#Python #Rust #rustlang #programming #textprocessing
Learn how to swap uppercase and lowercase and text within a string using Python and Rust as example languages. This no-fluff tutorial is excellent for those people who like to learn by doing.
It's not the most efficient way to do this though. What are your suggested improvements?
Python code as a single function:
def invert_case(text: str):
opposites = {}
for (u, l) in zip(iter(text.upper()), iter(text.lower())):
opposites[u] = l
opposites[l] = u
return "".join(opposites[c] for c in iter(text))
Rust code available via this link: https://play.rust-lang.org/?version=s...
📚 Resources:
Code: https://github.com/timClicks/tutorial...
👋 Connect with Tim
https://www.youtube.com/c/timClicks?s...
/ timmcnamaranz
/ timclicks
https://github.com/timClicks
https://mastodon.nz/@timClicks
https://dev.to/timclicks/
/ timclicks
🔔 Subscribe to the channel and click the bell icon to stay updated with the latest videos and live streams from timClicks: https://www.youtube.com/timClicks?sub...
👍 Like this video if you found it helpful, and share it with your friends who are also interested in Rust programming.
Watch video Swap uppercase and lowercase of text (hELLO to Hello) with code using Python and Rust online without registration, duration hours minute second in high quality. This video was added by user timClicks 28 April 2024, don't forget to share it with your friends and acquaintances, it has been viewed on our site 62 once and liked it 2 people.