Podcast
Questions and Answers
What does the function hello_name return when given the input 'Bob'?
What does the function hello_name return when given the input 'Bob'?
Hello Bob!
What is the output of make_abba('Hi', 'Bye')?
What is the output of make_abba('Hi', 'Bye')?
HiByeByeHi
What HTML string is created by make_tags('i', 'Yay')?
What HTML string is created by make_tags('i', 'Yay')?
Yay
What is the result of make_out_word('[[ ]]', 'word')?
What is the result of make_out_word('[[ ]]', 'word')?
If the input is 'Hello', what does extra_end return?
If the input is 'Hello', what does extra_end return?
What does first_two('abcdefg') return?
What does first_two('abcdefg') return?
What is the output when non_start('Hello', 'There') is called?
What is the output when non_start('Hello', 'There') is called?
What does left2('Hello') yield?
What does left2('Hello') yield?
Flashcards are hidden until you start studying
Study Notes
Greeting Function
- Function:
hello_name(name)
creates a personalized greeting. - Example:
hello_name('Bob')
→ returns 'Hello Bob!' - The output format is always "Hello [name]!".
String Concatenation
- Function:
make_abba(a, b)
concatenates two strings in the "abba" format. - Example:
make_abba('Hi', 'Bye')
→ returns 'HiByeByeHi'. - The result is structured as a + b + b + a.
HTML Tag Creation
- Function:
make_tags(tag, word)
generates an HTML string with specified tags. - Example:
make_tags('i', 'Yay')
→ results in 'Yay'. - This function surrounds the word with the provided HTML tag.
String Insertion
- Function:
make_out_word(out, word)
inserts a word into the middle of a given "out" string of length 4. - Example:
make_out_word('[[]]', 'word')
→ returns '[[word]]'. - The word is placed between the first two and last two characters of the "out" string.
Last Two Characters Repetition
- Function:
extra_end(str)
creates a string with three repetitions of the last two characters. - Example:
extra_end('Hello')
→ returns 'lo lolo'. - This function only requires the input string to be at least 2 characters long.
First Two Characters Extraction
- Function:
first_two(str)
returns the first two characters of a string. - Example:
first_two('Hello')
→ results in 'He'. - If the string length is less than 2, it returns the string itself.
Character Omission in Concatenation
- Function:
non_start(a, b)
concatenates two strings, omitting their first character. - Example:
non_start('Hello', 'There')
→ results in 'ellohere'. - Both input strings must be at least length 1.
Left Rotation of Characters
- Function:
left2(str)
rotates the string left by two characters. - Example:
left2('Hello')
→ returns 'lloHe'. - The function requires the input string to be at least 2 characters long.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.