File tree Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Expand file tree Collapse file tree 1 file changed +20
-20
lines changed Original file line number Diff line number Diff line change 1- configs = {
1+ config = {
22 "color" : "green" ,
33 "width" : 42 ,
44 "height" : 100 ,
55 "font" : "Courier" ,
66}
77
88# Access a value through its key
9- print (configs ["color" ])
9+ print (config ["color" ])
1010
1111# Update a value
12- configs ["font" ] = "Helvetica"
13- print (configs )
12+ config ["font" ] = "Helvetica"
13+ print (config )
1414
15- configs = {
15+ config = {
1616 "color" : "green" ,
1717 "width" : 42 ,
1818 "height" : 100 ,
1919 "font" : "Courier" ,
2020}
21- user_configs = {
21+ user_config = {
2222 "path" : "/home" ,
2323 "color" : "red" ,
2424 "font" : "Arial" ,
2525 "position" : (200 , 100 ),
2626}
27- configs .update (user_configs )
28- print (configs )
29- configs .update ([("width" , 200 ), ("api_key" , 1234 )])
30- print (configs )
31- configs .update (color = "yellow" , script = "__main__.py" )
32- print (configs )
27+ config .update (user_config )
28+ print (config )
29+ config .update ([("width" , 200 ), ("api_key" , 1234 )])
30+ print (config )
31+ config .update (color = "yellow" , script = "__main__.py" )
32+ print (config )
3333
34- default_configs = {
34+ default_config = {
3535 "color" : "green" ,
3636 "width" : 42 ,
3737 "height" : 100 ,
3838 "font" : "Courier" ,
3939}
40- user_configs = {
40+ user_config = {
4141 "path" : "/home" ,
4242 "color" : "red" ,
4343 "font" : "Arial" ,
4444 "position" : (200 , 100 ),
4545}
46- configs = default_configs | user_configs
47- print (configs )
46+ config = default_config | user_config
47+ print (config )
4848
49- configs = {
49+ config = {
5050 "color" : "green" ,
5151 "width" : 42 ,
5252 "height" : 100 ,
5353 "font" : "Courier" ,
5454}
55- user_configs = {
55+ user_config = {
5656 "path" : "/home" ,
5757 "color" : "red" ,
5858 "font" : "Arial" ,
5959 "position" : (200 , 100 ),
6060}
61- configs |= user_configs
62- print (configs )
61+ config |= user_config
62+ print (config )
You can’t perform that action at this time.
0 commit comments