goto in Python

 Hey guys, here's the code (it's not exactly a goto statement but works same):


def repeat():
a = int(input('\nEnter a number: '))
b = int(input('Enter another number: '))
com = [a,b]

print(f'\nSum: {sum(com)}')

ch = input('\nDo you want to repeat?(y/n): ')
ch = ch.upper()

if ch == 'Y':
repeat()

else:
exit()

repeat()

Comments

Popular Posts