Hello daniweb community,
i'm new to all this and i'm pretty happy that found this. Anyway i'm having sevral issues. Frist one is: my Python GUI (IDLE) won't open program.

def num(n):
    count=0
    while count <= abs(n):
	count = count + 1
	n= abs(n)/10
	print count
num(-23)

This code is problem. It's quite odd, but when i copy it at www.codepad.org, and try output
it's working fine. However, if i open it from notepad ++ (choosing to rn that python gui idle), and doesn't show any output in python active shell. (and this working for other programs well).
EDIT:
updated program so it works with negative values

Hello daniweb community,
i'm new to all this and i'm pretty happy that found this. Anyway i'm having sevral issues. Frist one is: my Python GUI (IDLE) won't open program.

def num(n):
    count=0
    while count <= abs(n):
	count = count + 1
	n= abs(n)/10
	print count
num(-23)

This code is problem. It's quite odd, but when i copy it at www.codepad.org, and try output
it's working fine. However, if i open it from notepad ++ (choosing to rn that python gui idle), and doesn't show any output in python active shell. (and this working for other programs well).
EDIT:
updated program so it works with negative values

I tried your code in IDLE, and it was rejected because of inconsistent indentation. You must not mix tab characters and spaces to indent python code. Configure your editor to insert 4 spaces instead of a tab when you hit the tab key. Here is the same code indented with spaces and it works

def num(n):
    count=0
    while count <= abs(n):
        count = count + 1
        n= abs(n)/10
        print count
num(-23)

In IDLE, it's: options -> configure idle -> Fonts/Tabs -> Indentation Width -> 4 .

worked. thanks

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.