Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- while True: ##loop forever
- try: #tries the lines
- x = input('enter paitent weight in Kg>') #get the users input
- x = float(x) # converts the input to a float (floating point number, example: 0.1)
- break #break out of the while loop
- except: #if the tried lines had an error then this runs instead
- print("sorry {} was not a number, please try again".format(x)) #simple print statement with variables
- if isinstance(x, float): #checks to make sure a variable is of a certian type
- print(x)#prints the varialbe
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement