حالت آفلاین — محتوا از حافظهٔ کش نمایش داده می‌شود

محاسبه حقوق فروشنده

تمرین آسان 1555 visibility link download flag

برنامه ای بنویسید که تعداد کالاهای فروخته شده توسط فروشنده را دریافت کرده و حقوق او را بر اساس فرمول زیر محاسبه و چاپ کند:

هر فروشنده برای فروش ۵۰ کالای اول، به ازای هر کالا ۲۰۰۰۰ تومان دریافت می‌کند
اگر تعداد کالاهای فروخته شده بیش از ۵۰ باشد، به ازای هر کالای اضافه، ۴۰۰۰۰ تومان دریافت خواهد کرد

reply 27

visibility
sold_items = int(input("تعداد کالاهای فروخته شده را وارد کنید: "))
if sold_items <= 50:
    salary = sold_items * 20000
else:
    salary = (50 * 20000) + ((sold_items - 50) * 40000)
print("حقوق فروشنده:", salary, "تومان")
kala=int(input())
if kala <= 50 :
    hoghogh=kala*20000
elif kala>50:
    #kala ha ta 50 adad 20hezar bodan balaye 50 b ezaye har kalaye (ezafe) 40 tomani mishe pas 50 avali 20 tomni va az on b bad ro 40 tomni mohasebe miknim
    kalajadid=(kala-50)*40000
    #hala pol 50 taye aval k 20 tomni bod (yani yek melion )ro bhsh ezafe miknim
    hoghogh=1000000+kalajadid
print(hoghogh)
try:
    kala = int(input("Enter the number of items sold: "))
    if kala <= 0:
        print("ٍError: Invalid value")
    elif kala <= 50:
        hoghough = kala * 20000
        a = hoghough
        print(f"hoghough = {kala} * 20000 =", hoghough, "Toman")
    else:
        ezafeh = kala - 50
        kala = 50
        hoghough = (kala * 20000 ) + (ezafeh * 40000)
        print(f"hoghough = ({kala} * 20000) + ({ezafeh} * 40000 )=", hoghough, "Toman")
except:
    print("ERROR")
def mohasebe_hoghogh(kala):
    if kala <= 50:
        return kala * 20000
    elif kala > 50:
        ezafe = kala - 50
        kala = 50
        return (kala * 20000)+(ezafe * 40000)
while 1:
    try: 
        kala = int(input('tedad kalaye frokhte shode: '))
        print(f"hoghogh shoma dar in mah: {mohasebe_hoghogh(kala)}")
        break
    except:
        print('adad vared konid')
num = int(input("hoghooghe forooshandeh:"))
if num > 50 :
    num1 = num - 50
    print ("hoghoogh forooshandeh:" , 50 * 20000 + num1 * 40000)
    print ("movafagh bashid")
if num < 50 :
    print ("hoghooghe forooshandeh:" , num * 20000)
    print ("movafagh bashid")
def calculation_seller_rights(num_goods):
    while True:
        if num_goods > 0 and num_goods <= 50:
            print(f"Number of goods: {num_goods}\nAmount received: {num_goods * 20000} Toman")
        elif num_goods > 50:
            print(f"Number of goods: {num_goods}\nAmount received: {num_goods * 40000} Toman")
        else:
            print("Please enter the correct product number!!")
            calculation_seller_rights(int(input("Enter the number of goods: ")))
        break
calculation_seller_rights(int(input("Enter the number of goods: ")))
<< صفحه قبل 1 2 3 صفحه بعد >>

ارسال جواب

جوابت را با Markdown بنویس و ثبت کن

×
بستن