Getting Started with Python
Class 11 · Computer Science · 22 Questions
Which of the following identifier names are invalid and why?
Write the corresponding Python assignment statements:
Write logical expressions corresponding to the following statements in Python and evaluate the expressions (assuming variables num1, num2, num3, first, middle, last are already having meaningful values):
Add a pair of parentheses to each expression so that it evaluates to True.
Write the output of the following:
Which data type will be used to represent the following data values and why?
Give the output of the following when num1 = 4, num2 = 3, num3 = 2
Categorise the following as syntax error, logical error or runtime error:
A dartboard of radius 10 units and the wall it is hanging on are represented using a two-dimensional coordinate system, with the board’s center at coordinate (0,0). Variables x and y store the x-coordinate and the y-coordinate of a dart that hits the dartboard. Write a Python expression using variables x and y that evaluates to True if the dart hits (is within) the dartboard, and then evaluate the expression for these dart coordinates:
Write a Python program to convert temperature in degree Celsius to degree Fahrenheit. If water boils at 100 degree C and freezes as 0 degree C, use the program to find out what is the boiling point and freezing point of water on the Fahrenheit scale. (Hint: T(°F) = T(°C) × 9/5 + 32)
Write a Python program to calculate the amount payable if money has been lent on simple interest. Principal or money lent = P, Rate of interest = R% per annum and Time = T years. Then Simple Interest (SI) = (P x R x T)/100. Amount payable = Principal + SI. P, R and T are given as input to the program.
Write a program to calculate in how many days a work will be completed by three persons A, B and C together. A, B, C take x days, y days and z days respectively to do the job alone. The formula to calculate the number of days if they work together is xyz/(xy + yz + xz) days where x, y, and z are given as input to the program.
Write a program to enter two integers and perform all arithmetic operations on them.
Write a program to swap two numbers using a third variable.
Write a program to swap two numbers without using a third variable.
Write a program to repeat the string “GOOD MORNING” n times. Here ‘n’ is an integer entered by the user.
Write a program to find average of three numbers.
The volume of a sphere with radius r is 4/3π. Write a Python program to find the volume of spheres with radius 7cm, 12cm, 16cm, respectively.
Write a program that asks the user to enter their name and age. Print a message addressed to the user that tells the user the year in which they will turn 100 years old.
The formula E = states that the equivalent energy (E) can be calculated as the mass (m) multiplied by the speed of light (c = about 10^{8}$$ m/s) squared. Write a program that accepts the mass of an object and determines its energy.