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

Python Course Content

The document provides an extensive overview of Python programming concepts, including data types, operators, control structures, and built-in functions. It covers various data structures such as strings, lists, tuples, sets, and dictionaries, along with their operations and methods. Additionally, it discusses file handling, regular expressions, and date and time functions in Python.

Uploaded by

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

Python Course Content

The document provides an extensive overview of Python programming concepts, including data types, operators, control structures, and built-in functions. It covers various data structures such as strings, lists, tuples, sets, and dictionaries, along with their operations and methods. Additionally, it discusses file handling, regular expressions, and date and time functions in Python.

Uploaded by

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

print()

comment
types of comment
quotation
types of quotation
first program
input()
variable

data type conversion

operator

Arithmatic operator
+
-
*
/ division 165/10 16.5
// floor division 16//10 16
** 5**3
% 5%2 1

Assigment operator
=
+=
-=
*=
/=
//=
**=
%=
Multiple assignment
parallel assigment
non parallel

a=10
b=20
comperision operator
a == b (equals to)
a != b (not equals to)
a > b (greater than)
a < b (less than)
a >= b (greater than equal)
a <= b (less than equal to)

bitwise operator
&
|
^
~
<<
>>

logical operator
and
or
not

membership operator
in
not in

identity operator
is
is not

decision making
if(singel statement suit)
if else
nested if

loops in python
while loop
for loop

loop control statement


break
continue
pass

break
continue
pass

nested loop
while nested
nested for loop

string in python
creating strign
traversing string
accessing
slicing
range slicing
*updating
deleting

operation on string
+
*
in
not in

