Skip to content

Commit 26dff43

Browse files
Create dict_using_some_new_technique.py
1 parent eb1422d commit 26dff43

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed

dict_using_some_new_technique.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
valuse = ('a1', 'b2', 'c3')
2+
3+
print(dict(valuse))
4+
5+
# Answer: {'a': '1', 'b': '2', 'c': '3'}
6+
7+
valuse = ('a1', 'b2', 'c') # if 1 charecter is missing
8+
9+
print(dict(valuse))
10+
11+
# Answer: ERROR!
12+
# ValueError: dictionary update sequence element #2 has length 1; 2 is required
13+
14+
#--------------------------------------------------------------------------------------
15+
16+
# It's actually return a tuples
17+
18+
# valuse = ('a1', 'b2', 'c3')
19+
# (('a': '1'), ('b': '2'), ('c': '3'))
20+
# print(dict(valuse))

0 commit comments

Comments
 (0)