[ AEEP2301 ] 2 - print() Function

0.0(0)
Studied by 0 people
call kaiCall Kai
Locked
learnLearn
examPractice Test
spaced repetitionSpaced Repetition
heart puzzleMatch
flashcardsFlashcards
GameKnowt Play
Card Sorting

1/49

encourage image

There's no tags or description

Looks like no tags are added yet.

Last updated 3:46 PM on 9/3/26
Name
Mastery
Learn
Test
Matching
Spaced
Call with Kai
Chat

No analytics yet

Send a link to your students to track their progress

50 Terms

1
New cards

The editor (left) and the console (right).

What two main areas are found in the Edube Sandbox?

2
New cards

A function is a reusable piece of code that can take input (arguments) and produce an output (return value) and/or cause an effect.

What is a function in Python?

3
New cards

Mathematical functions generally focus on producing a value, while Python functions can produce a value and/or an effect.

What is one important difference between mathematical functions and Python functions?

4
New cards

1. Built-in functions

2. Functions from other modules

3. User-defined functions

What are the three categories of functions?

5
New cards

Functions that are already available in Python and can be used directly by writing their function name.

What are built-in functions?

6
New cards

Functions that are not directly available and require their module to be imported first.

What are functions from other modules?

7
New cards

sin(), cos(), and log().

Give examples of functions from the math module.

8
New cards

Import the math module.

What must you do before using functions from the math module?

9
New cards

Functions created by the programmer.

What are user-defined functions?

10
New cards

It displays values or text in the console.

What does print() do?

11
New cards

No. print() displays the value; it does not return that displayed value as its return value.

Does print() return the value that it displays?

12
New cards

function_name(argument)

What is the general format of calling a function?

13
New cards

Spelling and case-sensitivity.

What should you be mindful of when writing function names?

14
New cards

They are used to define strings.

What are quotation marks used for in Python?

15
New cards

Everything inside the quotation marks is treated as string data.

What is treated as data when placed inside quotation marks?

16
New cards

A value passed to a function inside its parentheses.

What is an argument?

17
New cards

A Python function can have any number of arguments, depending on the function.

How many arguments can a Python function have?

18
New cards

It separates the arguments, and print() places a space between them by default.

What does a comma do when separating arguments in print()?

19
New cards

It produces an empty line/newline.

What happens when print() is called with zero arguments?

20
New cards

No. It produces an empty line/newline.

Does print() with zero arguments produce None?

21
New cards

It is treated as part of the string and is printed.

What happens to a comma placed inside quotation marks?

22
New cards

It separates arguments, and print() inserts a space between them by default.

What happens to a comma placed outside quotation marks in print()?

23
New cards

The newline character.

What is \n?

24
New cards

It causes the console to start a new output line.

What does \n do?

25
New cards

Yes. Using \n can produce two output lines from one line of code.

Can one line of Python code produce output on two lines?

26
New cards

A space.

What does print() place between multiple arguments by default?

27
New cards

Yes. Python allows both single (') and double (") quotation marks.

Can you use either single or double quotation marks for a string?

28
New cards

Use single quotation marks around the string, e.g. 'He said "Hello"'.

How can you print a double quotation mark inside a string surrounded by single quotation marks?

29
New cards

Use an escape character (\) before it.

How can you print a quotation mark that would otherwise terminate the string?

30
New cards

The backslash (\) used to give certain characters a special meaning.

What is an escape character?

31
New cards

\'

How do you escape a single quotation mark?

32
New cards

\"

How do you escape a double quotation mark?

33
New cards

Use two backslashes: \\

How do you print a backslash itself?

34
New cards

Six backslashes, because each displayed backslash requires two backslashes in the string.

If you want three backslashes to appear in the output, how many backslashes are needed in the string?

35
New cards

Immediately before the character that needs to be escaped, inside the string

Where should an escape character be placed?

36
New cards

A sequence of characters enclosed within quotation marks (delimiters), either single or double.

What is a string?

37
New cards

Positional arguments and keyword arguments.

What are the two main types of arguments?

38
New cards

Arguments whose meaning is determined by their position.

What are positional arguments?

39
New cards

Arguments whose meaning is determined by the keyword used to identify them, rather than their position.

What are keyword arguments?

40
New cards

After all positional arguments.

Where are keyword arguments generally placed relative to positional arguments?

41
New cards

It determines what is printed at the end of the output.

What does the end keyword argument control in print()?

42
New cards

A newline (\n).

What does print() use for end by default?

43
New cards

It replaces the default newline with a space, allowing consecutive print() calls to appear on the same line.

What happens when you use end=" " in print()?

44
New cards

It determines what separates multiple arguments within the same print() call.

What does sep control in print()?

45
New cards

Between all the arguments of a single print() call.

Where does sep place its separator?

46
New cards

"Hello" and "World" are two positional arguments. print() automatically places the default sep, which is a space, between them.

Explain why print("Hello", "World") produces Hello World.

47
New cards

sep is a keyword argument that controls the separator between arguments. A comma inside quotation marks is simply part of the string data.

Explain the difference between sep and a comma inside quotation marks.

48
New cards

To change the default separator to something else, such as -, ,, or /.

If print() already puts a space between arguments, why would we use sep?

49
New cards

To change what appears at the end of the output, such as replacing the newline with a space.

If print() normally starts a new line after printing, why would we use end?

50
New cards

sep controls what goes between arguments in one print() call. end controls what goes at the end of the entire print() output.

What is the difference between sep and end?