built-in function
capitalize()
center(width, fillchar)
count(str, beg= 0,end=len(string))
#decode(encoding='UTF-8',errors='strict')
#encode(encoding='UTF-8',errors='strict')
endswith(suffix, beg=0, end=len(string))
expandtabs(tabsize=8)
find(str, beg=0 end=len(string))
index(str, beg=0, end=len(string))
isalnum()
isalpha()
isdigit()
islower()
isnumeric()
isspace()
istitle()
isupper()
join(seq)
len(string)
lower()
Ljust(width, "fillchar")
rjust(width, "fillchar")
lstrip()
rstrip()
strip("chars")
*maketrans(intab, outtab)
max(str)
min(str)
replace(old, new [, max])
rfind(str, beg=0,end=len(string))
rindex( str, beg=0, end=len(string))
split(str="", num=string.count(str))
splitlines( num=string.count('
'))
startswith(str, beg=0,end=len(string))
swapcase()
title()
*translate(table, deletechars="")
upper()
zfill (width)
isdecimal()

list
creating a list
traversing a list
accessing a list
uddating a list
deleting a list

+
*
in
not in

Built-in List Functions & Methods


len(list)
max(list)
min(list)
list(seq)
list.append(obj)
list.count(obj)
list.clear()
list.copy()
list.extend(seq)
list.index(obj)
list.insert(index, obj)
list.pop(obj=list[-1])
list.remove(obj)
list.reverse()
list.sort([func])
nesting in list
#matrix formation in list
#list comprehension # [exp for i in list ]
list comprehesion with if condition
list comprehesion with nested if condition
list comprehesion with multiple traversing
list comprehesion with string

tuple
creating a tuple
traversing a tuple
accessing a tuple
#updating a tuple
deleting a tuple

max()
min()
len()
tuple()

set operator
set basic operations
add()--Adds an element to the set
clear()--Removes all the elements from the set
copy()--Returns a copy of the set
intersection() Returns a set, that is the intersection of two other
sets
intersection_update() Removes the items in this set that are not
present in other, specified set(s)
difference() Returns a set containing the difference between two
or more sets
difference_update()
isdisjoint()
issubset() Returns whether another set contains this set or not
issuperset() Returns whether this set contains another set or not
discard() Remove the specified item
pop() Removes an element from the set
remove() Removes the specified element
symmetric_difference() Returns a set with the symmetric
differences of two sets
symmetric_difference_update() inserts the symmetric differences
from this set and another
union() Return a set containing the union of sets
update() Update the set with the union of this set and others

dictiorany in python
Accessing
Updating
Deleting
travering

# +
# *
in
not in
len(dict)
str(dict)
type(variable)
dict.clear()
dict.copy()
dict.values()
dict.keys()
dict.fromkeys()
dict.get(key, default=None)
dict.items()
dict.setdefault(key, default=None)
dict.update(dict2)
dictionery comprehesion

Python - Numbers
Mathematical Functions
abs(x)
fabs(x)
ceil(x)
floor(x)
exp(x)
log(x)
log10(x)
max(x1, x2,...)
min(x1, x2,...)
modf(x)
pow(x, y)
round(x [,n])
sqrt(x)

Random Number Functions


choice(seq)
randrange ([start,] stop [,step])
randint(1,100)
uniform(x, y)
random()
seed([x])
shuffle(lst)

Trigonometric Functions
acos(x)
asin(x)
atan(x)
atan2(y, x)
cos(x)
hypot(x, y)
sin(x)
tan(x)
degrees(x)
Mathematical Constants
pi
e

function in python
creating function in python
calling function
call by values
#call ny refrence
global variable
local variable
return

Lambda function
modular programming in python
import file
from file import module
from file import all

file handling in python

file read and write in python


reading a file
read()
readline()
writing a file
write()
transfering data in file
file basic mode in python
read file--(r)
read binary--(rb)
read and write--(r+)
read and write binaty--(rb+)
write only--(w)
write binary--(wb)
write and read--(w+)
write and read binaty--(wb+)
append--(a)
append binary--(ab)
append and read--(a+)
append aeading a file
read()
readline()
writing a file
write()
transfering data in file
nd read binary--(ab+)

the file object attribute


file.closed
file.mode
file.name

file basic operation in python


close a file
read a file
write a file
read a file
file posotion (tell() method)
rename a file
delete a file
directories in python
mkdir() method
rmdir() method
rename() methd
chdir() method
getch() method
file and directory related methods
file.close
file.closed
file.flush
file.fileno
file.isatty
file.read()
file.readline(size)
file.readlines(sizehint)
file.seek()
file.tell()
file.truncate([size])
file.write(str)
file.writelines(sequence)

built-in function
regular expression in python
findall
search
split
sub

Metacharacters
[] A set of characters
\ Signals a special sequence (can also be used to
escape special characters)
. Any character (except newline character)
^ Starts with
$ Ends with
* Zero or more occurrences
+ One or more occurrences
{} Exactly the specified number of occurrences
| Either or

Special Sequences
\A Returns a match if the specified characters are at
the beginning of the string
# Returns a match where the specified characters are at
the beginning or at the end of a word
\B Returns a match where the specified characters are
present, but NOT at the beginning (or at the end) of a word
\d Returns a match where the string contains digits
(numbers from 0-9)
\D Returns a match where the string DOES NOT contain
digits
\s Returns a match where the string contains a white
space character
\S Returns a match where the string DOES NOT contain a
white space character
\w Returns a match where the string contains any word
characters (characters from a to Z, digits from 0-9, and the underscore _
character)
\W Returns a match where the string DOES NOT contain any
word characters
\Z Returns a match if the specified characters are at
the end of the string
Sets
[abc] Returns a match where one of the specified characters
(a, r, or n) are present
[^abc] Returns a match for any character EXCEPT a, r,
and n
[a-n] Returns a match for any lower case character,
alphabetically between a and n
[0123] Returns a match where any of the specified
digits (0, 1, 2, or 3) are present
[0-9] Returns a match for any digit between 0 and 9
[0-5][0-9] Returns a match for any two-digit numbers from 00 and
59
[a-zA-Z] Returns a match for any character
alphabetically between a and z, lower case OR upper case
[+] In sets, +, *, ., |, (), $,{} has no special meaning,
so [+] means: return a match for any + character in the string

Python - Date & Time


time.time() day(86400)
time.clock()
time.localtime()

You might also like