Hide keyboard shortcuts

Hot-keys on this page

r m x p   toggle line displays

j k   next/prev highlighted chunk

0   (zero) top of page

1   (one) first highlighted chunk

1 

2class Person: 

3 def __init__(self, name, alter): 

4 self.name = name 

5 self.alter = alter 

6 

7 def altern(self, jahre): 

8 if jahre >= 0: 8 ↛ 11line 8 didn't jump to line 11, because the condition on line 8 was never false

9 self.alter += jahre 

10 else: 

11 raise ValueError("Keine negativen Werte erlaubt") 

12 

13def test_person(): 

14 p = Person("Hans", 18) 

15 p.altern(1) 

16 assert p.alter == 19 

17 

18test_person()