محاسبه سال تولد کاربر
برنامه ای بنویسید که سن کاربر را از ورودی دریافت کند و سال تولد کاربر را محاسبه و چاپ کند
👨💻 1 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد
برنامه ای بنویسید که سن کاربر را از ورودی دریافت کند و سال تولد کاربر را محاسبه و چاپ کند
from datetime import datetime
v= eval(input("pless inter you birthday day:"))
m= eval(input("pless inter you birthday mons:"))
y= eval(input("pless inter you birthday year:"))
d = datetime.now()
D, M, Y = d.day, d.month, d.year
newday = D-v
if newday <0 :
newday = -newday
newmons = M-m
if newmons < 0 :
newmons = -newmons
print(f"{Y-y} year and {newmons} mons {newday} day")
from datetime import datetime
age = int(input('please enter your age: '))
this_year_m = datetime.now().year
this_year_sh = this_year_m - 621
birth_year_m = this_year_m - age
birth_year_sh = this_year_sh - age
print ("birth year in miladi Is: ",birth_year_m)
print ("birth year in shamsi Is: {} - {}".format(birth_year_sh,birth_year_sh-1))
year = int(input("which year are we? "))
user_year = int(input("how old are you? "))
user_birth = year - user_year
print(user_birth)
emsal=1403
saletavalod=int(input("سال تولد خود را وارد کنید: "))
a=emsal-saletavalod
print(a)
x=int(input('Sen khod ra vared konid:'))
n=input('Emsal Che sali ast:')
y=n-x
print('Shoma motevalled',y,'hastid.')
function showYearBirthday(yourAge) {
let nowYear = new Date().getFullYear()
let showBirthday = (nowYear - yourAge)
return showBirthday;
}
//test
// console.log(showYearBirthday(21))
def year_of_birthday(age):
this_year=2024
year_of_birthd= year_of_birthday - age
return year_of_birthd
age=int(input('enter your age? \t'))
year_of_birthd=year_of_birthday(age)
print(f'if you are {age} year old, your year of birth is {year_of_birthd}')
age=int(input("How old are you?"))
thisyear=int(input("Enter this year:"))
print("Your year of birth is",thisyear-age)
user_age = int(input('enter your age : '))
thisyear=int(input('enter this year : '))
print(thisyear-user_age)
age = int(input("enter your number age:"))
year = 1403 - age
print(year)
جوابت را با Markdown بنویس و ثبت کن
برای استفاده از این بخش باید وارد حساب کاربریت بشی
ورود/ثبت نامتوضیح کوتاهی بنویسید تا تیم بررسی کند.