0% found this document useful (0 votes)
3 views18 pages

Python Crash Basic PDF

The document is a training report by Khushpreet Kaur, a B.Tech student, acknowledging the Python Basic Crash Course provided by MindLuster, which enhanced her programming skills. It outlines the structure of the course, covering topics such as Python basics, functions, control flow, and file handling. The report emphasizes the importance of Python in various fields and expresses the author's intent to apply the knowledge gained in future academic and career opportunities.

Uploaded by

bigdreamers107
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)
3 views18 pages

Python Crash Basic PDF

The document is a training report by Khushpreet Kaur, a B.Tech student, acknowledging the Python Basic Crash Course provided by MindLuster, which enhanced her programming skills. It outlines the structure of the course, covering topics such as Python basics, functions, control flow, and file handling. The report emphasizes the importance of Python in various fields and expresses the author's intent to apply the knowledge gained in future academic and career opportunities.

Uploaded by

bigdreamers107
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

NAME KHUSHPREET KAUR

BRANCH [Link]

COURSE

CSE[AI&ML] ROLL NO

2448090

REG. NO 24826

PYTHO
N
CRASH
BASIC
ACKNOWLEDGEMENT

I am grateful to my college for providing me the opportunity to


pursue the vocational course and upgrade my technical skills
during the break. I sincerely appreciate the continuous support,
academic guidance and learning environment offered by the
institution throughout this training process.

I would also like to extend my thanks to MindLuster for offering


the Python Basic Crash Course, which played a significant role in
strengthening my foundation in Python programming. The
structured content, hands-on learning and practical approach
greatly enhanced my understanding of the subject.

This internship experience has contributed meaningfully to my


professional development, and I look forward to applying the
knowledge and skills gained through this course in future
academic and career opportunities.
INDEX

1. INTRODUCTION OF PYTHON

2. PYTHON BASICS

3. METHOD FUNCTION

4. CONTAINERS

5. CONTROL FLOW

6. MORE ON FUNCTION

7. TOOLS

8. CLASSES

9. MODULES

10. FILE HANDLING


INTRODUCTION TO PYTHON

Introduction:
Python is a powerful, high-level, general-purpose programming
language developed by Guido van Rossum and first released in
1991. It is designed to be easy to read, write, and understand.
Python follows a simple syntax similar to English, which makes
it one of the most beginner-friendly programming languages.

● Python supports multiple programming paradigms such as:


1. Procedural programming

2. Object-Oriented Programming (OOP)

3. Functional programming

● Python is widely used in various fields including:

1. Web development

2. Data Science & Machine Learning

3. Artificial Intelligence & Deep Learning

4. Cyber Security

5. Automation & Scripting

6. Game Development

● Features of Python
1. Easy to Learn: Simple syntax similar to English.

2. Interpreted Language: Executes line by line, making


debugging easier.

3. Extensive Libraries: Comes with built-in modules and


third-party packages.

4. Portable: Works on Windows, Mac, Linux without


changes in code.

5. Open Source: Free to use and distribute.

6. Dynamic Typing: No need to declare data types explicitly.

Python is one of the most in-demand programming languages


today. It is used by top companies such as Google, Facebook,
YouTube, NASA, Netflix, and more. Because of its simplicity and
strong ecosystem, beginners can learn it easily and
professionals can build powerful applications quickly.

For example:
INPUT

print("Welcome to Python Programming!")

OUTPUT

Welcome to Python Programming


PYTHON BASICS
Introduction:

Python basics include variables, data types, operators,


input/output, and basic expressions. Understanding these
fundamentals is essential before learning advanced concepts.

● Variable
A variable is a name used to store data in memory.

● Data Types
Python has several built-in data types:

1. int – integer numbers

2. float – decimal numbers

3. str – text data (string)

4. bool – True / False

5. list – ordered collection

6. tuple – ordered but immutable

7. set – unordered unique collection

8. dict – key-value pairs

● Input and Output


1. print() → used for output
2. input() → used for taking user

input For example:

name = input("Enter your name: ")


print("Hello,", name)

● Operators
Python supports many operators:

