lundi 28 octobre 2019

Why "While" doesn't show anything after input command?

Just i did somethin wrong with while loop i supposed

After print menu section u can input something but than program ends.

print("Welcome in American Roulette")
rules=("blabla rules of roulette")
import random


while True:
    print("Enter 'rules' to show rules")
    print("Enter 'play' to play the game")
    print("Enter 'author' to show info about creator")
    print("Enter 'quit' to end the program")
    user_input=input()
    if user_input=="quit" or "Quit":
        break
    elif user_input=="rules" or "rule" or "Rules" or "Rule":
        print(rules)
    elif user_input=="play":
        bet=int(input("Place your bet\n"))
        amount=float(input("How much you want to bet?"))
        spin=random.randint(0,36)
        if bet>36:
            print("You need to bet number beetwen 0 and 36!")
        elif bet<0:
            print("You need to bet number beetwen 0 and 36")
        elif spin==bet:
            print("You won",amount*35)
            print("Now you have",start-amount+amount*35)
        else:
            print("You lose")
    elif user_input=="author":
        print("Jacob X")
    else:
        print("Unknown command")

Added some text here becouse my code is mostly code ffs




Aucun commentaire:

Enregistrer un commentaire