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

Python_Unit1

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

Python_Unit1

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

Unit-I Python Introduction:

• 3 As usual questions arise: what, why, where?


 Platform Independent (Cross platform) and Portable: Python is available and can run
on various operating systems such as Mac, Windows, Linux, Unix etc. This makes it a
cross platform and portable language.
Data Science: libraries like NumPy, Pandas, and Matplotlib.
Desktop Applications: PyQt and Tkinter are useful libraries
Artificial Intelligence: TensorFlow, Keras, and PyTorch.
Web Applications: Django and Flask
Computer Vision or Image Processing Applications: OpenCV and
Scikit-image.
Scientific computing: Libraries like NumPy, SciPy, and Pandas
Gaming: Python has libraries like Pygame,
IoT: Raspberry Pi, Arduino, and others.
Running Python in script mode:
• The interpreter ignores blank lines.
 The following line causes an error.
print("Hi
How are you?")
Python Comments:

 You can indent using a number of tabs or spaces, or a combination of those.

Python Indentation
 Since Python doesn’t use curly braces to delimit blocks of code, this
Python Syntax is mandatory.
 You can indent using a number of tabs or spaces, or a combination
of those.
What are Mutable Data Types?

Anything is said to be mutable when anything can be modified or


changed. The term "mutable" in Python refers to an object's capacity to
modify its values. These are frequently the things that hold a data
collection.

What are Immutable Data Types?

Immutable refers to a state in which no change can occur over time. A


Python object is referred to as immutable if we cannot change its value
over time. The value of these Python objects is fixed once they are made.

List of Mutable and Immutable objects

Python mutable data types:

o Lists
o Dictionaries
o Sets
o User-Defined Classes (It depends on the user to define the
characteristics of the classes)

Python immutable data types:

o Numbers (Integer, Float, Complex, Decimal, Rational & Booleans)


o Tuples
o Strings
o Frozen Sets
Question: Difference between == and is operator?
Ans: == checks values and is checks addresses.
If Statement:
With Do and Without Do:
Input-Output:
Input function:
 This function always reads the data from the keyboard in the form of
String format.
 We have to convert that string type to our required type by using
corresponding type casting methods.

You might also like