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

Exercise `1 #53

Open
wants to merge 7 commits into
base: master
Choose a base branch
from
Open

Exercise `1 #53

wants to merge 7 commits into from

Conversation

Liviavanvliet
Copy link

My first pull request

Copy link
Owner

@wmvanvliet wmvanvliet left a 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 + "?")
Copy link
Owner

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 = '')
Copy link
Owner

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'
Copy link
Owner

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)
Copy link
Owner

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
Copy link
Owner

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

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants