American Young Coder (AYC)

AYC logo
Loading Events

« All Events

  • This event has passed.

6:30pm – Intro to Python – Roland

April 23 @ 6:30 pm - 7:30 pm

Today We Did

  1. Reviewed Function with Return Value HW
    1. Overloading functions
  2. Did more review of Functions with Return Values
    1. Conversion problems
    2. Searching for items in lists (returns True or False)
      1. Is item in list?
      2. Is even number in list?

Homework:

Submit the following file into your Google Drive Homework Folder

  1. “Apr23_FunctionHW.py” do the following problems below:
  1. Create a function, “hello_world”, with no parameter and inside the function, it will print “Hello World”. Call the function.
  2. 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.
  3. 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.
  4. Create a function with return value, “convert_miles_to_km”, with 1 parameter: miles.
    1. Inside the function, convert the parameter “miles” into the “km” value. There are 1.6 km in one mile. Return the conversion result or the km value.
    2. Outside the function:
      1. Ask user in the shell “Enter number of miles: “
      2. Get the user input and call the function and pass the user input as the parameter.
      3. Print “There are {result of the function} kms in {user_input} miles”.

If you have any questions, feel free to email me at rolandyang@ayclogic.com

Details

Date:
April 23
Time:
6:30 pm - 7:30 pm
Verified by MonsterInsights