1 Introduction to Python_Day 1
1 Introduction to Python_Day 1
Python Bootcamp
Vaibhav P. Vasani
Assistant Professor
Department of Computer Engineering
K. J. Somaiya School of Engineering
Somaiya Vidyavihar University
Python as a popular language
for data science.
• Rich Ecosystem of Libraries
o NumPy, Pandas, Matplotlib , Seaborn, Scikit-learn,
TensorFlow & PyTorch
• Easy to Learn and Use
• Strong Community Support
• Versatility and Integration
o integrates seamlessly with databases (SQL, MongoDB)
• Open-Source and Cross-Platform
• Support for Automation and Deployment
o Flask and FastAPI
Variables
• Variable are nothing but any set of character to which is
assigned
• For eg.
• Test = 1,a = 2,b=”this is just a test”
• Multiple assignment => a=b=c=1 or a,b,c,d = 1,2,’test’,3
• Every time a values is assigned to a variable the we reserve a
memory for that variable based on the datatype of that
variable
Data Types
>>> type(15) >>> 1j * 1j
<class 'int'> (-1+0j)
>>> type (3.) >>> s = 3 + 1j
<class 'float'> >>> type(s)
>>> x = 34.8 <class 'complex'>
>>> type(x) >>> x = "learning”
<class 'float'> >>> type(x)
<class 'str'>
[email protected]
Python’s built-in type hierarchy
[email protected]
Expressions
• Mixed type (integer and float) expressions are converted to floats:
>>> 4 * 2.0 /6
1.3333333333333333
[email protected]
String Data Type
>>> str1 = 'happy'
>>> str2 = “Holi"
>>> str1, str2
(‘happy', ‘Holi') # a tuple
>>> str1[1]
'a'
>>> x = str1, str2
>>> x
('happy', ‘Holi') # x is a tuple
>>> x[1]
‘Holi'
[email protected]
String Operations
• Slicing: selects a ‘slice’ or segment of a string
<string>[<start>:<end>] where <start> is the
beginning index and <end> is one past final index
>>> myName = “Manan Vasani"
>>> myName[2:7]
‘nan V‘
[email protected]
Thank you
Question
?