Reverse a string in Python | Python program #coding #python

preview_player
Показать описание

Рекомендации по теме
Комментарии
Автор

Explain the code please.. I don't know why it became reversed although we added every element in order in the empty string

malakhassan
Автор

str = "Python"
Print(
"ORIGINAL STRING:", str
"REVERSED STRING:", str[::-1]
) #It was one liner but I still expanded

yvg
Автор

Why we didn't call the function as usual and type.. reverse_string("sekar"): instead of..str = "sekar". ?

malakhassan
Автор

Can you elaborate why you took empty string str1 when you didn’t use it at all

joegoldberg
Автор

def revers_string(str_)
return str_[::-1]


str_ = revers_string('sekar')
print(str_)
=)

Lumen