0% found this document useful (0 votes)
6 views4 pages

Introduction to Python Programming

Uploaded by

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

Introduction to Python Programming

Uploaded by

atharvalmc
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Introduction to Python

Q1 - 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 of 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, DECIMAL, NUMERIC , NUMBER , and MONEY .

Q.6- Who created Python programming?

Ans. Guido Van Rossum.

Q.7- What is a 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.

Q.8- How to run Python Shell?

Ans. To run a python shell, follow the given steps below.

1. Open the power shell or command prompt on windows, and terminal window on Mac.

2. Write python there and then press enter.

3. A python prompt consisting of three greater than symbols i.e., “>>>” appears.

Now, just enter the single statement and see the results accordingly.

Q.9 - 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.10 - Write any four standard data types of python.


Ans. 1. Numeric 2. String. 3. List. [Link] 5. Set. 6.
Dictionary.

Q.11 - 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 Comment (#)


#This is a comment
print("Hello, World!")

[Link] Comment

#This is a comment
#written in
#more than just one line
print("Hello, World!")

3. Document Comment (“ “ “)

"""
This is a comment
written in
more than just one line
"""
print("Hello, World!")

Q.12- 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.13 - 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 14. - Why is python the preferred programming language for AI?

Ans. Because of its features like:

1. Standard built in Libraries so less coding

2. Ease of learning

3. Platform independent
4. Massive Community Support

5. Data Generation

6. More effective algorithm

7. Interpretive run time support

Q.15 - What are data types in python. Give some examples 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.

Example of data types:

1. Numeric

2. Sequence Type

3. Boolean

4. Set

5. Dictionary

You might also like