0% found this document useful (0 votes)
4 views5 pages

3779992-Worksheet_class Ix_ai_part b Unit5_introduction to Python

The document is a worksheet for Class 9 students on Artificial Intelligence, specifically focusing on the introduction to Python. It covers various topics including the role of the Python interpreter, features of Python, data types, variables, comments, and arithmetic operators, along with examples and coding exercises. Additionally, it discusses why Python is preferred for AI and lists several Python IDEs.

Uploaded by

hacksamy786du
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
4 views5 pages

3779992-Worksheet_class Ix_ai_part b Unit5_introduction to Python

The document is a worksheet for Class 9 students on Artificial Intelligence, specifically focusing on the introduction to Python. It covers various topics including the role of the Python interpreter, features of Python, data types, variables, comments, and arithmetic operators, along with examples and coding exercises. Additionally, it discusses why Python is preferred for AI and lists several Python IDEs.

Uploaded by

hacksamy786du
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

INDIAN SCHOOL AL WADI AL KABIR

CLASS 9
Worksheet ARTIFICIAL INTELLIGENCE-CHAPTER 5
INTRODUCTION TO PYTHON

Q.1- What is the role of Python Interpreter ?


Ans. Python Interpreter- It is a computer program that executes code written in python.
Python interpreter takes an interactive command and executes it.
Q.2- Why we use python in AI ?
Ans. Python has rich library, it is also object oriented, easy to program. It can be also used
as frontend language. That's why it is used in artificial intelligence.
Q.3- Write any 4 features of Python.
Ans. Features-
1)No Declaration required (2) Inbuilt OOP support/Library (3)Less Code
(4)Ease of learning (5)Platform independent (6) Non restrictive syntax.
Q.4- What is Python and its applications?
Ans. Python is a widely-used, interpreted, object-oriented, and high-level programming
language with dynamic semantics, used for general-purpose programming.
Applications for Python
Web Development.
Game Development.
Machine Learning and Artificial Intelligence.
Data Science and Data Visualization.
Desktop GUI.
Web Scraping Applications.
Q.5- What do you understand by data types? Explain numeric data types in brief.
Ans. Data type- Data type is an attribute associated with a piece of data that tells a
computer system how to interpret its value.
Numeric data types are numbers stored in database columns. These data types are
typically grouped by: Exact numeric types, values where the precision and scale
need to be preserved. The exact numeric types are INTEGER , BIGINT , DECIMAL
, NUMERIC , NUMBER , and MONEY .
Qn.6- Who was created Python programme?
Ans. Guido van Rossum.
Q.7- What is Variable in Python? Give example.
Ans. A Python variable is a reserved memory location to store values. In other words, a
variable in a python program gives data to the computer for processing.
Examples:-
Numbers, List, Tuple, Strings, Dictionary, etc.

Prepared by AJ , Department of Computer Science ISWK


Q.8- Explain String in Python with the help of example.
Ans. A string is a series of characters. In Python, anything inside quotes is a string. And
you can use either single quotes or double quotes.
For example: message = 'This is a string in Python' message = "This is also a string"
Q.9- Write any four standard data types of python .
Ans.
1. Numeric 2. String. 3. List. 4.Tuple 5. Set.6. Dictionary.

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

Prepared by AJ , Department of Computer Science ISWK


Q.15- Write a Python Code to find multiplication of two numbers. Display the result.
Ans. a=4
b=2
multi=a*b
print(multi)
Output
8
Q.16- Sh. Suresh has written following python code. This code is showing error,help Sh.
Suresh to rectify the error. Underline the error and rewrite the code.
a=10
20=b
a+b=sum
show (sum)
Ans. Correct Code-
a=10
b=20
sum=a+b
print(sum)
Q.17- Write the output of the following python statements.
(i) print('Good Morning, India')
(ii) print(0.25*0.5*2.5)
(iii) print (250+350*2//5)
Ans. (i) Good Morning, India
(ii) 0.3125
(iii) 390
Q.18- Identify the data type.
(i) dob = [19,"January",1990]
(ii) t = (5,'program',2.5)
Ans. (i) Lists
(ii) Tuple
Q.19- Match the Column 'A' with Column 'B' Column B
Column A

(i) + (Addition ) (i) Comparison operators


(ii) = = (ii) Logical operators
(iii) NOT (iii) Assignments Operators
(iv) + = (Add AND) (iv) Arithmetic operators
Ans. Column A Column B
(i) + (Addition ) (i) Arithmetic operators
(ii) = = (ii) Comparison operators
(iii) NOT (iii) Logical operators
(iv) + = (Add AND) (iv) Assignments Operators
Q.20- What output given by the following python code?
print("Good","Morning","India")
Prepared by AJ , Department of Computer Science ISWK
Ans. Good Morning India
Q.21- Write the output of the following python statements 5
i) print('Sunday' + 'Monday' + 'Holiday')
ii) print(16 * 4)
iii) print(1998 - 1964)
iv) print(100 // 25)
v) print(390 + 27 + 63 + 71)
Ans. i. SundayMondayHoliday
ii. 64
iii. 34
iv. 4
v. 551
Q.22- Write the Boolean value (“True” or “False”) returned by the following relational
expression in Python.
a. 10140 > 10104
b. 356 < 78
c. 'Lion'=='Leon'
Ans. a) True
b) False
c) False
Q.23- What output given by the following Python code?
SP = 3126
CP = 2500
x = SP - CP
if x > 0:
print('Profit gain')
else:
print('Loss suffer')
Ans. Profit gain
Q.24- Identify and write the name of variables used in the following python program .
player_name = 'Sachin'
century = 51
runs = 15000
print('Players name is ', player_name)
print('He made',century,'centuries')
print(runs,' Runs is the world record')
book = 'Autobiography'
price = 450
print('lets purchase the book', book)
print('Its cost only ', price,' Rs')
Ans. player_name, century, runs, book, price
Q.25- What is python IDEs. Write some Python IDEs.

Prepared by AJ , Department of Computer Science ISWK


Ans. It is specially designed for software development that consists of several tools
which is used for developing and testing the software.
There are some Python IDEs
IDLE python
PyCharm
Spyder
PyDev
Atom
Microsoft Visual Studio
Jupyter Notebook
Q.26- Find the output of given program.
(1) L1 = ["John", 102, "USA"]
(2) T2 = ("Apple", "Banana", "Orange")
print(type(L1))
print(type(T2))
Ans. <class 'list'>,
<class 'Tuple'>

Prepared by AJ , Department of Computer Science ISWK

You might also like