Question: Python Given a line of code, I want to take out a portion of the arithmetic and turn it into a global function, so that

Python

Given a line of code, I want to take out a portion of the arithmetic and turn it into a global function, so that I can consistently use the same global function later on.

Here's my code

Python Given a line of code, I want to take out a

I want to turn currentTotal into a global.

This is what I came up with in an attempt to make the global function, but it is not working properly. Can you please correct my error(s)?

portion of the arithmetic and turn it into a global function, so

= currentTotal = 0 for iCount in range(6): current Total += iCount print(currentTotal) 15 def addit(_num): currentTotal = 0 currentTotal += iCount for iCount in range(6): addit print(currentTotal)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!