Answer:
def countdown(n):
if n <= 0:
print('Blastoff!')
else:
print(n)
countdown(n-1)
def countup(n):
if n >= 0:
print('Blastoff!')
else:
print(n)
countup(n+1)
number = int(input("Enter a number: "))
if number >= 0:
countdown(number)
elif number < 0:
countup(number)
<u>Outputs:</u>
Enter a number: 3
3
2
1
Blastoff!
Enter a number: -3
-3
-2
-1
Blastoff!
Enter a number: 0
Blastoff!
For the input of zero, the countdown function is called.
Explanation:
Copy the countdown function
Create a function called countup that takes one parameter, n. The function counts up from n to 0. It will print the numbers from n to -1 and when it reaches 0, it will print "Blastoff!".
Ask the user to enter a number
Check if the number is greater than or equal to 0. If it is, call the countdown function. Otherwise, call the countup function.
Most computers have three types of ports: serial, parallel, and USB. A serial port is a type of interface that connects a device to the system unit by transmitting data only one bit at a time. Serial ports usually connect devices that do not require fast data transmission rates, such as a mouse, keyboard, or modem.
<em>hoping</em><em> that</em><em> </em><em>it </em><em>was </em><em>helpful</em><em> to</em><em> </em><em>you</em>
<em>plz </em><em>mark </em><em>me </em><em>as </em><em>brainlist</em><em> answer</em>
The program is an illustration of loops.
Loops are used to perform repetitive and iterative operations.
The program in Python where comments are used to explain each line is as follows:
#This intializes the list
nums = [5,4,4,2,1]
#This gets the length of the list
size = len(nums)
#This iterates through the list
for i in range(size):
#The following if condition determines the repeating number
if nums[abs(nums[i])-1] > 0:
nums[abs(nums[i])-1] = -nums[abs(nums[i])-1]
else:
repeating = abs(nums[i])
#The following if condition determines the missing number
if nums[i]>0:
missing = i + 1
#This calculates and prints the sum of the missing and the repeating numbers
print(repeating+missing)
Read more about similar programs at:
brainly.com/question/13549861