This exercise will help students understand more about List, Inputs, IF and ELSE and Loops:

  1. Create a List of Integer: 1,2,3,4,5,6
    1. Multiply the first and 3rd element of the list and assign the result to variable “result”.
    2. Print the “result” to the shell.
  2. Create a “for loop” that will print “. Hi there” 6 times like the following
    1. 0. Hi there
      1. Hi there
      2. Hi there
      3. Hi there
      4. Hi there
      5. Hi there
  3. Get input from shell: “What grade are you in? ”
    1. If user enter ‘1’ or ‘1st’ or ‘first’ or ‘pertama’ then print ‘You are learning to read.’
    2. If user enter ‘2’ or ‘2nd’ or ‘second’, then print ‘You are learning multiplication.’
    3. If user enter ‘3’ or ‘3rd’ or ‘third’, then print ‘You are learning shapes.’
    4. Else, then print ‘I don’t know what you are studying.’
  4. Create a function, “hello_world”, with no parameter and inside the function, it will print “Hello World”. Call the function.
  5. Create a function, “greeting”, with one parameter, “name”. Inside the function, print to the shell the combination of the word “Greeting ” and the name parameter. Call the function like this “greeting(‘Gamas’)” . The result should be “Greeting Gamas” in the shell.
  6. Create a function, “combine_words”, with 3 parameters. Inside the function, print the combination of all three parameters. Call the function like this: “combine_words(‘Hello ‘, ‘Mr. ‘, ‘Gamas.’)” . This will print ‘Hello Mr. Gamas’ to the shell.