[Tutor] (no subject)

David Rock david at graniteweb.com
Tue Feb 7 21:06:51 EST 2017


> On Feb 7, 2017, at 15:09, တာန္ခတ္သန္ <pkhattan at gmail.com> wrote:
> 
> 
> # RockPaperScissors
> 
> import random
> print ("Hello.. Welcome from Rock, Paper, Scissors Game!!\n"
>       +"Game instruction:\n"
>       +"You will be playing with the computer.\n"
>       +"You need to choose one of your choice: Rock, Paper or Scissors.\n"
>       +"Enter 'e' to exit the game.\n")
> 
> game_command = {"r":"Rock","p":"Paper","s":"Scissors","e":"Exit"}
> 
> 
> score = 0
> player = 0
> try:
>    while player == 'r' and player == 'p' and player == 's':
> 

There are two major things that you need to address first.

1. You never ask for user input before starting your while loop
2. Your while loop is testing for r, p, and s to all be equal to each other and set, which is not what you want to test.

Basically, your while loop is immediately false as soon as you run your script.  You need to rework your logic to test the player’s value.


— 
David Rock
david at graniteweb.com






More information about the Tutor mailing list