<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>special literals in python - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/special-literals-in-python/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/special-literals-in-python/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Tue, 16 Aug 2022 11:29:35 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://www.wikitechy.com/interview-questions/wp-content/uploads/2025/10/cropped-wikitechy-icon-32x32.png</url>
	<title>special literals in python - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/special-literals-in-python/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What do you mean by Python literals ?</title>
		<link>https://www.wikitechy.com/interview-questions/python/what-do-you-mean-by-python-literals/</link>
					<comments>https://www.wikitechy.com/interview-questions/python/what-do-you-mean-by-python-literals/#respond</comments>
		
		<dc:creator><![CDATA[webmaster]]></dc:creator>
		<pubDate>Tue, 16 Aug 2022 11:29:10 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[boolean literals in python]]></category>
		<category><![CDATA[difference between literals and data types in python]]></category>
		<category><![CDATA[literals in python]]></category>
		<category><![CDATA[literals in python meaning]]></category>
		<category><![CDATA[special literals in python]]></category>
		<category><![CDATA[string literals in python]]></category>
		<category><![CDATA[types of literals in python with example]]></category>
		<category><![CDATA[types of numeric literals in python]]></category>
		<category><![CDATA[what are literals]]></category>
		<category><![CDATA[what are literals in python how many types of literals in python]]></category>
		<category><![CDATA[what are the literals in python]]></category>
		<category><![CDATA[what do you mean by python literals]]></category>
		<category><![CDATA[what is literals in python with example]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=4710</guid>

					<description><![CDATA[Literals are a notation for representing a fixed value in source code and it can be defined as raw value or data given in variables or constants. String Literals A string literal can be created by writing a text with a group of characters surrounded by the single (‘), double (“) or triple quotes. We [&#8230;]]]></description>
										<content:encoded><![CDATA[<p style="text-align: justify;"><img fetchpriority="high" decoding="async" class="alignnone size-full wp-image-4711" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python.png" alt="" width="1213" height="826" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python.png 1213w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python-300x204.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python-1024x697.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python-768x523.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python-390x266.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python-820x558.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literals-in-python-1180x804.png 1180w" sizes="(max-width: 1213px) 100vw, 1213px" /></p>
<ul style="text-align: justify;">
<li style="text-align: justify;">Literals are a notation for representing a fixed value in source code and it can be defined as raw value or data given in variables or constants.</li>
</ul>
<h2 id="string-literals" style="text-align: justify;"><strong>String Literals</strong></h2>
<ul style="text-align: justify;">
<li>A string literal can be created by writing a text with a group of characters surrounded by the single (‘), double (“) or triple quotes.</li>
<li>We can write multi-line strings or display in the desired way by using triple quotes.</li>
</ul>
<h3 id="sample-code" style="text-align: justify;"><strong>Sample Code</strong></h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-python code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-python code-embed-code"># string literals<br/><br/># in single quote<br/><br/>s = &#039;Welcome to Wikitechy&#039;<br/><br/><br/><br/><br/># in double quotes<br/><br/>t = &quot;Welcome to Wikitechy&quot;<br/><br/><br/><br/><br/># multi-line String<br/><br/>m = &#039;&#039;&#039;Welcome<br/><br/>                  to<br/><br/>                 Wikitechy&#039;&#039;&#039;<br/><br/><br/><br/><br/>print(s)<br/><br/>print(t)<br/><br/>print(m)</code></pre> </div>
<h3 id="output" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img decoding="async" class="alignnone size-full wp-image-4712" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals.png" alt="" width="1455" height="412" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals.png 1455w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals-300x85.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals-1024x290.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals-768x217.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals-390x110.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals-820x232.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/string-literals-1180x334.png 1180w" sizes="(max-width: 1455px) 100vw, 1455px" /></p>
<h2 id="numeric-literals" style="text-align: justify;"><strong>Numeric Literals</strong></h2>
<ul style="text-align: justify;">
<li>They are immutable and it consists of three data types, they are Integer, Float, Complex.</li>
<li>In integer both positive and negative numbers including 0 and it should not take any fractional part.</li>
<li>Float data type are real numbers having both integer and fractional part.</li>
</ul>
<h3 id="sample-code-2" style="text-align: justify;"><strong>Sample Code</strong></h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-python code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-python code-embed-code"># integer literal<br/><br/><br/><br/><br/># Binary Literals<br/><br/>a = 0b10100<br/><br/><br/><br/><br/># Decimal Literal<br/><br/>b = 30<br/><br/><br/><br/><br/># Octal Literal<br/><br/>c = 0o320<br/><br/><br/><br/><br/># Hexadecimal Literal<br/><br/>d = 0x12b<br/><br/><br/><br/><br/>print(a, b, c, d)</code></pre> </div>
<h3 id="output-2" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img decoding="async" class="alignnone size-full wp-image-4713" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals.png" alt="" width="1442" height="299" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals.png 1442w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals-300x62.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals-1024x212.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals-768x159.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals-390x81.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals-820x170.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/numeric-literals-1180x245.png 1180w" sizes="(max-width: 1442px) 100vw, 1442px" /></p>
<h2 id="boolean-literals" style="text-align: justify;"><strong>Boolean Literals</strong></h2>
<ul style="text-align: justify;">
<li>In python there are only two Boolean literals they are true and false.</li>
</ul>
<h3 id="sample-code-3" style="text-align: justify;"><strong>Sample Code</strong></h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-python code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-python code-embed-code">x = (1 == True)<br/><br/>y = (2 == False)<br/><br/>z = (3 == True)<br/><br/>r = (1 == True)<br/><br/>a = True + 10<br/><br/>b = False + 10<br/><br/><br/><br/><br/>print(&quot;x is&quot;, x)<br/><br/>print(&quot;y is&quot;, y)<br/><br/>print(&quot;z is&quot;, r)<br/><br/>print(&quot;a:&quot;, a)<br/><br/>print(&quot;b:&quot;, b)</code></pre> </div>
<h3 id="output-3" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4714" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals.png" alt="" width="1391" height="314" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals.png 1391w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals-300x68.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals-1024x231.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals-768x173.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals-390x88.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals-820x185.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/boolean-literals-1180x266.png 1180w" sizes="(max-width: 1391px) 100vw, 1391px" /></p>
<h2 id="literal-collections" style="text-align: justify;"><strong>Literal Collections</strong></h2>
<ul style="text-align: justify;">
<li>In this there are four different types of literal collections, they are Lis literals, Tuple literals, Dict literals, Set literals.</li>
<li>In list literals the values are stored separated by comma (,) and enclosed within square brackets ([ ]).</li>
<li>Tuple literals are enclosed by the parentheses ‘<strong>()</strong>‘ and each element is separated by the comma(,) and it is immutable.</li>
<li>Dictionary literals is enclosed by curly-braces ‘<strong>{}</strong>‘ and each pair is separated by the commas(,).</li>
<li>Set literals is the collection of the unordered data set and enclosed by the {} and each element is separated by the comma (,).</li>
</ul>
<h3 id="sample-code-4" style="text-align: justify;"><strong>Sample Code</strong></h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-python code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-python code-embed-code"># Tuple literals<br/><br/>even_number = (2, 4, 6, 8)<br/><br/>odd_number = (1, 3, 5, 7)<br/><br/><br/><br/><br/>print(even_number)<br/><br/>print(odd_number)</code></pre> </div>
<h3 id="output-4" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4715" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections.png" alt="" width="1405" height="322" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections.png 1405w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections-300x69.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections-1024x235.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections-768x176.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections-390x89.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections-820x188.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/literal-collections-1180x270.png 1180w" sizes="(max-width: 1405px) 100vw, 1405px" /></p>
<h2 id="special-literals" style="text-align: justify;"><strong>Special Literals</strong></h2>
<ul style="text-align: justify;">
<li>Python contains one special literal where ‘None’ is used to define a null variable.</li>
<li>If <strong>‘None’ </strong>is compared with anything else other than a <strong>‘None’</strong>, it will return <strong>false</strong>.</li>
</ul>
<h3 id="sample-code-5" style="text-align: justify;"><strong>Sample Code</strong></h3>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-python code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-python code-embed-code"># Special literals<br/><br/>water_remain = None<br/><br/>print(water_remain)</code></pre> </div>
<h3 id="output-5" style="text-align: justify;"><strong>Output</strong></h3>
<p style="text-align: justify;"><img loading="lazy" decoding="async" class="alignnone size-full wp-image-4716" src="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals.png" alt="" width="1398" height="191" srcset="https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals.png 1398w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals-300x41.png 300w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals-1024x140.png 1024w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals-768x105.png 768w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals-390x53.png 390w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals-820x112.png 820w, https://www.wikitechy.com/interview-questions/wp-content/uploads/2022/08/special-literals-1180x161.png 1180w" sizes="(max-width: 1398px) 100vw, 1398px" /></p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/python/what-do-you-mean-by-python-literals/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
