Calculate User Birthday
Write a program that gets the user's age from the input and calculates and prints the user's birthday
Write a program that gets the user's age from the input and calculates and prints the user's birthday
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
let msg = 'error' alert(msg)This answer is only visible to premium members
This answer is only visible to premium members
from datetime import datetime
def calculate_birth_year():
age = int(input("Enter your age: "))
current_year = datetime.now().year
birth_year = current_year - age
print(f"Your birthyear: {birth_year}")
calculate_birth_year()
age=int(input('age:'))
a=1403
b=age-a
print('sale tavalode shoma:',b)
age = int(input("Please Enter your age: "))
print("Miladey=",2025-age)
print("Shamsy=",1404-age)
print("Ghamary=",1446-age)
a=int(input("age: "))
b=int(input("emsal: "))
c=b-a
print(c)
from datetime import datetime
age = int(input("how old are you?"))
current_year = datetime.now().year
birth_year = current_year - age
print(f"you were born at {birth_year}")
from datetime import datetime as gdt
from jdatetime import datetime as jdt
age = int(input('Enter your age: '))
print(f'Gregorian birthday: {gdt.today().year - age:2d} - Jalali birthday: {jdt.today().year - age:2d}')
from datetime import datetime
# Get User Age from Input
age = int(input("لطفاً سن خود را وارد کنید: "))
# Calculate the year of birth
current_year = datetime.now().year
birth_year = current_year - age
# Birthday printing
print("سال تولد شما برابر است با:", birth_year)
Submitting answers is currently unavailable.
You must be logged in to access this section.
Login/Sign up If you don’t understand the exercise or can’t solve it for any reason, that’s completely
normal—don’t worry 😊
Try checking out easier exercises and reviewing different answers
submitted by others. Gradually, you can move on to more challenging exercises. Also, your answer
might be correct even if it’s different from others.