Q1. Write the corresponding Python assignment statements:
a) Assign 10 to variable length and 20 to variable breadth.
b) Assign the average of values of variables length and breadth to a variable sum.
c) Assign a list containing strings 'Paper', 'Gel Pen', and 'Eraser' to a variable stationery.
d) Assign the strings 'Mohandas', 'Karamchand', and 'Gandhi' to variables first, middle and last.
Answers
Answer:
PYTHON
Explanation:
a) length = 10
breadth = 20
b) sum = (length+breadth)/2
c) stationary = ['Paper', 'Gel Pen', 'Eraser']
d) first = "Mohandas"
middle = "Karamchand"
last = "Gandhi"
Answer:
a) length = 10
breadth = 20
or
length, breadth = 10, 20
b) sum = (length + breadth)/2
c) stationery = ['Paper', 'Gel Pen', 'Eraser']
d) first,middle,last = "Mohandas","Karamchand","Gandhi"
or
first,middle,last = 'Mohandas','Karamchand','Gandhi'
or
first = "Mohandas"
middle = "Karamchand"
last = "Gandhi"
or
first = 'Mohandas'
middle = 'Karamchand'
last = 'Gandhi'
Explanation:
Python is created by Guido van Rossum and it came into existence in 1991. It is high-level and general programming language. It is a very lucid programming language as it has good language construct and object oriented approach. It is dynamically typed and garbage-collected.