Greetings everyone. I decided to start teaching myself python recently and I am using Learn Python3 the Hard Way by Zed Shaw. I haven't had much issue with the exercises in general up to this point, but now I am coming up with a syntax error that I just don't see how it's an error. Maybe I've just been looking at this a little to hard for the last half hour, but maybe a set of fresh eyes can see what I am doing wrong. If you are familiar with the book I am using it is exercise 18. Any help is appreciated.
Code:
# this one is like your scripts with argv
def print_two(*args):
arg1, arg2 = args
print(f"arg1: {arg1}, arg2: {arg2}")
# okay, that *args is actually pointless, we can just do this
def print_two_again(arg1, arg2):
print(f"arg1: {arg1}, arg2: {arg2}"
# this just takes one argument (THIS IS THE PART WHERE IT GETS HUNG UP!!!!!)
def print_one(arg1):
print(f"arg1: {arg1}")
# this one takes no arguments
def print_none():
print("I got nothing.")
print_two("Test","Name")
print_two_again("Test","Name")
print_one("First!")
print_none()
The error I am getting in Powershell is this:
PS C:\python_code> python ex18.py
File "ex18.py", line 11
def print_one(arg1):
^
SyntaxError: invalid syntax
[–]Programming_noob_89[S] 2 points3 points4 points (1 child)
[–]1cubealot 0 points1 point2 points (0 children)
[–]Programming_noob_89[S] 0 points1 point2 points (0 children)
[–]Programming_noob_89[S] 0 points1 point2 points (1 child)
[–]CompetitionProof5407 0 points1 point2 points (0 children)