1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
tresset_1 [31]
3 years ago
4

The variables x and y refer to numbers. Write a code segment that prompts the user for an arithmetic operator and prints the val

ue obtained by applying that operator to x and y.

Computers and Technology
1 answer:
timama [110]3 years ago
8 0

Answer:

Here is the Python program. If you want the program in some other programming language let me know.    

x = int(input("Enter the value of x: "))

y = int(input("Enter the value of y: "))

op = input("Enter an arithmetic operator : ")

operation = 0

if op == '+':

   operation = x + y

elif op == '-':

   operation = x - y

elif op == '*':

   operation = x * y

elif op == '/':

   operation = x / y

elif op == '%':

   operation = x % y

else:

   print("Invalid Character!")

print(x, op , y, "=", operation)

Explanation:

The program prompts the user to enter the value of x and y. These values are stored in variables x and y

Then the program prompts the user to enter an arithmetic operator. op variable stores the value of operator entered by the user.

If else statement is used which checks the the character of operator ( +, - , /,  * or %) that the user inputs and performs the arithmetic operation according to the input operator. The if else part that will be executed to perform the arithmetic operation is based on the operator that the user enters. For example if the user enters / then the third elif part is executed and the value of x and y are divided.

The screen shot of output of the program is attached.

You might be interested in
unlike the barcode-based tracking system, a radio frequency identification system offers a .
Over [174]

Unlike the barcode-based tracking system, a radio frequency identification system offers a <u>no-contact, no-line-of-sight reading, and tracking system</u>.

What is a tracking system?

A tracking system often referred to as <u>a locating system, is used to keep </u><u>track </u><u>of people or objects in motion and provide an accurate, timely sequence of location data for processing</u>. Human tracking should be understood; more information is provided below.

<u>Any stolen car can be kept </u><u>track </u><u>of across the nation</u> with the use of a tracking system, ensuring that it is returned as soon as possible. A tracking system is a crucial tool for making sure your personnel is safe.

To learn more about tracking system, use the link given
brainly.com/question/15237193
#SPJ4

8 0
1 year ago
Class members are accessed via the ____(1)_____ operator in conjunction with the name of an object of the class, or via the ___(
Alborosie

Answer:

1.ClassName and . operator

2. ClassName and [] operator

Explanation:

There are two ways to get the members of a class first one is by using dot(.) operator.

Example : with assumption that person is a class object and age is the member in it we can use it as:

person.age

Second way is to use [] operator with member as a string in it which is used by the compiler as key to get its value.

Example : person["age"]

5 0
3 years ago
What options are available for storing backups, physically?
RUDIKE [14]

The options are available for storing backups, physically are:

  • In both on site and off site,, a person can backup data to a given system that is located on-site, or the backups can be sent to any  remote system that is off-site.

<h3>What is a backup?</h3>

This is known to be a device that helps to save information or data temporarily or permanently.

Note that in the above, The options are available for storing backups, physically are:

  • In both on site and off site,, a person can backup data to a given system that is located on-site, or the backups can be sent to any  remote system that is off-site.

Learn more about backups from

brainly.com/question/17355457

#SPJ12

7 0
1 year ago
HELLLP
mojhsa [17]

Explanation:

The output of this program is 5 7, because the first time bruce is printed, his value is 5, and the second time, his value is 7. The comma at the end of the first print statement suppresses the newline after the output, which is why both outputs appear on the same line.

Here is what multiple assignment looks like in a state diagram:



With multiple assignment it is especially important to distinguish between an assignment operation and a statement of equality. Because Python uses the equal sign (=) for assignment, it is tempting to interpret a statement like a = b as a statement of equality. It is not!

First, equality is symmetric and assignment is not. For example, in mathematics, if a = 7 then 7 = a. But in Python, the statement a = 7 is legal and 7 = a is not.

Furthermore, in mathematics, a statement of equality is always true. If a = b now, then a will always equal b. In Python, an assignment statement can make two variables equal, but they don’t have to stay that way:

a = 5

4 0
2 years ago
Read 2 more answers
Asking questions when something is unclear is part of
Ksenya-84 [330]
Personally responsibility

Hope this helps
6 0
3 years ago
Other questions:
  • What are some useful properties of current electricity
    13·2 answers
  • What attack cracks a password or encryption key by trying all possible valid combinations from a defined set of possibilities (a
    12·1 answer
  • . Given an initially empty stack s that accepts integers, the following operations are performed: s.push (10) s.push (20) s.push
    13·1 answer
  • Which software can managers use to discuss financial performance with the help of slides and charts?
    7·2 answers
  • You can install several printers on your machine, but at least one must be the _______ printer.
    6·1 answer
  • A computer has the following parameters Operation Frequency Cycles Arithmetic/Logical instructions 65% 1 Register load operation
    11·1 answer
  • Define networks, marketplaces, and platforms and discuss their differences.
    15·1 answer
  • which of the following is a component of a rope-rewind starter system? a. a recoil spring c. an air vane governor b. a wrist pin
    5·1 answer
  • Por favor alguem poderia me falar qual PC e melhor: Computador Gamer Fox PC FPS Intel Core i5 8GB (GeForce GTX 1050Ti 4GB GDDR5)
    15·1 answer
  • Which is the following should be selected in the paragraph dialogue box to prevent page break from occurring within a paragraph
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!