Here we are using basic operator and function to implement basic calculator. This program provide basic use of operator and how to work with function. con=1 while con==1: no1=int(input("Enter First Value ")) no2=int(input("Enter Second Value ")) print("Choice") print("1. Add") print("2. Subtract") print("3. Multiplication") print("4. Division") choice=int(input("Enter Choice ")) def Add(): return (no1+no2) def Sub(): return (no1-no2) def Mul(): return (no1*no2) def Div(): return (no1/no2) def perform_op(choice): if choice == 1: print(Add()) elif choice == 2: print(Sub()) elif choice == 3: print(Mul()) elif choice == 4: print(Div()) else: print("*** Invalid Choice ***") perform_op(choice) con=int(input("Do You Want To Continue ")) OutPut…
-
-
Here, gettype() function is used to get the datatype of the variables. Syntax gettype($variable); <?php $a=10; $b=10.98; $c="Hello"; echo "$a is ".gettype($a); echo "<br> $b is ".gettype($b); echo "<br> $c is ".gettype($c); ?> OutPut 10 is integer 10.98 is double Hello is string