CodingNeed.

1 · First steps · 7 MIN

Give values a name

Variables keep values available for later instructions.

Assignment gives a value a name. Python does not use let or const. Numbers and strings are different types: 3 is numeric while "3" is text. A name can be assigned a new value later.

A label on a box tells you which value you are working with. let lets you replace what is in that box.

Read the example

points = 2
points = points + 3
print(points)
Check the expected output
5

Your challenge

Return the input number plus 10. Accept zero and negative numbers too.

Common trap

Adding a number to a string raises TypeError; convert deliberately.

Next lesson: Calculate a total →

Essential cookies keep your account signed in. Optional analytics is not configured on this site. Your choice does not affect access to lessons.

Read the Privacy Policy. You can change this choice in the footer.