Answer:
- equation = input("Enter an equation: ")
-
- if("+" in equation):
- operands = equation.split("+")
- result = int(operands [0]) + int(operands[1])
- print(operands[0] + "+" + operands[1] + "=" + str(result))
- elif("-" in equation):
- operands = equation.split("-")
- result= int(operands [0]) - int(operands[1])
- print(operands[0] + "-" + operands[1] + "=" + str(result))
- elif("*" in equation):
- operands = equation.split("*")
- result = int(operands [0]) * int(operands[1])
- print(operands[0] + "*" + operands[1] + "=" + str(result))
- elif("/" in equation):
- operands = equation.split("/")
- result = int(operands [0]) / int(operands[1])
- print(operands[0] + "/" + operands[1] + "=" + str(result))
- elif("%" in equation):
- operands = equation.split("%")
- result = int(operands [0]) % int(operands[1])
- print(operands[0] + "%" + operands[1] + "=" + str(result))
Explanation:
The solution code is written in Python 3.
Firstly prompt user to enter an equation using input function (Line 1).
Create if-else if statements to check if operator "+", "-", "*", "/" and "%" exist in the input equation. If "+" is found (Line 3), use split method to get the individual operands from the equation by using "+" as separator (Line 5). Output the equation as required by the question using string concatenation method (Line 6). The similar process is repeated for the rest of else if blocks (Line 7 - 22).
I type of shape, or a pointing index finger
True because that's what i said it is
Answer:
Explanation:
A pointer is nothing but a memory location where data is stored. A pointer is used to access the memory location. There are various types of pointers such as a null pointer, wild pointer, void pointer and other types of pointers. ... When you want to deal different variable data type, you can use a typecast void pointer.
Democracy is the best form of government simply because no other form of government is known to work well. Democracy may have its flaws but all in all it .