Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Syntax not exist
#1
Hi! Please help me. I got python 3.xx and I got error message "Syntax is not exist" for line 20. please help.


#!/usr/bin/env python2

#Linux user & Developer presents : Rock. Paper, Scissors: The video Game

import random
import time

rock = 1
paper = 2
scissors = 3

names = {rock: "Rock", paper: "Paper", scissors: "Scissors" }
rules = {rock: scissors, paper: rock, scissors: paper }

player_score = 0
computer_score = 0

def start():
print ("Let's play a game of Rock, Paper, Scissors")
While game ():
pass
scores ()

def game ():
player = move ()
computer = random.randint(1,3)
result (player, computer)
return play_again()

def move ()
while True:
print
player = raw_input("Rock = 1\nPaper = 2\nScissors = 3\nMake a move: ")

try:
player = int(player)
if player in (1,2,3):
return player
except ValueError:
pass
print ("Oops! I don't understand that. Please enter 1,2,3.")


def result (player, computer):
print ("1...")
time.sleep(1)
print ("2...")
time.sleep(1)
print ("3...")
time.sleep(0.5)
print ("Computer threw {0}!". format(names[computer]))
global player_score, computer_score
if player == computer:
print ("Tie game")
else:
if rules[player] == computer:
print ("Your victory has been assured")
player_score += 1
else:
print ("The Computer laughs as you realise you have been defeated")
computer_score += 1

def play_again ():
answer = raw_input ("Would you like to play again? y/n: ")
if answer in ("y", "Y", "yes", "Yes", "ofcourse!"):
return answer
else :
print ("Thank you very much for playing our game. See you next time!")

def scores():
global player-score, computer_score
print ("High Scores")
print ("Player: ", player_score)
print ("Computer: ", computer_score)

if __name__ == '__main__':
start()
Reply
#2
“while” is lowercase in Python.
I'm not 'in'-sane. Indeed, I am so far 'out' of sane that you appear a tiny blip on the distant coast of sanity. Bucky Katt, Get Fuzzy

Da Bishop: There's a dead bishop on the landing. I don't know who keeps bringing them in here. ....but society is to blame.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  UndefinedEnvironmentName: 'extra' does not exist in evaluation environment EarthAndMoon 3 1,663 Oct-09-2023, 05:38 PM
Last Post: snippsat
  check if a file exist on the internet and get the size kucingkembar 6 1,756 Apr-16-2022, 05:09 PM
Last Post: kucingkembar
  SQLALCHEMY - Column doesn't exist jamesaarr 9 7,497 Nov-04-2021, 09:20 AM
Last Post: ndc85430
  pathlib destpath.exists() true even file does not exist NaN 9 4,645 Dec-01-2020, 12:43 PM
Last Post: NaN
  Shutil attempts to copy directories that don't exist ConsoleGeek 5 4,512 Oct-29-2019, 09:26 PM
Last Post: Gribouillis
  get value if it's exist [python] senait 1 1,750 Aug-21-2019, 06:47 AM
Last Post: buran
  Python says module doesn't exist... I say it does! EricMichel 2 3,069 May-14-2019, 03:26 AM
Last Post: EricMichel
  pathlib: resolving a path that does not exist Skaperen 6 5,460 Sep-08-2018, 12:25 AM
Last Post: Skaperen
  Does stack overflow exist in python ? sylas 3 3,784 Jul-23-2017, 09:21 AM
Last Post: sylas
  Python 3.6 Installed, But Doesn't Exist Atomike 3 46,839 Feb-27-2017, 09:44 PM
Last Post: snippsat

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020