Noob here just a few weeks in, So after all the reading and videos I decided it was time to do more writing.
I got side tracked and somehow ended up trying to take a variable and turn it into a float that I could check to see if it was between two floats values.
I seen where someone used pylab frange for something and got it to work right I think. Keep in mind I m very new. How do I clean this up or make a function,
Where do I go from here or put it to use....
I got side tracked and somehow ended up trying to take a variable and turn it into a float that I could check to see if it was between two floats values.
I seen where someone used pylab frange for something and got it to work right I think. Keep in mind I m very new. How do I clean this up or make a function,
Where do I go from here or put it to use....
import pylab as pl # range scale to determine outcome of a weighted purchase avg_screwed = pl.frange(0.00,6.0,0.1) avg_below = pl.frange(6.0,7.0,0.1) avg_weight = pl.frange(7.0,7.50,0.1) avg_above = pl.frange(7.50,8.0,0.1) avg_extreme = pl.frange(8.0,99.0,0.1) #get users purchase weight input user_weight = float(input('What was the weight: ')) #possible outcomes to inform the user of there purchase worth if user_weight in avg_weight: print("You money was well spent.") elif user_weight in avg_above: print('Nice, You did really well!') elif user_weight in avg_extreme: print("WOW! Someone liked you.") elif user_weight in avg_below: print('You have been shorted.') elif user_weight in avg_screwed: print('Turn around and bend over!!!!!!') else: print('I do not understand.')