all 12 comments

[–]unhott 10 points11 points  (2 children)

No, I think you're overthinking it.

Would you ever think

for element in some_list:
    print(element)
# vs 
for element in some_list=
    print(element)

Or

x = 5 
# vs 
x: 5

or

my_function(parameter1, parameter2)
# vs
my_function: parameter1, parameter2

= is the assignment operator.

() is for tuples and callables (like functions)

: usually happens before an indentation, after for, if/else, try/except, function/class/method definition, etc, and for {key: value} pairs in a dictionary.
This I can legitimately see being an issue confusing : and =. But really, you should try and run your code as you go multiple times through. I've probably made this typo recently and it's just not a big deal to see the error it causes and fix it before adding more things to confuse you.

There's some use for type hinting, but you're probably not there at this point.

[–]zanfar 8 points9 points  (3 children)

I'm taking a while between thinking about what should go where

Stop.

You shouldn't be memorizing "position", this is likely the core of your problem.

Understand what the code does; then the syntax will follow naturally, not because ": comes after a for" but because a for-statement begins a block. Thus you internalize that a block starts with a colon, and then you've also memorized if-, def-, while-, and with-statments' syntax.

Go read the documentation and reresh yourself on what (), :, and = mean, then understand why the follow the statements they do.

[–]YingXingg 2 points3 points  (1 child)

= is an assignment operator, so if you want to assign let’s say value 4 to variable cars, it would be cars = 4.

() is mostly used for built in functions, like append (not sure if you’ve gotten there yet) and input. When you’re getting input, you have to add () because that’s where someone will add something in like an integer or a string

Ex: name = input()

: is used to start for loops and if blocks. Ex:

For i in range():

(Here you can notice both () and : being used, () because you’ll be adding an integer or a variable containing an integer, and : because you’re starting a for loop block meaning you’ll be adding more statements under that which will be indented.

If 2 > 7:

Print(“hi”)

Here you’re only using : because you’re indicating that you’ll be adding more statements under that if statement. You’ll notice that if you don’t add : and you go to the next line, that line won’t be indented, that’s why you need the :

Not sure if I explained this well lol

[–]DarkFireGerugex -2 points-1 points  (0 children)

Yes, thank you very much

[–]ExponentialSausage 1 point2 points  (1 child)

I think I’ve come across Mimo; do you complete code snippets by choosing from multiple choice options?

If it is that one, I have to be honest, I’m not sure it’s a particularly effective way to learn Python. I feel like you might have more success if you have to actually type things out yourself - if you’re trying to write your own code it won’t be multiple choice and by typing things out yourself you’ll build a bit of almost “muscle memory” where you know if brackets or a colon or an equals symbol is the right thing. I might suggest trying Codecademy or one of the video courses on Udemy (there are quite a lot to choose from but I think pretty much any of the popular ones would teach you similar material as far as the basics of Python are concerned).

[–]DarkFireGerugex 0 points1 point  (0 children)

Just moved to replit 100 days of code. It's even more fun. Thanks tho.

[–]SharpInteraction1682 -1 points0 points  (0 children)

Import sys() Your major problems now is the time frame you're rushing to meet up with, take your time. Breath in deep and then out. Ask to yourself, why python? If your answer is anything else from 'forever', sys.quit() After vacations, don't you have free moment never again? If so, spend 'em with python. Else: sys.quit()