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
Bad White [126]
2 years ago
15

4.8.4 Better Sum

Computers and Technology
1 answer:
ra1l [238]2 years ago
4 0

import sys

x = input("enter number 1: ") #ask for user input

y = input("enter number 2: ")

output = "" #the output string

try: #try integering them (this also has error message and will check if input is valid)

x = int(x)

except:

print("error! number 1 was not a number :(")

sys.exit() #leave

try:

y = int(y)

except:

print("error! number 2 was not a number :(")

sys.exit()

if x == y: #check they are not the same

print("both numbers are the same")

else: #do the thing

if y > x: #otherwise swap the order

for i in range (x, y + 1): #+1 for inclusive

output = (output + str(i) + " ")

else:

for i in range (y, x + 1):

output = (output + str(i) + " ")

print(output) #so it's all in one line

You might be interested in
What benefits did evolution realize by using the crm software?
Elza [17]
Hello there!
Answer:
Have included productivity improvements (doubling the number of deliveries for a speci²c time period), enhanced inventory management, automation of picklists, better resource planning, and more e±ective reporting to key stakeholders. Evolution’s CRM system can determine deliveries planned for any future month and the amount of product in stock, helping Evolution reduce stock holding by 40%. When a new patient is keyed onto system, tasks can be generated for Evolution’s team to organize delivery ahead of time. The system automatically generates a pick list for that patient from Evolution’s pharmacy. Managers can see tasks 2 weeks ahead and can allocate resources accordingly. Hoping this helps you! :D
4 0
3 years ago
What is A/B Testing
Gnom [1K]
A/b testing is comparing two versions of a web page to see which one performs better
8 0
3 years ago
Read 2 more answers
Cyberstalking is an example of a:
babunello [35]

Answer:

A cyber crime

Explanation:

Cyberstalking is a type of cybercrime that uses the internet and technology to harass or stalk a person. It can be considered an extension of cyberbullying and in-person stalking.

7 0
2 years ago
What is the output of the following program segment?int main(){float hours = 8;float payRate = 5.5; // per hourfloat grossPay =
astraxan [27]

Answer:

The answer is "Option b".

Explanation:

In the code firstly, the main method is declared, inside the main method three float variable is declared, that are "hours, payRate, and grossPay", in which all variable assign a value, that is "8, 5.5, and 0.0". The first two variables are used as parameters, and the third variable is used to hold and pass as a parameter in displayGrossPay function, Then two function is called that is "calcGrossPay and displayGrossPay".

  • The calcGrossPay function uses "hours and payRate" variable as a parameter, and return multiplication of value.  
  • The displayGrossPay function uses a float variable "gPay" in its parameter, which is held in the grossPay variable, that holds calcGrossPay function value and print, its value.

8 0
4 years ago
You can resize a row in a table by dragging the ____.
Sav [38]

Answer:

desk

Explanation:

You need more backround information i dont know what u talking about

6 0
3 years ago
Other questions:
  • 11.19 LAB: Max magnitude Write a function max_magnitude() with two integer input parameters that returns the largest magnitude v
    7·1 answer
  • When you reboot your system, the computer follows startup instructions stored in this type of memory?
    13·2 answers
  • Given the following code:
    9·1 answer
  • Suppose you want to write a program that will read a list of numbers from a user, place them into an array and then compute thei
    7·1 answer
  • By using ____, you can use reasonable, easy-to-remember names for methods and concentrate on their purpose rather than on memori
    6·1 answer
  • The hardware that takes the input data and works with it
    7·1 answer
  • A field with the ____ data type can store a unique sequential number that Access assigns to a record. Access will increment the
    7·1 answer
  • By
    7·1 answer
  • Define a function calc_pyramid_volume with parameters base_length, base_width, and pyramid_height, that returns the volume of a
    7·1 answer
  • Can someone help me and explain
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!