Getting Started with Python
Class 11 · Computer Science · 22 Questions
Add a pair of parentheses to each expression so that it evaluates to True.
Which data type will be used to represent the following data values and why?
Categorise the following as syntax error, logical error or runtime error:
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.
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.
Schools use “Student Management Information System” (SMIS) to manage student-related data. This system provides facilities for: • recording and maintaining personal details of students. • maintaining marks scored in assessments and computing results of students. • keeping track of student attendance. • managing many other student-related data. Let us automate this process step by step. Identify the personal details of students from your school identity card and write a program to accept these details for all students of your school and display them in the following format. Name of School Student Name: PQR Roll No: 99 Class: XI Section: A Address: Address Line 1 Address Line 2 City: ABC Pin Code: 999999 Parent’s/ Guardian’s Contact No: 999999999
Which of the following identifier names are invalid and why?
Write a program to swap two numbers without using a third variable.
Write a program to find average of three numbers.
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.
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):
Give the output of the following when num1 = 4, num2 = 3, num3 = 2
Write the corresponding Python assignment statements:
Write the output of the following:
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 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 repeat the string “GOOD MORNING” n times. Here ‘n’ is an integer entered by the user.