Skip to content

Commit

Permalink
Merge branch 'canbula:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
m-turan authored Oct 28, 2023
2 parents 1004006 + 38f70e2 commit 683cafb
Show file tree
Hide file tree
Showing 71 changed files with 3,653 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/python-app-week-04.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# This workflow will install Python dependencies, run tests and lint with a single version of Python
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python

name: Week04 Homework

on:
push:
branches: [ "master" ]
paths: ['Week04/**']
pull_request:
branches: [ "master" ]
paths: ['Week04/**']

permissions:
contents: read

jobs:
build:

runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Set up Python 3.12
uses: actions/setup-python@v3
with:
python-version: "3.12"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install flake8 pytest
if [ -f requirements.txt ]; then pip install -r requirements.txt; fi
- name: Lint with flake8
run: |
# stop the build if there are Python syntax errors or undefined names
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
- name: Test with pytest
run: |
pytest -q --tb=no 'Week04/test_awaitme.py'
Binary file modified LectureNotes.pdf
Binary file not shown.
12 changes: 12 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
Repository for Parallel Programming course given by Assoc. Prof. Dr. Bora Canbula
at Computer Engineering Department of Manisa Celal Bayar University.

[![made-with-python](https://img.shields.io/badge/Made%20with-Python-1f425f.svg)](https://www.python.org/) [![MIT license](https://img.shields.io/badge/License-MIT-blue.svg)](https://lbesson.mit-license.org/) [![GitHub stars](https://badgen.net/github/stars/canbula/ParallelProgramming/)](https://github.com/canbula/ParallelProgramming/stargazers/) [![GitHub forks](https://badgen.net/github/forks/canbula/ParallelProgramming/)](https://github.com/canbula/ParallelProgramming/network/) [![GitHub contributors](https://img.shields.io/github/contributors/canbula/ParallelProgramming.svg)](https://github.com/canbula/ParallelProgramming/graphs/contributors/) [![GitHub total-pull-requests](https://badgen.net/github/prs/canbula/ParallelProgramming)](https://github.com/canbula/ParallelProgramming/pull/) [![GitHub pull-requests merged](https://badgen.net/github/merged-prs/canbula/ParallelProgramming)](https://github.com/canbula/ParallelProgramming/pulls?q=is%3Amerged)

# Course Information
This course is about parallel programming using Python. Students will learn the basic concepts
of parallel programming like threads, processes, and distributed systems. They will also learn
Expand All @@ -18,6 +20,16 @@ You can find the codes that written in the laboratory in the folder WeekXX.
In the root folder there is a LectureNotes.pdf file, which is updated weekly after every lecture.
At the end of the every chapter, you will also find a Problem Set.

# Homeworks
Students are requested to submit their homeworks to folders WeekXX, as defined in the LectureNotes.pdf.
The codes will be subject to certain GitHub action workflows to be tested automatically.

Variable Types and Sequences<br>[![Week02 Homework](https://github.com/canbula/ParallelProgramming/actions/workflows/python-app-week-02.yml/badge.svg?branch=master)](https://github.com/canbula/ParallelProgramming/actions/workflows/python-app-week-02.yml)

Functions and Decorators<br>[![Week03 Homework](https://github.com/canbula/ParallelProgramming/actions/workflows/python-app-week-03.yml/badge.svg)](https://github.com/canbula/ParallelProgramming/actions/workflows/python-app-week-03.yml)

Coroutines<br>[![Week04 Homework](https://github.com/canbula/ParallelProgramming/actions/workflows/python-app-week-04.yml/badge.svg)](https://github.com/canbula/ParallelProgramming/actions/workflows/python-app-week-04.yml)

# Codes and Videos from Previous Years
You can change the branch to see the codes from previous years. Also there is a YouTube playlist,
which includes the supplementary videos for the course as given in 2021. The videos do not include
Expand Down
Binary file added Week02/hw/.DS_Store
Binary file not shown.
23 changes: 23 additions & 0 deletions Week02/hw/sequences_berke_yildiz.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
my_list = ["A", "B", "C", "D", "A", "B"]
my_tuple = (1,4,10,3,6,9,2)
my_set = {"A", 2, "B", 3, "C"}
my_dict = {"A" : 3, "B" : 2, "C" : 1}

def remove_duplicates(my_list):
return list(set(my_list))

def list_counts(my_list):
the_list = list(my_list)
the_dict = {}

for item in the_list:
occurance = the_list.count(item)
the_dict[item] = occurance
return the_dict

def reverse_dict(my_dict):
the_dict = dict(my_dict)
new_dict = {}
for item in the_dict:
new_dict[the_dict[item]] = item
return new_dict
13 changes: 13 additions & 0 deletions Week02/hw/sequences_mert_kosa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
my_list= [1,2,3,4,5]
my_tuple= (1,2,3)
my_set= {1,2,3}
my_dict= {"one" : 1, "two" : 2, "three" : 3}

def remove_duplicates(my_list: list) -> list:
return list(set(my_list))

def list_counts(my_list: list)-> dict:
return {index: my_list.count(index) for index in set(my_list)}

def reverse_dict(my_dict: dict)-> dict:
return{item: key for key, item in my_dict.items() }
26 changes: 26 additions & 0 deletions Week02/hw/sequences_murat_turan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
my_list = [1,2,3,3,4,5,6]
my_tuple = (7,8,9)
my_set = {"","",""}
my_dict = {"name": "Murat" ,"surname": "Turan","age": 21}


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

return new_list

def list_counts(my_list):
counter = {}
for i in my_list:
if i in counter:
counter[i] +=1
else:
counter[i]=1
return counter


def reverse_dict(dictionary):
return {value: key for key, value in dictionary.items()}
13 changes: 13 additions & 0 deletions Week02/hw/sequences_sinem_gencer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
my_list = [1, "Wow", 2.1]
my_tuple = (1, "Wow", 2.1)
my_set = {1, "Wow", 2.1}
my_dict = {1:1, "Wow":"Wow", 2.1: 2.1}

def remove_duplicates(my_list):
return list(set(my_list))

def list_counts(my_list):
return {item: my_list.count(item) for item in my_list}

def reverse_dict(my_dict):
return {value: key for key, value in my_dict.items()}
4 changes: 4 additions & 0 deletions Week02/hw/types_ata_ceyhun_alaca.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 2
my_float = 3.4
my_bool = True
my_complex = 4 + 6j
4 changes: 4 additions & 0 deletions Week02/hw/types_efecan_erdem.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 10
my_float = 10.3
my_bool = False
my_complex = 10j
4 changes: 4 additions & 0 deletions Week02/hw/types_mert_kosa.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 1
my_float= 3.1
my_bool= True
my_complex= 2+4j
4 changes: 4 additions & 0 deletions Week02/hw/types_murat_turan.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int=4
my_float=0.04
my_bool=False
my_complex=3+5j
4 changes: 4 additions & 0 deletions Week02/hw/types_sinem_gencer.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 1
my_float = 1.0
my_bool = True
my_complex = 1 + 1j
14 changes: 14 additions & 0 deletions Week02/sequences_ata_ceyhun_alaca.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
my_list = [3, 6.7, 3, 8, 8, 55, 5, 34, 133, 345, 3456, 2, 5, 43, 2, 2, 1.2]
my_tuple = (3, 12, 65, 43, 12)
my_set = {"Formula1", "Formula2", "Formula3"}
my_dict = {"Day One": 1,"Day Two": 2, "Day Three": 3}


def remove_duplicates(my_list) -> list:
return list(set(my_list))

def list_counts(my_list) -> dict:
return {element_count: my_list.count(element_count) for element_count in set(my_list)}

def reverse_dict(my_dict) -> dict:
return {value: key for key, value in my_dict.items()}
33 changes: 33 additions & 0 deletions Week02/sequences_cem_berk_basyurt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
def remove_duplicates(seq):
unique_items = []
for item in seq:
if item not in unique_items:
unique_items.append(item)
return unique_items

def list_counts(seq):
item_counts = {}
for item in seq:
if item in item_counts:
item_counts[item] += 1
else:
item_counts[item] = 1
return item_counts

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

# Example Data
my_list = [2, 6, 8]
my_tuple = (4, 6, 9)
my_set = {3, 4, 5}
my_dict = {1: 4, 5: 7, 7: 5}

#Sample transactions
unique_list = remove_duplicates(my_list)
item_counts_dict = list_counts(my_list)
reversed_dict = reverse_dict(my_dict)

4 changes: 4 additions & 0 deletions Week02/types_cem_berk_basyurt.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
my_int = 26
my_float = 26.30
my_bool = False
my_complex = 4j
Loading

0 comments on commit 683cafb

Please sign in to comment.