lundi 6 mai 2019

How to ask Question by if statement via timeout

is there any way for ask question by if statement and after afew sec if user didnot give any answer , if state use a default answer?

inp = input("change music(1) or close the app(2)")

if inp = '1':
    print("Music changed)

elif inp = '2':
    print("good by")

in this case if user dont give any answer after 30 sec by default if statement choose number 3

Aucun commentaire:

Enregistrer un commentaire