A program is a list of instructions for your computer to follow step by step. In Python, these steps look like plain English sentences. You write them in a text file and ask the computer to read that file from top to bottom.
Your first command
Your first tool is
print(). It is a function, which means it does one specific job: showing text on the screen. You give it what to show inside parentheses.print('Hello, world!')This line tells Python to display the exact text
Hello, world!. The quotes tell Python that this is a string, or words meant for reading. If you remove the quotes, Python thinks it is looking for a variable name and will crash.Creating multiple lines
Python runs your code one line at a time. Each
print() call ends with an automatic newline. This means the next thing you print appears on the very next line of text.print('My name is')
print('Alex')Here, the first line prints
My name is. The second line starts fresh below it. You do not need special characters to move down; Python handles that for you automatically.Adding notes with comments
Code is often read by humans before it runs. You can leave notes using the
# symbol to start a comment. Python ignores everything after #, so you can write English sentences there safely.# This line does nothing
print('I am real code')
# print('This is skipped')Comments help you remember why a line exists. They also let you temporarily turn off code while testing other parts of your program.