livepython.net

20. Python Program to Reassign a Variable

MediumHow they work

Overview

Understand how variable reassignment works.

Problem Statement

Demonstrate changing a variable's value and type.

Constraints:

  1. Create x = 5 and print it
  2. Reassign x = "hello" and print it again
  3. All in one execution

Input

  • No input required

Output

5 hello

Learn this firstChapter 4 · How Python Variables Work: Reassign, Swap and More
solution.py
# write your code here

EXPECTED OUTPUT

15
2hello

YOUR OUTPUT

Press Run to see your output here. Lines are compared with the expected output.