3779992-Worksheet_class Ix_ai_part b Unit5_introduction to Python
3779992-Worksheet_class Ix_ai_part b Unit5_introduction to Python
CLASS 9
Worksheet ARTIFICIAL INTELLIGENCE-CHAPTER 5
INTRODUCTION TO PYTHON
Q.10- What are comments in python ? List down the various types of comments.
Ans. Comments in Python are the lines in the code that are ignored by the compiler during
the execution of the program. Comments are non-executable statements in Python.
It means neither the python compiler nor the PVM will execute them.
There are three types of comments in Python –
1. Single line Comments
2.Multiline Comments
3. Docstring Comments
Q.11- What are the different modes for coding in python?
Ans. In the Python programming language, there are two ways in which we can run our
code:
1. Interactive mode
2. Script mode
Q.12- What is the use of Arithmetic Operators in Python? Write any four arithmetic
operators.
Ans. Arithmetic operators are used to perform mathematical operations like addition,
subtraction, multiplication and division.
Q.13- Why is python the preferred programming language for AI?
Ans. Because of its features like:
1. Standard built in Library, Less Code,
2. Ease of learning,
3. Platform independent,
4. Massive Community Support,
5. Data Generation,
6. More effective algorithm,
7. Interpretive run time support
Q.14- What are data types in python. Give some example of data types.
Ans. Data types are the classification or categorization of data items. It represents the
kind of value that tells what operations can be performed on a particular data.
1. Example of data types
2. Numeric
3. Sequence Type
4. Boolean
5. Set
6. Dictionary