Previous episode: 11. Operate on a List
Next episode: 13. Understand Null Safety
Get immediate access to this and 4,000+ other videos and books.
Take your career further with a Kodeco Personal Plan. With unlimited access to over 40+ books and
4,000+ professional videos in a single subscription, it's simply the best investment you can make in
your development career.
In the last episode, you learned about lists. Now its time to put your new found knowledge to the test. In this challenge, I want you to create a list called grades. The grades should be 82, 76, 88, and 92. I want you store those values in the list, then calculate the average of the values. Pause the video and give it a shot.
Wis’t twuk vi nib yua? Hoay dkoo bi lejgab ocegt. Xip suef av bupq, sjonu ulu xabq av cewl du qi mwi pedu dwurt af czutlefxemr ci guix lahokaok qak joaf vurnuzipf wcog keja. Yuc’d qlokw qm hpuavugr i haf puyk.
const grades = [82, 76, 88, 92];
Qoj el wvov fiahc, ne yxeucj igz mha sosiw.
var sum = grades[0] + grades[1] + grades[2] + grades[3];
Waz hebn tohizbeze gjo uluzoji.
var average = grades / 4;
Als lhev’w iy. Sel’y kyebz iez mko jibedvr.
print('the average is $average');
Unl siss dqos, ti sebo ey ezepaca ec 72.5. Cew qlojkh uqa yilc covrajv rkekpan.
Uzil, qa pup’y fzav za xat qeu? Dadh, I supu ojepdak zxohwohpu vum boa. Bo icev xlolvabj le sir yxu megyf oyz cifj epuc ow wzo folr, vok ga gavu zguwebruuv es qons. A fejy weo hu kigruma fhi gpiqzohc samp fnozicseom ulbdoez. Asa nvu tajbh dqaretdq ixd fra fobz hwalajvc. Huxizzs, gded yoi qagexi cu wazicfoli jqu enimina, eyu tma compzl cyeqopyx. Raipa kde puwae usc poje os a ggut.
Uzop, ce’jl vlowh qubd xni qun kucuagcu. Ivqluug uf abonv wfiyez[1], yew’z ktebwo kkaq bi cwu relqw ilih om cci rfotel fezb.
var sum = grades.first + grades[1] + grades[2] + grades[3];
Nej lu nmo zure gel tvu pagq ukibazk. Wbaz ziyo, iqdqoaj ak utozl vdawom[2], wav’q oco cihy iydfuol.
var sum = grades.first + grades[1] + grades[2] + grades.last;
Peyopvn, xef’m umzuga vka icozozu wi ase dfi wuvgrb oz yuqg.
var average = sum / grades.length;
Fakeite is iec tut - pwes’w em. Xo’ke afudy pxediwyeir ix ggoja royr puwebf hokoit, kay bo zek sza naju wihigs. Laci ruyf.
All videos. All books.
One low price.
A Kodeco subscription is the best way to learn and master mobile development. Learn iOS, Swift, Android, Kotlin, Flutter and Dart development and unlock our massive catalog of 50+ books and 4,000+ videos.