A data type in programming
is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error.
integer
is a data type that is used to classify text and an integer is a data type used to classify whole numbers.
example : 7, 12, 999
code : result:4*78
string
Alphanumeric characters
example: hello world, Alice, Bob123
code: address = "bandar seri begawan 26"
Decimal
number with decimal
code: price:1.50
Boolean
Representing logical values
example: true, false, yes, no
code: x=2 , y=12
float
Number with a decimal point but longer
example:3.15, 9.06, 00.13
code:
List
The list data type is an not in ordered collection type that stores unique elements. The number of elements in a list data type can vary, but no nulls are allowed.
code = list1 [1,2,3,'a','b'];
#print ("hello World")
myvar = 1
print (myvar)
#string data type
fruit = "apple"
print (fruit)
#decimal data type
price = 1.50
print (price)
#list data type
list1 = [1,2,3,'a','b'];
print (list1)
print ("list1")
#show a only
print (list1[3])
a= 1
b = 5
c = a + b
print (c)
d= 4
e= d + a
print (e)
is a classification that specifies which type of value a variable has and what type of mathematical, relational or logical operations can be applied to it without causing an error.
integer
is a data type that is used to classify text and an integer is a data type used to classify whole numbers.
example : 7, 12, 999
code : result:4*78
string
Alphanumeric characters
example: hello world, Alice, Bob123
code: address = "bandar seri begawan 26"
Decimal
number with decimal
code: price:1.50
Boolean
Representing logical values
example: true, false, yes, no
code: x=2 , y=12
float
Number with a decimal point but longer
example:3.15, 9.06, 00.13
code:
List
The list data type is an not in ordered collection type that stores unique elements. The number of elements in a list data type can vary, but no nulls are allowed.
code = list1 [1,2,3,'a','b'];
CREATE TABLE employee
(
name char(30),
address char(40),
children SET (varchar(30) NOT NULL)
);
#print ("hello World")
myvar = 1
print (myvar)
#string data type
fruit = "apple"
print (fruit)
#decimal data type
price = 1.50
print (price)
#list data type
list1 = [1,2,3,'a','b'];
print (list1)
print ("list1")
#show a only
print (list1[3])
a= 1
b = 5
c = a + b
print (c)
d= 4
e= d + a
print (e)
1
apple
1.5
[1, 2, 3, 'a', 'b']
list1
a
6
5
Comments
Post a Comment