Write a program to print the following,
Input
The first line contains a string representing a scrambled word.
The second line contains some space-separated strings representing words guessed by the player.
Output
The output should be a single integer of the final score.
Explanation
scramble word = "tacren"
guessed words = ["trance", "recant"]
Since "trance" and "recant" both have length 6 then you score 54 pts each.
So the output is 108.
Sample Input1
tacren
trance recant
Sample Output1
108
while True:
word = input('Please, input your word => ').lower().strip()
if word.isdigit() == False and len(word) == 6:
break
else:
print('Please, input word which lenght = 6')
str = input('Please, input words whose chars can be in the scramble word\n').lower().strip().split()
total = 0
points = {
3: 1,
4: 2,
5: 3,
6: 4
}
for el in str:
flag = True
if el.isdigit() == False and 3 <= len(el) <= 6:
for c in el:
if c not in word:
flag = False
break
if flag:
total += points[len(el)]
if len(el) == 6:
total += 50
else:
continue
print('Your score =', total)
Comments
Leave a comment