Skip to content

Commit 9d7f346

Browse files
committed
Merge remote-tracking branch 'origin/main'
2 parents 2fd3e88 + 8c3971e commit 9d7f346

File tree

8 files changed

+88
-19
lines changed

8 files changed

+88
-19
lines changed

conditions.py renamed to code/example/conditions.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# if ... elif ... else
22
amount_hansueli = 1000
33

4+
45
def compare_amount(amount):
56
if amount < amount_hansueli:
67
print("Du bisch ja no ermer als de Hansueli")
@@ -9,9 +10,11 @@ def compare_amount(amount):
910
else:
1011
print("Du bisch richer als de Hansueli")
1112

13+
1214
# switch case
1315
compare_amount(10000000)
1416

17+
1518
def switch_color(color):
1619
match color:
1720
case 'red':
@@ -21,4 +24,4 @@ def switch_color(color):
2124
case 'green':
2225
return "wrong color"
2326
case 'magenta':
24-
return "right color"
27+
return "right color"
Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,33 @@
11
# Creating and calling Function
22

33
def my_function():
4-
print("Hello from "
5-
"a function")
4+
print("Hello from "
5+
"a function")
6+
67

78
my_function()
89

10+
911
# Arguments
1012
def my_function_with_arguments(first_name, last_name):
11-
print(first_name + " " + last_name)
13+
print(first_name + " " + last_name)
14+
1215

1316
my_function_with_arguments("Emil", "Refsnes")
1417

18+
1519
# Arbitrary Arguments, *args
1620
def my_function(*kids):
17-
print("The youngest child is " + kids[2])
21+
print("The youngest child is " + kids[2])
22+
1823

1924
my_function("Emil", "Tobias", "Linus")
2025

26+
2127
# Return Values
2228

2329
def my_function(x):
24-
return 5 * x
30+
return 5 * x
31+
2532

26-
print(my_function(3))
33+
print(my_function(3))

loops.py renamed to code/example/loops.py

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -20,25 +20,24 @@
2020
# The continue Statement
2121
fruits = ["apple", "banana", "cherry"]
2222
for x in fruits:
23-
if x == "banana":
24-
continue
25-
print(x)
23+
if x == "banana":
24+
continue
25+
print(x)
2626

2727
# Else in For Loop
2828
for x in range(6):
29-
print(x)
29+
print(x)
3030
else:
31-
print("Finally finished!")
31+
print("Finally finished!")
3232

3333
# THE range() FUNCTION
3434
for x in range(6):
35-
print(x)
35+
print(x)
3636

3737
# Using the start parameter:
3838
for x in range(2, 6):
39-
print(x)
39+
print(x)
4040

4141
# Increment the sequence with 3 (default is 1):
4242
for x in range(2, 30, 3):
43-
print(x)
44-
43+
print(x)

variables.py renamed to code/example/variables.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
#Legal variable names:
1+
# Legal variable names:
22
myvar = "John"
33
my_var = "John"
44
_my_var = "John"
55
myVar = "John"
66
MYVAR = "John"
77
myvar2 = "John"
88

9-
#Illegal variable names:
9+
# Illegal variable names:
1010
# 2myvar = "John"
1111
# my-var = "John"
1212
# my var = "John"
1313

14-
#Example
14+
# Example
1515
name = "deo40"
1616
price = 12.50
1717
availability = True

code/exercise/exercise_solutions.py

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
max_points = 30
2+
3+
4+
def show_possible_grades():
5+
print("possible grades")
6+
for x in range(1, 7):
7+
print("\t", x)
8+
9+
10+
def calculate_grade(points):
11+
if points > max_points:
12+
print("the points can't be above the max_points of ", max_points)
13+
return
14+
your_grade = points / max_points * 5 + 1
15+
print("\nyour grade is: ", your_grade)
16+
if your_grade >= 4:
17+
print("well done")
18+
else:
19+
print("please learn more")
20+
21+
22+
show_possible_grades()
23+
calculate_grade(30)

docs/README_EXERCISE.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#Exercise
2+
To practise the topics from the presentation you have now the time to create your own little python project. <br/>
3+
Please create a little grade calculator. This calculator should have a variable with the maximum points. <br/>
4+
Also implement two methods <br/>
5+
- One function should output the possible grades (1, 2, 3...) using the range function
6+
- The other function (signature: calculate_grade(points)) should calculate (points / max_points * 5 + 1) the grade and print it with a little comment relating to the grade. Of course, the user isn't allowed to set the points above the max points

docs/README_PLANNING.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
#Python
2+
3+
##Planning
4+
5+
| Steps | Time | Task | Type | Resources |
6+
|----------|------|-----------------------------------------------------------|--------------|---------------------------------|
7+
| Question | 5' | - What is Python? <br/> - What do you already know about it? <br/> - Who had already programmed python | Plenum | Whiteboard |
8+
| Content | 10' | - Python's syntax <br/> - Concepts <br/> | Presentation | - PowerPoint <br/> - Code |
9+
| Training | 10' | Implement a grade calculator | Individual | - PC <br/> - Text editor |
10+
| Test | 5' | Kahoot test | Plenum | Kahoot |

docs/README_PROTOCOL.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
#Python
2+
3+
##Protocol
4+
5+
6+
| task | person | description | includes task |
7+
|-------------------|-------------------|---------------------------------------------------------------------------------------------------------|----------------------------|
8+
| Planing | Luca, Leo, Ian | Discussing what we want to talk about in our presentation <br> and how we want to explain and display it. | Research, Inputs |
9+
| Powerpoint | Luca, Leo, Ian | Creating and styling all the pages of the presentation | Research, Inputs, Feedback |
10+
| Code Files | Luca, Leo, Ian | Writing code to visualize the theory and shot that the code does actually work | Research, Inputs, Feedback |
11+
| Kahoot | Leo | Creating a Kahoot with questions referring to the presentation <br> in purpose to test the knowledge | Feedback |
12+
| Exercise | Ian | Create and write a exercise for the class to practise | Inputs, Feedback |
13+
| Research | Luca, Ian | Searching all types of information for the presentation | |
14+
| Inputs | Luca, Leo, Ian | Give your opinion referring to a topic or answer question during the process | |
15+
| Documentation | Ian | Create the Protocol and documenting what we've done | |
16+
| Feedback | Luca, Leo, Ian | Give feedback after reviewing finished topics | |
17+
18+
19+
Most of the time we've been working together. To be more precise, one of us wrote the code or styled the PowerPoint and
20+
the others gave instant feedback, disguised what should be displayed on the slide and done some research on different topics.
21+
Mostly Leo has written the text or styled the slides and Luca and Ian helped him with ideas, suggestions or facts from their research.

0 commit comments

Comments
 (0)