how to make a for loop calculator in python code example

Example 1: how to make a complex calculator in python

Just Ctrl-C and Ctrl-V

num1 = float(input("Enter first number... "))
op = input("Enter an Operation... ")
num2 = float(input("Enter second number... "))
if op == ("+"):
    print(num1+num2)
elif op == ("-"):
    print(num1-num2)
elif op == ("*"):
    print(num1 * num2)
elif op == ("/"):
    print(num1/num2)

Example 2: for in loop javascript

var person = {"name":"taylor","age":31};
for (property in person) {
	console.log(property,person[property]);
}
//name taylor
//age 31

Tags:

Java Example