Computer Science, asked by divyarajan225, 8 months ago

which of the following expressions will result in an error message being displayed when a program containing it is run 2.0/4
"3" + "hello"
4%15
int ("5")/float("3")
float("6"/"2")​

Answers

Answered by garvitguptark
0

Answer:

Variables

One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a name that refers to a value.

The assignment statement creates new variables and gives them values:

>>> message = "What's up, Doc?"

>>> n = 17

>>> pi = 3.14159

This example makes three assignments. The first assigns the string "What's up, Doc?" to a new variable named message. The second gives the integer 17 to n, and the third gives the floating-point number 3.14159 to pi.

The assignment operator, =, should not be confused with an equals sign (even though it uses the same character). Assignment operators link a name, on the left hand side of the operator, with a value, on the right hand side. This is why you will get an error if you enter:

>>> 17 = n

A common way to represent variables on paper is to write the name with an arrow pointing to the variable’s value. This kind of figure is called a state diagram because it shows what state each of the variables is in (think of it as the variable’s state of mind). This diagram shows the result of the assignment statements:

State diagram

The print statement also works with variables.

>>> print message

What's up, Doc?

>>> print n

17

>>> print pi

3.14159

In each case the result is the value of the variable. Variables also have types; again, we can ask the interpreter what they are.

>>> type(message)

<type 'str'>

>>> type(n)

<type 'int'>

>>> type(pi)

<type 'float'>

Explanation:

Answered by RAAZ34
0

Answer:

Explanation:

Variables

One of the most powerful features of a programming language is the ability to manipulate variables. A variable is a name that refers to a value.

The assignment statement creates new variables and gives them values:

>>> message = "What's up, Doc?"

>>> n = 17

>>> pi = 3.14159

This example makes three assignments. The first assigns the string "What's up, Doc?" to a new variable named message. The second gives the integer 17 to n, and the third gives the floating-point number 3.14159 to pi.

The assignment operator, =, should not be confused with an equals sign (even though it uses the same character). Assignment operators link a name, on the left hand side of the operator, with a value, on the right hand side. This is why you will get an error if you enter:

>>> 17 = n

A common way to represent variables on paper is to write the name with an arrow pointing to the variable’s value. This kind of figure is called a state diagram because it shows what state each of the variables is in (think of it as the variable’s state of mind). This diagram shows the result of the assignment statements:

State diagram

The print statement also works with variables.

>>> print message

What's up, Doc?

>>> print n

17

>>> print pi

3.14159

In each case the result is the value of the variable. Variables also have types; again, we can ask the interpreter what they are.

>>> type(message)

<type 'str'>

>>> type(n)

<type 'int'>

>>> type(pi)

<type 'float'>

Similar questions