Skip to content

Instantly share code, notes, and snippets.

@fnurl
Last active December 31, 2015 13:49
Show Gist options
  • Save fnurl/7995368 to your computer and use it in GitHub Desktop.
Save fnurl/7995368 to your computer and use it in GitHub Desktop.
Pythonlektion 3b HT2013
# 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