Arama butonu
Bu konudaki kullanıcılar: 1 misafir
3
Cevap
593
Tıklama
0
Öne Çıkarma
Python Basit Ödev Lütfen Yardım
H
8 yıl
Er
Konu Sahibi

#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



H
8 yıl
Er
Konu Sahibi

up



M
8 yıl
Er

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



T
8 yıl
Yarbay

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ı >

DH Mobil uygulaması ile devam edin. Mobil tarayıcınız ile mümkün olanların yanı sıra, birçok yeni ve faydalı özelliğe erişin. Gizle ve güncelleme çıkana kadar tekrar gösterme.