-
Notifications
You must be signed in to change notification settings - Fork 44
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
Exercise `1 #53
base: master
Are you sure you want to change the base?
Exercise `1 #53
Conversation
first exercise
added some string functions
…into livs-branch
Livs branch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for trying out my little Gizmo challenge! You're doing great!
@@ -0,0 +1,31 @@ | |||
# hello function | |||
def hello(name, country = "Finland"): | |||
print("Hello", name + ", how are things in", country + "?") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Check out Python's f-string syntax to make this even prettier: https://realpython.com/python-f-strings/
# spelling function | ||
def spell(word): | ||
for letter in word: | ||
print (letter + '.', end = '') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This prints one additional .
at the end of the word, eg: L.i.v.i.a.v.a.n.v.l.i.e.t.
. You need to get rid of that last dot.
# editing strings | ||
def relative_path(arr): | ||
for i in arr: | ||
i = './subjects/mock_recording_'+i+'.rec' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You first use i
as iterator variable, but then overwrite it to be a string. This works, but will confuse anyone (including your future self) trying to read this code. I recommend using a different name for the string variable.
self.name = name | ||
|
||
def speak(self): | ||
print(self.name) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Beautiful :)
while len(seq) < n: | ||
seq.append(a) | ||
a, b = b, a + b | ||
return iterator |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Huh. Yeah. That does return an iterator. But I was actually aiming for you to use Python's yield
keyword in this exercise. Check it out here: https://www.programiz.com/python-programming/generator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you :)
My first pull request