Code-2 Exercises

< CS101

1.

Change just one line of the code below so it produces the following output when run.

xyz123
xyz123 xyz123
xyz123 xyz123 xyz123


code-2-ex1

2.

This code prints a pattern of "meh" when run. Change just two lines of the code below so it produces the following output when run.

AAAAAA
AAAAAA aaaaaa
AAAAAA aaaaaa @
AAAAAA aaaaaa
AAAAAA


code-2-ex2

3.

For this problem, you will write code from scratch. Write code that prints the following with your name instead of "Alice".

Hello, my name is Alice
Alice is in this class
Without a doubt Alice is working on this homework

Rather than mentioning your name directly, assign a variable to hold your name (i.e. x = ... ; ), then use that name variable within the print statements to insert your name. It should be possible to assign a different string to the variable, "Bob" or "Abby" or whatever, and then that name will appear in the printout when run.


code-2-ex3


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

count 3 : code-2-ex1 code-2-ex2 code-2-ex3

(code appears here)