<?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>python class definition - Wikitechy</title>
	<atom:link href="https://www.wikitechy.com/interview-questions/tag/python-class-definition/feed/" rel="self" type="application/rss+xml" />
	<link>https://www.wikitechy.com/interview-questions/tag/python-class-definition/</link>
	<description>Interview Questions</description>
	<lastBuildDate>Thu, 09 Sep 2021 11:39:25 +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>python class definition - Wikitechy</title>
	<link>https://www.wikitechy.com/interview-questions/tag/python-class-definition/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>What is init function in Python ?</title>
		<link>https://www.wikitechy.com/interview-questions/python/what-is-init-function-in-python/</link>
					<comments>https://www.wikitechy.com/interview-questions/python/what-is-init-function-in-python/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Sun, 18 Jul 2021 14:00:00 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[__init__ python 3python init main]]></category>
		<category><![CDATA[__init__.py python]]></category>
		<category><![CDATA[__init__.py python 3]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Atos interview questions and answers]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Collabera Technologies interview questions and answers]]></category>
		<category><![CDATA[def __init__(self)]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[Genpact interview questions and answers]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Infosys Technologies interview questions and answers]]></category>
		<category><![CDATA[L&T Infotech interview questions and answers]]></category>
		<category><![CDATA[Mavenir interview questions and answers]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Persistent Systems interview questions and answers]]></category>
		<category><![CDATA[Prokarma Softech Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[python class definition]]></category>
		<category><![CDATA[python class definition example]]></category>
		<category><![CDATA[python class init]]></category>
		<category><![CDATA[python class init function]]></category>
		<category><![CDATA[python class init method]]></category>
		<category><![CDATA[python class init super]]></category>
		<category><![CDATA[python class initialization]]></category>
		<category><![CDATA[python class without __init__]]></category>
		<category><![CDATA[python data science interview questions]]></category>
		<category><![CDATA[python do classes need init]]></category>
		<category><![CDATA[python init not called]]></category>
		<category><![CDATA[python interview questions and answers for testers]]></category>
		<category><![CDATA[python programming questions]]></category>
		<category><![CDATA[python telephonic interview questions]]></category>
		<category><![CDATA[Reliance Industries Ltd interview questions and answers]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[UnitedHealth Group interview questions and answers]]></category>
		<category><![CDATA[Virtusa Consulting Services Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Wells Fargo interview questions and answers]]></category>
		<category><![CDATA[what is python class init ?]]></category>
		<category><![CDATA[Xoriant Soluti interview questions and answers]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=856</guid>

					<description><![CDATA[Answer : In Python, __init__() method within a class is its constructor...]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<h2 id="python-init" class="color-purple" style="text-align: justify;">Python init():</h2>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>In Python, __init__() method within a class is its constructor.Any method or variable that starts with double underscore is by default private.</li>
<li>Python defines several standard private methods that have a special meaning, and __init__() is one of them. Some others are __str__(), __repr__(), __add__() and others.</li>
</ul>
</div>
</div>
<h2 id="what-does-def-init-do-in-python" class="color-purple" style="text-align: justify;">What does def init do in Python ?</h2>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>The __init__ function is known as a constructor, or initializer, and is automatically called when you create a new instance of a class. Within that function, the recently created object is assigned to the parameter “self”. The notation self.legs is an attribute called legs of the object in the variable self.</li>
</ul>
</div>
</div>
<div class="subheading" style="text-align: justify;">
<h2 id="sample-code">Sample Code:</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markdown code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markdown code-embed-code">class my_class(object):<br/>  def __init(self, x, y):<br/>    self.x = x<br/>    self.y = y<br/>def f2(self):<br/>    return self.x + self.y<br/> a = my_class(10, 20)<br/>print a.f2()</code></pre> </div>
</div>
<div class="subheading" style="text-align: justify;">
<h2 id="output">Output :</h2>
</div>
<div class="Output" style="text-align: justify;">
<div class="hddn">
<figure class="highlight">
<pre><code class="python hljs" data-lang="python"><span class="nt">30 
</span></code></pre>
</figure>
</div>
</div>
<p style="text-align: justify;">In the constructor __init__() and method f2(), a initial parameter self is a reference to a object that will later invoke methods at run time. Actually leaving out self parameter in the definition makes it not possible to call it on behalf of the object.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/python/what-is-init-function-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is DEF function in Python ?</title>
		<link>https://www.wikitechy.com/interview-questions/python/what-is-def-function-in-python/</link>
					<comments>https://www.wikitechy.com/interview-questions/python/what-is-def-function-in-python/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Sun, 18 Jul 2021 13:58:09 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Atos interview questions and answers]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[Collabera Technologies interview questions and answers]]></category>
		<category><![CDATA[define variable python]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[Genpact interview questions and answers]]></category>
		<category><![CDATA[how to define a function in python]]></category>
		<category><![CDATA[how to pass a list to a function in python]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Infosys Technologies interview questions and answers]]></category>
		<category><![CDATA[L&T Infotech interview questions and answers]]></category>
		<category><![CDATA[Mavenir interview questions and answers]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Persistent Systems interview questions and answers]]></category>
		<category><![CDATA[Prokarma Softech Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[python class definition]]></category>
		<category><![CDATA[python data science interview questions]]></category>
		<category><![CDATA[python def main]]></category>
		<category><![CDATA[python default arguments]]></category>
		<category><![CDATA[python define class]]></category>
		<category><![CDATA[python define function]]></category>
		<category><![CDATA[python definition]]></category>
		<category><![CDATA[python function arguments listmain function python]]></category>
		<category><![CDATA[python function definition]]></category>
		<category><![CDATA[python function multiple arguments]]></category>
		<category><![CDATA[python function optional arguments]]></category>
		<category><![CDATA[python function return]]></category>
		<category><![CDATA[python function return multiple values]]></category>
		<category><![CDATA[python interview questions and answers for testers]]></category>
		<category><![CDATA[python pass list to function by reference]]></category>
		<category><![CDATA[python programming questions]]></category>
		<category><![CDATA[python telephonic interview questions]]></category>
		<category><![CDATA[Reliance Industries Ltd interview questions and answers]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[UnitedHealth Group interview questions and answers]]></category>
		<category><![CDATA[Virtusa Consulting Services Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Wells Fargo interview questions and answers]]></category>
		<category><![CDATA[Xoriant Soluti interview questions and answers]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=855</guid>

					<description><![CDATA[Answer : The Python Def function is the User-Defined one.]]></description>
										<content:encoded><![CDATA[<div class="TextHeading">
<div class="hddn">
<h2 id="def-function-in-python" class="color-purple" style="text-align: justify;">DEF function in Python</h2>
</div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>The Python Def function is the User-Defined one.</li>
<li>Function blocks start with the keyword def then followed by the function name and parentheses ( ( ) ).</li>
<li>Any input parameters must place inside the parentheses. Now you can define parameters inside the parentheses.</li>
<li>The initial statement of a function is optional statement &#8211; the documentation string of the function (docstring).</li>
<li>Within the code block each and every function begins with (:) colon and is indented.</li>
<li>The statement return [expression] exits the function, alternatively passing back the expression to caller. The return statement with no arguments is the similar as return none.</li>
</ul>
</div>
</div>
<div class="text-center row" style="text-align: justify;">
<div class="col-sm-12">
<div id="bsa-zone_1590522538159-8_123456"></div>
</div>
</div>
<div class="ImageContent" style="text-align: justify;">
<div class="hddn"><img fetchpriority="high" decoding="async" class="alignnone size-medium aligncenter" src="https://cdn.wikitechy.com/interview-questions/python/def function-in-python.png" alt="def function in python" width="1057" height="552" /></div>
</div>
<div class="subheading" style="text-align: justify;">
<h2 id="syntax">Syntax:</h2>
</div>
<div class="CodeContent">
<div class="hddn">
<figure class="highlight" style="text-align: justify;">
<pre><code id="code1" class="python hljs bash" data-lang="python"><span class="nt">def functionname( parameters ):
   <span class="hljs-string">"function_docstring"</span>
   <span class="hljs-keyword">function</span>_suite
   <span class="hljs-built_in">return</span> [expression]</span></code></pre>
</figure>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/python/what-is-def-function-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is Classes in Python ?</title>
		<link>https://www.wikitechy.com/interview-questions/python/what-is-classes-in-python/</link>
					<comments>https://www.wikitechy.com/interview-questions/python/what-is-classes-in-python/#respond</comments>
		
		<dc:creator><![CDATA[Editor]]></dc:creator>
		<pubDate>Sun, 18 Jul 2021 13:53:08 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Accenture interview questions and answers]]></category>
		<category><![CDATA[Applied Materials interview questions and answers]]></category>
		<category><![CDATA[Atos interview questions and answers]]></category>
		<category><![CDATA[Capgemini interview questions and answers]]></category>
		<category><![CDATA[CASTING NETWORKS INDIA PVT LIMITED interview questions and answers]]></category>
		<category><![CDATA[CGI Group Inc interview questions and answers]]></category>
		<category><![CDATA[Chetu interview questions and answers]]></category>
		<category><![CDATA[classes and objects in python]]></category>
		<category><![CDATA[Collabera Technologies interview questions and answers]]></category>
		<category><![CDATA[Dell International Services India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Flipkart interview questions and answers]]></category>
		<category><![CDATA[Genpact interview questions and answers]]></category>
		<category><![CDATA[IBM interview questions and answers]]></category>
		<category><![CDATA[Indecomm Global Services interview questions and answers]]></category>
		<category><![CDATA[Infosys Technologies interview questions and answers]]></category>
		<category><![CDATA[L&T Infotech interview questions and answers]]></category>
		<category><![CDATA[Mavenir interview questions and answers]]></category>
		<category><![CDATA[Mphasis interview questions and answers]]></category>
		<category><![CDATA[NetApp interview questions and answers]]></category>
		<category><![CDATA[Oracle Corporation interview questions and answers]]></category>
		<category><![CDATA[PeopleStrong interview questions and answers]]></category>
		<category><![CDATA[Persistent Systems interview questions and answers]]></category>
		<category><![CDATA[Prokarma Softech Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[python abstract class]]></category>
		<category><![CDATA[python class attributes]]></category>
		<category><![CDATA[python class constructor]]></category>
		<category><![CDATA[python class definition]]></category>
		<category><![CDATA[python class inheritance]]></category>
		<category><![CDATA[python class init]]></category>
		<category><![CDATA[python class methods]]></category>
		<category><![CDATA[python class name]]></category>
		<category><![CDATA[python class object]]></category>
		<category><![CDATA[python class self]]></category>
		<category><![CDATA[python create class]]></category>
		<category><![CDATA[python data science interview questions]]></category>
		<category><![CDATA[python define class]]></category>
		<category><![CDATA[python extend class]]></category>
		<category><![CDATA[python import class from another file]]></category>
		<category><![CDATA[python instantiate class]]></category>
		<category><![CDATA[python interview questions and answers for testers]]></category>
		<category><![CDATA[python programming questions]]></category>
		<category><![CDATA[python telephonic interview questions]]></category>
		<category><![CDATA[python3 class inherit from object]]></category>
		<category><![CDATA[Reliance Industries Ltd interview questions and answers]]></category>
		<category><![CDATA[SAP Labs India Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Tech Mahindra interview questions and answers]]></category>
		<category><![CDATA[UnitedHealth Group interview questions and answers]]></category>
		<category><![CDATA[Virtusa Consulting Services Pvt Ltd interview questions and answers]]></category>
		<category><![CDATA[Wells Fargo interview questions and answers]]></category>
		<category><![CDATA[Xoriant Soluti interview questions and answers]]></category>
		<guid isPermaLink="false">https://www.wikitechy.com/interview-questions/?p=852</guid>

					<description><![CDATA[Answer : Classes means of a bundling data and functionality together.]]></description>
										<content:encoded><![CDATA[<div class="row">
<div class="col-sm-12">
<div class="ImageContent" style="text-align: justify;">
<div><img decoding="async" class="aligncenter size-medium" src="https://cdn.wikitechy.com/interview-questions/python/what-is-classes-in-python.png" alt="what is classes in python" width="852" height="633" /></div>
<div class="hddn"><span style="color: #000000; font-family: inherit; font-size: 2rem;">Classes in Python</span></div>
</div>
<div class="Content" style="text-align: justify;">
<div class="hddn">
<ul>
<li>Classes means of a bundling data and functionality together. Creating a new class makes a new object, enabling new instances of that type to be made.</li>
<li>Each class instance can have attributes attached to it for maintaining its state. Class instances can also have methods (defined by its class) for modifying its state.</li>
<li>Compared with other programming languages, Python’s class mechanism includes classes with a minimum of new syntax and semantics. It is a blend of the class mechanisms that are found in C++ and Modula-3.</li>
<li>In Python, the class inheritance mechanism allows multiple base classes, a derived class will override some methods of its base class, and the method will call a method of a base class with the same name.</li>
<li>Objects can contain random amounts and kinds of data. It is true for modules, classes split of the dynamic nature of Python: they are created at runtime, and then can be changed further after making.</li>
</ul>
</div>
</div>
<div class="subheading" style="text-align: justify;">
<h2 id="syntax">Syntax:</h2>
<div class="code-embed-wrapper"> <div class="code-embed-infos"> </div> <pre class="language-markdown code-embed-pre line-numbers"  data-start="1" data-line-offset="0"><code class="language-markdown code-embed-code">class ClassName:<br/>   &#039;Optional class documentation string&#039;<br/>   class_suite</code></pre> </div>
</div>
<div class="Content">
<div class="hddn">
<p style="text-align: justify;">The class has a documentation string, which can be accessed via ClassName.__doc__.</p>
<p style="text-align: justify;">The class_suite consists of all the component statement defining class members, data attributes and functions.</p>
</div>
</div>
</div>
</div>
]]></content:encoded>
					
					<wfw:commentRss>https://www.wikitechy.com/interview-questions/python/what-is-classes-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
