Podcast
Questions and Answers
Which of the following statements is true?
Which of the following statements is true?
- Unless we call a function, the code inside its function definition is not executed. (correct)
- We can invoke (call) a function only once.
- The program terminates once a function is called and executed.
- We can define a function using the `function` keyword
Study Notes
Functions in Python
- A function named
display_stars
is defined to print three asterisks (***
). - The
display_stars
function is called initially to print the stars once. - A
for
loop is used to iterate over a range of 2, calling thedisplay_stars
function twice more. - The total output of the code is four sets of three asterisks (
***
) printed on separate lines.
Studying That Suits You
Use AI to generate personalized quizzes and flashcards to suit your learning preferences.