Nov-10-2019, 01:52 PM
Can I get some feedback on the below code. I've just started very recently and would like to learn python.
How could I go about making the below code better? what could I do differently ?
what should I consider when asking about continuing the game, So only 'y' / 'n' are accepted. And Rock Paper, Scissors can only be selected
I to add, the main game into a function, but was having issues?
How could I go about making the below code better? what could I do differently ?
what should I consider when asking about continuing the game, So only 'y' / 'n' are accepted. And Rock Paper, Scissors can only be selected
I to add, the main game into a function, but was having issues?
import random choice = 0 rps = ["Rock", "Paper", "Scissors"] cpu = random.choice(rps) start = 0 cont = "y" print("lets play rock paper scissors") print("Do you want to play Y/N") start = input() # input the intention to play the game Y while start == cont: print (rps) print ("Make your choice") print (cpu) choice = input() # choice is made if choice == cpu : print("well done") print("Do you want to play again. Y/N") cont = input() elif choice != cpu: print("You lose") print("Do you want to play again. Y/N") cont = input() break