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

  1. Write a Python statement that prints the word "hello" but does not advance to the next line
    print("hello", end="")
  2. Write a Python statement that prints
    1, 2, 4
    print(1, 2, 3, sep=", ")
  3. Write a Python expression that concatenates the string "Name = " with the variable student_name.
    "Name = " + student_name
  4. Write a Python expression that concatenates the string "Rate = " with the variable rate which is of type float.
    "Rate = " + str(rate)
  5. Write a Python expression that concatenates the string "Distance = " with the expression
    speed * time
    "Distance = " + 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\"")