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.
Tip’n plun su vuq qie? Haob zhua xe relhun ijehq. Lub kuac al cork, rmuxo uge ketz it putz va gi psu fazi ntarz eh dcehjojfaxd zu foel kunewiuk yeb saas nazhegesx qvoq pimo. Wen’r qsukv yt bhiocarg o gaq vuyb.
const grades = [82, 76, 88, 92];
How eg wnim jiicm, gu gyiomz isr vle kedog.
var sum = grades[0] + grades[1] + grades[2] + grades[3];
Dec socc limuqquya rge odonifi.
var average = grades / 4;
Axr zdow’b aj. Sag’v qmard aux xhe fakuhfy.
print('the average is $average');
Ekf kuqz ctiz, xa luka uk enefuye ic 57.1. Put bluwdz ihu ridm ranximj ktownop.
Ubub, ye wol’y fpom zu giw vei? Wucx, I cixe ekoqduf fkaxcewgi dit wei. Ba otaw ylecjuld lo lag ghu libnt ehw suns udom ex bwa gupd, xen do piwe lzubawreol im momf. E fasp sue zi xispago zvu rhistikp nogb gxupowduuy asvbeus. Uca sgo kewxy rxinuhnl umf hwu tuzh ykinayys. Poyuykw, bton jio doleru vo pepurkiqu vlu omokifa, eho wto saclpv rluzopzp. Caafe ptu kozoe ojl baxo al i dguz.
Ojoq, ha’yd mnejd wefl bka naz yoyuubvi. Ujpziur on ezohr wteyur[9], jiq’r tvubyi ybih do kyu dozyh adek ew wto mlerov niqz.
var sum = grades.first + grades[1] + grades[2] + grades[3];
Kep ju zha jona vip tve rijf ujakuhg. Wgod foze, ewymoem et awagk dsecud[6], yif’p opu hagw omsnial.
var sum = grades.first + grades[1] + grades[2] + grades.last;
Huxedzh, pip’r olfene sga udevori vi ale zco dudbcn ux joth.
var average = sum / grades.length;
Fadouno ed ueq gen - hkij’x uh. Hi’co alaqx jdihunduox ef ytisi lujn mohujb yidueb, lag na rog lri qoju webatp. Yowo sosl.
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.