Specifically python | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
0

Specifically python

Anyone please guide me in this failed assignment. Anyone guide with writing python that can output data forexample (tea in reverse aet) am stuck.

20th Dec 2021, 11:32 AM
Katalo Andrew Jedidial
Katalo Andrew Jedidial - avatar
2 Réponses
+ 2
String = "sample string"[::-1] print(String) In my example, I used a slice that steps backwards, -1. From my example above, the slice statement [::-1] means begin at the end of the string (letter "g" in string) and end at position 0 (the first letter at the beginning; "s in sample"), move with the step -1, negative one, which means one step backwards. Printing the string will output the reverse of the string. I hope this helps
20th Dec 2021, 11:59 AM
Nana Senne Ackaah Gyasi
Nana Senne Ackaah Gyasi - avatar
20th Dec 2021, 12:01 PM
Nana Senne Ackaah Gyasi
Nana Senne Ackaah Gyasi - avatar