IT 116: Introduction to Scripting
Answers to Class 6 Ungraded Quiz

  1. Write an assignment statement that creates the string s which, when printed, shows
    He said "It's me."
    s = 'He said "It\'s me."'
  2. Write an assignment statement that creates the string s which, when printed, shows
    My top directory is \c:
    s = "My top directory is \\c:"
  3. Write a Python expression that concatenates the string "My name is " with the string variable name.
    "My name is " + name
  4. Write a Python expression that concatenates the string "The rate is " with the variable rate which is of type float.
    "The rate is " + str(rate)
  5. Write a Python expression that concatenates the string "The distance is " with the expression
    speed * time
    "The distance is " + str(speed * time)
  6. Write a SINGLE print statement, without using triple quotes, which prints
    Line 1
    Line 2
    Line 3
    print("Line 1\nLine 2\nLine 3")
  7. Write a SINGLE print statement, without using triple quotes or concatenation, which prints
    The path is C:\temp\memo.txt.
    print("The path is C:\\temp\\memo.txt.")
  8. Write a SINGLE print statement, without using triple quotes or concatenation, which prints
    She said "I'm OK"
    print("She said \"I\'m OK\"")