Computer Science, asked by harendrakoley6, 5 months ago

give output of the following python statement- a) print(type(5/2)) 1 b) print(‘9’+’7’)?​

Answers

Answered by bhagabatisingh51
0

Answer:

a) 5

b) 16

brwbnwbrbdbdbdvdv

Answered by BrainlyYoda
1

a) print(type(5/2))

The output will be <class 'float'>

b) print('9'+'7')

The output will be 97

Explanation

type() function in Python returns the class or data type of object inside it.

In this print statement

print(type(5/2))

5/2 = 2.5

2.5 is a decimal value or float value that is why the output is class float.

Alphabets, words, or other characters when enclosed between single quotation marks (' ') or double quotation marks (" ") are called strings.

In this print statement

print('9'+'7')

9 and 7 are separately enclosed between single quotation marks which means they are two strings and the plus (+) sign between them is used to concatenate or join both strings.

If you wanted the addition of both numbers i.e. 9 and 7 then the print statement would have been

print(9 + 7)

The output would have been 16

Extra Information

There are various types of Arithmetic Operators in Python such as

(A) + operator

It is used to add two operands

Example

print(5+3)

The output will be 8

(B) - operator

It is used to subtract two operands

Example

print(5-3)

The output will be 2

(C) * operator

It is used to multiply two operands

Example

print(5*3)

The output will be 15

(D) / operator

It is used to divide the operands and will give the output in float or decimal value if required.

Example

print(5/3)

The output will be 1.6666666666666667

(E) // operator

It is used to divide the operands and will not give the output in float or decimal value even if required. It only gives integer value as output.

Example

print(5//3)

The output will be 1

(F) % operator

It is used to divide the operands and return the remainder

Example

print(5%3)

The output will be 2

(G) *‏‏‎‎‎‎‎* operator

It is used to raise one operand to the power of another.

Example

print(5*‎‎*3)

The output will be 125

In mathematical terms, it will be like 5³ which is 125

Python is created by Guido van Rossum and came into existence in 1991. It is a high-level and general programming language. It is a very lucid programming language as it has a good language construct and object-oriented approach. It is dynamically typed and garbage-collected.

Similar questions