diff --git a/Age-Calculator/README.md b/Age-Calculator/README.md new file mode 100644 index 0000000..037a45e --- /dev/null +++ b/Age-Calculator/README.md @@ -0,0 +1,31 @@ +# Age Calculator – Beginner Python Project + +This is a simple Python project for beginners to calculate a person's age based on the birth year. + +## File Structure + +- `age_calculator.py` – Contains the logic to calculate age from the user's input. + +## ✅ How It Works + +1. The user is asked to enter their **birth year**. +2. The program calculates the current year using Python's `datetime` module. +3. It subtracts the birth year from the current year to get the **age**. +4. The age is then printed on the screen. + +## Skills You'll Learn + +- Taking input from users +- Working with Python's `datetime` module +- Defining and calling functions +- Basic math and string formatting + +## Run the Code + +Open terminal and run: + +```bash +python age_calculator.py + +Then enter your birth year (e.g., 2000) and get your age. +Happy Coding! 🎉 diff --git a/Age-Calculator/age_calculator.py b/Age-Calculator/age_calculator.py new file mode 100644 index 0000000..66af52e --- /dev/null +++ b/Age-Calculator/age_calculator.py @@ -0,0 +1,12 @@ +from datetime import date + +def calculate_age(birth_year): + current_year = date.today().year + age = current_year - birth_year + return age + +# Ask user for their birth year +birth_year = int(input("Enter your birth year: ")) +age = calculate_age(birth_year) + +print(f"You are {age} years old.") diff --git a/hello-world/README.md b/hello-world/README.md new file mode 100644 index 0000000..bfadca1 --- /dev/null +++ b/hello-world/README.md @@ -0,0 +1,34 @@ +# Hello World in Python + +This is a simple beginner-friendly Python project that prints a personalized "Hello, World" message. + +## File: `hello.py` + +This script asks for the user's name and prints a greeting. + +### How it works: +- Takes input from the user +- Uses a function `say_hello(name)` to return a greeting message +- Prints the final message + +### To run: +```bash +python hello.py + +Example Output: +Enter your name: Shailaja +Hello, Shailaja! Welcome to the world of open source. + + +🌟 Who is this for? +Perfect for first-time contributors to practice creating a Python script and contributing to open-source. + + +Contribution Steps: + +Fork the repo +Clone to your system +Create a branch +Add your project +Commit and push +Create a Pull Request (PR) \ No newline at end of file diff --git a/hello-world/hello.py b/hello-world/hello.py new file mode 100644 index 0000000..60a5d81 --- /dev/null +++ b/hello-world/hello.py @@ -0,0 +1,7 @@ +def say_hello(name): + return f"Hello, {name}! Welcome to the world of open source." + +# Example usage +if __name__ == "__main__": + user_name = input("Enter your name: ") + print(say_hello(user_name))