پایتون
bmm = int(input('enter your birthmoth : '))
bdd = int(input('enter your birthday : '))
cyy = int(input('enter now year : '))
cmm = int(input('enter now moth : '))
cdd = int(input('enter now day : '))
# -------------------------------
def mosbat (x):
if x > ۰ :
x * -۱
# -------------------------------
year = cyy - byy
r = cmm - bmm
moth = year * ۱۲ + (mosbat(int(r)))
u = cdd - bdd
a = moth // ۲
day = a * ۳۰ + a * ۳۱ + (mosbat (int(u)))
print("your age to year is: " , year , '''
''' , "your age to moth is: " , moth ,'''
''' , "your age to day is: " , day) bmm = int(input('enter your birthmoth : '))
bdd = int(input('enter your birthday : '))
cyy = int(input('enter now year : '))
cmm = int(input('enter now moth : '))
cdd = int(input('enter now day : '))
# -------------------------------
def mosbat (x):
if x > ۰ :
x * -۱
# -------------------------------
year = cyy - byy
r = cmm - bmm
moth = year * ۱۲ + (mosbat(int(r)))
u = cdd - bdd
a = moth // ۲
day = a * ۳۰ + a * ۳۱ + (mosbat (int(u)))
print("your age to year is: " , year , '''
''' , "your age to moth is: " , moth ,'''
''' , "your age to day is: " , day)
سلام . من این کد رو که اجرا می کنم ارور میده :
moth = year * ۱۲ + (mosbat(int(r)))
TypeError: unsupported operand type(s) for +: 'int' and 'NoneType'
میشه راهنمایی کنید؟


1 پاسخ
- Hossein Azimi14 مرداد ۱۴۰۱
کدتون اشکالات زیادی داره.
۱_تابع mosbat شما x رو از جایی دریافت نمیکنه.
۲_ year = cyy - byy متغییر byy اصلا وجود نداره
۳_اونجا که نوشتین (mosbat(int)(r)) + moth = year * ۱۲ نوشته mosbat(int(r)) اصلا معنی نداره
۴_مورد سوم رو تو چند خط بعد هم تکرار کردین
