GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Modul 9 von 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!")

Anleitung

Um im Kurs weiterzukommen, sende einen Versuch dieses Quiz ab. Du kannst ihn nach der letzten Frage absenden.

Zum gewählten Modul

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck