I want to print a string in uppercase and backwards
 string = raw_input ("Favor ingrese su cadena-> ")
    print string.upper()
this one prints only in uppercase

HELLO

I want to print it backwards

OLLEH

Recommended Answers

[::-1] or reversed()

>>> s = 'hello' 
>>> s[::-1].upper()
'OLLEH'
>>> ''.join(reversed(s.upper()))
'OLLEH'
Jump to Post

All 2 Replies

[::-1] or reversed()

>>> s = 'hello' 
>>> s[::-1].upper()
'OLLEH'
>>> ''.join(reversed(s.upper()))
'OLLEH'
s = "Hello"
y = ""

for i in range(len(s) - 1, 0, -1):
    y.append(s[i])

y = y.upper()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of 1.20 million developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.