+ 4

Python ' "

When do we use ' and " in print command and how do they diffrr if we write '2' + '2' then it gves 22 or 4. This all confuses me A LOT!! and when to use () in priny command

26th Nov 2017, 3:04 PM
Jalaj Kumar
Jalaj Kumar - avatar
7 RĂ©ponses
+ 3
👌you could should use print () in python 3 for printing anything.The things needed to be printed should be given within () it. 👌"" and '' both are used to point out strings so if you try to add two strings it just gets joined eg: print("5"+'5') print("5"+"5") print('5'+'5') output: 55 55 55 You could choose anything to point out strings .For me I use "". 😊😊 I hope this helps
26th Nov 2017, 3:34 PM
VISHNU P.S
VISHNU P.S - avatar
+ 2
“” defines a string but when without “” defines other things (integer, floats, lists, etc etc). python takes strings literally, so if you ask it to print(“2 + 2”) it will print 2 + 2 and not 4 whereas in print(2 + 2) it prints 4 as python doesn't take it literally and does the calculation in the brackets. hope that helps.
27th Nov 2017, 3:17 PM
Cat🐈
Cat🐈 - avatar
+ 1
Thnx this cleared a lot
26th Nov 2017, 4:55 PM
Jalaj Kumar
Jalaj Kumar - avatar
+ 1
by the way how can we use else command in Python??
26th Nov 2017, 6:00 PM
Jalaj Kumar
Jalaj Kumar - avatar
0
' and " differs in there needs...my brother.. they are not just like : use anyone anytime.. for better underatanding...read the code below full and carefully follow the incode and output comments BOTH.. this code gives you a brief idea of why there is ' & " both..and 2 more things...which are often used with them YO MANUPULATE STRINGS...r and / https://code.sololearn.com/cnK7GbSZLglD/?ref=app
26th Nov 2017, 5:48 PM
sayan chandra
sayan chandra - avatar
0
if a>0 : do this else : do that
26th Nov 2017, 6:01 PM
sayan chandra
sayan chandra - avatar
0
a is a variable thats why checking the value...is less than or greater
27th Nov 2017, 12:05 PM
sayan chandra
sayan chandra - avatar