Write a program that reads two numbers from the user, and proceeds as follows: If the input numbers are equal, the program displays: both numbers are the same. Otherwise, the program logs all the integers in the range of the input numbers from the smaller value to the larger value in the console. For example, if the user enters 22 and 16, the program displays: 16 17 18 19 20 21 22. Note that all the numbers are displayed in one line separated by a single space. . If any of the input values are invalid, the program displays an error message and terminates.​

Answers

Answer 1

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


Related Questions

Question 2 of 25
How could a video's file size be reduced so that it will take up less space on a
computer's hard drive?
A. By shooting it at a lower resolution
B. By shooting it at a higher resolution
C. By shooting it at a higher frame rate
D. By sampling the sound at the maximum rate

Answers

A, as a lower resolution will store less data per frame, reducing file size.

What are the common operations performed on character strings?

Answers

Answer(:

•concatenation

• scanning

• substringing

• translation

• verification

if you want to remember means csstv;-)

Which is an example of a foley effect?

Answers

Answer:

Foley artists reproduce everyday sounds like footsteps, doors opening and closing, wind blowing, glass breaking, and other ambient noise.

How to powerwash chromebook

Answers

Answer:

you only need to select restart after you sign out of your account also I would make sure everything you need is backed up because otherwise everything you have will get deleted I accidentally had that happen to me last week or the week before, I didn’t realize it was going to need to be reset so I didn’t save the majority of my answers. So now I have barely anything done and I’m behind.

Explanation:

I hope it helps you though.

Choose the correct term to complete the sentence.

For most operating systems, the _______ function returns the number of seconds after January 1, 1970, 0:00 UTC.


O localtime()

O time()

O epoch()

Answers

Answer:

time() or time.time()

Explanation:

The time() method from the time module gives the amount of seconds after epoch, or Jan 1, 1970. Running this in the Python shell would return a number like this:

>>> time.time()

1652747529.0429285

For most operating systems, the time() function returns the number of seconds after January 1, 1970, 0:00 UTC. Thus, the correct option is B,

What is the time() function?

In python, the time() function is the function which returns the number of seconds that have been passed since an epoch. It is the point where time actually begins. For the Unix system, the time such as January 1, 1970, 00:00:00 at UTC is an epoch.

The time() method from the time module is used widely to give the amount of seconds which have been passed after the time period of an  epoch, or Jan 1, 1970. Running this in the Python shell would return a number like the one listed in the question.

Therefore, the correct option is B.

Learn more about time() function here:

https://brainly.com/question/12174888

#SPJ2

can i get help with computer language​

Answers

Answer:

yes

Explanation:

because you can choose you own language

What will be printed to the screen when the following program is run?

Answers

Answer:

The answer is 20

Explanation:

Hope this helps!

Answer:

40

Explanation:

Indexes for arrays in Python start at 0, which means the first item of an array is at index 0, the second item is at index 1, the third item is at index 2, and the fourth item is at index 3.

Therefore when my_list[3] is put inside the print function, the fourth item, 40, is printed to the screen.

Hope this helps!

Characteristics of VR headsets​

Answers

Answer Believable Virtual Word. The believable virtual world is a key characteristic of Virtual Reality. ...
Immersive. ...
Feedback. ...
Interactive. ...
Virtual Reality Headset. ...
Computing Device (Commuter / Smart Phone) ...
Virtual Reality Input and Output Devices. ...
Fully Immersive Virtual Reality.

Company ABC would like to select the topology that has the most reliability for data reaching its destination. Which topology should they choose?
bus
full mesh
partial mesh
ring

Answers

Full mesh because it is the answer and I been reading up in it

Allan is a candidate for the position of Mayor in his town. He is worried about using email for the fear that it may be intercepted by the government and used by his opponent. What law protects his email from being intercepted by the government?
The
and its proposed update strengthen the online privacy of users by increasing requirements for governmental access to the stored data.

Answer: Electronic Communications Privacy Act

Answers

Answer:

This is correct.

Explanation:

I took the test and got it right.

.....................................................

Answers

Answer:

i think its, a. sequence

Explanation:

i could be wrong, if i am, i am sorry

Which of the following types of promotion includes a two-way conversation?

Answers

It would be C. Personal selling. Hope it helps!
where are the answer choices?

Do anyone know how to code like I need someone do a code for me?

Answers

Answer:

yeah i can depends on what exactly it is but probably

