Page 465 - ComputerScience_Class_11
P. 465
3. P = float(int("Enter principal amount: "))
R = float(input("Enter rate of interest: "))
T = float(input("Enter time in years: "))
SI = (P * Q * R) / 100
print(f"The simple interest is {SI}")
Ans. P = float(input("Enter principal amount: "))
R = float(input("Enter rate of interest: "))
T = float(input("Enter time in years: "))
SI = (P * R * T) / 100
print(f"The simple interest is {SI}")
Unsolved Questions
A. Tick ( ) the correct answer.
1. What does the f before a string in print() indicate?
a. A file string b. A formatted string
c. A final string d. A fixed string
2. Which parameter in the print() function is used to change the separator between values?
a. end b. sep
c. f d. join
3. Which symbol is used to place variables inside an f-string?
a. ( ) b. [ ]
c. { } d. < >
4. Mark the other name used for run-time errors.
a. Syntax errors b. Logical errors
c. Exceptions d. Parsing errors
5. Which type of error is the most challenging to diagnose?
a. Syntax error b. Run-time error
c. System error d. Logical error
B. Fill in the blanks.
1. When using input() to get numeric input, it always returns a ………………… .
2. int() converts a string to an ………………… .
3. ………………… occurs when you try to divide a number by zero.
4. The ………………… block is used to handle runtime errors in Python.
5. The program does not ………………… when a logical error occurs.
C. Answer the following questions:
1. What is a text-based interface called in programming?
2. Which two Python functions are essential for console I/O?
3. Why is a prompt used in the input() function?
4. Name the three broad types of errors in Python.
5. Define syntax error in Python.
6. What are logical errors in Python and why are they difficult to diagnose?
7. What are the common types of run-time errors in Python and their examples?
8. Why can't you directly use the input() function for mathematical operations in Python?
Data Processing in Python 463

