0% found this document useful (0 votes)
7 views

1 Introduction to Python_Day 1

The document outlines a Python Bootcamp focused on data science, highlighting Python's popularity due to its rich ecosystem of libraries, ease of use, and strong community support. It covers fundamental concepts such as variables, data types, expressions, interactive input, and string operations. The content is aimed at providing foundational knowledge for using Python in data science applications.

Uploaded by

samhithabhat311
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views

1 Introduction to Python_Day 1

The document outlines a Python Bootcamp focused on data science, highlighting Python's popularity due to its rich ecosystem of libraries, ease of use, and strong community support. It covers fundamental concepts such as variables, data types, expressions, interactive input, and string operations. The content is aimed at providing foundational knowledge for using Python in data science applications.

Uploaded by

samhithabhat311
Copyright
© © All Rights Reserved
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 13

Data Science with

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

• Mixed type (real and imaginary) conversions:


>>> x = 5 + 13j
>>> y = 3.2
>>> z = x + y
>>> z
(8.2 + 13J )

• Explicit casts are also supported:


>>> y = 4.999 >>> x = 8
>>> int(y) >>> float(x)
4 8.0
[email protected]
Interactive Input
• Syntax: input → variable = input(string)
The string is used as a prompt.
Inputs a string
>>> y = input("enter a name --> ")
enter a name --> max
>>> y
'max'
>>> number = input("Enter an integer ")
Enter an integer 32
>>> number
’32’
• input() reads input from the keyboard as a string;

[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‘

• If either <start> or <end> is omitted, the start and


end of the string are assumed
>>> myName[:5]
'Manan'
>>> myName[4:]
'n Vasani'
>>> myName[:]
'Manan Vasani'
[email protected]
String Operations
Concatenation (+)
>>> "happy" + "birthday"
'happybirthday'
>>> 'happy' + ' birthday'
'happy birthday’
Repetition (*)
>>> word = 'ha'
>>> 3 * word
'hahaha'
>>> word + 3 * '!'
'ha!!!'
[email protected]
String Operations
Other examples:
>>> word = 'ha'
>>> len(word) # length function
2
>>> len(“Krishna and Radha")
12

[email protected]
Thank you
Question
?

You might also like