This video belongs to the openHPI course Programmieren lernen mit Python. Do you want to see more?
An error occurred while loading the video player, or it takes a long time to initialize. You can try clearing your browser cache. Please try again later and contact the helpdesk if the problem persists.
Scroll to current position
- 00:00Hello, everyone.
- 00:01So far we know which branch of a branch is executed, because we assign fixed values to the variable.
- 00:08But so that you do not know which branch is being executed, but something else may happen every time you run it, we're gonna show you how it's done.
- 00:16First of all, we want to determine the age from one of our campers.
- 00:21For this purpose, a value is assigned to the variable alter in the data file.
- 00:25We can then easily create this with the from data import age, which you can see in line 1 into our own program.
- 00:33Now we can simply use the variable, without getting a NameError in it.
- 00:38For example, if we say print alter, we get issue 13, because the value was previously assigned to this variable in the data file.
- 00:48If we run the program again now, for example, we can get the 7, which is a different value than before.
- 00:54Just like you import the variable alter here, you can also import other variables, which we will then give you in the assignment.
- 01:02Why don't you try it out on the next task?
To enable the transcript, please select a language in the video player settings menu.