0% found this document useful (0 votes)
7 views2 pages

COMP100 Practical One Overview

The document outlines the practical tasks for COMP100 in 2023, including login instructions for campus labs and how to sign the attendance register on Moodle. It provides detailed programming assignments that involve calculating final velocity, cylinder volume, converting pounds to kilograms, mortgage repayment, and determining the return day from a holiday. Each task includes specific instructions for coding in Python and the mathematical formulas required.

Uploaded by

skhulilem24
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
7 views2 pages

COMP100 Practical One Overview

The document outlines the practical tasks for COMP100 in 2023, including login instructions for campus labs and how to sign the attendance register on Moodle. It provides detailed programming assignments that involve calculating final velocity, cylinder volume, converting pounds to kilograms, mortgage repayment, and determining the return day from a holiday. Each task includes specific instructions for coding in Python and the mathematical formulas required.

Uploaded by

skhulilem24
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

COMP100 Practical One 2023

Preliminaries
1. If you are using the campus LABs, you must login with your UKZN login details.
The tutors cannot help you with login issues - you must see the LAB consultants for this (in the room
on the right side of the Green LAN as you walk in.)

2. How to sign the register on Moodle

• You may only sign the register before 5 pm if you have completed all your practical work. You
must sign the register before 5:10 pm.
• Click on ”Attendance Register” at the bottom of block.
• Click on “Start Quiz” then click the button next to ”True” in the quiz page
• Click “Next” then click on ”Finish Attempt”.

COMP100 Practical One 2023

1. Question One: Fast but not Furious


Write a program that asks the user for input of the following values: the initial velocity of a car,
its acceleration, and its time. The program should then output the car’s final velocity. The
equation of motion to calculate this is:

v = v0 + at

• Start by opening Wing IDE where you can write your Python code.
• Define variables for initial velocity (v0), acceleration (a), and time (t) and assign appropriate
values from user input (don’t forget type conversion from str to float!).
• Use the equation of motion to calculate the final velocity (v) of the car:
v = v0 + a * t
• Print the final velocity of the car using the print() function:
print("The final velocity of the car is:", v, "m/s")
• Save your code with a meaningful file name, such as " [Link]"
• Run your program to check if it's working correctly. You should see the final velocity of the
car printed to the console.

Congratulations, you have successfully implemented a Python program that calculates the
final velocity of a car!

2. Question Two: Volume Calculator


Write a program that inputs the radius and the length of a cylinder and then calculates and
outputs the volume of the cylinder. The volume of a cylinder is given by:
area = radius2 × π

volume = area × length

Use the math module as the value of π (see notes and Week 2 Flipped lecture if you are
unsure how to do this.)

3. Question Three: Weighty Issues


Write a program that converts pounds to kilograms. Your program should input the number of
pounds from the user and should output the equivalent number of kilograms. One pound is 0.454
kilograms.

4. Question Five: Debt


In order to pay off in N years a mortgage of P on which interest is charged at an annual rate of
R% and computed annually, A must be repaid every year where:

and .
Write a program which reads P, N and R from user input and outputs A.

5. Question Six: Holiday Time


It is possible to name the days 0 through 6 where day 0 is Sunday and day 6 is Saturday. If you
go on a wonderful holiday leaving on day number 3 (a Wednesday) and you return home after
10 nights then you would return on Friday. Write a general version of the program which asks
for the starting day number, and the length of your stay, and it will tell you the number of day
of the week you will return on. HINT: Use the % operator.

COMP100 2 2023

You might also like