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]
3 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]3 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 does your textbook recommend for preparing PowerPoint slides? Group of answer choices
Tcecarenko [31]

Answer:

1 & 3 only

1. Limit the amount of text to not more than 6 lines per slide

3. Stick to a limited number of colors and use them consistently

Explanation:

The general PowerPoint slide rule is 6 x 6 presentation rule which translates to

6 words per line and 6 lines per slide

It helps keeping your slide from being so dense and packed with information that people don't want to look at it.

It's always important to keep consistent colors in PowerPoint slides. This enables you to maintain cool rhythm throughout the slides.

Inconsistent colours easily distracts your audience/readers.

It's not advisable to use capital letters all through in PowerPoint slides.

3 0
3 years ago
Mha lovers why do other anime lovers report mha lovers for not liking there anime?
kow [346]

Answer: because it's a lot of hate and dark fanfic but soetimes people are stuck up but we all have opinions

Explanation: Is this logical

3 0
3 years ago
Read 2 more answers
What should you do first when designing a program?
Nady [450]

Answer: talk about da progrm

Explanation:

6 0
3 years ago
Read 2 more answers
Can someone write a 5 sentence summary about Virtual Assistants. Please. I'm in a rush. Personal problems.
Lyrx [107]
Virtual Assistants can be useful. Blind people can use them to be informed, browse the web, and learn new facts. They can make tasks quicker too. They can control things like your heater or air conditioner. But if one were to malfunction, it could take lives.
7 0
3 years ago
Page 1. I who invented computer?​
svetoff [14.1K]
Charles baggage (picture for more info)

4 0
2 years ago
Other questions:
  • You are provisioning a server with eight-core 3 GHz CMP that can execute a workload with an overall CPI of 2.0 (assuming that L2
    5·1 answer
  • Which of the following is NOT essential for individuals to have to build their own web page?
    9·1 answer
  • What test is most similar to binary​
    9·1 answer
  • :If a process terminates, will its threads also terminate or will they continue to run? Explain your answer.
    14·1 answer
  • What are the ethical implications of online social media after someone has died
    8·2 answers
  • You want to establish the validity of a test designed for computer technicians using a predictive criterion-related validation s
    9·1 answer
  • DTE just installed 500kW of solar capacity on the MCCC campus. the cost of the installation was about $3 million. what was the c
    10·1 answer
  • Ask the user to input a number less than 100. Print all the numbers from that number to 100.
    6·2 answers
  • Im boing exam help please In a category-based course grading system, teachers weigh a student's performance in all courses. all
    7·2 answers
  • Consider the following correct implementation of the selection sort algorithm.
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!