Page 70 - Digicode_AI_class_7
P. 70
The common data types are:
Data Type Used for Declaration Example
Integer It represents whole numbers (zero, positive, int a=2; 7, 12, 999
(int) negative value, not the decimal value)/integer
value.
Assigning non-integer values to integer
variable returns an error.
Variable holds only a single value.
Floating It represents a real number with decimal Float a=5.1; 3.15, 9.06,
point values or fraction. Double 00.13
(float) Another type of floating-point number is a=9.99*8.888
"double" data type, to store even bigger values.
Character It” holds a single letter (e.g. a, b, c). Char a=’z’; 97 (in ASCII,
(char) The syntax of declaring a character variable 97 is a lower
is specific to the programing language. case 'a')
It is the smallest data type by size.
Assigning a non-character type value to
character type variable returns error.
String (str) It represents alphanumeric characters and String hello world,
stores sequence of characters. a=“Hello” Alice, Bob123
It is used for the combination of any
character which appears on the keyboard
(letters, numbers, symbols).
In python string variables can be declared
either by single quotes or double quotes or
triple quotes.
Boolean It represents logical values. Bool b=false; TRUE, FALSE
(bool) It stores values in Boolean type only i.e. “true
(1)” or “false (0)”.
It is a subtype of integer data type.
Google was founded by Larry Page and Sergey Brin when they
were Ph.D. students at Stanford University in California.
68 DigiCode AI-VII

