Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Flow Control Help
#5
Here's my suggestion:
import random, sys
Wins = 0 
Losses =  0
Ties = 0 
Acceptable = ['R', 'P', 'S', 'Q']

print ('\n\nLets play Rock, Paper, Scissors!')
while True :
	print ("0 Wins, 0 Losses, 0 Ties")
	print ("Enter your move: (R)ock (P)aper (S)cissors or (Q)uit")
	answer = input (' >>> ')
	if answer != '' :
		Player = answer [0].upper ()
	if Player == "R":
		print ("ROCK vs...")
	elif Player == "P":
		print ("PAPER vs...")
	elif Player == "S":
		print ("SCISSOR vs...")
	elif Player == "Q":
		print ("Thanks for playing :)")
		sys.exit()
	else :
		print (f'"{answer}" is not a valid choice.')
Reply


Messages In This Thread
Flow Control Help - by RoadToSensei - Feb-13-2022, 08:11 PM
RE: Flow Control Help - by menator01 - Feb-13-2022, 08:15 PM
RE: Flow Control Help - by RoadToSensei - Feb-13-2022, 09:02 PM
RE: Flow Control Help - by deanhystad - Feb-13-2022, 10:38 PM
RE: Flow Control Help - by BashBedlam - Feb-14-2022, 01:51 AM
RE: Flow Control Help - by deanhystad - Feb-14-2022, 08:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Alicat Flow Meter data acquisition marenr 0 420 Sep-29-2023, 10:59 PM
Last Post: marenr
  Node Flow Generation in Python Linenloid 0 735 Feb-21-2023, 07:09 PM
Last Post: Linenloid
  Understanding Raspberry PI RTS/CTS flow control zazas321 2 3,799 Oct-30-2020, 09:55 AM
Last Post: zazas321
  Understanding Raspberry PI RTS/CTS flow control zazas321 0 1,595 Oct-30-2020, 08:02 AM
Last Post: zazas321
  Reproducing assignment with min cost flow in networkx mntfr 0 2,211 Jun-13-2019, 04:06 PM
Last Post: mntfr
  Find Maximum Flow for graph with infinite capacities Dav 6 4,480 Apr-16-2019, 02:08 PM
Last Post: Dav
  program flow advice sampazzer 2 3,225 Aug-05-2017, 09:34 PM
Last Post: sampazzer
  Trouble with general code flow JCN 1 3,483 May-26-2017, 01:27 PM
Last Post: sparkz_alot

Forum Jump:

User Panel Messages

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