Heads up! To view this whole video, sign in with your Courses account or enroll in your free 7-day trial. Sign In Enroll
Preview
Start a free Courses trial
to watch this video
Solve a challenge to test your knowledge of dunder main.
This video doesn't have any notes.
Related Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign upRelated Discussions
Have questions about this video? Start a discussion with the community and Treehouse staff.
Sign up
Hi again,
I've got a small coding challenge for you.
0:00
As you can see the files I have on screen
have your challenge prompt in them
0:03
already, so you can either open up
the workspace attached to this video or
0:08
grab the files from the downloads
tab below the video to work locally.
0:12
Your challenge is to write code here
in alphabet.py to find the word in
0:18
the list that would come
first alphabetically.
0:22
You'll need to follow best practices
in this module file by keeping your
0:26
code in a function or functions, and
0:31
then use Dunder main to hold code that
would run as you test it out in practice.
0:33
Then you can import your code into the
app.py file, which I've already done for
0:39
you here, and change out these two
comments here at the bottom of the file.
0:44
You'll need to replace,
0:49
this func_name with whatever you
end up naming your function.
0:51
That way,
you can run app.py to test out your work,
0:55
to make sure that you're getting
the correct responses, and
0:58
that nothing from alphabet.py is
getting printed to the console.
1:01
And a quick hint,
you can have your function either print or
1:06
return the correct word.
1:10
That's up to you, it doesn't matter to me.
1:12
But if you do,
don't forget that if you return the word,
1:14
you would then need to put this wrapped
inside of a print statement, so
1:18
that you can see the word
in the console afterwards.
1:23
So find the word in the list that
would come first alphabetically.
1:29
So for example, the word list
here is a list of a few animals.
1:33
We have a hamster, turtle, cat, and bird.
1:38
When this list is sent to your function,
1:40
the function should return that the word
bird is the word that would come first
1:42
alphabetically because it
begins with the letter b.
1:46
And that's it.
1:51
Good luck and I'll see you in
the next video with a solution.
1:53
You need to sign up for Treehouse in order to download course files.
Sign upYou need to sign up for Treehouse in order to set up Workspace
Sign up