Question
Python questions for a study guide, help would be appreciated, thank you. ______________________________________________________________________ 1.) What string is stored in b after the following code executes:
Python questions for a study guide, help would be appreciated, thank you.
______________________________________________________________________
1.) What string is stored in b after the following code executes: a = 'The quick brown fox jumped over the lazy dog." b = a[1:3]
2.)What is the output from the following print statement? print("The temperature is currently %d degrees in %s, %s." % (78, "New York", "NY"))
3.) The condition for a while loop must equate to a boolean value. True or False?
4.) An elif statement requires a condition. True or False?
5.) An else statement requires a condition. True or False?
6.) Rewrite the following for loop as a while loop: nums = [10, 15, 20, 25] total = 0 for num in nums: total += num
7.) Rewrite the following while loop into a for loop: i = 0 while i < 10: print(i) i += 1
8.) What type of loop should you use when the number of iterations are not computable before entering the loop?
9.) What type of loop is best suited to access the elements of a container?
10.) What does a break statement do?
11.) What does a continue statement do?
12.) A loop else clause is executed only when the loop terminates normally. True or False?
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