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).
Answer:
________________________
The following is a list of "6 (six) errors" :
__________________________________
1) The "city, state, and zip code" should be listed on a separate line, directly following the street address:
_______________________________________________________
→ Hartford, CT 06114
_______________________________________________________
2) In "Objective" section: The misspelled: "challenging" should be changed to "challenging".
_______________________________________________________
3) In the "Objective" section: The word: "righting" should be changed to:
"writing".
_______________________________________________________
4) In the "Summary" section: The misspelled: "addjust" should be changed to: "adjust" .
________________________________________________________
5) The misspelled "impppeccable" should be changed to "impeccable".
________________________________________________________
6) Perhaps, "drive-thru" should be changed to: "drive-through" ; but even more importantly— refer to:
________________________________________________________
"Managed all staff and ensured hi performance and efficiency" ;
→ The "hi" should be changed to "high".
___________________________________________________
These are some errors. Glad to be of help!
___________________________________________________
Answer:
// here is code in the C++.
#include <bits/stdc++.h>
using namespace std;
// main function
int main() {
// variable to store the input
int birth_month,birth_year;
cout<<"enter birth month:";
// read the birth month
cin>>birth_month;
cout<<"enter birth year:";
// read the birth year
cin>>birth_year;
// print the output
cout<<birth_month<<"/"<<birth_year<<endl;
return 0;
}
Explanation:
Declare two variables to store the birth month and birth year.Read the inputs from the user and assign it the variables.Print the birth month and year separated by a slash "/".
Output:
enter birth month:1
enter birth year:2000
1/2000
Answer:
The bicycle is a tremendously efficient means of transportation. In fact cycling is more efficient than any other method of travel--including walking! The one billion bicycles in the world are a testament to its effectiveness
Explanation:
Answer:
def validateCreditCard(x):
if type(x)==str and len(x) == 8:
print("Valid credit card number")
else:
print("Invalid credit card number")
validateCreditCard("43589795")
Explanation:
Run the code on your text editor(vs code, sublime, pycharm ) you will get your desired response. If your input is not of type string and not up to 8 digit you will get the response "invalid credit card number" but if it is of type string and up to 8 digit you will get "Valid credit card number".
But remember python works with indentation so when you are transferring this code to your text editor it will run properly well.
I defined the code using the conventional pattern "def"
After defining the function you create a brackets (x) to accommodate your argument x and end it with a semi colon.
Then i use "if" statement to make sure only string argument and 8 digit value will be accepted to print a "valid credit card". if your argument does not pass the if statement condition it will print out the else statement condition which is "Invalid credit card number"
Finally, you have to call your function and test various values.