Answer:
# -*- coding: utf-8 -*-
# Get N from the command line
import sys
N = int(sys.argv[1])
if N > 0: #N is positive
positve = list(range(N,0,-1))
print(positve)
elif N < 0: #N is negative
negative = list(range(N,0,1))
print(negative)
else:
print("Invalid in input")
Explanation:
First, you need to identify if the number entered is positive, negative or none of them, for that we use one if, one elif and one else statement:
- If the number entered (N) is greater than zero (is positive) we print a list in the range N to 0 in steps of minus one, the zero is not printed because the function range by default omits the last value
- If the previous statement was False and the number entered is smaller than zero (is negative) we print a list in the range N to 0 in steps of one, the zero is not printed because the function range by default omits the last value
- Finally, if the two previous events were false print invalid input
1. So you can complete the things you NEED to do faster. (I.e work, groceries)
2. So it’s easier for you to do leisure activities. (I.e visiting friends, shopping)
The program is an illustration of functions.
Functions are group of code blocks that perform as one
The ConvertToWeeksAndDays() function in python where comments are used to explain each line is as follows:
#This defines the ConvertToWeeksAndDays function
def ConvertToWeeksAndDays(totalDays):
#This calculates the number of weeks
weeks = totalDays//7
#This calculates the number of days
days = totalDays %7
#This prints the number of weeks and days
print(weeks,"weeks and",days,"days")
Read more about similar programs at:
brainly.com/question/25223400
... brake pedal; In vehicles equipped with ABS, the driver's foot remains firmly on the brake pedal, allowing the system to automatically pump the brakes.
“Brake Pedal.”