SlideShare a Scribd company logo
3rd
Sem Python
Programming
Practical File
Submitted To:
Dr. Chhavi Rana
Assistant Professor
CSE Department
UIET-MDU
Submitted By:
Rishab
25634
CSE-B
1
Table of Contents
Program to find GCD of two numbers......................................................... 3
Python Program to find the square root of a number by Newton’s
Method........................................................................................................... 5
Find the maximum of a list of numbers...................................................... 9
Linear Search.............................................................................................. 11
Binary Search.............................................................................................. 13
Python Program for Selection Sort........................................................... 15
Python Program for Insertion Sort............................................................ 17
Python Program for Merge Sort ................................................................ 19
Python program to find first n prime numbers ........................................ 21
Programs that take command line arguments (word count) .................. 24
Find the most frequent words in a text read from a file .......................... 26
Simulate elliptical orbits in Pygame.......................................................... 28
2
3
Program to find GCD of two numbers
1 def gcd(m,n):
2 if m< n:
3 (m, n) = (n, m)
4 while (m % n != 0):
5 (m, n) = (n, m % n)
6 return n
7
8 m = int(input("Enter the first number: "))
9 n = int(input("Enter the second number: "))
10 print(gcd(m, n))
4
5
Python Program to find the square root of a number by
Newton’s Method
6
7
Exponentiation (power of a number)
8
9
Find the maximum of a list of numbers
10
11
Linear Search
12
13
Binary Search
14
15
Python Program for Selection Sort
16
17
Python Program for Insertion Sort
18
19
Python Program for Merge Sort
20
21
Python program to find first n prime numbers
22
23
24
Programs that take command line arguments (word count)
25
26
Find the most frequent words in a text read from a file
27
28
Simulate elliptical orbits in Pygame
29
30
Simulate bouncing ball using Pygame

More Related Content

Similar to PythonPF.pdf

Algorithms
AlgorithmsAlgorithms
Algorithms
suzzanj1990
 
Big Data and the Web: Algorithms for Data Intensive Scalable Computing
Big Data and the Web: Algorithms for Data Intensive Scalable ComputingBig Data and the Web: Algorithms for Data Intensive Scalable Computing
Big Data and the Web: Algorithms for Data Intensive Scalable Computing
Gabriela Agustini
 
Big data-and-the-web
Big data-and-the-webBig data-and-the-web
Big data-and-the-web
Aravindharamanan S
 
An Optical Character Recognition Engine For Graphical Processing Units
An Optical Character Recognition Engine For Graphical Processing UnitsAn Optical Character Recognition Engine For Graphical Processing Units
An Optical Character Recognition Engine For Graphical Processing Units
Kelly Lipiec
 
Analyzing Non-Textual Content Elements To Detect Academic Plagiarism
Analyzing Non-Textual Content Elements To Detect Academic PlagiarismAnalyzing Non-Textual Content Elements To Detect Academic Plagiarism
Analyzing Non-Textual Content Elements To Detect Academic Plagiarism
Kristen Flores
 
Knapp_Masterarbeit
Knapp_MasterarbeitKnapp_Masterarbeit
Knapp_MasterarbeitNathaniel Knapp
 
ID3 Algorithm - Reference Manual
ID3 Algorithm - Reference ManualID3 Algorithm - Reference Manual
ID3 Algorithm - Reference Manual
Michel Alves
 
Specification of the Linked Media Layer
Specification of the Linked Media LayerSpecification of the Linked Media Layer
Specification of the Linked Media Layer
LinkedTV
 
Chakrabarti dissertation
Chakrabarti dissertationChakrabarti dissertation
Chakrabarti dissertation
Manjunath Ramachandra
 
Sparks of Artificial General Intelligence.pdf
Sparks of Artificial General Intelligence.pdfSparks of Artificial General Intelligence.pdf
Sparks of Artificial General Intelligence.pdf
NedyalkoKarabadzhako
 
Meterpreter in Metasploit User Guide
Meterpreter in Metasploit User GuideMeterpreter in Metasploit User Guide
Meterpreter in Metasploit User Guide
Khairi Aiman
 
Distributed Decision Tree Learning for Mining Big Data Streams
Distributed Decision Tree Learning for Mining Big Data StreamsDistributed Decision Tree Learning for Mining Big Data Streams
Distributed Decision Tree Learning for Mining Big Data Streams
Arinto Murdopo
 
R data mining_clear
R data mining_clearR data mining_clear
R data mining_clearsinanspoon
 
Increasing Privacy in Smart Contracts: Exploring Encryption Mechanisms
Increasing Privacy in Smart Contracts: Exploring Encryption MechanismsIncreasing Privacy in Smart Contracts: Exploring Encryption Mechanisms
Increasing Privacy in Smart Contracts: Exploring Encryption Mechanisms
RadhaKrishna342833
 
Liebman_Thesis.pdf
Liebman_Thesis.pdfLiebman_Thesis.pdf
Liebman_Thesis.pdf
SatishBhalshankar
 
Master thesis
Master thesisMaster thesis
Master thesisDhara Shah
 
Nweke digital-forensics-masters-thesis-sapienza-university-italy
Nweke digital-forensics-masters-thesis-sapienza-university-italyNweke digital-forensics-masters-thesis-sapienza-university-italy
Nweke digital-forensics-masters-thesis-sapienza-university-italy
AimonJamali
 

Similar to PythonPF.pdf (20)

Software guide 3.20.0
Software guide 3.20.0Software guide 3.20.0
Software guide 3.20.0
 
Algorithms
AlgorithmsAlgorithms
Algorithms
 
Big Data and the Web: Algorithms for Data Intensive Scalable Computing
Big Data and the Web: Algorithms for Data Intensive Scalable ComputingBig Data and the Web: Algorithms for Data Intensive Scalable Computing
Big Data and the Web: Algorithms for Data Intensive Scalable Computing
 
Big data-and-the-web
Big data-and-the-webBig data-and-the-web
Big data-and-the-web
 
An Optical Character Recognition Engine For Graphical Processing Units
An Optical Character Recognition Engine For Graphical Processing UnitsAn Optical Character Recognition Engine For Graphical Processing Units
An Optical Character Recognition Engine For Graphical Processing Units
 
Analyzing Non-Textual Content Elements To Detect Academic Plagiarism
Analyzing Non-Textual Content Elements To Detect Academic PlagiarismAnalyzing Non-Textual Content Elements To Detect Academic Plagiarism
Analyzing Non-Textual Content Elements To Detect Academic Plagiarism
 
Knapp_Masterarbeit
Knapp_MasterarbeitKnapp_Masterarbeit
Knapp_Masterarbeit
 
ID3 Algorithm - Reference Manual
ID3 Algorithm - Reference ManualID3 Algorithm - Reference Manual
ID3 Algorithm - Reference Manual
 
Specification of the Linked Media Layer
Specification of the Linked Media LayerSpecification of the Linked Media Layer
Specification of the Linked Media Layer
 
main
mainmain
main
 
Chakrabarti dissertation
Chakrabarti dissertationChakrabarti dissertation
Chakrabarti dissertation
 
Sparks of Artificial General Intelligence.pdf
Sparks of Artificial General Intelligence.pdfSparks of Artificial General Intelligence.pdf
Sparks of Artificial General Intelligence.pdf
 
Meterpreter in Metasploit User Guide
Meterpreter in Metasploit User GuideMeterpreter in Metasploit User Guide
Meterpreter in Metasploit User Guide
 
Distributed Decision Tree Learning for Mining Big Data Streams
Distributed Decision Tree Learning for Mining Big Data StreamsDistributed Decision Tree Learning for Mining Big Data Streams
Distributed Decision Tree Learning for Mining Big Data Streams
 
