Şimdi Ara

Python Basit Ödev Lütfen Yardım

Daha Fazla
Bu Konudaki Kullanıcılar: Daha Az
2 Misafir - 2 Masaüstü
5 sn
4
Cevap
0
Favori
525
Tıklama
Daha Fazla
İstatistik
  • Konu İstatistikleri Yükleniyor
0 oy
Öne Çıkar
Sayfa: 1
Giriş
Mesaj
  • #Suppose you have a dictionary of "cellPhone={}" with the following data

    cellPhone = {}

    cellPhone[0] = {"brand":"iphone", "price":5000, "sales":1266883}
    cellPhone[1] = {"brand":"samsung", "price":3500, "sales":845869}
    cellPhone[2] = {"brand":"nokia", "price":1200, "sales":312008}
    cellPhone[3] = {"brand":"vestel", "price":600, "sales":76853}
    cellPhone[4] = {"brand":"lg", "price":2860, "sales":858694}
    cellPhone[5] = {"brand":"htc", "price":4689, "sales":288963}

    # a) Write a function with the name "total" which returns the total earnings of all 6 brands
    #(Hint: earning = price * sales)

    def total():
    pass #you should complete the rest


    # b) Write a function with the name "share" which adds a new "share" key to each phone in the data
    #with the value to represent the total market share of the product
    #(Hint: cellPhone[0] => {"brand":"iphone", "price":5000, "sales":1266883, "share":1266883*5000/total()}

    def share():
    pass #you should complete the rest


    #Note: Deliver both your solution scripts and results on white paper...
    #Please do not e-mail your homework...

    bunu nasıl yapıcaz lütfen 4 arkadaş giriştik bir şey yapamadık







  • up
  • ula sirf su cevabi vermek icin 3 saattir uye olmaya calisiyorum, sitede baya sorunlar var, neyse senin odev niye ingilicce bakim hangi ulkedesin.

    bu arada cevap. hoca cevaplarida soyleyin yazmis # yazilan en alttaki results dan sonraki cevaplar. bu arada beyaz kagida yazin demis unutma email atmak yokmus.

    #Suppose you have a dictionary of "cellPhone={}" with the following data 

    cellPhone = {}

    cellPhone[0] = {"brand":"iphone", "price":5000, "sales":1266883}
    cellPhone[1] = {"brand":"samsung", "price":3500, "sales":845869}
    cellPhone[2] = {"brand":"nokia", "price":1200, "sales":312008}
    cellPhone[3] = {"brand":"vestel", "price":600, "sales":76853}
    cellPhone[4] = {"brand":"lg", "price":2860, "sales":858694}
    cellPhone[5] = {"brand":"htc", "price":4689, "sales":288963}

    # a) Write a function with the name "total" which returns the total earnings of all 6 brands
    #(Hint: earning = price * sales)

    def total():
    earning = 0
    for x in range(0,len(cellPhone)):
    earning += cellPhone[x]['price'] * cellPhone[x]['sales']
    return(earning)

    # b) Write a function with the name "share" which adds a new "share" key to each phone in the data
    #with the value to represent the total market share of the product
    #(Hint: cellPhone[0] => {"brand":"iphone", "price":5000, "sales":1266883, "share":1266883*5000/total()}

    def share():
    for y in range(0,len(cellPhone)):
    cellPhone[y]['share'] = cellPhone[y]['sales']*total()


    #Note: Deliver both your solution scripts and results on white paper...
    #Please do not e-mail your homework...


    #results
    # total() function returns 13526290247
    #values for share() function
    #17136227166990101
    #11441469604939643
    #4220310767385976
    #1039535984352691
    #11614944277357418
    #3908597408643861




  • Riot.im 'de Türkiye Yazılım Geliştirme adında bir oda açıp orada mesajlaşmak daha iyi olabilir. Ne cep ne e-mail istemiyor yeni nesil iletişim programları. Veya Tox ağı o da cok kullanışlı.

    < Bu ileti mini sürüm kullanılarak atıldı >
  • 
Sayfa: 1
- x
Bildirim
mesajınız kopyalandı (ctrl+v) yapıştırmak istediğiniz yere yapıştırabilirsiniz.