def main(): pounds = float(input("How much do you weigh (pounds)? ")) distance = float(input("How far away is your professor (meters)? ")) object = input( "Will you throw a rotten (t)omato, banana cream (p)ie, (r)ock, (l)ight saber, or lawn (g)nome? " ) massSkater = float(funcs.poundsToKG(pounds)) massObject = float(funcs.getMassObject(object)) velocityObject = float(funcs.getVelocityObject(distance)) velocitySkater = float( funcs.getVelocitySkater(massSkater, massObject, velocityObject)) velocitySkater = round(velocitySkater, 3) print() if massObject <= 0.1: print("Nice throw!", "You're going to get an F!") elif 0.1 < massObject <= 1.0: print("Nice throw!", "Make sure your professor is OK.") elif massObject > 1.0: if distance < 20: print("Nice throw!", "How far away is the hospital?") elif distance >= 20: print("Nice throw!", "RIP professor.") print("Velocity of skater:", format(velocitySkater, ".3f"), "m/s") if velocitySkater < 0.2: print("My grandmother skates faster than you!") if velocitySkater >= 1.0: print("Look out for that railing!!!")
def main(): pounds = int(input('How much do you weigh (pounds)? ')) massSkater = poundsToKG(pounds) distance = int(input('How far away is your professor (meters)? ')) massObject = input( 'Will you throw a rotten (t)omato, banana cream (p)ie, (r)ock, (l)ight saber, or lawn (g)nome? ' ) mass = getMassObject(massObject) velObject = getVelocityObject(distance) SkaterVelocity = getVelocitySkater(massSkater, mass, velObject) if mass <= 0.1: print(x, "You're going to get an F!") elif mass > 0.1 and mass <= 1.0: print(x, "Make sure your professor is OK.") elif mass > 1.0: if distance < 20: print(x, "How far away is the hospital?") else: print(x, "RIP professor.") print('Velocity of skater: %.3f m/s' % SkaterVelocity) if SkaterVelocity < 0.2: print("My grandmother skates faster than you!") elif SkaterVelocity >= 1.0: print("Look out for that railing!!!") else: SkaterVelocity = 0
def main(): pounds=float(input("How much do you weigh (pounds)? ")) distance=float(input("How far away your profesor is (meters)? ")) object=(input("Will you throw a rotten (t)omato,banana cream (p)ie, (r)ock, (l)ight saber, or lawn (g)nome? ")) massObject=funcs.getMassObject(object) # Get the mass of the object massSkater=funcs.poundsToKG(pounds) # Convert pounds to kg for skater velObj=funcs.getVelocityObject(distance) # Get velocity of obj velocitySkater=funcs.getVelocitySkater(massSkater,massObject,velObj) # Get velocity of obj # Display comment based on the mass of thrown obj and distance thrown if (massObject<=.1): print("Nice throw! You're going to get an F!") elif((massObject>.1) and (massObject<=1.0)): print("Nice throw! Make sure your professor is OK.") elif (massObject>1.0): if (distance<20): print("Nice throw! How far away is the hospital?") elif (distance>=20): print("Nice throw! RIP professor.") # Print velcoity of skater print("Velocity of Skater:",velocitySkater,"m/s") # Display comment based on velocity if (velocitySkater<.2): print("My grandmother skate faster than you!") elif (velocitySkater>=.2)and (velocitySkater<1.0): pass elif (velocitySkater>=1.0): print("Look out for that railing!!!")
def main(): pounds = float(raw_input('How much do you weigh (pounds)? ')) distance = float(raw_input('How far away is your professor (meters)? ')) object = raw_input( 'Will you throw a rotten (t)omato, banana cream (p)ie, (r)ock, (l)ight saber, or lawn (g)nome? ' ) massSkater = funcs.poundsToKG(pounds) massObject = funcs.getMassObject(object) velObject = funcs.getVelocityObject(distance) velSkater = funcs.getVelocitySkater(massSkater, massObject, velObject) if massObject <= 0.1: statement1 = "You're going to get an F!" elif massObject <= 1.0: statement1 = "Make sure your professor is OK." else: if distance < 20: statement1 = "How far away is the hospital?" else: statement1 = "RIP professor." if velSkater < 0.2: statement2 = "My grandmother skates faster than you!" elif velSkater >= 1.0: statement2 = "Look out for that railing!!!" else: statement2 = "" print "\nNice throw! " + statement1 print "Velocity of skater: %.3f m/s" % velSkater if statement2: print statement2
def main(): #Ask how much skater weighs to get massSkater massSkater = int(input("How much do you weigh (pounds)? ")) #use poundsToKG function to get their weight in kilograms mass = funcs.poundsToKG(massSkater) #Ask how far skater is from professor to get distance distance = int(input("How far away is your professor (meters)? ")) #use distance in function getvelocityObject velObject = funcs.getVelocityObject(distance) object = str( input( "Will you throw a rotten (t)omato, banana cream (p)ie, (r)ock, (l)ight saber, or lawn (g)nome? " )) massObject = funcs.getMassObject(object) #I have the massObject skatervelocity = funcs.getVelocitySkater(mass, massObject, velObject) #now I have all the variables... print the ending! print("\nNice throw! ", end="") if massObject <= 0.1: print("You're going to get an F!") elif massObject > 0.1 and massObject <= 1.0: print("Make sure your professor is OK.") elif massObject > 1.0 and distance < 20: print("How far away is the hospital?") elif massObject > 1.0 and distance > 20: print("RIP professor.") #this is the first line of the comments if skatervelocity == "-nan": print("Velocity of skater: -nan m/s") elif skatervelocity != "-nan": print("Velocity of skater:", "%.3f" % skatervelocity, "m/s") if skatervelocity < 0.2: print("My grandmother skates faster than you!") elif skatervelocity >= 0.2 and skatervelocity < 1.0: return "" elif skatervelocity >= 1.0: print("Look out for that railing!!!")
def main(): weight = float(input("How much do you weigh (pounds)? ")) distance = float(input("How far away is your professor (meters)?")) item = input( " Will you throw a rotten (t)omato, banana cream (p)ie, (r)ock, (l)ight saber, or lawn (g)nome? " ) skatermass = funcs.poundsToKG(weight) massObj = funcs.getMassObject(item) velocityObj = funcs.getVelocityObject(distance) velocitySkaterraw = funcs.getVelocitySkater(skatermass, massObj, velocityObj) #determining the response based on the returned mass massresponse = "" if (massObj <= 0.1): massresponse = "You're going to get an F!" elif (massObj > 0.1 and massObj <= 1.0): massresponse = "Make sure your professor is OK" elif (massObj > 1.0 and distance < 20): massresponse = "How far away is the hospital?" elif (massObj > 1.0 and distance >= 20): massresponse = "RIP professor." #converting skater velocity to 3 decimal places velocitySkater = round(velocitySkaterraw, 3) #determining the response based on the returned velocity skaterresponse = "" if (velocitySkater < 0.2): skaterresponse = "My grandmother skates faster than you!" elif (velocitySkater >= 0.2 and velocitySkater < 1.0): skaterresponse = "" elif (velocitySkater >= 1.0): skaterresponse = "Look out for that railing!!!" #printing the outputs print() print("Nice throw!", massresponse) print("Velocity of skater:", velocitySkater, "m/s") print(skaterresponse)
def test_vo_1(self): self.assertEqual(funcs.getVelocityObject(2), 3.1304951684997055)
def test_getVelocityObject_3(self): self.assertAlmostEqual(funcs.getVelocityObject(15.0), 8.573214099)
def test_getVelocityObject_2(self): self.assertAlmostEqual(funcs.getVelocityObject(10), 7.0)
def test_getVelocityObject(self): self.assertAlmostEqual(funcs.getVelocityObject(0), 0.0)
def test_getVelocityObject(self): self.assertAlmostEqual(funcs.getVelocityObject(25), 11.0679718) self.assertAlmostEqual(funcs.getVelocityObject(45), 14.8492424)
def test_getVelocityObject(self): self.assertAlmostEqual(funcs.getVelocityObject(30), 12.12435565298) self.assertAlmostEqual(funcs.getVelocityObject(96), 21.68870673876)
def test_getVelocityObject(self): answer11 = funcs.getVelocityObject(3) self.assertAlmostEqual(answer11, 3.834057903) answer12 = funcs.getVelocityObject(0) self.assertEqual(answer12, 0)
def test_getVelocityObject(self): self.assertEqual(funcs.getVelocityObject(10), 7) self.assertAlmostEqual(funcs.getVelocityObject(20), 9.8994949)