Hello, world! I’m just starting to learn Python on my own and I’m using W3Schools as my teacher. They show the following command:
if 5 > 2:
print(“Five is greater than two!”)
But they don’t explain why “:” is necessary. For instance, this following line of code does not require a colon:
import sys
print(sys.version)
How come? And why is it important to use indentation on the first example but not the other?
Thanks in advance for your answers!
submitted by /u/Cutsa
[link] [comments]
r/learnpython Hello, world! I’m just starting to learn Python on my own and I’m using W3Schools as my teacher. They show the following command: if 5 > 2: print(“Five is greater than two!”) But they don’t explain why “:” is necessary. For instance, this following line of code does not require a colon: import sys print(sys.version) How come? And why is it important to use indentation on the first example but not the other? Thanks in advance for your answers! submitted by /u/Cutsa [link] [comments]
Hello, world! I’m just starting to learn Python on my own and I’m using W3Schools as my teacher. They show the following command:
if 5 > 2:
print(“Five is greater than two!”)
But they don’t explain why “:” is necessary. For instance, this following line of code does not require a colon:
import sys
print(sys.version)
How come? And why is it important to use indentation on the first example but not the other?
Thanks in advance for your answers!
submitted by /u/Cutsa
[link] [comments]