https://github.com/qtle3/age_category
This simple Python program determines and outputs the age category of a user based on their input. The user is prompted to enter their age, and the program categorizes them into one of several predefined age groups.
https://github.com/qtle3/age_category
basic-control-flow conditional-statements data-conversion user-input
Last synced: 3 months ago
JSON representation
This simple Python program determines and outputs the age category of a user based on their input. The user is prompted to enter their age, and the program categorizes them into one of several predefined age groups.
- Host: GitHub
- URL: https://github.com/qtle3/age_category
- Owner: qtle3
- Created: 2024-07-27T02:43:24.000Z (over 1 year ago)
- Default Branch: main
- Last Pushed: 2024-07-27T03:03:14.000Z (over 1 year ago)
- Last Synced: 2025-02-14T16:01:51.374Z (10 months ago)
- Topics: basic-control-flow, conditional-statements, data-conversion, user-input
- Language: Python
- Homepage:
- Size: 1.95 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
Awesome Lists containing this project
README
# Age Category Program
This simple Python program determines and outputs the age category of a user based on their input. The user is prompted to enter their age, and the program categorizes them into one of several predefined age groups.
## Key Features
### User Input
- The program prompts the user to enter their age.
- The age is read as a floating-point number to handle possible fractional ages.
### Condition Statements
- The program uses a series of if, elif, and else statements to categorize the age into one of the following groups:
- **Not Born Yet:** Age less than 0.
- **Child:** Age between 0 and 12.
- **Teenager:** Age between 13 and 19.
- **Young Adult:** Age between 20 and 29.
- **Adult:** Age between 30 and 64.
- **Senior:** Age 65 and above.
### Output
- The program prints the corresponding age category based on the input.
- A farewell message, "Bye!", is printed at the end.
## Key Concepts Covered
- **User Input:** Using `input()` to read data from the user.
- **Data Conversion:** Converting the input to a floating-point number using `float()`.
- **Conditional Statements:** Using `if`, `elif`, and `else` to handle different conditions.
- **Basic Control Flow:** Demonstrating the flow of a simple program with user interaction and decision-making.