- This event has passed.
6pm – Intro To Python – Joshua Widjanarko (Darin Sub)
September 5 @ 6:00 pm - 7:00 pm
Today We Did:
- Reviewed the homework
- Brushed up on what functions are with/without return values
- Did examples of functions from the https://www.ayclogic.com/list-inputs-if-and-else-loops-and-function/ page
Homework:
In one new file, “Sep5_FunctionsWithRVCopyHW”, do the following:
- Copy pages:
2nd edition: pg. 138, 139
3rd edition: pg. 137-139
Create a new function called “convert_from_kg_to_gram”
The function accepts one argument/parameter: kg
Inside the function, convert from kg to gram by multiplying 1000 to kg
return the result of the conversion
get input from the user in the shell, and save that in a variable named “kg”
call the function with parameter from user input and save the return value in a variable called “result”.
print (for example) “There are 4000 grams in 4 KG”
EXAMPLE OUTPUT:
Enter the number of kg: 10
There are 10000 grams in 10 KG
NOTES:
If you have any questions feel free to email me jwidjanarko@ayclogic.com or ddjapri@ayclogic.com