+ 1

Asking for some codes

Hi Can you please tell me how can I have these results? Code 1: Input : example Output : e x a m p l e Code 2: Input : example Output : elpmaxe If there are modules or functions about these codes ; please send me ; thanks a lot

22nd Jun 2020, 4:33 PM
Mr.Lightning
Mr.Lightning - avatar
12 Answers
+ 13
Please do not ask for a code. Do a try by yourself first, put your code in playground and link it here. If you get stuck, you can ask for help. Thanks!
22nd Jun 2020, 5:06 PM
Lothar
Lothar - avatar
+ 4
Code Crasher thanks my friend ; I got my answer
22nd Jun 2020, 5:48 PM
Mr.Lightning
Mr.Lightning - avatar
+ 4
Mirielle One-liner code - Ok, lambda is redundant🤔 print(" ".join(n), n[::-1], sep="/n")
23rd Jun 2020, 10:36 AM
Lobzov Alexey
Lobzov Alexey - avatar
+ 3
s=input() e1=list(s) # for Code 1 e2 =s # for Code 2 print(*e1) print(e2[::-1]) https://code.sololearn.com/c80GGl1Clhs0/?ref=app
22nd Jun 2020, 7:55 PM
Lobzov Alexey
Lobzov Alexey - avatar
+ 3
List and strings shares almost every methods so you don't need to convert strings to list before You can index, join or splice them. ``` print("\n".join((lambda n:[" ".join(n), n[::-1]])(input() or "example"))) ```
23rd Jun 2020, 2:02 AM
Mirielle
Mirielle - avatar
+ 3
Lobzov Alexey Code Crasher Mirielle Actually I'd rather like to 10 small lines instead of 1 unreadable line and I'm in WET (We Enjoy Typing) team
23rd Jun 2020, 5:52 PM
Mr.Lightning
Mr.Lightning - avatar
+ 3
Mr.Lightning it's all about writing an efficient code, lambdas are top in efficiency. ref: python.org
23rd Jun 2020, 10:26 PM
Mirielle
Mirielle - avatar
+ 2
Lobzov Alexey zen of Python isn't against the use of lambdas or oneliners. It only talk about making a code readable (not all oneliner are unreadable)
23rd Jun 2020, 11:09 AM
Mirielle
Mirielle - avatar
+ 1
To Mirielle Сan u read Zen of Python😉💪 In code: import this
23rd Jun 2020, 4:52 AM
Lobzov Alexey
Lobzov Alexey - avatar
0
I don't know what function shoudl I use ; if you know please tell me and I'll use it
22nd Jun 2020, 5:18 PM
Mr.Lightning
Mr.Lightning - avatar
0
LEGEND GAMER 916 We're talking about Python Mirielle Code Crasher I haven't read about Lambdas yet ; however thanks for answers
25th Jun 2020, 7:06 PM
Mr.Lightning
Mr.Lightning - avatar
- 3
<!DOCTYPE html> <html> <head> </head> <body><h6 style="color:blue;"style=" font-size:600%;">RANDOM FACTS</h6> <img src="" alt="dragonfly" width=400 height=300> <p style="font-size:100%;">A dragonfly is an insect belonging to the order Odonata, infraorder Anisoptera.</p> <img src="" alt="SUN" width=400 height=300> <p style="font-size:100%;">The Sun is the star at the center of the Solar System.</p> <img src="" alt="first bulb(incansadent bulb)" width=400 height=300> <p style="font-size:100%;">An incandescent light bulb, incandescent lamp or incandescent light globe is an electric light with a wire filament heated until it glows.</p> <img src="" alt="first book" width=400 height=300> <p style="font-size:100%;">The first book ever written that we know of is The Epic of Gilgamesh: a mythical retelling of an important political figure from history.</p> <img src="" alt="volcano" width=400 height=300> <p style="font-size:100%;">A volcano is a rupture in the crust of a planetary-mass object, such as Earth, that
24th Jun 2020, 4:43 AM
LEGEND GAMER 916
LEGEND GAMER 916 - avatar