First, click "Solve the Problem:" to see detailed instructions and useful information.
Second, try to code a solution to the problem using the embedded Python coding environment.
Third, if you are finding it difficult, you can click "Get Some Hints:" to see some tips to help you solve the problem. There is also music to help you focus midway down the page.
Finally, at the bottom of the page, there is an embedded Form where you can paste and upload your completed solution.
Once you have uploaded your code there will be a link to the solution at the end of the Form, so just like in the exam even if you can't entirely finish the solution, upload as much as you have been able to and you can then see the correct answer afterwards to see where (if anywhere) you went wrong.
This should be easy, right? Two variables (called number1 and number2, maybe?) that have values assigned to them using input statements like we have done before. Something like number1 = input("Please enter your first number: ") and number2 = input("Please enter your second number: ") (remember, each statement needs a new line!)
We've got our two numbers saved to variables - but how do we add them together? It is good practice to create another variable with a sensible name (maybe answer) and assign a value to it with the assignment operator = like before. But how to make the computer add them together?
How about this? answer = number1+number2. Remember computers are just big calculators really, so it is no surprise that they can add things up using standard maths just like we do! Only difference is the variable answer and the = have to come first, not last. number1+number2 = answer wouldn't work, for example.
Now, we can just print the answer. We just want to print the answer, no concatenated text strings this time, so only the variable name goes in the print brackets: print(answer)
Hold on! I tired this code and it told me that 7+7=77! I am *pretty* sure that isn't right... Well that is because we didn't tell Python what data type we were using. By default, an input line enters a string - words or text. So, python saw our numbers as strings - bits of a sentence, maybe - and tried to concatenate them using the + operator rather than add them up. It just joined the two values together - 7 joined to 7 is 77... It thinks we're in an English class, it should think we're in Maths! So... how can we fix it?
We need to cast our input - tell Python what kind of data it is. Whole numbers in Python are called integers, and we want whole numbers, so try the code this way with the word int( before the input statement and an extra bracket at the finish as well ) to wrap it up neatly: number1 = int(input("Please enter your first number: "))
Do that to both input staements - it knows to do maths now! Remember, every bracket you open needs to be closed... so int(input( opens 2, so 2 need to be closed at the end )).