02Lab COMP1811 - Python Basics PDF

Title 02Lab COMP1811 - Python Basics
Course Paradigms of Programming
Institution University of Greenwich
Pages 1
File Size 87.5 KB
File Type PDF
Total Downloads 22
Total Views 140

Summary

02Lab COMP1811 - Python Basics...


Description

CO COMP1 MP1 MP18 811 Lab Lab2 2 Pyth Pytho on B Baasics Aim To practice using and coding Python variables, built-in data types and basic operations.

Tas Tasks ks 1.

Revise the Python Basics notebook on Moodle and repeat the activities within until you are competent in coding them. 2. Take this quiz on Python Basics. Complete the quiz individually. 3. Complete the Python coding exercises below. You will need to download and unzip the code needed for these exercises. Complete lab tasks 1 and 3 in pairs. Don’t worry if you can’t do all the exercises. Give them a try and if you are stuck, ask your tutor. You do not need to upload your work but it is essential for your learning to document what you’ve done and outline relevant points for future reference. Discuss your work with your tutor before you leave.

Pyth Pytho on C Cod od odin in ingg EExe xe xerrcise cisess a. Exerc Exercise ise 1 Go through and run downloaded Python files with prefix numbers from 01 to 05. Examine the code and try to understand what each file does.

b. Exerc Exercise ise 2 Make a copy of 06Addition and save it to 07Multiplication. Now modify it to do multiplication.

c. Exerc Exercise ise 3 Make a copy of 08Subtraction and save it to 09Division, then modify it to do division. Currently it has 6 variables; without looking at the lecture notes: i. Can you modify it to eliminate some of them? ii. Can you modify it to eliminate all of them? [Harder]

d. Exerc Exercise ise 4 Write Python code from scratch to implement a solution to the following problem. "You’re filling a pool with water and have two hoses – one green and the other red. The green hose fills the pool in 1.5 hours, and the red hose fills it in 1.2 hours. You want to speed up the process by using both hoses at once. How long will it take using both hoses, in minutes?" Remember to comment your code and to use meaningful variable names.

e. Furt Furthe he herr re refere fere feren nce For additional information, please follow the online tutorials listed under "useful resources" under the 1.02 block on the Moodle pages for COMP1811. Go to the w3schools web pages for further details about:  Python variables  Casting data types  Python numbers...


Similar Free PDFs