Nov-26-2019, 10:19 PM
Hello everyone,
I am working on my school homework that is quite easy for some professional, but I have troubles with few things that I tried to change but obviously I can't make them work.
After making this, the program tells me
I am working on my school homework that is quite easy for some professional, but I have troubles with few things that I tried to change but obviously I can't make them work.
p=[] def number(): c=1 try: x=int(input("Insert integer number:")) p.append(x) for z in p: nn=p.sort(p) #nn=new number print(p,"->",nn) except ZeroDivisionError: print("You cant divide by Zero") c=0 except ValueError: print("You didn't insert integer number") c=0 return c while c!=0: number()The point of this exercise is to insert numbers until we insert 0, than every inserted number - every digit of this number sort in order from the biggest to smallest.
After making this, the program tells me
Output:1# name "c" is not defined - when I define c as 1 (c=1), next problem income
2# File "/Users/adam/Desktop/python/kod2.py", line 12, in cisla
nc=p.sort(z)
TypeError: sort() takes no positional arguments
- after 2nd problem I tried to delete "p" from parentheses and than my program did this:Output:Insert integer number: --I inserted 23---
program did this:
[23] --> None
Does anyone have any solution how to solve this? I tried almost everything...