+ 6
Thats the code for the comprehension: w = ["Ra","JA","BA","Bu"] [print(tuple(i)) for i in w] # result is: ('R', 'a') ('J', 'A') ('B', 'A') ('B', 'u')
21st May 2020, 2:41 PM
Lothar
Lothar - avatar
+ 4
Rajababu Shab, if you will keep your loop method, there will only 2 things left for optimization: The input Data, and 2 variables that are initialized. So there is nothing that you can make more simple, except you do the initialization of your variables in 2 lines instead of 1 line. What you could do is to put it all in a comprehension, which is all in one line, but thats not more simple as your current code.
21st May 2020, 2:34 PM
Lothar
Lothar - avatar
+ 4
Triston Phillips, we are talking here about python. I have no glue what language your code is. Can you enlighten me?
23rd May 2020, 12:51 PM
Lothar
Lothar - avatar
+ 2
21st May 2020, 2:16 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 2
Rajababu Shah well It's pretty much reduced, u need those variables for sure, and you just have two lines in the loop.. Well hope if someone could reduce it further, keeping the while loop..
21st May 2020, 2:27 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Ikhuoria .E. Josephine It's kind of good to know you want to help solving problems, but it doesn't mean you have to answer all questions, unless you are sure that you can be helpful.. It leaves a bad impression, as well as spams the question..
21st May 2020, 2:18 PM
Мг. Кнап🌠
Мг. Кнап🌠 - avatar
+ 1
Correction taken sir.
21st May 2020, 2:20 PM
Ikhuoria .E. Josephine
Ikhuoria .E. Josephine - avatar
+ 1
heres an easier Way to do it {{b.=R_>AAnd if u C them its Ja Ba Bu Ra Mixed
22nd May 2020, 10:50 PM
Triston Phillips
0
Reduce it to what?
21st May 2020, 1:53 PM
Ikhuoria .E. Josephine
Ikhuoria .E. Josephine - avatar
22nd May 2020, 3:54 AM
Rahul Gupta
Rahul Gupta - avatar