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
Which statements accurately describe the Outlook interface? Check all that apply.
blagie [28]

Answer:

All are right except the 4th one.

1) Two main elements are items and folders.

2) The content pane contains a list of items to be viewed in the reading pane.

3) The ribbon contains a list of tabs and menu items.

5) The main Outlook menu has a ribbon tab with default commands.

6) File, Home, Send/Receive, Folder, and View are commands on the main ribbon tab.

Explanation:

Hope this helped Justine!

7 0
3 years ago
How can I do a project with a model on the steam machine?
user100 [1]
look up some facts about steam machines and then see when they were created and by who they were created and how they have evolved.
5 0
3 years ago
The goal of this project is to become familiar with basic Python data processing and file usage. By the end of this project, stu
xenn [34]

Answer:

Explanation:

The question does not provide any actual data to manipulate or use as input/guidline therefore I have taken the liberty of creating a function for each of the question's points that does what is requested. Each of the functions takes in a list of the needed data such as a list of field test averages for part 1, or a list of field tests for part 2, etc. Finally, returning the requested output back to the user.

import matplotlib.pyplot as plt

from collections import Counter

def best_pilot(field_test_average):

   return max(field_test_average)

def find_average(field_test):

   average = sum(field_test) / len(field_test)

   return average

def create_histogram(field_test_colors):

   count_unique_elements = Counter(field_test_colors).keys()

   plt.hist(field_test_colors, bins=len(count_unique_elements))

   plt.show()

def average_name_lengths(first, last):

   first_name_sum = 0

   last_name_sum = 0

   count = 0

   for name in first:

       first_name_sum += len(name)

       count += 1

   for name in last:

       last_name_sum += len(name)

   first_name_average = first_name_sum / count

   last_name_average = last_name_sum / count

   return first_name_average, last_name_average

7 0
2 years ago
Professional photographers often use the lowest quality settings on their cameras since this can be reversed in Photoshop.
kap26 [50]
False you want to use the best lenses and settings as very fine details can't be edited plus let's be real no one wants to sit for three hours editing one photo 
3 0
4 years ago
Read 2 more answers
Which of these is NOT a standard part of the outro of a podcast?
Lisa [10]

Answer:

final thoughts

Explanation:

it is generally what we should do so that people can know what your opinion on it at the end

7 0
3 years ago
Other questions:
  • While driving you encounter an emergency vehicle stopped ahead. Discuss how the move over law applies to this situation and your
    13·1 answer
  • Jeremy wishes to create a site map for his website. What tag will surround the URL of his home page? A. B. C. D.
    8·1 answer
  • How many cells does the organism have?\
    5·2 answers
  • Write the definition of a method, oddsMatchEvens, whose two parameters are arrays of integers of equal size. The size of each ar
    10·1 answer
  • 3. When you right-click a linked spreadsheet object, what commands do you choose to activate the Excel features?
    7·2 answers
  • Universal Containers uses a custom object within the product development team. Product development, executives, and System Admin
    11·1 answer
  • Kris is the project manager for a large software company. Which part of project management describes the overall project in deta
    11·2 answers
  • Please describe the role of games in modern society!
    5·2 answers
  • Describe four traditional tehniques for collecting information during analysis.
    11·1 answer
  • WHATS 5X750 i really dont even know that questiob
    7·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!