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
Which of the following allows the transmission of voice and often video communication over the internet?
spin [16.1K]
Voice Over IP (VOIP) is the option that allows the transmission of voice and often video communication over the Internet.
So, this doesn't refer to mobile or other telephone communication, but rather to the Internet solely. Applications that are examples of this type of technology are Skype, Teamspeak, Ventrilo, and others. This technology is becoming better and better with each day and will probably replace phones completely in the future.
8 0
3 years ago
Which of the following is NOT areserved word in Java?intpublicstaticnum
Rama09 [41]

Answer:

num

Explanation:

In java reserved words are also known as keywords, keywords are reserve words for a language that can't be used as an identifier(name of a class, name of a variable, name of an array etc.) int, public static, are reserve words.

In given question num is not a reserved word.

6 0
3 years ago
High-level languages must be translated into machine language before they can be executed. _________________________
Rufina [12.5K]
High-level language programs must be translated into machine language before they can be executed. (Machine language instructions are encoded as binary numbers that are meant to be used by a machine, not read or written by people. The Java compiler translates Java programs into a language called Java bytecode.
4 0
2 years ago
A drink costs 2 dollars. A taco costs 5 dollars. Given the number of each, compute total cost and assign to totalCost. Ex: 2 dri
evablogger [386]

Answer:

OKKKkkkkkkayyyy

3 0
3 years ago
What is not critical when you are first designing a database?
Anvisha [2.4K]
The answer is : What the field names will be.   This <span>is not critical when you are first designing a database.  </span>
8 0
3 years ago
Other questions:
  • Which of the following represents the bus topology? Multiple Choice All devices are connected to a central device, called a hub.
    8·1 answer
  • "a router interface has been assigned an ip address of 172.16.192.166 with a mask of 255.255.255.252. to which subnet does the i
    5·1 answer
  • What can be done to improve the security of business uses of the Internet? Give several examples of ecurity measures and technol
    9·1 answer
  • How to show neither precious nor accurate
    13·1 answer
  • Select the organizational skills that can help with
    6·1 answer
  • Assume TCP is operating in steady state congestion avoidance phase (no slow start) and the maximum congestion window size is 220
    8·1 answer
  • Which two pieces of information must be provided when saving a file for the first time in Wordpad?____.
    8·1 answer
  • A general rule for printing is to use _____ fonts for headlines and serif fonts for body text
    6·1 answer
  • 2. What does the "Users" metric measure?
    10·1 answer
  • Open IDLE. Create a new script file (File--&gt;New File, Ctrl n on Windows, Cmd n on macOS). On the first line, place your name
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!