Python Programs | IT Developer
IT Developer

Python Programs



Share with a Friend

Python Programs - String

Reverse a string using slicing and loop - Python Program

Example 1 :

text = "Python" print(text[::-1]) # slicing rev = "" for ch in text: rev = ch + rev print(rev) # loop

Output

 
OUTPUT  :
nohtyP
nohtyP