All language subtitles for 20. Coding Challenge

af Afrikaans
ak Akan
sq Albanian
am Amharic
ar Arabic
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bem Bemba
bn Bengali
bh Bihari
bs Bosnian
br Breton
bg Bulgarian
km Cambodian
ca Catalan
ceb Cebuano
chr Cherokee
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
ee Ewe
fo Faroese
tl Filipino
fi Finnish
fr French
fy Frisian
gaa Ga
gl Galician
ka Georgian
de German
el Greek
gn Guarani
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ia Interlingua
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
rw Kinyarwanda
rn Kirundi
kg Kongo
ko Korean
kri Krio (Sierra Leone)
ku Kurdish
ckb Kurdish (Soranî)
ky Kyrgyz
lo Laothian
la Latin
lv Latvian
ln Lingala
lt Lithuanian
loz Lozi
lg Luganda
ach Luo
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mfe Mauritian Creole
mo Moldavian
mn Mongolian
my Myanmar (Burmese)
sr-ME Montenegrin
ne Nepali
pcm Nigerian Pidgin
nso Northern Sotho
no Norwegian
nn Norwegian (Nynorsk)
oc Occitan
or Oriya
om Oromo
ps Pashto
fa Persian Download
pl Polish
pt-BR Portuguese (Brazil)
pt Portuguese (Portugal)
pa Punjabi
qu Quechua
ro Romanian
rm Romansh
nyn Runyakitara
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
sh Serbo-Croatian
st Sesotho
tn Setswana
crs Seychellois Creole
sn Shona
sd Sindhi
si Sinhalese
sk Slovak
sl Slovenian
so Somali
es Spanish
es-419 Spanish (Latin American)
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
tt Tatar
te Telugu
th Thai
ti Tigrinya
to Tonga
lua Tshiluba
tum Tumbuka
tr Turkish
tk Turkmen
tw Twi
ug Uighur
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
wo Wolof
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu

Original subtitles

1 1

I hope you're excited 2

2

for your next coding challenge 3

3

so let's jump right in. 4

4

And this time we have a different coding challenge. 5

5

So, this time we have two gymnastics teams 6

6

called the Dolphins and the Koalas. 7

7

And they compete against each other three times, 8

8

then the team with the highest ever score 9

9

is the winner and wins a trophy. 10

10

So here are your tasks. 11

11

First, you should calculate the average score 12

12

for each of the teams using the test data below. 13

13

So, this test data right here, okay. 14

14

Then compare the teams' average scores 15

15

to determine the winner of the competition 16

16

and also print it to the console. 17

17

Now there might be a draw between the teams 18

18

which means that they have the same average score. 19

19

So, you need to test for that situation as well. 20

20

So this is the basic challenge 21

21

and I think this will be great to test the knowledge 22

22

that you gained over the last couple of videos. 23

23

Now if you want to take it to the next level 24

24

and make it a little more difficult, 25

25

you can try out the bonus one and bonus two. 26

26

So, let's take a look at this. 27

27

So, bonus one is to include the requirement 28

28

for a minimum score of 100. 29

29

So what this means is that the team only wins 30

30

if it has a higher score than the other team. 31

31

And, at the same time a score of at least 100 points. 32

32

And to help you solve this one, 33

33

I'm giving you the hint of using a logical operator 34

34

to test for the minimum score of 100 points. 35

35

Also, you will also probably need multiple else if blocks. 36

36

All right. 37

37

Now the second bonus here, 38

38

is that the minimum score also applies to a draw. 39

39

So a draw only happens when both teams have the same score 40

40

and both have a score greater or equal 100 points. 41

41

And otherwise no team at all wins the trophy, all right. 42

42

And then here you actually have the test data for bonus one 43

43

and for bonus two. 44

44

And you can of course play around with these scores 45

45

and change them to match all the different scenarios, okay. 46

46

So these are not static, 47

47

they're just some initial values that make sense 48

48

but from there feel free to change them. 49

49

So the first two are the easier ones 50

50

and for these you use this test data. 51

51

Then to make it a bit more difficult 52

52

you can do bonus two and bonus one 53

53

and for that you use these two test data sets, all right? 54

54

Now if one of the bonuses turns out to be too hard for you 55

55

then just don't do it. 56

56

It's perfectly fine, okay. 57

57

What matters is that you don't become frustrated. 58

58

