CS1101-Unit03 programming assignment

.docx

School

University of the People *

*We aren’t endorsed by this school

Course

1101

Subject

Computer Science

Date

Jan 9, 2024

Type

docx

Pages

7

Uploaded by BaronEmuPerson965

Q1. The code for my countup function: >>> def countup(n): ... if n >= 0: ... print('Blastoff!') ... else: ... print(n) ... countup(n+1) The output: >>> countup(-3) ... -3 ... -2 ... -1 ... Blastoff!
Program to run countdown or countup, depending on user keyboard input: Output (positive number): Output (negative number):
Output (zero): An explanation of your choice for what to call for input of zero. I chose to call countdown when user keyboard input is zero simply because it seemed most straightforward to me to make the determination by using if n >= 0 (if input is greater than or equal to 0, program runs countdown) and elif n < 0 (if input is less than 0, program runs countup). Q2.
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help