Mar-18-2019, 06:15 PM
Hi everyone.... first time poster here and complete newbie to Python.
I started reading up on Python about a week ago so very early days of learning it.
I was on a plane on Saturday morning and had an idea to make a little app to keep score for scrabble games using the things I had leant already. My wife always wins, so I might need to add a little 'feature' that always makes player 'Rich' win :-)
This is as far as I have got so far..... there are 'elif' for 3 and 4 players too just not included in the below as I wanted to get 2 playuer scoring working first.
I would like to add the following once I know how...
Thanks for any input you can give me.
Rich
I started reading up on Python about a week ago so very early days of learning it.
I was on a plane on Saturday morning and had an idea to make a little app to keep score for scrabble games using the things I had leant already. My wife always wins, so I might need to add a little 'feature' that always makes player 'Rich' win :-)
This is as far as I have got so far..... there are 'elif' for 3 and 4 players too just not included in the below as I wanted to get 2 playuer scoring working first.
#Seems I have to define player*scores otherwise I get errors. player1score = int(0) player2score = int(0) player3score = int(0) player4score = int(0) p1go = 0 p2go = 0 p3go = 0 p4go = 0 number_of_players = input('How many players?: ') if number_of_players == '2': player1 = input('Enter name for player 1: ') player2 = input('Enter name for player 2: ') print('%s, %s.... lets play scrabble!!!' %(player1, player2)) print(' ') # I don't like this line below here.... while p1go != 1000: #I don't like this f'{} coding... must be a nice way to do that. I would like to use the %s method but I does not seem to work. p1go = int(input(f'{player1} Score?')) p2go = int(input(f'{player2} Score?')) player1score = (player1score + p1go) player2score = (player2score + p2go) print(" ") print(player1, ':', player1score) print(player2, ':', player2score) print('RUNNING TOTAL') print(' ')Is there any better ways to code the above?
I would like to add the following once I know how...
- A way to return a "invalid input" if bad information is inputed by the user.
- A way to end the game and print out final scores
- A way to allow for deducting remaining tiles at the end of the game... it is possible to just enter a negative number but I feel there must be a better way.
- Much further down the line it would be nice to add a simple GUI to it.
Thanks for any input you can give me.
Rich