PGoCareerGoCareer prep tools
Home
LoginSign up
  • Java
  • Python
  • AI
  • React
  • Angular
  • PHP
  • Node.js
  • SQL
  • DSA
  • HTML
  • CSS
  • JS
  • Spring
  • ML
  • MongoDB

Python · Theory

Python Literals

← All stacks

Theory

10/268

Python Literals

A literal is a value you write as-is in the source. 10 is an int literal. 3.14 is float. "Asha" is a string. True and False are booleans. None means no value. You are not computing them — you are writing the value itself.

Collections have literals too: [1, 2] list, (1, 2) tuple, {1, 2} set, {"name": "Asha"} dict. 2+3j is a complex literal. Interviewers want one example each: int, str, bool, None. That is enough.

Python Literals — output — 10, Asha, True, None. Four real literals.

Exam tip

One example each: int, str, bool, None.

Example

# Literals
print(10)
print("Asha")
print(True)
print(None)

Python Literals — output: 10, Asha, True, None. Four real literals.

Short notes

  • DefFixed value written in code.
  • Rule10, "hi", True, None.
  • RememberList/dict literals too.

Questions

1

Explain Literals as if you are teaching a junior — definition, then one tiny script.

2

What does the example print, and why?

3

What mistake do freshers make with Literals?

Previous← Python KeywordsNextPython Operators →
P

GoCareerGo

Utilities · Preparation Hub · Resume · CV · Tools — one workspace.

Workspace

DashboardProfilePreparation HubResume builderCV builderCareer planning

PDF Tools

Merge PDFSplit PDFCompress PDFImage to PDFAll toolsJobs

Image & QR

Compress ImageResize ImageQR ScannerQR GeneratorBlogIT interview prep

Company

FAQFeedbackContactPrivacyTermsSitemap

© 2026 GoCareerGo. Keep moving forward.