Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

umutcan homework02 types and sequences #140

Merged
merged 7 commits into from
Oct 17, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 38 additions & 0 deletions Week02/hw/sequences_umutcan_turk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
my_list = ["keyboard","mouse","laptop","mousepad","headset","mouse"]
my_tuple = ("2", "Hyundai",5.4,"Umut")
my_set = {"C#","C#","JAVA","JAVASCRIPT","PHP"}
my_dict = {
"keyboard": 150,
"mouse": 100,
"laptop": 20000,
"mousepad":20,
"headset":120
}

def remove_duplicates(list):
new_list = []
for key in my_list:
if key not in new_list:
new_list.append(key)
return new_list

print(remove_duplicates(my_list))

def list_counts(list):
counts_dict = {}
for item in list:
if counts_dict.get(item):
counts_dict[item] += 1
else:
counts_dict[item] = 1
return counts_dict

print(list_counts(my_list))

def reverse_dictionary(my_dict):
reversed_dict = {}
for key, value in my_dict.items():
reversed_dict[value] = key
return reversed_dict

print(reverse_dictionary(my_dict))
4 changes: 4 additions & 0 deletions Week02/hw/types_umutcan_turk.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 28
my_float = 13.6
my_bool = True
my_complex = 1 + 5j