This repository has been archived on 2026-02-27. You can view files and clone it. You cannot open issues or pull requests or push a commit.
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:38:55 -05:00
2026-02-27 12:38:55 -05:00
2026-02-27 12:38:55 -05:00
2026-02-27 12:43:17 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00
2026-02-27 12:56:12 -05:00

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

S
Description
2nd test in my computer hardware class's software unit
Readme 32 KiB
Languages
Python 100%