CSC 401 Assignment One
Out of 40 points
Due Date: Friday, Jan. 12thby 11:59PM
NOTE: Your "personal" deadline, though should always be BEFORE lecture, i.e. no later than 5:45 every Wednesday!
May be submitted up to 2 days late (i.e. by Sunday), but with a 3 point penalty for each day late.
I hope you will find this to be a relatively short and easy assignment. I kept it short because this first week also requires you to get Python installed, practice with the IDE, and just getting used to the fundamentals.
The purpose of this assignment is to assess your understanding of
- The basic concepts of arithmetical evaluation, variables, data types, built-in functions.
- The process of creating a Python module (program)
- Testing Python code.
- Use computational thinking to determine the best way to solve each problem
Submission
- Include your full name as a comment in the first line of your Python program
- Include the problem number as a comment in the second line of our Python program
- Save each program to a separate file labeled as yourName_hw1_1.py, yourName_hw1_2.py, accordingly
- Upload each file to Submissionsfolder in D2L.
Problems
Note: you may not use Python statements, functions, data types, etc. that were not discussed in the reading assignment or the lecture notes/videos for this week. This is a class for students who have not programmed before and I expect everyone to code on the same level. If your skills are beyond this course, then please contact me right away so that we can evaluate whether or not this is the correct course for you.
I encourage you to use computational thinking to solve the problems. These are very simple programs, but developing a good habit of analyzing the problem and describing the steps will serve you well as the problems get more complex.
- In this course, I will drop your lowest assignment score. Imagine that the course only required 4 assignments, each of which is out of 40 points. Write a short Python program that contains 4 variables, each representing a homework score. Because we have not yet determined how to get input from the user, we will hard-code the scores into our variables. (In subsequent assignments, we will ask the user who is running our program to enter those values). Hard-code the following four scores: 38, 27, 39, 32. Then calculate the average assignment score out of 40 – after the lowest score has been dropped. You must use Python's built-in 'min()' function to drop the lowest score. Round the result to 2 decimal places. Print this result to the screen. (Note: Your result should come out to 36.33).
- Write a short Python program that calculates a vehicle’s average gas mileage. The formula for calculating the miles that a vehicle can travel per gallon of gas is: MPG = miles driven/gallons where MPG is the miles-per-gallon, miles driven is the number of miles that can be driven on a full tank of gas, and gallons is the number of gallons that the tank can hold. Have variables for number of gallons of gas the tank can hold, and the number of miles the vehicle can be driven on a full tank. Hard code 16 for gallons, and 342 for miles. Round your result to 1 decimal place and output the numeric result to the screen. (Your calculation should come out to 21.4).
If you have any questions regarding this assignment, please post them to the COURSE Discussion Forum.You may discuss strategy and approaches, but please do not post any code!
1