3.7. Chapter 3 Exercises

There are 3 syntax errors in the following code. Fix it to print correctly without errors. It will print, “Your name is Carly and your favorite color is red.”.

You will get an error if you try to run the following code. Fix the code to print correctly without errors. It should print, “Your name is Carly and your age is 19.”

Use string slicing to set s1 to “giant alligator”. The print will put |’s around your output to make it clear if you have a space at the start or end of s1.

Using the variables given, modify the print statement to print "A car travelling at 70 mph takes 2.0 hours to go 140 miles." Make sure to print the variables, not the values you know they contain. If we changed milesPerHour and distanceTravelled your program should still print a correct message.

Write code below to get at least 3 values from the user using the input function and output a mad lib (which will use the input to tell a silly story).

This problem is not automatically checked. Make sure you are using variables to build your output and that the story uses the values you type in as input. Try giving different inputs and make sure that the story uses them.

You have attempted of activities on this page