fbpx
1- Introduction
2- Python Basic
3- Learning Python
4- Python Literals
5- Arithmetic operators
6- Function INPUT() and STRING operations
7- Comparison Operators and Conditions
8- Loops in Python
9- Logic and bit operators
10- Lists and Arrays in Python
11- Functions
12- Tuples, Dictionaries
13- Conclusion
14- Practice Exams

L6.2 Hands-on Lab -input function

Lesson
Materials

Purpose: Becoming familiar with the inputting and outputting of data in Python

Task:

Your task is to write and complete code in order to evaluate the results of four basic arithmetic operations. You can pick any two numbers and show output of the results of addition, subtraction, multiplication and division.

Solution

 

num1 = float(input(" Please Enter the First Value Number 1: ")) 
num2 = float(input(" Please Enter the Second Value Number 2: "))
# Add Two Numbers
add = num1 + num2
print(add)
# Subtracting num2 from num1
sub = num1 - num2
print(sub)
# Multiply num1 with num2
multi = num1 * num2
print(multi)
# Divide num1 by num2
div = num1 / num2
print(div)
6
0
Wanna ask a question or say something? Go aheadx
()
x
Scroll to Top