Mar-09-2019, 03:04 PM
You never
In a function can use
indentation is 4-space not 8.
break
out of the loop.In a function can use
return
as return always get value out and exit function. indentation is 4-space not 8.
def main(): total = 0 number = input('Enter a number : ') while number != '': total += int(number) number = input('Enter a number : ') return f'Sum of all input number is : {total}' if __name__=='__main__': print(main())