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
Does the security burden fall primarily on the user? On
liubo4ka [24]

Answer:

yes and no because of the security

Explanation:

yes and no because of the security

6 0
3 years ago
If an occupation is projected to grow by 13% over the next 10 years, how would you rate the job outlook?
Elena L [17]

Answer:

Steady

Explanation:

Its not an insane growth rate but it would more then likely be Steady.

6 0
3 years ago
Read 2 more answers
Keyboards that are widely used on various smartphones and other small portable devices, and which are designed primarily for com
mr Goodwill [35]

Answer:

Option A is the correct answer for the above question.

Explanation:

The keyboard is a device, by which a human can instruct the computer in the text form. There are so many keyboards in which, thumb keyboard is one of them. The thumb keyboard is found in mobile phones, smartphones or PDA phones, which is used for personal use. It is a designed layout of the keyboard that can be placed on the hand of the human and a person can type on its with the help of his thumb.

The above question asked about the type of the keyboard which is used in various smartphones and other phones. That keyboard is thumb keyboard which is described above and it is stated from the option A. So option A is the correct answer while the other is not because--

  • Option B states about the traditional keyboard which is used for the PC only.
  • Option C states about the Notebook keyboard which is used for the Notebook computers only.
  • Option D states about combination which is not a type of keyboard.
7 0
3 years ago
Is a book considered technology?
kumpel [21]
Yes, "technology" doesn't have to be all about computers or cell phones.. Technology is anything that is a new advance in knowledge and books were once a great advance in that field.
7 0
3 years ago
Read 2 more answers
6. Which of the following is malware? (1 point)
lubasha [3.4K]
Software to damage computers
5 0
3 years ago
Read 2 more answers
Other questions:
  • The eastern front was longer than other fronts of the war true or false
    7·2 answers
  • What does a professional programmer usually do first to gain an understanding of a problem?
    12·2 answers
  • The process of engineering design typically starts with what ?
    12·1 answer
  • A broadband router is used to do which of the following? run the programs on a computer locate lost files on a computer manage a
    6·1 answer
  • A user has been complaining that their wireless connection has been connecting and disconnecting too frequently. what command co
    15·1 answer
  • Which of the following statements can be used as evidence that ancient Greek beliefs and art has been influential? Select the th
    9·2 answers
  • Why is it difficult to convince top management to commit funds to develop and implement a Strategic Information System
    13·1 answer
  • Can you help me with my homework what should i do
    9·1 answer
  • The following statements regarding centralized administration concepts are presented to you in an interview in which only one of
    5·1 answer
  • In additon to setting up services, what other tasks does a sysadmin have to keep in mind? check all that apply.
    11·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!