Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def greeter():
- global name
- name = input("What's yer name?")
- greeting = "Howdy, " + name + "."
- print (greeting)
- def yourpay():
- try:
- name
- except:
- name = 'pardner'
- try:
- rate = float(input( "So, " + name + ", how much you make an hour?" ))
- except:
- rate = float(input( "Just gimme a number, in 'merican dollars." ))
- try:
- hours = float(input( "Yeah? An how many hours you work?" ))
- except:
- hours = float(input( "Just gimme the number of hours." ))
- pay = rate * hours
- if hours > 40:
- pay += 0.5 * rate * (hours - 40)
- reply = "So, with overtime I reckon you make $" + str(pay) + ", right?"
- else:
- reply = "So, I reckon you make $" + str(pay) + ", right?"
- print( reply )
- def tempconversion():
- celsius = input("What's the temperature in Celsius?")
- fahrenheit = float(celsius) * (9.0/5) + 32
- print ("Well, here in 'merica, we call that " + str(fahrenheit) + " degrees, got it?")
- def yourscore():
- rejection = "Ur dumb. I said a NUMBER, 'tween ZERO an' ONE. You fail."
- try:
- score = float(input( "Gimme a number 'tween zero an' one." ))
- except:
- print( rejection )
- return
- if score < 0 or score > 1:
- print ( rejection )
- return
- if score < 0.6:
- grade = "F"
- elif score >= 0.9:
- grade = "A"
- elif score >= 0.8:
- grade = "B"
- elif score >= 0.7:
- grade = "C"
- elif score >= 0.6:
- grade = "D"
- else:
- grade = "F"
- print( "Ur grade is " + grade + "." )
- def runningaverage():
- print( "Let's begin. The rules are, you input numbers, as many as you want. Then when you're done, say \"done\" and I'll give you the average." )
- total = 0
- i = 0
- average = 0
- maxx = None
- x = input( "Beep boop boop. Number please." )
- while x != "done":
- try:
- total += float(x)
- i += 1
- if i == 1:
- maxx = float(x)
- minx = float(x)
- if float(x) > maxx:
- maxx = float(x)
- if float(x) < minx:
- minx = float(x)
- average = float(total) / float(i)
- x = input( "Beep boop bop beep. Ready for another number." )
- except:
- x = input( "I said a number. Beep boop bip." )
- print( "Beep beep beep boop beep bip bip bop beeeeeeeep." )
- print( "The average is " + str(average) + "." )
- if maxx:
- print ( "The highest input is " + str(maxx) + "." )
- print ( "The lowest input is " + str(minx) + "." )
- return
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement