| 
  
   Size: 2352 
  
  Comment:  
 | 
  
   Size: 2727 
  
  Comment:  
 | 
| Deletions are marked like this. | Additions are marked like this. | 
| Line 5: | Line 5: | 
| = For loops = == a) == {{{ #!python  | 
|
| Line 6: | Line 10: | 
| for i in range(0,4,1): print i  | 
|
| Line 7: | Line 13: | 
| = For loops = == a) == {{{#!python for ...: print i  | 
|
| Line 16: | Line 14: | 
| 1 | 1 | 
| Line 20: | Line 18: | 
| Line 44: | Line 41: | 
| Line 49: | Line 45: | 
| In [51]: a='0' In [52]: b='1' In [53]: 4*a+4*b Out[53]: '00001111' ----- In [44]: a=0,1,2,3 In [45]: a*4 Out[45]: (0,1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0) Second Solution (in einer Schleife): a = [range(0,4)] for item in a:<br> b = item * 4 <br> b.sort()<br> c = item * 4<br> d = [b,c]<br> print d <br>  | 
|
| Line 50: | Line 72: | 
| Line 54: | Line 75: | 
| Line 57: | Line 77: | 
| Line 65: | Line 84: | 
| Line 68: | Line 86: | 
| Line 71: | Line 88: | 
| One byte consists of eight bit and covers the value range of 0..255 ({{{uint8}}}, unsigned integer)  or -128..127.  | 
One byte consists of eight bit and covers the value range of 0..255 ({{{uint8}}}, unsigned integer) or -128..127. | 
| Line 74: | Line 90: | 
| {{{#!python | {{{ #!python  | 
| Line 81: | Line 99: | 
| Line 83: | Line 100: | 
| Line 94: | Line 110: | 
| Line 96: | Line 111: | 
| Line 106: | Line 120: | 
| {{{#!python | {{{ #!python  | 
| Line 109: | Line 125: | 
| Line 114: | Line 129: | 
| * Display the elements {{{3:6}}} of arrays {{{B}}} | * Display the elements {{{3:6}}} of arrays {{{B}}} | 
| Line 116: | Line 131: | 
| * Insert a new key-values pair {{{C:array(range(0,10,-1))}}} into {{{D}}} | * Insert a new key-values pair {{{C:array(range(0,10,-1))}}} into {{{D}}} | 
| Line 120: | Line 135: | 
| = 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:  | 
|
| Line 121: | Line 138: | 
| = 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:  | 
For loops
a)
Insert an expression in ... to get the results.
Solution:
b)
0 0 0 1 0 2 0 3 1 0 1 1 1 2 1 3 2 0 2 1 2 2 2 3 3 0 3 1 3 2 3 3
- What are the corresponding loops?
 
Solution:
In [51]: a='0' In [52]: b='1' In [53]: 4*a+4*b
Out[53]: '00001111'
In [44]: a=0,1,2,3
In [45]: a*4
Out[45]: (0,1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0, 1, 2, 3, 0)
Second Solution (in einer Schleife):
a = [range(0,4)]
for item in a:<br>
b = item * 4 <br> b.sort()<br> c = item * 4<br> d = [b,c]<br> print d <br>
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:
