Homework 2-1

Task 1

Create a new Python script that prints "Hello, World!". On two additional lines, print out a number of your choice and a boolean value of your choice. Both the number and the boolean should not be in string quotes.

Task 2

Consult Python's built-in functions list. Find three functions of interest besides print() that require an input and return a result of some kind. That is, if you print out their result, it should not be a NoneType. For each function, print out the results of three valid examples of their use. Your program should not throw any exceptions.

For each different function, write a brief comment describing what you think the function does.

To make your search easier, this list contains a number of simple functions that require only one or two parameters. It is recommended you choose from this list.

  • abs()
  • bool()
  • chr()
  • eval()
  • float()
  • hash()
  • hex()
  • id()
  • input()
  • int()
  • len()
  • long()
  • max()
  • min()
  • oct()
  • ord()
  • pow()
  • range()
  • round()
  • str()
  • type()

Task 3

In three separate commented lines at the top, place the number of hours you worked on this assignment, any collaborators you worked with and whether you went to TA hours for this assignment.

Extra Credit

As with every homework, you are welcome to expand on the tasks above for extra credit. For example, you may consider adding examples of other functions from the built-in functions list.


Once you're done, email your Python script to cs0030handin@gmail.com by midnight, 2/20.

Make sure your submission has your name in the filename: FirstLast_HW2-1.py. “FirstLast” should be replaced with your first and last name or we will take off points. Make sure every task has been completed.