In this area, you want to focus on which hardware, application, personnel, or department(s) will be impacted by the security policy. For instance, what type of personal devices are allowed on the network and when? Must the personnel receive formal approval before using such devices on the network? What kind of activity is allowed on a personal device? Who is responsible for granting the permission to use a device on the network?

Answers

The type of personal devices that are allowed on the network are:

LaptopsSmartphones tablets

What devices do BYOD have?

BYOD is known to be Personal devices such as smartphones that organizations often gives permission for employees that are working from home so as to be able to have a flexible schedule and others.

Therefore, The type of personal devices that are allowed on the network are:

LaptopsSmartphones tablets

Learn more about personal device from

https://brainly.com/question/4457705

#SPJ1

Which method can be used for making a robot perform a different set of functions?

a. changing a robot's sensors
b. dismantling a robot
c. creating a new robot
d. rewriting software

Answers

Answer:

D. Because rewriting it can make it preform new functions.

Explanation:

Gigantic Life Insurance has 4,000 users spread over five locations in North America. They have hired you as a consultant to provide a
solution for standardizing Windows 10 configuration. There is a mix of desktop computers and tablets running Windows 10. The computer
and tablets come from a variety of vendors because Gigantic Life Insurance allows agents to purchase their own computers. How do you
recommend they standardize their Windows 10 installations?

Answers

First of all, when buying a set of Windows 10 operating system, It needs to buy Windows Server 2016 version as well in order to centrally connected to the Windows server machine. So coming to the edition of the Windows 10 version, we need to buy Windows 10 Enterprise edition for your infrastructure. So, the configuration can be like for each computer machine you must use 8 GB of memory and 500 GB of storage. For tablet, it can choose 4 GB memory and 32 GB ROM. Windows tablet comes with already installed OS. But for installation of Windows enterprise client OS, it needs to choose network mode of installation.

What is windows?

A window is a separate viewing area on a computer display screen in a system that allows multiple viewing areas as part of a graphical user interface (GUI). Windows are managed by a windows' manager as part of a windowing system. A window can usually be resized by the user.

Learn more about window's here,

https://brainly.com/question/26388929

#SPJ1

what is the input for air cooler computer science​

Answers

Answer:

cooling

Explanation:

Air cooling is a process of lowering air temperature by dissipating heat. It provides increased air flow and reduced temperatures with the use of cooling fins, fans or finned coils that move the heat out of a casing such as a computer …

The groups within a tab are collectively
known as?

Answers

Answer:

the ribbon

Explanation:

Commands are organized in logical groups, which are collected together under tabs. Each tab relates to a type of activity, such as formatting or laying out a page. To reduce clutter, some tabs are shown only when needed.

DUE IN AN HOUR PLS HELP
Random answers for points will be reported


Which one of these is an example of an output device digital pen headset keyboard mouse

Answers

Answer:headset

Explanation:because sound comes out of them

Answer:

Headset

Explanation:

It would be a headset because headsets "output sounds"

Digital pens, keyboards, and mice don't output anything.

What will be printed to the screen when the following program is run?

Answers

Answer:

false

Explanation:

the parenthesis contains 2 true statements (5 is greater than 4 and 10 is greater than or equal to 10)

outside the parenthesis is the not, so the true parenthesis is negated to false

this means the value of a is false

What will be the output of the following code snippet?

Answers

Answer:

D

Explanation:

Its gonna be of the class integer.

when does computer store data permanently?​

Answers

when the device is unpowered.

I need help including my other one I posted

Answers

Answer:

2. I like the form of it, I like the porportion of it.

3. I dont know what a purpose of this maybe it a person wearing a tuexdo stepping out of his house or something.

4. Another thing that would work well is texture.

I need the answer with c++
The question : Implement the class "Rectangle" with sides parallel to the coordinate axes. 1.Provide for the possibility of moving rectangles on the plane. 2.Provide for the possibility of changing sizes. 3.Provide for the possibility of constructing the smallest rectangle containing two given rectangles. 4.Provide for the possibility of constructing the rectangle that is a common part (intersection) of two rectangles. 5.Provide for the possibility of calculating the length of half the diagonal of a rectangle.

Answers

Using the knowledge of computational language in C++ code we found that this code can be written as:

The code can be found in the attached image.

How to writte the C++ code ?

So from the c++ code you can write the geometric figure as

#include <bits/stdc++.h>

struct Point {

   int x, y;

};

bool doOverlap(Point l1, Point r1, Point l2, Point r2)

