Reputation:
this is my code:
a = input("Enter word here: ")
print("Reverse is", a[::-1])
this is my result:
Enter word here: patronus
Reverse is sunortap
this is what I want:
Enter word here: patronus
Reverse is sunortap
Enter word here:
I want it to ask for new words 10 times before it terminates.
Upvotes: 1
Views: 72
Reputation: 846
for i in range(10):
a = input("Enter word here: ")
print("Reverse is", a[::-1])
This works by looping 10 times. You can test it by printing i within the for loop.
Upvotes: 1
Reputation: 327
for x in range(10):
a = input("Enter word here: ")
print("Reverse is", a[::-1])
Upvotes: 0