I am making a coin flip simulator where the user inputs how many flips they would like to simulate. After the results are printed out I would like it to print the longest streak of heads and the longest streak of tails.
def coin_toss():
turn = 1
Heads = 0
Tails = 0
index = 1
number_of_flips = int(input('How many flips? '))
for _ in range(number_of_flips):
flip = randint(1,2)
if flip == 1:
print(f'Result {index}: Heads')
Heads += 1
index+=1
if flip == 2:
print(f'Result {index}: Tails')
Tails +=1
index +=1
print('\n')
print(f'Number of Heads: {Heads}')
print(f'Number of Tails: {Tails}')
print('\n')
replay = input('Would you like to play again? y/n ')
while turn == 1:
coin_toss()
if replay == 'y':
pass
else:
turn == 0