-1

Here is my code in python This is the whole program in gist.

import random
    list= [ "Rock", "Paper", "Scissors" ]
    my_decision = random.choice(list)
    while True:
        game = input("Let's play Rock-Paper-Scissors Game! Please enter your decision: ")
        game.capitalize() 

this method don't work. When i enter rock or paper or scissors, it just failed to capitalize the first letter.

2 Answers2

0

You can use .title():

game = game.title()
print(game)

If you put "rock" it'll print out "Rock", and if you put in "two words", the script above will print out "Two Words".

kiyah
  • 1,502
  • 2
  • 18
  • 27
0

The method works fine here. You just aren't assigning it's result to game.

while True:
    game = input("Let's play Rock-Paper-Scissors Game! Please enter your decision: ")
    game = game.capitalize() # You need to assign to `game`

But more importantly while True is a infinite loop. Unless there is more code that you aren't showing. If not ensure you add break to exit the loop when you want.

Spencer Wieczorek
  • 21,229
  • 7
  • 44
  • 54