0% found this document useful (0 votes)
9 views3 pages

Python

Uploaded by

mayuridhanak12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
9 views3 pages

Python

Uploaded by

mayuridhanak12
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python is a general-purpose, dynamically typed, high-level, compiled and

interpreted, garbage-collected, and purely object-oriented programming language


that supports procedural, object-oriented, and functional programming.

Features of Python:
1. **General-purpose**: Python is designed to be used for a wide variety of
applications and tasks, from web development to scientific computing, to
automation and scripting.

2. **Dynamically typed**: In Python, you don't need to specify the data type of a
variable when you declare it. Python automatically handles the types for you.

4. **Compiled and interpreted**: Python code is first compiled into intermediate


bytecode, which is then interpreted by the Python interpreter. This makes Python
versatile and easy to use across different platforms.

5. **Garbage-collected**: Python has automatic memory management. It


automatically handles memory allocation and deallocation for you, which
simplifies memory management for developers.

6. **Purely object-oriented**: Python supports object-oriented programming


(OOP) paradigm. However, unlike languages like Java, it also supports procedural
and functional programming paradigms.

7. **Supports procedural, object-oriented, and functional programming**: Python


is versatile in terms of programming paradigms. You can write code in a procedural
style (using functions), an object-oriented style (defining classes and objects), or a
functional style (using functions as first-class objects).
3. Applications of Python:

Python is versatile and widely used in various domains, including:

●​ Web Development: Frameworks like Django and Flask are popular for
building web applications.
●​ Data Science and Machine Learning: Libraries like NumPy, Pandas,
SciPy, and scikit-learn are widely used in data analysis and machine
learning.
●​ Game Development: Python can be used for game development with
libraries like Pygame.
●​ Desktop GUI: Libraries like Tkinter and PyQt allow developers to create
desktop applications.
●​ Embedded Systems: Python is used for programming embedded systems
and IoT devices.

Variables

Variables are containers for storing data values.

age = 25 # Integer variable

height = 5.9 # Float variable

grade = 'A' # String variable (since Python doesn't have a separate char type)

name = "Alice" # String variable

Variable Names

●​ A variable name must start with a letter or the underscore character


●​ A variable name cannot start with a number
●​ A variable name can only contain alpha-numeric characters and underscores
(A-z, 0-9, and _ )
●​ Variable names are case-sensitive (age, Age and AGE are three different
variables)
1. Numbers: Represents numeric data to perform mathematical operations.
Numbers can be integers (like 1 and 2), floats (like 1.1 and 1.2), fractions (like 1/2
and 2/3), or even complex numbers.
2. String: Represents text characters, special symbols or alphanumeric data. String
is a sequence of Unicode characters.
x = "Hello World"
3. List: Represents sequential data that the programmer wishes to sort, merge etc.
x = ["apple", "banana", "cherry"]
4. Tuple: Represents sequential data with a little difference from list.
x = ("apple", "banana", "cherry")
5. Dictionary: Represents a collection of data that associate a unique key with each
Value.
x = {"name" : "John", "age" : 36}
6. Boolean: Represents truth values (true or false).
>>> size = 1
>>> size < 0
False
7. Set: Set is an unordered collection of unique data items.
x = {"apple", "banana", "cherry"}

You might also like