{

   if (l1.x > r2.x || l2.x > r1.x)

       return false;

   if (r1.y > l2.y || r2.y > l1.y)

       return false;

    return true;

}

/* Driver program to test above function */

int main()

{

   Point l1 = { 0, 10 }, r1 = { 10, 0 };

   Point l2 = { 5, 5 }, r2 = { 15, 0 };

   if (doOverlap(l1, r1, l2, r2))

       printf("Rectangles Overlap");

   else

       printf("Rectangles Don't Overlap");

   return 0;

}

See more about C++ at brainly.com/question/19705654

#SPJ1

A license agreement specifies the number of
devices on which you can install the product, any
dates of expiration, and other restrictions. True or false?

Answers

The statement that a license agreement specifies the number of devices on which you can install the product, any dates of expiration, and other restrictions is true.

What is a license agreement?

A license agreement is a formal agreement that is given to a person to do or use something.

It is a legal contract between people or government and a person to authorize over any product.

Thus, the given statement is true.

Learn more about license agreement

https://brainly.com/question/14681311

#SPJ1

Explain the stages of the evolution of the idea of IDS and its importance of security, military and examine the importance of intrusion detection systems and categories classifications, and where can put IDS to reduce the risk to the network.

Answers

Intrusion detection systems (IDS) is a software type that is used to check for violations of policy or any other malicious activity. IDS detects and prevents unauthorized activities.

What is IDS?

Intrusion detection systems (IDS) is the technological system that is built to check for any suspicious and unauthorized activities. They detect the network system and the system logs.

The unauthorized and suspicious things are scanned and made an alert. It is very crucial in many fields as many documented and private items are needed to be protected.

Therefore, IDS can be of various types like host, network, perimeter, and VM.

Learn more about IDS here:

https://brainly.com/question/20709626

#SPJ1

Question # 9
Fill in the Blank
Complete the statement using the correct term.
The aerospace industry uses______________ simulators to train astronauts and design spacecraft.

Answers

Answer:

flight stimulators are used to train astronaut and design simple air craft

The name for the instructions you write to a computer in a program

Answers

Answer:

Code

Explanation:

The code is instructions that you can write yourself or download from online

Answer:

Code

Explanation:

Code

The name for the instructions you write to a computer in a program


Which type of device would be used on a laptop to verify
the identity of a user

Answers

Answer:

A biometric identification device

Explanation:

As biometric identification devices, laptops commonly use a fingerprint scanner or, for facial recognition, a camera.

what are the four main components of programming languages and why is each one needed?

Answers

Answer:

input, output, arithmetic and conditional and looping

Other Questions
Many of the learners come from different backgrounds with different cultures, as a teacher what can you do to always avoid conflict as it blocks learning If a sample size is 20, which can be used to test a hypothesis about the mean? List two doctrinal reasons the apocrypha is inconsistent with the teaching of the scriptures. use complete sentences. -5(y+.2)=25 what is y? PLEASE SOLVE ASAP Which figure could Jose have constructed? please need help with this question The factors of 52 and the first three factors of 130 are listed in the table below. Fill in the remaining five factors of 130 and then identify the greatest common factor, or GCF, of 52 and 130.Type the multiples in the increasing order.130: 1, 2, 5, GCF of 52 and 130: Why does argumentation matter? can anyone tell me what points I plot these two at ? ty PLSSSSSS HELPPPP ITS DUEEEEEEE!!!!Write a paragraph about "Sun Yat-sen's era of medical practice" after reading. In Little Women , it is the women, not the men who are celebrated. Discuss. When many different species live in an environment, the environment has high . if the number of predators increase in an area, the immediate effect will be a . 1. Scapula is also called as collar bone.True/False? #2. If we have a 9V battery connected to a 100 resistor , what is the current ? Which types of multimedia did the public service advertisement about bullying use? check all that appeared in the advertisement. video of real students animations photographs of bullies speaking music graphs or charts Describe the content of the letter that had the greatest emotional effect on you. What was it aboutthis letter that made you react/respond the way you did (emotionally, physically, psychologically)? After providing initial treatment to a patient with syncope, the medical assistant may need to assess and treat the patient for which of the following possible causes of syncope? At what time did time begin50 points :) I need to Label the seasons in the Northern and Southern hemisphere at each location. I need answers and dont understand this Please help. (Middle school science btw) Which two sentences in the passage introduce counterarguments to the speakers position in favor of recycling?