Print list index without quotes and assign it to a veriable | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Print list index without quotes and assign it to a veriable

I want to print a list content without quotes and assign it to a veriable so I can use it in if else statements later. Here is mylist: Mylist=['11', '22', '33', '44'] I know to to print the values without quotes using >>>Print(*mylist) 11223344 But how do I assign 11223344 to a veriable such as x?

26th Oct 2020, 8:22 PM
Karzan
3 Answers
+ 4
print(*Mylist) will output 11 22 33 44 Not 11223344 So if you want that Use join method x = "".join(Mylist) print(x) >>>11223344 Hope It Helps You 😊
26th Oct 2020, 8:31 PM
Hacker Badshah
Hacker Badshah - avatar
0
Thank you Hacker badshah. Yes your method works great
26th Oct 2020, 8:36 PM
Karzan
0
You can turn around with for loop and print argument.https://code.sololearn.com/c3JsXImVGT1P/?ref=app
26th Oct 2020, 8:36 PM
HBhZ_C
HBhZ_C - avatar