- Create a function WITHOUT return value: get_letter_grade with one parameter: grade . Inside the function, do the following
- if grade less than 60 then print “F”
- if grade less than 70 then print “D”
- if grade less than 80 then print “C”
- if grade less than 90 then print “B”
- else print “A”
- Outside the function, call the function and pass 85 as the parameter. The program should print B
- Create a function WITH return value: get_letter_grade_2 with one parameter: grade . Inside the function, do the following
- if grade less than 60 then return “F”
- if grade less than 70 then return “D”
- if grade less than 80 then return “C”
- if grade less than 90 then return “B”
- else return “A”
- Outside the function call the function and pass 85 as the parameter.
- Capture/get the return value and print “Score 85 is equal to <return value>”
- Create a list with the following elements: “hydra”, “dragon”, “gremlin”, “minotaur”, “gnome” . Use for loop to go through each element inside the list and print to the shell. Specifically for “hydra” and “dragon”, you need to print “hydra is a big creature” and “dragon is a big creature”. This is how the expected result.
hydra is a big creature
dragon is a big creature
gremlin
minotaur
gnome
- Create a function with return value, “movie_ticket_price”. The function need to have one parameter “age“. Inside the function, when age is less than 4, return 0. When age is less than 10 return 5. When age is less than 59 return 10. Otherwise return 7. Outside the function, ask user in the shell “How old are you: ” take user input and call the above function and use the user input as the function parameter. Print the function return value like this “Your ticket price is $<return value>”. Look at expected output below if you run your program 3 times with different input.
How old are you: 7
Your ticket price is $5
How old are you: 3
Your ticket price is $0
How old are you: 100
Your ticket price is $7