Ryan Peng Assignment 6 1. Input n1=float(raw_input("What is your first number?")) n2=float(raw_input("What is your second number?")) if n1>n2: print"The first number is larger than the second." elif n1<n2: print"The second number is larger than the first." else: print"The numbers are equal." Output >>> What is your first number?20 What is your second number?57 The second number is larger than the first. >>> ================================ RESTART ================================ >>> What is your first number?28 What is your second number?12 The first number is larger than the second. >>> ================================ RESTART ================================ >>> What is your first number?90 What is your second number?90 The numbers are equal. >>> 2. Input radius=int(raw_input("What is the radius of a circle?")) diameter=radius*2 print"The diameter of the circle is", diameter Output >>> What is the radius of a circle?54 The diameter of the circle is 108 >>> 3. Input number=float(raw_input("State a number.")) squared=number*number cubed=number*number*number print"This number squared is",squared print"This number cubed is",cubed Output >>> State a number.5 This number squared is 25.0 This number cubed is 125.0 >>> 4. Input grade=int(raw_input("What is your number grade?")) if grade>=95: print"You have a 7." elif grade>=90: print"You have a 6." elif grade>=85: print"You have a 5." elif grade>=80: print"You have a 4." elif grade>=75: print"You have a 3." elif grade>=70: print"You have a 2." elif grade>=65: print"You have a 1." else: print"You have a 0." Output >>> What is your number grade?96 You have a 7. >>> ================================ RESTART ================================ >>> What is your number grade?90 You have a 6. >>> ================================ RESTART ================================ >>> What is your number grade?87 You have a 5. >>> ================================ RESTART ================================ >>> What is your number grade?84 You have a 4. >>> ================================ RESTART ================================ >>> What is your number grade?77 You have a 3. >>> ================================ RESTART ================================ >>> What is your number grade?71 You have a 2. >>> ================================ RESTART ================================ >>> What is your number grade?66 You have a 1. >>> ================================ RESTART ================================ >>> What is your number grade?50 You have a 0. >>> 5. Input n1=int(raw_input("What is your first number?")) n2=int(raw_input("What is your second number?")) mid=(n1+n2)/2 print"The midpoint of the two numbers is", mid Output >>> What is your first number?50 What is your second number?100 The midpoint of the two numbers is 75 >>> 6. Input money=int(raw_input("What is the amount you want to borrow?")) month=int(raw_input("How many months do you want the loan for?")) monthpay=money/month print"You monthly payment is $", monthpay Output >>> What is the amount you want to borrow?75500 How many months do you want the loan for?12 You monthly payment is $ 6291 >>>