CSci 127 Resources    Coursework    Programs    FAQ



Programming Problem List
CSCI 127: Introduction to Computer Science
Hunter College, City University of New York
Spring 2025


All students registered by Tuesday, 21 January are sent a Gradescope registration invitation to the email on record on their Brightspace account. If you did not receive the email or would like to use a different account, fill in the form on Brightspace. Include that you not receive a Gradescope invitation, your preferred email, and your EmpID. We will manually generate an invitation. As a default, we use your name as it appears in Brightspace/CUNYFirst (to update CUNYFirst, see changing your personal information). If you prefer a different name for Gradescope, include it, and we will update the Gradescope registration.

General Notes

Learning programming is like learning a foreign language: you will learn more (with less work) if you practice every day. Some of the programs below are easy; some will take more time. We suggest you set aside a block of time most days to work on programming and the course.

The programs build on the concepts and code developed during lecture, lab, and through the reading. Mastery of material is assessed via

While you are encouraged to work with others, all work submitted must be your own. As a rule of thumb, you must do your own typing. If it is not from the book or class webpage and you did not type it, it is plagiarism. For the first incident, your grade will be a 0 for the assignment (even for cases where you typed the program but others submitted it as their own). For the second incident of cheating or plagiarism, your grade will be a 0 for the homework component of the grade (20% of your overall grade). For the third incident, you will fail the class. We report all incidents to the Office of Student Affairs.

Autograder Notes

The majority of the programs this semester are written in Python (see Lab 1 for getting started with Python); it is noted below when other formats or languages are used. For Python programs, the autograder expects a .py file, using only the specified libraries, and does not accept iPython notebooks. Since all assignments are designed to be uploaded as a single file, the autograder is set up for direct file upload instead of Github. If submitting directly (drop-and-drag onto the webpage), the file name is flexible but must have the extension .py. Also, to receive full credit, the code should be compatible with Python 3.10 (the default for the Gradescope autograders).

To get full credit for a program, the file must include in the opening comment:

For example, for the student, Thomas Hunter, his first program might be:
"""
Name:  Thomas Hunter
Email: thomas.hunter1870@hunter.cuny.edu
Date: February 1, 2025
This program prints: Hello, Thomas Hunter
"""

print("Hello, Thomas Hunter")

