-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathData-type.py
28 lines (25 loc) · 1.34 KB
/
Data-type.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# What are data types?
#---------------------------------------------
# Data types are ways in which data are represented in computer.
# It represents the kind of value that tells what operations can be performed on a particular data.
# In Python, every value has a data type.
#---------------------------------------------
#Types of data types in Python
#---------------------------------------------
#1.Integer they are whole number which are either negative or positive number.
#2.Float they are represented in decimal or fractional value example are 1.5, 2/5, 20.5 etc.
#3.String they are sequesnce of characters, numbersa and symbols usually in double coat e.g "Hello Nii", "2024-07-14"
#4.Boolean/Bool they are denoted in form of true or false, yes or no, on or off statement.
#5. Character / Char they are denoted by single letter/characters, numbers or symbols and usually in sungle coat 'A', '1', '#'
#
#---------------------------------------------
# What is Casting
#----------------------------------------------
#Data can be converted from one data types to another. This process of data convertion from one data type to another is known as Casting.
#for example
#
# you are to convert x from string data type to integer
# x="5"
#print(int(x))
#From the above exanple you can see thet x was converted from strinf or character data type to integer.
#