-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathPyNotes.txt
55 lines (39 loc) · 1.03 KB
/
PyNotes.txt
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
46
47
48
49
50
51
52
53
54
55
//Lets Learn Python
DATATYPES OF Python
===================
Text: str
Numeric: int, float, complex
Sequence: list, tuple , range
Mapping: dict
Set: set, frozenset
boolean: bool
binary: bytes, bytearray, memoryview
x = float(20.4)
print(x)
#list[] , tuple(), set{}, dict{string int}, frozenset({})
a = list(("apple", "banannann", "orange"))
print(a)
b = tuple(("apple","banana"))
print(b)
c = set (("apple", "banana"))
print(c)
d = frozenset(("apple", "banana"))
print(d)
e = dict(name = "Ayush", age = 19)
print(e)
#CASTING: Specify a Type on a Variable
======================================
a = int(2) #int
b = int("4") #string
c = int(5.3) #float
print(a,b,c)
d = str(3)
e = str(4.3)
f = str("6")
print(d, e, f)
#String is a Array of Chracters. [] can be used to access elements of String Array
#Char is just a String of Size 1
print(a[3])
#Looping Throught the LETTERS in WORD ==> Vertical Printing of Letters of Word
for x in "BANANANANANANA":
print(x)