15,936,887 members
1.00/5 (2 votes)
See more:
There are three players in a game with the following rules: Each player has to write n distinct words of size 3. Then, for each word: 1. If a word was written by only one player, that player 3 points, 2. If a word was written by two players then each of the two gets 1 point, 3. If a word was written by all three players then nobody gets any points. Print the final total of each player.

What I have tried:

Python
```n=int(input())
a=input()
b=input()
c=input()```

after that i am unable to think of logic.
Posted
Updated 11-Jan-23 6:44am
v2
Comments
Dave Kreskowiak 11-Jan-23 7:34am
The point of the assignment is to think about the problem and create the algorithm to solve it. This is an iterative process. You try something, test it, think about any problems, and make changes to solve those problems, and repeat until you've figured this out.

This is experience you have to gain by doing. Nobody can do it for you.

## Solution 1

The next step is validate the input: split[^] the input strings and verify that
• Each input string contains the required number of words.
• All the words have the required length.
After validation is accomplished then you have implement the 'assign the points' logic.
Start (maybe with paper and pencil) with a small input (e.g. `n=2`) and try to solve such a scenario, then generalize.
Ask for further help here when you are stuck.

## Solution 2

While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.

So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.

If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]

## Solution 3

Quote:
after that i am unable to think of logic.

If you can solve the game by hand, you have the logic, the algorithm.
Take a sheet of paper and a pencil. Make sample inputs and train to solve by hand.
You method to solve by hand is basically your algorithm.

- At a point, you will have to memorize all 3 letters words of all players.
- At another point you will have to compare the words.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Top Experts
Last 24hrsThis month
 OriginalGriff 40 Richard MacCutchan 10 Pete O'Hanlon 10 Member 16305744 -6 Member 16305931 -22
 OriginalGriff 720 Pete O'Hanlon 600 Richard Deeming 475 merano99 215 Dave Kreskowiak 180

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900