BEGINNER PYTHON CODING - REVERSE WORDS IN A STRING

Veröffentlicht am: 26 Juli 2019
auf dem Kanal: Apptato Trivia & Word Games
1,114
14

This is a beginner python coding exercise. Reverse words in a string!

💻 Code along with a Python 3 online compiler: https://www.onlinegdb.com/online_pyth...
⭐ SUBSCRIBE to Apptato for more Brain Teasers, Code Challenges and interesting math problems!
💻 Problem taken from geeksforgeeks.org

Question:
Reverse Words in a given String

For example:
1 2 3 4 5 -- 5 4 3 2 1
Reverse a String in Python 3 -- 3 Python in String a Reverse

Coverage & Review:
Array Split
Array Join
Array For Loop


Answer:

Code:

string = "5 4 3 2 1"

def reverseString(s):
wordArray = s.split(' ')
output = []
for word in wordArray:
output.insert(0,word)
return " ".join(output)

print(reverseString(string))



Thanks for watching
Until next time!


** LINKS **

Website: http://www.apptato.com
YouTube:    / apptato  
Twitter:   / apptato  
Facebook:   / apptato  
Instagram:   / apptato  

#CODE #PYTHON #PROGRAMMING


Auf dieser Seite können Sie das Online-Video BEGINNER PYTHON CODING - REVERSE WORDS IN A STRING mit der Dauer stunde minuten sekunde in guter Qualität ansehen, das der Benutzer Apptato Trivia & Word Games 26 Juli 2019 hochgeladen hat, den Link mit Freunden und Bekannten teilen, dieses Video wurde auf Youtube bereits 1,114 Mal angesehen und es wurde von 14 den Zuschauern gefallen. Viel Spaß beim Betrachtenden Zuschauern gefallen!