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

Introduction To Programming Test

The document outlines a programming test consisting of eight questions that require writing Python code using Thonny. The tasks include basic arithmetic operations, string manipulation, user input handling, loops, and list operations. Each question specifies the requirements for the code and emphasizes the importance of commenting and submitting the work correctly.

Uploaded by

skqkjwi
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)
13 views2 pages

Introduction To Programming Test

The document outlines a programming test consisting of eight questions that require writing Python code using Thonny. The tasks include basic arithmetic operations, string manipulation, user input handling, loops, and list operations. Each question specifies the requirements for the code and emphasizes the importance of commenting and submitting the work correctly.

Uploaded by

skqkjwi
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
You are on page 1/ 2

Programming Test 1

Write the code for each of these questions in Thonny, then submit the Python file to Microsoft
Teams. Put your name as a comment at the top of your code (write # then your name).
Remember that if your code isn’t working, don’t delete it, just comment it out (use # or “””)

Question 1

Write a program that assigns two numbers with decimal points (floats) and then, separately,
displays their sum, difference, and product.

Question 2

Write a program that assigns two decimal numbers and then calculates and displays their
average, the remainder after division, and the first to the power of the second.

Question 3

Create a program where the user is asked to input the name of their favourite artist. Assign
this value to a variable. Create another variable containing a compliment (e.g., “ is brilliant.”).
Using the + operator, concatenate (combine) the two string variables and display the result.

Question 4

Create a program to work out whether the user is eligible to apply for an Irish Driving Licence.

Ask the user to input their age. If they are aged 17 or over, they are eligible, otherwise they
are not. Display a message to tell the user whether they are eligible or not.

Question 5

Write a program the prints the numbers 1 to 10 using a for loop. Then write an equivalent
program that prints the numbers 1 to 10 using a while loop.
Question 6

Write a Python program to take in 5 numbers and store them in a list. Separately, go through
the list and add 1 to each item. Print out the list to test that each item has been incremented
by 1.

Question 7

Write a program that takes in a sentence. Then ask the user to enter a single character (a string
of length 1). Next, using a for loop, count the occurrences of that character in the sentence.

Question 8

Using a rain gauge, you have collected and recorded the rainfall amount (in cm), for each day
in a week.
Write a Python program to allow the user to input these measurements into a list (7 days).
The program should then calculate and output the total rainfall for the week and the average
rainfall.
In a separate loop, if on any day the rainfall exceeded 3.5 cm, a message indicating this should
be output to the user.

You might also like