Fundamentals of Python Programming Flashcards
7 cards from real PCEP practice questions. Tap to flip, then mark Knew It or Still Learning โ missed cards come back until you master them.
Read the first 7 Fundamentals of Python Programming flashcards as text
What is the output of `print(type(3.0))` in Python?
Answer:
3.0 is a floating-point literal, so its type is `float`.
Which operator is used for integer (floor) division in Python?
Answer: //
The `//` operator performs floor division, discarding the fractional part.
What value does `bool('')` return?
Answer: False
An empty string is falsy in Python, so `bool('')` returns `False`.
What is the result of `10 % 3` in Python?
Answer: 1
The modulo operator `%` returns the remainder of 10 divided by 3, which is 1.
Which of the following is a valid Python identifier?
Answer: _count
`_count` is valid because identifiers can start with an underscore, but not a digit or hyphen, and cannot be reserved keywords.
What does the `len()` function return when called on the string `'hello'`?
Answer: 5
`len('hello')` returns 5 because there are five characters in the string.
In Python, what is the result of `'3' + '4'`?
Answer: 34
String concatenation with `+` joins the two string literals, resulting in `'34'`.