Page 121 - Computer Genius Class 08
P. 121
Output:
5
3.2
Hello
Description:
In the above program, we assigned different values to different variables in one statement. It is
one of the interesting features of Python, where multiple variables can be declared using a single
statement and each variable is separated from other by comma.
Example 5: Assigning same value to multiple variables.
Program:
a,b,c ="Same"
print(a)
print(b)
print(c)
Output:
Same
Same
Same
Description:
In the above program, we assigned same value to different variables. All type of values like integer,
oat, Boolean etc.
Example 6: Arithmetic operators in Python.
Program:
x = 15
y = 4
print('x+y=', x+y)
print('x- y=', x- y)
print('x*y=', x*y)
print('x/y=', x/y)
print('x//y=', x//y)
print('x**y=', x**y)
Output:
x + y = 19
x - y = 11
x * y = 60
x / y = 3.75
x // y = 3
x ** y = 50625
Basics of Python 119

