0
How do I type in output for Python
4 Answers
+ 5
Bryce Fort ,
we can also use a reverse iterator: (it is simple to use, efficient and has very low memory consumption)
print("**********TEXT REVERSER**********")
txt = input("Enter any word or jumble of letters and reverse it here: \n")
for i in reversed(txt):
print(i,end="")
+ 2
Bryce Fort you can also try it like this
print("**********TEXT REVERSER**********")
txt = input("Enter any word or jumble of letters and reverse it here: ")
print(txt[::-1])
+ 1
Bryce Fort an easy way but not the only way is ..
print("**********TEXT REVERSER**********")
txt = input("Enter any word or jumble of letters and reverse it here: \n")
x = len(txt)
y = x
for i in range(y):
r = txt[x-1]
print(r,end="")
x -= 1
As you can see the
while True loop was removed as well as your if statement. AND you were not only inputting txt as a string but there was no need to also create an array as txt = []
0
You can't, except there is a prompt for input just like the input function