Created
March 29, 2022 17:30
-
-
Save quietguyproductions/a30fc5e61c9f92fbf19d8af6e3f8a28b to your computer and use it in GitHub Desktop.
Example Function
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def split_on_comma(x): | |
# replace the code below with code that solves the problem | |
return x.split(',') |
are you able to see my comments
1 def split_sentence():
2 ("the quick brown fox; likes to hack. The car is annoyed by my keyboard!")
3
4 split_sentence()
The quick brown fox; likes to hack. The cat is annoyed by my keyboard!
this is where i am stuck
Great job figuring out the function definition! The error you're now seeing happens because you passed an invalid argument (an argument is another way of saying "value of an input variable"). I suggest doing a google search for python string methods, or examining the method's help documentation in the terminal
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 1 declares the start of a function by using def.
split_on_comma is the function name and its signature is the single input variable x.
Line 3 is an example of a return statement -- this will stop the execution of the function and return the value to whatever bit of python called the function.