<?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 Archives -</title>
	<atom:link href="https://careersknowledge.in/category/python/feed/" rel="self" type="application/rss+xml" />
	<link>http://careersknowledge.in/category/python/</link>
	<description></description>
	<lastBuildDate>Sat, 18 May 2024 14:45:31 +0000</lastBuildDate>
	<language>en-US</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=7.0</generator>
	<item>
		<title>Top 20+ python projects with source code (2024)</title>
		<link>https://careersknowledge.in/python-projects-with-source-code-2024/</link>
					<comments>https://careersknowledge.in/python-projects-with-source-code-2024/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Sat, 18 May 2024 14:36:56 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Python mini projects for college students]]></category>
		<category><![CDATA[Python mini projects with source code]]></category>
		<category><![CDATA[Python projects for students]]></category>
		<category><![CDATA[Python Projects With Source Code]]></category>
		<category><![CDATA[Python projects with source code for final year Python projects with source code for beginners]]></category>
		<category><![CDATA[Python projects with source code free]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1646</guid>

					<description><![CDATA[<p>Hello Guys ! Once again welcome to our new blog. In this blog i am going to tell you python projects with source code. So must check out the full article in the middle of the blog you will get our live class link on YouTube so can see live development of the projects. Python ... <a title="Top 20+ python projects with source code (2024)" class="read-more" href="https://careersknowledge.in/python-projects-with-source-code-2024/" aria-label="Read more about Top 20+ python projects with source code (2024)">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/python-projects-with-source-code-2024/">Top 20+ python projects with source code (2024)</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Hello Guys ! Once again welcome to our new blog. In this blog i am going to tell you python projects with source code. So must check out the full article in the middle of the blog you will get our live class link on YouTube so can see live development of the projects.</span></p>
<h2 style="text-align: center;"><span style="color: #000000;"><strong>Python projects for beginners</strong></span></h2>
<p><span style="color: #000000;">Here we will learn python projects for beginners step by step. In this blog i m going to tell you<strong> Python mini projects with source code.</strong></span></p>
<p><span style="color: #000000;">In this blog, i am going to solve the your following queries</span></p>
<ul>
<li><span style="color: #008000;"><strong>Python projects with source code free</strong></span></li>
<li><span style="color: #008000;"><strong>Python projects with source code for final year</strong></span></li>
<li><span style="color: #008000;"><strong>Python projects with source code for beginners</strong></span></li>
<li><span style="color: #008000;"><strong>Python mini projects with source code</strong></span></li>
<li><span style="color: #008000;"><strong>Python mini projects for college students</strong></span></li>
<li><span style="color: #008000;"><strong>Python projects for students</strong></span></li>
</ul>
<h3 style="text-align: center;"><strong><span style="color: #000000;">python projects with source code</span></strong></h3>
<p><strong><span style="color: #ff0000;">1) WAP to enter Name,Age,mobile number and Address one by one.</span></strong></p>
<p><span style="color: #000000;">Code-</span></p>
<p><span style="color: #000000;">name=input(&#8220;enter name&#8221;)</span></p>
<p><span style="color: #000000;">age=int(input(&#8220;enter age&#8221;))</span></p>
<p><span style="color: #000000;">mobile=int(input(&#8220;enter mobile number&#8221;))</span></p>
<p><span style="color: #000000;">add=input(&#8220;enter address&#8221;)</span></p>
<p><span style="color: #000000;">print(&#8220;Name=&#8221;,name)</span></p>
<p><span style="color: #000000;">print(&#8220;Age=&#8221;,age)</span></p>
<p><span style="color: #000000;">print(&#8220;Mobile Number=&#8221;,mobile)</span></p>
<p><span style="color: #000000;">print(&#8220;Address=&#8221;,add)</span></p>
<p><span style="color: #ff0000;"><strong>2) WAP to enter 3 numbers and find their sum and average.</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">a=int(input(&#8220;enter number 1&#8221;))</span></p>
<p><span style="color: #000000;">b=int(input(&#8220;enter number 2&#8221;))</span></p>
<p><span style="color: #000000;">c=int(input(&#8220;enter number 3&#8221;))</span></p>
<p><span style="color: #000000;">sum=a+b+c</span></p>
<p><span style="color: #000000;">avg=sum/3</span></p>
<p><span style="color: #000000;">print(&#8220;Sum=&#8221;,sum)</span></p>
<p><span style="color: #000000;">print(&#8220;Average=&#8221;,avg)</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><strong><span style="color: #ff0000;">3) WAP to solve the quadratic equation</span></strong></p>
<p><strong><span style="color: #ff0000;">                            ax<sup>2</sup>+bx+c</span></strong></p>
<p><strong><span style="color: #000000;">Code</span></strong></p>
<p><span style="color: #000000;">import cmath</span></p>
<p><span style="color: #000000;">a=float(input(&#8220;enter number 1&#8221;))</span></p>
<p><span style="color: #000000;">b=float(input(&#8220;enter number 2&#8221;))</span></p>
<p><span style="color: #000000;">c=float(input(&#8220;enter number 3&#8221;))</span></p>
<p><span style="color: #000000;">d=(b**2)-4*a*c</span></p>
<p><span style="color: #000000;">sol1=-b-cmath.sqrt(d)/(2*a)</span></p>
<p><span style="color: #000000;">sol2=-b+cmath.sqrt(d)/(2*a)</span></p>
<p><span style="color: #000000;">print(&#8216;The solution are {0} and {1}&#8217;.format(sol1,sol2))</span></p>
<p><span style="color: #ff0000;"><strong>4) WAP to perform Swaping of two number without using third variable</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">a=10</span></p>
<p><span style="color: #000000;">b=20</span></p>
<p><span style="color: #000000;">print(&#8220;Value a before swaping a=&#8221;,a)</span></p>
<p><span style="color: #000000;">print(&#8220;Value a before swaping b=&#8221;,b)</span></p>
<p><span style="color: #000000;">a,b=b,a</span></p>
<p><span style="color: #000000;">print(&#8220;Value a after swaping a=&#8221;,a)</span></p>
<p><span style="color: #000000;">print(&#8220;Value a after swaping b=&#8221;,b)</span></p>
<p><span style="color: #ff0000;"><strong>5) WAP To create Login Application</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">user=input(&#8220;enter user name&#8221;)</span></p>
<p><span style="color: #000000;">pas=int(input(&#8220;enter password&#8221;))</span></p>
<p><span style="color: #000000;">if user==&#8221;python&#8221; and pas==123:</span></p>
<p><span style="color: #000000;">    print(&#8220;Welcome to our application&#8221;)</span></p>
<p><span style="color: #000000;">else:</span></p>
<p><span style="color: #000000;">    print(&#8220;Invalid username or password&#8221;)</span></p>
<p><span style="color: #ff0000;"><strong>6) WAP to create Table generate Application</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">n=int(input(&#8220;Enter any number&#8221;))</span></p>
<p><span style="color: #000000;">i=1</span></p>
<p><span style="color: #000000;">while i&lt;=10:</span></p>
<p><span style="color: #000000;">    t=n*i</span></p>
<p><span style="color: #000000;">    print(t)</span></p>
<p><span style="color: #000000;">    i=i+1</span></p>
<p><span style="color: #ff0000;"><strong>7) WAP to Generate number, square and Cube depending on user range.</strong></span></p>
<p><strong><span style="color: #000000;">Code</span></strong></p>
<p><span style="color: #000000;">st=int(input(&#8220;enter starting range&#8221;))</span></p>
<p><span style="color: #000000;">end=int(input(&#8220;enter ending range&#8221;))</span></p>
<p><span style="color: #000000;">while st&lt;=end:</span></p>
<p><span style="color: #000000;">    print(&#8220;Number=&#8221;,st)</span></p>
<p><span style="color: #000000;">    print(&#8220;Square=&#8221;,st*st)</span></p>
<p><span style="color: #000000;">    print(&#8220;cube=&#8221;,st*st*st)</span></p>
<p><span style="color: #000000;">    st=st+1</span></p>
<p><span style="color: #ff0000;"><strong>8) WAP to Calculate Simple Interest Depending on user choice</strong></span></p>
<p><strong><span style="color: #000000;">Code-</span></strong></p>
<p><span style="color: #000000;">ch=&#8217;y&#8217;</span></p>
<p><span style="color: #000000;">while ch==&#8217;y&#8217;:</span></p>
<p><span style="color: #000000;">    p=int(input(&#8220;enter principal&#8221;))</span></p>
<p><span style="color: #000000;">    r=int(input(&#8220;enter rate of interest&#8221;))</span></p>
<p><span style="color: #000000;">    t=int(input(&#8220;enter time&#8221;))</span></p>
<p><span style="color: #000000;">    si=p*r*t/100</span></p>
<p><span style="color: #000000;">    print(&#8220;Simple interest=&#8221;,si)</span></p>
<p><span style="color: #000000;">    ch=input(&#8220;do you want to continue(y/n)&#8221;)</span></p>
<p><span style="color: #ff0000;"><strong> 9) WAP to input 10 integer. Calculate and print the average of only positive integer among them. Negative number should not be processes and 0 should treated as end of input.</strong></span></p>
<p><span style="color: #000000;">sum=0</span></p>
<p><span style="color: #000000;">c=0</span></p>
<p><span style="color: #000000;">for i in range(10):</span></p>
<p><span style="color: #000000;">    n=int(input(&#8220;Enter the number&#8221;))</span></p>
<p><span style="color: #000000;">    if n==0:</span></p>
<p><span style="color: #000000;">        break</span></p>
<p><span style="color: #000000;">    if n&lt;0:</span></p>
<p><span style="color: #000000;">        continue</span></p>
<p><span style="color: #000000;">    sum=sum+n</span></p>
<p><span style="color: #000000;">    c=c+1</span></p>
<p><span style="color: #000000;">avg=sum/c</span></p>
<p><span style="color: #000000;">print(&#8220;Average of Positive Integer=&#8221;,avg)</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<h4><span style="color: #ff0000;"><strong>10) WAP to input two number one as numerator and second denominator. Calculate and print result of division of numbers.Program should repeat this process for 5 pair of number. Program should terminate its repetition when user input 0 as denominator.</strong></span></h4>
<p><span style="color: #000000;">i=1</span></p>
<p><span style="color: #000000;">while i&lt;=5:</span></p>
<p><span style="color: #000000;">    n=int(input(&#8220;Enter Numerator&#8221;))</span></p>
<p><span style="color: #000000;">    d=int(input(&#8220;Enter Denominator&#8221;))</span></p>
<p><span style="color: #000000;">    if d==0:</span></p>
<p><span style="color: #000000;">        print(&#8220;Division by zero.. Loop Terminated!!&#8221;)</span></p>
<p><span style="color: #000000;">        break</span></p>
<p><span style="color: #000000;">    r=n/d</span></p>
<p><span style="color: #000000;">    print(&#8220;Result=&#8221;,r)</span></p>
<p><span style="color: #000000;">    i=i+1</span></p>
<p><span style="color: #000000;">print(&#8220;Program Over!!!&#8221;)</span></p>
<p><span style="color: #ff0000;"><strong>11) Write a program to create a List of 10 numbers. While traversing the List print all its elements and count how many of them are positive, negative and zero.</strong></span></p>
<p><span style="color: #000000;">p=n=z=0</span></p>
<p><span style="color: #000000;">num=[5,-8,2,0,6,-2,4,0,6,-1]</span></p>
<p><span style="color: #000000;">print(&#8220;List elements….&#8221;)</span></p>
<p><span style="color: #000000;">for a in num:</span></p>
<p><span style="color: #000000;">    print(a,&#8221; &#8220;,end=&#8221;&#8221;)</span></p>
<p><span style="color: #000000;">    if(a&gt;0):</span></p>
<p><span style="color: #000000;">        p=p+1#1+1=2</span></p>
<p><span style="color: #000000;">    elif a&lt;0:</span></p>
<p><span style="color: #000000;">        n=n+1#1</span></p>
<p><span style="color: #000000;">    else:</span></p>
<p><span style="color: #000000;">        z=z+1#1</span></p>
<p><span style="color: #000000;">print(&#8220;\n\nNo.of positives=&#8221;, p)</span></p>
<p><span style="color: #000000;">print(&#8220;No. of negatives=&#8221;, n)</span></p>
<p><span style="color: #000000;">print(&#8220;No. of zeros=&#8221;, z)</span></p>
<p><iframe title="Top Python Project for Beginners to Advanced Level (Learn Python Practically) | Python Projects 2024" width="900" height="506" src="https://www.youtube.com/embed/4-V8hQn4Wuw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p><span style="color: #ff0000;"><strong>12) WAP which takes list of number as input and finds</strong></span></p>
<ol>
<li style="list-style-type: none;">
<ol>
<li><span style="color: #0000ff;">The largest number in the list</span></li>
<li><span style="color: #0000ff;">The smallest number in the list</span></li>
<li><span style="color: #0000ff;">Product of all the element in the list</span></li>
</ol>
</li>
</ol>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">num=[54,67,8,32,90]</span></p>
<p><span style="color: #000000;">min=num[0]</span></p>
<p><span style="color: #000000;">max=num[0]</span></p>
<p><span style="color: #000000;">mul=1</span></p>
<p><span style="color: #000000;">for i in num:</span></p>
<p><span style="color: #000000;">    mul=mul*i</span></p>
<p><span style="color: #000000;">    if i&gt;max:</span></p>
<p><span style="color: #000000;">        max=i</span></p>
<p><span style="color: #000000;">    if i&lt;min:</span></p>
<p><span style="color: #000000;">        min=i</span></p>
<p><span style="color: #000000;">print(&#8220;Maximum=&#8221;,max)</span></p>
<p><span style="color: #000000;">print(&#8220;Minimum=&#8221;,min)</span></p>
<p><span style="color: #000000;">print(&#8220;Product&#8221;,mul)</span></p>
<p><span style="color: #ff0000;"><strong>13) WAP to combine two dictionary adding values for common keys</strong></span></p>
<p>code</p>
<p><span style="color: #000000;">from collections import Counter</span></p>
<p><span style="color: #000000;">d1={&#8216;a&#8217;:100,&#8217;b&#8217;:200,&#8217;c&#8217;:300}</span></p>
<p><span style="color: #000000;">d2={&#8216;a&#8217;:300,&#8217;b&#8217;:200,&#8217;d&#8217;:400}</span></p>
<p><span style="color: #000000;">d=Counter(d1)+Counter(d2)</span></p>
<p><span style="color: #000000;">print(d)</span></p>
<p><span style="color: #ff0000;"><strong>14) WAP that takes sentence as input from the user and computes the frequency of each letter. Use a variable of dictionary type to maintain and show the frequency of each character.</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">str1=input(&#8220;enter any string&#8230;&#8221;)</span></p>
<p><span style="color: #000000;">f={}</span></p>
<p><span style="color: #000000;">for i in str1:</span></p>
<p><span style="color: #000000;">    if i in f:</span></p>
<p><span style="color: #000000;">        f[i]+=1</span></p>
<p><span style="color: #000000;">    else:</span></p>
<p><span style="color: #000000;">        f[i]=1</span></p>
<p><span style="color: #000000;">print(&#8220;Count of all characters in&#8221;,str1,&#8221;is:\n&#8221;+str(f))</span></p>
<p><a href="https://careersknowledge.in/scope-of-variable-in-python/">scope of variable in python example</a></p>
<p><span style="color: #ff0000;"><strong>15) Write a program to create a list of 5 names. The program should ask user to input a new name and index position to update the element with new name</strong></span></p>
<p><span style="color: #000000;">name=[&#8216;Aditi&#8217;,&#8217;Bhawna&#8217;, &#8216;Chetna&#8217;, &#8216;Dipika&#8217;, &#8216;Enabel&#8217;]</span></p>
<p><span style="color: #000000;">print(&#8220;The current List is: \n&#8221;, name)</span></p>
<p><span style="color: #000000;">k=input(&#8220;\nEnter a new name:&#8221;)</span></p>
<p><span style="color: #000000;">pos=int(input(&#8220;Enter the index to replace element: &#8220;))</span></p>
<p><span style="color: #000000;">name[pos]=k</span></p>
<p><span style="color: #000000;">print(&#8220;\nThe updated List = \n&#8221;, name)</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<h4><span style="color: #000000;"><span style="color: #ff0000;"><strong>16) Write a program to create a Tuple of age of 10 persons. While traversing the Tuple print all its elements and count how many of them are Major and Minor</strong></span>.</span></h4>
<p><span style="color: #000000;">t=(54,3,56,65,11,32,54,19,1,10)</span></p>
<p><span style="color: #000000;">mj=mn=0</span></p>
<p><span style="color: #000000;">for i in t:</span></p>
<p><span style="color: #000000;">    if i&gt;=18:</span></p>
<p><span style="color: #000000;">        mj=mj+1</span></p>
<p><span style="color: #000000;">    else:</span></p>
<p><span style="color: #000000;">        mn=mn+1</span></p>
<p><span style="color: #000000;">print(&#8220;No. of majors=&#8221;,mj)</span></p>
<p><span style="color: #000000;">print(&#8220;No. of minors=&#8221;,mn)</span></p>
<p>Subscribe Our Youtube Channel for more live project click on the below link</p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p><span style="color: #000000;"><strong><span style="color: #ff0000;">17) Write a program to input key for a dictionary of cricketer&#8217;s name. Check whether that key exist in the dictionary or not. If the key exist in the dictionary then give user a choice of deleting or updating that element</span></strong>.</span></p>
<p><span style="color: #000000;">cricker={1: &#8220;Sachin&#8221;, 2: &#8220;Dhoni&#8221;, 3:&#8221;Virat&#8221;, 4: &#8220;Rohit&#8221;, 5: &#8220;Rahane&#8221;}</span></p>
<p><span style="color: #000000;">c=int(input(&#8220;Enter a key: &#8220;))</span></p>
<p><span style="color: #000000;">if c in cricker:</span></p>
<p><span style="color: #000000;">    print(&#8220;Press 1 for Deleting the element&#8221;)</span></p>
<p><span style="color: #000000;">    print(&#8220;Press 2 for Updating the element&#8221;)</span></p>
<p><span style="color: #000000;">    ch=int(input(&#8220;Enter your choice…: &#8220;))</span></p>
<p><span style="color: #000000;">    if ch==1:</span></p>
<p><span style="color: #000000;">        print(&#8220;Deleted value is: &#8220;, cricker[c])</span></p>
<p><span style="color: #000000;">        del cricker[c]</span></p>
<p><span style="color: #000000;">    else:</span></p>
<p><span style="color: #000000;">        print(&#8220;Old Name:&#8221;, cricker[c])</span></p>
<p><span style="color: #000000;">        nm=input(&#8220;Enter new Cricketer’s Name:&#8221;)</span></p>
<p><span style="color: #000000;">        cricker[c]=nm</span></p>
<p><span style="color: #000000;">    print(&#8220;Final Dictionary Values are…&#8221;)</span></p>
<p><span style="color: #000000;">    for c in cricker:</span></p>
<p><span style="color: #000000;">        print(c, cricker[c])</span></p>
<p><span style="color: #000000;">else:</span></p>
<p><span style="color: #000000;">    print(&#8220;Key does not exist&#8221;)</span></p>
<p><span style="color: #ff0000;"><strong>18) Write a Program to input the value of x and calculate the result of the following equation</strong></span></p>
<p style="text-align: center;"><strong><span style="color: #000000;">e<sup>x</sup>+cosx<sup>0</sup>+root(x)</span></strong></p>
<p><span style="color: #000000;">from math import *</span></p>
<p><span style="color: #000000;">x=int(input(&#8220;enter x&#8221;))</span></p>
<p><span style="color: #000000;">a=exp(x)</span></p>
<p><span style="color: #000000;">b=cos(x*(3.14/180))</span></p>
<p><span style="color: #000000;">c=sqrt(x)</span></p>
<p><span style="color: #000000;">r=a+b+c</span></p>
<p><span style="color: #000000;">print(r)</span></p>
<p><span style="color: #ff0000;"><strong>19) Write a program using user defined function with default argument. Calculate and print percentage of three subject marks. Use 300 as default value for maximum marks.</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">def per(a,b,c,mm=300):</span></p>
<p><span style="color: #000000;">    p=(a+b+c)*100/mm</span></p>
<p><span style="color: #000000;">    print(&#8220;Percentage=&#8221;,p)</span></p>
<p><span style="color: #000000;">per(85,74,96)</span></p>
<p><span style="color: #000000;">per(45,35,42,150)</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><span style="color: #ff0000;"><strong>20) Create area module in python and import in our program.</strong></span></p>
<p><strong>Code</strong></p>
<p><span style="color: #000000;">area.py(creating module) </span></p>
<p><span style="color: #000000;">def tarea(b,h):</span></p>
<p><span style="color: #000000;">    ar=(b*h)/2</span></p>
<p><span style="color: #000000;">    print(&#8220;Area of triangle=&#8221;,ar)</span></p>
<p><span style="color: #000000;">def carea(r):</span></p>
<p><span style="color: #000000;">    ar=3.14*r*r</span></p>
<p><span style="color: #000000;">    print(&#8220;Area of circle=&#8221;,ar)</span></p>
<p><span style="color: #000000;"><strong>calling module</strong></span></p>
<p><span style="color: #000000;">from area import *</span></p>
<p><span style="color: #000000;">tarea(10,20)</span></p>
<p><span style="color: #000000;">carea(5)</span></p>
<p><strong>Also Check Our Latest Uploads</strong></p>
<p><a href="https://careersknowledge.in/python-user-defined-functions-with-examples2024/">Python user defined functions with examples(2024)</a></p>
<p><a href="https://careersknowledge.in/python-modules/">python modules create and import in python</a></p>
<p>The post <a href="https://careersknowledge.in/python-projects-with-source-code-2024/">Top 20+ python projects with source code (2024)</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/python-projects-with-source-code-2024/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>scope of variable in python example</title>
		<link>https://careersknowledge.in/scope-of-variable-in-python/</link>
					<comments>https://careersknowledge.in/scope-of-variable-in-python/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Tue, 14 May 2024 16:32:35 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[global variable python]]></category>
		<category><![CDATA[python local variable]]></category>
		<category><![CDATA[scope of variable in python]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1641</guid>

					<description><![CDATA[<p>Hello Students Welcome to our new python blog. In this blog i am going to tell you scope of variable in python in details. In this blog you will also learn types of scope in python. Here we will learn global scope in python and local scope in python in details. So must check out the ... <a title="scope of variable in python example" class="read-more" href="https://careersknowledge.in/scope-of-variable-in-python/" aria-label="Read more about scope of variable in python example">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/scope-of-variable-in-python/">scope of variable in python example</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Hello Students Welcome to our new python blog. In this blog i am going to tell you <strong>scope of variable in python </strong>in details. In this blog you will also learn types of scope in python. Here we will learn <strong>global scope in python</strong> and<strong> local scope in python</strong> in details. So must check out the full article</span></p>
<h2 style="text-align: center;"><span style="color: #000000;"><strong>Scope Of Python Variable</strong></span></h2>
<p><span style="color: #000000;">The scopes of a variable are the rules that determine in which part(s) of the program that variable is identified and can be accessed. There are two kinds of scope of variable in Python: Global Scope and Local Scope. Which variables are global and local? How? When? Where? Why? can global and local variable be created and used, is all part of the discussion in this chapter. While reading this chapter you will learn about LEGB rule, followed by computer to search a variable used in the program. At the end this chapter explains the process of creating our own modules of functions and module functions: dir() and reload().</span></p>
<h3><span style="color: #000000;"><strong>Types of scope in python</strong></span></h3>
<p><span style="color: #000000;">The scopes of a variable in programming language are the rules that determine in which part(s) of the program that variable is identified and can be accessed. There are two kinds of scope of variable in Python:</span></p>
<ol>
<li><span style="color: #000000;">Global Scope </span></li>
<li><span style="color: #000000;">Local Scope</span></li>
</ol>
<p><span style="color: #000000;"><strong>1) Global Scope or global variable python</strong></span></p>
<p><span style="color: #000000;">A variable declared in top most level segment (_main_) of the program is said to have global scope. In other words any variable which is created and initialized in main program and not i any function or other block is having global scope. Any variable which is created with global scope is accessible within the whole program including all the functions and blocks of the program.</span></p>
<p><span style="color: #000000;"><strong>2) Local Scope or local variable python</strong></span></p>
<p><span style="color: #000000;">A variable created and initialized within a function body is said to have local scope i.e. the variable created inside the function can be used or accessed only within that function. The local variables are not known outside the function in which they are created. The following program demonstrate the concept of local and global scope.</span></p>
<p style="text-align: center;"><span style="color: #000000;"><b>python local and global variable examples</b></span></p>
<p><span style="color: #000000;">Consider another example of Python program that explain how global variable are accessible in the whole program and error generated when local variables are used outside the function.</span></p>
<p><a href="https://careersknowledge.in/python-modules/">python modules create and import in python</a></p>
<p><a href="https://careersknowledge.in/python-user-defined-functions-with-examples2024/">Python user defined functions with examples(2024)</a></p>
<p><span style="color: #ff0000;"><strong>Write a program to input three numbers. Calculate and print average numbers using user define function.</strong></span></p>
<p><span style="color: #0000ff;">def avrg():</span></p>
<p><span style="color: #0000ff;">           avg=(a+b+c)/3</span></p>
<p><span style="color: #0000ff;">          print(&#8220;Average&#8221;, avg)</span></p>
<p><span style="color: #0000ff;">#main program</span></p>
<p><span style="color: #0000ff;">a=int(input(&#8220;Enter First number :&#8221;))</span></p>
<p><span style="color: #0000ff;">b=int(input(&#8220;Enter Second number :&#8221;))</span></p>
<p><span style="color: #0000ff;">c=int(input(&#8220;Enter Third number :&#8221;))</span></p>
<p><span style="color: #0000ff;">avrg()</span></p>
<p><span style="color: #0000ff;">print(&#8220;Average=&#8221;, avg)#error</span></p>
<h3 style="text-align: center;"><span style="color: #000000;"><strong>Local and Global variable with same name</strong></span></h3>
<p><span style="color: #000000;">If in a function we create a variable by assigning it a values, using the name which is already present in global environment then Python creates a new variable in its local scope and does not uses its higher scope variable. Following program demonstrate this concept of hiding global variable when local variable is created with same name.</span></p>
<p><span style="color: #0000ff;">def func1():</span></p>
<p><span style="color: #0000ff;">               k=10</span></p>
<p><span style="color: #0000ff;">               print(&#8220;K=&#8221;,k)#10</span></p>
<p><span style="color: #0000ff;">#main program</span></p>
<p><span style="color: #0000ff;">k=25&#8212;-Global</span></p>
<p><span style="color: #0000ff;">print(&#8220;K=&#8221;,k)#25</span></p>
<p><span style="color: #0000ff;">func1()</span></p>
<p><span style="color: #0000ff;">print(&#8220;K=&#8221;, k)#25</span></p>
<h4><span style="color: #ff0000;"><strong>global variable in python example</strong></span></h4>
<p><span style="color: #0000ff;">def test():</span></p>
<p><span style="color: #0000ff;">k=15</span></p>
<p><span style="color: #0000ff;">print(&#8220;Values in Function&#8230;&#8221;)</span></p>
<p><span style="color: #0000ff;">print(&#8220;K=&#8221;,k)#15</span></p>
<p><span style="color: #0000ff;">print(&#8220;M=&#8221;,m)#10</span></p>
<p><span style="color: #0000ff;">#main program</span></p>
<p><span style="color: #0000ff;">k=25</span></p>
<p><span style="color: #0000ff;">m=10</span></p>
<p><span style="color: #0000ff;">print(&#8220;Values in main before calling Function&#8230;&#8221;)</span></p>
<p><span style="color: #0000ff;">print(&#8220;K=&#8221;k)#25</span></p>
<p><span style="color: #0000ff;">print(&#8220;M=&#8221;,m)#10</span></p>
<p><span style="color: #0000ff;">test()</span></p>
<p><span style="color: #0000ff;">print(&#8220;Values in main after calling Function&#8230;&#8221;)</span></p>
<p><span style="color: #0000ff;">print(&#8220;K=&#8221;k)#25</span></p>
<p><span style="color: #0000ff;">print(&#8220;M=&#8221;,m)#10</span></p>
<p><iframe title="Nielit Olevel Python Module with Examples | How to create own module in python | Python Tutorial" width="900" height="506" src="https://www.youtube.com/embed/_KY9c3AEceU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<h3 style="text-align: center;"><strong><span style="color: #000000;">Difference between python local and global variable</span></strong></h3>
<p><span style="color: #000000;"><strong>Python local variable</strong></span></p>
<ul>
<li><span style="color: #000000;">The variable created or declared inside the function is called local variable.</span></li>
<li><span style="color: #000000;">local variable can not be used outside the function.</span></li>
<li><span style="color: #000000;">The scope of local variable is only within the function.</span></li>
<li><span style="color: #000000;">If we declare variable like a=10 than we can use this value inside the function if we print the value of a outside the function then we will get the error <span style="color: #ff0000;">( a is not defined)</span></span></li>
<li><span style="color: #000000;">If we declare local and global variable with same name then function always takes priority to local variable.</span></li>
</ul>
<p><span style="color: #000000;"><strong>Python global variable</strong></span></p>
<ul>
<li><span style="color: #000000;">The variable created or declared outside the function is called <strong>global variable.</strong></span></li>
<li><span style="color: #000000;">Global variable can be used inside or outside the function.</span></li>
<li><span style="color: #000000;">The scope of global variable is within the function and also outside the function.</span></li>
<li><span style="color: #000000;">If we declare variable like a=10 than we can print this value inside the function as well as  of a outside the function.</span></li>
<li><span style="color: #000000;">If we declare local and global variable with same name then global scope always takes priority to global variable.</span></li>
</ul>
<p><span style="color: #ff0000;"><strong>Subscribe Our YouTube Channel For Live Class</strong></span></p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p><span style="color: #000000;"><strong>Also Check Our Latest Uploads</strong></span></p>
<p><a href="https://careersknowledge.in/python-library-function-examples/">Python library function examples</a></p>
<p><a href="https://careersknowledge.in/dictionary-in-python/">What is a dictionary in Python?</a></p>
<p><a href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/">dictionary functions in python with examples (2024)</a></p>
<p>The post <a href="https://careersknowledge.in/scope-of-variable-in-python/">scope of variable in python example</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/scope-of-variable-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>python modules create and import in python</title>
		<link>https://careersknowledge.in/python-modules/</link>
					<comments>https://careersknowledge.in/python-modules/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Sun, 12 May 2024 16:43:59 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[how to create own python module]]></category>
		<category><![CDATA[importing python module]]></category>
		<category><![CDATA[python module examples]]></category>
		<category><![CDATA[python modules]]></category>
		<category><![CDATA[python package]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1633</guid>

					<description><![CDATA[<p>Hello Students welcome to our new blog. In this blog i am going to tell you about python module. Here we will  Create python modules and import in python. So must read the full blog. In the middle of the article you will get the video link of live class. Introduction Every program that we ... <a title="python modules create and import in python" class="read-more" href="https://careersknowledge.in/python-modules/" aria-label="Read more about python modules create and import in python">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/python-modules/">python modules create and import in python</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Hello Students welcome to our new blog. In this blog i am going to tell you about python module. Here we will  Create python modules and import in python. So must read the full blog. In the middle of the article you will get the video link of live class.</span></p>
<p><img fetchpriority="high" decoding="async" class="aligncenter size-full wp-image-1637" src="http://careersknowledge.in/wp-content/uploads/2024/05/python-modules-with-example-1.jpg" alt="python modules" width="600" height="338" srcset="https://careersknowledge.in/wp-content/uploads/2024/05/python-modules-with-example-1.jpg 600w, https://careersknowledge.in/wp-content/uploads/2024/05/python-modules-with-example-1-324x183.jpg 324w, https://careersknowledge.in/wp-content/uploads/2024/05/python-modules-with-example-1-300x169.jpg 300w" sizes="(max-width: 600px) 100vw, 600px" /></p>
<h2><span style="color: #000000;"><strong>Introduction</strong></span></h2>
<p><span style="color: #000000;">Every program that we create Python is treated as a module. It logically organizes Python functions in a single program file Grouping related code into a module makes the code easier to understand and use. In oth words a module can be defined as &#8211; &#8220;A module is a group of functions, classes and variable saved as a python program file (.py)&#8221;.</span></p>
<p><span style="color: #000000;">In the Python programming that we have learnt so far we have used two readymade Python modules (Math and Random) and the function defines in them. Now, in this blog we will learn to <strong>create your own python module or custom python module</strong> which we can import in our any program later when neede User defined modules can be A module can be defined as a file consisting of Python code created in the following three steps-</span></p>
<ol>
<li><span style="color: #000000;">Creating Module</span></li>
<li><span style="color: #000000;">Importing Module</span></li>
<li><span style="color: #000000;">Calling Module Object</span></li>
</ol>
<h3><span style="color: #000000;"><strong>1) Creating python modules</strong></span></h3>
<p><span style="color: #000000;">As defined earlier a module is just a Python&#8217;s program file consisting of functions, so, to create a new module open a new Python program file and define function(s) in it. Python module generally does not have global environment i.e. it does not need any main program. It can have only function definitions and no calling of function. But a module can have more than one function,</span></p>
<p><span style="color: #000000;">For example, type the following functions in a python program file and save it in the default Python directory by the name &#8216;mymod.py&#8217;. This program file will become a Python module created with the name &#8216;mymod&#8217; having two function namely tarea() and carea().</span></p>
<p><span style="color: #000000;">def tarea(b, h):</span></p>
<p><span style="color: #000000;">ar=(b*h)/2</span></p>
<p><span style="color: #000000;">print(&#8220;Area of Triangle: &#8220;, ar)</span></p>
<p><span style="color: #000000;">def carea(r):</span></p>
<p><span style="color: #000000;">ar=3.14*r*r</span></p>
<p><span style="color: #000000;">print(&#8220;Area of Circle:&#8221;, ar)</span></p>
<p><span style="color: #ff0000;"><strong>Watch Our Full Video on Youtube</strong></span></p>
<p><iframe loading="lazy" title="Nielit Olevel Python Module with Examples | How to create own module in python | Python Tutorial" width="900" height="506" src="https://www.youtube.com/embed/_KY9c3AEceU?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p><span style="color: #000000;"><strong>2) Importing Module</strong></span></p>
<p><span style="color: #000000;">Once a module is created and saved it can be used in any program, any number time because it has become a permanent record. We can use our Python module by executing an import statement in some other Python source file. The &#8216;import&#8217; has the following syntax:</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">import module 1, module2,&#8230;</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">import mymod</span></p>
<p><span style="color: #000000;">Python has few other ways to import a module in a program and use its function there. The first is Python&#8217;s &#8216;from&#8230;import&#8217; statement. It lets us import specific function from a module into the current program file. The functions imported in this way can be called directly by their name without module name.</span></p>
<p><span style="color: #ff0000;"><strong>Syntax</strong></span></p>
<p><span style="color: #008000;">from module_name import fname 1, fname2,&#8230;</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">from mymod import tarea</span></p>
<p><span style="color: #000000;">tarea(4,3)</span></p>
<p><a href="https://careersknowledge.in/python-user-defined-functions-with-examples2024/">Python user defined functions with examples(2024)</a></p>
<h3><span style="color: #000000;"><strong>3) Calling Module Objects</strong></span></h3>
<p><span style="color: #000000;">User defined module helps re-usability of codes defined in it as functions. So, once the module is created and functions defined we can call functions as follows-</span></p>
<p><span style="color: #ff0000;"><strong>Syntax</strong></span></p>
<p><span style="color: #008000;">&lt;module name&gt;.&lt;funct_name&gt;(&lt;list of values&gt;)</span></p>
<p><span style="color: #000000;">mymod.tarea(5, 11)</span></p>
<p><span style="color: #000000;"><strong>Subscribe Our Youtube Channel By click on the link below</strong></span></p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<h4 style="text-align: center;"><span style="color: #000000;"><strong>Python Module Example</strong></span></h4>
<p><span style="color: #ff0000;"><strong>Create a python module mymod.py which contain two functions namelu tarea and carea after that call this module from the other program</strong></span></p>
<p><span style="color: #000000;"><strong>mymod.py</strong></span></p>
<p><span style="color: #0000ff;">def tarea(b,h):</span><br />
<span style="color: #0000ff;">             ar=(b*h)/2</span><br />
<span style="color: #0000ff;">            print(&#8220;Area of triangle=&#8221;,ar)</span><br />
<span style="color: #0000ff;">def carea(r):</span><br />
<span style="color: #0000ff;">              ar=3.14*r*r</span><br />
<span style="color: #0000ff;">             print(&#8220;Area of circle=&#8221;,ar)</span></p>
<p><span style="color: #000000;"><strong>test.py</strong></span></p>
<p><span style="color: #000000;">Note- In this file we will import our own create python module</span></p>
<p><span style="color: #0000ff;">from area import *</span><br />
<span style="color: #0000ff;">tarea(5,10)</span><br />
<span style="color: #0000ff;">carea(5)</span></p>
<p><span style="color: #ff0000;"><strong>Output</strong></span></p>
<p><span style="color: #000000;">Area of triangle= 25.0</span></p>
<p><span style="color: #000000;">Area of circle= 78.5</span></p>
<p><span style="color: #000000;"><strong>Also Check Our Latest Uploads</strong></span></p>
<p><a href="https://careersknowledge.in/python-library-function-examples/">Python library function examples</a></p>
<p><a href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/">Dictionary operations in python with examples</a></p>
<p><a href="https://careersknowledge.in/dictionary-operations-in-python/">Dictionary operations in python with examples</a></p>
<p>The post <a href="https://careersknowledge.in/python-modules/">python modules create and import in python</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/python-modules/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Python user defined functions with examples(2024)</title>
		<link>https://careersknowledge.in/python-user-defined-functions-with-examples2024/</link>
					<comments>https://careersknowledge.in/python-user-defined-functions-with-examples2024/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Thu, 09 May 2024 17:07:58 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[python function with arguments and retuirn value]]></category>
		<category><![CDATA[python named argument]]></category>
		<category><![CDATA[Python user defined functions]]></category>
		<category><![CDATA[types of user defined function with examples]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1626</guid>

					<description><![CDATA[<p>Python User Defined Function A function is a sub program that acts on data and may or may not return a value. When same code is required to execute number of times, we can write a function for it and then call this function as many times as needed. Here you will learn Python user ... <a title="Python user defined functions with examples(2024)" class="read-more" href="https://careersknowledge.in/python-user-defined-functions-with-examples2024/" aria-label="Read more about Python user defined functions with examples(2024)">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/python-user-defined-functions-with-examples2024/">Python user defined functions with examples(2024)</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2><span style="color: #000000;"><strong>Python User Defined Function</strong></span></h2>
<p><span style="color: #000000;">A function is a sub program that acts on data and may or may not return a value. When same code is required to execute number of times, we can write a function for it and then call this function as many times as needed. Here you will learn <strong>Python user defined functions with examples-</strong></span></p>
<p><span style="color: #000000;">Using user defined function is a two steps process-</span></p>
<p><span style="color: #000000;">1) Defining a Function</span></p>
<p><span style="color: #000000;">2)Invoking a Function or calling a function</span></p>
<p><span style="color: #000000;"><strong>1) Defining a Function</strong></span></p>
<p><span style="color: #000000;">To defining a function we use def keyword to define a function.</span></p>
<p><span style="color: #000000;"><strong>Syntax-</strong></span></p>
<p><span style="color: #000080;"> def function name(&lt;argument&gt;):</span></p>
<p><span style="color: #000080;">                                &lt;body of function&gt;</span></p>
<p><span style="color: #000000;"><strong>2)Invoking a Function or calling a function</strong></span></p>
<p>Once the function is defined we can call this function by the following statement. In this article we will see in details</p>
<p><span style="color: #000000;"><strong>Syntax</strong></span></p>
<p><span style="color: #000000;">function();</span></p>
<p><span style="color: #000000;">fucntion(values);</span></p>
<p>&nbsp;</p>
<p><span style="color: #ff0000;"><strong>Example- Write a program to find area of circle using user defined function .</strong></span></p>
<p><span style="color: #000000;"><strong>How to define a function in Python</strong></span></p>
<p><span style="color: #040487;">def tarea(b,h):                           <span style="color: #000000;"><strong> #defining a function</strong></span></span><br />
<span style="color: #040487;">         area=(b*h)/2</span><br />
<span style="color: #040487;">         print(&#8220;Area of triangle=&#8221;,area)</span><br />
<span style="color: #040487;">#main</span><br />
<span style="color: #040487;">b1=int(input(&#8220;enter base&#8221;))</span><br />
<span style="color: #040487;">h1=int(input(&#8220;enter base&#8221;))</span><br />
<span style="color: #040487;">tarea(b1,h1)   <span style="color: #000000;"><strong> #function calling or invoking</strong></span></span></p>
<p><strong>Output</strong></p>
<p><span style="color: #008000;">enter base 4</span><br />
<span style="color: #008000;">enter base 5</span><br />
<span style="color: #008000;">Area of triangle= 10.0</span></p>
<p><a href="https://careersknowledge.in/python-library-function-examples/">Python library function examples</a></p>
<h3 class="s75CSd u60jwe r2fjmd AB4Wff" style="text-align: center;"><span style="color: #000000;"><strong>types of user-defined functions in python</strong></span></h3>
<p><span style="color: #000000;">There are the following <strong>list of user defined functions in python</strong></span></p>
<p><span style="color: #000000;">1) Python function with argument and return value</span></p>
<p><span style="color: #000000;">2) Python function with argument and without return value</span></p>
<p><span style="color: #000000;">3) Python function without argument and without  return value</span></p>
<p><span style="color: #000000;">4) Python function without argument and return value</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><strong><span style="color: #000000;">1) Python function with argument and return value</span></strong></p>
<p><span style="color: #000000;">This types of function takes values from the calling program and return value to the calling program.</span></p>
<p><span style="color: #ff0000;"><strong>Example</strong></span></p>
<p><span style="color: #000000;"><span style="color: #0000ff;">def sum(a,b):</span><br />
<span style="color: #0000ff;">        c=a+b</span><br />
<span style="color: #0000ff;">        return c</span><br />
<span style="color: #0000ff;">#main</span><br />
<span style="color: #0000ff;">a1=int(input(&#8220;enter the value of a&#8221;))</span><br />
<span style="color: #0000ff;">b1=int(input(&#8220;enter the value of b&#8221;))</span><br />
<span style="color: #0000ff;">print(&#8220;Sum of a and b=&#8221;,sum(a1,b1))</span><br />
</span></p>
<p><span style="color: #000000;"><strong>Output</strong><br />
<span style="color: #008000;">enter the value of a 5</span><br />
<span style="color: #008000;">enter the value of b 4</span><br />
<span style="color: #008000;">Sum of a and b= 9</span></span></p>
<p><span style="color: #000000;"><strong>2) Python function with argument and without return value</strong></span></p>
<p><span style="color: #000000;">This types of function takes values from the calling program and does not return value to the calling program.</span><span style="color: #000000;"><strong><br />
</strong></span></p>
<p><strong><span style="color: #ff0000;">Example</span></strong></p>
<p><span style="color: #0000ff;">def sum(a,b):</span><br />
<span style="color: #0000ff;">      c=a+b</span><br />
<span style="color: #0000ff;">       print(&#8220;Sum of a and b=&#8221;,c)</span><br />
<span style="color: #0000ff;">#main</span><br />
<span style="color: #0000ff;">a1=int(input(&#8220;enter the value of a&#8221;))</span><br />
<span style="color: #0000ff;">b1=int(input(&#8220;enter the value of b&#8221;))</span><br />
<span style="color: #0000ff;">sum(a1,b1)</span></p>
<p><strong>Output</strong></p>
<p><span style="color: #008000;">enter the value of a 5</span><br />
<span style="color: #008000;">enter the value of b 6</span><br />
<span style="color: #008000;">Sum of a and b= 11</span></p>
<p><strong><span style="color: #000000;">3) Python function without argument and without  return value</span></strong></p>
<p><span style="color: #000000;">This types of function does not takes values from the calling program and also does not return value to the calling program.</span></p>
<p><strong><span style="color: #ff0000;">Example</span></strong></p>
<p><span style="color: #0000ff;">def sum():</span><br />
<span style="color: #0000ff;">       a=int(input(&#8220;enter the value of a&#8221;))</span><br />
<span style="color: #0000ff;">      b=int(input(&#8220;enter the value of b&#8221;))</span><br />
<span style="color: #0000ff;">      c=a+b</span><br />
<span style="color: #0000ff;">       print(&#8220;Sum of a and b=&#8221;,c)</span><br />
<span style="color: #0000ff;">#main</span><br />
<span style="color: #0000ff;">sum()</span></p>
<p><span style="color: #000000;"><strong>Output</strong></span><br />
<span style="color: #008000;">enter the value of a 9</span><br />
<span style="color: #008000;">enter the value of b 3</span><br />
<span style="color: #008000;">Sum of a and b= 1</span></p>
<p><strong><span style="color: #000000;">4) Python function without argument and return value</span></strong></p>
<p><span style="color: #000000;">This types of function does not takes values from the calling program but return value to the calling program.</span></p>
<p><span style="color: #ff0000;"><strong>Example</strong></span></p>
<p><span style="color: #0000ff;">def sum():</span><br />
<span style="color: #0000ff;">       a=int(input(&#8220;enter the value of a&#8221;))</span><br />
<span style="color: #0000ff;">      b=int(input(&#8220;enter the value of b&#8221;))</span><br />
<span style="color: #0000ff;">      c=a+b</span><br />
<span style="color: #0000ff;">      return c</span><br />
<span style="color: #0000ff;">#main</span><br />
<span style="color: #0000ff;">print(&#8220;Sum of a and b=&#8221;,sum())</span></p>
<p>Output<br />
<span style="color: #008000;">enter the value of a 65</span><br />
<span style="color: #008000;">enter the value of b 43</span><br />
<span style="color: #008000;">Sum of a and b= 108</span></p>
<h3 style="text-align: center;"><span style="color: #000000;"><strong>Python Named Arguments function</strong></span></h3>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><span style="color: #000000;">To have full control and flexibility over the order of values sent to the arguments Python provided another type of arguments called Keyword or Named arguments. In other words Keyword argument offer a way of writing function calls where we can write any value in any order provided we name </span><span style="color: #000000;">the argument. Since in function call we write values along with argument name, we can write values in order. For example following are the valid of calling statements of function sum()</span></p>
<p><span style="color: #000000;">sum(y=8, x=6, z=2)</span></p>
<p><span style="color: #000000;">In the above written function call value 6 is going to x, value 8 is going to y and z will take value 2. This transfer values is irrespective of order of argument in function header.</span></p>
<p><span style="color: #000000;">sum(z=3, y=4, x=9)</span></p>
<p><span style="color: #000000;">In the above written function call value 9 is going to x, value 4 is going to y and z will take value 3. This transfer values is irrespective of order of argument in function header.</span></p>
<div class="s75CSd u60jwe r2fjmd AB4Wff" style="text-align: left;"><span style="color: #ff0000;"><strong>Python named arguments function examples</strong></span></div>
<p><span style="color: #0000ff;">def test(a, b, c):</span></p>
<p><span style="color: #0000ff;">                p=(a+b)/c</span></p>
<p><span style="color: #0000ff;">                return p</span></p>
<p><span style="color: #0000ff;">#main</span></p>
<p><span style="color: #0000ff;">r=test(a=5, b=9, c=7)</span></p>
<p><span style="color: #0000ff;">print(&#8220;Result: &#8220;, r)</span></p>
<p><span style="color: #0000ff;">r=test(c=4, a=11, b=9)</span></p>
<p><span style="color: #0000ff;">print(&#8220;Result:&#8221;,r)</span></p>
<p><iframe loading="lazy" title="User Defined Function in Python | Types Of Functions in Python | Python Tutorial Day-34" width="900" height="506" src="https://www.youtube.com/embed/-GSDPYOEsA4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<h3 style="text-align: center;"><span style="color: #000000;"><strong>Python Default Arguments Functions</strong></span></h3>
<p><span style="color: #000000;">arguments which have some value in function header called Default arguments. While fnction call we can skip the value of default argument. For example-</span></p>
<p><span style="color: #000000;">def sum(x, y, z=4)</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><span style="color: #000000;">the above example of function header argument &#8216;z&#8217; is having a value 4 assigned to it, so,</span><span style="color: #000000;">argument &#8216;z&#8217; is default argument. Now, while calling this function we can give values for only </span><span style="color: #000000;">argument x and y; z will take 4 as its value.</span></p>
<p><span style="color: #000000;">We can even give values for all the three arguments also. In that case argument &#8216;z&#8217; will take value provided by the user and ignore its default value. So we can say that in while calling function with default argument, the calling statement can have number of values less than or equals to the </span><span style="color: #000000;">number of arguments in the function header. But, order of values has to be the same. For emple following are the valid example of calling statements of function sum()</span></p>
<p><span style="color: #000000;">sum(5,9,7)</span></p>
<p><span style="color: #000000;">In the above calling statement function argument x will take value 5, y will take value 9 and value 7 will be stored in z (&#8216;z&#8217; will ignore its default value 4).</span></p>
<p><span style="color: #000000;">sum(8, 2)</span></p>
<p><span style="color: #000000;">In the above calling statement function argument x will take value 8, y will take value 9 and z will</span></p>
<p><span style="color: #000000;">have its default value (4) as we have not exclusively provided value for z in calling statement.</span></p>
<p><span style="color: #000000;">Any argument, in a function header, cannot have default value unless all arguments on its right side have their default values. In other words only those arguments can have default values which are present in the right side of argument list. For example following is the list of some valid and invalid function header with default argument~</span></p>
<p><span style="color: #000000;">Valid Examples</span></p>
<p><span style="color: #000000;">sum(x, y, z=4)</span></p>
<p><span style="color: #000000;">sum(x,y=5, z=4)</span></p>
<p><span style="color: #000000;">sum(x=8, y=5, 2=4)</span></p>
<p><span style="color: #000000;">sum(x=3, y, z) sum(x,y=5, z) sum(x=8, y=5, z)</span></p>
<p><span style="color: #000000;">Invalid Examples</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- displayads1111 --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="3719459320" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p>For Live Class Subscribe Our Youtube Channel by click on the below link</p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p><span style="color: #ff0000;"><strong>Write a program using user defined function with default argument. Calculate and print percentage of three subject marks. Use 300 as default value for maximum marks.</strong></span></p>
<p><span style="color: #0000ff;">def percent(a, b, c, mm=300):</span></p>
<p><span style="color: #0000ff;">                total=a+b+c</span></p>
<p><span style="color: #0000ff;">                p=total*100/mm</span></p>
<p><span style="color: #0000ff;">                return p</span></p>
<p><span style="color: #0000ff;">#main</span></p>
<p><span style="color: #0000ff;">print(&#8220;Percentage=&#8221;,percent(75,85,50)</span></p>
<p><span style="color: #0000ff;">print(&#8220;Percentage=&#8221;,percent(45,35,40,150)</span></p>
<h3 style="text-align: center;"><span style="color: #000000;"><strong>python recursion functions</strong></span></h3>
<p><span style="color: #000000;">A Function calls it self again and again then it is called Recursion.</span></p>
<p><span style="color: #ff0000;"><strong>Example- python recursion factorial program </strong></span></p>
<p><span style="color: #0000ff;">def factorial(x):</span><br />
<span style="color: #0000ff;">          if x==1:</span><br />
<span style="color: #0000ff;">                 return 1</span><br />
<span style="color: #0000ff;">          else:</span><br />
<span style="color: #0000ff;">                 return x*factorial(x-1)</span><br />
<span style="color: #0000ff;">#main program</span><br />
<span style="color: #0000ff;">num=int(input(&#8220;Enter a number:&#8221;))</span><br />
<span style="color: #0000ff;">fact=factorial(num)</span><br />
<span style="color: #0000ff;">print(&#8220;Factorial of number = &#8220;,fact)</span></p>
<p><span style="color: #000000;"><strong>Output</strong></span></p>
<p><span style="color: #008000;">Enter a number:5</span><br />
<span style="color: #008000;">Factorial of number = 120</span></p>
<p><span style="color: #000000;"><strong>Thanks for reading the article Python user defined functions.</strong></span></p>
<p><iframe loading="lazy" title="Nielit OLevel Recursion Function Tutorial | Keyword Vs Default Argument | User Defined Function |" width="900" height="506" src="https://www.youtube.com/embed/ErfkWCi7ioY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p><strong><span style="color: #ff0000;">Also Check Our Latest Uploads</span></strong></p>
<p><a href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/">dictionary functions in python with examples (2024)</a></p>
<p><a href="https://careersknowledge.in/dictionary-operations-in-python/">Dictionary operations in python with examples</a></p>
<p>The post <a href="https://careersknowledge.in/python-user-defined-functions-with-examples2024/">Python user defined functions with examples(2024)</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/python-user-defined-functions-with-examples2024/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>Python library function examples</title>
		<link>https://careersknowledge.in/python-library-function-examples/</link>
					<comments>https://careersknowledge.in/python-library-function-examples/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Fri, 03 May 2024 16:56:20 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1618</guid>

					<description><![CDATA[<p>Introduction A Python module is a program file(.py) containing Variables, Class definition, Statements and Junctions related to a particular task. Every program that we write in Python is also called module. In addition to it, Python comes loaded with some pre-defined modules called Standard Library Modules. Each of these modules contains some built in functions ... <a title="Python library function examples" class="read-more" href="https://careersknowledge.in/python-library-function-examples/" aria-label="Read more about Python library function examples">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/python-library-function-examples/">Python library function examples</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<h2 style="text-align: center;"><span style="color: #000000;"><strong>Introduction</strong></span></h2>
<p><span style="color: #000000;">A Python module is a program file(.py) containing Variables, Class definition, Statements and Junctions related to a particular task. Every program that we write in Python is also called module. In addition to it, Python comes loaded with some pre-defined modules called Standard Library Modules. Each of these modules contains some built in functions called Library Functions.Here You will learn Python library function examples.</span></p>
<h3><span style="color: #000000;">Python library function list</span></h3>
<ul>
<li><span style="color: #000000;">abs()</span></li>
<li><span style="color: #000000;">sqrt()</span></li>
<li><span style="color: #000000;">exp()</span></li>
<li><span style="color: #000000;">ceil()</span></li>
<li><span style="color: #000000;">floor()</span></li>
<li><span style="color: #000000;">log()</span></li>
<li><span style="color: #000000;">pow()</span></li>
<li><span style="color: #000000;">sin()</span></li>
<li><span style="color: #000000;">cos()</span></li>
<li><span style="color: #000000;">tan()</span></li>
<li><span style="color: #000000;">random()</span></li>
<li><span style="color: #000000;">randint()</span></li>
<li><span style="color: #000000;">ord()</span></li>
<li><span style="color: #000000;">chr()</span></li>
<li><span style="color: #000000;">str()</span></li>
<li><span style="color: #000000;">isalpha()</span></li>
<li><span style="color: #000000;">islower()</span></li>
<li><span style="color: #000000;">isdigit()</span></li>
<li><span style="color: #000000;">isupper()</span></li>
<li><span style="color: #000000;">capitalize()</span></li>
<li><span style="color: #000000;">find()</span></li>
<li><span style="color: #000000;">Istrip()</span></li>
<li><span style="color: #000000;">rstrip()</span></li>
<li><span style="color: #000000;">pattern()</span></li>
</ul>
<h3 class="s75CSd u60jwe r2fjmd AB4Wff"><span style="color: #000000;"><strong>Python import module example</strong></span></h3>
<p><span style="color: #000000;">In order to use functions defined inside a module we need to bring that module inside our program. This is called importing module. Python provides &#8220;import&#8221; statement to import module in a program. It can be done in three ways&#8221;</span></p>
<ul>
<li><span style="color: #000000;">Import entire module</span></li>
<li><span style="color: #000000;">Import selected objects from a module</span></li>
<li><span style="color: #000000;">Importing all objects of module</span></li>
</ul>
<p><span style="color: #000000;"><strong>To import entire module</strong></span></p>
<p><span style="color: #000000;">Importing entire module means all functions defined inside module will be accessible in the program. To import an entire module we use &#8216;import&#8217; command in the following format:</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">import &lt;module1&gt;, &lt;module2&gt;,</span></p>
<p><span style="color: #000000;">import math, random</span></p>
<p><span style="color: #000000;">when we import entire module in our program we can use functions defined inside the module using module name only. The general format of calling a function will be, name&gt;()</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;module name&gt;.&lt;function</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">math.sqrt(25)</span></p>
<p><span style="color: #000000;"><strong>To import selected object of module</strong></span></p>
<p><span style="color: #000000;">Rather than importing an entire module, we can import only a selected list of functions also. To</span></p>
<p><span style="color: #000000;">do so we use from-import command in the following format</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">from &lt;module_name&gt; import &lt;object_list&gt;</span></p>
<p><span style="color: #000000;">from math import sqrt, pi, pow</span></p>
<p><span style="color: #000000;">Example Now since we have imported selected objects from the module we don&#8217;t need to use module name with object name.</span></p>
<p><span style="color: #ff0000;"><strong>Valid Example</strong></span></p>
<p><span style="color: #000000;">print(pi)</span></p>
<p><span style="color: #000000;">print(sqrt(25))</span></p>
<p><span style="color: #000000;">Invalid Example:</span></p>
<p><span style="color: #000000;">print(math.pi)</span></p>
<p><span style="color: #000000;">print(math.sqrt(25))-</span></p>
<p><span style="color: #000000;"><strong>To import all object of module</strong></span></p>
<p><span style="color: #000000;">We can use &#8216;from-import&#8217; command to import all object from a module. It is very much like importing entire module but with a difference that here we don&#8217;t have to use module name with function name.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">from &lt;module_name&gt;import *</span></p>
<p><strong><span style="color: #ff0000;">Example</span></strong></p>
<p><span style="color: #000000;">from math import*</span></p>
<p><span style="color: #000000;">Now since we have imported all objects from the module we don&#8217;t need to prefix module name with object name.</span></p>
<p><span style="color: #000000;">Valid Example</span></p>
<p><span style="color: #000000;">print(pi)</span></p>
<p><span style="color: #000000;">print(sqrt(25))</span></p>
<p><span style="color: #000000;"><strong>Python library function examples PDF Notes Whatsapp on 9235740454</strong></span></p>
<h3 style="text-align: center;"><span style="color: #000000;"><strong>Python Math module function</strong></span></h3>
<p><span style="color: #000000;">Python&#8217;s standard library provides a module namely &#8220;math&#8221; for math related functions that work with all numeric values except for complex number. In order to work with functions of &#8220;math&#8221; module, we need to first import it to our program. There are the following <strong>math library functions. </strong>The math <strong>python math function</strong> list is given below</span></p>
<h4><strong style="color: #000000;">1) abs()</strong></h4>
<p><span style="color: #000000;">This function is used to calculate absolute value of the number given. In other words, it converts negative numbers into positive. It can take both integer and floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.abs(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">print(math.abs(-12.8))</span></p>
<h4><span style="color: #000000;"><strong>2) sqrt()</strong></span></h4>
<p><span style="color: #000000;">This function is used to calculate square root of the number given. It takes non-negative integer and floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.sqrt(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.sqrt(25))</span></p>
<p><a href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/">dictionary functions in python with examples (2024)</a></p>
<h4><strong style="color: #000000;">3) exp()</strong></h4>
<p><span style="color: #000000;">This function is used to calculate exponent value (e) of the number given. It takes both integer</span></p>
<p><span style="color: #000000;">and floating pointing number as argument. (e=2.718281)</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.exp(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.exp(3))</span></p>
<p><span style="color: #000000;">20.08554</span></p>
<h4><strong style="color: #000000;">4) ceil()</strong></h4>
<p><span style="color: #000000;">This function is used to round off the given number to the higher integer. It takes both negative and positive floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">math.ceil(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">print(math.ceil(3.2))</span></p>
<p><span style="color: #000000;">4</span></p>
<p><span style="color: #000000;">print(math.ceil(3.9))</span></p>
<p><span style="color: #000000;">4</span></p>
<p><span style="color: #000000;">print(math.ceil(-3.2))</span></p>
<p><span style="color: #000000;">-3</span></p>
<h4><span style="color: #000000;"><strong>5) floor()</strong></span></h4>
<p><span style="color: #000000;">This function is used to round off the given number to the lower integer. It takes both negative and positive floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.floor(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.floor(3.2))</span></p>
<p><span style="color: #000000;">3</span></p>
<p><span style="color: #000000;">print(math.floor(3.9))</span></p>
<p><span style="color: #000000;">3</span></p>
<p><span style="color: #000000;">print(math.floor(-3.2))</span></p>
<p><a href="https://careersknowledge.in/dictionary-operations-in-python/">Dictionary operations in python with examples</a></p>
<h4><span style="color: #000000;"><strong>6) log()</strong></span></h4>
<p><span style="color: #000000;">This function is used to calculate natural logarithm of the given number. It takes both integer and floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.log(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.log(2.34))</span></p>
<p><span style="color: #000000;">0.85015092936961</span></p>
<h4><strong style="color: #000000;">7) log10()</strong></h4>
<p><span style="color: #000000;">This function is used to calculate logarithm to the base of 10, of the given number. It takes both Integer and floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.log10(&lt;any number&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.log10(2.34))</span></p>
<p><span style="color: #000000;">0.3692158574101428</span></p>
<h4><span style="color: #000000;"><strong>8) pow()</strong></span></h4>
<p><span style="color: #000000;">This function is used to calculate one number(x) raised to the power of another (y) number (X&#8221;). It takes both integer and floating pointing number as argument.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.pow(&lt;base&gt;, &lt;power&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.pow(3,6))</span></p>
<h4><strong style="color: #000000;">9) sin()</strong></h4>
<p><span style="color: #000000;">This is trigonometric function and used to calculate sine of the given angle. The angle must be specified in radians. To convert and angle from degree to radian we multiple that angle by &#8220;3.14/180&#8221;.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.sin(&lt;any angle in radians&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.sin(45 (3.14/180)))</span></p>
<p><span style="color: #000000;">0.7068251811053661</span></p>
<h4><strong><span style="color: #000000;">10) cos()</span></strong></h4>
<p><span style="color: #000000;">This is trigonometric function and used to calculate cosine of the given angle. The angle must be specified in radians. To convert and angle from degree to radian we multiple that angle by &#8220;3.14/180&#8221;</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">math.cos(&lt;any angle in radians&gt;)</span></p>
<p><span style="color: #000000;">print(math.cos(60&#8243; (3.14/180)))</span></p>
<p><span style="color: #000000;">0.5004596890082056</span></p>
<h4><strong style="color: #000000;">11) tan()</strong></h4>
<p><span style="color: #000000;">This is trigonometric function and used to calculate tangent of the given angle. The angle must be specified in radians. To convert and angle from degree to radians we multiple that angle by &#8220;3.14/180&#8221;</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.tan(&lt;any angle in radians&gt;)</span></p>
<p><span style="color: #000000;">print(math.tan(45&#8243; (3.14/180)))) 0.9992039901050429</span></p>
<p><span style="color: #000000;">Example</span></p>
<h4><span style="color: #000000;"><strong>12) degrees()</strong></span></h4>
<p><span style="color: #000000;">This function is used to convert angle from radians to degree.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.degrees(&lt;any angle in radians&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.degrees(1.0472))</span></p>
<h4><strong><span style="color: #000000;">13) radians()</span></strong></h4>
<p><span style="color: #000000;">This function is used to convert angle from degrees to radians.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">math.radians(&lt;any angle in degrees</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(math.radians(60))</span></p>
<p><span style="color: #000000;">1.04719</span></p>
<h4><strong><span style="color: #000000;">14) trunc()</span></strong></h4>
<p><span style="color: #000000;">This function is used to truncate the given floating point number. Truncation means this function will remove the fractional part from the given floating point number and print only the integer part.</span></p>
<p><span style="color: #000000;">math.trunc(&lt;any floating point number&gt;)</span></p>
<p><span style="color: #000000;">print(math.trunc(6,97))</span></p>
<p><iframe loading="lazy" title="Python Library Functions || Python Math Module With All Function || Importing Math Module in Python" width="900" height="506" src="https://www.youtube.com/embed/jEfCfxEghcw?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<h3 style="text-align: center;"><span style="color: #000000;"><strong>Python math function example</strong></span></h3>
<p><span style="color: #ff0000;"><strong>Write a Program to input the value of x and calculate the result of the following equation</strong></span></p>
<p><span style="color: #ff0000;"><strong>e<sup>x</sup>+cosx<sup>0</sup>+root(x)</strong></span></p>
<p><span style="color: #000000;">import math</span></p>
<p><span style="color: #000000;">x=float(input(&#8220;Enter the value for x: &#8220;))</span></p>
<p><span style="color: #000000;">a=math.exp(x)</span></p>
<p><span style="color: #000000;">b=math.cos(x*(3.14/180))</span></p>
<p><span style="color: #000000;">c=math.sqrt(x)</span></p>
<p><span style="color: #000000;">d=a+b+c</span></p>
<p><span style="color: #000000;">print(&#8220;Result = &#8220;, d)</span></p>
<p><span style="color: #ff0000;"><strong>Write a program to print three sides of a triangle. Calculate and print its area using Heron&#8217;s Formula.</strong></span></p>
<p><span style="color: #000000;">import math</span></p>
<p><span style="color: #000000;">x=float(input(&#8220;Enter side 1: &#8220;))</span></p>
<p><span style="color: #000000;">y=float(input(&#8220;Enter side 2: &#8220;))</span></p>
<p><span style="color: #000000;">z=float(input(&#8220;Enter side 3:&#8221;))</span></p>
<p><span style="color: #000000;">s=(x+y+2)/2</span></p>
<p><span style="color: #000000;">area=math.sqrt(s*(s-x)*(s-b)*(s-z))</span></p>
<p><span style="color: #000000;">print(&#8220;Result=&#8221;, area)</span></p>
<p><span style="color: #000000;">Thanks For Reading the blog Python library function examples. I hope you will understand the topic well.</span></p>
<p><span style="color: #ff0000;"><strong>For Full Python Class Subscribe Our Youtube Channel by click on the link below-</strong></span></p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p>&nbsp;</p>
<p>The post <a href="https://careersknowledge.in/python-library-function-examples/">Python library function examples</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/python-library-function-examples/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>dictionary functions in python with examples (2024)</title>
		<link>https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/</link>
					<comments>https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/#comments</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Thu, 02 May 2024 14:54:17 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[dictionary functions in python]]></category>
		<category><![CDATA[dictionary methods in python]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1603</guid>

					<description><![CDATA[<p>Hello Guys Welcome to our new blog. In this blog we will learn dictionary functions in python with examples. Here you will also get the answers of the following queries Dictionary functions in python with examples Dictionary functions and method() What are the functions of dictionary in python Dictionary methods Dictionary functions in python class ... <a title="dictionary functions in python with examples (2024)" class="read-more" href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/" aria-label="Read more about dictionary functions in python with examples (2024)">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/">dictionary functions in python with examples (2024)</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Hello Guys Welcome to our new blog. In this blog we will learn dictionary functions in python with examples. Here you will also get the answers of the following queries</span></p>
<ul>
<li><span style="color: #000000;"><strong>Dictionary functions in python with examples </strong></span></li>
<li><span style="color: #000000;"><strong>Dictionary functions and method()</strong></span></li>
<li><span style="color: #000000;"><strong>What are the functions of dictionary in python</strong></span></li>
<li><span style="color: #000000;"><strong>Dictionary methods</strong></span></li>
<li><span style="color: #000000;"><strong>Dictionary functions in python class 11</strong></span></li>
<li><span style="color: #000000;"><strong>Built in dictionary function in python</strong></span></li>
<li><span style="color: #000000;"><strong>dictionary function complete with examples</strong></span></li>
</ul>
<p><span style="color: #ff0000;"><strong>For Python PDF Whatsapp Me on the number-9235740454</strong></span></p>
<h2 style="text-align: center;"><span style="color: #000000;"><strong>Dictionary Functions and Method()</strong></span></h2>
<p><span style="color: #000000;">Here we will learn what are the built in function available in python. These are given below-</span></p>
<h3><span style="color: #000000;"><strong>1)len()-</strong></span></h3>
<p><span style="color: #000000;">The function is used to calculate length of the dictionary in terms of number of elements.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">len(&lt;dictionary name&gt;)</span></p>
<p><span style="color: #ff0000;"><strong>Example</strong></span></p>
<p><span style="color: #0000ff;">cricket-(1:&#8221;Sachin&#8221;, 2: &#8220;Dhoni&#8221;, 3: &#8220;Virat&#8221;, 4: &#8220;Rohit&#8221;, 5&#8243;Rahane&#8221;)</span></p>
<p><span style="color: #0000ff;">print(len(cricket))</span></p>
<p><span style="color: #000000;">This example will print number of elements in the Dictionary &#8216;cricket&#8217; as its length. The result it will print will be 5.</span></p>
<h3><span style="color: #000000;"><strong>2) clear()</strong></span></h3>
<p><span style="color: #000000;">This function is used to remove all the elements from the dictionary. It is a dictionary function so it has to be called by dictionary name.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.clear()</span></p>
<p><strong><span style="color: #ff0000;">Example</span></strong></p>
<p><span style="color: #000000;">cricket.clear()</span></p>
<p><span style="color: #000000;">This example will delete all the elements from the dictionary &#8216;cricket&#8217;.</span></p>
<p><a href="https://careersknowledge.in/dictionary-in-python/">What is a dictionary in Python?</a></p>
<h3><span style="color: #000000;"><strong>3) get()</strong></span></h3>
<p><span style="color: #000000;">This function is used to obtain the value of the given key. This function takes two arguments, first of which is the key whose value is to be obtained and second is a message given as string. If the key specified in the function as argument does not exist in the dictionary it will display given message.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.get(&lt;key&gt;, &lt;message&gt;)</span></p>
<p><span style="color: #ff0000;"><strong>Example</strong></span></p>
<p><span style="color: #0000ff;">cricket.get (6, &#8220;Key does not exist!!&#8221;)</span></p>
<p><span style="color: #000000;">This example will search the key 6 in the dictionary and print its corresponding value if key exist in the dictionary. In case of key 6 does not exist in the dictionary it will display message &#8220;Key does not exist!!&#8221; on screen.</span></p>
<h3><span style="color: #000000;"><strong>4) has_key()</strong></span></h3>
<p><span style="color: #000000;">This function is used to check whether the given key exists in the Dictionary or not. It is a Boolean function so it returns True or False. If dictionary has the key specified in the function it returns True otherwise False.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.has_key(&lt;key&gt;)</span></p>
<p><span style="color: #000000;">This example will search the key 6 in the dictionary and if found it will print True or else False.</span></p>
<p><a href="https://careersknowledge.in/dictionary-operations-in-python/">Dictionary operations in python with examples</a></p>
<h3><span style="color: #000000;"><strong>5) items ()</strong></span></h3>
<p><span style="color: #000000;">This function is used to obtain all the items (key, value in the Dictionary as a sequence of Each key,value pair will become a tuple and this function will create a List of all tuples;</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.items()</span></p>
<p><strong><span style="color: #ff0000;"> Example</span></strong></p>
<p><span style="color: #000000;">cricket.items()</span></p>
<p><span style="color: #0000ff;">This example will print all the items of the dictionary &#8216;cricket&#8217; as follows: dict_items([(1, &#8216;Sachin&#8217;), (2, &#8216;Dhoni&#8217;), (3, &#8216;Virat&#8217;), (4, &#8216;Rohit&#8217;), (5, &#8216;Rahane&#8217;)])</span></p>
<h3><span style="color: #000000;"><strong>6) keys()</strong></span></h3>
<p><span style="color: #000000;">This function is used to obtain all the keys from the &#8216;key: value&#8217; pair in the Dictionary. T function returns only keys and in the form of List.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.keys()</span></p>
<p><strong><span style="color: #ff0000;">Example</span></strong></p>
<p><span style="color: #000000;">cricket.keys()</span></p>
<p><span style="color: #000000;">This example will print all the keys of the dictionary &#8216;cricket&#8217; as follows;</span></p>
<p><span style="color: #0000ff;">dict_keys([1, 2, 3, 4, 5])</span></p>
<h3><span style="color: #000000;"><strong>7) values()</strong></span></h3>
<p><span style="color: #000000;">This function is used to obtain all the values from the &#8216;key: value&#8217; pair in the Dictionary. The function returns only values and in the form of List.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.values()</span></p>
<p><span style="color: #ff0000;"><strong>Example</strong></span></p>
<p><span style="color: #000000;">cricket.values()</span></p>
<p><span style="color: #000000;">This example will print all the values of the dictionary &#8216;cricket&#8217; as follows:</span></p>
<p><span style="color: #0000ff;">dict_values([&#8216;Sachin&#8217;, &#8216;Dhoni&#8217;, &#8216;Virat&#8217;, &#8216;Rohit&#8217;, &#8216;Rahane&#8217;])</span></p>
<h3><span style="color: #000000;"><strong> </strong></span><span style="color: #000000;"><strong>8) update()</strong></span></h3>
<p><span style="color: #000000;">This function is used to update a dictionary by adding elements from another dictionary. Addi or replaces key; value pairs from the new dictionary into the original.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;new dictionary&gt;.update(&lt;original dictionary&gt;)</span></p>
<p><strong><span style="color: #ff0000;">Example</span></strong></p>
<p><span style="color: #000080;">players.update(cricket)</span></p>
<p><span style="color: #000000;">This example will add elements of &#8216;players&#8217; dictionary into &#8216;cricket&#8217; dictionary.</span></p>
<p>Subscribe Our Youtube Channel For Full Python Class by click on the below link</p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p><strong><span style="color: #ff0000;">Also Check Out Latest Uploads</span></strong></p>
<p><a href="https://careersknowledge.in/what-is-tuple-in-python-with-example/">tuple operations in python with examples</a></p>
<p><a href="https://careersknowledge.in/dictionary-in-python/">What is a dictionary in Python?</a></p>
<p><span style="color: #003300;"><strong>For Python PDF Whatsapp Me on the number-9235740454</strong></span></p>
<p>The post <a href="https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/">dictionary functions in python with examples (2024)</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/dictionary-functions-in-python-with-examples-2024/feed/</wfw:commentRss>
			<slash:comments>2</slash:comments>
		
		
			</item>
		<item>
		<title>Dictionary operations in python with examples</title>
		<link>https://careersknowledge.in/dictionary-operations-in-python/</link>
					<comments>https://careersknowledge.in/dictionary-operations-in-python/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Wed, 01 May 2024 16:12:19 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[dictionary in python example]]></category>
		<category><![CDATA[Dictionary operations in python]]></category>
		<category><![CDATA[nested dictionary]]></category>
		<category><![CDATA[Python Dictionary operations]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1596</guid>

					<description><![CDATA[<p>Hello Guys, If you searching about dictionary operations in python than you are right place here you will learn complete Python Dictionary operations with examples so read the full blog also i provide the video class link in the middle of the blog. Python dictionary support the following operation- 1) Adding elements to Dictionary We ... <a title="Dictionary operations in python with examples" class="read-more" href="https://careersknowledge.in/dictionary-operations-in-python/" aria-label="Read more about Dictionary operations in python with examples">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/dictionary-operations-in-python/">Dictionary operations in python with examples</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Hello Guys, If you searching about dictionary operations in python than you are right place here you will learn complete <strong>Python Dictionary operations</strong> with examples so read the full blog also i provide the video class link in the middle of the blog. Python dictionary support the following operation-</span></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1598" src="http://careersknowledge.in/wp-content/uploads/2024/05/dictionary-operation-1-1024x576.png" alt="" width="1024" height="576" srcset="https://careersknowledge.in/wp-content/uploads/2024/05/dictionary-operation-1-1024x576.png 1024w, https://careersknowledge.in/wp-content/uploads/2024/05/dictionary-operation-1-324x182.png 324w, https://careersknowledge.in/wp-content/uploads/2024/05/dictionary-operation-1-300x169.png 300w, https://careersknowledge.in/wp-content/uploads/2024/05/dictionary-operation-1-768x432.png 768w, https://careersknowledge.in/wp-content/uploads/2024/05/dictionary-operation-1.png 1280w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></p>
<h3><strong style="color: #000000;">1) Adding elements to Dictionary</strong></h3>
<p><span style="color: #000000;">We can add elements to an existing dictionary using assignment method. The key being added must not exist in dictionary. The following syntax is used to add element~</span></p>
<p><span style="color: #ff0000;"><strong>Syntax</strong></span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;[&lt;key&gt;]=&lt;value&gt;</span></p>
<p><span style="color: #000000;">cricket (1: &#8220;Dhoni&#8221;, 2:&#8221;Virat&#8221;}</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">cricket[3]=&#8221;Sachin&#8221;</span></p>
<p><span style="color: #000000;">print(cricket)</span></p>
<p><span style="color: #000000;">The example will first create a dictionary by the name &#8216;cricket&#8217; with two element assigned to it. Next, it will add a new element to the dictionary. The key of the newly added element will be 3 and value will be &#8220;Sachin&#8221;. Finally it will print the whole dictionary which will appear on screen as {1:&#8221;Dhoni&#8221;, 2: &#8220;Virat&#8221;, 3: &#8220;Sachin&#8221;</span></p>
<h3><strong style="color: #000000;">2) Creating Dictionary using keys and values separately </strong></h3>
<p><span style="color: #000000;">This is another method of creating a new dictionary. In this method, the keys and values are enclosed separately in parentheses and are given as argument to the zip() function of Python, The zip() function is then given as argument of dict().</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;= dict(zip((&lt;list of keys&gt;), (&lt;list of values&gt;)))</span></p>
<p><span style="color: #000000;">cricket=dict(zip((1,2,3), (&#8220;Sachin&#8221;, &#8220;Lara&#8221;, &#8220;Ponting&#8221;)))</span></p>
<p><span style="color: #000000;">print(cricket)</span></p>
<p><span style="color: #000000;">The above example will create a new dictionary by the name &#8216;cricket&#8217;. The zip() function creates &#8216;key:value&#8221; pair by taking data from the two given tuples on one-to-one basis. Finally it will print the whole dictionary as follows{1: &#8220;Sachin&#8221;, 2: &#8220;Lara&#8221;, 3: &#8220;Ponting&#8221;}</span></p>
<h3><strong style="color: #000000;">3) Creating Dictionary using key: value pair as List</strong></h3>
<p><span style="color: #000000;">This is yet another method of creating a new dictionary. In this method, a List of two element Lists is passed as argument to the dict() function. Each inner List represents one key: value pair,</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;= dict([[&lt;key value pair&gt;], [&lt;key value pair&gt;],&#8230;&#8230;])</span></p>
<p><span style="color: #000000;">cricket=dict([[1, &#8220;Sachin&#8221;], [2, &#8220;Lara&#8221;], [3, &#8220;Pointing&#8221;]])</span></p>
<p><span style="color: #000000;">print(cricket)  </span></p>
<p><span style="color: #000000;">This example is first creating a new dictionary using a Python&#8217;s List of Lists. The inner lists are representing key:value pair for dictionary and outer list is as argument to dict() function. At the end it is printing the newly created Dictionary.</span></p>
<p><iframe loading="lazy" title="Python Dictionary |Traversing | Adding l Dictionary Operations | Python Dictionary Tutorial | Day-28" width="900" height="506" src="https://www.youtube.com/embed/cPd400EAnSY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p><span style="color: #ff0000;"><strong>Write a program to create a dictionary with the cricketer&#8217;s name as value and index number as key. Number of element must be user dependent. Also print the elements.</strong></span></p>
<p><span style="color: #000000;">c=1</span></p>
<p><span style="color: #000000;">ch=&#8221;y&#8221;</span></p>
<p><span style="color: #000000;">cricket={}</span></p>
<p><span style="color: #000000;">while ch==&#8221;y&#8221;:</span></p>
<p><span style="color: #000000;">nm=input(&#8220;Enter Cricketer&#8217;s Name:&#8221;)</span></p>
<p><span style="color: #000000;">cricket[c]=nm</span></p>
<p><span style="color: #000000;">c=c+1</span></p>
<p><span style="color: #000000;">ch=input(&#8220;Any more data(y/n):&#8221;)</span></p>
<p><span style="color: #000000;">for c in cricket:</span></p>
<p><span style="color: #000000;">                print(c,cricket[c])</span></p>
<h3><strong style="color: #000000;">4) Updating Dictionary element</strong></h3>
<p><span style="color: #000000;">Updating an element is similar to adding new element in the Dictionary except that in updating the key used must exist in the dictionary otherwise a new element will be added to the dictionary. The general format of updating dictionary element is;</span></p>
<p><strong><span style="color: #000000;">Syntax</span></strong></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;[&lt;key&gt;] = &lt;value&gt;</span></p>
<p><span style="color: #000000;">cricket[4]=&#8221;Hardik&#8221;</span></p>
<h3><strong style="color: #000000;">5) Deleting Dictionary element</strong></h3>
<p><span style="color: #000000;">There are two ways to delete an element from Dictionary. One using del statement and the other using pop() method.</span></p>
<p><span style="color: #000000;">Syntax-1</span></p>
<p><span style="color: #000000;">del &lt;dictionary name&gt;[&lt;key&gt;]</span></p>
<p><span style="color: #000000;">del cricket[2]</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">This example will delete that entry from the dictionary whose key is 2. If the key given with del() function does not exist in the dictionary Python will display an error message.</span></p>
<p><span style="color: #000000;">Syntax-2</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;.pop(&lt;key&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">cricket.pop(2)</span></p>
<p><span style="color: #000000;">This example will delete that entry from the dictionary whose key is 2. After deleting the entry it will return the value deleted from the dictionary. If the key given with pop() function does not exist in the dictionary Python will display an error message.</span></p>
<h3><strong style="color: #000000;">6) Checking existing of key</strong></h3>
<p><span style="color: #000000;">The membership operator &#8216;in&#8217; and &#8216;not in&#8217; can be used with the Dictionary also. These opertor be used to check for existence of &#8216;keys&#8217; in the dictionary. They check existing of key only not for &#8216;values&#8217;</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;key&gt; in &lt;Dictionary name&gt;</span></p>
<p><span style="color: #000000;">&lt;key&gt; not in &lt;Dictionary name&gt;</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">if rno in student:</span></p>
<p><span style="color: #000000;">print(student[rno])</span></p>
<p><span style="color: #000000;">else:</span></p>
<p><span style="color: #000000;">print(&#8220;Record does not exist&#8221;)</span></p>
<p><span style="color: #ff0000;"><strong>Write a program to input key for a dictionary of cricketer&#8217;s name. Check whether that key exist in the dictionary or not. If the key exist in the dictionary then give user a choice of deleting or updating that element. </strong></span></p>
<p><span style="color: #ff0000;"><strong>cricker={1: &#8220;Sachin&#8221;, 2: &#8220;Dhoni&#8221;, 3:&#8221;Virat&#8221;, 4: &#8220;Rohit&#8221;, 5: &#8220;Rahane&#8221;}</strong></span></p>
<p><span style="color: #000000;">c=int(input(&#8220;Enter a key: &#8220;))</span></p>
<p><span style="color: #000000;">if c in cricket:</span></p>
<p><span style="color: #000000;">         print(&#8220;Press 1 for Deleting the element&#8221;)</span></p>
<p><span style="color: #000000;">         print(&#8220;Press 2 for Updating the element&#8221;)</span></p>
<p><span style="color: #000000;">        ch=int(input(&#8220;Enter your choice&#8230;: &#8220;))</span></p>
<p><span style="color: #000000;">          if ch==1:</span></p>
<p><span style="color: #000000;">                 print(&#8220;Deleted value is: &#8220;, cricket[c])</span></p>
<p><span style="color: #000000;">                 del cricket[c]</span></p>
<p><span style="color: #000000;">            else:</span></p>
<p><span style="color: #000000;">                    print(&#8220;Old Name:&#8221;, cricket[c])</span></p>
<p><span style="color: #000000;">                    nm=input(&#8220;Enter new Cricketer&#8217;s Name:&#8221;)</span></p>
<p><span style="color: #000000;">                    cricket[c]=nm</span></p>
<p><span style="color: #000000;">       print(&#8220;Final Dictionary Values are&#8230;&#8221;)</span></p>
<p><span style="color: #000000;">       for c in cricket:</span></p>
<p><span style="color: #000000;">                     print(c, cricket[c])</span></p>
<p><span style="color: #000000;">else:</span></p>
<p><span style="color: #000000;">         print(&#8220;Key does not exist&#8221;)</span></p>
<p><span style="color: #ff0000;"><strong>For Live Class Subscribe Our Youtube channel Link is given below-</strong></span></p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<h3 style="text-align: center;"><strong style="color: #000000;">Nested Dictionary python</strong></h3>
<p><span style="color: #000000;">We can add Dictionaries as values inside a Dictionary. Storing Dictionary inside Dictionary is called Nested Dictionary. Internal Dictionary can be used only as value inside External Dictionary and not as key.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;= {&lt;key&gt;: {&lt;key&gt;: &lt;value&gt;,..)&#8230;.}</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">student={1: {&#8216;name&#8217;:&#8221;Gagan&#8221;, &#8216;mark&#8217;:76}, 2: {&#8216;name&#8217;: &#8220;Palak&#8221;, &#8216;mark&#8217;:82), 3: {&#8216;name&#8217;:&#8221;Reena&#8221;, &#8216;mark&#8217;:69}}</span></p>
<p><span style="color: #000000;">I hope you will understand the blog<strong> Python Dictionary operations</strong> very well.</span></p>
<p><span style="color: #ff0000;"><strong>Also Check Our Latest Upload</strong></span></p>
<p><a href="https://careersknowledge.in/dictionary-in-python/">What is a dictionary in Python?</a></p>
<p><a href="https://careersknowledge.in/tuple-operations-in-python/">tuple operations in python with examples</a></p>
<p>&nbsp;</p>
<p>The post <a href="https://careersknowledge.in/dictionary-operations-in-python/">Dictionary operations in python with examples</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/dictionary-operations-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is a dictionary in Python?</title>
		<link>https://careersknowledge.in/dictionary-in-python/</link>
					<comments>https://careersknowledge.in/dictionary-in-python/#comments</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Tue, 30 Apr 2024 15:39:43 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[dictionary in Python]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1592</guid>

					<description><![CDATA[<p>Dictionary is one of the sequence data type supported by Python to handle large volume of data Elements in the Dictionary are present in the form of &#8216;key: value&#8217; pair, where value is the data item and key is the unique Id of value. In Dictionary keys are immutable and values are mutable. In the ... <a title="What is a dictionary in Python?" class="read-more" href="https://careersknowledge.in/dictionary-in-python/" aria-label="Read more about What is a dictionary in Python?">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/dictionary-in-python/">What is a dictionary in Python?</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Dictionary is one of the sequence data type supported by Python to handle large volume of data Elements in the Dictionary are present in the form of &#8216;key: value&#8217; pair, where value is the data item and key is the unique Id of value. In Dictionary keys are immutable and values are mutable. In the Dictionary key and value of each element is separated by &#8216;colon&#8217;, elements are separated by &#8216;comma&#8217; and they are written with curly brackets. By the end of this chapter you will understand the processes like creation and updating the Dictionary, accessing individual elements and traversal of Dictionary, Nesting of Dictionary etc. It also covers Dictionary related Python functions such as-dict(), zip(), del(), pop(), has_key(), items(), len() etc.</span></p>
<h2><span style="color: #000000;"><strong>Introduction</strong></span></h2>
<p><span style="color: #000000;">The DICTIONARY is one of the sequence data type supported by Python. It can be defined as a collection of values of any data type. Unlike List, Tuple and String which have an index number associated with each element, Dictionary have a &#8216;key: value&#8217; pair. &#8216;key&#8217; and &#8216;value&#8217; are separated by colon(:) and pairs are separated by comma.</span></p>
<p><span style="color: #000000;">Here value represents the data item and the key is the unique Id of the value. Like in List we nee to remember the index to access an element, in Dictionary we need to remember the key t access its value. In Dictionary keys are immutable type but the values are mutable type i.e. w can change values of Dictionary in place. A Dictionary is always depicted in curly brackets. Th following are some examples of Dictionary in Python:</span></p>
<p><span style="color: #000000;">{}                                                                                              #Empty Dictionary</span></p>
<p><span style="color: #000000;">{1:&#8217;aaa&#8217;, 2:&#8217;bbb&#8217;, 3:&#8217; ccc&#8217;}                                                 #Dictionary of names</span></p>
<p><span style="color: #000000;">{&#8216;math: &#8216;Mr. Puri, &#8216;science&#8221;:&#8221;Ms. Patil&#8217;}                   #Dictionary of Teachers</span></p>
<h3 class="JlqpRe"><span style="color: #000000;"><strong><span class="JCzEY tNxQIb">How do you declare a dictionary</span></strong></span></h3>
<p><span style="color: #000000;">In Python, the sequence data type Dictionary can be created in two ways&#8221;</span></p>
<ol>
<li><span style="color: #000000;"><strong> Creating Dictionary using Assignment method</strong></span></li>
</ol>
<p><span style="color: #000000;">To create a Dictionary we write the key: value pairs in curly brackets as per following syntax. The keys in the dictionary must be immutable type such as string, number or Tuple with mutable type values.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;= {&lt;key&gt;:&lt;value&gt;, &lt;key&gt;:&lt;value&gt;,&#8230;}</span></p>
<p><span style="color: #000000;">players = {1: &#8220;Sachin&#8221;, 2: &#8220;Lara&#8221;, 3: &#8220;ponting&#8221;}</span></p>
<p><span style="color: #000000;">print() statement can be used to print the whole Dictionary, as:</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">print(&lt;dictionary name&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">print(players)</span></p>
<p><a href="https://careersknowledge.in/what-is-tuple-in-python-with-example/">What is tuple in Python with example</a></p>
<h3 class="JlqpRe" style="text-align: center;"><span style="color: #000000;"><strong><span class="JCzEY tNxQIb"><span class="CSkcDe">dictionary in Python with examples?</span></span></strong></span></h3>
<p><span style="color: #ff0000;"><strong>Write a program to create a Dictionary of monthly sale of 5 salesmen. Use their name as &#8216;key&#8217; and monthly sales as &#8216;value&#8217;. Also print the dictionary. Sales are; 41000, 39000, 44000, 21500, 32750; and names are- &#8216;Mohak&#8217;, &#8216;Manan&#8217;, &#8216;Ansh&#8217;, &#8216;Jay&#8217; and &#8216;Hement&#8217;.</strong></span></p>
<p><span style="color: #000000;">msales={&#8216;Manan&#8217;:39000, &#8216;Ansh&#8217;:44000,&#8217;Jay&#8217;:21500, &#8216;Hement&#8217;: 32750}</span></p>
<p><span style="color: #000000;">print(&#8220;Monthly Sales Report: \n&#8221;, msales)</span></p>
<p><span style="color: #000000;">Creating Dictionary dynamically via keyboard</span></p>
<ol start="2">
<li><span style="color: #000000;"><strong> Using input() statement-</strong></span></li>
</ol>
<p><span style="color: #000000;">Using input() statement we can feed data for key and value using keyboard to create a Dictionary dynamically. Two input() statements will take input from the user as a key and value of Python Dictionary. Finally a dictionary entry can be created using given below syntax.</span></p>
<p><span style="color: #000000;">&lt;key variable&gt;= input(&#8220;&lt;any message&gt;&#8221;)</span></p>
<p><span style="color: #000000;">&lt;value variable&gt;=input(&#8220;&lt;any message&gt;&#8221;)</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;[&lt;key variable&gt;]=&lt;value variable&gt;</span></p>
<p><span style="color: #ff0000;"><strong>Write a program to input temperature in 3 cities and create a dictionary using them. Take city name as key and temperature as value.</strong></span></p>
<p><span style="color: #000000;">weather = {}</span></p>
<p><span style="color: #000000;">for a in range(3):</span></p>
<p><span style="color: #000000;">ct=input(&#8220;Enter City name:&#8221;)</span></p>
<p><span style="color: #000000;">tmp=input(&#8220;Enter Temperature:</span></p>
<p><span style="color: #000000;">weather[ct]=tmp</span></p>
<p><span style="color: #000000;">print(&#8220;InDictionary is, weather)</span></p>
<p><span style="color: #ff0000;"><strong>For Live Class Watch Our Full Video on you tube by click on the link</strong></span></p>
<p><iframe loading="lazy" title="Python Dictionary Full Tutorial | How to create Dictionay  | Dictionay is Mutable or immuable Type" width="900" height="506" src="https://www.youtube.com/embed/K0Lrwd81b1A?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<h4 class="JlqpRe" style="text-align: center;"><span style="color: #000000;"><strong><span class="JCzEY tNxQIb">How do you access a dictionary in Python?</span></strong></span></h4>
<p><span style="color: #000000;">Python Dictionary is a mutable sequence data type in which elements can be edited in its place Python allow us to access list in both the ways: Whole dictionary at once and Individual element one by one.</span></p>
<p><span style="color: #000000;"><strong> </strong></span><span style="color: #000000;"><strong>Accessing whole Dictionary</strong></span></p>
<p><span style="color: #000000;">Python Dictionary is a collection of values stored as a &#8216;key:value&#8217; pair. All elements i.e. keys and es both of dictionary can be displayed on screen by using dictionary name with print() tement</span></p>
<p><span style="color: #000000;">Syntax-1</span></p>
<p><span style="color: #000000;">print(&lt;dictionary name&gt;)</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">marks (1:38, 2:41, 3:29)</span></p>
<p><span style="color: #000000;">print(marks)</span></p>
<p><span style="color: #000000;">Output</span></p>
<p><span style="color: #000000;">{1:38, 2:41, 3:29}</span></p>
<p><span style="color: #000000;"><strong>Explanation</strong></span></p>
<p><span style="color: #000000;">In above example we have created a dictionary of three subject marks with roll number as key and marks as value. When we print the dictionary name, all the elements get printed on screen.</span></p>
<p><span style="color: #000000;">print(&#8220;&lt;dictionary name&gt;”)</span></p>
<p><span style="color: #000000;">Syntax-2</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">Mrktup={(1:38, 2:41, 3:29}</span></p>
<p><span style="color: #000000;">print(*mrktup)</span></p>
<p><span style="color: #000000;">In the above example we have created a dictionary of three subject marks with roll number as key and marks as value. When we print the dictionary name with asterisk sign (*), only the keys get printed on screen without values, bracket and comma.</span></p>
<ol start="2">
<li><span style="color: #000000;"><strong> Accessing individual element or python access dictionary by key</strong></span></li>
</ol>
<p><span style="color: #000000;">Once a Dictionary is created and elements are stored in it, individual element can be accesses by ting dictionary name followed by key of that element in square bracket in the following mat:</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">&lt;dictionary name&gt;[&lt;key of element&gt;]</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">marks[1]</span></p>
<p><span style="color: #ff0000;"><strong>Write a program to create a dictionary of marks of five students. Print the whole dictionary, only its keys and marks of the student whose key is entered by the user.</strong></span></p>
<p><span style="color: #000000;">marks={1:39, 2:46, 3:30, 4:37, 5:42}</span></p>
<p><span style="color: #000000;">print(&#8220;\nDictionary is = &#8220;, marks)</span></p>
<p><span style="color: #000000;">print(&#8220;keys of the dictionary is &#8220;*marks)</span></p>
<p><span style="color: #000000;">print(&#8220;Marks of Roll Number 4&#8221;,marks[4])</span></p>
<p><span style="color: #000000;">k=int(input(&#8220;\nEnter the roll number of the marks to be displayed: &#8220;))</span></p>
<p><span style="color: #000000;">print(&#8220;Marks of the&#8221;,k,&#8221;Roll Numberk is&#8221;=marks[k])</span></p>
<div class="s75CSd u60jwe r2fjmd AB4Wff" style="text-align: center;"><span style="color: #000000;"><strong>Traverse dictionary python example</strong></span></div>
<p><span style="color: #000000;">Accessing and processing each and every element of the Dictionary is called Traversing the Dictionary For traversal of the Dictionary, rather than accessing values using key, we use for loop to access key from the Dictionary and then print its value.</span></p>
<p><span style="color: #000000;">Syntax</span></p>
<p><span style="color: #000000;">for &lt;variable&gt; in &lt;dictionary name&gt;:</span></p>
<p><span style="color: #000000;">                   body of loop</span></p>
<p><span style="color: #000000;">Example</span></p>
<p><span style="color: #000000;">for a in marks:</span></p>
<p><span style="color: #000000;">print(marks[a])</span></p>
<p><strong><span style="color: #ff0000;">Subscribe Our Youtube Channel For Live Class</span></strong></p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p><span style="color: #000000;"><strong>Program 61 Write a program to create a dictionary of age of 5 persons. Use Name as key and Age as value. While traversing the dictionary print all its elements and count how many of them are Major and Minor.</strong></span></p>
<p><span style="color: #000000;">mj=mn=0</span></p>
<p><span style="color: #000000;">age ={“Anil” :15, “Sunil”: 28, “Vanil”:12, “Romil&#8221;:40,”manzil&#8221;:61)</span></p>
<p><span style="color: #000000;">print(&#8220;Dictionary elements&#8230;&#8221;)</span></p>
<p><span style="color: #000000;">for a in age:</span></p>
<p><span style="color: #000000;">print(&#8220;Age of&#8221;, a, &#8220;is&#8221;, age[a])</span></p>
<p><span style="color: #000000;">if (age[a]&gt;=18):</span></p>
<p><span style="color: #000000;">             mj=mj+1</span></p>
<p><span style="color: #000000;">else:</span></p>
<p><span style="color: #000000;">            mn=mn+1</span></p>
<p><span style="color: #000000;">print(&#8220;\n\nNo. of Major=&#8221;, mj)</span></p>
<p><span style="color: #000000;">print(&#8220;No. of Minor=&#8221;, mn)</span></p>
<p><span style="color: #ff0000;"><strong>Also Check Our Latest Uploads</strong></span></p>
<p><a href="https://careersknowledge.in/tuple-operations-in-python/">tuple operations in python with examples</a></p>
<p>The post <a href="https://careersknowledge.in/dictionary-in-python/">What is a dictionary in Python?</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/dictionary-in-python/feed/</wfw:commentRss>
			<slash:comments>4</slash:comments>
		
		
			</item>
		<item>
		<title>tuple operations in python with examples</title>
		<link>https://careersknowledge.in/tuple-operations-in-python/</link>
					<comments>https://careersknowledge.in/tuple-operations-in-python/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Mon, 29 Apr 2024 17:43:50 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[tuple operations in python]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1586</guid>

					<description><![CDATA[<p>Hello Guys welcome to our new blog if you searching about tuple operations in python then you are on right place. What are tuple operations in python? Since Tuple is Python&#8217;s data type, we can perform several operations on the data represented as Tuple. The operations commonly performed on Tuple are Combing the tuple or ... <a title="tuple operations in python with examples" class="read-more" href="https://careersknowledge.in/tuple-operations-in-python/" aria-label="Read more about tuple operations in python with examples">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/tuple-operations-in-python/">tuple operations in python with examples</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<div><span style="color: #000000;">Hello Guys welcome to our new blog if you searching about tuple operations in python then you are on right place.<img loading="lazy" decoding="async" class="aligncenter wp-image-1588 size-full" src="http://careersknowledge.in/wp-content/uploads/2024/04/tuple-operation-1.png" alt="tuple operations in python " width="600" height="338" srcset="https://careersknowledge.in/wp-content/uploads/2024/04/tuple-operation-1.png 600w, https://careersknowledge.in/wp-content/uploads/2024/04/tuple-operation-1-324x183.png 324w, https://careersknowledge.in/wp-content/uploads/2024/04/tuple-operation-1-300x169.png 300w" sizes="auto, (max-width: 600px) 100vw, 600px" /></span></div>
<div></div>
<h2 class="JlqpRe" style="text-align: center;"><strong><span class="JCzEY tNxQIb" style="color: #000000;"><span class="CSkcDe">What are tuple operations in python?</span></span></strong></h2>
<div class="p8Jhnd">
<div class="aj35ze"><span style="color: #000000;">Since Tuple is Python&#8217;s data type, we can perform several operations on the data represented as Tuple. The operations commonly performed on Tuple are</span></div>
<ol>
<li><span style="color: #000000;">Combing the tuple or Joining the tuple</span></li>
<li><span style="color: #000000;">Replicating the tuple</span></li>
<li><span style="color: #000000;">Slicing the tuple</span></li>
<li><span style="color: #000000;">Unpacking the tuple</span></li>
</ol>
<h3><strong><span style="color: #000000;">Combining the Tuples:</span></strong></h3>
</div>
<ol>
<li><span style="color: #000000;">Also known as joining the Tuples,combining the Tuples is simply adding two or more Tuples to create a new. The concatenation operator  &#8216;+&#8217; is used to join two Tuples.</span></li>
</ol>
<ol start="2">
<li><span style="color: #000000;">The &#8216;+&#8217; operator requires that both the operands must be of Tuple types. Thus we cannot add  number or string to a Tuple. We can create a new Tuple. We can create a new Tuple by adding two or more Tuples.</span></li>
<li><span style="color: #000000;">Syntax: &lt;tuple1&gt;+&lt;tuple2&gt;</span></li>
</ol>
<p><span style="color: #000000;">Example : print(ageB+ageA)</span></p>
<p><span style="color: #000000;">Example will join Tuple &#8216;ageA&#8217; and &#8216;ageB&#8217;. The resultant Tuple will be displayed on screen.</span></p>
<p><span style="color: #000000;">Example-2: ageC=ageA+ageB</span></p>
<p><span style="color: #000000;">This example will join Tuple &#8216;ageA&#8217; and &#8216;ageB&#8217;. The resultant Tuple will stored by the new name &#8216;ageC&#8217;.</span></p>
<p><span style="color: #ff0000;"><strong>Q) Write a program to create two tuples areaA and areaB with the names of 5-5 salesman. Add both the Tuples into one and finally print the combined Tuple.</strong></span></p>
<p><span style="color: #000000;">areaA=(&#8216;Raj&#8217;,&#8217;Harsh&#8217;,&#8217;Anu&#8217;,&#8217;Abhinav&#8217;,&#8217;Abhiraj&#8217;)</span></p>
<p><span style="color: #000000;">areaB=(&#8216;Shubh&#8217;,&#8217;vinay&#8217;,&#8217;yogya&#8217;,&#8217;Anushul&#8217;,&#8217;Abhinash&#8217;)</span></p>
<p><span style="color: #000000;">zone=areaA+areaB</span></p>
<p><span style="color: #000000;">print(&#8220;\nFirst Tuple:&#8221;,areaA)</span></p>
<p><span style="color: #000000;">print(&#8220;\nSecond Tuple:&#8221;,areaB)</span></p>
<p><span style="color: #000000;">print(&#8220;\nFinal Tuple:&#8221; zone)</span></p>
<h3><span style="color: #000000;"><strong>tuple operations in python Replicating the Tuple: </strong></span></h3>
<ol>
<li><span style="color: #000000;"><strong> </strong>The arithmetic operator of MULTIPLICATION &#8216;*&#8217; is used to replicate the Tuples up to specified number of times.</span></li>
<li><span style="color: #000000;">The &#8216;*&#8217; operator requires that one operand must be of Tuple types and the other mus be an integer. We can create a new Tuple by replicating a Tuple up to a specified number of times.</span></li>
</ol>
<p><span style="color: #000000;">Syntax :&lt;tuple name&gt;*&lt;integer&gt;</span></p>
<p><span style="color: #000000;">Example : print(marks*3)</span></p>
<p><span style="color: #000000;">The above statement will print a new tuple by replicating elements</span></p>
<p><span style="color: #000000;">of Tuple &#8216;marks&#8217; three times.</span></p>
<p><a href="https://careersknowledge.in/what-is-tuple-in-python-with-example/">What is tuple in Python with example</a></p>
<h3 class="s75CSd u60jwe r2fjmd AB4Wff" style="text-align: center;"><span style="color: #000000;"><b>what is</b> slicing in python <b>with example</b></span></h3>
<p><span style="color: #000000;"><strong>Slicing the Tuple</strong></span></p>
<p><span style="color: #000000;">Slicing the Tuple is the process of extracting some part of the Tuple out of it. In other words, it is the process of creating sub-list from a main Tuple . We use indexes of the Tuple elements to create a slice</span></p>
<p><strong><span style="color: #ff0000;">syntax</span></strong></p>
<p><span style="color: #000000;">&lt;tuple name&gt;[start: stop: step]</span></p>
<p><span style="color: #000000;">Here &lt;Tuple name&gt; is name of the Tuple to be sliced. &lt;start&gt; represent the index from where extraction is to begin. The default of &lt;start&gt; is 0(zero). &lt;stop&gt; is the index numbers up to which extraction will take place. Actually extraction takes place up to &lt;stop&gt;-1 i.e. element at position &lt;stop&gt; index is not included in slice. The default of &lt;stop&gt; is the end of Tuple. &lt;step&gt; is used when all the numbers between &lt;start&gt; and &lt;stop&gt; are not to be sliced. &lt;step&gt; represent the number by</span></p>
<p><span style="color: #000000;">num=(11, 22, 33, 44, 55, 66, 77, 88, 99)</span></p>
<p><span style="color: #000000;">print(num[1:7:2])#[22,44,66]</span></p>
<p><iframe loading="lazy" title="Python Tuples Full Tutorial | Difference Between List and Tuple | Mutable Vs Immutable-मैराथन क्लास" width="900" height="506" src="https://www.youtube.com/embed/kLbRgT9uFFY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<h3 class="s75CSd u60jwe r2fjmd AB4Wff"><span style="color: #000000;">Unpacking tuples in python example</span></h3>
<p><span style="color: #000000;">Unpacking the tuple is the process of breaking the tuple as sequence and spliting its elements individually. Each element is than separate variable specified.</span></p>
<p><span style="color: #000000;">In the process of unpacking the tuple number of variable must be same as number of element in tuple and separated by comma.</span></p>
<p><span style="color: #000000;"><span style="color: #ff0000;"><strong>Syntax</strong></span>&#8211;</span></p>
<p><strong><span style="color: #000000;">&lt;list of variable&gt;=&lt;tuple name&gt;</span></strong></p>
<p><span style="color: #000000;">t=(1,shubh,99)</span></p>
<p><span style="color: #000000;">x,y,z=t</span></p>
<p><span style="color: #000000;">print(x)#1</span></p>
<p><span style="color: #000000;">print(z)#99</span></p>
<p><strong><span style="color: #ff0000;">Also check our latest uploads</span></strong></p>
<p><a href="https://careersknowledge.in/what-is-numpy-in-python/">what is numpy in python</a></p>
<p><a href="https://careersknowledge.in/top-digital-marketing-agency-in-delhi/">top digital marketing agency in delhi</a></p>
<p>Join whatsapp Group for notes and other information<br />
<a href="https://chat.whatsapp.com/DWV1CefpQTw0FKG7uGpED3">Join</a></p>
<p>Subscribe Our Youtube Channel for Live classes</p>
<p><a href="https://www.youtube.com/@olevelguruji">https://www.youtube.com/@olevelguruji</a></p>
<p>The post <a href="https://careersknowledge.in/tuple-operations-in-python/">tuple operations in python with examples</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/tuple-operations-in-python/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
		<item>
		<title>What is tuple in Python with example</title>
		<link>https://careersknowledge.in/what-is-tuple-in-python-with-example/</link>
					<comments>https://careersknowledge.in/what-is-tuple-in-python-with-example/#respond</comments>
		
		<dc:creator><![CDATA[Shubham Laxakar]]></dc:creator>
		<pubDate>Fri, 26 Apr 2024 14:10:52 +0000</pubDate>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[how to create a tuple in python]]></category>
		<category><![CDATA[python tuple]]></category>
		<category><![CDATA[python tuple example]]></category>
		<category><![CDATA[python with example]]></category>
		<guid isPermaLink="false">https://careersknowledge.in/?p=1574</guid>

					<description><![CDATA[<p>Hello Guys once again welcome to our new post in this blog you will learn tuple in Python with example. So must check out the full blog also share to everyone. Tuple is one of the immutable sequence data type supported by Python to handle large volume of data. Tuple is a collection of data ... <a title="What is tuple in Python with example" class="read-more" href="https://careersknowledge.in/what-is-tuple-in-python-with-example/" aria-label="Read more about What is tuple in Python with example">Read more</a></p>
<p>The post <a href="https://careersknowledge.in/what-is-tuple-in-python-with-example/">What is tuple in Python with example</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></description>
										<content:encoded><![CDATA[<p><span style="color: #000000;">Hello Guys once again welcome to our new post in this blog you will learn tuple in Python with example. So must check out the full blog also share to everyone.</span></p>
<p><img loading="lazy" decoding="async" class="aligncenter size-large wp-image-1577" src="http://careersknowledge.in/wp-content/uploads/2024/04/python-tuple-example-1024x576.jpg" alt="" width="1024" height="576" srcset="https://careersknowledge.in/wp-content/uploads/2024/04/python-tuple-example-1024x576.jpg 1024w, https://careersknowledge.in/wp-content/uploads/2024/04/python-tuple-example-324x182.jpg 324w, https://careersknowledge.in/wp-content/uploads/2024/04/python-tuple-example-300x169.jpg 300w, https://careersknowledge.in/wp-content/uploads/2024/04/python-tuple-example-768x432.jpg 768w, https://careersknowledge.in/wp-content/uploads/2024/04/python-tuple-example.jpg 1280w" sizes="auto, (max-width: 1024px) 100vw, 1024px" /></p>
<p><span style="color: #000000;">Tuple is one of the immutable sequence data type supported by Python to handle large volume of data. Tuple is a collection of data items of any type,separated by comma, written within parenthesis. Python provides several functions and methods to access and process the elements of Tuple. This chapter discusses the concepts, functions and methods of Python Tuple.</span></p>
<p><span style="color: #000000;"><strong>Introduction:</strong> The Tuple is one of the sequence data type Supported by Python. it can be defined as a collection of values of any data type.</span></p>
<p><span style="color: #000000;">Unlike List, Tuple is an immutable data type of Python i.e we cannot </span><span style="color: #000000;">change elements of Tuple in place. A Tuple is always depicted in </span><span style="color: #000000;">parentheses () or curved brackets. The following are some examples of tuple.</span><br />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- HorizontalDisplayHeader --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="2146920641" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<h2 style="text-align: center;"><span style="color: #000000;"><strong>TUPLE in Python</strong></span></h2>
<p><span style="color: #000000;">()                                                                               #EmptyTuple</span></p>
<p><span style="color: #000000;">(1,2,3,4,5)                                                               #TUPLE OF Integers</span></p>
<p><span style="color: #000000;">(1.2,2.3,3.4)                                                            #Tuple of floating point</span></p>
<p><span style="color: #000000;">(&#8216;x&#8217;,&#8217;y&#8217;,&#8217;z&#8217;)                                                                  # Tuple of Characters</span></p>
<p><span style="color: #000000;">(&#8220;Delhi&#8221;,&#8221;mumbai&#8221;,&#8221;chennai&#8221;,&#8221;Kolkata&#8221;)        #Tuple of Strings</span></p>
<p><span style="color: #000000;">(1, &#8220;Rajesh&#8221;,12.5,2,&#8221;kiran&#8221;,45.7)                          # Tuple of Mixed val</span></p>
<h3><span style="color: #000000;"><strong>How to creating  Tuple in python</strong></span></h3>
<p><span style="color: #000000;">In Python, the sequence data type Tuple can be created in </span><span style="color: #000000;">three ways. </span></p>
<ol>
<li><span style="color: #000000;">By Assigning Values</span></li>
<li><span style="color: #000000;">Through other sequence</span></li>
<li><span style="color: #000000;">Dynamically via Keyboard</span></li>
</ol>
<p><span style="color: #000000;">Here you will also learn <strong>python tuple example </strong></span></p>
<h4><span style="color: #000000;"><strong>1) Creating Tuple by assigning values: </strong></span></h4>
<p><span style="color: #000000;">To create Tuple by asssignment method, put a number of data values in parentheses and assig it to a variable. The data values in parentheses must be separated by commas and the variable to which it is assigned becomes a Python Tuple.</span></p>
<p><span style="color: #000000;">Syntax  : &lt;tuple name&gt;=(&lt;comma separated number of values&gt;)</span></p>
<p><span style="color: #000000;">Example-1 : num=(23,65,42,82,27,19)</span></p>
<p><span style="color: #000000;">This example will create a Python Tuple by the name &#8216;num&#8217; with </span><span style="color: #000000;">few integers.</span></p>
<p><span style="color: #000000;">Example-2   : tup1=(3)</span></p>
<p><span style="color: #000000;">The above example will create a Tuple with single element. As </span><span style="color: #000000;">we can see to create Tuple with single element we add a comma </span><span style="color: #000000;">after the single element otherwise Python will store the single</span></p>
<p><span style="color: #000000;">element as simple data into a variable. This mean the following </span><span style="color: #000000;">example will not create a Tuple.</span></p>
<p><span style="color: #000000;">   tup=(3)</span></p>
<p><span style="color: #000000;"> print() statement can be used to print the whole Tuple of values, as:</span></p>
<p><span style="color: #000000;">Syntax : print(&lt;tuple name&gt;)</span></p>
<p><span style="color: #000000;">  Example:  print(num)</span></p>
<p><span style="color: #ff0000;"><strong>Q) Write a program to create a Tuple of monthly sale of 5 salesmen. </strong><strong>Also print the Tupple. Sales are- 41000,39000,44000,21500,32750.</strong></span></p>
<p><span style="color: #000000;">   msales=(41000,39000,44000,21500,32750)</span></p>
<p><span style="color: #000000;">   print(msales)</span></p>
<h3><span style="color: #000000;"><strong>2) Creating Tuples from Existing Sequence:</strong></span></h3>
<p><span style="color: #000000;"> we can create a new Tuple from </span><span style="color: #000000;">any exising sequence data type by using a built-in function tuple() in  </span><span style="color: #000000;"> the following general format. Sequence data type could be String . List </span><span style="color: #000000;">or even another Tuple. The tuple() functions usses individual elements </span><span style="color: #000000;">of given sequence data to create a new tuple.</span></p>
<p><span style="color: #000000;"> Syntax : &lt;tuple name&gt;=tuple(&lt;sequence&gt;)</span></p>
<p><span style="color: #000000;">Example-1 : tup1=tuple(&#8220;PYTHON&#8221;)</span></p>
<p><span style="color: #000000;">                print(tup1)</span></p>
<p><span style="color: #000000;">This example is taking a string as sequence type data and creating a tuple </span><span style="color: #000000;">using its characters as elements of tuple. Finally, it will print the newly </span><span style="color: #000000;">created tuple as</span></p>
<p><span style="color: #000000;">[&#8216;P&#8217;,&#8217;Y&#8217;,&#8217;T&#8217;,&#8217;H&#8217;,&#8217;O&#8217;,&#8217;N&#8217;]</span></p>
<p><span style="color: #000000;"> Example-2 : tup2=tuple([&#8216;a&#8217;,&#8217;e&#8217;,&#8217;i&#8217;,&#8217;o&#8217;,&#8217;u&#8217;]</span></p>
<p><span style="color: #000000;">                         print(tup2)</span></p>
<p><span style="color: #000000;">This example is taking a Python List as sequence type data and creating </span><span style="color: #000000;">a tuple using its element are element of tuple. Finally, it will print newly</span></p>
<p><span style="color: #000000;">created tuple as   </span><span style="color: #000000;">(&#8216;a&#8217;,&#8217;e&#8217;,&#8217;i&#8217;,&#8217;o&#8217;,&#8217;u&#8217;)</span><br />
<script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- HorizontalDisplayHeader --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="2146920641" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script><br />
<span style="color: #ff0000;"><strong>Q) write a program to create a Tuple using a List containing name of 5 persons. Also print the tuple on screen.</strong></span></p>
<p><span style="color: #000000;"> p=[&#8216;Aditi&#8217;,&#8217;Bhawna&#8217;,&#8217;Shivangi&#8217;,&#8217;Dipika&#8217;,&#8217;Ekta&#8217;]</span></p>
<p><span style="color: #000000;">                nam=tuple(p)</span></p>
<p><span style="color: #000000;">                print(num)</span></p>
<h3><span style="color: #000000;"><strong>3) Creating Tuple dynamically via keyboard: </strong></span></h3>
<p><span style="color: #000000;">Using input() statement within eval() function we can create a Tuple dynamically. The input() </span><span style="color: #000000;">statement will take input from the user as a list of values separated by comma and eval() function will separate values as element of Python Tuple. Finally tuple() function will convert these values in a Tuple </span><span style="color: #000000;">and store them in the variable provided.In this case user has to input values separating with comma.</span></p>
<p><span style="color: #000000;">Syntax  :  &lt;variable&gt;=eval(input(&#8220;&lt;any message&gt;&#8221;))</span></p>
<p><span style="color: #000000;">                &lt;tuple name&gt;=tuple(&lt;variable&gt;)</span></p>
<p><span style="color: #000000;">Example : n=eval(input(&#8220;Enter tuple elements:&#8221;))</span></p>
<p><span style="color: #000000;">              tup=tuple(n)</span></p>
<p><strong><span style="color: #ff0000;">Q) Write a program to input temperature in 5 cities and create a tuple using them.</span></strong></p>
<p><span style="color: #000000;">   </span><span style="color: #000000;">m=eval(input(&#8220;Enter temperature in 5 cities&#8221;)</span></p>
<p><span style="color: #000000;">   tmptup=tuple(m)</span></p>
<p><span style="color: #000000;">   print(&#8220;\nTuple is=&#8221;,tmptup)</span></p>
<p><iframe loading="lazy" title="Python Tuples Full Tutorial | Difference Between List and Tuple | Mutable Vs Immutable-मैराथन क्लास" width="900" height="506" src="https://www.youtube.com/embed/kLbRgT9uFFY?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<h3><span style="color: #000000;"><strong> </strong></span><span style="color: #000000;"><strong>Accessing the Tuple: </strong></span></h3>
<p><span style="color: #000000;">Python Tuple ia an immutable sequence data type in which elements cannot be edited in its place. Python allow us to access Tuple in both the ways: Whole Tuple at once and individual </span><span style="color: #000000;">element one by one.Accessing whole Tuple: Python Tuple is a collection of values of several </span><span style="color: #000000;">data types stored with a single name. All the elements of Tuple can do </span><span style="color: #000000;">displayed on screen by using Tuple name with print() statement.</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- HorizontalDisplayHeader --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="2146920641" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><strong><span style="color: #ff0000;">Syntax-1 : print(&lt;tuple name&gt;)</span></strong></p>
<p><span style="color: #000000;">Example : marks=(38,41,29,13,25)</span></p>
<p><span style="color: #000000;">           print(marks)</span></p>
<p><span style="color: #000000;">output : (38,41,29,13,25)</span></p>
<p><span style="color: #000000;">Explanation : In the above example we have created a tuple of five</span><span style="color: #000000;"> subject marks with the name &#8216;marks&#8217;. When we print the </span><span style="color: #000000;">tuple name, all the element gets printed on screen.</span></p>
<p><span style="color: #ff0000;"><strong>Syntax-2  :  print(*&lt;tuple name&gt;)</strong></span></p>
<p><span style="color: #000000;">Example   : mrktup=(38,41,29,13,25)</span></p>
<p><span style="color: #000000;">Output : 38 41 29 13 25</span></p>
<p><span style="color: #000000;">Explanation : In the above example we have created a Tuple of five subject </span><span style="color: #000000;">marks with the name &#8216;mrktup&#8217;. When we print the tuple name with </span><span style="color: #000000;">asterisk sign(*), only the elements get printed on screen </span><span style="color: #000000;">without bracket and comma.</span></p>
<p><span style="color: #ff0000;"><strong>Q) write a program to create a tuple of roll no, name and marks obtained </strong><strong> by three students and print all the elements on screen.</strong></span></p>
<p><span style="color: #000000;">student=(1,&#8217;Anchal&#8217;,58,2,&#8217;Somya&#8217;,61,3,&#8217;Vishal&#8217;,52)</span></p>
<p><span style="color: #000000;">                 print(student)</span></p>
<p><span style="color: #000000;">                 print()</span></p>
<p><span style="color: #000000;">                 print(*student)</span></p>
<h3><span style="color: #000000;"><strong>Accessing individual element:</strong></span></h3>
<p><span style="color: #000000;"> Once a Tuple is created and elements are stored in it, the position of each element in the Tuple is assigned a number. The position of element in the Tuple is called Index and index numbering begins with 0. The diagram below shows the index position of element in a Tuple.To access elements of a Tuple individually we write Tuple name followed by index of that element in square bracket in the following format:</span></p>
<p><span style="color: #000000;"> Syntax  :  &lt;tuple name&gt;[&lt;index of element&gt;]</span></p>
<p><span style="color: #000000;">Example : marks[0]</span></p>
<p><span style="color: #000000;">The above example will display first element of Tuple&#8217;marks&#8217;.</span></p>
<p><span style="color: #ff0000;"><strong>Q) Write a program to create a Tuple of numbers and print all the numbers separately. Also calculate and print their total. </strong></span></p>
<p><span style="color: #000000;">tot=0</span></p>
<p><span style="color: #000000;">   ntup=(12,65,42,75,26,78,52,48,50,26)</span></p>
<p><span style="color: #000000;">   print(&#8220;Forward printing&#8230;&#8221;)</span></p>
<p><span style="color: #000000;">   for a in range(10):</span></p>
<p><span style="color: #000000;">                   print(ntup[a],&#8221; &#8220;,end=&#8221;)</span></p>
<p><span style="color: #000000;">                   tot=tot+ntup[a]</span></p>
<p><span style="color: #ff0000;"><strong>To Learn Complete Python in 2 Hours Watch our Full Video</strong></span></p>
<p><iframe loading="lazy" title="PYTHON Full Course for Beginners in 2 Hours (with Projects + Practical ) | | Python Full Course 2024" width="900" height="506" src="https://www.youtube.com/embed/vjnRnvBQWs4?feature=oembed" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture; web-share" referrerpolicy="strict-origin-when-cross-origin" allowfullscreen></iframe></p>
<p style="text-align: center;"><span style="color: #000000;"><strong>Traversing the tuple:</strong></span></p>
<p><span style="color: #000000;">In Tuple Accessing and processing each and every element of the is known Traversing the Tuple. For traversal of the Tuple </span><span style="color: #000000;">rather than accessing elements using index number we use for() loop to </span><span style="color: #000000;">access elements elements from the List.</span></p>
<p><span style="color: #000000;">Syntax  : for&lt;variable&gt;in&lt;tuple name&gt;:</span></p>
<p><span style="color: #000000;">                          body of loop</span></p>
<p><span style="color: #000000;">                Example : for a in marks:</span></p>
<p><span style="color: #000000;">                                       print(a)</span></p>
<p><script async src="https://pagead2.googlesyndication.com/pagead/js/adsbygoogle.js?client=ca-pub-5382286864538712" crossorigin="anonymous"></script><br />
<!-- HorizontalDisplayHeader --><br />
<ins class="adsbygoogle" style="display: block;" data-ad-client="ca-pub-5382286864538712" data-ad-slot="2146920641" data-ad-format="auto" data-full-width-responsive="true"></ins><br />
<script>
     (adsbygoogle = window.adsbygoogle || []).push({});
</script></p>
<p><strong><span style="color: #ff0000;">Q) Write a program to create a Tuple of age of 10 persons. While traversing the Tuple print all its elements and count how many of them are Major and Minor.</span></strong></p>
<p><span style="color: #000000;">   mj=mn=0</span></p>
<p><span style="color: #000000;">   age=(15,28,12,40,61,22,14,50,16,61)</span></p>
<p><span style="color: #000000;">   print(&#8220;Tuple elements&#8230;&#8221;)</span></p>
<p><span style="color: #000000;">   for a in age:</span></p>
<p><span style="color: #000000;">                   print(a,&#8221; &#8220;,end=&#8221;)</span></p>
<p><span style="color: #000000;">                   if(a&gt;=18):</span></p>
<p><span style="color: #000000;">                                   mj=mj+1</span></p>
<p><span style="color: #000000;">                    else:</span></p>
<p><span style="color: #000000;">                                   mn=mn+1</span></p>
<p><span style="color: #000000;">print(&#8220;\n\nNo.of Major=&#8221;,mj)</span></p>
<p><span style="color: #000000;">print(&#8220;No.of Minor=&#8221;, mn)</span></p>
<div class="JlqpRe"><strong><span class="JCzEY tNxQIb" style="color: #000000;"><span class="CSkcDe">What is a tuple vs list?</span></span></strong></div>
<div><span style="color: #000000;">List is a mutable data type whereas tuple is a immutable data type.In list we can insert,update and delete the element this property represent list is mutable. On the other hand we cannot insert,update and delete the element in tuple so this property represent tuple is immutable data type. So here i clearly provide the explaination about <strong><span class="JCzEY tNxQIb"><span class="CSkcDe"> tuple vs list? </span></span></strong></span><span class="JCzEY tNxQIb" style="color: #000000;"><span class="CSkcDe"><span style="color: #000000;">If you learn more about the list  then click on the link below</span>&#8211;</span></span></div>
<div><a href="https://careersknowledge.in/list-in-python-with-examples-python-list/">what is list in python</a></div>
<div><a href="https://careersknowledge.in/python-list-methods-and-list-operations/">list methods in python</a></div>
<div><span style="color: #000000;">Watch Our Full List Video on Youtube Click on the link</span></div>
<div><a href="https://youtu.be/RaUQV725Ghw">python list live class</a></div>
<div></div>
<div></div>
<div></div>
<p>The post <a href="https://careersknowledge.in/what-is-tuple-in-python-with-example/">What is tuple in Python with example</a> appeared first on <a href="https://careersknowledge.in"></a>.</p>
]]></content:encoded>
					
					<wfw:commentRss>https://careersknowledge.in/what-is-tuple-in-python-with-example/feed/</wfw:commentRss>
			<slash:comments>0</slash:comments>
		
		
			</item>
	</channel>
</rss>
