0% found this document useful (0 votes)
3 views2 pages

Python Basics: Features, Variables, and Operators

The document provides an overview of Python, highlighting its features such as simplicity, platform independence, and a large standard library, along with its applications in web development, data science, and automation. It explains Python variables, data types, numeric types, type casting, basic operators, and the importance of indentation in defining code blocks. Additionally, it outlines the Python programming cycle and clarifies why Python is considered an interpreted language.

Uploaded by

abc97938016
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)
3 views2 pages

Python Basics: Features, Variables, and Operators

The document provides an overview of Python, highlighting its features such as simplicity, platform independence, and a large standard library, along with its applications in web development, data science, and automation. It explains Python variables, data types, numeric types, type casting, basic operators, and the importance of indentation in defining code blocks. Additionally, it outlines the Python programming cycle and clarifies why Python is considered an interpreted language.

Uploaded by

abc97938016
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

UNIT I – Python Basics

1. What is Python? Explain its features and applications.


Python is a high-level, interpreted, general-purpose programming language. It is easy to learn and
widely used for various applications.
Features:
• Simple and easy to learn
• Interpreted language
• Platform independent
• Large standard library
• Object-oriented
Applications:
• Web development
• Data science and AI
• Automation and scripting
• Game development

2. Explain Python variables and different data types with examples.


Variables are used to store data values.
Example:
x = 10
name = "Python"
Data Types:
int – 10, 20
float – 10.5
str – "Hello"
bool – True, False

3. Explain numeric data types in Python and type casting.


Numeric types include int, float, and complex.
Example:
a = 10
b = 5.5
Type Casting:
int(5.6) → 5
float(5) → 5.0
str(10) → "10"

4. Explain basic Python operators with examples.


Arithmetic: +, -, *, /
Relational: >, <, ==
Logical: and, or, not
Assignment: =, +=
Membership: in, not in
Identity: is, is not

5. Explain Python blocks and indentation.


Python uses indentation to define blocks of code. It improves readability and avoids confusion.
Example:
if a > b:
print("a is greater")

6. Explain the Python programming cycle. Why is Python called an interpreted language?
Steps:
• Write code
• Interpret code
• Execute output
Python is called an interpreted language because code is executed line by line.

You might also like