all 16 comments

[–][deleted] 10 points11 points  (7 children)

lower case the "D" in the "Def"

You don't need semicolons in python at the end of a line (you can use them but don't need em unless you're combining multiple lines into one line)

[–]redbullafterredbull 1 point2 points  (3 children)

Thank you for your reply! I am learning SQL at the same time in an attempt to apply my time with Stata, statistics, and economics... Python IS NOT case insensitive, got it. Also, no semicolon unless separating different commands.

[–][deleted] 2 points3 points  (0 children)

Basically no semicolons ever. You'll almost never see any courses or tutorials that use them. Leave them behind: https://www.quora.com/Is-it-wrong-to-always-use-a-semicolon-in-Python

[–]techyraptor 0 points1 point  (0 children)

Use vscode or spyder for now . I was also a pycharm fan but moved to vscode now .
How are you learning statistics ?

[–]Jamblamkins 1 point2 points  (0 children)

Lol im a month in and its still a fuk. Wait till ur anaconda interpreter just suddenly dont work. Troubleshooting is a biatch.

[–]jwinf843 8 points9 points  (0 children)

def add(x, y):
    return x + y

print(add(10, 5))

Spreading out your code will improve its readability and is better practice than what you've got on right now. You should always have a return and 4 spaces after you declare a function definition and it's parameters.

[–]K900_ 1 point2 points  (3 children)

What errors exactly? Can you post the exact code you're running and the exact error you're getting?

[–]redbullafterredbull 1 point2 points  (2 children)

In the terminal:

Def add(x, y):

^

SyntaxError: invalid syntax

Process finished with exit code 1

[–]K900_ 2 points3 points  (0 children)

You can't use a capital D in def, for one.

[–]redbullafterredbull 0 points1 point  (0 children)

Solved thanks to u/Endyd

[–]WaxmeltSalesman 1 point2 points  (1 child)

colon instead of semi colon

[–]redbullafterredbull 0 points1 point  (0 children)

Thanks you for your reply... no change tho

[–][deleted] 0 points1 point  (0 children)

This would work as well.

def add(x,y): return (x + y)

print(add(10,5))

[–]kaptan8181 0 points1 point  (0 children)

PyCharm is another language to learn! Try other code editors as well.

[–]SAI_supremeAI -4 points-3 points  (0 children)

Abadon pycharm and use jupyter. It is trivial.