0% found this document useful (0 votes)
2 views8 pages

Python Basics

This document provides an introduction to Python programming, highlighting its versatility and applications in various fields such as web development and data science. It covers fundamental concepts including variables, data types, operators, and functions, essential for building interactive programs. The conclusion encourages further exploration of Python's capabilities to develop more complex applications.

Uploaded by

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

Python Basics

This document provides an introduction to Python programming, highlighting its versatility and applications in various fields such as web development and data science. It covers fundamental concepts including variables, data types, operators, and functions, essential for building interactive programs. The conclusion encourages further exploration of Python's capabilities to develop more complex applications.

Uploaded by

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

Introduction to Python

Programming
Python is a versatile, high-level, interpreted language. Created by
Guido van Rossum in 1991, it is known for its clear syntax. Python
powers web development, data science, AI/ML, and automation.
Major applications like Instagram and Spotify rely on Python.

by surya chandran
Variables and Basic Data Types
Variables Integer (int) Float (float) String (str)

Named locations for Whole numbers like Numbers with decimals, Sequences of characters
storing data. Examples: quantity = 100. such as price = 19.99. in quotes: message =
age = 30, name = "Python is fun!".
"Alice".

Python automatically detects data types when values are assigned.


Arithmetic Operators and
Expressions
Addition + Subtraction - Multiplicat
ion *
Combines Finds
values. differences. Repeated
addition.

Division /
Splits into
parts.

Expressions combine values and operators. They evaluate to a


single result. For example, total_cost = (item_price *
quantity) + shipping_fee. Standard order of operations
(PEMDAS/BODMAS) applies here.
Comparison Operators
Equal To == Not Equal To !=
Checks if values are identical. 5 == 5 is True. Determines if values differ. age != 18.

Greater Than > Less Than <


Compares if one value is larger. score > 90. Compares if one value is smaller. temperature < 0.

Comparison operators return either True or False. They are crucial for decision-making in programs.
Logical Operators
AND Operator
Both conditions must be true. Example: (age > 18)
and (has_license == True).

OR Operator
At least one condition must be true. Example:
(is_student == True) or (is_senior == True).

NOT Operator
Reverses the boolean result. Example: not is_admin.

Logical operators combine conditional statements. They control


program flow for complex decisions.
Assignment Operators and
Type Conversion
Assignment Operators
• x = 5

x += 2 (x = x + 2)

x -= 3, x *= 4

Shorthand for operations combined with assignment.

Type Conversion
int(value): To integer (int("123") becomes 123)

float(value): To float (float("3.14") becomes 3.14)

str(value): To string (str(25) becomes "25")

Explicitly changes data types.


Using print() and input() Functions

The input() Function


The print() Function
Reads user input. Example: user_name =
Displays output to the console. Example: input("Enter your name: "). Input is always a
print("Hello, World!"). You can combine strings string; convert for numbers: fav_num =
and variables: print("Your age is:", age). int(input("Enter your favourite number: ")).

These functions are essential for interactive programs. They allow users to communicate with your code.
Conclusion and Next Steps
Next Steps
1 Conditional statements, loops, functions, data structures.

Input/Output
2 User interaction with print(), input().

Logical Operations
3 Control program logic with and, or, not.

Core Concepts
4 Variables, data types, operators.

Python's clear syntax enables diverse applications. You have grasped foundational elements for programming. Continue
exploring Python's capabilities to build more complex applications.

You might also like