I'm utilizing Python 3.5, and I might want to utilize the break command inside a function, yet I don't ability. I might want to utilize something like this:
def stopIfZero(a):
if int(a) == 0:
break
else:
print('Continue')
while True:
stopIfZero(input('Number: '))
I know, that I can also use the below code:
while True:
a = int(input('Number: '))
if a == 0:
break
else:
print('Continue')
What's more, in the event that you couldn't care less about the print('Continue') part, you can even do this in one line: while a != 0: a = int(input('Number: '))(as long as a was at that point alloted to some different option from 0) However, I might want to utilize a function, on the grounds that different occasions it could help a great deal.
Thank you