MCPcopy Create free account
hub / github.com/ndleah/python-mini-project / minion_game

Function minion_game

minionGame/game.py:23–70  ·  view source on GitHub ↗
(s)

Source from the content-addressed store, hash-verified

21
22
23def minion_game(s):
24 p1 = input("enter name of player 1 who is taken strings are starts from consonant: \n")
25 p2 = input("enter name of player 2 who is taken strings are starts from vowel: \n")
26 s.lower()
27 k =len(s)
28 v = []
29 c = []
30 vowel = 0
31 const = 0
32 for a in range(k):
33 if(check(s[a])):
34 v.append(a)
35 vowel += 1
36 else:
37 c.append(a)
38 const += 1
39 # print(c)
40 cPossible = []
41 vPossible = []
42 list = [c,v]
43 for i1 in list:
44 for value in i1:
45 l = value
46 i = 1
47 for _ in range(k-l):
48 temp = ''
49 for _ in range(k - (k - i)):
50 # print(s[l], end="")
51 temp = temp + s[l]
52 l += 1
53 if i1 == c:
54 cPossible.append(temp)
55 else:
56 vPossible.append(temp)
57 temp = ''
58 l = value
59 i += 1
60
61 print('overall score is given by:')
62 print(f'{p1} : {cPossible}')
63 print(f'{p2} : {vPossible}')
64
65 if len(cPossible) > len(vPossible):
66 print(f"{p1} wins with score {len(cPossible)}")
67 elif len(cPossible) < len(vPossible):
68 print(f"{p2} wins with score {len(vPossible)}")
69 else:
70 print("Draw")
71
72print(instruction)
73s = input("enter any String / single Word: \n")

Callers 1

game.pyFile · 0.85

Calls 1

checkFunction · 0.85

Tested by

no test coverage detected