- This event has passed.
4 PM – Intro to Python – Nathaniel
July 24, 2021 @ 4:00 pm - 5:00 pm
Today We:
- Reviewed https://indo.ayclogic.com/intro-to-python/star-wars-problem/
- Did more practice on functions
Homework
- Problems listed at the bottom of “Jul24_StarWarsHw.py”
- The 3 problems in that file can also be found below here:
1.)
create a function called deal_or_no_deal with one parameter called “decision”
and in the function, if “decision” is equal to “no deal” then print “we do not have a deal”
if “decision” is equal to “deal” then print “we have a deal”
2.)
write a function called “is_number_2” with one parameter called “num”
in the function, if “num” is 2 then return True. if “num” is not 2 then return False
NOTE: Do this outside the function!
outside the function, call “is_number_2” and if the return value is True then print “number is 2”
if the return value is False then print “number is not 2”
3.)
write a function called “is_in_list” with one parameter called “num”.
inside the function, write this list of numbers called “numbers” which has the elements [1,2,3,4]
and if the parameter “num” is in the list “numbers”, print “num is in numbers”
if the parameter “num” is not in the list “numbers” print “num is not in numbers”
call the function with any number and see if it works