+ 3

I typed a="rishabh", b="rishabh" & print("a" == "b"). I found output false why?

27th Jan 2019, 3:30 PM
Rishabh Chaturvedi
Rishabh Chaturvedi - avatar
18 ответов
+ 23
With "a" == "b" you test if "a" and "b" are the same letters. They are not, so the output is False. Remove the quotes to check if the contents of the variables are equal.
27th Jan 2019, 3:42 PM
Anna
Anna - avatar
+ 4
Jeet he is probably using python that's why he is using print instead of printf
2nd Feb 2019, 2:11 AM
Aditya
Aditya - avatar
+ 3
You are giving wrong input so that the output is false. Remove the quotes of a and b
28th Jan 2019, 12:31 PM
__z._.k_
__z._.k_ - avatar
+ 3
The same answer has been given seven times in a row now. I think OP got it by now
29th Jan 2019, 8:45 AM
Anna
Anna - avatar
+ 3
REGINA MUTUA But what is OP supposed to do with the quotes? Can he just keep them or do you think that removing them would be a better idea?
29th Jan 2019, 10:27 AM
Anna
Anna - avatar
+ 3
Jeet haldar That's why it's probably not a good idea to learn five languages at the same time 🤔
2nd Feb 2019, 6:02 AM
Anna
Anna - avatar
+ 2
Remove the quotes of and b
28th Jan 2019, 3:11 PM
Aditya
Aditya - avatar
+ 2
"a" and "b" are clearly not the same character
28th Jan 2019, 10:11 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 2
Remove the inverted commas from both "a", "b" you will definetly get the desired output ie 1
29th Jan 2019, 7:37 AM
MINAHIL_HUSSAIN
MINAHIL_HUSSAIN - avatar
+ 1
Remove the quotes of a n b
28th Jan 2019, 4:14 PM
Kavita Chaudhary
Kavita Chaudhary - avatar
+ 1
Quotes are the problem
28th Jan 2019, 5:37 PM
RISHIKESH T NAIR
RISHIKESH T NAIR - avatar
+ 1
Тут русски кто нибудь знает
28th Jan 2019, 5:41 PM
Жанна ива
+ 1
a and b are different characters so equalizing them makes the output false, precisely remove the quotes
29th Jan 2019, 8:55 AM
REGINA MUTUA
REGINA MUTUA - avatar
+ 1
Bhai sunn woh 2 bindu hataley dodega programme
30th Jan 2019, 5:24 PM
Hitesh Srivastava
Hitesh Srivastava - avatar
+ 1
a="rishabh" means you are assigning the string to a variable a. To check variable a is equal to variable b you should try a==b."a"=="b" means it checks if string a is equal to string b which is false and thereby gives error.
5th Feb 2019, 5:55 PM
Vedant Bhosale
0
One more thing you wrote print not printf
2nd Feb 2019, 1:56 AM
Jeet haldar
Jeet haldar - avatar
0
Anna sorry but I am learning them one by one not at the same time
2nd Feb 2019, 6:06 AM
Jeet haldar
Jeet haldar - avatar
0
There you comapre "a" with "b" which becames char values Not the variables a and b Thats why it prints false Write it as print(a==b).
3rd Apr 2019, 5:07 AM
Tony Stark
Tony Stark - avatar