Saturday, October 1, 2011

Test 0004: solving for a hypotenuse

#October 1, 2011
#Python 3.2 code by Carla Fuqua
#purpose: to allow a user to solve for a hypotenuse

#ask for values and assign to integers floats
w=float(input("Enter the width: "))
h=float(input("Enter the height: "))

#Pythagorean Theorem
hyp=(w*w+h*h)**(0.5)

#show hypotenuse
print('The hypotenuse is:',hyp)

#sweet!

Test 0003: receiving and processing user input

#October 1, 2011
#Python 3.2 code by Carla Fuqua
#purpose: to receive input and process it

#getting the input from the user
firstName=input('Enter your first name: ') #must add a space manually
lastName=input('Enter your last name: ')

#returning as output
print('''\nHello,''',firstName,lastName+"!") #commas turn into spaces, +'s do not
print(firstName+""", you have successfully completed this test.\
\nThank you for your participation.""")

Friday, September 30, 2011

Test 0002: finding a hypotenuse

#September 30, 2011
#Python 3.2 code by Carla Fuqua
#purpose: to find a hypotenuse

#again, input not yet learned

#assign arbitrary variables
width=3
length=4

#remember algebra class
#remember syntax for exponents
hyp=(width*width+length*length)**(1/2)

#print results
print (hyp)

#redefine variables as necessary :)

#...

#(basically just code for the Pythagorean Theorem)

Test 0001: reformatting data

#September 30, 2011

#Python 3.2 code by Carla Fuqua
#purpose: reformatting names "from a list"

#input from list not yet learned

#assign arbitrary variables
x="Carla"
y="Fuqua"

#print results; format Last, First
print (y+", "+x)

#continuing with the theory: to display results from an actual list, number each item in the list?
#print (number)
#then print (number+1) over and over
#loops? je ne sais pas!