File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 22gpa = float (input ('What was your Grade Point Average? ' ))
33lowest_grade = float (input ('What was your lowest grade? ' ))
44
5+ # Boolean variables allow you to remember a True/False value
56if gpa >= .85 and lowest_grade >= .70 :
67 honour_roll = True
78else :
Original file line number Diff line number Diff line change 1+ # When you join a hockey team you get your name on the back of the jersey
2+ # but the jersey may not be big enough to hold all the letters
3+ # Ask the user for their first name
4+
5+ # Ask the user for their last name
6+
7+ # if first name is < 10 characters and last name is < 10 characters
8+ # print first and last name on the jersey
9+ # if first name >= 10 characters long and last name is < 10 characters
10+ # print first initial of first name and the entire last name
11+ # if first name < 10 characters long and last name is >= 10 characters
12+ # print entire first name and first initial of last name
13+ # if first name >= 10 characters long and last name is >= 10 characters
14+ # print last name only
15+
16+ # Test with the following values
17+ # first name: Susan last name: Ibach
18+ # output: Susan Ibach
19+ # first name: Susan last name: ReallyLongLastName
20+ # output: Susan R.
21+ # first name: ReallyLongFirstName last name: Ibach
22+ # output: R. Ibach
23+ # first name: ReallyLongFirstName last name: ReallyLongLastName
24+ # output: ReallyLongLastName
Original file line number Diff line number Diff line change 1+ # When you join a hockey team you get your name on the back of the jersey
2+ # but the jersey may not be big enough to hold all the letters
3+ # Ask the user for their first name
4+ first_name = input ('Please enter your first name: ' )
5+ # Ask the user for their last name
6+ last_name = input ('Please enter your last name: ' )
7+
8+ # if first name is < 10 characters and last name is < 10 characters
9+ # print first and last name on the jersey
10+ # if first name >= 10 characters long and last name is < 10 characters
11+ # print first initial of first name and the entire last name
12+ # if first name < 10 characters long and last name is >= 10 characters
13+ # print entire first name and first initial of last name
14+ # if first name >= 10 characters long and last name is >= 10 characters
15+ # print last name only
16+
17+ # Check length of first name
18+ if len (first_name ) >= 10 :
19+ long_first_name = True
20+ else :
21+ long_first_name = False
22+
23+ # Check length of last name
24+ if len (last_name ) >= 10 :
25+ long_last_name = True
26+ else :
27+ long_last_name = False
28+
29+ # Evaluate possible jersey print combinations for different lengths
30+ if long_first_name and long_last_name :
31+ print (last_name )
32+ elif long_first_name :
33+ print (first_name [0 :1 ] + '. ' + last_name )
34+ elif long_last_name :
35+ print (first_name + ' ' + last_name [0 :1 ] + '.' )
36+ else :
37+ print (first_name + ' ' + last_name )
Load diff This file was deleted.
Load diff This file was deleted.
Load diff This file was deleted.
You can’t perform that action at this time.
0 commit comments