Performance 2
Instructions: Use input(), math operators (+, -, *, /, //, **, %), and your choice of string formatting (f-strings, .format(), or %) to solve the following.
Task 1: The Personal Greeting
Ask the user for their name and their favorite hobby. Print a sentence like:
"Hi [Name], it's cool that you enjoy [Hobby]!"
Constraint: Use an f-string to display the message.
Task 2: The Rectangle Calculator
Ask the user for the length and width of a rectangle. Calculate the area (Area = length * width).
Constraint: Use .format() to display the result as: The area of a [L]x[W] rectangle is: [Area].
Task 3: The Shopping Trip
Ask the user for the name of an item, its price (as a float), and the quantity they bought.
Constraint: Use % formatting to print a receipt line: Item: [Name] | Total: $[Price].
Task 4: The Exponent Explorer
Ask the user for a "Base" number and an "Exponent" number. Calculate the result.
Constraint: Display the output using an f-string in this format: [Base] to the power of [Exponent] is [Result].
Task 5: The Modulo Mystery
Ask the user for a large whole number. Use the % operator to determine if it is even or odd (Hint: a number % 2 returns 0 if even, 1 if odd).
Constraint: Print only the result of the calculation followed by the text: (0 means even, 1 means odd).
Task 6: The "Fancy" Name Tag
Ask the user for their first name. Print the name centered between 10 dashes on each side.
Example Output: ---------- Alex ----------
Constraint: Use string multiplication ("-" * 10) and a single print command.
Task 7: The Money Splitter
Ask for a total bill amount and the number of people at the table. Calculate how much each person owes.
Constraint: Use f-strings to show the result.
Task 8: The Length Checker
Ask the user to enter a secret password. Tell them how many characters are in that password.
Constraint: Use .format() and the len() function.
Task 9: Decimal Limiter
Ask the user for a number like 10 and divide it by 3.
Constraint: Use f-string formatting to display the result rounded to 2 decimal places (Hint: {value:.2f}).
Task 10: The Digit Extractor
Ask the user for a two-digit number (e.g., 47). Using only // and %, separate the number into its tens and ones.
Example Output: The tens digit is 4 and the ones digit is 7.
Constraint: You cannot treat the input as a string; you must convert it to an int first.
Task 11
Write a program to display a banner for a user entering their name. So, for example, if the user enters the name âXephosâ, this lovely banner could appear:
------------
.::Xephos::.
------------
Task 12:
Stella was half of John's age when John was 6. Now John is 18, how old is Stella now? Write a program to help people solve this problem. Make sure you include the function input() into your program