0% found this document useful (0 votes)
4 views1 page

Introduction to Python Programming

Unit 1 introduces the basics of Python programming, covering variables, basic operators, blocks of code, and data types. It explains how to declare and use numeric data types with examples. The document emphasizes the importance of indentation in creating code blocks.

Uploaded by

anshpratap982
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)
4 views1 page

Introduction to Python Programming

Unit 1 introduces the basics of Python programming, covering variables, basic operators, blocks of code, and data types. It explains how to declare and use numeric data types with examples. The document emphasizes the importance of indentation in creating code blocks.

Uploaded by

anshpratap982
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 Programming - Unit 1

Unit 1: Introduction to Python

1. Python Variables:
A variable is like a container to store information. For example, if you write x = 10, the computer
remembers that x has the value 10. You can change the value anytime by assigning a new value.

2. Python Basic Operators:


Operators are symbols that tell Python to do some task. For example: + (Addition): 5 + 3 = 8 -
(Subtraction): 9 - 4 = 5 * (Multiplication): 6 * 2 = 12 / (Division): 8 / 2 = 4 % (Modulus): 10 % 3 = 1
(gives remainder)
3. Understanding Python Blocks:
A block is a group of code written together for a specific purpose. In Python, blocks are created
using indentation (spaces). For example, in an if statement, the indented code is the block that
runs if the condition is true.

4. Python Data Types:


Python can store different kinds of values: int: Whole numbers like 5, 20, -10 float: Decimal
numbers like 3.14, 2.5 str: Text (string) like "Hello" bool: True or False
5. Declaring and Using Numeric Data Types:
Declaring means creating a variable. For example: x = 10 (an integer) y = 3.5 (a float) You can use
these variables in calculations like z = x + y.

You might also like