Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
0% found this document useful (0 votes)
1 views

Introduction to Python Programming

The document provides an introduction to Python programming, covering basics such as syntax rules, variables, data types, control structures, and functions. It emphasizes Python's readability and simplicity, making it suitable for beginners. Additionally, it includes review questions and references for further learning.

Uploaded by

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

Introduction to Python Programming

The document provides an introduction to Python programming, covering basics such as syntax rules, variables, data types, control structures, and functions. It emphasizes Python's readability and simplicity, making it suitable for beginners. Additionally, it includes review questions and references for further learning.

Uploaded by

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

Class Notes: Introduction to Python Programming

Instructor: Prof. John Doe


Date: 16/5/2015

1. Basics of Python
ˆ High-level, interpreted language.

ˆ Used in web dev, data science, AI, and automation.

2. Syntax Rules
ˆ Indentation: Blocks use indentation (no curly braces).

ˆ Comments: Use # for single-line comments.

3. Variables and Data Types


ˆ Variables: Dynamically typed (e.g., x = 5).

ˆ Data types: int, float, str, bool, list, dict.

4. Control Structures
If-Else Example:
if x > 10:
print ( " Greater " )
else :
print ( " Smaller " )

Loops:
ˆ for loop: for i in range(5):

ˆ while loop: while x < 10:

1
5. Functions
def add (a , b ):
return a + b

Example: Factorial Function


def factorial ( n ):
if n == 0:
return 1
else :
return n * factorial (n -1)

Summary
Python’s readability and simplicity make it ideal for beginners. Practice writing small pro-
grams to reinforce concepts.

Review Questions
1. Write a Python program to check if a number is prime.

2. Explain the difference between a list and a dictionary.

References
ˆ Python Crash Course by Eric Matthes.

ˆ Official Python Documentation: https://www.python.org

You might also like