You are on page 1of 2

Python

Date 06-03-24
Today I learned how to write a code in python
What is comment. It can be written with triple single inverted comma or #
python as a calculator
about module
how to play sound in python
date 07-04-24
Data types in python
1- Integers
2- Floating point numbers
3-Strings
4-Bolean
5-None
Python automatically identify the type of data
Name can be written as a_12 but not as “a_12 ghfen”
variable names are case sensitive
operators in python arithmetic operators, assignment operator, comparison, operator logical
operator
Converting string in an integer
Input function
For remainder we had apply %
Chapter 3: string string is a data type in python
slicing: greeting + name can be used to print a name and greeting
if command Is given to print 0:3 it will print the item 0,1,2 only
(for Harry the negative indices would be -5 as H)
Slicing with skip value: Name = “Mrityunjay” and d = [0:10:2] it will give Miyna skipping one
alphabet
Print(len(story)) will print the length of story and print(story.endswith()) will print whether it is true
or not. We can also find the occurrence of any alphabet by print(story.Count(“”)) likewise we can
capitalize find and replace using the corresponding python program
Escape sequence character: \n is new line
Chapter 4: List and Tuples List can be created using a square bracket [ ]
we can create a list using items of different types
we can sort a list for example L1= [1,8,3,5,99,58] we can use function L1.sort() to sort the list under
name L1 and it will sort the list in an ascending order similarly reverse function reverse the list
Append= add at the end of the list
insert, pop will remove the digit, remove will also do the same where remove ke sath hame name
dena padta hai
there is no problem if we repeat the value of a list
Newly added method can be seen on google website python docs
we can create a tuple using () which is an immutable data type in python but the major difference
between the list and the tuple is we cannot update a tuple
in order to print a tuple of a single digit we have to add an extra comma at the end of the digit to
avoid the error that will occur in the tuple .count will count the element of the tuple
more method of tuple can be seen on python.org
Chapter:5 Dictionary and sets Dictionary is as set of a key value pair
it's properties are it is unordered, mutable, indexed and it cannot contain duplicate key
Dictionary’s method

You might also like