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

محاسبه تخفیف

تمرین آسان 4663 visibility link download flag trending_up پربازدید

لیستی از اجناس مختلف به همراه درصد تخفیف آنها داریم و میخواهیم بدانیم قیمت نهایی هر محصول بعد از لحاظ کردن تخفیف چقدر میشود.

برنامه ای بنویسید که همانند زیر قیمت محصول و درصد تخفیف آن را دریافت کند و قیمت نهایی و مقدار تخفیف را در خروجی چاپ کند.

تا وقتی کاربر عدد 0 وارد نکرده است برنامه باید ادامه یابد


gheymat mahsool: 10000000
darsad takhfif: 20

gheymat nahaei = 8000000
takhfif = 2000000
👨‍💻 5 ساعت قبل کاربر ناشناس این تمرین رو مشاهده کرد

reply 16

visibility
while 1:
    price = int(input('gheymat mahsol: '))

    if price == 0 :
        break
    elif price < 0 :
        print("gheymat nabayad kochek tar az 0 bashad")
        continue

    off = int(input('darsad takhfif: '))

    if off > 100 or off < 0:
        print('darsad bayad beyne 0 ta 100 bashad dobare emtehan kon')
        continue

    takhfif = (price * off)/100
    gheymat_akhar = price - takhfif
    print(f"gheymat nahayi kala {gheymat_akhar} \n takhfif{takhfif}")
import os 
while True:
    product_price = int(input('Enter product price : '))
    if product_price == 0:
        break
    discount = int(input('Enter discount : '))
    discount_price = discount * product_price / 100
    final_product_price = product_price - discount_price
    print(f'final price is {final_product_price}')
    print(f'discount price is {discount_price}')
    input('Top to continue ... ')
    os.system('cls')
f=0
a=0
while 1:
   i =int(input('geymat jens chande:'))
   a+=i
   takhfif=20
   darsad=100
   b=i*takhfif/darsad
   f+=b
   if i ==0:
    break
print(int(f),' darsade takhfife shoma')
print(int(a-f),' geymate nahayie jens')
while 1:
     gheymat = int(input("gheymat ra vared konid: "))
     if gheymat == 0:
          break
     takhfif = int(input("takhfif ra vared konid: "))
     if takhfif > 100:
          print("error")
          break
     baghi_mande = 100 - takhfif
     gheymat_nahayi = baghi_mande/100*gheymat
     print("=====================================")
     print("-----------------{}---------------".format(gheymat_nahayi))
     print("=====================================")
while True:
    a=int(input("ghemat: "))
    b=int(input("takhfif: "))
    c=b/100
    d=(a*c)
    print("mablagh ghabel pardakht"+str(a-d))
    print("mablagh kasr shode="+str(a-(a-d)))
    e=input("baray payan adad sefr ra vared konid: ")
    if e=="0":
        break
while 1:
    gheymate_mahsoul = float(input("lotfan gheymate mahsoul ra vared konoid(toman): "))
    darsad_takhfif = float(input("lotfan darsade takhfif ra vared konoid:  % "))
    takhfif = gheymate_mahsoul * (darsad_takhfif / 100)
    gheymate_nahaee = gheymate_mahsoul - takhfif
    if gheymate_mahsoul == 0:
        break
    print("gheymate mahsoul = ", gheymate_mahsoul, "toman \n", "darsade takhfif = ", darsad_takhfif,"%")
    print("gheymate nahaee = ", gheymate_nahaee, "toman" , "\n", "takhfif = ", takhfif, "toman")
while True:
    a=float(input("Please enter the original price of the product:\n"))
    if a==0:
        break
    else:
        b=float(input("Please enter the product discount percentage:\n"))
        print(f"Product discount amount: {(a*b)/100}\nThe final amount of the product: {a-((a*b)/100)}")
        continue
while 1 :
    price=float(input('price($) : '))
    discount =float(input('discount(%) : '))
    new_price=price - (price/100 *discount)
    if discount  in range(-1,101):
        print(new_price,'$')
    else :
        print('erorr')
def D(a, b):
    return a - b
def C(u, g):
    w = u / 100 
    return w * g   
while True:
    t = float(input("gheymat :"))
    if t == 0:
        break
    v = float(input('darsad takhfif : '))
    if t == 0:
        break
    k = C(t, v)
    print("-------------------------------")
    print('gheimat akhar :',D(t, k))
    print('takhfif : ', k)
    print("-------------------------------")
<< صفحه قبل 1 2 صفحه بعد >>

ارسال جواب

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

×
بستن