Devry CIS 115 Week 5 iLab and Course Project
CIS115 Week 5 Lab Overview
Title of Lab: Race Time Sorting in Python
Store the times into arrays called Chevy[ ] and Ford[ ]. Then list the winner of each pair, giving the number of seconds the winner won by. At the end declare which team won based on which team had the most wins.
- A source code Python file.
- A Word document containing both source code and the screen print of the program outputs.
There are eight cars in each team called Chevy and Ford. One car from each team races its opponent on the drag strip. Read in the racing times for the eight Chevy cars and then read in the times for the eight Ford cars.
- Accept the racing times for each of the Chevy cars into the array Chevy[ ].
- Accept the racing times for each of the Ford cars into the array Ford[ ].
- Then declare the wining car for each race, giving the winning time in seconds.
- If the times are identical, then declare the race was a tie.
- Finally, declare which team won the match, assuming a tie is possible.
CIS 115 Week 5: Course Project
The Week 5 portion of your Course Project is due this week. Please refer to the Course Project Overview in the Introduction and Resources module for full details. Use this report (Links to an external site.) to complete this portion of the project.
Guess the number!
You will add to the program you created last week. This week you will add input validation and a count to show how many guesses the user took before getting the correct number. The pseudocode is below. Be sure to import random at the beginning of your code and use a comment block explaining what your program does
#Guess the number week 5 #Name: #Date: #Random number, loop while true #ask user for number. Check to see if the value is a number between 1 and 10 #if number is too high or too low, tell user, if they guessed it break out of loop Display "Welcome to my Guess the number program!" random mynumber count=1 while True try Display "Guess a number between 1 and 10" Get guess while guess<1 or guess>10 Display "Guess a number between 1 and 10" Get guess except Display "numbers only" continue if (guess<mynumber) Display "Too low" count=count+1 else if (guess>mynumber) Display "Too high" count=count+1 else if (guess==mynumber) Display "You guessed it in "+ count + " attempts"
When you run your program the result should be something like this:
Welcome to my Guess the number program! Please guess a number between 1 and 10: a Numbers only! Please guess a number between 1 and 10: -3 Please guess a number between 1 and 10: 4 Too low Please guess a number between 1 and 10: 5 Too low Please guess a number between 1 and 10: 6 You guessed it! It took you 3 attempts
Be sure to submit your assignment.