what will the following code do: a=b=18?
In python
Answers
Answered by
1
Answer:
Literals are data items that have a fixed value. The different types of literals allowed in Python are:
String literals
Numeric literals
Boolean literals
Special literal None
Literal collections
Explanation:
Answered by
2
a = b = 18
This assign same value to multiple variables in one line.
Therefore, a = 18 and also b = 18.
More examples :
1) x = y = z = "ABC"
So, x = "ABC" , y = "ABC" and also z = "ABC"
2) x , y , z = "Pink" , "Blue" , "Red"
So, x = "Pink" , y = "Blue" and z = "Red"
3) a , b = 123 , 345
So, a = 123 and b = 345
Attachments:
Similar questions