bugl
bugl
HomeLearnPatternsPathsSearch
HomeLearnPatternsPathsSearch

Loading lesson path

Learn/Python/Files, Modules, and the Standard Library
Python•Files, Modules, and the Standard Library

How to Add Two Numbers in Python

Flash cards

Review the key moves

1/4
Core idea

What is the main idea behind How to Add Two Numbers in Python?

Lesson checks

Practice each idea before moving on

Short Mimo-style checks built from this lesson's code, terms, and sequence.

1Quick choice

Which statement best captures the main point of this lesson?

2Fill blank

Complete the missing token from the example code.

___(x + y)
3Order

Put the learning moves in the order that makes the concept easiest to apply.

Use the + operator to add two numbers:
Add Two Numbers with User Input
How to Add Two Numbers in Python

Learn how to add two numbers in Python.

Use the + operator to add two numbers:

Example

x = 5
y = 10
print(x + y)

Add Two Numbers with User Input

In this example, the user must input two numbers. Then we print the sum by calculating (adding) the two numbers:

Example

x = input("Type a number: ")
y = input("Type another number: ")
sum
= int(x) + int(y)
print("The sum is: ", sum)

Previous

Python Requests Module

Next

Python Delete File