Application#
How to Submit#
Your answers to this chapter’s application questions should be added to the notebook template.
Google Colab link (ND users only)
Submit the Colab link on Canvas for the assignment submission.
Application Questions#
Q1: Create a named variable for each of the following data types.
Integer
Float
String
Boolean
Show the value of each variable using print() and check the type of each variable using type().
Answer to this question includes program + comments that document process and explain your code.
Q2: Write programs (or a single program) that use each of the following arithmetic operators at least once.
Addition
Subtraction
Multiplication
Division
Modulus
Exponents
You can write separate calculations with single operators, or calculations that use multiple operators.
Answer to this question includes program + comments that document process and explain your code.
Q3: Write a program that uses arithmetic operators to convert a specific Farenheit temperature value and output its Celsius representation. Answer to this question includes program + comments that document process and explain your code.
The conversion equation is: celsius = (fahrenheit - 32.0) * 5.0 / 9.0
Q4: Create variables for each of the discrete pieces of information in “the standard Notre Dame introduction.”
Name
Class year
Home state/country
Major(s) / minor(s)
Residence hall
Use concatenation in combination with a print() statement to output a narrative introduction using the named variables.
Answer to this question includes program + comments that document process and explain your code.
Sample output for this program:
I'm Knute Rockne, class of 1914. I'm majoring in pharmacy and originally from Norway but grew up in Chicago. I live in Sorin Hall.
Q5: Write a program that creates first_name and last_name variables, and then uses concatenation to output a full_name variable. Answer to this question includes program + comments that document process and explain your code.
Q6: Write a program that asks the user to enter their favorite color, and then prints a "Your favorite color is..." message. Answer to this question includes program + comments that document process and explain your code.
Q7: Write a program that accepts user input for the discrete pieces of information in “the standard Notre Dame introduction.”
Name
Class year
Home state/country
Major(s) / minor(s)
Residence hall
Use concatenation in combination with a print() statement to output a narrative introduction using the named variables.
Answer to this question includes program + comments that document process and explain your code.
Sample output for this program:
Knute Rockne, class of 1918, is majoring in pharmacy. He is originally from Norway but grew up in Chicago. He lives in Sorin Hall.
Q8: Write a program that prompts the user to enter two numbers, converts the input values to integers, adds them, and reports the result. Answer to this question includes program + comments that document process and explain your code.
Q9: Write a program that asks the user to think of a month and then enter the number of days in that month. Your program should then compute the number of minutes in the month, and report the result. Answer to this question includes program + comments that document process and explain your code.
Q10: Write a program that prompts the user to enter a temperature in Fahrenheit, and reports the equivalent temperature in Celsius. Answer to this question includes program + comments that document process and explain your code.
Q11: Write a program that uses each of Python’s comparison operators (==, !=, >, <, >=, <=) to compare two numeric values. Answer to this question includes program + comments that document process and explain your code.
Outline for this program:
# first numeric value
# second numeric value
# equal
# not equal
# greater than
# less than
# greater than or equal to
# less than or equal to
Q12: Write a program that uses each of Python’s comparison operators (==, !=, >, <, >=, <=) to compare two string objects. Answer to this question includes program + comments that document process and explain your code.
Outline for this program:
# first string object
# second string object
# equal
# not equal
# greater than
# less than
# greater than or equal to
# less than or equal to
Q13: Write a program that uses Python’s comparison operators (==, !=, >, <, >=, <=) to compare at least three (3) numeric values. Answer to this question includes program + comments that document process and explain your code.
Outline for this program:
# first numeric value
# second numeric value
# third numeric value
# complex comparison statement
Q14: Write a program that uses Python’s comparison operators (==, !=, >, <, >=, <=) to compare at least three (3) string objects. Answer to this question includes program + comments that document process and explain your code.
Outline for this program:
# first string object
# second string object
# third string object
# complex comparison statement