2.10 th Basics of Python
2.10 th Basics of Python
Basics of Python
1. The input () function reads the user’s input value and returns it as a
_________.
Ans. String
2. The valid combination of both operands and operators makes an
________, which returns a computed result.
Ans. Expression
3. The _______ operator is used to combine two or more strings.
Ans. Concatenate (‘+’)
4. ________ operators are used to show the relationship between
operands.
Ans. Relational
5. The order in which the operators are evaluated is called ________
of operators.
Ans. Precedence
B. State True or False
1. What are the data types? List some common data type used in python.
Ans). The type of data value that can be stored in a variable is known as
its data type. The data types help in classifying different types of data values
used in a program. Python language has standard data types that are used to
define operations performed on them and the storage method for each. The main
data types used in Python are: int, float, and string.
2. Describe the use of the input (). Write a one-line example to take the input
of a float value from the user.
Ans).The input () function is used to accept the value of a variable from
the user. When you call the input () function, it displays a prompt (if specified)
and then waits for the user to input a value. This value is always considered as a
string, whether it is a number or any other data type.
In this example, the input (“Enter a float value:”) statement prompts the user to
enter a float value.
4. The floor division (//) is different from the basic division (/). Explain.
Ans). ‘/’ operator is used to divide the numbers and give an output in the
decimal form. For example: 5/2 = 2.5, -5/2 = -2.5, 10.0/3 = 3.333.
‘//’ operator is used to divide the numbers and give an output in the integer
form. For example: 5//2 = 2, -5//2 = -2.