Computer Science, asked by rekha1972mishra, 5 months ago

5. Consider the two variables a and b. Write a program in Python to assign
value 2 to variable a and value 3 to variable b. Then interchange and
display the values of a and b.​

Answers

Answered by vidya1112
5

lAssigning Values to Variables

Python variables do not need explicit declaration to reserve memory space. The declaration happens automatically when you assign a value to a variable. The equal sign (=) is used to assign values to variables

To swap values of variables, write as follows:

a = 1 b = 2 a, b = b, a print('a = ', a) print('b = ', b) # a = 2 # b = 1. ...

a, b = 100, 200 print('a = ', a) print('b = ', b) # a = 100 # b = 200.

hope it will helpful for you

please mark me brainlist

Similar questions