|
Size: 1897
Comment:
|
Size: 2365
Comment:
|
| Deletions are marked like this. | Additions are marked like this. |
| Line 11: | Line 11: |
| {{{#!python for ...: print i |
{{{# |
| Line 23: | Line 20: |
| [[/Solution1A|Solution]] | Solution: |
| Line 26: | Line 23: |
| Line 28: | Line 24: |
| for ... in zip(range(0,4,1),range(4,0,-1)): print i,j |
for i in 4*range(4): print i |
| Line 31: | Line 27: |
| 0 4 1 3 2 2 3 1 }}} * Insert an expression in {{{...}}} to get the results. [[/Solution1B|Solution]] == c) == {{{ |
|
| Line 64: | Line 47: |
| [[/Solution1C|Solution]] | Solution: |
| Line 66: | Line 49: |
| = Data types = {{{ A=dict([('a',1),('b',2)]) }}} Please specify the data types: * A is a ... * 'a' is a ... * 1 is a ... * ('a',1) is a ... * [('a',1),('b',2)] is a ... Provide an alternative way to assign A |
|
| Line 92: | Line 92: |
| [[/Solution2A|Solution]] |
Solution: |
| Line 103: | Line 102: |
| [[/Solution2B|Solution]] | Solution: |
| Line 113: | Line 112: |
| * Display all values of {{{D}}} using the method {{{.values()}}} | |
| Line 117: | Line 117: |
| * Display all values of {{{D}}} using the method {{{.values()}}} | |
| Line 119: | Line 118: |
| [[/Solution3A|Solution]] | Solution: = Reading and practicing = Install python and ipython on your computer and read through the tutorial which comes with the documentation. There are translations in other languages: * [[http://wiki.python.org/moin/Languages/German?highlight=(CategoryLanguage)|German Language]] * [[http://starship.python.net/crew/gherman/publications/tut-de/online/tut/|Das Python-Tutorium (Version 1.5.2)]] * [[http://www.heise.de/ix/artikel/1999/11/184/|Beschränkung aufs Wesentliche (iX 11/1999)]] |
For loops
a)
{{{# 0 1 2 3 }}}
Insert an expression in ... to get the results.
Solution:
b)
- What are the corresponding loops?
Solution:
Data types
A=dict([('a',1),('b',2)])Please specify the data types:
- A is a ...
- 'a' is a ...
- 1 is a ...
- ('a',1) is a ...
- [('a',1),('b',2)] is a ...
Provide an alternative way to assign A
Scipy numeric types
from scipy import *
One byte consists of eight bit and covers the value range of 0..255 (uint8, unsigned integer) or -128..127.
a)
What is the value range of the following types and how many bytes are allocated in the memory?
- bool8
- uint8, int8
- uint16, int16
- uint32, int32
- uint64, uint64
Solution:
b)
How many bytes are allocated in the memory by these floating point types?
- float32, float64, float96
- complex64, complex128, complex192
Solution:
Data structures
a)
1 D={'A':array(range(10)),'B':array(range(10))+1}
Which keys contains the dictionary D
Get the keys with the method D.keys()
Display all values of D using the method .values()
Display array A
Display the elements 3:6 of arrays B
- Set this elements to 0
Insert a new key-values pair C:array(range(0,10,-1)) into D
Solution:
Reading and practicing
Install python and ipython on your computer and read through the tutorial which comes with the documentation. There are translations in other languages:
