Data Type (Python VS Java)
Data type used in Python:
int – Used for whole numbers (e.g. 1, 10, 100)
float – Used for decimal numbers (e.g 1.4, 2.5, 3.0)
str – Used for any textual data (e.g. ‘John, “Peter”,
“Male”)
You can use both single quote (‘john’) or double quote
(“john”)
Data type used in Java:
int – Used for whole numbers as well
float, double – Used for decimal numbers
In this course, for simplicity, we will always use double to
store decimal numbers.
String – Used for text data. Take note that only double
quotation is allowed (“john”)
char- Is also know as single character. Take note that only single quotation is allowed ('a')
No comments:
Post a Comment