+ 1

Please must you use concatenation? Cant you write the code without it, like; print("First string , second string")

print("First string" + ", " + "second string")

18th Apr 2020, 11:57 AM
Faisal A Bukar
Faisal A Bukar - avatar
6 Réponses
+ 2
Then, no, you don't always need to use concatenation. It depends on what you're doing. You can use other methods like format or f-strings. Print wil also take comma separated values. a = 1 b = 2 c = 3 print(a, b, c) print("a is {}, b is {}, c is {}".format(a, b, c)) https://www.w3schools.com/JUMP_LINK__&&__python__&&__JUMP_LINK/ref_string_format.asp print(f"a is {a}, b is {b}, c is {c}") https://realpython.com/python-f-strings/
18th Apr 2020, 2:21 PM
ChaoticDawg
ChaoticDawg - avatar
+ 2
Thank you so much ChaoticDawg
18th Apr 2020, 2:35 PM
Faisal A Bukar
Faisal A Bukar - avatar
+ 1
Yes you MUST
18th Apr 2020, 12:23 PM
Rakshit Chaturvedi
Rakshit Chaturvedi - avatar
+ 1
What language?
18th Apr 2020, 1:36 PM
ChaoticDawg
ChaoticDawg - avatar
+ 1
Python sir
18th Apr 2020, 1:49 PM
Faisal A Bukar
Faisal A Bukar - avatar
0
Thank you.
18th Apr 2020, 12:26 PM
Faisal A Bukar
Faisal A Bukar - avatar