The goal here is really just to test the stuff 59

59

that we did before 60

60

and absolutely not to get you frustrated 61

61

and thinking that coding might not be for you, okay. 62

62

And again, don't focus on writing efficient 63

63

or optimized code at this point, 64

64

all we want here is to learn programming 65

65

and to learn JavaScript. 66

66

So, just make it work and, yeah... 67

67

That's it for instructions about this challenge. 68

68

So, pause the video now and I see you in a second. 69

69

Now okay, hopefully you managed to complete 70

70

at least point one and point two 71

71

and so let's start by solving these two. 72

72

So, number one is calculating the average of both teams. 73

73

So let's create one variable for each. 74

74

So, score Dolphins 75

75

and so to calculate the average 76

76

we simply add up all the three scores 77

77

and then divide it by 3. 78

78

So we already did something similar before 79

79

so that's 96 plus 108 plus 89, 80

80

and then divided by three. 81

81

And we need these parentheses 82

82

so that these plus operations are executed first. 83

83

Because the grouping... 84

84

So the parentheses have a higher precedence. 85

85

Okay, score Koalas is 88 plus 91 plus 110 86

86

And again divided by 3 87

87

And now let's quickly log both to the console here. 88

88

Score Dolphins and score Koalas. 89

89

Okay, so they're pretty close 90

90

but the Dolphins have a little bit higher of an average. 91

91

And so that's what we're working on in point two 92

92

where we're going to compare the average of both teams. 93

93

So, we're gonna use an if statement or if else probably. 94

94

So score dolphins, if it's greater than score Koalas 95

95

then log to the console, 96

96

Dolphins win the trophy. 97

97

And we can get fancy here with some emoji. 98

98

Let's see if we got one. 99

99

Ah! That's the one I'm looking for. 100

100

But of course once more, 101

101

you don't need to worry about this part. 102

102

Let's just copy this for the next one. 103

103

So, else... 104

104

And actually we are going to use an else if 105

105

because of the draw. 106

106

But let's talk about that one later. 107

107

So, if the score of the Koalas 108

108

is greater than score Dolphins 109

109

then we're gonna print the opposite, 110

110

so that Koalas win the trophy. 111

111

And finally, else if score Dolphins is equal to score Koalas 112

112

then we can simply say that no one wins the trophy, 113

113

or actually both win the trophy. 114

114

Okay, so let's test that and indeed, 115

115

we get that Dolphins win the trophy 116

116

and that because as we know, this value is greater. 117

117

And so actually this first condition here 118

118

turns out to be true right away 119

119

and so this block of code here gets executed. 120

120

Now let's just quickly increase 121

121

the score of the Koalas here. 122

122

Let's say 100, just to see if the second part also works 123

123

And it did, now the Koalas win the trophy. 124

124

Okay, but let's put it back here 125

125

and here you could have actually done it in another way. 126

126

So you could have done score Dolphins 127

127

less than score Koalas. 128

128

So basically you write the same as here 129

129

but instead of the greater, 130

130

you will have used the less than. 131

131

So that's the exact same thing and both are equally valid. 132

132

Then here in the last part 133

133

actually, we wouldn't even have needed this part 134

134

so that the score of Dolphins is equal to score of Koalas, 135

135

because that's actually the only scenario that's left 136

136

given these previous two conditions. 137

137

So, basically if none of these here were true, 138

138

really the only thing possible 139

139

would be that they had the same score 140

140

and so simple else block would have been enough here. 141

141

But anyway, this works just fine too 142

142

and so, again what matters is that you made it work 143

143

even if you did some things differently. 144

144

For example, 145

145

you could have stored the conditions 146

146

in separate boolean variables 147

147

or you could have structured the if else statement 148

148

in some different way. 149

149

But if you got the same result that we just saw here, 150

150

then congratulations. 151

151

That's a great work. 152

152

Well done, really. 153

153

So, maybe you even made it to bonus number one and two 154

154

and so let me solve them here now, as well. 155

155

So, let's start by calculating the average. 156

156

So, this is gonna be bonus one. 157

157

And yeah, let's copy this one, too. 158

158

Let's copy this one. 159

159

Let's copy this one. 160

160

So we should have done it all in one go 161

161

so that we can now command out this first part. 162

162

So, for test number one, 163

163

this should be 97, 164

164

then the second one should be 112 and 101 165

165

