Differences between revisions 4 and 8 (spanning 4 versions)
Revision 4 as of 2013-08-30 14:46:57
Size: 270
Editor: hassan
Comment:
Revision 8 as of 2013-08-30 16:23:51
Size: 1213
Editor: hassan
Comment:
Deletions are marked like this. Additions are marked like this.
Line 5: Line 5:
Before staring with the exercises, have a look at the python tutorial, [[ScrumPy/Doc/Tutorial/PyIntro | here]]. Before staring with the exercises, have a look at the python tutorial, [[ScrumPy/Doc/Tutorial/PyIntro | here]]. 
Line 7: Line 7:
'''(a)''' Start a !ScrumPy session, and make the following assignments:

{{{#!python
>>> num_type_1 = 8
>>> num_type_2 = 9.0
>>> str_type = 'a'
}}}

What do you think the ''value'' and ''type'' of the following expressions are?

{{{
num_type_1/2
num_type_1/2.0
num_type_2/3
5 + 2*10
str_type*4
}}}

Control your answers using Python. Any deviations from expected? Why?


'''(b)''' Create a list with six items, e.g.:
{{{#!python
>>> test_list= ['a', 'b', 'c', 'd', 'e', 'f']
}}}

Make another list (''reversed_list'') that is a copy of the first, e.g.:
{{{#!python
>>> reversed_list=test_list[:]
}}}

(why will this assignment result in a copy of ''test_list''? Hint: this is a ''slicing'' operation.)

Now, reverse the order of the items in ''reversed_list'' by repeating the following assignment with suitable choice of ''n'' and ''m'':

{{{#!python
>>> reversed_list[n]=test_list[m]
}}}

'''(c)'''

Practical 1

Part 1 - Exploring Python

Before staring with the exercises, have a look at the python tutorial, here.

(a) Start a ScrumPy session, and make the following assignments:

   1 >>> num_type_1 = 8
   2 >>> num_type_2 = 9.0
   3 >>> str_type = 'a'

What do you think the value and type of the following expressions are?

num_type_1/2
num_type_1/2.0
num_type_2/3
5 + 2*10
str_type*4

Control your answers using Python. Any deviations from expected? Why?

(b) Create a list with six items, e.g.:

   1 >>> test_list= ['a', 'b', 'c', 'd', 'e', 'f']

Make another list (reversed_list) that is a copy of the first, e.g.:

   1 >>> reversed_list=test_list[:]

(why will this assignment result in a copy of test_list? Hint: this is a slicing operation.)

Now, reverse the order of the items in reversed_list by repeating the following assignment with suitable choice of n and m:

   1 >>> reversed_list[n]=test_list[m]

(c)

Part 2 - Creating Models

Part 3 - The Stoichiometry Matrix and Null-space

None: AccliPhot/WorkshopOne/prac1 (last edited 2014-12-16 12:30:53 by david)