Class 5 – Friday, January 25
It's all about you
Show understanding — Put it altogether now — Yes you all can do
The #metoo movement — Calls out to everyone — Female Lives Matter
Look both ways
Agenda
- Demontrate your own chresthomatics abilities by solving and submiting problem solutions before the end of class.
Right now
Please help us help you
- If you did not take the survey last time please do
Galleries
- Nothing but the truth
Enlightening examples
- Shows the proper way of converting the splitting of a string made up of numberic characters into individual numbers.
- Introduces the string member function
split()
. Its called a member because every string can be called upon to produce a split up version of itself. The value of asplit()
invocation is the list of substrings (words) that make up the string being told tosplit()
. The function is handy for breaking up user input into its individual parts.
- The final version of the program shows that every string has a member function for inspecting itself. The
split()
function hands back the list of words that make up the string.
- Uses the built-in cast functions
int()
andfloat()
to convert numeric strings into the numbers they represent.
- The final version of the program shows the two casts using built-in functions
int()
andfloat()
to convert the supplied string-based inputs into numerics.
Homework requirement
- A numeric value display must be from the value of a variable; i.e., there will never be arithmetic calculations within a
print()
statement.
- All variables should be named indicating their purpose/usage.
- Always end each prompt with a space; e.g.,
input( 'What is something you consume daily?: ' )
Homework warning
- The testing of your programs will use inputs different from those shown in problem discussion.
In-class homework requirements
- Demonstrate to a classmate that you have met the problem specifications. Identify those person(s) as part of the header comments for your programs.
- Ensure your checkers have also been successfully checked out by somebody(s).
Program complimenter.py
- For a single user-supplied integer age, print out a tasteful compliment based on the supplied age.
-
Requirements
- The faux (complimentary) age is the user-supplied age minus five years.
- The faux age is to be integer.
- The program does not attempt to get more than one input from the user.
-
Three different program runs
- The above section header means what it literally says. The below boxes each show a different program run; i.e., your program is to perform a single age calculation each time it is run.
Enter your age: 19
You don’t even look 14
Enter your age: 111
You don’t even look 106
Enter your age: 20
You don’t even look 15
-
Suggested code outline
- Prompt user to supply an age
- Convert user reply to integer
- Compute supposed age
- Print the result of the computation
To do list
- Ensure familarity of the past by carefully examining artifacts, epistles, and videos.
- Complete homework 06 as soon as possible for your sake.