The document contains multiple coding questions and examples:
1. It lists several Python variable names and identifies which ones are invalid, such as variables that start with a number or contain special characters.
2. It provides Python assignment statements to assign values to variables for examples like assigning numbers to length and breadth, averaging values, assigning a list, and concatenating strings.
3. It asks which data types would be used for examples like the number of months in a year, a boolean value, a phone number, and other data to represent their values appropriately in Python.
4. It gives examples of Python expressions and operators, showing the output for examples using addition, exponents, floor division, string concatenation
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
107 views1 page
Py 1
The document contains multiple coding questions and examples:
1. It lists several Python variable names and identifies which ones are invalid, such as variables that start with a number or contain special characters.
2. It provides Python assignment statements to assign values to variables for examples like assigning numbers to length and breadth, averaging values, assigning a list, and concatenating strings.
3. It asks which data types would be used for examples like the number of months in a year, a boolean value, a phone number, and other data to represent their values appropriately in Python.
4. It gives examples of Python expressions and operators, showing the output for examples using addition, exponents, floor division, string concatenation
2. 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. e) Assign the concatenated value of string variables first, middle and last to variable fullname. Make sure to incorporate blank spaces appropriately between different parts of names. 3. Which data type will be used to represent the following data values and why? a) Number of months in a year b) Resident of Delhi or not c) Mobile number d) Pocket money e) Volume of a sphere f) Perimeter of a square g) Name of the student h) Address of the student 4. Give the output of the following when num1 = 4, num2 = 3, num3 = 2 a) num1 += num2 + num3 b) print (num1) c) num1 = num1 ** (num2 + num3) d) print (num1) e) num1 **= num2 + c f) num1 = '5' + '5' g) print(num1) h) print(4.00/(2.0+2.0)) i) num1 = 2+9*((3*12)-8)/10 j) print(num1) k) num1 = float(10) l) print (num1) m) num1 = int('3.14') n) print (num1) o) print(10 != 9 and 20 >= 20) p) print(5 % 10 + 10 < 50 and 29 <= 29)