-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathexe1.2.py
30 lines (25 loc) · 969 Bytes
/
exe1.2.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Sun Jan 9 15:15:45 2022
@author: jolien
"""
############################ Exercise 1.2 ####################################
#1. Describe, in your own words, the difference between mutable and immutable
#data types.
#mutable data: alte werte einer variablen werden mit einer neuen variablen mit neuen werte überschrieben
#immutible data: sind unveränderliche ob jekte
#2. Consider the following code:
a = 12345
b = a
c = 12345
#Try to predict the expected output of each line below and check whether
#you were right
a == b #true
a is b#true
a == c#true
a is c#false weil c auf anderer position in speicher, andere id
#Now explain the output of the following lines of code (somewhat comprehensively)
#3. Compare the functions and methods that were applied to lists and tuples.
#What can be done with lists that cannot be done with tuples?
#lists werte sind veränderbar durch verschiedene funktionen