You may submit your assignments up to two weeks before the due date and are encouraged to work ahead. To receive credit, assignments must be submitted by the deadline to Gradescope. For more information on using Gradescope, see Lab 1. Since Gradescope gives limited feedback, run your program first locally (on your computer or a lab computer) where the compiler messages will pinpoint errors and help debug your code. For example, if Gradescope gives you a "The autograder failed to execute..." error, it means your program has an error (in this case, it's usually the file contains non-Python commands.). The local Python compiler will give the line of your file with the error, where Gradescope will only say that there's a general problem. For more information on installing Python on your computer, see the installation guides.



Programming Exercises


  1. Due Date: 5pm, Monday, February 3
    Reading: Chapter 1 & Lab 1
    Available Libraries: Python 3.10+

    Hello

    Write a program that prints Hello followed by your name to the screen. For example, if your name is Thomas Hunter, when your program is run, it would print:

    
    Hello, Thomas Hunter
  2. Due Date: 5pm, Tuesday, February 4
    Reading: Chapter 4 & Lab 1
    Available Libraries: turtle, Python 3.10+

    Triangle

    Write a program that draws a triangle using the turtle library.
    program 2

    Note: Whenever submitting a turtle program, choose a name for your file that is not turtle.py. When executing the "import turtle" statement, the computer first looks in the folder where the file is saved for the turtle module and then in the libraries (and other places on the path). So, it thinks the module is itself, causing all kinds of errors. To avoid this, name your program something like "myTurtle.py" or "program2.py".

  3. Due Date: 5pm, Thursday, February 6
    Reading: Chapter 4 & Lab 1
    Available Libraries: turtle, Python 3.10+

    Flower

    Write a program that implements the pseudocode ("informal high-level description of the operating principle of a computer program or other algorithm") below:

    Repeat 50 times: 
      Change color to blue
      Walk forward 100 steps 
      Turn left 155 degrees 
      Change color to blue  
      Walk forward 100 steps 

    The result should look as follows:

  4. Due Date: 5pm, Friday, 7 February
    Reading: Chapter 1 & Lab 1
    Available Libraries: Python 3.10+

    Multiple Greetings

    Write a program that will print Hi & Bye multiple times. The number of times depends on your EmplID number. Take the last digit of your EmplID number and add 10. For example, if your EmplID ends in 3, the number of times you repeat the message is 3+10 = 13.

    For example, with an EmplID ending in 7, you would repeat the message 17 times:

    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
    Hi & Bye
  5. Due Date: 5pm, Tuesday, 11 February
    Reading: Chapter 4 & Lab 1
    Available Libraries: turtle, Python 3.10+

    Green Star

    Write a program that uses the turtle library to draw a green 5-pointed star.

    Your output should look like this:

    Hint: To draw the 5-pointed star, the turtle must turn a total of 720 degrees. How many degrees does the turtle need to turn at each point?


  6. Due Date: 5pm, Thursday, 13 February
    Reading: Chapter 2 & Lab 2
    Available Libraries: Python 3.10+

    Upper & Lower

    Using the string commands introduced in Lab 2, write a Python program that prompts the user for a message, and then prints the message, the message in upper case letters, and the message in lower case letters.

    A sample run of your program should look like:

    Enter a message:  Mihi cura futuri
    Mihi cura futuri
    MIHI CURA FUTURI
    mihi cura futuri

    Another run:

    Enter a message:  I love Python!
    I love Python!
    I LOVE PYTHON!
    i love python!

    Hint: Your program should be able to take any phrase the user enters and prints it, prints it in upper case letters, and prints it in lower case letters. To do that, you need to store the phrase in a variable and print variations of the stored variable. See Sections 2 and 3 of Lab 2.

  7. Due Date: 5pm, Friday, 14 February
    Reading: Chapter 2 & Lab 2
    Available Libraries: Python 3.10+

    Uppercase ASCII

    Write a program that prompts the user to enter a phrase, converts the phrase to uppercase, and then prints out each uppercase character and its corresponding ASCII code.

    A sample run of your program should look like:

    Enter a phrase: ABC
    A 65
    B 66
    C 67

    And another sample run:

    Enter a phrase: abc
    A 65
    B 66
    C 67

    Another run, with a longer phrase:

    Enter a phrase:  I love Python!
    I 73
      32
    L 76
    O 79
    V 86
    E 69
      32
    P 80
    Y 89
    T 84
    H 72
    O 79
    N 78
    ! 33
    

    Hint: The first step is to ask the user for input (see Section 2 of Lab 2). If c is a character, ord(c) returns its ASCII code. For example, if c is 'I', then ord(c) returns 73. See Lab 2.

  8. Due Date: 5pm, Wednesday, February 19
    Reading: Chapter 2 & Lab 2
    Available Libraries: Python 3.10+

    Counting by 25's

    Write a program that prints out the numbers from 1000 to 2000, counting by twentyfives.

    The output of your program should be:

    1000
    1025
    1050
    1075
    1100
    1125
    1150
    1175
    1200
    1225
    1250
    1275
    1300
    1325
    1350
    1375
    1400
    1425
    1450
    1475
    1500
    1525
    1550
    1575
    1600
    1625
    1650
    1675
    1700
    1725
    1750
    1775
    1800
    1825
    1850
    1875
    1900
    1925
    1950
    1975
    2000
  9. Due Date: 5pm, Thursday, February 20
    Reading: Chapter 2 & Lab 2
    Available Libraries: turtle, Python 3.10+

    Twisting Square

    Write a program, using the turtle library, that implements the pseudocode below:

    For i = 20, 22, 24, 26, ... ,100:
      Walk forward i steps
      Turn right 93 degrees

    Your output should look similar to:


    Hint: See examples of range(start,stop,step) in Section 4 of Lab 2.

  10. Due Date: 5pm, Friday, 21 February
    Reading: Chapter 2 & Lab 2
    Available Libraries: Python 3.10+

    Acronyms

    Write a program that prompts the use for a phrase and creates an acronym, consisting of the first letters of each word, in uppercase.

    To approach a problem, it is useful to break it into steps:

    1. Prompt for a phrase & read it into a variable.
    2. Make the phrase upper case.
    3. Print the phrase.
    4. Split up the phrase into words.
    5. Take the first letter of each word (keep in mind that split() returns a list of the words ), concatenate and make an acronym of it.
    6. Print the acronym.

    Now translate the above pseudocode (informal but detailed description of the steps in a program) into python and test that your program works as follows:

    Enter a phrase:  City University New York
    Your phrase in capital letters:  CITY UNIVERSITY NEW YORK
    Acronym:  CUNY

    Hint: See examples of looping throught strings in Section 3 of Lab 2.




More to come...