

InterviewSolution
Saved Bookmarks
1. |
Name any four data type of python |
Answer» NumericA numeric value is any representation of data which has a numeric value. Python identifies three types of numbers:\tInteger:\xa0Positive or negative whole numbers (without a fractional part)\tFloat:\xa0Any real number with a floating point representation in which a fractional component is denoted by a decimal symbol or scientific notation\t\tComplex number:\xa0A number with a real and imaginary component represented as x+yj. x and y are floats and j is -1(square root of -1 called an imaginary number)\tBooleanData with one of two built-in values\xa0<code>True</code>\xa0or\xa0<code>False</code>. Notice that \'T\' and \'F\' are capital.\xa0<code>true</code>\xa0and\xa0<code>false</code>\xa0are not valid booleans and Python will throw an error for them.Sequence TypeA sequence is an ordered collection of similar or different data types. Python has the following built-in sequence data types:\tString: A string value is a collection of one or more characters put in single, double or triple quotes.\tList\xa0: A list object is an ordered collection of one or more data items, not necessarily of the same type, put in square brackets.\tTuple: A Tuple object is an ordered collection of one or more data items, not necessarily of the same type, put in parentheses.DictionaryA dictionary object is an unordered collection of data in a key:value pair form. A collection of such pairs is enclosed in curly brackets. For example:\xa0<code>{1:"Steve", 2:"Bill", 3:"Ram", 4: "Farha"}</code> | |