A brief introduction to python, involving problem solving techniques: algorithm, flowchart,pseudocode,Building blocks of algorithms and tower of hanoi as an example with its algorithm
Size: 162.18 KB
Language: en
Added: Jul 02, 2024
Slides: 15 pages
Slide Content
Python is a high level, interpreted programming language known for its simplicity, readability and versatility Python has since become one of the most popular languages for wide range of applications, including web development, data analysis, artificial intelligence, machine learning, automation and scientific computing. Introduction
Created by Guido van Rossam and first released in1991. Python supports multiple programming paradigms, including procedural, object-oriented, and functional programming styles, allowing developers to choose the approach that best fits their needs.
One of python’s greatest strength is its extensive standard library, Which provides modules and packages for tasks ranging from file i/o to network programming, web development, and database access. Additionally python’s vibrant ecosystem boasts a vast number of third-party libraries and framework, such as Django , flask, NumPy , pandas, T ensorFlow , scikit -learn, which further extend its capabilities o
ALGORITMIC PROBLEM SOLVING
Problem solving is a systematic approach to define the problem and creating no. of solutions. The problem solving begins with understanding the problem ,exploring the examples, simplifying and finding the solutions. PROBLEM SOLVING
Problem solving technique is a set of techniques that helps in providing logic for solving a problem. Problem solving can be expressed in the form of (a) algorithm (b) flowchart (c) pseudocode . Problem solving techniques
Algorithm is an ordered sequence and provide a detailed set of instructions by which you can process data for a specific purpose. Any problem whose solution can be expressed in a list of executable instructions. Algorithm
Start Read the name and department print the name and department stop. Example -1
The building blocks of algorithm are 1. statement 2. state 3. control flow 4. functions Building blocks of algorithm
Statement is a single action in a computer A statement might include some of the following actions 1. input data information given to the program 2. process data perform operation on a given input 3. output data processed result Statement
Transition from one process to another process under specified condition within a time is called state State
The process of executing the individual statements in a given order is called control flow. The control can be executed in 3 ways Sequence-All the instructions are executed one after another Selection-used for decisions, brancing and choosing b/w 2 or more alternative paths Iteration-controlled with loop statements that executes 1 or more statements repeatedly Control Flow
Write an algorithm to check whether he is eligible to vote. Start Get age if age>=18 print ‘eligible to vote’ else print ‘not eligible to vote’ stop Example-2
Tower of Hanoi
Define a function towerofhanoi that takes 4 parameters: the no. of disks, the rod source, the extra rod, destination rod. Check if n is equal to 1.if so ,move the disk from the source rod to destinationrod Recursive call with towerofhanoi with n-1 disks, moving source rod to auxiliary. Move the nth disk from the source to destination Move the n-1 disks , moving them from the auxiliary rod to the destination. algorithm