Write a program that reads a string and reverses it


Problem

I. Write a program that reads a string and reverses it. Your program must be able to save the new reversed string in another variable. You must use "for loop" and indexing to accomplish this task. Compare your reversed string with the reversed string produced using the built in syntax such as s[: : -1] to see if they look the same (using comparison operator "==").

II. Write a program that reads in a continuous input of decimal numbers, stops when the user enters "stop". Think carefully about the most appropriate loop to use for this task. Upon entry into the loop body, keep track of the largest number input. Once input is complete, the program should output the largest number received accurate to the 3rd decimal place.

Hint: to keep track of the largest number during the input, you can use a variable, such as largest, to keep the running largest number. Each time you get a new number from the user, compare it with the largest. If it is larger than the largest, you update the largest. But what initial value should you give to variable largest? It should be the smallest possible value! In Python, the smallest possible float number is float('-Infinity').

Request for Solution File

Ask an Expert for Answer!!
Python Programming: Write a program that reads a string and reverses it
Reference No:- TGS03345611

Expected delivery within 24 Hours