#100DaysOfWeb in Python Transcripts
Lecture: Day 2: 4 JS exercises
0:03 It's day two now and today it's all about
0:06 practicing what you have learned so far.
0:09 So now it's time to see into the Demo folder
0:12 of your checkout.
0:14 And there you will find a couple of directories
0:16 and see into the language.
0:19 Now, run JS and debugging are for my lesson
0:24 but the exercises are in control, flow, functions
0:28 looping and objects.
0:35 As you see, every exercise has an html file
0:41 in a browser and you will start with the exercise.html
0:45 and if you're stuck or if you just want to work
0:47 from the solution, you can use the dash solution files.
0:51 So let me quickly show them.
0:57 I have a multi-line command showing what's required
1:00 and some startup code has been provided.
1:04 So here we make a simple number guessing game
1:07 asking the user for an input partial to an int
1:10 and check if the number is a secret number.
1:12 If it's lower, we print to low;
1:14 if it's higher, we print to high.
1:16 And if we assert a number, we print, you guessed it.
1:22 Again, if you get stuck
1:24 you can always look at the solution.
1:27 The second exercise is about using functions.
1:31 So here, we're going to write a function to some numbers.
1:34 You might have seen this one on the platform, actually
1:36 it was one of our first bites and here you have the sum
1:39 the numbers provided to the function
1:41 but if numbers is not defined
1:43 you sum a default range of 1-100.
1:48 is not having built-in range
1:50 so you probably have to write a second function
1:52 to generate a range from 1-100.
1:55 But that's awesome, because you should be practicing writing functions.
2:05 Then I got a looping exercise where you're provided with
2:08 two arrays of names and ages
2:10 and you write a small program to loop over both.
2:13 For each person, you print a name, the age
2:17 and if they're allowed to drive, based on their mean age.
2:19 And it's closely related to what we've seen
2:21 in the previous videos.
2:25 Now the last exercise is about objects
2:28 and it's kind of pre-work for the final project
2:31 but to kind of recounter.
2:38 And here we can just create a list, or array
2:40 of simple food objects that contain a description
2:44 and a count of the calories.
2:47 Then you print that to the console.
2:51 So, some exercises to really get you practicing
2:55 what you've learnt so far, because as I always say
2:57 the learning's in the practice.
2:59 And with that done, tomorrow I have some more video lessons
3:02 lined up, to start looking at the document object model
3:08 See you tomorrow.