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- The above question is from the chapter 'Introduction to Python'.
Python-
Python is a simple programming language.
It has been created by Guido van Rossum and launched in 1991.
Its features make it easy to understand and this language is used a lot in the big companies and industries.
Given question: 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.
Answer: a) length = 10
breadth = 20
b) sum = (length + breadth)/2
c) Stationery = [ 'Paper' , 'Gel Pen' , 'Eraser' ]
d) first = 'Mohandas'
middle = 'Karamchand'
last = 'Gandhi'