Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
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)?
= 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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started