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]
4 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]4 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
Identify a true statement about heuristics: a. They are more complicated than algorithms. b. Unlike algorithms, they do not perm
STatiana [176]

Answer:

The appropriate alternative is Option d.

Explanation:

  • Heuristic also seems to be essentially a methodology that solves numerous major issues in an even cheaper manner. It requires less effort than those of the traditional techniques. It's providing accurate solutions. It has a broader potential in the treatment of computer engineering. It is already being shown in quantum computing.
  • Mathematical implementations also contribute significantly to heuristics. This could make concessions on the component of optimal performance. It can also make concessions on the degree of consistency. It helps to achieve international headquarters at quite a quicker speed.

The latter decisions made are not connected to the conditions. So the above comment is correct.

4 0
3 years ago
The process of changing a program’s internal structure without changing the way the program works is ______________.
aev [14]

Explanation: changing the coding and not the way it works.

7 0
3 years ago
Which tag pair contains the items in an ordered or unordered list?
Serga [27]
```
<ul>
  <li>item1</li>
  <li>item2</li>
</ul>
```
It's the same for ol.
7 0
3 years ago
Under what conditions might the Justice Department approve a merger between two companies that operate in an industry with a pos
pogonyaev

Answer:

Explanation:

Overall an industry with a post merger Herfindahl-Hirschman index value of below 1500 is considered un-concentrated.In an extreme case,if the Herfindahl-Hirschman index in an industry exceeds 2900,it suggest that the industry is highly concentrated.

In that case if a merger is going to occur which is expected to raise the Herfindahl-Hirschman index by 255 points,then the FTC and DOJ might challenge a lawsuit against such merger,some other factor are also scrutinized.

This include economies of scale,economies of scopes and the ease in which there is an entry possible in the industry,The agencies like FTC and DOJ try to block horizontal merger if it expected to create unsuitable economic business environment for other firms in the industry

3 0
4 years ago
A ___________ organizes related commands together, under a tab.
notsponge [240]
A menu bar organizes related commands together, under a tab.
So the answer is <span>b. menu bar</span>
8 0
4 years ago
Other questions:
  • What happens if i receive a text while my phone is off?
    15·1 answer
  • What is the drawback of the linear model?
    5·2 answers
  • Which word goes with "meals
    5·2 answers
  • You are asked to monitor a network which has a network monitoring system. Using the monitoring server, you notice that it is lis
    13·1 answer
  • A customer has contacted you to help him alleviate a large amount of time and effort that goes into adding and removing users wh
    14·1 answer
  • If a user inserts a piece of clip art over some text but does not want the art to block the text, the user should select
    14·2 answers
  • You are splitting up all your apples equally between 3 people. which statement below will calculate how many apples will be left
    12·1 answer
  • ou use productivity apps on your iPad tablet device while traveling between client sites. You're concerned that you may lose you
    11·1 answer
  • Write programs in python to display “Valid Voter”. (condition : age of person should be
    15·1 answer
  • time to throw poggers xqc time to throw pogchamp time to throw pogchamp time to throw pogchamp time to throw pogchamp time to th
    5·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!