Difference between revisions of "CSC111 Homework 1 2018"

From dftwiki3
Jump to: navigation, search
 
(26 intermediate revisions by the same user not shown)
Line 1: Line 1:
 
[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 15:01, 17 January 2018 (EST)
 
[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 15:01, 17 January 2018 (EST)
 
----
 
----
 
+
<onlydft>
 
<bluebox>
 
<bluebox>
This homework is due a week after it is released, on Thursday Feb 8th, at 11:55 p.m.  The quiz part of the assignment should be done individually.  For the programming part of the assignment, you should find a partner and work in pair, and use the pair-programming approach.  
+
This homework is due on Thursday '''Feb 8th, at 11:55 p.m.'''   The quiz part of the assignment should be done individually.  For the programming part of the assignment, '''you should find a partner and work in pair, and use the pair-programming approach. You may want to work with your lab partner, if the two of you have a good schedule.  '''
 
</bluebox>
 
</bluebox>
 
<br />
 
<br />
 
=Quiz=
 
=Quiz=
 
<br />
 
<br />
Please go to the CSC111 page on Moodle and answer the questions in the "Quiz on Chapter 1" section.
+
Please go to the CSC111 page on Moodle and answer the questions in the "Quiz" section for Week 1.  The questions refer to Chapter 1 in the Zelle textbook, and to the [http://cs.smith.edu/~jfrankli/111s08/pairProgramming2000.pdf article] on ''pair programming.''
  
 
=Programming=
 
=Programming=
 
--[[User:Thiebaut|D. Thiebaut]] ([[User talk:Thiebaut|talk]]) 16:45, 7 September 2015 (EDT)
 
----
 
  
 
<br />
 
<br />
<bluebox>
+
Each problem below requires you to ''copy'' an incomplete program into IDLE, and then ''edit'' it so that the output of your edited program matches '''exactly''' the output specified in the problem.  You will submit your programs for this assignment in the CSC111 section of your Moodle account.   
In this assignment is due on 9/19/15 at 11:55 p.m., or 5 minutes before midnightRemember that no extensions are given in this class!
 
  
Each problem requires you to ''copy'' an incomplete program into IDLE, and then ''edit'' it so that the output of your edited program matches '''exactly''' the output specified in the problem.   You will submit your programs for this assignment in the CSC111 section of your Moodle account.  
+
There may be many different ways to edit a program to make it output the one specified in the problem.  In general, if you have a choice between several possible modifications, pick the one that is the simplest.  Do not try to rewrite the program, but keep its structure.  It is acceptable to add new statements in some problems.  You can click on the '''evaluate''' button to see whether your program is correct or not. The evaluate feature will be available for the first half of the semester.
  
There may be many different ways to edit a program to make it output the one specified in the problemIn general, if you have a choice between several possible modifications, pick the one that is the simplestDo not try to rewrite the program, but keep its structure.  It is acceptable to add new statements in some problems.  You must '''evaluate''' each program on Moodle to receive a grade for it.  Make sure you evaluate your programs before the deadline, otherwise you will not receive a grade.
+
You should work as a pair on this assignment, and submit your program on Moodle twice, once for each member of the pairFor example, if Emily and Sarah work as a pair, they will create the program together on one computerWhen the program runs well, Sarah will connect to her Moodle account, and submit the program in the area specific to this assignment, and then Emily will connect to her Moodle account and do the same.
  
'''Grading''':  The homework assignments count for a total of 40% of the final grade.  Since there will be approximately 11 assignments this semester, each one will count for roughly 40/11 or 3.9% of the final grade.  Homework 1 contains 10 problems; therefore each one counts for approximately 0.039% of the final grade.  The programs are graded 0 or 100, depending on whether its output is exactly the one required, or not.
+
<br />
 +
=Grading=
 +
<br />
 +
Moodle uses numbers to grade programsThese numbers are translated into letters using the following scale:
  
You should work as a pair on this assignment, and submit your program on Moodle twice, once for each pair member. For example, if Emily and Sarah work as a pair, they will create the program together on one computer. When the program runs well, Sarah will connect to her Moodle account, and submit the program in the area specific to this assignment, and then Emily will connect to her Moodle account and do the same.
+
* 100.00 - 93.00: A
</bluebox>
+
* 92.99 - 90.00: A-
<br />
+
* 89.99 - 87.00: B+
__NOTOC__
+
* 86.99 - 83.00: B
 +
* 82.99 - 80.00: B-
 +
* 79.99 - 77.00: C+
 +
* 76.99 - 73.00: C
 +
* 72.99 - 70.00: C-
 +
* 69.99 - 67.00: D+
 +
* 66.99 - 60.00: D
 +
* 59.99 - 0.00: F
 
<br />
 
<br />
 +
<!--
 
=Quiz=
 
=Quiz=
 
<br />
 
<br />
Line 57: Line 64:
 
:The article suggests that it is acceptable for programmers involved in pair programming to sometimes work alone.  But the time spent alone should be less than half of the total time spent on the project. True or false?
 
:The article suggests that it is acceptable for programmers involved in pair programming to sometimes work alone.  But the time spent alone should be less than half of the total time spent on the project. True or false?
 
<br />
 
<br />
 +
-->
  
 
=Problem #1=
 
=Problem #1=
Line 73: Line 81:
 
# Name of pair partner #2
 
# Name of pair partner #2
  
age = 1
+
age = 1 # you may want to change this number
 
name = "Alex"
 
name = "Alex"
year = 2015
+
year = 2018
  
print( "--", year )
+
print( "++", year )
 
print( name, "is", "and was born in" )
 
print( name, "is", "and was born in" )
  
Line 83: Line 91:
 
|
 
|
 
<source lang="text">
 
<source lang="text">
-- 2015 --
+
++ 2018 ++
Alex is 20 years old and was born in 1995
+
Alex is 20 years old and was born in 1998
Alex will be 25 in 2020
+
Alex will be 22 in 2020
 
</source>
 
</source>
 
|}
 
|}
  
 
<br />
 
<br />
Make sure you '''evaluate''' the program and receive a grade for it, otherwise your work will not be counted toward the homework grade!
+
You click on ''run'' to verify that your program works.  Click on ''evaluate'' to see if it outputs the correct information.
 +
<br />
 +
'''Possible grades''': A, A- or B.
 
<br />
 
<br />
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
Line 109: Line 119:
  
 
college = "Smith College"
 
college = "Smith College"
bar = "-" * len( college )
+
bar = "+" * len( college )
 
name = "Fiona"
 
name = "Fiona"
 
print( bar )
 
print( bar )
Line 116: Line 126:
 
|
 
|
 
<source lang="text">
 
<source lang="text">
-------------
+
+++++++++++++
 
Smith College
 
Smith College
 
Fiona
 
Fiona
-------------
+
+++++++++++++
 
</source>
 
</source>
 
|}
 
