Answered step by step
Verified Expert Solution
Question
1 Approved Answer
have no idea why it shows invalid syntax. There shouldnt be an error since my instructor posted this... # Whatz it do? print(This program will
have no idea why it shows invalid syntax. There shouldnt be an error since my instructor posted this...
# Whatz it do? print("This program will compute the sum of the sequence from 1 to n.") # PRIMING READ # Get the num num_str -input ("InPlease enter a whole positive number " "(or press KENTER> to quit): ") # CONTINUATION TEST # Have a (nother) round? while num str: # VALIDATION LOOP (aka ERROR TRAP - you're stuck here now!) # Did you give me what I want? while not (is_positive whole (num_str)): print ("%s is NOT a positive whole number! " % numstr) print ("Are you trying to scramble my electronic brain? " - "PLEASE give me valid input!!!n") # Try again, please! num_str -input ("Please enter a whole positive number " "(or press KENTER> to quit): ") # CONVERT -make me a number num - int (num str) # INITIALIZE ACCUMULATOR- so I can remember what I've summed so far sequence. Sum = 0 # OUTPUT - tell me what I've got print (" The sum from 1 to %d is %d " % (num, sumto (num)) - # CONTINUATION READ -more stuff OR QUIT? num-st input (" Please enter a whole positive number " " (or pressStep 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