exercise01SOLUTION.docx - 44-141 Computer Programming I Exercise 01 1 How does one write a one line comment in Python#This is a one line comment 2 How

exercise01SOLUTION.docx - 44-141 Computer Programming I...

This preview shows page 1 - 2 out of 2 pages.

44-141 Computer Programming I Exercise 01 1. How does one write a one line comment in Python? #This is a one line comment 2. How does one write a comment in Python that extends to more than one line? “””This is a multi Line comment “”” 3. Write the single line of Python code that will display (output) the word ‘hello’ on the screen (without the quotes). print("Hello") 4. Write two lines of Python code that will display the following text on two lines. This is the first line This is the second line print("This is the first line") print("This is the second line") 5. Provide an example of the type of data that might be stored with each data type. a) int - 7 a) float – 7.0 b) char - a c) boolean - True d) str – “hello” 6. Write the Python code to assign the value 10 (an int) to the variable named examScore . examScore = 10 7. Write the Python code to assign the value 10.5 (a float) to a variable named
Image of page 1

Subscribe to view the full document.

Image of page 2

Unformatted text preview: price . price = 10.5 8. Write the Python code to display the contents of the variable examScore to the monitor. print(examScore) 9. Write the Python code to display the contents of the variable price to the monitor. print(price) Challenge Problems (You are not required to complete the challenge problems): 1. Write one line of Python code that will display the following text on two lines as shown below. This is the first line This is the second line print("This is the first line\nThis is the second line") 2. Write one line of Python code that will display the following text on one line with a tab character separating the text as shown below. This line contains a tab character print("This line contains\ta tab character")...
View Full Document

  • Spring '16
  • DianaLinville

What students are saying

  • Left Quote Icon

    As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

    Student Picture

    Kiran Temple University Fox School of Business ‘17, Course Hero Intern

  • Left Quote Icon

    I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern

Ask Expert Tutors You can ask You can ask ( soon) You can ask (will expire )
Answers in as fast as 15 minutes