所以我试图做一个程序,用户可以输入命令到达他们要去的地方(启动另一个程序等),但是当他们输入一个命令时,他们可以到达该部分的末尾,程序停止运行可以循环回特定行吗?
command = input('Please enter a command or enter help for a list of commands:')
if command in ['help', 'Help', 'HELP', '?']:
print("\t music \t Listen to music (XXXX songs)")
print("\t")
print("")
if command in ['music', 'Music']:
print("Genres:")
print("Rap")
print("Rock")
print("Pop")
print ("Country")
print("\t\t")
genre = input('What genre do you want to listen to?:')
if genre in ['Rap', 'rap', 'RAP']:
print("Songs (alphabetical order):")
if genre in ['Rock', 'rock', 'ROCK']:
print("Songs (alphabetical order):")
if genre in ['Pop', 'pop', 'POP']:
print("Songs (alphabetical order):")
所以我的问题是我怎么可以让它回到顶部(命令)
使用'while'循环,直到他们选择退出 –
好感谢虐待尝试了这一点 –