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
In 1948, a Bell Labs researcher named Claude Shannon wrote a technical report in which he proposed that all information media co
antiseptic1488 [7]

Answer: true

Explanation:

Claude Shannon’s law says that the highest obtainable error-free data speed, expressed in bits per second (bps), is a function of the bandwidth and the signal-to-noise ratio.

Claude Shannon is regarded as the father of Information technology and he was a researcher of Bell Labs. The report he presented is known as the Information report.

8 0
3 years ago
Describe data center technology and its relevance to modern-day cloud computing. Support your opinion with cited information.( S
Masteriza [31]

Answer: Data center technologies are the innovations that support the IT(Information technology) department and its functioning like storing data, management, operating etc. Data centers provide the help in functioning of the cloud services.

The modern cloud computing services require data centers for operations protecting data when the the power of the network goes off or any other failure occurs while data is getting updated or accessed.

6 0
4 years ago
A school’s administration stores the following data for each student in an online system: name, class, and five electives. Selec
aleksandr82 [10.1K]

Answer:

Array of Strings

Explanation:

I believe the best data type for this information would be an Array of Strings. This array would have a fixed size of 5 elements. One for each one of the five electives that the student will have. Then the individual electives will be String elements that are saved in the 5 indexes of the Array. This would allow all of the electives to be bundled into a single variable and accessed together or individually by the user. This would be the best and most efficient data type to store this information.

5 0
3 years ago
A canister is released from a helicopter 500m above the ground. The canister is designed to withstand an impact speed of up to 1
Lisa [10]

Answer:

a) h = 1/2 gt² b) 99 m/s c) 14.1 m/s

Explanation:

a) As the only force acting on the canister once released is gravity, as it is constant, we can use one of the kinematic equations, as follows:

h = h₀ + v₀t + 1/2a t²

As we are told that the canister is simply released, it means that v₀ =0.

If we choose the direction of the acceleration (downward) as positive ,and we select the height at which it was released as our origin, so h₀ =0, the final expression for height is as follows:

h = 1/2 g t²

b) Combining this equation with the expression of t, from the definition of acceleration as the rate of change of velocity, we arrive to this expression:

vf² - v₀² = 2 g h  

As v₀ = 0, we have v₀ = √2.g.h = √2.9.8.500 m²/s² = 99 m/s

c) In order to be able to break the canister, impact speed must be larger than 100 m/s.

So, we can use the same equation as above, putting vf=100 m/s, and solving for v₀, as follows:

v₀² = vf² - 2.g.h = 100² m²/s² - 2.9.8.500 m²/s² = 200 m²/s²

v₀ = √200 m²/s² = 14.1 m/s

For any value of v₀ just barely larger than this, the canister will be broken.

7 0
3 years ago
The home keys on the numeric keypad are?
Eva8 [605]
4, 5 , 6 , and plus key
456+
5 0
3 years ago
Read 2 more answers
Other questions:
  • Let PALINDROME_DFA= | M is a DFA, and for all s ∈ L(M), s is a palindrome}. Show that PALINDROME_DFA ∈ P by providing an algorit
    5·1 answer
  • Discuss OPENGL instruction to draw the following drawing primatives:
    14·1 answer
  • What would be the results of the following code? final int SIZE = 25; int[] array1 = new int[SIZE]; … // Code that will put valu
    9·1 answer
  • In the case below, the original source material is given along with a sample of student work. Determine the type of plagiarism b
    7·1 answer
  • What year did Elvis die? Right answer 1977.
    14·1 answer
  • Click to review the online content. Then answer the question(s) below, using complete sentences. Scroll down to view additional
    14·2 answers
  • Describe the forward button​
    7·1 answer
  • Write a Python program stored in a file q1.py to play Rock-Paper-Scissors. In this game, two players count aloud to three, swing
    13·1 answer
  • Do a comment if u hate me.or think im d.U.m b. add a answer if u dont care. thank all the asnwers or report for saying i dont ex
    9·1 answer
  • What is table,form,query and report ?short ans​
    13·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!