Code-1 Exercises

These exercises are part of the full Homework 1 due next Wednesday; you should also complete the written exercises. Each time you press the "Run" button, your code is stored inside your browser, so you can't switch or share browsers. You can leave this tab with the exercises open, and there's also a "retrieve" button at the bottom of the page that will get your code back if needed (even if the tab is closed or the browser exits). To submit your homework, press the "retrieve" button at the bottom of the page, and copy and paste your code into Canvas.

Disclaimer: these early print exercises are a little dry, but we'll build this up to something more fun soon.

1.

The following code contains a syntax error, so it does not work. Fix the code so it produces the following output.

1 2 tree

 

2.

The following code contains a syntax error, so it does not work. Fix the code so it produces the following output.

3 4 alive

 

3.

Write code to produce the following output when run:

7 ate 9

 

4.

Write code to produce the following 3-line output when run

1 2 3
  2 3
    3

 

5.

Write code to create ASCII art. Your output must be at least five lines and have some creative aspect.


 


Each click of a Run button saves that code on the computer running the browser. The button below retrieves the all code exercises listed to the right of the button.

count 5 : code-1-ex1 code-1-ex2 code-1-ex3 code-1-ex4 code-1-ex5

(code appears here)