Page 462 - ComputerScience_Class_11
P. 462
Let’s Revisit
♦ The primary way to get data from the user into your Python program is through the built-in input() function.
♦ The input() function can accept an optional string argument, known as a prompt.
♦ print() is used to display output to the console.
♦ Errors are an inevitable part of programming. Instead of avoiding them, it's important to learn how to read and understand
error messages.
♦ Syntax errors, also known as parsing errors, are the most basic kind of error.
♦ Run-time errors, also known as exceptions, occur while the program is running.
♦ To prevent runtime errors from crashing your program, Python provides a way to catch and handle them.
♦ Logical errors are the most challenging to diagnose.
MIND DRILL
Solved Questions
A. Tick ( ) the correct answer.
1. Identify the term used for communication between a program and the outside world.
a. Processing b. Compilation
c. Input/Output d. Debugging
2. Which parameter in the print() function changes the separator between values?
a. end b. sep
c. join d. next
3. Mark the type of function used to take input from the user in Python.
a. User-defined function b. Output function
c. Loop function d. input() function
4. Spot the type of error that occurs due to violation of Python grammar rules.
a. Runtime error b. Logical error
c. Syntax error d. Input error
5. Identify the error that occurs when a function gets the correct type but a wrong value.
a. ValueError b. TypeError
c. NameError d. IndexError
Answers
1. c 2. b 3. d 4. c 5. a
B. Fill in the blanks.
1. ………………… accepting data from the user via the keyboard.
2. float() converts a string to a floating-point ………………….
3. Syntax errors also known as ………………… errors.
4. ………………… occurs when you try to use a variable or function that has not been defined.
5. Run-time errors occur while the program is ………………….
Answers
1. Input 2. Number 3. Pasrsing 4. NameError 5. running
460 Touchpad Computer Science (Ver. 3.0)-XI