|}
 
<br />
 
<br />
Make sure you '''evaluate''' the program and receive a grade for it, otherwise your work will not be counted toward the homework grade!
+
<br />
 +
'''Possible grades''': A, A- or B.
 +
<br />
 
<br />
 
<br />
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
 +
 
=Problem #3=
 
=Problem #3=
 
<br />
 
<br />
Line 160: Line 173:
 
|}
 
|}
 
<br />
 
<br />
Make sure you '''evaluate''' the program and receive a grade for it, otherwise your work will not be counted toward the homework grade!
+
<br />
 +
'''Possible grades''': A, A- or B.
 +
<br />
 
<br />
 
<br />
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
Line 178: Line 193:
 
# Name of pair partner #2
 
# Name of pair partner #2
  
def greetBar( person ):
+
def greetBar( person ):        
     bar = "---------------------"
+
     bar = "+++++++++++++++++++++"
 
     print( bar )
 
     print( bar )
 
     print( person )
 
     print( person )
Line 189: Line 204:
 
|
 
|
 
<source lang="text">
 
<source lang="text">
---------------------
+
+++++++++++++++++++++
 
Hello John
 
Hello John
 
How are you?
 
How are you?
---------------------
+
+++++++++++++++++++++
 
Hello Emily
 
Hello Emily
 
How are you?
 
How are you?
---------------------
+
+++++++++++++++++++++
 
Hello Lujun
 
Hello Lujun
 
How are you?
 
How are you?
Line 201: Line 216:
 
|}
 
|}
 
<br />
 
<br />
 
+
<br />
 +
'''Possible grades''': A, A- or B.
 +
<br />
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
 
<!-- ---------------------------------------------------------------------------------------------------------------------- -->
  
 
+
=Problem #5=
=Problem 5=
 
 
<br />
 
<br />
 
Open IDLE on your computer and type in the incomplete program shown below.  Save it as '''hw1_5.py'''. Modify it until you get it to show the output shown in the second column, below.  When you are satisfied your program runs correctly, submit it to Moodle, in the HW 1 P 5 section.  Be careful, as the Moodle testing program counts extra spaces or extra blank lines in your output as incorrect!
 
Open IDLE on your computer and type in the incomplete program shown below.  Save it as '''hw1_5.py'''. Modify it until you get it to show the output shown in the second column, below.  When you are satisfied your program runs correctly, submit it to Moodle, in the HW 1 P 5 section.  Be careful, as the Moodle testing program counts extra spaces or extra blank lines in your output as incorrect!
Line 224: Line 240:
  
 
def greetLength( person ):
 
def greetLength( person ):
     bar = "---------------------"
+
     bar = "+++++++++++++++++++++"
 
     print( bar )
 
     print( bar )
 
     print( "Hello", person )
 
     print( "Hello", person )
Line 234: Line 250:
 
|
 
|
 
