Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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)?

image text in transcribed

= 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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Mike Morrison, Joline Morrison

1st Edition

061901556X, 978-0619015565

Students also viewed these Databases questions

Question

Provide examples of KPIs in Human Capital Management.

Answered: 1 week ago

Question

What are OLAP Cubes?

Answered: 1 week ago