SOME SOLVED PROBLEMS
Question 1 – What are data types ?
Solution – The type of data is known as data types .
Question 2 – What are python built in core data types ?
Solution – There are the following data types in python built in core –
1 – Numbers ( Integers , floating point , complex numbers , booleans)
2 – string
3 – tuples
4 – lists
5 – dictionaries
Question 3 – Which data types of python handle numbers ?
Solution – there are the following data types to handle numbers –
1 – integers
2 – floating – point numbers
3 – complex numbers
4 – boolean
Question 4 – Identify the data types of the values given below –
3 , 3j , 13.0 , ‘13 ’ , “ 13 ” , 2 + 0j , 13 , [ 3 , 13 , 2 ] , ( 3 , 13 , 2 )
Solution –
3 – integer
3j – complex number
13.0 – floating point numbers
‘ 13 ’ – string
“ 13 ” – string
2 + 0j – complex number
13 – Integer
( 3 , 13 , 2 ) – tuple
[ 08,16,20 ] - List
Question 5 – Define “ immutable ” ?
Solution – immutable means unchangeable . in python the Immutable types are those types which are unchangeable and we cannot change the values.
Question 6 – What are the output produced by the following code statements ?
1 – 87 // 5
Output - 17
2 – 87 / 5
Output – 17.4
3 – ( 87 // 5.0 ) == ( 87 // 5 )
Output – true
4 – ( 87 // int ( 5.0 ) ) == ( 87 // 5.0 )
Output – true
5 – 17 % 5
Output – 2
6 – 17 % 5.0
Output – 2.0
SOME SHORT TERMS
Atom – something that has a value
Coercion – implicate type conversion
Expression – valid combination of operators and atoms
Explicit type conversion – forced data type conversion
Immutable – unchangeable
Implicit type conversion – Automatic internal conversion
Mutable – changeable
Type casting – Explicit type conversion
SOME QUESTION AND TERMS
Reviewed by Learn Python
on
November 12, 2019
Rating:
No comments: