GoConqr has a new look! Let us know what you think.

Module 9 of 13 · Text

LAB

David Khieu

Objectives

  • becoming familiar with the inputting and outputting the data in Python
  • evaluating simple expressions

Scenario

Your task is to complete the code in order to evaluate the results of four basic arithmetic operations. 

The results have to be printed to the console. 

You may not be able to protect the code from a user who wants to divide by zero. That's okay, don't worry about it for now. 

Test your code - does it produce the results you expect ?

We won't show you any test data - that would be too simple. 

What I wrote:

vara = float(input("Input variable a number here: " ))# input a float value for variable a here
varb = float(input("Input variable b number here: "))# input a float value for variable b here


print("Variable a plus Variable b is", vara + varb)# output the result of addition here
print("Variable a minus Variable b is", vara - varb)# output the result of subtraction here
print("Variable a multiplied by Variable b is", vara * varb)# output the result of multiplication here
print("Variable a divided by Variable b is", vara / varb)# output the result of division here

print("\nThat's all, folks!")

Instructions

You must submit an attempt for this quiz to progress. You can submit it after the last question.

Go to the chosen module

Feedback

What is it about?

What do you think of the new look?

How do you like it?