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
Exam (elaborations)

Python programming notes basic to advanced level

Rating
-
Sold
-
Pages
15
Grade
A+
Uploaded on
05-03-2023
Written in
2022/2023

easy to understand and both for beginners and advanced.

Institution
Course

Content preview

Python programming language


Python is a high-level, interpreted, and general-purpose programming language that is used for a wide
range of applications such as web development, scientific computing, data analysis, artificial intelligence,
and more. It was created by Guido van Rossum in the late 1980s and was first released in 1991.

Keywords-
Keywords in Python are the reserved words that have a predefined meaning and cannot be used as
variable names, function names or any other identifiers. Here is the list of all the keywords in Python:

and del from None True

as elif global nonlocal try

assert else if not while

break except import or with

class False in pass yield

continue finally is raise async

def for lambda return await

It's important to note that keywords are case-sensitive in Python, which means that 'True' and 'true' are
not the same thing, and only the first one is a keyword.

Rules for writing keywords in python programming language-

1. Keywords are always written in lowercase letters.
2. Keywords cannot be used as variable names, function names, or any other identifiers.
3. Keywords cannot be abbreviated or used in any other form.
4. There are 33 keywords in Python, and they have a predefined meaning.
5. Keywords cannot be used for any other purpose other than their predefined use in Python.

Identifiers-
In Python programming language, an identifier is a name given to a variable, function, class, module, or
other objects. It is used to identify the object and access it in the program. Identifiers in Python have the
following rules:

1. Identifiers must begin with a letter (either uppercase or lowercase) or an underscore (_).
2. Identifiers can contain letters (uppercase or lowercase), digits (0-9), or underscores (_).
3. Identifiers are case-sensitive, which means that my_variable and My_Variable are different
identifiers.
4. Identifiers cannot be a keyword or reserved word. For example, 'if', 'else', 'for', 'while', etc. are
reserved words in Python and cannot be used as identifiers.

, 5. Identifiers should be descriptive and meaningful, so that they can be easily understood and
maintained by other developers.

Here are some examples of valid and invalid identifiers in Python:

Valid Identifiers:

• my_variable
• MyVariable
• _my_variable
• myVariable123

Invalid Identifiers:

• 123myvariable (cannot start with a digit)
• if (reserved word in Python)
• my-variable (cannot use hyphen in an identifier)

Statements-
In Python programming language, a statement is a unit of code that performs an action, such as
assigning a value to a variable, calling a function, or looping over a sequence of values. Python supports
a variety of statements, including:

1. Assignment statements: These statements assign a value to a variable using the assignment
operator (=). For example, x = 10 assigns the value 10 to the variable x.
2. Conditional statements: These statements execute different code depending on whether a
condition is true or false. The most common conditional statement in Python is the if statement.
For example:

if x > 0:

print("x is positive")

else:

print("x is non-positive")

3. Loop statements: These statements execute a block of code repeatedly, either a fixed number of
times or until a certain condition is met. Python supports two main types of loop statements: for
loops and while loops. For example:

for i in range(10):

print(i)



while x < 10:

x=x+1

Written for

Institution
Course

Document information

Uploaded on
March 5, 2023
Number of pages
15
Written in
2022/2023
Type
Exam (elaborations)
Contains
Questions & answers

Subjects

$10.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
nitin200411

Get to know the seller

Seller avatar
nitin200411 DBDS
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
3 year
Number of followers
0
Documents
2
Last sold
-

0.0

0 reviews

5
0
4
0
3
0
2
0
1
0

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