0% found this document useful (0 votes)
6 views7 pages

Features in Python

The document outlines key features of Python, including its open-source nature, ease of coding and reading, object-oriented support, and large community backing. It also discusses literals in Python, detailing types such as numeric, string, boolean, and collection literals, along with the concept of variables and their naming rules. Additionally, it highlights Python's dynamic typing, allowing variables to hold different types of values during execution.

Uploaded by

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

Features in Python

The document outlines key features of Python, including its open-source nature, ease of coding and reading, object-oriented support, and large community backing. It also discusses literals in Python, detailing types such as numeric, string, boolean, and collection literals, along with the concept of variables and their naming rules. Additionally, it highlights Python's dynamic typing, allowing variables to hold different types of values during execution.

Uploaded by

kngp5405
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 7

V Features in Python

In this section we will see what are the features of Python programming
language:

1. Free and Open Source

Python language is freely available at the official website and you can
download it from the given download link below click on the Download
Python keyword.

2. Easy to code
Python is a high-level programming language. Python is very easy to learn
the language as compared to other languages like C, C#, Javascript, Java,
etc..

3. Easy to Read

As you will see, learning Python is quite simple. As was already


established, Python's syntax is really straightforward. The code block is
defined by the indentations rather than by semicolons or brackets.

4. Object-Oriented Language

One of the key features of Python is Object-Oriented programming.


Python supports object-oriented language and concepts of classes, object
encapsulation, etc.

5. GUI Programming Support

Graphical User interfaces can be made using a module such as PyQt5,


PyQt4, wxPython, or Tk in Python. PyQt5 is the most popular option for
creating graphical apps with Python.

6. High-Level Language
Python is a high-level language. When we write programs in Python, we
do not need to remember the system architecture, nor do we need to
manage the memory.

7. Large Community Support

Python has gained popularity over the years. Our questions are constantly
answered by the enormous StackOverflow community. 8. Easy to
8.Debug
Excellent information for mistake tracing. You will be able to quickly
identify and correct the majority of your program's issues once you
understand how to interpret Python's error traces.
.

9. Python is a Portable language

Python language is also a portable language. For example, if we have


Python code for Windows and if we want to run this code on other
platforms such as Linux, Unix, and Mac then we do not need to change it,
we can run this code on any platform.

10. Python is an Integrated language

Python is also an Integrated language because we can easily integrate


Python with other languages like C, C++, etc.

Literals in Python
Literals in Python are fixed values written directly in the code that

represent constant data. They provide a way to store numbers, text, or


other essential information that does not change during program

execution.

10, 3.14, and 5 + 2j are numeric literals.

● 'Hello' and "Python" are string literals.

● True and False are Boolean literals.

Types of Literals

● Numeric Literals

● String Literal (words and sentences)

● Boolean Literal

● Collection Literals

● Special Literal

● Difference between Literals

Numeric Literals

Numeric literals represent numbers and are classified into three types:

● Integer Literals – Whole numbers (positive, negative, or zero)

without a decimal point. Example: 10, -25, 0

● Floating-point (Decimal) Literals – Numbers with a decimal

point, representing real numbers. Example: 3.14, -0.01, 2.0

● Complex Number Literals – Numbers in the form a + bj, where a

is the real part and b is the imaginary part. Example: 5 + 2j, 7 - 3j


String Literals

String literals are sequences of characters enclosed in quotes. They are

used to represent text in Python.

Types of String Literals:

● Single-quoted strings – Enclosed in single quotes (' '). Example:

'Hello, World!'

● Double-quoted strings – Enclosed in double quotes (" ").

Example: "Python is fun!"

● Raw strings – Prefix with r to ignore escape sequences (\n, \t,

etc.). Example: r"C:\Users\Python" (backslashes are treated as

normal characters).

Boolean Literals

Boolean literals represent truth values in Python. They help in decision-

making and logical operations.

True – Represents a positive condition (equivalent to 1).

● False – Represents a negative condition (equivalent to 0).

Collection Literals

Python provides four different types of literal collections:


● List literals: [1, 2, 3]

● Tuple literals: (1, 2, 3)

● Dictionary literals: {"key": "value"}

● Set literals: {1, 2, 3}

Special Literal

Python contains one special literal (None). 'None' is used to define a null

variable. If 'None' is compared with anything else other than a 'None', it

will return false.

res = None
print(res)

Python Variables
In Python, variables are used to store data that can be referenced and

manipulated during program execution. A variable is essentially a name

that is assigned to a value. Unlike many other programming languages,

Python variables do not require explicit declaration of type. The type of

the variable is inferred based on the value assigned.

Variables act as placeholders for data. They allow us to store and reuse

values in our program.

Example:

# Variable 'x' stores the integer value 10


x = 5

# Variable 'name' stores the string "Samantha"


name = "Samantha"

print(x)
print(name)

Output
5
Samantha

In this article, we’ll explore the concept of variables in Python, including

their syntax, characteristics and common operations.

Rules for Naming Variables

To use variables effectively, we must follow Python’s naming rules:

● Variable names can only contain letters, digits and underscores

(_).

● A variable name cannot start with a digit.

● Variable names are case-sensitive (myVar and myvar are different).

● Avoid using Python keywords (e.g., if, else, for) as variable

names.

Assigning Values to Variables

Basic Assignment
Variables in Python are assigned values using the = operator.

x = 5
y = 3.14
z = "Hi"

Dynamic Typing

Python variables are dynamically typed, meaning the same variable can

hold different types of values during execution.

x = 10
x = "Now a string"

You might also like