Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.
Start your free trialmorgan williams
161 PointsHow 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
current_count = 1
planned = 5
upcoming_releases = 2
del planned
def total
sum = current_count
total = upcoming_releases
1 Answer
Steven Parker
231,275 PointsThe "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.