Hello, just joined the forum
I am going through the pdf Automating the boring stuff with Python and I am stuck on this little program.
I don't what I am doing wrong. I did whittle the code down to show the error.
Any help is appreciated.
Oops, found my error I forgot the colon after the if statement. You don't need colons at the end of if statement in C : )
I get the error :
Traceback (most recent call last):
File "C:\Users\Joe\Documents\Python\PcOfPy.py", line 2
if number % 2 == 0
^
SyntaxError: invalid syntax
I am going through the pdf Automating the boring stuff with Python and I am stuck on this little program.
I don't what I am doing wrong. I did whittle the code down to show the error.
Any help is appreciated.
Oops, found my error I forgot the colon after the if statement. You don't need colons at the end of if statement in C : )
I get the error :
Traceback (most recent call last):
File "C:\Users\Joe\Documents\Python\PcOfPy.py", line 2
if number % 2 == 0
^
SyntaxError: invalid syntax
def collatz(number):
if number % 2 == 0
number = number //2
print(number)
return number
x= 10
collatz(x)
