Code-1 Exercises

< CS101

These exercises will be part of the full homework-1 due next Monday. We'll explain how to turn in your work on Thu. For now, just know that each time you click the Run button, your code is stored inside your browser. This means you can't switch or share browsers. You can leave this tab with the exercises open, and also 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).

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 shoe

code-1-ex1

 

2.

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

3 4 door

code-1-ex2

 

3.

The code below prints something when run. Change the code so it produces the following output when run:

1 2 3 hello

code-1-ex3

 

4.

The code below prints a single line when run. Change the code so it produces the following 3-line output when run

1
1 2
1 2 3

code-1-ex4

 


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 4 : code-1-ex1 code-1-ex2 code-1-ex3 code-1-ex4

(code appears here)