warmup 7.htm.pdf - COM110 Fall 2014 Warm-­‐up exercise 7...

Info icon This preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: COM110 Fall 2014 Warm-­‐up exercise 7 Due Mon, Oct 6 The goal of this assignment is to practice coding if statements in the context of functions with parameters that return values using the website CodingBat. • Start by creating an account. o Under preferences (“prefs”), be sure to add me ([email protected]) as your teacher. That way I will be able to see your progress. o Under “report,” make sure “Python problems” is checked. • Click on the Sirst Python Logic-­‐1 exercise (cigar_party). A screenshot of my completed solution to this exercise is below. • The solutions of these exercises use function deSinitions with parameters (variables in the parentheses next to the function name). • They also use return statements. Note that once a return statement is reached, the function ends immediately, even if there is more code after the return statement. • I’ve added some comments to my code to help explain what’s going on. • The function header will always be automatically provided for you in the box where you type your code. • Start by carefully reading the cigar_party problem speciSication. • Then solve it, simply by typing in my solution below if you’d like. (Though if you use my solution, make sure you understand it!) Notice that the website does not automatically indent for you as IDLE does, and you can’t use the Tab key for indentation as usual. Instead you should use spaces. Just be consistent with how many you use. Four spaces per “tab” is a pretty standard number. Some people use as few as two spaces per indent. • When you click on the “Go” bu2on, your code will be run on a ba2ery of tests. The results of these tests will show up on the right hand side of the screen. If you pass all the tests, you have correctly solved the problem. • After completing the cigar_party problem, pick at least one other exercise from the Python Logic-­‐1 list to complete. Check under the “done” link to verify that you’ve completed at least these two problems. But have fun and keep solving problems for as long as you like! ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern