Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- def main():
- while True:
- try:
- fraction = input('Fraction: ')
- parts = fraction.split('/')
- numer = int(parts[0])
- denom = int(parts[1])
- if numer>denom:
- continue
- pct = round((numer / denom) * 100)
- except ValueError:
- continue
- except ZeroDivisionError:
- continue
- except:
- continue
- else:
- if pct >= 99:
- print('F')
- elif pct <= 1:
- print('E')
- else:
- print(f'{pct}%')
- break
- main()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement