0% found this document useful (0 votes)
8 views

Introductory Python

Python is a high-level, interpreted programming language created by Guido van Rossum in 1991, known for its simplicity and versatility in various fields such as web development and data science. It features easy learning, open-source availability, dynamic typing, and supports multiple programming paradigms. The document also covers Python syntax basics, including comments, variables, data types, operators, conditional statements, loops, and functions.

Uploaded by

kevinowenhunt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

Introductory Python

Python is a high-level, interpreted programming language created by Guido van Rossum in 1991, known for its simplicity and versatility in various fields such as web development and data science. It features easy learning, open-source availability, dynamic typing, and supports multiple programming paradigms. The document also covers Python syntax basics, including comments, variables, data types, operators, conditional statements, loops, and functions.

Uploaded by

kevinowenhunt
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

Introductory Python

What is Python?

• Python is a high-level, interpreted, and general-purpose programming language.

• Created by Guido van Rossum and released in 1991.

• Known for its simplicity, readability, and wide usage.

• Used for: Web development, Data Science, Automation, Machine Learning,


Cybersecurity, Game Development, etc.

Basic Features of Python

• Easy to learn and use.

• Open-source and free.

• Portable (runs on Windows, macOS, Linux, etc.).

• Dynamically typed (no need to declare variable types).

• Supports Object-Oriented, Functional, and Procedural programming.

• Huge standard library and community support.

Python Syntax Basics

Comments

# This is a single-line comment

'''

This is a

multi-line comment

'''
Variables

name = "Alice"

age = 25

price = 19.99
Data Types

Type Example

int 5

float 5.5

str "Hello"

bool True / False

list [1, 2, 3]

tuple (1, 2, 3)

dict {"name": "Alice", "age": 25}

set {1, 2, 3}

Input and Output

name = input("Enter your name: ")

print("Hello", name)

Operators

Operator Example Meaning

+ a+b Addition

- a-b Subtraction

* a*b Multiplication

/ a/b Division

// a // b Floor Division

% a%b Modulus

** a ** b Exponentiation

== a == b Equals

!= a != b Not Equal
Conditional Statements

if age > 18:

print("Adult")

elif age == 18:

print("Just 18")

else:

print("Minor")

Loops

For Loop

for i in range(5):

print(i)
While Loop

count = 0

while count < 5:

print(count)

count += 1

Functions

def greet():

print("Hello!")

greet()

def add(a, b):

return a + b

print(add(5, 3))
Example Program

# Simple Calculator

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

b = int(input("Enter second number: "))

print("Sum is:", a + b)

You might also like