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
timofeeve [1]
3 years ago
8

Write a program whose input is two integers. Output the first integer and subsequent increments of 5 as long as the value is les

s than or equal to the second integer. Ex: If the input is: - 15 10 the output is: -15 -10 -5 0 5 10 Ex: If the second integer is less than the first as in: 20 5 the output is: Second integer can't be less than the first. For coding simplicity, output a space after every integer, including the last. 5.17 LAB: Print string in reverse Write a program that takes in a line of text as input, and outputs that line of text in reverse. The program repeats, ending when the user enters "Done", "done", or "d" for the line of text. Ex: If the input is: Hello there Hey done then the output is: ereht olleh уен 275344.1613222
Computers and Technology
1 answer:
adell [148]3 years ago
3 0

Answer:

Following are the code to the given question:

For code 1:

start = int(input())#defining a start variable that takes input from the user end

end = int(input())#defining a end variable that takes input from the user end

if start > end:#use if that checks start value greater than end value

   print("Second integer can't be less than the first.")#print message

else:#defining else block

   while start <= end:#defining a while loop that checks start value less than equal to end value

       print(start, end=' ')#print input value

       start += 5#incrementing the start value by 5

   print()#use print for space

For code 2:

while True:#defining a while loop that runs when its true

   data = input()#defining a data variable that inputs values

   if data == 'Done' or data == 'done' or data == 'd':#defining if block that checks data value

       break#use break keyword

   rev = ''#defining a string variable rev

   for ch in data:#defining a for loop that adds value in string variable  

       rev = ch + rev#adding value in rev variable

   print(rev)#print rev value

Explanation:

In the first code two-variable "first and end" is declared that takes input from the user end. After inputting the value if a block is used that checks start value greater than end value and use the print method that prints message.

In the else block a while loop is declared that checks start value less than equal to end value and inside the loop it prints input value and increments the start value by 5.

In the second code, a while loop runs when it's true and defines a data variable that inputs values. In the if block is used that checks data value and use break keyword.

In the next step, "rev" as a string variable is declared that uses the for loop that adds value in its variable and prints its values.

You might be interested in
A group of students writes their names and unique student ID numbers on sheets of paper. The sheets are then randomly placed in
aleksklad [387]

Answer:

D.

Explanation:

Binary searches are required to be first sorted, since they use process of elimination through halving the list every round until the answer is found. Linear searches just start from the beginning and check one by one.

6 0
3 years ago
True or false? If you’re posting the same content across different channels, make sure you post them simultaneously—on the same
alukav5142 [94]

Answer:

The answer is true.

Explanation:

7 0
2 years ago
The kitchen in any café is a noisy place. To make sure the orders which you have carefully written down on your notepad make it
Levart [38]

Answer:

file_name = 'orders.txt'

file_obj = open( file_name, 'r' )

lines = file_obj.read()

print(lines.upper(), end = '')

Explanation:

  • Define the name of the file .
  • Use the built-in open function to open the file in read mode .
  • Use the built-in read function to read the file and assign this to lines variable.
  • Finally display the lines by converting them to capital alphabets by using the built-in upper() function.
5 0
3 years ago
Two independent customers are scheduled to arrive in the afternoon. Their arrival times are uniformly distributed between 2 pm a
seraphim [82]

Answer:

1/3

Explanation:

T₁ , T₂ , be the arrival times of two customers.

See expected time for the earliest and latest below.

The formulas used will guide you.

4 0
3 years ago
which of these describes a property of all elements A. all elements have six electrons B. all elements are pure substances C. al
sergiy2304 [10]
Im guessing the answer would either B or C
3 0
3 years ago
Other questions:
  • You're trying to improve an ad's perceived quality so it performs better during an ad auction. What change would have the least-
    15·1 answer
  • Look up and list the number of a local taxi or car service in your community. Include the company name and telephone number.
    13·1 answer
  • In short and brave what is technology?
    9·2 answers
  • Why is the len ( ) function useful when using a loop to iterate through a stack?
    6·1 answer
  • Explain in three to four sentences what happens to data packets once they leave a node.
    11·2 answers
  • Describe the difference between the while loop and the do-while loop.
    7·1 answer
  • Many digital libraries have much more information than traditional libraries
    13·1 answer
  • Which is an example of machine-to-machine communication?
    7·1 answer
  • The full meaning of UNIVAC and ENIAC​
    5·2 answers
  • How does the technology affect you daily living? Give situations where you use technology and how it helped you.​
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!