Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- print('''There are n people in the circle. You give the knife to one of them, he stabs person on the right and
- gives the knife to the next person. What will be the number of whoever
- will be left alive?'''
- )
- pplList = []
- numOfPeople = int(input('How many people are there in the circle?'))
- for i in range(1, (numOfPeople + 1)):
- pplList.append(i)
- print(pplList)
- while len(pplList) > 1:
- for i in pplList:
- if i % 2 == 0:
- del pplList[::i]
- print(f'The number of person which survived is {pplList[0]+1}')
- break
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement