From 06f7df89df41f3b53422bf146cfd4d99a9eff0e3 Mon Sep 17 00:00:00 2001 From: ksushaQA2014 Date: Mon, 20 Jul 2020 23:06:47 +0300 Subject: [PATCH 1/3] My first commi --- python_dict.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/python_dict.py b/python_dict.py index 7fbc7fc..2733ffd 100644 --- a/python_dict.py +++ b/python_dict.py @@ -1,3 +1,6 @@ + + + """ 1. Sum Values Write a function named sum_values that takes a dictionary named my_dictionary as a parameter. From 1bf7c467494282a40e8af603beb6c9468bfbe152 Mon Sep 17 00:00:00 2001 From: ksushaQA2014 <67373274+ksushaQA2014@users.noreply.github.com> Date: Tue, 21 Jul 2020 11:44:40 +0300 Subject: [PATCH 2/3] Update python_dict.py --- python_dict.py | 36 +++++++++++++++++++++--------------- 1 file changed, 21 insertions(+), 15 deletions(-) diff --git a/python_dict.py b/python_dict.py index 2733ffd..38f401e 100644 --- a/python_dict.py +++ b/python_dict.py @@ -6,13 +6,13 @@ Write a function named sum_values that takes a dictionary named my_dictionary as a parameter. The function should return the sum of the values of the dictionary """ -# Write your sum_values function here: - -# Uncomment these function calls to test your sum_values function: -# print(sum_values({"milk":5, "eggs":2, "flour": 3})) -# should print 10 -# print(sum_values({10:1, 100:2, 1000:3})) -# should print 6 +def sum_values(my_dictionary): + sum_dict = 0 + for value in my_dictionary.values(): + sum_dict = sum_dict + value + return sum_dict +print(sum_values({"milk":5, "eggs":2, "flour": 3})) +print(sum_values({10:1, 100:2, 1000:3})) """ @@ -22,12 +22,16 @@ """ -# Write your sum_even_keys function here: +def sum_even_keys(my_dictionary): + even_keys = 0 + for key, values in my_dictionary.items(): + if key % 2 == 0: + even_keys += values + return even_keys -# Uncomment these function calls to test your function: -# print(sum_even_keys({1:5, 2:2, 3:3})) +print(sum_even_keys({1:5, 2:2, 3:3})) # should print 2 -# print(sum_even_keys({10:1, 100:2, 1000:3})) +print(sum_even_keys({10:1, 100:2, 1000:3})) # should print 6 @@ -36,12 +40,14 @@ Create a function named add_ten that takes a dictionary with integer values named my_dictionary as a parameter. The function should add 10 to every value in my_dictionary and return my_dictionary """ -# Write your add_ten function here: +def add_ten(my_dictionary): + for values in my_dictionary.keys(): + my_dictionary[values] = my_dictionary[values] + 10 + return my_dictionary -# Uncomment these function calls to test your function: -# print(add_ten({1:5, 2:2, 3:3})) +print(add_ten({1:5, 2:2, 3:3})) # should print {1:15, 2:12, 3:13} -# print(add_ten({10:1, 100:2, 1000:3})) +print(add_ten({10:1, 100:2, 1000:3})) # should print {10:11, 100:12, 1000:13} From da7cab7ced45491c14128e30812a2c21388e32fb Mon Sep 17 00:00:00 2001 From: ksushaQA2014 Date: Tue, 21 Jul 2020 13:39:04 +0300 Subject: [PATCH 3/3] Gryshyna Oksana Dictionaries --- python_dict.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/python_dict.py b/python_dict.py index 38f401e..3a384bc 100644 --- a/python_dict.py +++ b/python_dict.py @@ -57,7 +57,7 @@ def add_ten(my_dictionary): This function should return a list of all values in the dictionary that are also keys. """ # Write your values_that_are_keys function here: - +aaa # Uncomment these function calls to test your function: # print(values_that_are_keys({1:100, 2:1, 3:4, 4:10})) # should print [1, 4]