2. 2
2
Week 1
o1. Why Programming ?
o2. Importance of clear instructions.
By - ANSHUL
3. 3
Why Programming ?
1. Digital world relies on programs.
2. Programming makes life simpler and faster.
3. Examples of daily life use (train
reservations, apps).
4. Almost everything today involves
programming.
5. Digital world is built on code and
programs.
4. Importance of clear
instructions !
Importance of clear, unambiguous
instructions
1. Instructions help accomplish tasks, whethe
for people or computers.
2. Clarity in instructions ensures successful
execution.
3. Computers excel at fast task completion
when instructed clearly.
6. Introduction to
• Anaconda is a comprehensive platform for Python
programming.
• It serves as an integrated development environment (IDE) for
Python.
• Anaconda is well-suited for beginners and professionals,
offering a user-friendly interface.
• It includes a vast collection of pre-installed Python libraries and
tools.
• Anaconda is widely used in data science, machine learning,
and scientific computing.
7. Writing Your First Program !
Print Command: Displays output on the screen.
Input and IDE: Learn how to take input from the keyboard and use an
integrated development environment (IDE) like Spyder for Python
programming.
Coding in Spyder: Understand the process of writing and executing Python
code in Spyder's console.
Incrementing Variables: Practice setting variables and incrementing values
within your code.
Executing Code: Explore ways to run code either line by line or as a complete
script.
Python for Beginners: Python is an ideal language for newcomers, and we'll
gradually progress to more advanced topics and applications.
9. Introduction to Crowd Computing
"Unlocking the Wisdom of the Crowd"
Crowd Computing – Harnessing CollectiveWisdom
• The Power of Crowd: Crowd computing is the art of tapping into the collective knowledge and skills of a
group of people.
• A Simple Query: Have a question? Post it on a platform like Facebook or Quora, and the crowd can help you
find answers quickly.
• Estimating Numbers: When it comes to estimating things, the collective guesses of manyindividuals can
often be astonishinglyaccurate.
• Wisdom in Numbers: The "wisdom of crowds" shows that collective opinions often outperform individual
experts.
• Wikipedia vs. Britannica: Wikipedia, curated by crowds, has been found to be as reliable as expert-curated
Britannica.
• Collective Collaboration:Crowd computing enables us to collectively solve problems, make accurate
estimates, and accumulate knowledge.
11. MAGIC SQUARES
•Introduction: Magic squares are fascinating mathematical puzzles with constantsums in rows, columns,
and diagonals.
•Visual Representation:
• Features of a Magic Square:
• In a magic square, all rows, columns, and diagonals have the same sum.
• There are various sizes of magic squares, but we're exploring the classic 3x3 magic square
today.
• Historical Significance: Magic squares have captivated mathematicians and artists for
centuries and can be found in ancient manuscripts, art, and even modern puzzles.
12. Types of MAGIC SQUARES
•Introduction: Magic squares are classified into two main types based on their order.
•Types: the two main types:
•Odd Order Magic Squares (e.g., 3x3)
•Singly Even Order Magic Squares (e.g., 4x4)
14. SEARCHING AND SORTING ALGORITHMS WITH PYTHON
• Understanding searching and sorting algorithms is essential for any
programmer. These algorithms help to optimize code and improve
program efficiency. Python provides a wide range of built-in
functions and libraries that make it easy to implement these
algorithms. By mastering these algorithms, programmers can
improve their problem- solving skills and become better at writing
efficient and optimized code
15. 1. SEARCHING ALGORITHMS
•1. LinearSearch:A linear search (often called a sequential
search) is performed by inspecting each item in a list one by one
from one end to the other to find a match for what you are searching
for
•2.BinarySearch: Binary search compares the target value to the
middle element of the array. If they are not equal, the half in which the target
cannot lie is eliminated, and the search continues on the remaining half, again
taking the middle element to compare to the target value and repeating this
until the target value is found
16. 2.SORTING ALGORITHMS
•Bubble Sort: Bubble sort is a simple sorting algorithm that repeatedly steps
through the list, compares adjacent elements and swaps them if they are in the
wrong order. The pass through the list is repeated until the list is sorted.
• Merge Sort: Merge sort is a popular sorting algorithm that uses the divide
and conquer strategy to sort an array or list of elements. It works by dividing the
list into smaller sub-lists, sorting those sub-lists recursively, and then merging
them back together to form the final sorted list.
18. 1. RECURSION IN PYTHON
•The term Recursion can be defined as the process of
defining something in terms of itself. In simple words,
it is a process in which a function calls itself directly or
indirectly.
19. 2. Advantages and Disadvantages of using recursion
❑ Advantages of using recursion
•Recursion adds clarity and (sometimes) reduces the time needed to write
and debug code (but doesn't necessarily reduce space requirements or
speed of execution).
•Reduces time complexity.
❑ Disadvantages of using recursion
•A lot of memory and time is taken through recursive calls which makes it expensive for
use.
•Recursive functions are challenging to debug.
•The reasoning behind recursion can sometimes be tough to think through
21. ✓ SNAKE AND LADDER
1. GameInitialization:
The game starts with two players positioned at square 0 on the board.
2. Rolling the Die:
The roll die() function simulatesrolling a six-sided die, providing a random
number between 1 and 6.
3. Player Turn:
The play turn() function is responsible for simulating a player's turn . It rolls the
die, updates the player's position, and checks for snakes and ladders
4. Snakes and Ladders Configuration:
The snakes and ladders are defined using dictionaries, where the keys represent
the head of a snake or the bottom of a ladder, and the values representthe tail of
the snake or the top of the ladder.
24. ✓ LOTTERY SIMULATION
1. Import Necessary Libraries:
Start by importing any required libraries, such as ‘ random ‘ for generating random numbers. You mayalso need
other modules depending on the specific requirements .
2. Generate Lottery Tickets:
Generate lottery tickets for participants. Each ticket should contain a unique combination of numbers within the
specified range .
3. Simulate the Drawing:
Simulate the drawing of winning numbers.
4. Check for Winners:
Compare the winning numbers with the numbers on each participant's ticket to determine the winners.
26. ANAGRAMS
Anagrams are words or phrases formed by rearranging the
letters of another word or phrase, using all the original letters
exactly once. For instance, "listen" and "silent" are anagrams.
29. ❑ INTRODUCTION TO NETWORKX
NetworkX is a Python library for the creation, manipulation, and analysis of complex networks.
Why NetworkX?:
v Essential for studying real-world systems, like social networks, transportation, and more.
v Easy to use and integrate into your Python projects.
Key Features:
v Create, modify, and visualize networks.
v Algorithms for network analysis, e.g., centrality and connectivity.
v Flexible data structures for graphs and digraphs.-
Use Cases:
v Social Network Analysis
v Infrastructure and Transportation Planning
v Biological Network Analysis
v Recommender Systems
30. ❑ SIX DEGREES OF SEPARATION
Six Degrees of Separation - The theory that everyone is connected to every other person on the planet by a
chain of connections with no more than six intermediaries.
Python's Role - Python, with its rich libraries, can help explore this theory.
Key Steps -
v DataCollection - Collect relevant data, e.g., social network connections.
v Network Analysis - Use libraries like NetworkX to create a graph.
v Path Finding - Find the shortest path between two individuals.
v Verification - Validate the theory by finding paths between random individuals.
Applications - Social network analysis, recommendation systems, and more.
Conclusion - Python's libraries make exploring the Six Degrees of Separation concept accessible and actionable.
32. • DATA COMPRESSION
NumPy is a powerful library for numerical operations in Python. Here are some key
points related to NumPy:
1. NumPy provides a powerful array object, numpy.array , which allows for
efficient manipulation of large datasets of numerical data.
2. It supports a variety of numerical operations such as arithmetic, statistical, and
linear algebraic operations.
3. NumPy enables the creation of multidimensional arrays (matrices), which is particularly
useful for representing and manipulating data in scientific computing and data analysis.
33. ➢ COMMANDS IN NUMPY
1. Importing
NumPy:
import numpy as np
2. Creating a 1D array:
arr_1d = np.array([1, 2, 3])
3. Creating a 2D array (matrix)
arr_2d = np.array([[1, 2, 3], [4,
5, 6]])
4. Creating arrays with zeros or
ones:
zeros_arr = np.zeros((3, 4))
ones_arr = np.ones((2, 2))
35. WHATSAPP BROWSER AUTOMATION
• WHATSAPP BROWSER AUTOMATION USING PYTHON TYPICALLY INVOLVES
THE USE OF THE SELENIUM LIBRARY. SELENIUM ALLOWS YOU TO CONTROL
WEB BROWSERS PROGRAMMATICALLY, MAKING IT AN EXCELLENT CHOICE
FOR AUTOMATING WHATSAPP WEB.
• SELENIUM REQUIRES A WEB DRIVER TO INTERFACE WITH THE CHOSEN
BROWSER. WEB DRIVERS IS A PACKAGE TO INTERACT WITH A WEB
BROWSER. IT INTERACTS WITH THE WEB BROWSER OR A REMOTE WEB
SERVER THROUGH A WIRE PROTOCOL WHICH IS COMMON TO ALL.
36. • FUN WITH CALENDAR USING PYTHON
"FUN WITH CALENDAR" USING PYTHON INVOLVES WORKING
WITH DATES, TIMES, AND CALENDARS TO CREATE, MANIPULATE,
AND MANAGE EVENTS AND SCHEDULES. PYTHON PROVIDES
POWERFUL LIBRARIES LIKE DATETIME AND CALENDAR TO WORK WITH
DATES AND TIMES.
38. PAGE RANK
PAGERANK IS AN ALGORITHM USED BY SEARCH ENGINES, LIKE GOOGLE, TO
RANK WEB PAGES.
• IT WAS DEVELOPED BY LARRY PAGE AND SERGEY BRIN, CO-FOUNDERS OF GOOGLE, IN THE
LATE 1990S.
• PAGERANK IS CRUCIAL FOR DETERMINING THE QUALITY AND RELEVANCE OF WEB PAGES
IN SEARCH ENGINE RESULTS.
• IT HELPS SEARCH ENGINES IDENTIFY AUTHORITATIVEAND TRUSTWORTHY PAGES.
• PAGERANK IS BASED ON THE IDEA OF LINK ANALYSIS AND USES A
MATHEMATICALFORMULA TO ASSIGN SCORES TO WEB PAGES.
39. • PAGERANK CAN BE REPRESENTED USING MATRICES WHERE
ELEMENTS DENOTE LINK RELATIONSHIPS BETWEEN PAGES.
• THE PAGERANK FORMULA CAN BE EXPRESSED AS A MATRIX EQUATION.
• PAGERANK IS NOT LIMITED TO SEARCH ENGINES; IT HAS APPLICATIONS
IN VARIOUS FIELDS LIKE SOCIAL NETWORK ANALYSIS AND
RECOMMENDATION SYSTEMS.
• PAGERANK MAY BE MANIPULATED OR INFLUENCED BY VARIOUS MEANS.
• IT IS JUST ONE OF MANY FACTORS SEARCH ENGINES USE TO RANK PAGES.
40. Thank you
By –
AJIT SHRIVAS |0901MC221004
AKSHAT SINGH PARMAR |0901MC221005
ANSHUL SONI | 0901MC221013
HIMANSHU KUSHWAH | 0901MC221037
Submitted to: Prof. Divya
Chaturvedi