-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy path4.tuple.py
More file actions
75 lines (52 loc) · 2.3 KB
/
4.tuple.py
File metadata and controls
75 lines (52 loc) · 2.3 KB
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# मेरे Youtube चैनल को सबस्क्राइब करना ना भूलो ताकि आपको कोड का पूरा फ़्लो समझमे आए - https://www.youtube.com/channel/UCphs2JfmIClR62wbyf76HDg
# कोई भी सवाल है उसको मेरे यूट्यूब चैनल के कमेन्ट या डिस्कशन सेक्शन मे पूछ सकते हो - https://www.youtube.com/channel/UCphs2JfmIClR62wbyf76HDg/discussion
# और हाँ GitHub पर मुझे फॉलो करना ना भूलो ताकि सारे अपडेट एण्ड वर्क आपको मिलता रहे।
'''
Tuple
1. tuple ki values non-changeable hoti hai
2. immutable
3. tuple syntax = ()
4. tuple andar bhi values index fke form me hoti hai
'''
newtuple = ('Ram','Shyam','Geeta','Seeta')
# chekc datatype
print('\n\nnewtupels dataype: ',type(newtuple))
# tuple me agar single value hai then value ke baad ek comma use karna jaruru hi
checktupe = ('Hello',)
print(type(checktupe))
# range of tuple
print('newtuple[0]: ',newtuple[0])
print('start and end: ',newtuple[0:3]) # 3-1
# try to modify tuple value
# newtuple[0] = 'Shree Ram'
# len
print('count tupe: ',len(newtuple))
# remove ke liye del
# del newtuple
# join or concatanation +
secondtuple = ('Hari','Ravi','Sona')
addtuple = newtuple + secondtuple
print('\naddtuple: ',addtuple)
# convert tupel into list
tuple2list = list(newtuple)
print('tupel2list type: ',type(tuple2list))
tuple2list.append('Arjun')
tuple2list.append('Bheem')
tuple2list.append('Nakul')
# convert list 2 tuple
newtuple = tuple(tuple2list)
# print('list2tuple: ',list2tuple)
# tuple vlaue
print('TUple values newtupel: ',newtuple)
'''
Questions:
1. what is static variable in programming language.
2. what is constant in programming language.
3. Differnce b/w static and constant
'''
'''
programms
1. tuple me friends ke name save karne hai and unko index postion se multiline string ka use karke output show karana hai.
2. tuple negative values to output me show karke dekho
3. 1st cast ke friend list ka use karna hai aur uske andar kuch firends ko hata kar new firends ke name add karne hai. complet list ko multiline string ka use karke show karan ahi.
'''