Python Python Basics (2015) Python Data Types Del

How do I define a variable and assign total to another variable already defined

How do I define a variable and assign total to another variable already defined

delete.py
current_count = 1
planned = 5
upcoming_releases = 2
del planned
def total
sum = current_count
total = upcoming_releases

1 Answer

Steven Parker
Steven Parker
173,537 Points

The "def" keyword is only used for defining functions.

New variables can be created just by assigning values to them. And you won't need a separate variable for the sum, just add the two values together on the same line as you make the assignment.