mirror of
https://github.com/bregman-arie/devops-exercises.git
synced 2024-11-24 08:22:12 +02:00
add Python begginner reverse a string answer
This commit is contained in:
parent
edfba36818
commit
279c727ea0
10
README.md
10
README.md
@ -1751,8 +1751,14 @@ set([food for bro in x for food in bro['food']])
|
||||
<details>
|
||||
<summary>How to reverse a string?</summary><br><b>
|
||||
|
||||
Shortest way is: <code>my_string[::-1]</code> but it doesn't mean it's the most efficient one.
|
||||
</b></details>
|
||||
Shortest way is: <code>my_string[::-1]</code> but it doesn't mean it's the most efficient one. <br>
|
||||
Cassic way is: <code>
|
||||
def reverse_string(string):
|
||||
temp = ""
|
||||
for char in string:
|
||||
temp = char + temp
|
||||
return temp
|
||||
</code></b></details>
|
||||
|
||||
<details>
|
||||
<summary>Write a function to determine if a given string is a palindrome</summary><br><b>
|
||||
|
Loading…
Reference in New Issue
Block a user