0
What is the difference between print(' ')and print(" ")??
10 odpowiedzi
+ 2
a=' hello! hey i heard about bill 's marraige '
print(a)---> error
a=" hello! hey i heard about bill 's marraige "
print(a)---> no error
------------------------------------------
b= " he said , " I want money. " "
print(b)---> error
b= ' he said , " I want money. " '
print(b)---> no error
### hope it helped ####
+ 11
@Larry is right if it were C, C++, C# or Java
in those language there is a difference between ' ' and " "
' ' is actually used for a single character while " " is used for strings
in python and JavaScript (also probably Ruby) you can use either or a combination of both
+ 2
single quotes for character and double quotes for string
+ 2
in 1st a
string ends at ' (after bill)
rest generates error
in 2nd a
we made the compiler understand
that string is from " to "
no error on '
in 1st b
string ends at 2nd "
compiler generated error for rest
in 2nd b
we made compiler understand
string is from ' to '
no error
+ 1
thankyou Michelle
+ 1
hi Larry I think Michelle is right because I was able to write both print('hi') and print("hi ")and both worked and that's what made me confused anyway thanks to you also for helping me
0
a very big thx to you Sayan you made me more clear about it
0
✌👌good to know it..
0
here is a small code
that shows HOW TO OMIT ERRORS EVEN IF U ARE USING SAME QUOTES LIKE
1st a and 1st b
**read code comments and output comments to get the idea**
https://code.sololearn.com/cqOgACBjGnj3/?ref=app