Written by students who passed Immediately available after payment Read online or as PDF Wrong document? Swap it for free 4.6 TrustPilot
logo-home
Class notes

Python

Rating
-
Sold
-
Pages
12
Uploaded on
07-05-2024
Written in
2023/2024

These notes on the Python programming language are an excellent resource for anyone looking to learn or improve their Python skills. The clear and concise explanations make it easy to understand even the most complex concepts. The author has included numerous examples and practical exercises to help reinforce the material covered in each section. Whether you are a beginner or an experienced programmer, these notes are a valuable reference to keep on hand. With this comprehensive guide, you can confidently tackle any Python project with ease.

Show more Read less
Institution
Course

Content preview

Python

, 1. What are two modes of working in IDLE?
Interactive mode:
Interactive mode is very convenient for writing concise lines of code. In Python, it is also known as REPL which stands
for Read Evaluate Print Loop. Here, the read function reads input from the user and stores it in memory. The eval
function evaluates input to get the desired output.
Script Mode:
In script mode, you write your code in a .py file and then run it with the Python command. This is the most common
way that people use Python because it lets you write and save your code so that you can use it again later.

2. What is a variable? What are the rules for naming a variable?
Variables in Python are containers that store values. The rules to name variables are as follows:
a. Variable names must start with a letter or underscore character.
b. Variable names cannot start with a number.
c. It can only contain alpha-numeric characters and underscores.
d. They are case-sensitive.
e. Reserved words cannot be used in naming a variable.

3. Explain the difference between Brackets, Braces, and Parenthesis.
Brackets Braces Parenthesis
Brackets show changes within the Braces are not typically used except Parenthesis is for
quoted material. in technical and mathematical separating citations or other
wrongs. asides from body text.
Brackets are dented by the ‘[ ]’ Braces are denoted by the ‘{}’ Parenthesis is denoted by the ‘()’
symbol. symbol. symbol.

4. Explain the control statement by using a for loop.
With loop control statements, you can repeatedly execute a block of code. For statements loop, a specific number of
times, and keep track of each iteration with an incrementing index variable.

5. Explain the Break statement with a suitable example.
The purpose of a break statement is to break out of the loop early. For example, the following code takes 2 lists and
returns true if they have common members.
a=[1,2,3,4,5,6,7]
b= [2,4,6,8]
for i in a
for j in b
if I == j
print(“true”)
break;

6. Explain type conversion in Python
Type conversion is the process of converting a data type into another data type. Implicit type conversion is performed
by the user by Python interpreter only. Explicit type conversion is performed by the user by explicitly using the type
conversion function in the program code. Explicit type conversion is also known as typecasting. Python, when
performing implicit typecasting, avoids the loss of classes in data.

7. What is import? Explain ways of importing in Python.
Python code in one module gains access to code in another module by the process of importing it. Import statement
is the most common way of invoking import machinery, but it is not the only way.Functions such as
importlib.import_module() and built-in import() can also be used to invoke import machinery. Import statement
combines two operations; it searches for a named module, and then it binds the results of that search to a name in
the local scope. The search operation of the import statement is defined as a call to the import() function, with
appropriate arguments. The return value of import() is used to perform name binding operation of the import
statement.

Written for

Institution
Course

Document information

Uploaded on
May 7, 2024
Number of pages
12
Written in
2023/2024
Type
Class notes
Professor(s)
Dr. juita raut
Contains
All classes

Subjects

$3.99
Get access to the full document:

Wrong document? Swap it for free Within 14 days of purchase and before downloading, you can choose a different document. You can simply spend the amount again.
Written by students who passed
Immediately available after payment
Read online or as PDF

Get to know the seller
Seller avatar
sushanttare

Also available in package deal

Get to know the seller

Seller avatar
sushanttare University of Mumbai
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
2 year
Number of followers
0
Documents
7
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

Recently viewed by you

Why students choose Stuvia

Created by fellow students, verified by reviews

Quality you can trust: written by students who passed their tests and reviewed by others who've used these notes.

Didn't get what you expected? Choose another document

No worries! You can instantly pick a different document that better fits what you're looking for.

Pay as you like, start learning right away

No subscription, no commitments. Pay the way you're used to via credit card and download your PDF document instantly.

Student with book image

“Bought, downloaded, and aced it. It really can be that simple.”

Alisha Student

Working on your references?

Create accurate citations in APA, MLA and Harvard with our free citation generator.

Working on your references?

Frequently asked questions