ToMotion AI logo
Back to gallery

Public AI explainer video

LESSON 2: YOUR FIRST PYTHON PROGRAM — print()...

LESSON 2: YOUR FIRST PYTHON PROGRAM — print() Scene 1 — Start Coding Narration Now we are ready to write our first Python program. Type this: print("Hello...

Prompt

Source idea used to generate this video.

LESSON 2: YOUR FIRST PYTHON PROGRAM — print() Scene 1 — Start Coding Narration Now we are ready to write our first Python program. Type this: print("Hello World") Run the program. You will see: Hello World Congratulations. You have just given your first instruction to Python. The print() function is used to display output on the screen. Scene 2 — Understanding the Line Narration Now let's understand this line slowly. print("Hello World") There are three important parts here. First: print print tells Python that we want to display something on the screen. Next, we have parentheses: () Inside these parentheses, we give Python the information that we want to print. In our example, that information is: "Hello World" So the complete instruction means: Python, display Hello World on the screen. Scene 3 — Why Do We Use Quotes? Narration Look carefully at this part: "Hello World" Hello World is text. In Python, text can be written inside quotation marks. For example: print("Welcome to Python") Output: Welcome to Python We can also use single quotes: print('Welcome to Python') This gives the same output. Python strings can be created using either single quotes or double quotes. For now, we'll mostly use double quotes to keep our examples consistent. Scene 4 — Print Different Messages Narration print() is not limited to Hello World. We can display any text we want. For example: print("My name is Ravi") Output: My name is Ravi Or: print("I am learning Python") Output: I am learning Python Or: print("Welcome to our Python course") Output: Welcome to our Python course Whatever text we place inside the quotes is displayed on the screen. Scene 5 — Multiple Print Statements Narration We can also write more than one print() instruction. For example: print("Hello") print("Welcome to Python") print("Let's start coding") Output: Hello Welcome to Python Let's start coding Notice something important. Each print() starts its output on a new line by default. The source material describes the default ending of print() as a newline. We will learn how to change that behavior later. For now, just remember: One print() normally gives us one line of output. Scene 6 — Printing Numbers Narration print() can also display numbers. For example: print(10) Output: 10 Or: print(500) Output: 500 Notice the difference. For text, we used quotes: print("Hello") For a number, we can write the number directly: print(10) Why text needs quotes but numbers don't will become clear when we learn data types. Scene 7 — Python Can Calculate Inside print() Narration We can even ask Python to calculate something and display the answer. For example: print(10 + 20) Output: 30 Here Python first calculates: 10 + 20 and then displays the result. Try another one: print(50 - 20) Output: 30 Don't worry about learning all mathematical operators now. We will cover them properly in a separate lesson. The important idea here is: print() can display both information and calculated results. Scene 8 — A Very Common Beginner Mistake Narration Suppose you want to display the word Python. If you write: print("Python") Python understands that Python is text. But if you write: print(Python) Python does not treat Python as normal text. It tries to understand Python as a name used in the program. Since we haven't created anything with that name, the program will give an error. So for now, remember this simple rule: If you want to display normal text, put it inside quotes. Scene 9 — Your First Practice Narration Now try writing these three lines yourself: print("My First Python Program") print("I am learning Python") print(100 + 200) Before running the program, try to predict the output. Then run it and check your answer. This habit is very important. Don't just run code. First think: What do I expect Python to do? Then run the program and compare the result. Scene 10 — Move to the Next Concept Narration We can now display text, numbers and simple calculations. But imagine we want to store information. For example: A student's name. Their age. Their marks. Or the price of a product. We don't want to type the same value again and again. We need a way to give a name to a value and use it later. That brings us to our next topic: Variables.