Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribed

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 press to quit): ") #RUN ME! main ()

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

Machine Learning And Knowledge Discovery In Databases European Conference Ecml Pkdd 2015 Porto Portugal September 7 11 2015 Proceedings Part 1 Lnai 9284

Authors: Annalisa Appice ,Pedro Pereira Rodrigues ,Vitor Santos Costa ,Carlos Soares ,Joao Gama ,Alipio Jorge

1st Edition

3319235273, 978-3319235271

More Books

Students also viewed these Databases questions

Question

Differentiate 3sin(9x+2x)

Answered: 1 week ago

Question

Compute the derivative f(x)=(x-a)(x-b)

Answered: 1 week ago