16/dec/2021
....................................................................
exception handling
Sorted and ranges
{}.format(defined variable): this is used when you list the number of items in index in a particular format.You can only call them using this syntax.
==================================================================================================================
20th-21st Dec 2021
---------------------------
While < condition >
------statement
to display the no of items in sequential order which are stored in the index
for i, list in enumerate(total, start=1):
print(i,list)
where total is the array and i is the serial no
adding items to the index
total.append(list)
where total is the index which stores item values and list is the item which you're going to enter into the index
creating dictionaries:
dictionary = { key1:value1, key2:value2.............. }
inserting key and values in the dictionary
dictionary[key3] = value 1
deleting dictionary items from the list:
people.pop(k)
k= Variable where dictionary items are saved
to find out max or minimum from dictionary:
min(Grades.items())
Grades is the dictionary we created and items are the values we entered in the dictionary.
========================================================================================================================
5:12 PM 27-Dec-21
del is used to remove items from list,below is the syntax:
del electronics[0]
Sort:
Inorder to get the list in sequence we'll use this sort function,original sequence will be affected after using this function:
electronics.sort()
reverse():
sequence can be reversed using this function:
electronics.reverse()
==============================================================================================================================================
1:50 PM 28-Dec-21
from pprint import pprint:
pprint is the python builtin module which is used to print out well formatted datatypes in python
string.ascii_lowercase: returns list of characters from A to Z
No comments:
Post a Comment