blog.dopana

Back

Welcome to the world of coding! 🚀

Did you know there is a tiny, friendly robot living inside your computer? It does not have arms or legs, but it is super smart. Its name is Python! 🐍

Python does not speak human languages like English or Vietnamese. To talk to it, we use special words. Today, we will learn how to make Python talk and do math!

1. Making the Robot Speak#

To make Python speak, we use the print() command. Think of print() as giving the robot a speech bubble!

Here is how you do it:

print("Hello Robot!")
python

When Python runs this code, it reads inside the speech bubble "Hello Robot!" and says it back to you:

graph LR
    Code["print('Hello Robot!')"] --> Robot["🐍 Python Robot"]
    Robot --> Speech["💬 'Hello Robot!'"]

[!NOTE] Make sure to put quotation marks " " around your text. Otherwise, the robot gets confused and does not know where the text starts and ends!

2. The Math Wizard Robot#

Our Python robot is also a math wizard. It can calculate large numbers faster than any human!

If you tell the robot to print math, you do not use quotation marks. If you do, it will just repeat the numbers instead of calculating them.

Let’s test it:

print(2 + 3)
python
graph TD
    Input["2 + 3"] --> Brain["🧠 Robot Math Brain"]
    Brain --> Output["💬 5"]

If you write print("2 + 3") with quotation marks, the robot says "2 + 3". But if you write print(2 + 3) without quotation marks, the robot says 5!

Here are the math symbols Python uses:

  • + for plus (addition)
  • - for minus (subtraction)
  • * for times (multiplication)
  • / for divide (division)

Try It Yourself! 🎮#

Open your Python playground and type these commands:

  1. Make the robot say your name: print("Hello, [Your Name]!")
  2. Make the robot do a multiplication: print(5 * 5)

Congratulations! You just wrote your very first Python program! Next time, we will learn how to give the robot memory boxes to store toys and secrets.

References#