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
546 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 ==> | Average difficulty |
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.
Your task for this exercise is to write a program to add together two numbers typed in by a user. Here's what a typical output from the program might look like:
The hard part of this exercise is making sure that you're working with numbers when you need numbers, and text when you need text.
To being with, create a new program called Slack adder.py. Within this create two variables to equal the two inputs typed in by your user.
You'll need to use the int() function to convert the text typed in by your user into integers, otherwise you won't be able to subsequently add the two numbers together. You can assume that your user will be well-behaved and type in only numbers.
Create a third variable to hold the sum of your two numbers, then print out your results (this time you'll need to use the str() function to turn your numbers back into text, before using the + sign to concatenate the bits of text you need to form your message).
When your program is working to your satisfaction, save it 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 2024. All Rights Reserved.