0

I'm trying to make this code, and I need to make the precent show the whole number in the f-string instead of it saying 9e-06% or something like that. (Python)

import random
x = random.randint(1, 1000000)
y = float(100000000)
precent = float(0)
while x != y:
  y = float(input('Number from 1 to 1000000: '))
  if x != y:
    print('Wrong, try again')
  precent = precent+0.000001
wow = f'Wow! That only had a {precent}% chance of happening!'
print(wow)

0 Answers0