diff --git a/jeet.txt b/jeet.txt index e69de29..fcd6bcb 100644 --- a/jeet.txt +++ b/jeet.txt @@ -0,0 +1 @@ +jeet011@gmail.com \ No newline at end of file diff --git a/jeet_issue_07.py b/jeet_issue_07.py new file mode 100644 index 0000000..c2b9ed8 --- /dev/null +++ b/jeet_issue_07.py @@ -0,0 +1,33 @@ +def binary_to_decimal(binary_str): + """Convert binary string to decimal integer""" + try: + return int(binary_str, 2) + except ValueError: + return "❌ Invalid binary number!" + + +def decimal_to_binary(decimal_num): + """Convert decimal integer to binary string""" + try: + return bin(int(decimal_num))[2:] # remove '0b' prefix + except ValueError: + return "❌ Invalid decimal number!" + + +# Main program +print("🔄 Binary ↔ Decimal Converter 🔄") +print("1️⃣ Binary → Decimal") +print("2️⃣ Decimal → Binary") + +choice = input("Enter your choice (1 or 2): ") + +if choice == '1': + binary = input("Enter a binary number: ") + print(f"Decimal: {binary_to_decimal(binary)}") + +elif choice == '2': + decimal = input("Enter a decimal number: ") + print(f"Binary: {decimal_to_binary(decimal)}") + +else: + print("❌ Invalid choice! Please enter 1 or 2.") diff --git a/jeet_issue_14.py b/jeet_issue_14.py new file mode 100644 index 0000000..9ab01ff --- /dev/null +++ b/jeet_issue_14.py @@ -0,0 +1,19 @@ +import random + +print("🎯 Welcome to the Number Guessing Game! 🎯") + +# Generate a random number between 1 and 100 +number = random.randint(1, 100) +attempts = 0 + +while True: + guess = int(input("Enter your guess (1-100): ")) + attempts += 1 + + if guess < number: + print("📉 Too low! Try again.") + elif guess > number: + print("📈 Too high! Try again.") + else: + print(f"🎉 Congratulations! You guessed it in {attempts} attempts.") + break diff --git a/jeet_issue_19.py b/jeet_issue_19.py new file mode 100644 index 0000000..b22fa4f --- /dev/null +++ b/jeet_issue_19.py @@ -0,0 +1,9 @@ +# Leap Year Checker + +year = int(input("Enter a year: ")) + +# Leap year conditions +if (year % 400 == 0) or (year % 100 != 0 and year % 4 == 0): + print(f"{year} is a leap year.") +else: + print(f"{year} is not a leap year.") diff --git a/jeet_issue_21.py b/jeet_issue_21.py new file mode 100644 index 0000000..1a6e6c6 --- /dev/null +++ b/jeet_issue_21.py @@ -0,0 +1,46 @@ +# Temperature Converter + +def celsius_to_fahrenheit(c): + return (c * 9/5) + 32 + +def fahrenheit_to_celsius(f): + return (f - 32) * 5/9 + +def celsius_to_kelvin(c): + return c + 273.15 + +def kelvin_to_celsius(k): + return k - 273.15 + +def fahrenheit_to_kelvin(f): + return (f - 32) * 5/9 + 273.15 + +def kelvin_to_fahrenheit(k): + return (k - 273.15) * 9/5 + 32 + + +print("=== Temperature Converter ===") +print("1. Celsius to Fahrenheit") +print("2. Fahrenheit to Celsius") +print("3. Celsius to Kelvin") +print("4. Kelvin to Celsius") +print("5. Fahrenheit to Kelvin") +print("6. Kelvin to Fahrenheit") + +choice = int(input("\nEnter your choice (1-6): ")) +temp = float(input("Enter temperature value: ")) + +if choice == 1: + print(f"{temp}°C = {celsius_to_fahrenheit(temp):.2f}°F") +elif choice == 2: + print(f"{temp}°F = {fahrenheit_to_celsius(temp):.2f}°C") +elif choice == 3: + print(f"{temp}°C = {celsius_to_kelvin(temp):.2f} K") +elif choice == 4: + print(f"{temp} K = {kelvin_to_celsius(temp):.2f}°C") +elif choice == 5: + print(f"{temp}°F = {fahrenheit_to_kelvin(temp):.2f} K") +elif choice == 6: + print(f"{temp} K = {kelvin_to_fahrenheit(temp):.2f}°F") +else: + print("Invalid choice! Please select a number between 1 and 6.")