def petrol():
while True:
try:
fract = input('Enter fraction here ')
x , y = fract.split('/')
a = int(x)
b = int(y)
k = int(a*100/b)
if 0<= k <=1:
print('E')
if 1 <= k <=99:
print(k,"%", sep ='')
if 99< k<=100:
print("F")
if k > 100:
return False
except (ValueError, ZeroDivisionError ,):
pass
I’m trying to get a prompt when percentage exceeds 100 and no prompt when the percentage is under 100, but the opposite is happening
I am a beginner and have only done a few classes so answer accordingly if possible
New contributor
Manansh Arora is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.