import random

import random

numberOfStreaks=0
for i in range(0,100):
list1=[]# List that contains 100 values of 0 and 1. Here 0 is for tail and 1 is for head
for j in range(0,100): # Loop to generate 100 values
temp= random.randint(0,1)
list1.append(temp)

# Count no. of consecutive head or tail
head=0
tail=0
# Iterate in list
for x in list1:
if(head==6 or tail==6):
numberOfStreaks+=1
break
elif(x==1):
head+=1
tail=0
else:
tail+=1
head=0
# Output
print(“Chances of streak: “, numberOfStreaks/100.0)

I need help with indenting this code properly

Complete Answer:

Get Instant Help in Homework Asap
Get Instant Help in Homework Asap
Calculate your paper price
Pages (550 words)
Approximate price: -
Open chat
1
Hello 👋
Thank you for choosing our assignment help service!
How can I help you?