pc
authorNilsForssen <forssennils@gmail.com>
Mon, 7 Feb 2022 08:18:48 +0000 (09:18 +0100)
committerNilsForssen <forssennils@gmail.com>
Mon, 7 Feb 2022 08:18:48 +0000 (09:18 +0100)
laboration3/uppgift_1.py
uppgift_1.txt [new file with mode: 0644]

index 345b74042c998dcaa91cc685789abbf6e844a141..0c0b92073671714fa8458db66cf17c3c38f37673 100644 (file)
@@ -21,8 +21,8 @@ def increment_dictionary_value1(key, d):
     d[key] += 1
 
 
-def increment_dictionary_value2(key, value, d):
-    if key not in value:
+def increment_dictionary_value2(key, d):
+    if key not in d:
         d[key] = 1
     else:
         d[key] += 1
@@ -41,9 +41,10 @@ def return_value_list1(prefix, d):
 
 
 def value_exists2(value, d):
-    for d in d.values:
-        if "__contains__" in dir(d):
-            if value in d:
-                return True
-    else:
-        return False
+    for v in d.values():
+        if v == value:
+            return True
+        elif isinstance(v, list) and value in v:
+            return True
+        
+    return False
\ No newline at end of file
diff --git a/uppgift_1.txt b/uppgift_1.txt
new file mode 100644 (file)
index 0000000..0f75ecc
--- /dev/null
@@ -0,0 +1,21 @@
+UEsDBBQAAAAIAEdKR1REFzSfLgEAAFYDAAAaABwAbmlsZm8zNTktcHl1cHBnM18xL29yaWcucHlV
+VAkAA8bVAGLG1QBidXgLAAEEehxpWQQA4fUFhVJNb4MwDL3zKyztAlpViR4rcd0v2E6oQhExU9TU
+oCSl5d/P+eiAdms5BdvvPfvZb/A1DN+qc1BmmcQOjjg1eFXW2ZyfG5DFPgP+DLqzIZ8GRSCzWD0K
+fcZUX+bh7wESogG0DU+bFwktpGxc30jVuih2RyBrjh6givEFiPDS9KSnp2gVhgHqXRCPwX9pFbUG
+T0guEKqehJmaUFCujUjo98o79gK6W0Nfd1SGEGqLD8mFYPItmq/Z+/KJfVsxDEgyLufmfFzNimEw
+2KnrjHbcZQX1Ifx0vYEjC8Q1Kocn3uLcoh+s3mukxFLwLBXE91yVWH8bKpZXwok/bmp3f1O+kXF9
+TKs2Ri8cMm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