Last active
December 31, 2015 13:49
-
-
Save fnurl/7995368 to your computer and use it in GitHub Desktop.
Pythonlektion 3b HT2013
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Referensövning | |
def ref_test1(): | |
a = [1, 2, 3] | |
b = a | |
a.append(4) | |
# Vad skriver nedanstående rader ut? Varför? | |
print(a) | |
print(b) | |
def ref_test2(): | |
a = 5 | |
b = a | |
a = a + 5 | |
# Vad skriver nedanstående rader ut? Varför? | |
print(a) | |
print(b) | |
def ref_test3(): | |
a = "hej" | |
b = a | |
a += "san" | |
# Vad skriver nedanstående rader ut? Varför? | |
print(a) | |
print(b) | |
def ref_test4(): | |
a = {"hej": "hello", "hej då": "good bye"} | |
b = a | |
a["hej"] = "szia" | |
a["hej då"] = "viszlát" | |
# Vad skriver nedanstående rader ut? Varför? | |
print(a) | |
print(b) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment