slides
slides
slides
You also want an ePaper? Increase the reach of your titles
YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.
1 #!/usr/bin/python<br />
2<br />
3 Dictionary={<br />
4 "red":[1.0,0.0,0.0],<br />
5 "green":[0.0,1.0,0.0],<br />
6 "blue":[0.0,0.0,1.0],<br />
7 "white":[1.0,1.0,1.0],<br />
8 "black":[0.0,0.0,0.0]<br />
9 }<br />
10<br />
11 print Dictionary.get("red")<br />
12 print Dictionary.get("white")<br />
13 print Dictionary.get("purple")<br />
Create a dictionary of<br />
colour lists<br />
“key”:[r,g,b]<br />
Use the .get(“key”)<br />
method to find the<br />
value<br />
1 [1.0, 0.0, 0.0]<br />
2 [1.0, 1.0, 1.0]<br />
3 None<br />
note “None” returned<br />
if “key” not found<br />
Saturday, 23 October 2010