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
Configuring a firewall to ignore all incoming packets that request access to a specific port is known as ____.
Sati [7]

Answer: Logical Point Blocking

Explanation:

4 0
1 year ago
In modern computer systems, a byte consists of
Cerrena [4.2K]
8 smaller units, called bits :)
8 0
3 years ago
Conduct a site research on a specific property using the concepts discussed during this week.
Anni [7]

Answer:Penis!

Explanation:

Haha! Enjoy your day! Hahahahaha!

8 0
3 years ago
Need help ASAP <br><br> Thankss + BRAINLIST only for correct answers
AVprozaik [17]
Why visit it?
For entertainment, purely for the user to enjoy the content that has been produced for them.

Why was it made?
Netflix is a subscription based service that has been made to allow users to stream TV shows and other entertainment sources. It was made for leisure.
7 0
3 years ago
What is an aptitude assessment that matches students with study programs at specific colleges and universities?
melisa1 [442]
I think the correct answer would be FOCUS2. It is a system that guides members in choosing college or a major. It provides a starting point for students who are not yet certain of what they want to take academically. Hope this helps.
5 0
3 years ago
Read 2 more answers
Other questions:
  • how to write a function "void funct()" which will accept a string from the user as input and will then display the string backwa
    11·1 answer
  • A Unit of information containing the objects position, rotation, and scale values is called:
    13·1 answer
  • C++
    11·1 answer
  • A descriptive study represents the highest level on the knowledge-level continuum.
    11·1 answer
  • You are given an integer N, followed by N lines of input (1 &lt;= N &lt;= 100). Each line of input contains one or several words
    8·1 answer
  • I need help getting earbuds please help
    11·2 answers
  • The fractional_part function divides the numerator by the denominator, and returns just the fractional part.
    10·1 answer
  • What are the five generations of computers?​
    13·1 answer
  • The people on this platform are unbelievably nice. its almost rare to see this type of kindness online these days. Just wanted t
    14·1 answer
  • Write IF() function for student 3, If total mark is greater than 10 then print
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!