Datascience 2.
0
30 Days Master Class
DAY III
Announcement
• Attendance form | 7.30pm
• E-Certificate – end of the Series
• 25 Days attendance is required to get Free
Master Class participation Certificate
Recap of day-02:-
• Python
• History and versions of python language
• Its features and applications
• Installation process of python idle in system
• Different modes of execution of programs
• Basic Conditional statements with its syntax and examples
Basic fundamentals of python language :-
• Tokens – the small unit of progam.
• Keywords -
• Identifiers
• Literals
• Operators
• Comments -# this is a comment
Keywords :-
• Examples :-
• is or not if elif not and etc. are all the different keywords
Identifiers- variable names
• Rules for naming the variables:-
• No keywords
• No digits
• Only one special character is used when we name a variable .
• As python is case sensitive , should use proper case characters.
Literals-values
• String – single or double quotes
• Numeric literal - signed and unsigned integer
• Boolean literal- true or false
• Special literal- none
• Literal collection- list ,tuple , dictionary
Operators :-
• Arithmetic operator
• Relational operator
• Logical operator
• Bitwise operator
• Modification operator
List:-
• Used for storing of anytype of data.
• In list if once the data is stored , the data can be modified , that is why
we call as the data can be mutable .
• List data is stored in square brackets .
Tuple:-
• It is used to store the data permanently .i.e data is immutable.
• Parentheses I,e, () is used to store the data in tuple .
How to Enroll into 1 month Internship
FEE : Rs.999 COUPON : WELCOMEDS2
REG FEE : RS.597
‘[Link]
Dictionary :-
• Dictionary stores the data in the form of a key-value pair .
• We use {} to store this type of key-value pair .
• Data can be modified .
• Example :-
• A={‘name’:”sita”,”class”:5th,”rank”=1}
• Print(a)
• Print(a[0])
• Print(a[0:1])
Strings :-
• Set of characters
• String operations are as follows :-
• Concatenation
• Replication or repetition
List examples:-
• Program -01:-
• names = [“ram”, “sita”, “radha”,”krishna”]
print(names) # print the list elements
• print(len(names)) # print the length of the list
• school = ["abc", 34, True, 40, “marks"] # list with strings , integers , Boolean
• print(type(school)) # which type of data present in school
• Print (school[1]) # accessing list with positive index values
• Print(school[-1]) # accessing list with negative index values
• print(school[2:5])
• school[1] = “black colour #change the list elements
• [Link]("orange") # add the elements in the list
• [Link](1, “red") #inserting of elements
• [Link](“black colour") #remove the list elements
• [Link](1) #removes specified index element
Example of list with if-else condition
• names = [“sita", “ram", “radha“,”krishna”]
if “sita" in names:
print("Yes, sita is in the names list")
• Else:
• Print(“no , sita name is not given in the list ”)
Tuple examples :-
• Program-01
• fruits = ("apple", "banana", "cherry")
print(fruits) #accessing the tuple elements
• print(fruits[1]) #accessing through index values
• print(fruits[0:2]) #accessing tuple with index range
• Fruits[1] = "kiwi“ #update tuple elements
• (green, yellow, *red) = names
• print(green)
• print(yellow)
• print(red)
Concatenation of tuple elements:-
• tuple1 = ("a", "b" , "c")
tuple2 = (1, 2, 3)
tuple3 = tuple1 + tuple2
print(tuple3)
Replication of tuple elements :-
• fruits = ("apple", "banana", "cherry")
• mytuple = fruits * 2
• print(mytuple)
Dictionary examples :-
• Program-01:-
• school = {
“name”: “sunny",
“class": “5th",
“section": ”D”,
“[Link]” :”015”
}
Print(school)
Accessing of dictionary elements :-
• x = school[“class"] #accessing of dictionary
• school[“class"] = 6th #change of dictionary elements
• school[“grade"] = “A+“ #add of elements
• [Link](“class") # to remove elements
String operations
• String concatenation :-
• a = "Hello"
b = "World"
c = a + " " + b
print(c)
How to Enroll into 1 month Internship
FEE : Rs.999 COUPON : WELCOMEDS2
REG FEE : RS.597
‘[Link]
LAST DATE FOR REGISTRATION : 26.09.2022
Thanks!
Do you have any questions?
+91 8925533489
Phone Call: 9am
to 9pm