Question
2. Write a program that reads a string and prints the reversal. You should define a function called reverse() that computes the reversal of a
2. Write a program that reads a string and prints the reversal. You should define a function called reverse() that computes the reversal of a string using a loop. For this programming exercise you are not allowed to reverse a string using [::-1]. The input of the program (function) is a string s. For example: reverse(Python is fun!) should return the string !nuf si nohtyP reverse(Texas Aggies) should return the string seiggA saxeT reverse(Reveille) should return the string ellieveR Notes: len(s) is a function that returns the numbers of caracteres of the string. Strings do not support item assignment, so you cant do this: s[i] = a. You can use operations like concatenation to solve your problem.
by the way this has to be done in python
Example #1. Python is fun! Enter the string Python is Fun! Reverse string: !nuF si nohtvP Example #2. n= 1000. 1Enter the string Texas Aggies Reverse string: sei88A saxeTStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started