English
Tasks
Complete the task of the chosen difficulty level for your variant number.
For every level, provide a UML class diagram with attribute types, method signatures, and relationships. Represent the _name and __name conventions in the diagram and explain their meaning in Python. Validation belongs to the model; leave input and print to the external interface. For the advanced level, support a CLI and keyboard menu, --help, structured --item arguments with documented fields, stderr and code 2 for invalid input; success uses code 0. Reports contain aligned object rows and totals. All rates and physical coefficients are for learning purposes; no external accounts are used.
Variants
Variant 1. Car and garage
1. Initial level. Create a Python 3.14 console program with a Car class that reads a make, mileage of 0..1000000 km, and fuel of 0..60 l. Implement an initializer, annotations, and this operation: a trip of d km consumes 0.08*d liters and increases mileage; reject insufficient fuel. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Car class that reads a make, mileage of 0..1000000 km, and fuel of 0..60 l. Implement an initializer, annotations, and this operation: a trip of d km consumes 0.08*d liters and increases mileage; reject insufficient fuel. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Car class that reads a make, mileage of 0..1000000 km, and fuel of 0..60 l. Implement an initializer, annotations, and this operation: a trip of d km consumes 0.08*d liters and increases mileage; reject insufficient fuel. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Garage aggregates up to 10 cars; add cars, find them by make, and show total mileage. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 2. Smartphone
1. Initial level. Create a Python 3.14 console program with a Phone class that reads a model and charge of 0..100. Implement an initializer, annotations, and this operation: charging adds percentage points up to 100; use subtracts charge without allowing it to become negative. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Phone class that reads a model and charge of 0..100. Implement an initializer, annotations, and this operation: charging adds percentage points up to 100; use subtracts charge without allowing it to become negative. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Phone class that reads a model and charge of 0..100. Implement an initializer, annotations, and this operation: charging adds percentage points up to 100; use subtracts charge without allowing it to become negative. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Phone has a separate list of application names; a classmethod reads model:charge, and duplicate applications are rejected. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 3. Recipe
1. Initial level. Create a Python 3.14 console program with a Recipe class that reads a name, 1..20 servings, and an ingredient mass of 1..5000 g. Implement an initializer, annotations, and this operation: scaling changes masses in proportion to the new serving count. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Recipe class that reads a name, 1..20 servings, and an ingredient mass of 1..5000 g. Implement an initializer, annotations, and this operation: scaling changes masses in proportion to the new serving count. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Recipe class that reads a name, 1..20 servings, and an ingredient mass of 1..5000 g. Implement an initializer, annotations, and this operation: scaling changes masses in proportion to the new serving count. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Recipe owns a list of Ingredient objects with a name, mass, and kcal per 100 g; calculate total calories. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 4. Sample bank card
1. Initial level. Create a Python 3.14 console program with a Card class that reads a name, a balance of 0..100000 kopiykas, and a daily limit of 0..10000 kopiykas. Implement an initializer, annotations, and this operation: a withdrawal reduces the balance but does not exceed the balance or unused limit. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Card class that reads a name, a balance of 0..100000 kopiykas, and a daily limit of 0..10000 kopiykas. Implement an initializer, annotations, and this operation: a withdrawal reduces the balance but does not exceed the balance or unused limit. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Card class that reads a name, a balance of 0..100000 kopiykas, and a daily limit of 0..10000 kopiykas. Implement an initializer, annotations, and this operation: a withdrawal reduces the balance but does not exceed the balance or unused limit. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: store a private sample 4-digit PIN and transaction history; a separate command starts a new day, and there are no real payments. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 5. Aquarium
1. Initial level. Create a Python 3.14 console program with a Aquarium class that reads a name and a volume of 10..1000 l. Implement an initializer, annotations, and this operation: adding a fish increases the count; use a sample allowance of 10 l per fish. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Aquarium class that reads a name and a volume of 10..1000 l. Implement an initializer, annotations, and this operation: adding a fish increases the count; use a sample allowance of 10 l per fish. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Aquarium class that reads a name and a volume of 10..1000 l. Implement an initializer, annotations, and this operation: adding a fish increases the count; use a sample allowance of 10 l per fish. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Fish has a species and a predator flag; Aquarium aggregates fish, prohibits mixing predators and nonpredators, and reports capacity use. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 6. Thermostat
1. Initial level. Create a Python 3.14 console program with a Thermostat class that reads current and target temperatures in 5..35. Implement an initializer, annotations, and this operation: the target-temperature setter checks the bounds; the mode is heat if the current temperature is below the target, otherwise idle. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Thermostat class that reads current and target temperatures in 5..35. Implement an initializer, annotations, and this operation: the target-temperature setter checks the bounds; the mode is heat if the current temperature is below the target, otherwise idle. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Thermostat class that reads current and target temperatures in 5..35. Implement an initializer, annotations, and this operation: the target-temperature setter checks the bounds; the mode is heat if the current temperature is below the target, otherwise idle. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the change history stores old and new values; the menu manages up to 5 independent thermostats. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 7. Library card
1. Initial level. Create a Python 3.14 console program with a ReaderCard class that reads a name and a loan limit of 1..10. Implement an initializer, annotations, and this operation: lend and return a book title, prohibiting duplicates and exceeding the limit. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a ReaderCard class that reads a name and a loan limit of 1..10. Implement an initializer, annotations, and this operation: lend and return a book title, prohibiting duplicates and exceeding the limit. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a ReaderCard class that reads a name and a loan limit of 1..10. Implement an initializer, annotations, and this operation: lend and return a book title, prohibiting duplicates and exceeding the limit. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Book objects are created independently; aggregate books with due dates and calculate a sample fine of 200 kopiykas/day as of a specified date. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 8. Coffee machine
1. Initial level. Create a Python 3.14 console program with a CoffeeMachine class that reads water of 0..2000 ml and coffee of 0..500 g. Implement an initializer, annotations, and this operation: an espresso consumes 30 ml and 8 g; leave state unchanged if supplies are insufficient. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a CoffeeMachine class that reads water of 0..2000 ml and coffee of 0..500 g. Implement an initializer, annotations, and this operation: an espresso consumes 30 ml and 8 g; leave state unchanged if supplies are insufficient. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a CoffeeMachine class that reads water of 0..2000 ml and coffee of 0..500 g. Implement an initializer, annotations, and this operation: an espresso consumes 30 ml and 8 g; leave state unchanged if supplies are insufficient. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a staticmethod returns the recipe for espresso or americano, 60 ml/8 g; the menu refills reservoirs and counts prepared drinks. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 9. Hiking trip
1. Initial level. Create a Python 3.14 console program with a Hike class that reads a name and a length of 1..100 km. Implement an initializer, annotations, and this operation: add a participant with equipment weighing 0..30 kg and print total weight. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Hike class that reads a name and a length of 1..100 km. Implement an initializer, annotations, and this operation: add a participant with equipment weighing 0..30 kg and print total weight. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Hike class that reads a name and a length of 1..100 km. Implement an initializer, annotations, and this operation: add a participant with equipment weighing 0..30 kg and print total weight. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Backpack owns Item objects with a name and mass; Hike aggregates participants, checks backpack limits, and produces a distribution. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 10. Electronic ticket
1. Initial level. Create a Python 3.14 console program with a Ticket class that reads a trip code and a seat in 1..60. Implement an initializer, annotations, and this operation: change the seat after validating the range. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Ticket class that reads a trip code and a seat in 1..60. Implement an initializer, annotations, and this operation: change the seat after validating the range. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Ticket class that reads a trip code and a seat in 1..60. Implement an initializer, annotations, and this operation: change the seat after validating the range. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a classmethod reads trip:seat; Trip aggregates tickets and prohibits duplicate seats on one trip. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 11. Point and segment
1. Initial level. Create a Python 3.14 console program with a Segment class that reads coordinates of two points from -100 to 100. Implement an initializer, annotations, and this operation: properties return the segment's length and midpoint. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Segment class that reads coordinates of two points from -100 to 100. Implement an initializer, annotations, and this operation: properties return the segment's length and midpoint. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Segment class that reads coordinates of two points from -100 to 100. Implement an initializer, annotations, and this operation: properties return the segment's length and midpoint. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Point objects are independent; Segment aggregates points, and a staticmethod calculates distance; add intersection checking only for horizontal and vertical segments. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 12. Alarm clock
1. Initial level. Create a Python 3.14 console program with a Alarm class that reads a time HH:MM and an enabled flag. Implement an initializer, annotations, and this operation: add an integer number of minutes, normalizing within a day. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Alarm class that reads a time HH:MM and an enabled flag. Implement an initializer, annotations, and this operation: add an integer number of minutes, normalizing within a day. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Alarm class that reads a time HH:MM and an enabled flag. Implement an initializer, annotations, and this operation: add an integer number of minutes, normalizing within a day. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a classmethod reads the time; a list of days 1..7 defines repetition, and the menu checks whether the alarm triggers for an entered day and time. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 13. Guitar
1. Initial level. Create a Python 3.14 console program with a Guitar class that reads a name and frequencies of 6 strings in 20..1000 Hz. Implement an initializer, annotations, and this operation: tune string 1..6; a property returns the average frequency. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Guitar class that reads a name and frequencies of 6 strings in 20..1000 Hz. Implement an initializer, annotations, and this operation: tune string 1..6; a property returns the average frequency. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Guitar class that reads a name and frequencies of 6 strings in 20..1000 Hz. Implement an initializer, annotations, and this operation: tune string 1..6; a property returns the average frequency. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: String objects are created inside Guitar; check tuning against sample frequencies 82.41, 110, 146.83, 196, 246.94, 329.63 with a tolerance of 1 Hz. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 14. Sports team
1. Initial level. Create a Python 3.14 console program with a Team class that reads a name and a capacity of 1..20. Implement an initializer, annotations, and this operation: add a player aged 16..80 and 140..230 cm tall; reject exceeding capacity. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Team class that reads a name and a capacity of 1..20. Implement an initializer, annotations, and this operation: add a player aged 16..80 and 140..230 cm tall; reject exceeding capacity. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Team class that reads a name and a capacity of 1..20. Implement an initializer, annotations, and this operation: add a player aged 16..80 and 140..230 cm tall; reject exceeding capacity. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Player objects are independent and Team aggregates them; provide average-age and average-height properties, name lookup, and a roster. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 15. Invoice
1. Initial level. Create a Python 3.14 console program with a Invoice class that reads a number and a sample VAT rate of 0..30 percent. Implement an initializer, annotations, and this operation: add an item with a price in kopiykas and a quantity of 1..100; calculate the total. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Invoice class that reads a number and a sample VAT rate of 0..30 percent. Implement an initializer, annotations, and this operation: add an item with a price in kopiykas and a quantity of 1..100; calculate the total. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Invoice class that reads a number and a sample VAT rate of 0..30 percent. Implement an initializer, annotations, and this operation: add an item with a price in kopiykas and a quantity of 1..100; calculate the total. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Invoice owns Line objects; apply a discount of 0..50 percent before VAT, round down to a kopiyka, and include the base, discount, tax, and payment in the report. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 16. Greenhouse
1. Initial level. Create a Python 3.14 console program with a Greenhouse class that reads a name and humidity of 0..100. Implement an initializer, annotations, and this operation: watering adds 10 percentage points without exceeding 100. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Greenhouse class that reads a name and humidity of 0..100. Implement an initializer, annotations, and this operation: watering adds 10 percentage points without exceeding 100. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Greenhouse class that reads a name and humidity of 0..100. Implement an initializer, annotations, and this operation: watering adds 10 percentage points without exceeding 100. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the greenhouse aggregates Plant objects, each with a desired minimum humidity; the report shows plants that need more moisture. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 17. Hero's backpack
1. Initial level. Create a Python 3.14 console program with a Backpack class that reads an owner and a capacity of 1..100 kg. Implement an initializer, annotations, and this operation: add or remove an item with a unique name and a mass of 0.1..20 kg. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Backpack class that reads an owner and a capacity of 1..100 kg. Implement an initializer, annotations, and this operation: add or remove an item with a unique name and a mass of 0.1..20 kg. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Backpack class that reads an owner and a capacity of 1..100 kg. Implement an initializer, annotations, and this operation: add or remove an item with a unique name and a mass of 0.1..20 kg. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Item has a creation counter and Backpack aggregates items; changes must not exceed the weight limit, and the report includes remaining capacity. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 18. Sample patient card
1. Initial level. Create a Python 3.14 console program with a PatientCard class that reads a fictional name, mass of 1..300 kg, and height of 0.5..2.5 m. Implement an initializer, annotations, and this operation: a property calculates only the numeric BMI without diagnoses. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a PatientCard class that reads a fictional name, mass of 1..300 kg, and height of 0.5..2.5 m. Implement an initializer, annotations, and this operation: a property calculates only the numeric BMI without diagnoses. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a PatientCard class that reads a fictional name, mass of 1..300 kg, and height of 0.5..2.5 m. Implement an initializer, annotations, and this operation: a property calculates only the numeric BMI without diagnoses. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the card creates Visit objects with a date and a sample note; the private code does not appear in repr, the report includes the visit count, and all data is synthetic. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 19. Room renovation
1. Initial level. Create a Python 3.14 console program with a Room class that reads a length of 1..20 m, width of 1..20 m, and height of 2..5 m. Implement an initializer, annotations, and this operation: a property returns the area of four walls. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Room class that reads a length of 1..20 m, width of 1..20 m, and height of 2..5 m. Implement an initializer, annotations, and this operation: a property returns the area of four walls. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Room class that reads a length of 1..20 m, width of 1..20 m, and height of 2..5 m. Implement an initializer, annotations, and this operation: a property returns the area of four walls. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a classmethod reads LxWxH; Room owns openings with areas, whose total must not exceed the wall area, and the report includes the painting area. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 20. Elevator
1. Initial level. Create a Python 3.14 console program with a Lift class that reads a floor count of 2..30 and a capacity of 100..1000 kg. Implement an initializer, annotations, and this operation: a call to floor 1..N moves the car only when the load is valid. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Lift class that reads a floor count of 2..30 and a capacity of 100..1000 kg. Implement an initializer, annotations, and this operation: a call to floor 1..N moves the car only when the load is valid. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Lift class that reads a floor count of 2..30 and a capacity of 100..1000 kg. Implement an initializer, annotations, and this operation: a call to floor 1..N moves the car only when the load is valid. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a separate instance call queue removes duplicates and processes calls in order; the report shows the route and number of transitions. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 21. Sample loan
1. Initial level. Create a Python 3.14 console program with a Loan class that reads an amount of 100..100000 UAH, a rate of 0..30 percent, and a term of 1..24 months. Implement an initializer, annotations, and this operation: calculate payments with equal principal installments and monthly interest on the remaining balance. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Loan class that reads an amount of 100..100000 UAH, a rate of 0..30 percent, and a term of 1..24 months. Implement an initializer, annotations, and this operation: calculate payments with equal principal installments and monthly interest on the remaining balance. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Loan class that reads an amount of 100..100000 UAH, a rate of 0..30 percent, and a term of 1..24 months. Implement an initializer, annotations, and this operation: calculate payments with equal principal installments and monthly interest on the remaining balance. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Loan owns ScheduleRow objects; the report includes principal, interest, balance, and totals; this is a learning model without fees. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 22. Weather station
1. Initial level. Create a Python 3.14 console program with a WeatherStation class that reads a name and a temperature from -40 to 50. Implement an initializer, annotations, and this operation: add a finite measurement; properties return the minimum and maximum. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a WeatherStation class that reads a name and a temperature from -40 to 50. Implement an initializer, annotations, and this operation: add a finite measurement; properties return the minimum and maximum. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a WeatherStation class that reads a name and a temperature from -40 to 50. Implement an initializer, annotations, and this operation: add a finite measurement; properties return the minimum and maximum. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a classmethod reads name:temperature; Measurement has a timestamp, the station owns measurements, and a report covers a specified interval. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 23. Student group
1. Initial level. Create a Python 3.14 console program with a Group class that reads a name and a capacity of 1..30. Implement an initializer, annotations, and this operation: add a student with grades in 0..100; a property returns the group average. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Group class that reads a name and a capacity of 1..30. Implement an initializer, annotations, and this operation: add a student with grades in 0..100; a property returns the group average. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Group class that reads a name and a capacity of 1..30. Implement an initializer, annotations, and this operation: add a student with grades in 0..100; a property returns the group average. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Student objects are independent and Group aggregates them; a staticmethod validates a grade, and ranking uses average with name as a tiebreaker. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 24. Apartment and meters
1. Initial level. Create a Python 3.14 console program with a Apartment class that reads a number and previous and current readings in 0..100000. Implement an initializer, annotations, and this operation: current readings cannot be less than previous readings; the payment is consumption*4 sample UAH. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Apartment class that reads a number and previous and current readings in 0..100000. Implement an initializer, annotations, and this operation: current readings cannot be less than previous readings; the payment is consumption*4 sample UAH. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Apartment class that reads a number and previous and current readings in 0..100000. Implement an initializer, annotations, and this operation: current readings cannot be less than previous readings; the payment is consumption*4 sample UAH. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the apartment creates Meter objects for water and electricity, with sample rates of 30 and 4; the report includes consumption and total, and updates are atomic. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 25. Electric scooter
1. Initial level. Create a Python 3.14 console program with a Scooter class that reads a code, charge of 0..100, and mileage of 0..10000 km. Implement an initializer, annotations, and this operation: a trip of d km consumes 2*d percentage points of charge and increases mileage. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Scooter class that reads a code, charge of 0..100, and mileage of 0..10000 km. Implement an initializer, annotations, and this operation: a trip of d km consumes 2*d percentage points of charge and increases mileage. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Scooter class that reads a code, charge of 0..100, and mileage of 0..10000 km. Implement an initializer, annotations, and this operation: a trip of d km consumes 2*d percentage points of charge and increases mileage. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the scooter creates Rental objects with a duration of 1..120 minutes and a sample payment of 10+3*t UAH; maintain history and total revenue. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 26. Music album
1. Initial level. Create a Python 3.14 console program with a Album class that reads a title and a year in 1900..2100. Implement an initializer, annotations, and this operation: add a track with a title and duration of 1..1800 seconds; a property returns total time. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Album class that reads a title and a year in 1900..2100. Implement an initializer, annotations, and this operation: add a track with a title and duration of 1..1800 seconds; a property returns total time. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Album class that reads a title and a year in 1900..2100. Implement an initializer, annotations, and this operation: add a track with a title and duration of 1..1800 seconds; a property returns total time. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the album creates Track objects; a classmethod reads title:seconds, and the menu finds and removes tracks and prints time as MM:SS. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 27. Chess piece
1. Initial level. Create a Python 3.14 console program with a Piece class that reads a name and a position in a1..h8. Implement an initializer, annotations, and this operation: the setter validates the position notation and allows moving to another square without game rules. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Piece class that reads a name and a position in a1..h8. Implement an initializer, annotations, and this operation: the setter validates the position notation and allows moving to another square without game rules. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Piece class that reads a name and a position in a1..h8. Implement an initializer, annotations, and this operation: the setter validates the position notation and allows moving to another square without game rules. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: Board aggregates Piece objects and prohibits two pieces on one square; move changes state only after validation and prints an ASCII board. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 28. Fitness tracker
1. Initial level. Create a Python 3.14 console program with a Tracker class that reads a name and a goal of 1..50000 steps. Implement an initializer, annotations, and this operation: add a nonnegative step count; a property returns progress as a percentage. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Tracker class that reads a name and a goal of 1..50000 steps. Implement an initializer, annotations, and this operation: add a nonnegative step count; a property returns progress as a percentage. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Tracker class that reads a name and a goal of 1..50000 steps. Implement an initializer, annotations, and this operation: add a nonnegative step count; a property returns progress as a percentage. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the tracker creates DayRecord objects by date; the report shows a week and total, and kcal is only a sample estimate of 0.04 per step. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 29. Movie theater
1. Initial level. Create a Python 3.14 console program with a CinemaHall class that reads a name, 1..20 rows, and 1..30 seats. Implement an initializer, annotations, and this operation: book or free a seat after checking its coordinates and state. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a CinemaHall class that reads a name, 1..20 rows, and 1..30 seats. Implement an initializer, annotations, and this operation: book or free a seat after checking its coordinates and state. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a CinemaHall class that reads a name, 1..20 rows, and 1..30 seats. Implement an initializer, annotations, and this operation: book or free a seat after checking its coordinates and state. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: the theater creates Seat objects and provides an occupancy property; the CLI accepts a series of bookings and prints a map and totals. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Variant 30. Velocity vector
1. Initial level. Create a Python 3.14 console program with a Velocity class that reads components vx and vy from -100 to 100. Implement an initializer, annotations, and this operation: properties calculate magnitude and the atan2 angle; the zero vector has direction None. Print the state and result. Provide class UML with types, methods, and relationship multiplicities.
2. Basic level. Create a Python 3.14 console program with a Velocity class that reads components vx and vy from -100 to 100. Implement an initializer, annotations, and this operation: properties calculate magnitude and the atan2 angle; the zero vector has direction None. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Provide class UML with types, methods, and relationship multiplicities.
3. Advanced level. Create a Python 3.14 console program with a Velocity class that reads components vx and vy from -100 to 100. Implement an initializer, annotations, and this operation: properties calculate magnitude and the atan2 angle; the zero vector has direction None. Print the state and result. Add a validated or computed property and ValueError for invariant violations; state must remain unchanged after rejection. Test two independent instances. Extended model: a staticmethod creates a vector from polar coordinates, Fleet aggregates up to 10 vectors, and the report includes components, magnitudes, and the resultant vector. Support --help, named parameters, and --item with documented fields; without arguments, use a keyboard menu. Errors go to stderr with code 2; success uses 0. Print a table and totals and provide five checks. Provide class UML with types, methods, and relationship multiplicities.
Procedure
- Define the class's responsibility and invariants. Draw UML before implementation, then compare it with the final code.
- Implement the initializer and methods with annotations. Create instance collections in the constructor, not in class attributes.
- Separate validation from state changes. For derived values, choose a property instead of duplicating data.
- Test two independent objects, an ordinary action, a boundary, and a rejection. After rejection, verify that the previous state is unchanged.
- Test the alternative constructor, string representation, and object relationships if your level includes them.
- Provide the code, UML, README with launch commands, and a table of at least five checks; preserve local Git history.
- During the defense, explain
self, a class attribute, a setter, and the choice of composition or aggregation. Show the state in the debugger.