1. Arithmetic operators: (+ - * / % // **)

2. Comparison operators:( == != > < >= <=)

3. Logical operators:( and or not)

For Example:

a = 10
b = 3
print(a + b) #
13 print(a % b) #
1
METHOD FUNCTION
Introduction:
A method is a function, but it belongs to an object.
It is called using [Link]() syntax.

Example of methods:

● "hello".upper()

● [Link](5)

function = independent block of code


method = function that belongs to an object (string, list, class object,
etc.)

CODE 1: SIMPLE CODE

def greet():
print("Hello! This is a
function.") greet()

OUTPUT:

Hello! This is a function.

CODE 2: METHOD EXAMPLE

text = "python"
print([Link]())// using a method

OUTPUT:

PYTHON
CONTAINERS

Introduction:
Containers are data structures in Python that can store
multiple values in a single variable.
They allow us to group related data

together. Python provides four main built-in

containers:

● List
1. Ordered
2. Changeable (mutable)
3. Allows duplicate values
4. Written inside []

For Example:
[1, 2, 3]

● Tuple
1. Ordered
2. Not changeable (immutable)
3. Allows duplicates
4. Written inside ()

For Example:
(4, 5, 6)

● Set
1. Unordered
2. No duplicate values
3. Written inside {}
For Example:
{1, 2, 3}

● Dictionary
1. Stores data in key-value pairs
2. Written inside { key: value }

For Example:
{"name": "John", "age": 22}

PROGRAM

my_list = [1, 2, 3] //list

my_tuple = (4, 5, 6) //tuple

my_set = {7, 8, 9} //set

my_dict = {"name": "Alice", "age": 20}

//Dictionary print(my_list)
print(my_tuple)
print(my_set)
print(my_dict)

OUTPUT:
[1, 2, 3]
(4, 5, 6)
{8, 9, 7}
{'name': 'Alice', 'age': 20}
CONTROL FLOW

Control flow statements like if, for, and while decide


program flow.

PROGRAM: EVEN OR ODD

num = 7
if num % 2 == 0:
print("Even number")
else:
print("Odd number")

Output:

Odd number

PROGRAM: PRINT 1 TO 5 USING FOR LOOP


for i in range(1, 6):
print(i)

Output:

1
2
3
4
5
FUNCTIONS

Introduction:
A function is a reusable block of code that performs a specific
task.

In the earlier lesson, we learned simple


functions. Now we explore more advanced
aspects of functions:

MORE ON FUNCTIONS:-

1. Functions with Parameters


Functions can take input values called

parameters. Syntax:

def function_name(parameter1, parameter2):


# code using parameters

PROGRAM 1: Add Two Numbers Using Parameters


def add(a, b):
sum = a + b
print("Sum is:", sum)

add(5, 3)

Output:

Sum is: 8
ction_name(parameters):
return value

2. Functions with Return Values


Functions can return a value using the return statement.

Syntax:

def fun

PROGRAM 2: Function That Returns Square


def square(num):
return num * num

result = square(4)
print("Square is:", result)

Output:

Square is: 16
TOOLS

(BUILT-IN METHOD)

Introduction:
Python provides many built-in tools such as string methods,
list methods, etc.

PROGRAM: Using String Methods


text = "hello world"
print("Uppercase:", [Link]())
print("Title:", [Link]())

Output:

Uppercase: HELLO WORLD


Title: Hello World
CLASSES

Introduction:
Classes define objects with attributes and methods.

PROGRAM : Simple Class Example


class Student:
def_init_(self, name, roll):
[Link] = name
[Link] = roll

def show(self):
print("Name:",
[Link])
print("Roll:", [Link])

s = Student("Rahul", 101)
[Link]()

Output:

Name: Rahul
Roll: 101
MODULES

Introduction:
Modules are Python files that contain functions and
variables. We import them using import.

PROGRAM: Using Math Module


import math

print("Square root of 16 is:", [Link](16))


print("Value of pi is:", [Link])

Output:

Square root of 16 is: 4.0


Value of pi is: 3.141592653589793
FILE HANDLING

Introduction:
File handling in Python allows you to read, write, and append
data in files.
Common file modes:

● "r" → read
● "w" → write
● "a" → append

Steps:

1. Open a file using open()

2. Perform operations (read() / write())

3. Close the file using close()

PROGRAM: Write and Read File


file = open("[Link]", "w") //Write to a
file [Link]("Hello, Python file handling!")
[Link]()

file = open("[Link]", "r") //Read the


file print([Link]())
[Link]()

Output:

Hello, Python file handling!

You might also like