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
Summary

Summary PYTHON PROGRAMMING SMALL AND PRECISE NOTES

Rating
-
Sold
-
Pages
22
Uploaded on
17-06-2024
Written in
2023/2024

"Comprehensive and practical notes on Python programming, covering essential concepts from variables and control structures to advanced topics like object-oriented programming and data analysis. Perfect for beginners and intermediate learners looking to master Python for diverse applications."

Show more Read less
Institution
Course

Content preview

1. What is python?
Python is a user-friendly programming language known for its simplicity and readability. It's widely used
in various fields like web development, data science, and automation. With a clear syntax and extensive
libraries, Python makes coding easier and faster.

2. Identifiers in python: -
An identifier is a name given to entities like variables, functions, classes, modules, etc.
1. Must begin with a letter (a-z, A-Z) or an underscore (_).
2. Can be followed by letters, underscores, or digits (0-9).
3. Names are case-sensitive (e.g., "myVar" and "myvar" are different).
4. Cannot be a reserved word or keyword used in Python (such as "if", "for", "while", "def", etc.)
5. Can be of any length.
6. Does not allow punctuation characters
7. Should maintain the standard procedure of naming convention , i.e. …starting class names
with uppercase letters , and other things with small

3. Keywords:-

Keywords in Python are reserved words that have special meanings and are part of the language syntax.
These keywords cannot be used as identifiers (such as variable names, function names, or class names)
because they are used by Python to define the structure and logic of the code.
Attempting to use a keyword as an identifier will result in a syntax error.
Import keyword
Print (keyword.kwlist)

4. Datatypes :-
Python have 3 types of datatypes :

i. Basic Data Types: These are fundamental data types provided by Python. They include:
 int: Integer numbers

 float: Floating-point numbers

 str: Strings

 bool: Boolean values - True or False (First letter to be capital always)

 complex: Complex numbers

ii. Container Data Types: These are data types that can hold multiple values or objects.
 list: Ordered collection of items, mutable

 tuple: Ordered collection of items, immutable

 dict: Collection of key-value pairs

,  set: Unordered collection of unique items

 frozenset: Immutable set

iii. User-defined Data Types: These are data types created by the user using classes and
objects. They allow developers to define custom structures and behaviours suited to their
specific needs.

5. List :-
A list in Python is an ordered collection of elements, mutable and accessed by index, typically enclosed in
square brackets `[]`. Lists can contain elements of different data types and support various operations like
appending, slicing, and sorting. We can also define list without using any brackets.

 Example:




 Characteristics Of lists are :
Ordered: It maintain the order of data insertions
Heterogeneous: It can contain value of different datatypes.
Type: List is both compound(holding values of different datatypes) and sequence(order wise) datatype
Mutable: List is mutable. We can use and update every value through their indexes.
Duplicate: It can contain duplicate values.
Symbol: In list we use [].
Reverse: In list for doing reverse we start counting from the last index as -1 , then second last -2 , so on.

 Operations of lists are :-
 Merging
 Mutability :
S=[1,05,75]
Ab=[‘k’,’l’,’d’]
U=[51,29]
Ab[1]=’j’
St=s+u
Print(ab)
Print(st)
 Concatenation
 Cloning
1st=[1,2,4]
 Searching
1st=1st+[5,9]  Comparison
Prinr(1st)

6. Tuple :-

, A tuple in Python is an ordered, immutable collection of elements, defined using parentheses `()`. Tuples
are often used for heterogeneous data and as a lightweight alternative to lists for storing data.

 Example:




 Characteristics Of Tuple :
Ordered: It maintain the order of data insertions
Heterogeneous: It can contain value of different datatypes.
Type: Tuple is both compound and sequence datatype. Beside it is a read only datatype.
Immutable: Tuples are immutable. We can’t modify or update any value of tuple just like sets.
Duplicate: It can contain duplicate values like sets.
Symbol: In tuples we use ().


 Operations of tuple are :-
 Count -> tuple_name.count(“name_of_elemnt”)
 Concatenation -> final=tuple1+tuple2



7. Dictionary
A dictionary in Python is an unordered collection of key-value pairs, defined using curly braces `{}`.
Keys must be unique and immutable, while values can be of any data type.
This are like hashing (concept of having a key value that tells us about the data location )Here index
can be anything , it can be a string , it can be a number , it can also be a float, or anything.

 Example:




 Syntax :
tinydict = {'name': 'john' , 'code':6734, }

Written for

Institution
Course

Document information

Uploaded on
June 17, 2024
Number of pages
22
Written in
2023/2024
Type
SUMMARY

Subjects

$9.49
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
akanshasaha

Get to know the seller

Seller avatar
akanshasaha NSHM
Follow You need to be logged in order to follow users or courses
Sold
-
Member since
1 year
Number of followers
0
Documents
1
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