Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
apt_exercises
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Mohammed Ahmed
apt_exercises
Compare revisions
master to a82ad08d68b99b220203c9021891514dafc02335
Compare revisions
Changes are shown as if the
source
revision was being merged into the
target
revision.
Learn more about comparing revisions.
Source
ma18960/apt_exercises
Select target project
No results found
a82ad08d68b99b220203c9021891514dafc02335
Select Git revision
Branches
ma18960-master-patch-58670
master
Swap
Target
afischer/apt_exercises
Select target project
ll21215/apt_exercises
hb09106/apt_exercises
afischer/apt_exercises
sm27496/apt2020
ia19390/apt_exercises
pk02862/apt_exercises
cd28198/apt_exercises
ma05240/apt_exercises
jp01114/apt_exercises
mf19908/apt_exercises
an25923/apt_exercises
ma18960/apt_exercises
fa30968/apt_exercises
jg08184/apt_exercises
gs27324/apt_exercises
ss18986/apt_exercises
16 results
master
Select Git revision
Branches
master
Show changes
Only incoming changes from source
Include changes to target since source was created
Compare
Commits on Source (5)
Update html_writer.py
· feb8cef7
Mohammed Ahmed
authored
3 years ago
feb8cef7
Update test.csv
· b5d7132a
Mohammed Ahmed
authored
3 years ago
b5d7132a
Update bintree.py
· eaee0d00
Mohammed Ahmed
authored
3 years ago
eaee0d00
Update bintree.py
· 0efa61ba
Mohammed Ahmed
authored
3 years ago
0efa61ba
Update bintree.py
· a82ad08d
Mohammed Ahmed
authored
3 years ago
a82ad08d
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
Programming_Paradigms/bintree.py
+42
-0
42 additions, 0 deletions
Programming_Paradigms/bintree.py
Programming_with_Python/html_writer.py
+14
-5
14 additions, 5 deletions
Programming_with_Python/html_writer.py
Programming_with_Python/test.csv
+1
-0
1 addition, 0 deletions
Programming_with_Python/test.csv
with
57 additions
and
5 deletions
Programming_Paradigms/bintree.py
View file @
a82ad08d
#!/usr/bin/env python3
# *-* coding:utf-8 *-*
class
Node
:
def
__init__
(
self
,
data
=
None
):
self
.
data
=
data
self
.
left
=
None
self
.
right
=
None
class
BST
:
def
__init__
(
self
):
self
.
root
=
None
def
insert
(
self
,
data
):
if
self
.
root
is
None
:
self
.
root
=
Node
(
data
)
else
:
self
.
_insert
(
data
,
self
.
root
)
def
_insert
(
self
,
data
,
cur_node
):
if
data
<
cur_node
.
data
:
if
cur_node
.
left
is
None
:
cur_node
.
left
=
Node
(
data
)
else
:
self
.
_insert
(
data
,
cur_node
.
left
)
elif
data
>
cur_node
.
data
:
if
cur_node
.
right
is
None
:
cur_node
.
right
=
Node
(
data
)
else
:
self
.
_insert
(
data
,
cur_node
.
right
)
else
:
print
(
"
value is already in the tree
"
)
def
find
(
self
,
data
):
if
self
.
root
:
is_found
=
self
.
find
(
data
,
self
.
root
)
if
is_found
:
return
True
return
False
else
:
return
None
def
_find
(
self
,
data
,
cur_node
):
if
data
>
cur_node
.
data
and
cur_node
.
right
:
return
self
.
_find
(
data
,
cur_node
.
right
)
elif
data
<
cur_node
.
data
and
cur_node
.
left
:
return
self
.
_find
(
data
,
cur_node
.
left
)
if
data
==
cur_node
.
data
:
return
True
if
__name__
==
"
__main__
"
:
pass
This diff is collapsed.
Click to expand it.
Programming_with_Python/html_writer.py
View file @
a82ad08d
...
...
@@ -20,8 +20,10 @@ def read_csv(filename):
result
=
[]
with
open
(
filename
)
as
csvfile
:
### EDIT BELOW HERE ###
row
=
[]
reader
=
csv
.
reader
(
csvfile
,
delimiter
=
"
;
"
)
pass
for
row
in
reader
:
result
.
append
(
row
)
### EDIT ABOVE HERE ###
return
result
...
...
@@ -38,10 +40,11 @@ def csv_to_html(csvdata):
"""
htmlstring
=
""
### EDIT BELOW HERE ###
htmlline
=
"
<tr><td>{}</td><td>{}</td><td>{}</td></tr>
\n
"
pass
big_list
=
read_csv
(
'
test.csv
'
)
for
row
in
big_list
:
htmlline
=
"
<tr><td>{}</td><td>{}</td><td>{}</td></tr>
\n
"
htmlstring
=
htmlstring
+
htmlline
### EDIT ABOVE HERE ###
return
htmlstring
...
...
@@ -51,7 +54,13 @@ def combine_template_with_data(template_string, htmldata):
tabular data.
"""
### EDIT BELOW HERE ###
return
""
fullstring
=
""
i
=
""
i
=
csv_to_html
(
'
test.csv
'
)
with
open
(
'
template.html
'
,
'
r
'
,
encoding
=
'
utf-8
'
)
as
f
:
reader
=
f
.
read
()
fullstring
=
reader
.
replace
(
'
{}
'
,
i
)
return
fullstring
### EDIT ABOVE HERE ###
...
...
This diff is collapsed.
Click to expand it.
Programming_with_Python/test.csv
View file @
a82ad08d
Andreas;Fischer;andreas.fischer@th-deg.de
Jane;Doe;jane.doe@example.com
Max;Mustermann;max.mustermann@example.com
Mohammed;Ahmed;mohammed.ahmed@stud.th-deg.de
This diff is collapsed.
Click to expand it.