-
Notifications
You must be signed in to change notification settings - Fork 0
/
hello.py
45 lines (34 loc) · 909 Bytes
/
hello.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
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
greetings = "Hello-World This is my first time writing python"
print(greetings)
#Types in python
type (1) #This prints out the type int
type(4) #This prints out the type int
type(0) #This prints out the type int
type("Heloo") #This prints out the type str
float(4) #This prints out the type int
#Checking the type of conversion
type(float(4))
#This brings an output of float because the no.4 is converted to a float
#Converting from strings to integers or floats
int('1')
float('2.1')
#Converting numbers to strings
str(1)
str(2.3)
#This prints '1' and '2.3' because the number is being converted to strings
#Boolean data types
#These are True / False
#Checking the type of True and False
type(True)
type(False)
#convert float and integer to a string
str(1)
str(4.5)
#Convert true to an int
int(True)
#convert 1 to boolean
bool(1)
#convert 0 to boolean
bool(0)
#convert true to float
float(True)