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

Python Basic Notes

This document provides basic notes on Python programming, covering variables, numerical data types, basic operators, Python blocks, conditional statements, and a summary of data types. It includes examples and rules for creating variables, as well as the structure of conditional blocks. The document serves as a foundational guide for beginners in Python programming.
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 views2 pages

Python Basic Notes

This document provides basic notes on Python programming, covering variables, numerical data types, basic operators, Python blocks, conditional statements, and a summary of data types. It includes examples and rules for creating variables, as well as the structure of conditional blocks. The document serves as a foundational guide for beginners in Python programming.
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 BASIC NOTES

1. Variables:

Variables are names used to store data values.

Example:

x = 10

name = "Carthy"

Rules:

- Cannot start with a number

- No special characters

- Use underscore if needed

2. Numerical Data Types:

Integer (int): Whole numbers (10, -5)

Float (float): Decimal numbers (3.14, 99.5)

Complex (complex): Numbers like 2 + 3j

3. Basic Operators:

Arithmetic: +, -, *, /, %, **, //

Comparison: ==, !=, >, <, >=, <=

Logical: and, or, not

Assignment: =, +=, -=, *=, /=

Bitwise: &, |, ^, ~, <<, >>

4. Python Blocks:

A block is a group of statements with same indentation.

Blocks start after ':'


Indentation is mandatory (4 spaces).

Example:

if x > 5:

print("Greater")

5. Conditional Block:

if, elif, else are used for decision making.

Example:

if marks >= 90:

print("Grade A")

elif marks >= 60:

print("Grade B")

else:

print("Grade C")

6. Data Types Summary:

Numeric: int, float, complex

Text: str

Boolean: bool

Sequence: list, tuple, range

Set: set

Mapping: dict

You might also like