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
Why were low quality video so often use when Internet connection we’re poorer than they are today
kakasveta [241]
What do you mean? I’m confused with the question, it doesn’t make sense:)
8 0
3 years ago
Create a float variable named diameter. This variable will hold the diameter of a circle. d. Create a float variable named PI.
Basile [38]

Answer:

float diameter=2*r; //hold the diameter of a circle

float PI; // float variable named PI.

Explanation:

Here we have declared two variable i.e diameter and PI of type float. The variable diameter will hold the diameter of a circle i.e  2*r  where r is the radius of a circle.

Following are the program in c++

#include <iostream> // header file

using namespace std; // namespace

int main() // main function

{

   float r=9.2; // variable declaration

float diameter=2*r; //hold the diameter of a circle

float PI=3.14; // float variable named PI hold 3.14

cout<<"diameter IS :"<<diameter<<endl<<"PI IS :"<<PI; // display value

  return 0;

}

Output:

diameter IS :18.4

PI IS :3.14

8 0
3 years ago
(choose one) Which is the proper means to decrement the integer variable, myScore, by one?
kakasveta [241]

Answer

                                                                                                                                                                                                         

Explanation

its too short please add more characters

7 0
4 years ago
Describe the objectives of e-commerce ?​
AnnZ [28]

Answer: eCommerce is to reach the more and right customers at the right time so that more orders can be placed and in turns, high revenue can be generated.

Explanation:

5 0
3 years ago
What does firewall do
Bogdan [553]

Answer:

help

Explanation: to make people blocked on school computer

4 0
3 years ago
Other questions:
  • python A pet shop wants to give a discount to its clients if they buy one or more pets. The discount is equal to 20 percent of t
    12·1 answer
  • You need a collection to represent secret agents. Every agent has a unique codename that identifies them, and an Agent object th
    14·1 answer
  • When registering online for your classes you log onto to a website provided by your university. The computer and web browser tha
    6·2 answers
  • An example of hardware is a(n) _____.
    9·2 answers
  • III. FILL-IN THE BLANK (five points each)
    14·1 answer
  • Where is the BIOS stored?<br><br> CPU<br> CMOS<br> RAM<br> Northbridge
    13·2 answers
  • Mha rp anyone? ima be baby shoto
    14·2 answers
  • Does anyone have any advice for me im a junior in highschool
    10·2 answers
  • What is the most appropriate data type for each of these items?
    15·1 answer
  • Explain how you would set up a Demilitarized Zone on. You have 25 workstations and a server on your site. Explain what additiona
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!