I'm confused about the equal operator,about assignment being one equal sign and comparison being two equal sign | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

I'm confused about the equal operator,about assignment being one equal sign and comparison being two equal sign

One equal sign = Two equal sign ==

29th Nov 2021, 3:14 PM
Eshighasim Christabel Chidera
2 Answers
+ 4
This = is used to assign a value to a variable while == known as the equality operator is used to check if value a == value b. Examples 1. a = 4 # assined a value to variable a print(a)#it prints 4 to the console 2. a = 4#4 has been assigned to variable a b = 5#5 has been assigned to variable b print(a==b)#it will print false because variable a is not the same as variable b
29th Nov 2021, 3:27 PM
MATOVU CALEB
MATOVU CALEB - avatar
+ 1
MATOVU CALEB oohhh..I get it now Thanks
30th Nov 2021, 8:07 PM
Eshighasim Christabel Chidera