Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

################################################################################################################################################################################# PLS ONLY ANSWER 6.2 ######################################################################################################################################################################### QUESTION 1 What kind of statement creates a variable in Python (i.e., what do you need to do to

#################################################################################################################################################################################

PLS ONLY ANSWER 6.2

image text in transcribed

#########################################################################################################################################################################

QUESTION 1

What kind of statement creates a variable in Python (i.e., what do you need to do to make a new variable exist in your codE)

6.1 (8 pts) In Section 5.2, p. 134-136 the author discusses the "Accumulator Pattem", which is a very important topic in this course; one of the most important for you to master. So please read those two pages several times and try to understand every detail. The figure at the top of p. 135 shows the various stages of execution for the code on p. 134. The code mySum = mySum + num takes the old value of my Sum, adds num to it, and stores the result back in mySum. That code is done inside a for loop, for num in myList, after setting mySum initially to zero. The final value for my Sum is 20. Page 2 of 6 CS 8 (Winter 2020) Re-write this code to iterate through the numbers in numList and add them to mySum using a while loop. numList - (3, 2, 7, -1, 9] mySum=i=0 while i

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_2

Step: 3

blur-text-image_3

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

MySQL Crash Course A Hands On Introduction To Database Development

Authors: Rick Silva

1st Edition

1718503008, 978-1718503007

More Books

Students also viewed these Databases questions