1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
Lapatulllka [165]
3 years ago
8

Wrtie a program in which we will pass a value N. N can be positive or negative. If N is positive then output all values from N d

own to and excluding 0. If N is negative, then output every value from N up to and excluding 0.
Computers and Technology
1 answer:
Triss [41]3 years ago
5 0

Answer:

Following are the answer to this question:

x=int(input("Enter number: "))#defining x variable that input value from user end

if x< 0:#defining if block that check x value is less then 0

   while x<0:#defining while loop print up to the value

       print(x)#print value

       x+= 1#add values by 1

elif x>0:#defining elif block to check value x is greater than 0

   while x>0:#defining while loop to print down to value

       print(x)#print value

       x-= 1#subtract value by 1

Output:

when input is a positive value

Enter number: 5

5

4

3

2

1

when input is a negative value

Enter number: -5

-5

-4

-3

-2

-1

Explanation:

  • In the given python code, x variable is declared that input the value from the user end, in the next step if and elseif block is declared that calculates and prints its value.
  • In the if block, it checks value is negative it uses the while loop to prints its values in the down to value form.
  • In the elif block, it checks the positive it uses the while loop to prints its values into the up to values form.  
You might be interested in
What does "CPU" stand for?
MrMuchimi
Central processing unit
7 0
3 years ago
Read 2 more answers
Arman, a friend of your dad, has a computer running Windows 7 and wants to perform an upgrade. He has only 3GB of RAM in his com
torisob [31]

Answer:

Low memory?

So to fix the problem you could add more memory to the machine.

Explanation:

8 0
3 years ago
What is the most complex part of a PC?
rjkz [21]

Answer:

From a hardware standpoint, the CPU is most likely the main component. From a software standpoint, macOS and Windows are complex software systems.

Explanation:

6 0
2 years ago
Consider the following code example:
yKpoI14uk [10]

Answer:

The number of invoices for each vendor that have a larger balance due than the average balance due for all invoices.

Explanation:

This part of the code below

WHERE InvoiceTotal - PaymentTotal - CreditTotal >

(SELECT AVG (InvoiceTotal - PaymentTotal- CreditTotal)

FROM Invoices)

gives the condition to pick the invoices with balance that are greater than the average balance for all invoice.

This part of the code below

GROUP BY VendorName

ORDER BY BalanceDue DESC;

then enables the program to group the result of the above condition by VendorName and sort the resulting rows in the order of BalanceDue. You will therefore, obtain for each row in the NumberOfInvoices column, the number of invoices for each vendor that have a larger balance due than the average balance due for all invoices.

7 0
3 years ago
Of the following, the greatest advantage of a database architecture is that
Zina [86]

Answer:

c.

Explanation:

Of the following, the greatest advantage of a database architecture is that data redundancy can be reduced. This refers to data being unintentionally repeated within the database causing space to be taken up unnecessarily. Database architecture allows for this problem to be addressed and prevented.

3 0
3 years ago
Other questions:
  • Antivirus software products require that you update _____ on a regular basis
    6·2 answers
  • You have found statistics on the Internet that you would like to use in your speech.
    6·1 answer
  • What are the most popular/up-and-coming social media applications?
    10·2 answers
  • A ____ database supports data distributed across several different sites.
    7·1 answer
  • An email message form includes all of the following main areas except
    11·2 answers
  • In order to make burger a chef needs the following ingredients one piece of chicken meat 3 lettuce leaves 6 tomato slices Write
    8·1 answer
  • How dose society use computer in government?​
    5·1 answer
  • Write a program for determining if a year is a leap year. In the Gregorian calendar system you can check if it is a leaper if it
    15·1 answer
  • What is the primary way that social networks work? Multiple Choice providing a security system for communication online connecti
    5·1 answer
  • Identify the end-to-end processes that should appear in the process landscape model.
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!