Read our blogs, tips and tutorials
Try our exercises or test your skills
Watch our tutorial videos or shorts
Take a self-paced course
Read our recent newsletters
License our courseware
Book expert consultancy
Buy our publications
Get help in using our site
537 attributed reviews in the last 3 years
Refreshingly small course sizes
Outstandingly good courseware
Whizzy online classrooms
Wise Owl trainers only (no freelancers)
Almost no cancellations
We have genuine integrity
We invoice after training
Review 30+ years of Wise Owl
View our top 100 clients
Search our website
We also send out useful tips in a monthly email newsletter ...
Software ==> | Python (34 exercises) |
Topic ==> | Basic coding (3 exercises) |
Level ==> | Relatively easy |
Subject ==> | Python training |
This exercise is provided to allow potential course delegates to choose the correct Wise Owl Microsoft training course, and may not be reproduced in whole or in part in any format without the prior written consent of Wise Owl.
For this exercise you are invited to write a program which asks a user for two bits of information:
Their name; and
What they think is the meaning of life.
The program should then summarise the answers you've received. Instructions follow!
Start by creating a program called The meaning of life.py, and use the input function to get the value of two variables:
Variable name | Set to |
---|---|
person_name | Your user's name (typed in at the command prompt) |
life_meaning | Your user's opinion of the meaning of life (again, typed in at the command prompt). |
Run your program to test it out:
Notice that the second question should incorporate the answer to the first question (ie the person's given name).
Extend your program to print out a summary of what you've learnt:
An example final output from your program with questions answered by Bob the nihilist.
Remember that you can include \n in your text to generate a new line.
Test that your program works for optimistics, pessimists and anyone in between, then save it as The meaning of life.py and close it down.
You can find other training resources for the subject of this exercise here:
Kingsmoor House
Railway Street
GLOSSOP
SK13 2AA
Landmark Offices
99 Bishopsgate
LONDON
EC2M 3XD
Holiday Inn
25 Aytoun Street
MANCHESTER
M1 3AE
© Wise Owl Business Solutions Ltd 2025. All Rights Reserved.