Description
Task 1 [Ticket Price]
Goal: This task is to compute the ticket price for a person based on their age and their status as a student.
The user should input two piece of information:
(1) Their age as an integer
(2) If they are a student or not, either “Y” or “N”
You need to compute the type of ticket and amount they need to pay. The possible outcomes are:
Type ‘CHILD’, Price 0.50 – if their age is less than or equal to 12.
Type ‘STUDENT’, Price 1.00 – if they answer “Y” to the student question
Type ‘SENIOR’, Price 0.50 – if their age is greater than or equal to 65.
Type ‘ADULT’, Price 1.50 – if none of the thing above are true.
Note, you should compute the lowest fare based on the input. For example, a person who is a ‘CHILD’ or
‘SENIOR’ but is also a ‘STUDENT’ should only pay 0.50 and not the students rate of 1.00.
See output for several examples (user input is in red)
—TASK 1: Determine Fare—
What is your age?: 5
Are you a student (Y/N)?: Y
Fare Type ‘CHILD’ – Price: $0.50
—TASK 1: Determine Fare—
What is your age?: 30
Are you a student (Y/N)?: Y
Fare Type ‘STUDENT’ – Price: $1.00
—TASK 1: Determine Fare—
What is your age?: 66
Are you a student (Y/N)?: N
Fare Type ‘SENIOR’ – Price: $0.50
—TASK 1: Determine Fare—
What is your age?: 21
Are you a student (Y/N)?: N
Fare Type ‘ADULT’ – Price: $1.50
Your output should look like that shown here. Also see accompanying video.
Example video for the lab: https://www.eecs.yorku.ca/~mbrown/EECS1015_Lab3.mp4
Page 3/9
Task 2 [Print each item in string and reverse the string.]
Goal: The user should input string. You will print out each character one by one. You will also print out the
string in reverse order.
See output for several examples (user input is in red)
— Task 2: Print String Characters and Reverse —
Input a string: This is a test.
str[0] = ‘T’
str[1] = ‘h’
str[2] = ‘i’
str[3] = ‘s’
str[4] = ‘ ‘
str[5] = ‘i’
str[6] = ‘s’
str[7] = ‘ ‘
str[8] = ‘a’
str[9] = ‘ ‘
str[10] = ‘t’
str[11] = ‘e’
str[12] = ‘s’
str[13] = ‘t’
str[14] = ‘.’
Reversed: ‘.tset a si sihT’
— Task 2: Print String Characters and Reverse —
Input a string: EECS1015 Lab3
str[0] = ‘E’
str[1] = ‘E’
str[2] = ‘C’
str[3] = ‘S’
str[4] = ‘1’
str[5] = ‘0’
str[6] = ‘1’
str[7] = ‘5’
str[8] = ‘ ‘
str[9] = ‘L’
str[10] = ‘a’
str[11] = ‘b’
str[12] = ‘3’
Reversed: ‘3baL 5101SCEE’
Your output should look like that shown here. Also see accompanying video.
Example video for the lab: https://www.eecs.yorku.ca/~mbrown/EECS1015_Lab3.mp4
Page 4/9
Task 3 [Finding the maximum value in a list of inputs
Goal: The goal is to find the maximum value from a sequence of positive numbers. You should ask the user to
input a sequence of positive numbers (it is OK if they repeat numbers). The end of the sequence is
determined when the user enters a negative number. You should print out the maximum number from the
sequence.
See output for several examples (user input is in red)
— Task 3: The Maximum —-
Keep entering positive numbers.
To quit, input enter a negative number.
Enter a number: 10
Enter a number: 15
Enter a number: 11
Enter a number: 0
Enter a number: 88
Enter a number: 15
Enter a number: 33
Enter a number: 8
Enter a number: -1
Largest number entered 88
— Task 3: The Maximum —-
Keep entering positive numbers.
To quit, input enter a negative number.
Enter a number: 1039
Enter a number: 2029
Enter a number: 3333
Enter a number: 40
Enter a number: 109
Enter a number: 5555
Enter a number: -1
Largest number entered 5555
Your output should look like that shown here. Also see accompanying video.
Example video for the lab: https://www.eecs.yorku.ca/~mbrown/EECS1015_Lab3.mp4
Page 5/9
Task 4: String triangle
Goal: Input a string. Based on the inputted string, print out a triangle as shown below. Note that case where
string only is a single character (last example).
See output for several examples (user input is in red)
— Task 4: String triangle —
Type in a string: EECS1015
E
EE
EEC
EECS
EECS1
EECS10
EECS101
EECS1015
EECS101
EECS10
EECS1
EECS
EEC
EE
E
— Task 4: String triangle —
Type in a string: ******
*
**
***
****
*****
******
*****
****
***
**
*
— Task 4: String triangle —
Type in a string: ^^
^
^^
^
— Task 4: String triangle —
Type in a string: X
X
Example video for the lab: https://www.eecs.yorku.ca/~mbrown/EECS1015_Lab3.mp4
Page 6/9
3. GRADING SCHEME (Maximum number of points possible 10)
This lab is more challenging than lab 2. However, the notes and trinkets examples are all sufficient to help
you do this lab. To get full marks you need to make sure you follow the instructions correctly. The following
will be our grading scheme for the Lab components specified in Section 2 of this document.
Task 0: (0 points, but deduction if you skip this part)
File name must be “lab3.py” (all lowercase, no spaces)
The Python comments at the beginning of your program must include your name, email, and York
student id (this is important for grading)
If your file name is incorrect, your or do not put in the required information we will deduct -5 points
(Why are we so harsh? Because if you don’t put in your name and student id it can be very difficult for
the TAs to determine whose submission this is.)
Task 1-4: (2.5 points each)
Each task should prompt the user correctly and compute the required output correctly.
Please watch the accompanying video.
-No submission – 0 points
-Any submission 1 week after the due date 50% off the total marks
-Any submission 2 weeks after the due date will not be marked and treated as no submission.
See pages below on how to submit your lab code.
MAKE SURE TO SELECT Lab3 with websubmit
Page 7/9
4. SUBMISSIONS (EECS web-submit)
You will submit your lab using the EECS web submit.
Click on the follow URL: https://webapp.eecs.yorku.ca/submit
STEP 1 — If you don’t have an EECS account,
click here to use Passport York (everyone
has a passport York account).
If you do have an EECS account, enter here
and go to STEP 3.
STEP 1 — If you don’t have an EECS account,
click here to use Passport York (everyone
has a passport York account).
If you do have an EECS account, enter here
and go to STEP 3.
STEP 1 — If you don’t have an EECS account,
click here to use Passport York (everyone
has a passport York account).
If you do have an EECS account, enter here
and go to STEP 3.
STEP 2 – Enter your passport York
username/password.
Page 8/9
STEP 3 – Select the correct menu option
as follows. Term “F”, Course “1015”,
Assignment “Lab3”.
STEP 3 cont’ – Select your file. The location
in PyCharm may be complicated. I
recommend you save your PyCharm Python
file to your desktop and select from there.
Remember, name your file lab3.py.
STEP 3 cont’ – once you have entered
everything above, click “Submit Files”.
STEP 4 – Confirm that you have entered
everything in correctly. If you make a
mistake here and submit to the wrong
course, or wrong lab, we won’t be able to
tell and will mark your lab as not submitted.
Please double check before clicking OK.
Lab 3
lab3.py
Page 9/9
For more details on websubmit, see EECS department instructions:
https://wiki.eecs.yorku.ca/dept/tdb/services:submit:websubmit