The Basics

Learn Python Programming

Tutorial

#1

Ask for the user’s first name and display the output message:

“Hello [First Name]”

#2

Ask for the user’s frist name and then ask for their surname and display the output message: 

“Hello [First Name] [Surname]”

#3

Write the code that will display the joke: 

“What do you call a bear with no teeth?” and on the next line display the answer “A gummy bear!”. 

Try to create it using only one line of code.

#4

Ask the user to enter two numbers. Add them together and display the answer as:

“The total is [answer]”

#5

Ask the user to enter three numbers. Add together the first two numbers and then multiply this total by a third. Display the answer as: 

“The answer is [answer]”

#6

Ask how many slices of a pizza the user started with and ask how many slices they have eaten. Work out how many slices they have left and display the answer in a user-friendly format.

#7

Ask the user for their name and their age. Add 1 to their age and display the output:

[Name] next birthday you will be [new age].

#8

Ask for the total price of the bill, then ask how many diners there are. Divide the total bill by the number of diners and show how much each person must pay. 

#9

Write a program that will ask for a number of days and then will show how many hours, minutes and seconds are in that number of days. 

#10

There are 2.204 pounds in a kilogram. Ask the user to enter a weight in kilograms and convert it to pounds. 

#11

Task the user to enter a number over 100 and then enter a number under 10. Display to the user how many times the smaller number goes into the larger number in a user friendly format. 

Assessment

Now that you have completed all the challenges have a go at creating this program which sums up all of the knowledge you have learned so far. This will be marked and you will be given feedback on this piece of work so do your best!

Ask the user for the following details: 

Full name | Age | Full address including post code | Job title | Amount of money they earn each year. |

Also ask how much money they spend on the following things each month:

Rent | Utility bills | Car | Phone | Food  

Calculate their take home pay each month after tax. (Tax will be set at 20% of their annual salary) 

Figure out how much money they have left after they have spent all their monthly outgoings. This is called disposable income. 

The code will output all the information in the following format as in the image.