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
Lostsunrise [7]
2 years ago
5

I need to reverse a inputted word using for loops with range 0 to the input word and increment 1.

Computers and Technology
1 answer:
Ksivusya [100]2 years ago
4 0

fruit_name = input("What is your favorite fruit: ")

fruit_len = len(fruit_name)

fruit_len = int(fruit_len)

reversed_word = ""

lower = 0

upper = fruit_len

inc = 1

for lp in range(lower, upper, inc):

   reversed_word = (fruit_name[lp] + reversed_word)

   reversed_word = str(reversed_word)

print(fruit_name + " backwards is " + reversed_word)

I just changed the str(lp) to fruit_name[lp]. This takes lp as the index of fruit_name and gets the letter at that index. We then add that letter to the existing reversed_word. I think this is what you're looking for.

You might be interested in
Which of the following is an example of phishing attack? csp
TEA [102]
There are no examples you imbecile it’s A
4 0
3 years ago
Whats the correct answer
dem82 [27]
Line 2 or line 4 sorry if I’m wrong
7 0
3 years ago
Read 2 more answers
The CPU converts into information. The CPU is the mastermind of the computer, controlling everything that goes on through a seri
Harman [31]

Answer:

Mathematical sequences

Explanation:

Just did it

5 0
3 years ago
Read 2 more answers
A web page typically contains ________, which contains the formatting instructions for displaying the web page.
USPshnik [31]
HTML: Hypertext Markup Language. It's used in conjunction with CSS (Cascading Style Sheets), which implements presentation (adding color, positioning elements, etc.) and JavaScript (you'll often see this referred to as JS), which implements functionality (like clicking on buttons) for webpages.
3 0
3 years ago
_____ is a form of witty, amusing speech that is often used to bring people together.
Neporo4naja [7]

Answer:Informative

Explanation:

5 0
3 years ago
Read 2 more answers
Other questions:
  • Write a Python program that will take as input 5 integer values and will output the average of the odd values and the average of
    6·1 answer
  • HELP ASAP
    9·1 answer
  • What do character formats do for your document's message? A. Set how text aligns within a document B. Provide organization C. Pr
    6·2 answers
  • This is not a feature provided by most GUIS.<br> icons<br> windows<br> forms<br> menus
    14·2 answers
  • Which tasks can be completed using the Chart Tools Design tab? Check all that apply.
    5·1 answer
  • When two or more tables share the same number of columns, and when their corresponding columns share the same or compatible doma
    12·1 answer
  • What allows users to connect via the Internet to its private network?
    11·2 answers
  • What pointer appears when pointing to a hyperlink?
    9·1 answer
  • Select the correct answer.
    15·2 answers
  • Write a program in C/C++ to draw the following points: (0.0,0.0), (20.0,0.0), (20.0,20.0), (0.0,20.0) and (10.0,25.0). For this
    6·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!