I would like to utilise random and range together in this code. Im trying to figure how the user can input a weight unit (kg or pounds) and the output would be a range of weights between 10 and 200, and only generate say 100 random weights between that range. I think its only a small fix, I just can't nut it out where it should go.
Code so far..
import random
weight_unit = input("Enter the units: , kg or pounds")
while weight_unit != 'pounds' or weight_unit != 'kg':
if weight_unit =='pounds':
for i in range(10,200):
print("weight_unit" , i+1, '=', i,'pounds')
break
elif weight_unit == 'kg':
for i in range(10,200):
print("weight_unit ", i+1, "=" ,round(i/2.204,2),"kg")
break
else :
weight_unit = input("Incorrect input. Reinput the unit kg or pounds")
Aucun commentaire:
Enregistrer un commentaire