+ 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
7 Answers
+ 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
+ 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.
+ 1
Thnx this cleared a lot
+ 1
by the way how can we use else command in Python??
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
0
if a>0 :
do this
else :
do that
0
a is a variable thats why checking the value...is less than or greater