0% found this document useful (0 votes)
21 views

python manual 1-3 practical

The document outlines a practical programming course using Python, detailing installation procedures, programming modes, and various operators. It emphasizes the development of programming skills through hands-on exercises and the application of engineering principles. Additionally, it includes resources required for the course and practical questions to assess student understanding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
0% found this document useful (0 votes)
21 views

python manual 1-3 practical

The document outlines a practical programming course using Python, detailing installation procedures, programming modes, and various operators. It emphasizes the development of programming skills through hands-on exercises and the application of engineering principles. Additionally, it includes resources required for the course and practical questions to assess student understanding.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF or read online on Scribd
You are on page 1/ 15
Programm . ver *RE.With Python (22616) - Practical No. 1: Instal TM. Relevant Program Outcomes (POs) basic * Basic knowledge: Apply Knowledge of basic mathematics, sciences and basi wwineeting to solve the broad-based Computer engineering problem. : Rascipline knowledge: Apply Computer engineering discipline - specific lowledge to solve core computer engineering related problems. Engineering tools: Apply relevant Computer technologies and tools with an understanding of the limitations. Communication: Communicate effectively in oral and written form. Life-tong learning: Engage in independent and life-long learning activities in the context of technological changes in the Computer engineering field and allied industry. MIL Competency and Practical Skills Develop general purpose Programming using Python to solve problem IV. Relevant Course Outcome(s) Display message on sereen using Python seript on IDE, Practical Outcomes(PrOs) Setup a Python programming development environment VI. Relevant Affective Domain related Outcome(s) 1. Follow safety practices 2. Demonstrate working as a leader /a team member. 3. Follow ethical practices Installing Python in Windows: * Open any internet browser. Type http://www. Python.org/downloads/ in address bar and Enter. * Home page of Python will have displayed as shown in Fig. 1 Maharashtra State Board of Technical Education Programming with P ython (22616) Fig. 1: Home Page Click on download the latest version for windows, which shows latest version as shown in Fig. 2 kin fr Fig.2: Python release versions Open the Python 3.7.1 version pack and double click on it to start installation and installation windows will be open as shown in Fig. 3 | | pythen a W launcher for at c | wind@ws __asarynen'37 so par —_ Fig. 3: Installation Type Maharashtra State Board of Technical Education . ing with Python (22616) VIL Resources required Sr. ‘Name of ‘Specification Quantity | Remarks No. Resource (if any) 1. | Computer System | Computer (i3-i5 ‘As per Batch | For ALL preferable RAM>2GB) _| Size Experiments 2. | Operating System | Windows/Linux 3. | Development Pyhton IDE Software IX. Resources used (Additional) Sr. ‘Name of Specification Quantity [Remarks No. Resource (fany) 1. [Computer System _| COMOURA 13-15 vary, 2. | Operating System | Uoind ous /Lnux + 3. | Development Software Pytnon 7 OE X. Practical related Questions Note: Below given are few sample questions for reference. Teachers must design ‘more such questions to ensure the achievement of identified CO. . Write steps for installing Python on window. State IDLE in Python. List key features of Python Explain Python Path State use of pep and pip Apppe (Space for answers) (A Htantt...p:10.L9se: a. Open Yon 2+! Versio “pack gn double ckick Maharashira Sate Board of Technical Favcation ‘ snd SHOM... instal 1a. N0.0... LLL... Packages Library ‘Maharashtra State Board of Technical Education Programming with Python (22616) —_—_——— Xi Exercise (Use blank space for answers or attach more pages if needed) 1. Print the version of Python 2. Write steps to be followed to load Python interpreter in windows, (Space for answers) ersten... ard of Technical Education Maharashira State Bo: Programming with Python (22616) Practical No. 2: Write simple Python program to display message on screen qv. va. Practical Significance Python is a high level language which is trending in recent past. To make it more user friendly developers of Python made sure that it can have two modes Viz. Interactive mode and Script Mode. The Script mode is also known as normal mode and uses scripted and finished .py files which are run on interpreter whereas interactive mode Supports command line shells. Students will able to understand how to run programs using Interactive and Seript mode. ‘Relevant Program Outcomes (POs) * Basic knowledge: Apply knowledge of basic mathematics, sciences and basic engineering to solve the broad-based Computer engineering problem. * Discipline knowledge: Apply Computer engineering discipline - specific knowledge to solve core computer engineering related problems * Experiments and practice: Plan to perform experiments and practices to use the results to solve broad-based Computer engineering problems. : * Engineering tools: Apply relevant Computer technologies and tools with an understanding of the limitations. + Lifelong learning: Engage in independent and life-long learning activities in the context of technological changes in the Computer engineering field and allied industry. Competency and Practical Skills Develop general purpose programming using Python to solve problem ‘The practical is expected to develop the following skills: 1. Write a simple Python Program using Interactive mode. 2. Write a simple Python Program using Script mode. Relevant Course Outcome(s) Display message on screen using Python script on IDE. Practical Outcome (PrOs) Write simple Python program to display message on screen. Relevant Affective Domain related Outcome(s) 1. Follow safety practices 2. Demonstrate working as a leader / a team member. 3. Follow ethical practices Minimum Theoretical Background Different modes for executing Python program. Interactive Mode Programming Invoking the interpreter without passing a script file as a parameter brings up the following prompt ~ $ Python Python 2.4.3 (#1, Nov 11 2010, 13:34:43) [GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2 ‘Type "help", “copyright”, "credits" or "license" for more information, >>> ‘Maharashtra State Board of Technical Edueation 10 7 Howing text at the Python prompt and press the Enter Trg PENt "Hello, Python! — ” Ifyou are runnin, 'g new version of Python, then you would need to use print statement With parenthesis as j 3k However, in Python version 2.4.3, Script Mode Programming Invoking the inter i fe interpreter with a seri continues until the ipt parameter begins execution of the script and © Script is finished. When the script is finished, the interpreter is no longer active, tus write a simple a imp ibe the following source code in a test po Runt "Hello, Python!" . © assume that you have Python int Python program in a script. Python files have extension -py. eter set in PATH variable. Now, try to run this Program as follows: — $ Python test py, iS Produces the folk ult: Heller Petes h° following resut: Let us try another Way to execute a Python script. Here is the modified test.py file: #V/ust/bin/Python — Print "Hello, Python! We assume that you have Python int tun this program as follows Schmod-+xtestpy # This is to make file executable S.Aest.py This produces the following result — Hello, Python! VIIL Resources required Sr. Name of Specification Quant Remarks | No. Resource (fany) 1. | Computer System | Computer (3+ As per Batch | For ALL preferable RAM>2GR)_| Size Experiments 2. | Operating System | Windows/Linux 3. | Development Pyhton IDE Software IX. Resources used (Additional) Sr. Name of Specification Quantity | Remarks No. Resource a (fany) | 1._| Computer System | Compury 1 2. | Operating System | windows [Linux 3. | Development Software eutnen Ee ‘etpreter available in /usr/bin directory. Now, try to Maharashtra State Board of Technical Education TT Programming with Python (22616) - X. Practical retated Questions a Note: Below given are few sample questions for reference, Peachers must — ‘ore such questions to ensure the achievement of identified CO. ~ List different modes of Programming in Python - 2. Describe procedure to execute program using Interactive Mode | 3. State the steps involved in executing the program using Seript Mos 4. State the procedure to make file executable (Space for answers) IMLS... CANOGA ALU! OG, ‘Maharashtra State Board of Technical Education Programmi th Python (22616) XL Exercise ‘ote: Faculty must ensure that every group of students use different input value. (Use blank space for answers or attach more pages if needed) }- Write a Python program to display your name using Interactive Mode 2. Write a Python Program to display “MSBTE” using Script Mode (Space for answers) ‘Maharashtra State Board of Technical Education w Programs “Togramming with Python (22616) Practical No. 3: Write simple Python program using operators: Arithmetic 1 m1. vi Operators, Logical Operators, Bitwise Operators Practical Sij gnificance Qrerators are used to perform operations on values and variables. Operators can Granipulate individual items and retus a result. The data items are referred as operands or arguments. Operators are either represented by keywords or special Sharacters. Here are the types of operators supported by Python: * Arithmetic Operators * Assignment Operators 2 Relational or Comparison Operators * Logical Operators * Bitwise Operators * Identity Operators 2, Membership Operators Students will be able to use various operators to check the condition and get SpPropriate result by performing different operation with the help of supported operators, Relevant Program Outcomes (POs) * Basic knowledge: Apply knowledge of basic mathematics, sciences and basic engineering to solve the broad-based Computer engineering problem. * Discipline knowledge: Apply Computer engineering discipline - specific knowledge to solve core computer engineering related problems * Experiments and practice: Plan to perform experiments and practices to use the results to solve broad-based Computer engineering problems. * Individual and team work: Function effectively as a leader and team member in diverse/ multidisciplinary teams. * Lifelong learning: Engage in independent and life-long learning activities in the context of technological changes in the Computer engineering field and allied industry. ‘Competency and Practical Skills Develop general purpose programming using Python to solve problem The practical is expected to develop the following skills: + Write a program to use Arithmetic, Logical and Bitwise Operators Relevant Course Outcome(s) Develop Python program to demonstrate use of Operators Practical Outcomes(PrOs) Develop Python program using operators: Arithmetic Operators, Logical Operators, Bitwise Operators Relevant Affective Domain related Outcome(s) 1. Follow safety practices 2. Demonstrate working as a leader / a team member. 3. Follow ethical practices 15 “Maharashtra State Board of Technical Education Programmi NE with Python (22616) [S8® Piety the mamber orbits pected I | ———Lbytherightoperand, | = VEL. Resources required 7 7 Sr. Name of Specification Quantity | Remarks ___Resource 7 oon a 7 Computer System | Computer (35 - 5 __| preferable RAM>2GB)_| | Operating System | Windows/Linux Development Pyhton IDE Software = TX. Resources used (Additional) Sr. | Name of Resource Specification Quantity | Remarks Ne fam: 1. | Computer System CompUry i3 - 1S 2. Operating System, ind. = 7 | Development Sotwens Python FRE x. Practical related Questions Note: Below given are few sample questions for reference. Teachers must design more such 1. questions to ensure the achievement of identified CO. Mention the use of //, **, % operator in Python 2. Describe ternary operator in Python 3. 4. Describe about different Logical operators in Python with appropriate examples. + Describe about different Arithmetic operators in Python with appropriate examples. - Describe about different Bitwise operators in Python with appropriate examples. ‘Maharashtra State Board of Technical Education Programming with Python (22616) 7 — Axi tno eh, Operatot Maharashtra State Board of Technical Education Proj A Setamnming with Python (22616) Exercise Note: Faculty must ensure that every group of students use different input value. _ (Use blank space for answers or attach more pages if needed) Write a program to convert U.S, dollars to Indian rupees. Write a program to convert bits to Megabytes, Gigabytes and Terabytes Write a program to find the square root of a number Write a program to find the area of Rectangle Write a program to calculate area and perimeter of the square - Write a program to calculate surface volume and area of a eylinder. ‘Write a program to swap the value of two variables (Space for answers) NOY sen IKE ABLE AVM Square Toot of NUM Maharashtra State Board of Technical Education 7 —_ lenght = tot Cinput Cuentey the lengtn! d a breadth = ny (inpur (“Enter fhe breadth’ aan ooo print (° Areqa of vectangle = 5 deagth * brea h Output Enter the. Leagth Le —._ Enter tne breadth. aoe Arta oF rectangle @55> side = int Cinput Co énter side of square: p RAAEnaa print (% area of square =” sider side) print CO" penmerer of square =", 4# side ) i output : 7 Soi Enter side of square. 5 area _ of _ aaa aelegete Po e perimerks of square = 20 = = @t>—> p 22 (/ = 7 —_her'ght = Float C yput C'Herght of cylinder! te) cee ald Float C input C" radius of cylindes +”) eet ane (Volume = pi * Yadivan & Tadian x height am —surcarea = C2* pix vodian ) x height)t CC ple radvan a Me QED) ——print_CYvolume_t's_."_, volume ____ eet print’ CS surface area + sut— avea ) oukpur : Height of cylindes + 4 | Fadius of | inden. 6 HH i Volume 1S 2 452-5 E4295 414 2656 {| surface Aven is. 3tF. (4285t14285F es

You might also like