################### # Homework 1.6 # Adam Brandeis # 02/09/2014 # Raise the first number to the power of the second number # (you will have to convert them to numbers to do the math). # Take the resulting number and determine its string length with len() # (you will have to convert it to a string to get its string length). # Print a line with a ======== border exactly the length of the resulting number # (use the * operator to repeat the string '='). On the next line, print the number. # Then on a third line print a ======== border the same length as the first. ################### #!/usr/bin/python input_1 = raw_input(' Please enter a positive integer: ') input_2 = raw_input(' Please enter another positive integer: ') print " The first number you entered is " + input_1 + " and the second number is " + input_2 + "." #convert new_input_1 = int(input_1) new_input_2 = int(input_2) power = new_input_1**new_input_2 power_len = str(power) print " "+"="*len(power_len) print " ",power print " "+"="*len(power_len)
Run
Reset
Share
Import
Link
Embed
Language▼
English
中文
Python Fiddle
Python Cloud IDE
Follow @python_fiddle
Browser Version Not Supported
Due to Python Fiddle's reliance on advanced JavaScript techniques, older browsers might have problems running it correctly. Please download the latest version of your favourite browser.
Chrome 10+
Firefox 4+
Safari 5+
IE 10+
Let me try anyway!
url:
Go
Python Snippet
Stackoverflow Question