Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. Trace the while-loop and indicate the total trip count for the loop: total = 128 div - 2 while total > 2 : total
1. Trace the while-loop and indicate the total trip count for the loop: total = 128 div - 2 while total > 2 : total /-div div +- 2 print("total = $d, div - $d" ! (total, div)) Trip count = 2. Trace the for-loop, compute the trip count. total - 0 for target in [ 27, 9, 18, 3): total += target/3 print("total - " (total) ) Trip count = 3. Determine the sequence for each: a. range( 72, 144, 12) [ b. range( -10,11,2) [_ c. range( -15, -76,-15). 4. Trace the for-loop, compute the trip count. total = 0 for target in range( 3, 13, 3): total += target print("total = $d" $ (total)) Trip count = 5. Trace the for-loop and determine what the loop does. in atr-apple for target in range( 0, len(in_str), 1) : print (in_str[target]) count + 1 print("d" (count)) 6. Trace the for-loop strl - - # an empty string for target in "Cnd": strl +- (target + "a") print("%s" 8 (str1)) 7. Trace the for-loop: strl - "my dog has fleas".split("") '# a space delimiter for target in stri: print("s" (target)) 8. Write a loop to display every other character in a string, as in "periwinkle" would print "prwnl" (indices 0, 2, 4, 6, 8)
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access with AI-Powered 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