
Hi there! Multiplying numbers in Python is quite straightforward, and it's great that you're diving into this lesson on data types.
To perform multiplication, you'll use the asterisk symbol (*
), which serves as the multiplication operator in most programming languages, including Python.
Let's update the code you're working with to perform an actual multiplication:
result = 2 * 2
print("2 * 2 =", result)
This code assigns the result of 2 * 2
to the variable result
and then prints it out, showing the numerical answer to the calculation.
Output
2 * 2 = 4
You can multiply any numbers using the same approach by replacing 2
with any other numbers you want to multiply.
You'll learn more about this as you follow the course, so for now, just click the Next Lesson button and continue your journey.
Hope this helps! Let me know if you have more questions about numbers or anything else you're curious about.