A literal is a value written directly in your code, such as 42, 3.5, "cat" or True. The way you write it decides its type, which you can check with the built-in type() function. PCEP tests whether you can recognise each kind of literal on sight and predict its type, because type decides what operators do with the value. Literals are different from variables: x is a name that refers to a value, while 42 is the value itself.
Keep reading for free
Create a free StudyToCert account to read the rest of this lesson: 7 more sections, 7 key terms, a real-world example, an exam tip and self-check questions. Every lesson, lab and practice test is free with an account.