LU06.L09: Only positives

def main_break():
    while True:
        number = int(input('Give a number:\n'))
        if number > 0:
            print(number * number)
        elif number == 0:
            break
        else:
            print('Unsuitable number')
 
def main_continue():
    number = 1
    while number != 0:
        number = int(input('Give a number:\n'))
        if number > 0:
            print(number * number)
        elif number == 0:
            continue
        else:
            print('Unsuitable number')
 
def main():
    number = int(input('Give a number:\n'))
    while number != 0:
        if number > 0:
            print(number * number)
        elif number < 0:
            print('Unsuitable number')
        number = int(input('Give a number:\n'))
 
if __name__ == '__main__':
    main()
  • modul/archiv/m319python/learningunits/lu06/loesungen/onlypositives.txt
  • Last modified: 2023/11/13 08:56
  • by 127.0.0.1