Skip to main content Link Search Menu Expand Document (external link)

Homework #1 - Google Search

Google Search is an incredibly important tool to use when learning and practicing programming. It’s not expected that you will memorize how to do absolutely everything with code. You won’t be able to, there’s just too much to know. It is expected that you will be able to figure out what you don’t know. Google Search is one of the best tools for that.

Professional programmers routinely use Google to remind themselves how to do certain things with code, to find examples of how other people have written code for solving a specific problem, and even to find freely available code they can add to their own programs. The goals of this assignment are to get you started with understanding what Google is and isn’t good for, and to give you some tips for using Google more effectively.

Instructions

For each exercise below, write your answers to the questions in Word (or similar) and include at least one screenshot which shows your search results. Paste your screenshots directly into Word underneath your answers. Your answers don’t need to be more than 1-2 sentences.

Note: If you would prefer to use Bing or DuckDuckGo or some other search engine than Google for this assignment, that’s fine. Everything below will work in most search engines.

When working with a specific programming language, it’s always very useful to include the name of the language in the search terms you use. For this class, that means including the word “python” in your searches.

Let’s say you want to figure out how to use an “else” statement in Python. Use Google to search for the term “else statement”. What’s the first thing that comes up? How far down do you have to scroll before you get a search result that’s specific to Python? Is the featured snippet at the top of the search useful? (Include a screenshot of the results.)

Now search for “else statement python”. How are the results different? (Include a second screenshot of these results.)

Exercise 2 - Define

Google Search allows you to use a number of different operators to narrow your search results. If you’re trying to understand what a term or concept means, the “define” operator can be very helpful.

define:else statement

Note there is no space between “define:” and the term you want defined. This is important.

Search for “else statement” using the “define:” operator, as shown above. How are the results different from when you searched for “else statement” in exercise 1?

Exercise 3 - Exact search terms

Sometimes you want to find results that exactly match the search terms you use. You might want to do this if the search results coming up aren’t specific enough. To search for a specific phrase, put the phrase in quotes.

Google this phrase without quotes: what does elif do

Now use quotes around it: "what does elif do"

Take screenshots for each result. How are the results different? Which of the results do you find most useful?

There’s also an operator that allows you to use Google to search a specific website rather than the entire internet. It works like the “define” operator, except you can add additional keywords after it. So if I wanted to search Reddit to see what kinds of reading chairs Redditors recommend, I could do this:

site:reddit.com best reading chair

This will bring up search results only from Reddit. Note that you have to include the domain extension for the url (like .com or .org) as part of the site name. If you try it with just site:reddit your search won’t work.

Reddit can actually be a useful site for finding answers to specific programming questions. Stack Overflow (stackoverflow.com) is also a very useful site for programming questions, and the official Python documentation (python.org) will be useful for this class, too.

Search Reddit, Stack Overflow, or the Python documentation to find out whether you always need to have an else statement after an if statement or not. Make sure your search is specific to Python.

What search terms did you use to find the answer? Did you try using quote marks around any phrases? Which site(s) did you search? About how many searches did you do before you found a good answer?

Include two screenshots: one of the search results for the last search you did, and one showing the webpage with the best answer you found.

Turn in

Turn your assignment in as a Word doc or a PDF on D2L under Assignments -> Google Search and Programming. This assignment is due before the start of the studio in Week 4.

Grades will be based on following the instructions and making an honest effort. If you describe your findings for each exercise particularly well, that will earn you a check plus.