CSC 241 Lab 1

Submission:  Submit the python or text file that contains all your answers to the submission folder for this lab by the end of the lab. To simplify Drew's (our tutor) work, please include your name and the number of the lab at the top of the file (if you're submitting a Python file, use comments: start the line with a #).

Check out hwexample.docx for a sample (homework) submission, your lab submission could be similar.

Grading: see the grading criteria for lab assignments.

1. (Arithmetical Expressions) Using +, -, *, / and parentheses (as necessary) write expressions for the following tasks.

  1. Compute 1-2*3/4+5 .

  2. Compute 10-3 * 5 . (Compute the answer in your head, befor you check with Python).

  3. Compute (10-3)*5.

  4. How often does 7 divide into 100? Hint: use /.

  5. Redo that problem: How often does 7 divide into 100, but use // instead of /. What is the difference between the two?

2. (Using arithmetical expressions) You've forgotten your pin number which you need to activate one of your games on your tablet. The pin number consists of 5 digits, and each digit is between 1 and 9 (so 0 is not allowed).

  1. Calculate the total number of possible pins (that is, calculate 9 to the 5).

  2. How long will it take to break into your game in the worst case, that is, you have to check all possible pins, and it takes you 5 seconds to enter/check each particular pin by hand? Compute the answer:

    1. In seconds.

    2. In minutes.

    3. In hours.

    4. In days.

  3. Breaking into your game by hand it to slow, so instead you write yourself a program that tries all pins automatically (shame on your game for alllowing that). Let's say your program can check 1 billion (that is, 10 to the 9) pins a second.

    1. How many seconds does your program take to check all possible pins?

    2. How many milli-seconds does your program take (a milli-second is a thousandth of a second, that is 10 to the -3).

    3. How many micro-second does your program take (a micro-second is a millionth of a second, that is, 10 to the -6).

3. (A Short Program) Write a program that prints the following conversation when run. Hint: use three print statements, one for each line of text.

Marcus Schaefer
Last updated: April 1st, 2019.