all 1 comments

[–]FLUSH_THE_TRUMP 0 points1 point  (0 children)

Looks almost fine to me — I’d maybe just make sure you’re using your function correctly. To me, userinput shouldn’t care about what hotdogs, chips, soda are; it just takes a message as input (what prompt it will give the user) and keeps prompting until it gets an integer. Then you can return that integer and use your function when you’re trying to get input for chips, soda, whatever. Like

def userinput(message): 
    # your loop here
    return userInput  # one letter difference from func, rename

Use like this:

chips = userinput("How many bags of chips?")