Homework due in 1 hour - HELP!

I know, I fucked up. It's almost finals week, so I'm pretty stressed out, but that shouldn't be an excuse.

My code is supposed to calculate the probability of the birthday problem: 23 random people in a room have around an average of 50% chance of sharing a birthday.

However, whenever I input 23 in my code, it keeps giving me an average of 0.65 to 0.69.

This is my code pasted. I dont know how to paste it in the code format, but I hope this will suffice.

(heres a link incase the code doesnt show up properly: https://repl.it/@AbdullahAlmutou/Lab-5-Birthday-paradox )

import math import random

ft = [] k = 0 ss=0 while(k < 365) : ft.append(0) k = k+1

print("Please type in how many people are in the class: ") n = int(input())

success = 0 trials = 0

while(trials < 10000) : k=0

while(k < 365) : ft[k] = 0 k = k+1

k = 0 while(k < n): x = math.floor(364*random.random()) + 1 ft[x]=ft[x]+1 k = k+1

k = 0 while(k < 365): if ft[k]>=2: success=success+1 k = k+1

trials = trials+1

print("The probability that in a class of ", end="") print(n , end="") print(" people, at least two have the same birthday is: " , end="") print(success/trials)

/r/learnpython Thread Parent