Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
C
CSCI30_Project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Temujin
CSCI30_Project
Commits
d4357b12
Commit
d4357b12
authored
Dec 09, 2019
by
Adrian Cansino
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update family_tree.py
parent
27781975
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
13 additions
and
5 deletions
+13
-5
family_tree.py
family_tree.py
+13
-5
No files found.
family_tree.py
View file @
d4357b12
...
@@ -217,7 +217,7 @@ class FamilyTree:
...
@@ -217,7 +217,7 @@ class FamilyTree:
"""Return the index in the times table."""
"""Return the index in the times table."""
return
self
.
times
[
n
]
return
self
.
times
[
n
]
def
great
(
self
,
n
):
def
GREAT
(
self
,
n
):
"""Return a string of n 'greats' separated by '-' ."""
"""Return a string of n 'greats' separated by '-' ."""
return
"-"
.
join
([
"great"
]
*
n
)
return
"-"
.
join
([
"great"
]
*
n
)
...
@@ -433,7 +433,7 @@ def commandLine():
...
@@ -433,7 +433,7 @@ def commandLine():
print
(
"Error: no such person "
+
cmd
[
1
])
print
(
"Error: no such person "
+
cmd
[
1
])
elif
cmd
[
0
]
==
"edit-age"
:
elif
cmd
[
0
]
==
"edit-age"
:
try
:
try
:
tree
.
get_person
(
cmd
[
1
])
.
set_
nam
e
(
cmd
[
2
])
tree
.
get_person
(
cmd
[
1
])
.
set_
ag
e
(
cmd
[
2
])
except
KeyError
:
except
KeyError
:
print
(
"Error: no such person "
+
cmd
[
1
])
print
(
"Error: no such person "
+
cmd
[
1
])
elif
cmd
[
0
]
==
"edit-sex"
:
elif
cmd
[
0
]
==
"edit-sex"
:
...
@@ -446,13 +446,21 @@ def commandLine():
...
@@ -446,13 +446,21 @@ def commandLine():
print
(
"Error: no such person "
+
cmd
[
1
])
print
(
"Error: no such person "
+
cmd
[
1
])
elif
cmd
[
0
]
==
"relationship"
:
elif
cmd
[
0
]
==
"relationship"
:
try
:
try
:
print
(
tree
.
relationship
(
tree
.
get_person
(
cmd
[
1
]),
tree
.
get_person
(
cmd
[
2
])))
if
cmd
[
1
]
==
cmd
[
2
]:
print
(
"Error: inputs must be distinct"
)
else
:
print
(
tree
.
relationship
(
tree
.
get_person
(
cmd
[
1
]),
tree
.
get_person
(
cmd
[
2
])))
except
KeyError
:
except
KeyError
:
print
(
"Error: one or both persons do not exist"
)
print
(
"Error: one or both persons do not exist"
)
elif
cmd
[
0
]
==
"load"
:
elif
cmd
[
0
]
==
"load"
:
tree
=
openfile
(
cmd
[
1
])
try
:
print
(
cmd
[
1
]
+
".ft has been loaded"
)
tree
=
openfile
(
cmd
[
1
])
print
(
cmd
[
1
]
+
".ft has been loaded"
)
except
FileNotFoundError
:
print
(
"Error: File not found"
)
elif
cmd
[
0
]
==
"save"
:
elif
cmd
[
0
]
==
"save"
:
tree
.
find_root
()
tree
.
precompute
()
savefile
(
cmd
[
1
],
tree
)
savefile
(
cmd
[
1
],
tree
)
print
(
"file saved"
)
print
(
"file saved"
)
elif
cmd
[
0
]
==
"bye"
:
elif
cmd
[
0
]
==
"bye"
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment