Everything I'm Learning In Python
Everything I'm Learning In Python
# is a comment
print prints something
print() is a function, like in JavaScript
You can use double "" or '' single quotes around a string just like in JavaScript. Variables are assigned with an = sign and don't need a let or a const equivalent. I cannot get used to not using let or const!
And it's so weird reassigning variables without let or const too.
Errors
Two common errors in Python are NameError and SyntaxError
SyntaxError
- Something wrong with the way your program is written.
- Punctuation written wrong
- A command that is not expected
- A missing parenthesis
NameError
- A word that it does not recognise
- Something that looks like a variable but was never defined
Concatenation
The Python str() method turns a number into a string.
Plus Equals
This is good coding revision anyway. You can increment values using a += operator.
Comments
Post a Comment