And for the Koalas, we have 109, 95 and 123. 166

166

Let's just quickly test. 167

167

And so right now the Koalas win the trophy. 168

168

So for now everything works the same 169

169

but now we need to include this important condition here, 170

170

which is that with this rule, 171

171

a team only wins if it has a higher score 172

172

than the other team, which we already have. 173

173

And, at the same time a score of at least 100 points. 174

174

Okay. 175

175

Easy enough. 176

176

So in this case, the Dolphins win. 177

177

But now we also need to ensure 178

178

that the Dolphins have a score higher or equal 100. 179

179

So let's just say that. 180

180

So Dolphins need to have a higher score than Koalas 181

181

and score Dolphins needs to be greater or equal 100 182

182

and that's it. 183

183

That's all we need for this requirement. 184

184

And then the same thing here. 185

185

So this is the scenario where the Koalas win. 186

186

So for the Koalas to win 187

187

they need to have a higher score than the Dolphins 188

188

and at the same time, 189

189

they need to have at least 100 points. 190

190

So just like before, greater or equal 100. 191

191

And so once more, we used a logical operator here 192

192

to model this situation essentially. 193

193

Okay, and actually with this we implemented 194

194

this bonus number one. 195

195

So let's try that again 196

196

and right now of course it still works 197

197

because both have a score higher than 100 198

198

but let's change that now here 199

199

according to test data two, to 106. 200

200

So, 106... 201

201

and now they both win the trophy. 202

202

So let's actually decrease all these points 203

203

like by 20. 204

204

So let's make it 81 and 86, 205

205

so the average should still be the same now 206

206

Yeah, but they're both below 100 now. 207

207

And so this brings us to our bonus number two 208

208

that says that the minimum score 209

209

should also apply to a draw. 210

210

So a draw only happens when both teams have the same score 211

211

and both score greater or equal 100 points, okay. 212

212

And otherwise, no team wins the trophy. 213

213

So that's important too. 214

214

So let's translate that. 215

215

So to be a draw, the score needs to be the same 216

216

which we already have. 217

217

And the score of Dolphins 218

218

needs to be greater or equal 100 219

219

and the score of Koalas needs to be greater, equal 100, okay 220

220

And else... 221

221

Well, then we can say that no one wins the trophy. 222

222

And let's just add some sad emoji here, okay. 223

223

Let's try that 224

224

and now we get that no one wins the trophy, okay. 225

225

So that's because their scores are now below 100. 226

226

And so, we actually enter this last case here. 227

227

But if we go back to the averages that we had before 228

228

so 106 and 101, let's see. 229

229

Now both win the trophy 230

230

because they have the same amount of points 231

231

and they both have a number of points above 100. 232

232

And so that's exactly what we have here. 233

233

So, same points, 234

234

Dolphins have over, or at least 100 points 235

235

and Koalas have at least 100 points. 236

236

And so in this case, both win the trophy. 237

237

Finally, let's also test the scenario 238

238

in which both have below 239

239

but the Dolphins have a little bit more. 240

240

Let's put this one here at 80, and so, 241

241

now we see that the Dolphins have 96 points 242

242

and the Koalas have 84 243

243

but still no one wins the trophy. 244

244

And that's because the Dolphins have more than the Koalas 245

245

so this part of the requirement is true 246

246

but they do not have over 100 247

247

so this part here is false, okay 248

248

and so true, this first part here is true 249

249

and the second part is false. 250

250

True and false gives false 251

251

and so then all of these are skipped 252

252

because they are also obviously false 253

253

and so we go straight to this last block. 254

254

And so no one wins the trophy 255

255

which is exactly what we were expecting 256

256

as a result here, okay. 257

257

Now if you didn't manage to do this here, 258

258

again, don't worry because I know that this is 259

259

a little bit complicated already 260

260

and so in case you managed to successfully 261

261

complete this challenge, then a huge congratulations to you. 262

262

Well done. 263

263

But if for some reason, 264

264

you were not able to complete the challenge 265

265

then don't worry all too much about it. 266

266

You can always go back to the lectures 267

267

where we first learned about these topics 268

268

and you can of course, after this video 269

269

also review the code a little bit more carefully 270

270

to make sure 100% that you understand 271

271

especially this last example that we just worked on, okay. 272

272

But anyway, great job in completing this challenge 273

273

and now I see you in the next video.

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.