<source lang="text">
 
<source lang="text">
---------------------
+
+++++++++++++++++++++
 
Hello John how are you?
 
Hello John how are you?
---------------------
+
+++++++++++++++++++++
 
Hello Emily how are you?
 
Hello Emily how are you?
---------------------
+
+++++++++++++++++++++
 
Hello Jo how are you?
 
Hello Jo how are you?
 
</source>
 
</source>
 
|}
 
|}
 +
<br />
 +
<br />
 +
'''Possible grades''': A, A- or B.
 
<br />
 
<br />
 
<br />
 
<br />
 
<!-- ---------------------------------------------------------------------------------------------------- -->
 
<!-- ---------------------------------------------------------------------------------------------------- -->
  
=Problem 6=
+
=Problem #6=
 
<br />
 
<br />
 
Open IDLE on your computer and type in the incomplete program shown below.  Save it as '''hw1_6.py'''.  Modify it until you get it to show the output shown in the second column, below.  When you are satisfied your program runs correctly, submit it to Moodle, in the HW 1 P 6 section.
 
Open IDLE on your computer and type in the incomplete program shown below.  Save it as '''hw1_6.py'''.  Modify it until you get it to show the output shown in the second column, below.  When you are satisfied your program runs correctly, submit it to Moodle, in the HW 1 P 6 section.
  
Be careful, as the Moodle testing program counts extra spaces or extra blank lines in your output as incorrect!
+
Be careful, as the Moodle testing program may count extra spaces or extra blank lines in your output as incorrect!
 
 
Make sure you click on '''evaluate''' in Moodle to make sure your program receives a grade.
 
  
 
<br />
 
<br />
Line 271: Line 288:
  
 
def greetLength( person ):
 
def greetLength( person ):
     bar = "---------------------"
+
     bar = "+++++++++++++++++++++"
 
     print( bar )
 
     print( bar )
 
     noChars = len( person )
 
     noChars = len( person )
Line 283: Line 300:
 
|
 
|
 
<source lang="text">
 
<source lang="text">
---------------------
+
+++++++++++++++++++++
 
==> Maria Callas <==
 
==> Maria Callas <==
 
Your name contains 12 characters
 
Your name contains 12 characters
---------------------
+
+++++++++++++++++++++
 
==> Sir Elton John <==
 
==> Sir Elton John <==
 
Your name contains 14 characters
 
Your name contains 14 characters
---------------------
+
+++++++++++++++++++++
 
==> Lady Gaga <==
 
==> Lady Gaga <==
 
Your name contains 9 characters
 
Your name contains 9 characters
 
</source>
 
</source>
 
|}
 
|}
<br /><br />
+
<br />
 +
<br />
 +
'''Possible grades''': A, A- or B.
 +
<br />
 +
<br />
 
<!-- ---------------------------------------------------------------------------------------------------- -->
 
<!-- ---------------------------------------------------------------------------------------------------- -->
 
  
  
Line 318: Line 338:
 
year = 2015
 
year = 2015
  
print( "--", year, "--" )
+
print( "++", year, "++" )
 
print( name, "is", age, "years old and was born in", year-age )
 
print( name, "is", age, "years old and was born in", year-age )
 
print( name, "will be", 2020-2015 + age, "in 2020" )
 
print( name, "will be", 2020-2015 + age, "in 2020" )
Line 328: Line 348:
  
 
college = "Smith College"
 
college = "Smith College"
bar = "-" * len( college )
+
bar = "+" * len( college )
 
name = "Fiona"
 
name = "Fiona"
 
print( bar )
 
print( bar )
Line 351: Line 371:
 
# Homework 1, Problem 4 (read Section 1.6 in Zelle)
 
# Homework 1, Problem 4 (read Section 1.6 in Zelle)
  
def greetBar( person ):
+
def greetBar( person ):        
     bar = "---------------------"
+
     bar = "+++++++++++++++++++++"
 
     print( bar )
 
     print( bar )
 
     print( "Hello", person )
 
     print( "Hello", person )
Line 367: Line 387:
  
 
def greetLength( person ):
 
def greetLength( person ):
     bar = "---------------------"
+
     bar = "+++++++++++++++++++++"
 
     print( bar )
 
     print( bar )
 
     noChars = len( person )
 
     noChars = len( person )
Line 385: Line 405:
  
 
def greetLength( person ):
 
def greetLength( person ):
     bar = "---------------------"
+
     bar = "+++++++++++++++++++++"
 
     print( bar )
 
     print( bar )
 
     noChars = len( person )
 
     noChars = len( person )
Line 398: Line 418:
 
</source>
 
</source>
 
</showafterdate>
 
</showafterdate>
 
+
</onlydft>
 
<br />
 
<br />
 
<br />
 
<br />

Latest revision as of 13:38, 1 June 2018

D. Thiebaut (talk) 15:01, 17 January 2018 (EST)



...