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

Python Beginner Notes

The document provides an overview of Python for beginners, covering key concepts such as the Python Interpreter, data types, input/output statements, operators, and decision structures. It includes examples of various data types like integers, floats, strings, and collections, as well as how to use input and output functions. Additionally, it explains the use of operators and conditional statements for decision-making in Python.

Uploaded by

disha
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)
1 views2 pages

Python Beginner Notes

The document provides an overview of Python for beginners, covering key concepts such as the Python Interpreter, data types, input/output statements, operators, and decision structures. It includes examples of various data types like integers, floats, strings, and collections, as well as how to use input and output functions. Additionally, it explains the use of operators and conditional statements for decision-making in Python.

Uploaded by

disha
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/ 2

Python Beginner Notes

1. Python Interpreter
A Python Interpreter is a program that reads and executes Python code line-by-line. It
converts the source code into bytecode which is then executed by the Python Virtual
Machine (PVM).

print("Hello Python")

2. Data Types in Python


Python provides various built-in data types:

- int: Integer values (e.g., x = 10)


- float: Floating point values (e.g., pi = 3.14)
- str: String values (e.g., name = "Alice")
- bool: Boolean values (e.g., is_valid = True)
- list: Ordered collection (e.g., nums = [1, 2, 3])
- tuple: Immutable collection (e.g., t = (1, 2))
- set: Unordered unique values (e.g., s = {1, 2, 3})
- dict: Key-value pairs (e.g., d = {"a": 1, "b": 2})

a = 5
b = 3.14
name = "Bob"
flag = True

3. Input and Output Statements


Python uses input() for taking input and print() for displaying output.

name = input("Enter your name: ")


print("Hello", name)

Input with type conversion:

num = int(input("Enter a number: "))


print(num * 2)

4. Python Operators
Python supports several types of operators:
- Arithmetic: +, -, *, /, %, //, **
- Comparison: ==, !=, >, <, >=, <=
- Logical: and, or, not
- Assignment: =, +=, -=, *=, /=
- Bitwise: &, |, ^, ~, <<, >>
- Membership: in, not in
- Identity: is, is not

a = 10
b = 3
print(a + b)
print(a % b)
print(a > b)
print(a != b)

lst = [1, 2, 3]
print(2 in lst)

x = [1, 2]
y = [1, 2]
print(x is y)

5. Decision Structure in Python


Python uses if, if-else, and elif statements for decision-making.

age = int(input("Enter your age: "))


if age >= 18:
print("You are an adult.")
else:
print("You are a minor.")

marks = int(input("Enter marks: "))


if marks >= 90:
print("Grade A")
elif marks >= 75:
print("Grade B")
elif marks >= 50:
print("Grade C")
else:
print("Fail")

You might also like