Python Coding - Vending machine - How to get the user to only enter certain coins? -


i'm doing controlled assessment on python. 1 of tasks create vending machine under criteria. i'm pretty bad python , i'm being idiot , doing wrong.

i want user input 10,20,50,1.00 coins. if user enters other these coins, want print "machine doesn't accept these coins".

this have far:

inp = input("enter coins, note: machine accepts 10, 20, 50 , 100 coins: ") value = [10,20,50,100] if inp != value:     print("machine doesn't accept these coins") else:     print("what buy?") 

here, want:

if any(int(coin) not in value coin in inp.split()):     print("machine doesn't accept these coins") 

what split input separate coins, converts them integers, (because items in values integers) checks if not in values, of course mean invalid.

finally, done until finds invalid coin (take @ any). @ that, print coins invalid. if not, continue else.


Comments

Popular posts from this blog

javascript - jquery or ashx not working -

opencv - DataType<cv::detail::deriv_type>::depth what is it used for -

python 3.x - Mapping specific letters onto a list of words -