R data mining_clear
R data mining_clearR data mining_clear
R data mining_clear
 
thesis
thesisthesis
thesis
 
Increasing Privacy in Smart Contracts: Exploring Encryption Mechanisms
Increasing Privacy in Smart Contracts: Exploring Encryption MechanismsIncreasing Privacy in Smart Contracts: Exploring Encryption Mechanisms
Increasing Privacy in Smart Contracts: Exploring Encryption Mechanisms
 
Liebman_Thesis.pdf
Liebman_Thesis.pdfLiebman_Thesis.pdf
Liebman_Thesis.pdf
 
Master thesis
Master thesisMaster thesis
Master thesis
 
Nweke digital-forensics-masters-thesis-sapienza-university-italy
Nweke digital-forensics-masters-thesis-sapienza-university-italyNweke digital-forensics-masters-thesis-sapienza-university-italy
Nweke digital-forensics-masters-thesis-sapienza-university-italy
 

More from Rishab Saini

DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
Rishab Saini
 
DSA.pdf
DSA.pdfDSA.pdf
DSA.pdf
Rishab Saini
 
Resonance.pptx
Resonance.pptxResonance.pptx
Resonance.pptx
Rishab Saini
 
SQL 3.pptx
SQL 3.pptxSQL 3.pptx
SQL 3.pptx
Rishab Saini
 
PowerFactorImprovement.pptx
PowerFactorImprovement.pptxPowerFactorImprovement.pptx
PowerFactorImprovement.pptx
Rishab Saini
 
Indian Premier League
Indian Premier LeagueIndian Premier League
Indian Premier League
Rishab Saini
 
Poverty
PovertyPoverty
Poverty
Rishab Saini
 
Poetry
PoetryPoetry
Poetry
Rishab Saini
 
Impact of Social media
Impact of Social mediaImpact of Social media
Impact of Social media
Rishab Saini
 

More from Rishab Saini (9)

DBMS.pdf
DBMS.pdfDBMS.pdf
DBMS.pdf
 
DSA.pdf
DSA.pdfDSA.pdf
DSA.pdf
 
Resonance.pptx
Resonance.pptxResonance.pptx
Resonance.pptx
 
SQL 3.pptx
SQL 3.pptxSQL 3.pptx
SQL 3.pptx
 
PowerFactorImprovement.pptx
PowerFactorImprovement.pptxPowerFactorImprovement.pptx
PowerFactorImprovement.pptx
 
Indian Premier League
Indian Premier LeagueIndian Premier League
Indian Premier League
 
Poverty
PovertyPoverty
Poverty
 
Poetry
PoetryPoetry
Poetry
 
Impact of Social media
Impact of Social mediaImpact of Social media
Impact of Social media
 

Recently uploaded

A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
kalichargn70th171
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
Globus
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
Srikant77
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
Philip Schwarz
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Anthony Dahanne
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Globus
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
Tendenci - The Open Source AMS (Association Management Software)
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
abdulrafaychaudhry
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
Donna Lenk
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
Fermin Galan
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
Ortus Solutions, Corp
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Natan Silnitsky
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Jay Das
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
Juraj Vysvader
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
Adele Miller
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
Globus
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Globus
 

Recently uploaded (20)

A Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdfA Comprehensive Look at Generative AI in Retail App Testing.pdf
A Comprehensive Look at Generative AI in Retail App Testing.pdf
 
First Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User EndpointsFirst Steps with Globus Compute Multi-User Endpoints
First Steps with Globus Compute Multi-User Endpoints
 
RISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent EnterpriseRISE with SAP and Journey to the Intelligent Enterprise
RISE with SAP and Journey to the Intelligent Enterprise
 
A Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of PassageA Sighting of filterA in Typelevel Rite of Passage
A Sighting of filterA in Typelevel Rite of Passage
 
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
Paketo Buildpacks : la meilleure façon de construire des images OCI? DevopsDa...
 
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
Innovating Inference - Remote Triggering of Large Language Models on HPC Clus...
 
Corporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMSCorporate Management | Session 3 of 3 | Tendenci AMS
Corporate Management | Session 3 of 3 | Tendenci AMS
 
Lecture 1 Introduction to games development
Lecture 1 Introduction to games developmentLecture 1 Introduction to games development
Lecture 1 Introduction to games development
 
Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"Navigating the Metaverse: A Journey into Virtual Evolution"
Navigating the Metaverse: A Journey into Virtual Evolution"
 
Vitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume MontevideoVitthal Shirke Microservices Resume Montevideo
Vitthal Shirke Microservices Resume Montevideo
 
Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604Orion Context Broker introduction 20240604
Orion Context Broker introduction 20240604
 
Into the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdfInto the Box 2024 - Keynote Day 2 Slides.pdf
Into the Box 2024 - Keynote Day 2 Slides.pdf
 
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.ILBeyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
Beyond Event Sourcing - Embracing CRUD for Wix Platform - Java.IL
 
Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024Globus Compute wth IRI Workflows - GlobusWorld 2024
Globus Compute wth IRI Workflows - GlobusWorld 2024
 
Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024Globus Connect Server Deep Dive - GlobusWorld 2024
Globus Connect Server Deep Dive - GlobusWorld 2024
 
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdfEnhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
Enhancing Project Management Efficiency_ Leveraging AI Tools like ChatGPT.pdf
 
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
In 2015, I used to write extensions for Joomla, WordPress, phpBB3, etc and I ...
 
May Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdfMay Marketo Masterclass, London MUG May 22 2024.pdf
May Marketo Masterclass, London MUG May 22 2024.pdf
 
Enhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdfEnhancing Research Orchestration Capabilities at ORNL.pdf
Enhancing Research Orchestration Capabilities at ORNL.pdf
 
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
Climate Science Flows: Enabling Petabyte-Scale Climate Analysis with the Eart...
 

PythonPF.pdf

  • 1. 3rd Sem Python Programming Practical File Submitted To: Dr. Chhavi Rana Assistant Professor CSE Department UIET-MDU Submitted By: Rishab 25634 CSE-B
  • 2. 1 Table of Contents Program to find GCD of two numbers......................................................... 3 Python Program to find the square root of a number by Newton’s Method........................................................................................................... 5 Find the maximum of a list of numbers...................................................... 9 Linear Search.............................................................................................. 11 Binary Search.............................................................................................. 13 Python Program for Selection Sort........................................................... 15 Python Program for Insertion Sort............................................................ 17 Python Program for Merge Sort ................................................................ 19 Python program to find first n prime numbers ........................................ 21 Programs that take command line arguments (word count) .................. 24 Find the most frequent words in a text read from a file .......................... 26 Simulate elliptical orbits in Pygame.......................................................... 28
  • 3. 2
  • 4. 3 Program to find GCD of two numbers 1 def gcd(m,n): 2 if m< n: 3 (m, n) = (n, m) 4 while (m % n != 0): 5 (m, n) = (n, m % n) 6 return n 7 8 m = int(input("Enter the first number: ")) 9 n = int(input("Enter the second number: ")) 10 print(gcd(m, n))
  • 5. 4
  • 6. 5 Python Program to find the square root of a number by Newton’s Method
  • 7. 6
  • 9. 8
  • 10. 9 Find the maximum of a list of numbers
  • 11. 10
  • 13. 12
  • 15. 14
  • 16. 15 Python Program for Selection Sort
  • 17. 16
  • 18. 17 Python Program for Insertion Sort
  • 19. 18
  • 20. 19 Python Program for Merge Sort
  • 21. 20
  • 22. 21 Python program to find first n prime numbers
  • 23. 22
  • 24. 23
  • 25. 24 Programs that take command line arguments (word count)
  • 26. 25
  • 27. 26 Find the most frequent words in a text read from a file
  • 28. 27
  • 30. 29