<?php include __DIR__ . '/../../header.php'; ?>
<div><section data-id="Interview Detail Banner" id="Interview Detail Banner" class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0 !pb-0 !pt-spacing20 md:!bg-offWhite"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div class="row g-4"><div class="col-12 md:flex-col"><ol itemscope="" itemtype="https://schema.org/BreadcrumbList" class="flex h-8 w-auto justify-start items-center bg-transparent md:!bg-offWhite xs:!bg-yellow1"><li class="flex items-center text-xs font-normal h-8 group ease-in-out duration-500 transition text-neutral-500" itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem"><a href="" class="px-spacing8 h-full cursor-pointer flex rounded-128 items-center group-hover:bg-mono-black/4 duration-500 ease-in-out transition justify-center" itemprop="item"><div itemprop="name" content="Home"><div class="text-xs text-neutral-600 group-hover:font-medium group-hover:underline group-hover:underline-offset-3 group-hover:text-mono-black">Home</div></div></a><meta itemprop="position" content="1"><i class=" icon-chevron-right text-xl leading-5 text-neutral-600  md:text-neutral-400 self-center "></i></li><li class="flex items-center text-xs font-normal h-8 group ease-in-out duration-500 transition text-neutral-500" itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem"><a href="interview-questions" class="px-spacing8 h-full cursor-pointer flex rounded-128 items-center group-hover:bg-mono-black/4 duration-500 ease-in-out transition justify-center" itemprop="item"><div itemprop="name"><div class="text-xs text-neutral-500 group-hover:font-medium group-hover:underline group-hover:underline-offset-3 group-hover:text-mono-black max-w-50 overflow-ellipsis whitespace-nowrap overflow-hidden">Interview Questions</div></div></a><meta itemprop="position" content="2"><i class=" icon-chevron-right text-xl leading-5 text-neutral-600  md:text-neutral-400 self-center "></i></li><li class="flex items-center text-xs font-normal h-8 group ease-in-out duration-500 transition text-neutral-500" itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem"><a href="interview-questions/programming" class="px-spacing8 h-full cursor-pointer flex rounded-128 items-center group-hover:bg-mono-black/4 duration-500 ease-in-out transition justify-center" itemprop="item"><div itemprop="name"><div class="text-xs text-neutral-500 group-hover:font-medium group-hover:underline group-hover:underline-offset-3 group-hover:text-mono-black max-w-50 overflow-ellipsis whitespace-nowrap overflow-hidden">Programming</div></div></a><meta itemprop="position" content="3"><i class=" icon-chevron-right text-xl leading-5 text-neutral-600  md:text-neutral-400 self-center "></i></li><li class="flex items-center text-xs font-normal h-8 group ease-in-out duration-500 transition text-neutral-500" itemprop="itemListElement" itemscope="" itemtype="https://schema.org/ListItem"><span class="overflow-hidden px-spacing8 "><div itemprop="name"><div class="text-xs text-neutral-500 max-w-50 overflow-ellipsis whitespace-nowrap overflow-hidden">Python</div></div></span><meta itemprop="position" content="4"><i class=" hidden"></i></li></ol></div></div></div></section></div><div><section data-id="Interview Detail Banner" id="Interview Detail Banner" class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0 bg-offWhite !py-0 !pb-0"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div class="row g-4"><div class="col-12 md:flex-col"><!--$--><div class="flex flex-col md:flex-row md:items-center md:justify-between bg-offWhite  md:pt-spacing20 md:pb-[48px]"><div class="md:max-w-[579px] xs:w-full"><p class="uppercase text-interview-grey-1 text-interactionNormal font-semibold pb-spacing7">Programming</p><h1 class="font-[700] text-headingBanner2 pb-spacing20 text-black">Python</h1><p class="text-greyscale1 text-interactionNormal leading-[22px] font-normal flex items-center gap-spacing6"><svg xmlns="http://www.w3.org/2000/svg" width="18" height="18" viewBox="0 0 18 18" fill="none"><path d="M8.09313 2.36439C8.46453 1.61186 9.53762 1.61185 9.90902 2.36439L11.6202 5.8317L15.4466 6.38771C16.2771 6.50838 16.6087 7.52895 16.0078 8.11472L13.239 10.8136L13.8926 14.6246C14.0345 15.4517 13.1663 16.0825 12.4235 15.6919L9.00108 13.8927L5.57864 15.6919C4.83584 16.0825 3.96769 15.4517 4.10955 14.6246L4.76318 10.8136L1.99437 8.11472C1.39343 7.52896 1.72504 6.50838 2.55551 6.38771L6.38191 5.8317L8.09313 2.36439ZM9.00108 3.06669L7.36457 6.38262C7.21708 6.68146 6.932 6.88858 6.60222 6.9365L2.94286 7.46824L5.5908 10.0493C5.82943 10.2819 5.93832 10.6171 5.88199 10.9455L5.2569 14.5901L8.52992 12.8694C8.82489 12.7143 9.17727 12.7143 9.47224 12.8694L12.7453 14.5901L12.1202 10.9455C12.0638 10.6171 12.1727 10.2819 12.4114 10.0493L15.0593 7.46824L11.3999 6.9365C11.0702 6.88858 10.7851 6.68146 10.6376 6.38262L9.00108 3.06669Z" fill="#FF9F1F"></path></svg>4.5<!-- --> Rating<span class="bg-transparent"></span><i aria-hidden="true" class="icon-book-open text-yellow-main text-base"></i> <!-- -->100<!-- --> Questions<span class="bg-transparent"></span><i aria-hidden="true" class="icon-clock text-yellow-main text-base"></i> <!-- -->30<!-- --> mins read<span class="bg-transparent"></span><svg xmlns="http://www.w3.org/2000/svg" width="15" height="11" viewBox="0 0 15 11" fill="none"><path fill-rule="evenodd" clip-rule="evenodd" d="M3.24952 2.59291C2.23066 3.44326 1.51929 4.44071 1.16018 5.00933C1.11075 5.0876 1.09048 5.12047 1.0772 5.14603C1.0712 5.15757 1.06952 5.16207 1.06839 5.16646C1.06826 5.16749 1.06809 5.16902 1.06789 5.17105C1.0672 5.17843 1.06667 5.1885 1.06667 5.2C1.06667 5.2115 1.0672 5.22157 1.06789 5.22895C1.06809 5.23098 1.06826 5.23251 1.06839 5.23354C1.06952 5.23793 1.0712 5.24243 1.0772 5.25397C1.09048 5.27953 1.11075 5.3124 1.16018 5.39067C1.51929 5.95929 2.23066 6.95674 3.24952 7.80709C4.26712 8.6564 5.55933 9.33333 7.0961 9.33333C8.63288 9.33333 9.92509 8.6564 10.9427 7.80709C11.9615 6.95674 12.6729 5.95929 13.032 5.39067C13.0815 5.3124 13.1017 5.27953 13.115 5.25396C13.121 5.24246 13.1227 5.23796 13.1238 5.23358C13.1239 5.23255 13.1241 5.23101 13.1243 5.22895C13.125 5.22157 13.1255 5.2115 13.1255 5.2C13.1255 5.1885 13.125 5.17843 13.1243 5.17105C13.1241 5.16902 13.1239 5.16749 13.1238 5.16646C13.1227 5.16207 13.121 5.15757 13.115 5.14603C13.1017 5.12047 13.0815 5.0876 13.032 5.00933C12.6729 4.44071 11.9615 3.44325 10.9427 2.59291C9.92509 1.7436 8.63288 1.06667 7.0961 1.06667C5.55933 1.06667 4.26712 1.7436 3.24952 2.59291ZM2.56604 1.77398C3.70346 0.824679 5.22954 0 7.0961 0C8.96266 0 10.4887 0.824679 11.6262 1.77398C12.7623 2.72224 13.5427 3.8204 13.9339 4.43976C13.9388 4.44758 13.9438 4.45545 13.9489 4.4634C14.0278 4.58784 14.1182 4.73042 14.1644 4.9319C14.2015 5.0936 14.2015 5.3064 14.1644 5.4681C14.1182 5.66958 14.0278 5.81216 13.9489 5.9366C13.9438 5.94455 13.9388 5.95243 13.9339 5.96024C13.5427 6.5796 12.7623 7.67775 11.6262 8.62601C10.4887 9.57532 8.96266 10.4 7.0961 10.4C5.22954 10.4 3.70346 9.57532 2.56604 8.62601C1.42987 7.67775 0.649473 6.5796 0.258315 5.96024C0.253381 5.95243 0.248386 5.94455 0.243343 5.9366C0.164414 5.81216 0.0739778 5.66958 0.027797 5.4681C-0.00926565 5.3064 -0.00926565 5.0936 0.027797 4.9319C0.0739778 4.73042 0.164414 4.58784 0.243343 4.4634C0.248385 4.45545 0.253381 4.44757 0.258314 4.43976C0.649473 3.8204 1.42987 2.72225 2.56604 1.77398ZM7.0961 3.73333C6.28609 3.73333 5.62944 4.38998 5.62944 5.2C5.62944 6.01002 6.28609 6.66667 7.0961 6.66667C7.90612 6.66667 8.56277 6.01002 8.56277 5.2C8.56277 4.38998 7.90612 3.73333 7.0961 3.73333ZM4.56277 5.2C4.56277 3.80088 5.69698 2.66667 7.0961 2.66667C8.49522 2.66667 9.62944 3.80088 9.62944 5.2C9.62944 6.59912 8.49522 7.73333 7.0961 7.73333C5.69698 7.73333 4.56277 6.59912 4.56277 5.2Z" fill="#FF9F1F"></path></svg>169<!-- --> Readers</p></div><div class="rounded-[12px] h-auto relative overflow-hidden self-auto"><img alt="Interview Detail Banner Image" fetchpriority="high" loading="eager" width="411" height="274" decoding="async"  class="object-cover rounded-[12px]" style="color:transparent" sizes="(min-width: 768px) 411px, 274px" srcSet="" src="https://images.unsplash.com/photo-1460925895917-afdab827c52f?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80"></div></div><!--/$--></div></div></div></section></div><div><section data-id="Interview_Detail_Page_Interviews_Section" id="Interview_Detail_Page_Interviews_Section" class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div class="row g-4"><div class="col-12 md:flex-col"><div class="flex flex-row relative gap-spacing80"><div class="md:min-w-[846px] xs:w-full"><h3 class="text-interview-black-1 font-[700] md:text-title2 xs:text-baseInterviewTitle pb-spacing10">Introduction</h3><div class="text-neutral7 font-normal md:text-bodyNormal xs:text-bannerPoints pb-spacing24"><p>Python is a versatile language for web development, data analysis, artificial intelligence, scientific computing, and more. Known for its simplicity, readability, and ease of use, it allows developers to write code more quickly and efficiently. Here are the top Python interview questions and answers that cover a wide base of topics associated with Python, such as the use of the assert statement, the difference between Shallow copy vs deep copy, and decorators in Python. Go through these Python interview question-answer sets and land your dream job as a Python Developer, Full Stack engineer, and other top profiles as a fresher, intermediate or expert applicant. Practice these interview questions in Python with answers provided by experts and be fully prepared for your next Python interview. Be smarter with every interview.</p></div><div><section class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0 bg-subdued md:bg-white !py-0 !px-0"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div class="row g-4"><div class="col-12 md:flex-col"><div class="flex items-center justify-center font-Inter"><div class="bg-subdued w-full md:p-spacing40 py-spacing40 rounded-custom20"><div class="flex justify-between items-center"><div class="items-center flex-1"><div class="max-w-133"><div class="text-3xl leading-9.75 font-bold text-mono-black mt-spacing6">Python Interview Questions and Answers</div></div></div></div><div class=""><div><div class="relative flex w-fit items-center max-w-full customized-x-scrollbar gap-spacing12 md:gap-spacing24 rounded-xl bg-white p-spacing8 shadow-primaryDouble my-6 md:my-spacing40"><button class="z-1 rounded-lg px-spacing16 h-10 transition-all duration-300 ease-out flex items-center gap-spacing8 whitespace-nowrap font-semibold text-primary-900 bg-primary-100 delay-300"><h3 class="text-sm md:text-base first-letter:capitalize">Beginner</h3></button><button class="z-1 rounded-lg px-spacing16 h-10 transition-all duration-300 ease-out flex items-center gap-spacing8 whitespace-nowrap bg-transparent font-medium text-neutral-800 hover:text-primary-600"><h3 class="text-sm md:text-base first-letter:capitalize">Intermediate</h3></button><button class="z-1 rounded-lg px-spacing16 h-10 transition-all duration-300 ease-out flex items-center gap-spacing8 whitespace-nowrap bg-transparent font-medium text-neutral-800 hover:text-primary-600"><h3 class="text-sm md:text-base first-letter:capitalize">Advanced</h3></button><span class="absolute block h-10 rounded-lg bg-primary-100 transition-all duration-300" style="left:0;width:0;opacity:1"></span></div></div><div class=""><div><div class="text-xl text-neutral-800 mb-spacing20 font-bold">Beginner</div><div class="relative w-full"><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-primary-main outline-2 shadow-card hover:shadow-card visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-t-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden">1. How do I check whether a file exists using Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-0 text-neutral-800"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>There are a couple of ways to check if a file exists or not. First method is use open() function on a file and see if it raises any exception. If the file is indeed existing, the open() function will be executed correctly. However, if it doesn’t, an exception will be raised.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-aze5mkhc6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; try:
file=open(filename)
print ('the file exists')
file.close()
except:
print ('file is not existing')</pre></div></div><p dir="ltr">You can also use exists() method of path object defined in os module.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-84jf1edjy" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from os import path
&gt;&gt;&gt; path.exists(filename)</pre></div></div><p>Here filename should be a string containing name along with file’s path. Result will be True if file exists otherwise false.</p><p>Python library consists of pathlib module. You can also check if file exists or not by using exists() method in this module as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ojhckw75r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import pathlib
&gt;&gt;&gt; file=pathlib.Path(filename)
&gt;&gt;&gt; file.exists()</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">2. Why is Python called dynamically typed language?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Computer languages are generally classified as statically or dynamically typed. Examples of statically typed languages are C/C++, Java, C# etc. Python, along with JavaScript, PHP etc are dynamically typed languages. &nbsp;</p><p>First we have to understand the concept of variable. In C/C++/Java, variable is a user defined convenience name given to a memory location. Moreover, compilers of these languages require prior declaration of name of variable and type of data that can be stored in it before actually assigning any value. Typical variable declaration and assignment statement in C/C++/Java would be as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-n1k9u4vgj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">int x;
x=10;</pre></div></div><p>Here, the variable x is permanently bound to int type. If data of any other type is assigned, compiler error will be reported. Type of variable decides what can be assigned to it and what can’t be assigned.</p><p>In Python on the other hand, the object is stored in a randomly chosen memory location, whereas variable is just an identifier or a label referring to it. When we assign 10 to x in Python, integer object 10 is stored in memory and is labelled as x. Python’s built-in type() function &nbsp;tells us that it stores object of int type.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8bfr505zz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; type(x)
&lt;class 'int'&gt;</pre></div></div><p dir="ltr">However, we can use same variable x as a label to another object, which may not be of same type.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8eioj0bfn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x='Hello'
&gt;&gt;&gt; type(x)
&lt;class 'str'&gt;</pre></div></div><p>Python interpreter won’t object if same variable is used to store reference to object of another type. Unlike statically typed languages, type of variable changes dynamically as per the object whose reference has been assigned to it. Python is a dynamically typed language because type of variable depends upon type of object it is referring to.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">3. Is Python weakly typed or strongly typed?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Depending upon how strict its typing rules are, a programming language is classified as strongly typed or weakly (sometimes called loosely) typed.</p><p>Strongly typed language checks the type of a variable before performing an operation on it. If an operation involves incompatible types, compiler/interpreter rejects the operation. In such case, types must be made compatible by using appropriate casting techniques.</p><p>A weakly typed language does not enforce type safety strictly. If an operation involves two incompatible types, one of them is coerced into other type by performing implicit casts. PHP and JavaScript are the examples of weakly typed languages.</p><p>Python is a strongly typed language because it raises TypeError if two incompatible types are involved in an operation</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-kxiaqncn0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; y='Python'
&gt;&gt;&gt; z=x+y
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#2&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;z=x+y
TypeError: unsupported operand type(s) for +: 'int' and 'str'</pre></div></div><p>In above example, attempt to perform addition operation on one integer object and another string object raises TypeError as neither is implicitly converted to other. If however, the integer object “I” converted to string then concatenation is possible.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-pkc3whz1s" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; y='Python'
&gt;&gt;&gt; z=str(x)+y
&gt;&gt;&gt; z
'10Python'</pre></div></div><p>In a weakly typed language such as JavaScript, the casting is performed implicitly.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-b3mpfszuj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&lt;script&gt;
var x = 10;
var y = "Python";
var z=x+y;
document.write(z);
&lt;/script&gt;
Output:
10Python</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">4. What is difference between string and raw string?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Literal representation of Python string can be done using single, double or triple quotes. Following are the different ways in which a string object can be declared:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9ez18ci90" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s1='Hello Python'
&gt;&gt;&gt; s2="Hello Python"
&gt;&gt;&gt; s3='''Hello Python'''
&gt;&gt;&gt; s4="""Hello Python"""</pre></div></div><p>However, if a string contains any of the escape sequence characters, they are embedded inside the quotation marks. The back-slash character followed by certain alphabets carry a special meaning. Some of the escape characters are:</p><ul><li class="CertTheme__listItem pt-spacing10"><strong>\n : </strong>newline – causing following characters printed in next line</li><li class="CertTheme__listItem pt-spacing10"><strong>\t : </strong>tab – resulting in a fixed space between characters</li><li class="CertTheme__listItem pt-spacing10"><strong>\\ :</strong> prints backslash character itself</li><li class="CertTheme__listItem pt-spacing10"><strong>\b : </strong>effects pressing backspace key – removes previous character</li></ul><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7hr8r7m2q" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s1='Hello\nPython'
&gt;&gt;&gt; sprint (s1)
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#6&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;sprint (s1)
NameError: name 'sprint' is not defined
&gt;&gt;&gt; print (s1)
Hello
Python
&gt;&gt;&gt; s2='Hello\tPython'
&gt;&gt;&gt; print (s2)
Hello Python</pre></div></div><p>In case of a raw string on the other hand the escape characters don’t get translated while printing. Such raw string is prepared by prefixing ‘r’ or ‘R’ to the leading quotation mark(single, double or triple)</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8wa6f8oxs" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; r1=r'Hello\nPython'
&gt;&gt;&gt; print (r1)
Hello\nPython
&gt;&gt;&gt; r2=R"Hello\tPython"
&gt;&gt;&gt; print (r2)
Hello\tPython</pre></div></div><p>Python doesn’t allow any undefined escape sequence to be embedded in the quotation marks of a normal string.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-34ds3fcxx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s1='Hello\xPython'
SyntaxError: (unicode error) 'unicodeescape' codec can't decode bytes in position 5-6: truncated \xXX escape</pre></div></div><p>However, in a raw string, any character followed by backslash may be used because anyway it is not going to be interpreted for its meaning!</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ekcnx6bew" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s1=r'Hello\xPython'
&gt;&gt;&gt; print (s1)
Hello\xPython</pre></div></div><p>Raw strings are used in building regular expressions (called regex). Python’s re module provides functions to process the regular expressions. The re module assigns its own escape characters. Some of them are listed below:</p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><tbody><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\d</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Matches any decimal digit</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\D</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Matches any non-digit character</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\s</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Matches any whitespace character</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\S</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Matches any non-whitespace character</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\w</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Matches any alphanumeric character</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\W</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Matches any non-alphanumeric character.</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">\b</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">boundary between word and non-word and /B is opposite of /b</td></tr></tbody></table></div><p dir="ltr">Some examples of above escape characters are given below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-kfbx8ab6m" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import re
&gt;&gt;&gt; string='ab12cd34ef'
&gt;&gt;&gt; #find all digits
&gt;&gt;&gt; x = re.findall("\d", string)
&gt;&gt;&gt; print (x)
['1', '2', '3', '4']
&gt;&gt;&gt; #find all non-digit characters
&gt;&gt;&gt; x = re.findall("\D", string)
&gt;&gt;&gt; print (x)
['a', 'b', 'c', 'd', 'e', 'f']</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">5. Python library has built-in pow() function. It also has pow() function in math module. What's the difference?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Built-in pow() function has two variations &nbsp;- with two arguments and three arguments.</p><p>The pow() function with two arguments returns first argument raised to second argument. That means pow(x,y) results in x to the power y</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-61dkx2csx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; pow(10,2)
100</pre></div></div><p>The two-argument form pow(x, y) is equivalent to using the power operator: x**y.</p><p>The pow() function can take three arguments. In that case, pow(x,y,z) returns pow(x,y)%z. It returns modulo division of x to the power y and z.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-y9e0xq91l" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; pow(10,2)
100
&gt;&gt;&gt; pow(10,2,3)
1</pre></div></div><p>This is equivalent to10**2%3 which is 100%3 = 1</p><p>The pow() function from math module only has a two argument version. Both the arguments are treated as float. Hence the result is always float even if arguments are int.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1h0b8z1l5" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; math.pow(10,2)
100.0
&gt;&gt;&gt; pow(10,2)
100</pre></div></div><p>Because of the floating point representation in the memory, result of math.pow() may be inaccurate for integer arguments. Hence for integers it is advised to use built-in pow() function or ** operator.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">6. Python's math module has ceil() and floor() division functions. What is the difference?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python has a built-in round() function that rounds given number to nearest integer.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2qe80d9mr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; round(3.33)
3
&gt;&gt;&gt; round(3.65)
4</pre></div></div><p>Sometimes, you may need a largest integer smaller than given number, or a smallest integer, that is larger than given number. This is where floor() and ceil() functions in math module are used.</p><p>As the name suggests, ceil() stands for ceiling. It returns nearest integer greater than given number or numeric expression.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zvtnobd39" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import math
&gt;&gt;&gt; math.ceil(3.33)
4
&gt;&gt;&gt; math.ceil(3.65)
4</pre></div></div><p>The floor() function on the other hand returns integer that is smaller than given number or numeric expression indicating that given number is larger than a certain fraction from the resulting integer.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-j4hc22306" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import math
&gt;&gt;&gt; math.floor(3.33)
3
&gt;&gt;&gt; math.floor(3.65)
3</pre></div></div><p>The floor() function shows a peculiar behaviour when the number or numeric expression is negative. In such case, the result is floored away from 0.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-aybi1291r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; math.floor(-3.65)
-4</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">7. How do we define class level attributes and methods in a Python class?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>A class has two types of attributes – instance attributes and class atributes. Each object of class may have different values for instance attributes. However class attribute is same for each object of the class.</p><p>Instance attributes are normally defined and initialized through __init__() method which is executed when object is declared.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fft3667sk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class MyClass:
def __init__(self, x,y):
self.x=x
self.y=y
&gt;&gt;&gt; obj1=MyClass(10,20)
&gt;&gt;&gt; obj1.x, obj1.y
(10, 20)
&gt;&gt;&gt; obj2=MyClass(100,200)
&gt;&gt;&gt; obj2.x, obj2.y
(100, 200)</pre></div></div><p>In above example MyClass defines two instance attributes x and y. These attributes are initialized through __init__() method when object is declared. Each object has different values of x and y attributes.</p><p>Class attribute is defined outside __init__() method (in fact outside any method of the class). It can be assigned value in definition or from within __init__() or any method. However, it’s value is not different for each object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mthlw91fl" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class MyClass:
z=10
def __init__(self, x,y):
self.x=x
self.y=y</pre></div></div><p>Here z is not an instance attribute but class attribute defined outside __init__() method. Value of z is same for each object. It is accessed using name of the class. However, accessing with object also shows same value</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cgo9cva8m" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; obj1=MyClass(10,20)
&gt;&gt;&gt; obj2=MyClass(100,200)
&gt;&gt;&gt; MyClass.z
10
&gt;&gt;&gt; obj1.x, obj1.y, obj1.z
(10, 20, 10)
&gt;&gt;&gt; obj2.x, obj2.y, obj2.z
(100, 200, 10</pre></div></div><p>Class has instance methods as well as class methods. An instance method such as __init__() always has one of the arguments as self which refers to calling object. Instance attributes of calling object are accessed through it. A class method is defined with @classmethod decorator and received class name as argument.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5if07dfto" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class MyClass:
z=10
def __init__(self, x,y):
self.x=x
self.y=y
@classmethod
def classvar(cls):
print (cls.z)</pre></div></div><p>The class variable processed inside class method using class name as well as object as reference. It cannot access or process instance attributes.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-60eme63c1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; obj1=MyClass(10,20)
&gt;&gt;&gt; MyClass.classvar()
10
&gt;&gt;&gt; obj1.classvar()
10</pre></div></div><p>Class can have a static method which is defined with @staticmethod decorator. It takes neither a self nor a cls argument. Class attributes are accessed by providing name of class explicitly.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-oaajwkz2k" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class MyClass:
z=10
def __init__(self, x,y):
self.x=x
self.y=y
@classmethod
def classvar(cls):
print (cls.z)
@staticmethod
def statval():
print (MyClass.z)
&gt;&gt;&gt; obj1=MyClass(10,20)
&gt;&gt;&gt; MyClass.statval()
10
&gt;&gt;&gt; obj1.statval()
10</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">8. How can arguments be passed from command line to a Python program?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python is an interpreted language. Its source code is not converted to a self-executable as in C/C++ (Although certain OS specific third party utilities make it possible). Hence the standard way to execute a Python script is issuing the following command from command terminal.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9lpfhavvy" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python hello.py</pre></div></div><p>Here $ (in case of Linux) or c:\&gt; in case of Windows is called command prompt and text in front of it is called command line contains name of Python executable followed by Python script.</p><p>From within script, user input is accepted with the help of built-in input() function</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cn5ruxip0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">x=int(input('enter a number'))
y=int(input('enter another number'))
print ('sum=',x+y)</pre></div></div><p>Note that input() function always reads user input as string. If required it is converted to other data types.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-c9dp8iv7w" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#example.py
x=int(input('enter a number'))
y=int(input('enter another number'))
print ('sum=',x+y)</pre></div></div><p>Above script is run from command line as:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ty8rgwhpj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python example.py
enter a number10
enter another number20
sum= 30</pre></div></div><p>However, it is also possible to provide data to the script from outside by entering values separated by whitespace character after its name. All the segments of command line (called command line arguments) separated by space are stored inside the script in the form of a special list object as defined in built-in sys module. This special list object is called sys.argv</p><p>Following script collects command line arguments and displays the list.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-lx6ulmk0r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import sys
print ('arguments received', sys.argv)</pre></div></div><p dir="ltr">Run above script in command terminal as:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5yj3nxjmd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python example.py 10 20
arguments received ['example.py', '10', '20']</pre></div></div><p>Note that first element in sys.argv sys.argv[0] is the name of Python script. Arguments usable inside the script are sysargv[1:] Like the input() function, arguments are always strings. They may have to be converted appropriately.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-al5lji4df" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import sys
x=int(sys.argv[1])
y=int(sys.argv[2])
print ('sum=',x+y)
$python example.py 10 20
sum= 30</pre></div></div><p>The command line can pass variable number of arguments to the script. Usually length sys.argv is checked to verify if desired number of arguments are passed. For above script, only 2 arguments need to be passed. Hence the script should report error if number of arguments is not as per requirement.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-iswcef7ja" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import sys
x=int(sys.argv[1])
y=int(sys.argv[2])
print ('sum=',x+y)
$python example.py 10 20
sum= 30</pre></div></div><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-rnajbaw9m" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import sys
if len(sys.argv)!=3:
&nbsp;print ("invalid number of arguments")
else:
&nbsp;x=int(sys.argv[1])
&nbsp;y=int(sys.argv[2])
&nbsp;print ('sum=',x+y)</pre></div></div><p dir="ltr"><span style="color:rgb(0, 0, 0)"><strong>Output:</strong></span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hlesis5iy" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python example.py 10 20 30
invalid number of arguments
$ python example.py 10
invalid number of arguments
$ python example.py 10 20
sum= 30</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">9. How do you unpack a Python tuple object?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" data-mode="standard"><br></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>A tuple object is a collection data type. It contains one or more items of same or different data types. Tuple is declared by literal representation using parentheses to hold comma separated objects.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-6q7wdjxl5" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> tup</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenSelector">'hello'</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">3.25</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenOperator">+</span><span>3j</span><span class="CertTheme__tokenPunctuation">)</span><br><span>Empty tuple is declared by empty parentheses</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> tup</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>However, single element tuple should have additional comma in the parentheses otherwise it becomes a single object.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-u18ve72yq" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> tup</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> tup</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">type</span><span class="CertTheme__tokenPunctuation">(</span><span>tup</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&lt;</span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenSelector">'int'</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Using parentheses around comma separatedobjects is optional.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-m8nof7omv" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> tup</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">20</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">30</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">type</span><span class="CertTheme__tokenPunctuation">(</span><span>tup</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&lt;</span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenSelector">'tuple'</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Assigning multiple objects to tuple is called packing. Unpacking on the other hand is extracting objects in tuple into individual objects. In above example, the tuple object contains three int objects. To unpack, three variables on left hand side of assignment operator are used</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hvooc1cir" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenPunctuation">,</span><span>z</span><span class="CertTheme__tokenOperator">=</span><span>tup</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><br><span class="CertTheme__tokenProperty">10</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> y</span><br><span class="CertTheme__tokenProperty">20</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> z</span><br><span class="CertTheme__tokenProperty">30</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Number of variables on left hand side must be equal to length of tuple object.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wtlm6oe9f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenOperator">=</span><span>tup</span><br><span class="CertTheme__tokenFunction">Traceback</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span>most recent call last</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenOperator">:</span><br><span>&nbsp;File </span><span class="CertTheme__tokenSelector">"&lt;pyshell#12&gt;"</span><span class="CertTheme__tokenPunctuation">,</span><span> line </span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenAttr">in</span><span> </span><span class="CertTheme__tokenOperator">&lt;</span><span>module</span><span class="CertTheme__tokenOperator">&gt;</span><br><span>&nbsp; &nbsp;x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenOperator">=</span><span>tup</span><br><span>ValueError</span><span class="CertTheme__tokenOperator">:</span><span> too many values to </span><span class="CertTheme__tokenFunction">unpack</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span>expected </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>However, we can use variable prefixed with * to create list object out of remaining values</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nlreyja4b" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenOperator">*</span><span>y</span><span class="CertTheme__tokenOperator">=</span><span>tup</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><br><span class="CertTheme__tokenProperty">10</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> y</span><br><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">20</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">30</span><span class="CertTheme__tokenPunctuation">]</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><br></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">10. What is the difference between break and continue?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>In order to construct loop, Python language provides two keywords, while and for. The loop formed with while is a conditional loop. The body of loop keeps on getting executed till the boolean expression in while statement is true.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9mrn371me" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; while expr==True:
statement1
statement2
...
...</pre></div></div><p>The ‘for’ loop on the other hand traverses a collection of objects. Body block inside the ‘for’ loop executes for each object in the collection</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-qpogzkvdj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; for x in collection:
expression1
expression2
...
...</pre></div></div><p>So both types of loops have a pre-decided endpoint. Sometimes though, an early termination of looping is sought by abandoning the remaining iterations of loop. In some other cases, it is required to start next round of iteration before actually completing entire body block of the loop.</p><p>Python provides two keywords for these two scenarios. For first, break keyword is used. When encountered inside looping body, program control comes out of the loop, abandoning remaining iterations of current loop. This situation is diagrammatically represented by following flowchart:<img alt="difference between break and continue" loading="lazy" width="100" height="100" decoding="async"  class="fr-fic fr-dib" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1540316687405-b04ebbbddfb1?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80">Use of break in while loop:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-im8tm4kii" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; while expr==True:
statement1
if statement2==True:
break
...
...</pre></div></div><p>Use of break in ‘for’ loop:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-gyf4x3xxv" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; for x in collection:
expression1
if expression2==True:
break
...
...</pre></div></div><p>On the other hand continue behaves almost opposite to break. Instead of bringing the program flow out of the loop, it is taken to the beginning of loop, although remaining steps in the current iteration are skipped. The flowchart representation of continue is as follows:<img alt="flowchart representation of continue is as follows" loading="lazy" width="100" height="100" decoding="async"  class="fr-fic fr-dib" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1540316687405-b04ebbbddfb1?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80">Use of continue in while loop:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-v06n6mkr9" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; while expr==True:
statement1
if statement2==True:
continue
...
...</pre></div></div><p>Use of continue in ‘for’ loop:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-35vjsng1p" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; for x in collection:
expression1
if expression2==True:
continue
...
...</pre></div></div><p>Following code is a simple example of use of both break and continue keywords. It has an infinite loop within which user input is accepted for password. If incorrect password in entered, user is asked to input it again by continue keyword. Correct password terminates infinite loop by break</p><p>#example.py</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-pfajlwuu4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">while True:
&nbsp; &nbsp;pw=input('enter password:')
&nbsp; &nbsp;if pw!='abcd':
&nbsp; &nbsp; &nbsp; &nbsp;continue
&nbsp; &nbsp;if pw=='abcd':
&nbsp; &nbsp; &nbsp; &nbsp;break</pre></div></div><p><span style="color:rgb(0, 0, 0)"><strong>Output:</strong></span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-tm7x0eztb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">enter password:11
enter password:asd
enter password:abcd</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">11. What according to you is the difference between shallow copy and deep copy?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Unlike C/C++, a variable in Python is just a label to object created in memory. Hence when it is assigned to another variable, it doesn’t copy the object, but rather it acts as another reference to the same object. The built-in id() function brings out this behaviour.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mm2aam6wa" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num1=[10,20,30]&nbsp;
&gt;&gt;&gt; num2=num1&nbsp;
&gt;&gt;&gt; num1&nbsp;
[10, 20, 30]&nbsp;
&gt;&gt;&gt; num2&nbsp;
[10, 20, 30]&nbsp;
&gt;&gt;&gt; id(num1), id(num2)&nbsp;
(140102619204168, 140102619204168)</pre></div></div><p>The id() function returns the location of object in memory. Since id() for both the list objects is the same, both refer to the same object in memory.</p><p>The num2 is called as a shallow copy of num1. Since both refer to the same object, any change in either will reflect in the other object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1i0415zjh" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num1=[10,20,30]
&gt;&gt;&gt; num2=num1
&gt;&gt;&gt; num2[2]=5
&gt;&gt;&gt; num1
[10, 20, 5]
&gt;&gt;&gt; num2
[10, 20, 5]</pre></div></div><p>In the above example, the item at index no. 2 of num2 is changed. We see this change appearing in both.</p><p>A deep copy creates an entirely new object and copies of nested objects too are recursively added to it.</p><p>The copy module of the Python standard library provides two methods:</p><ul><li class="CertTheme__listItem pt-spacing10"><strong>copy.copy() –</strong> creates a shallow copy</li><li class="CertTheme__listItem pt-spacing10"><strong>copy.deepcopy() –</strong> creates a deep copy</li></ul><p>A shallow copy creates a new object and stores the reference of the original elements but doesn't create a copy of nested objects. It just copies the reference of nested objects. As a result, the copy process is not recursive.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3h2859exp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import copy
&gt;&gt;&gt; num1=[[1,2,3],['a','b','c']]
&gt;&gt;&gt; num2=copy.copy(num1)
&gt;&gt;&gt; id(num1),id(num2)
(140102579677384, 140102579676872)
&gt;&gt;&gt; id(num1[0]), id(num2[0])
(140102579676936, 140102579676936)
&gt;&gt;&gt; num1[0][1],id(num1[0][1])
(2, 94504757566016)
&gt;&gt;&gt; num2[0][1],id(num2[0][1])
(2, 94504757566016)</pre></div></div><p>Here num1 is a nested list and num2 is its shallow copy. Ids of num1 and num2 are different, but num2 doesn’t hold physical copies of internal elements of num1, but holds just the ids.</p><p>As a result, if we try to modify an element in nested element, its effect will be seen in both lists.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-y66zdve24" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num2[0][2]=100
&gt;&gt;&gt; num1
[[1, 2, 100], ['a', 'b', 'c']]
&gt;&gt;&gt; num2
[[1, 2, 100], ['a', 'b', 'c']]</pre></div></div><p>However, if we append a new element to one list, it will not reflect in the other list.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-e3v2vcdpo" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num2.append('Hello')
&gt;&gt;&gt; num2
[[1, 2, 100], ['a', 'b', 'c'], 'Hello']
&gt;&gt;&gt; num1
[[1, 2, 100], ['a', 'b', 'c']]</pre></div></div><p>A deep copy on the other hand, creates a new object and recursively adds the copies of nested objects too, present in the original elements.</p><p>In following example, num2 is a deep copy of num1. Now if we change any element of the inner list, this will not show in the other list.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-gg8uhagbz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import copy
&gt;&gt;&gt; num1=[[1,2,3],['a','b','c']]
&gt;&gt;&gt; num2=copy.deepcopy(num1)
&gt;&gt;&gt; id(num1),id(num2)
(140102641055368, 140102579678536)
&gt;&gt;&gt; num2[0][2]=100
&gt;&gt;&gt; num2
[[1, 2, 100], ['a', 'b', 'c']]
&gt;&gt;&gt; num1 #not changed
[[1, 2, 3], ['a', 'b', 'c']]</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">12. What are Python-specific environment variables?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>After you install Python software on your computer, it is desired that you add the installation directory in your operating system’s PATH environment variable. Usually the installer program does this action by default. Otherwise you have to perform this from the control panel.</p><p>In addition to updating PATH, certain other Python-specific environment variables should be set up. These environment variables are as follows:</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONPATH</strong></span></li></ul><p>This environment variable plays a role similar to PATH. It tells the Python interpreter where to locate the module files imported into a program. It includes the Python source library directory and &nbsp;other directories containing Python source code. PYTHONPATH is usually preset by the Python installer.</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONSTARTUP</strong></span></li></ul><p>It denotes the path of an initialization file containing Python source code. This file is executed every time the Python interpreter starts. It is named as .pythonrc.py and it contains commands that load utilities or modify PYTHONPATH.</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONCASEOK</strong></span></li></ul><p>In Windows, it enables Python to find the first case-insensitive match in an import statement. Set this variable to any value to activate it.</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONHOME</strong></span></li></ul><p>It is an alternative module search path. It is usually embedded in the PYTHONSTARTUP or PYTHONPATH directories to make switching module libraries easy. It may refer to zipfiles containing pure Python modules (in either source or compiled form)</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONDEBUG</strong></span></li></ul><p>If this is set to a non-empty string it turns on parser debugging output.</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONINSPECT</strong></span></li></ul><p>If this is set to a non-empty string it is equivalent to specifying the -i option. When a script is passed as the first argument or the -c option is used, enter interactive mode after executing the script or the command.</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONVERBOSE</strong></span></li></ul><p>If this is set to a non-empty string it is equivalent to specifying the -v option causes printing a message each time a module is initialized, showing the place from which it is loaded.</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>PYTHONEXECUTABLE</strong></span></li></ul><p>If this environment variable is set, sys.argv[0] will be set to its value instead of the value got through the C runtime. Only works on Mac OS X.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">13. Python index operator can accept negative numbers. Explain how?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python’s sequence data types (list, tuple or string) are indexed collection of items not necessarily of the same type. Index starts from 0 – as in C/C++ or Java array (although these languages insist that an array is a collection of similar data types). Again like C/C++, any element in sequence can be accessed by its index.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-q7aoks24z" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num=[10,20,25,15,40,60,23,90,50,80]
&gt;&gt;&gt; num[3]
15</pre></div></div><p>However, C/C++/Java don’t allow negative numbers as index. Java throws NegativeArraySizeException. C/C++ produces undefined behaviour. However, Python accepts negative index for sequences and starts counting index from end. Consequently, index -1 returns the last element in the sequence.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3m7sb4aeh" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num=[10,20,25,15,40,60,23,90,50,80]
&gt;&gt;&gt; num[-1]
80
&gt;&gt;&gt; num[-10]
10</pre></div></div><p>However, using negative index in slice notation exhibits some peculiar behaviour. The slice operator accepts two numbers as operands. First is index of the beginning element of the slice and second is the index of the element after slice. Num[2:5] returns elements with index 2, 3 and 4</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nzj4nlub8" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num=[10,20,25,15,40,60,23,90,50,80]
&gt;&gt;&gt; num[2:5]
[25, 15, 40]</pre></div></div><p>Note that default value of first operand is 0 and second is length+1</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yhdztt1n4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num=[10,20,25,15,40,60,23,90,50,80]
&gt;&gt;&gt; num[:3]
[10, 20, 25]
&gt;&gt;&gt; num[0:3]
[10, 20, 25]
&gt;&gt;&gt; num[8:]
[50, 80]
&gt;&gt;&gt; num[8:10]
[50, 80]</pre></div></div><p>Hence using a negative number as the first or second operand gives the results accordingly. For example using -3 as the first operand and ignoring the second returns the last three items. However, using &nbsp;-1 as second operand results in leaving out the last element</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-v8r0s4ann" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num[-3:]
[90, 50, 80]
&gt;&gt;&gt; num[-3:-1]
[90, 50]</pre></div></div><p>Using -1 as first operand without second operand is equivalent to indexing with -1</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-j7ebkae47" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num[-1:]
[80]
&gt;&gt;&gt; num[-1]
80</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">14. List and tuple data types appear to be similar in nature. Explain typical use cases of list and tuple.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Yes, the list and tuple objects are very similar in nature. Both are sequence data types being an ordered collection of items, not necessarily of the same type. However, there are a couple of subtle differences between the two.</p><p>First and foremost, a tuple is an immutable object while a list is mutable. Which simply means that once created, a tuple cannot be modified in place (insert/delete/update operations cannot be performed) and the list can be modified dynamically. Hence, if a collection is unlikely to be modified during the course of the program, a tuple should be used. For example price of items.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ydwcsqvlj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; quantity=[34,56,45,90,60]
&gt;&gt;&gt; prices=(35.50, 299,50, 1.55, 25.00,99)</pre></div></div><p>Although both objects can contain items of different types, conventionally a list is used generally to hold similar objects – similar to an array in C/C++ or Java. Python tuple is preferred to set up a collection of heterogenous objects – similar to a struct in C. Consequently, you would use a list to store marks obtained by students, and a tuple to store coordinates of a point in cartesian system.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-addct4j0o" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; marks=[342,516,245,290,460]
&gt;&gt;&gt; x=(10,20)</pre></div></div><p>Internally too, Python uses tuple a lot for a number of purposes. For example, if a function returns more than one value, it is treated as a tuple.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vzn1ux89l" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testfunction():
x=10
y=20
return x,y
&gt;&gt;&gt; t=testfunction()
&gt;&gt;&gt; t
(10, 20)
&gt;&gt;&gt; type(t)
&lt;class 'tuple'&gt;</pre></div></div><p>Similarly if a function is capable of receiving multiple arguments in the form of *args, it is parsed as a tuple.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-f54ad7iuc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testfunction(*args):
print (args)
print (type(args))
&gt;&gt;&gt; testfunction(1,2,3)
(1, 2, 3)
&lt;class 'tuple'&gt;</pre></div></div><p>Python uses tuple to store many built-in data structures. For example time data is stored as a tuple.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-byttizdgw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import time
&gt;&gt;&gt; time.localtime()
time.struct_time(tm_year=2019, tm_mon=5, tm_mday=28, tm_hour=9, tm_min=20, tm_sec=0, tm_wday=1, tm_yday=148, tm_isdst=0)</pre></div></div><p>Because of its immutable nature, a tuple can be used as a key in a dictionary, whereas a list can’t be used as key. Also, if you want to iterate over a large collection of items, tuple proves to be faster than a list.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">15. What is the difference between TypeError and ValueError?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>An exception is a type of run time error reported by a Python interpreter when it encounters a situation that is not easy to handle while executing a certain statement. Python’s library has a number of built-in exceptions defined in it. Both TypeError and valueError are built-in exceptions and it may at times be confusing to understand the reasoning behind their usage.</p><p>For example, int(‘hello’) raises ValueError when one would expect TypeError. A closer look at the documentation of these exceptions would clear the difference.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cpuy587o2" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; int('hello')
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#26&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;int('hello')
ValueError: invalid literal for int() with base 10: 'hello'</pre></div></div><p>Passing arguments of the wrong type (e.g. passing a list when an int is expected) should result in a TypeError which is also raised when an operation or function is applied to an object of inappropriate type.</p><p>Passing arguments with the wrong value (e.g. a number outside expected boundaries) should result in a ValueError. It is also raised when an operation or function receives an argument that has the right type but an inappropriate value.</p><p>As far as the above case is concerned the int() function can accept a string argument so passing ‘hello’ is not valid hence it is not a case of TypeError. Alternate signature of int() function with two arguments receives string and base of number system</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-xi2zji5dw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">int(string,base)
&gt;&gt;&gt; int('11', base=2)
3</pre></div></div><p>Second argument if ignored defaults to 10</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-w56zrlvdt" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; int('11')
11</pre></div></div><p>If you give a string which is of inappropriate ‘value’ such as ‘hello’ which can’t be converted to a decimal integer, ValueError is raised.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">16. Explain the builtins getattr() and setattr() functions.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The built-in functions make it possible to retrieve the value of specified attribute of any object (getattr) and add an attribute to given object.</p><p>Following is definition of a test class without any attributes.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ofcchoirr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class test:
Pass</pre></div></div><p>Every Python class is a subclass of ‘object’ class. Hence it inherits attributes of the class which can be listed by dir() function:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2wqdkarf4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; dir(test)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__']</pre></div></div><p>The setattr() function can be used to add a class level attribute to our test class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-pouea7f43" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; setattr(test,'name','Ravi')</pre></div></div><p>To retrieve its value use getattr() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ww48in2a9" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; getattr(test,'name')
'Ravi'</pre></div></div><p>You can of course access the value by dot (.) notation</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nq4pp8r21" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; test.name
'Ravi'</pre></div></div><p>Similarly, these functions add/retrieve attributes to/from an object of any class. Let us declare an instance of test class and add age attribute to it.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-oaca19efy" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=test()
&gt;&gt;&gt; setattr(x,'age',21)</pre></div></div><p>Obviously, ‘age’ becomes the instance attribute and not class attribute. To retrieve, use getattr() or ‘.’ operator.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-uj4rt0m9c" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; getattr(x,'age')
21
&gt;&gt;&gt; x.age
21</pre></div></div><p>Use dir() function to verify that ‘age’ attribute is available.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-oabg6nxhj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; dir(x)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'age', 'name']</pre></div></div><p>Incidentally, Python also provides ‘hasattr()’ function to check if an object possesses the given attribute.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-g4hv4ssa4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; hasattr(x,'age')
True
&gt;&gt;&gt; hasattr(test, 'age')
False</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">17. How are Python’s built-in functions ord() and chr() related?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>These two functions have exactly the opposite behaviour to each other. The chr() function returns a string representing a character to an integer argument which is a Unicode code point.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7w90h5t28" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; chr(65)
'A'
&gt;&gt;&gt; chr(51)
'3'
&gt;&gt;&gt; chr(546)
'Ȣ'
&gt;&gt;&gt; chr(8364)
'€'</pre></div></div><p>The chr() function returns corresponding characters for integers between 0 to 1114111 (0x110000). For a number outside this range, Python raises ValuError.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-o3jiabzwx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; chr(-10)
&nbsp; &nbsp;chr(-10)
ValueError: chr() arg not in range(0x110000)</pre></div></div><p>On the other hand ord() function returns an integer corresponding to Unicode code point of a character.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-6yhthcwtb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; ord('A')
65
&gt;&gt;&gt; ord('a')
97
&gt;&gt;&gt; ord('\u0222')
546
&gt;&gt;&gt; ord('€')
8364</pre></div></div><p>Note that ord() function accepts a string of only one character otherwise it raises TypeError as shown below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mg73rp1jz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; ord('aaa')
&nbsp; &nbsp;ord('aaa')
TypeError: ord() expected a character, but string of length 3 found</pre></div></div><p>These two functions are the inverse of each other as can be seen from the following</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fmyxglm0d" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; ord(chr(65))
65
&gt;&gt;&gt; chr(ord('A'))
'A'</pre></div></div><p>This is a common yet one of the most important Python coding interview questions and answers for experienced professionals, don't miss this one.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">18. What is the use of slice object in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python’s built-in function slice() returns Slice object. It can be used to extract slice from a sequence object list, tuple or string) or any other object that implements sequence protocol supporting _getitem__() and __len__() methods.</p><p>The slice() function is in fact the constructor in slice class and accepts start, stop and step parameters similar to range object. The start and step parameters are optional. Their default value is 0 and 1 respectively.</p><p>Following statement declares a slice object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-w6qgrslgp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; obj=slice(1,6,2)</pre></div></div><p>We use this object to extract a slice from a list of numbers as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9kuy94psb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; numbers=[7,56,45,21,11,90,76,55,77,10]
&gt;&gt;&gt; numbers[object]
Traceback (most recent call last):
&nbsp;File "&lt;stdin&gt;", line 1, in &lt;module&gt;
TypeError: list indices must be integers or slices, not type
&gt;&gt;&gt; numbers[obj]
[56, 21, 90]</pre></div></div><p>You can see that elements starting from index 1 upto 5 with step 2 are sliced away from the original list.</p><p>Slice can also receive negative index.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2zyky8j9t" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; obj=slice(-1,3,-1)
&gt;&gt;&gt; numbers[obj]
[10, 77, 55, 76, 90, 11]</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">19. Explain the behaviour of view objects in Python.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>In general, view gives a representation of a particular object in a certain direction or perspective. In Python’s dictionary, an object has items(), keys() and values() methods that return view objects. These are objects of dict_items, dict_keys and dict_values classes respectively. All of them are view types.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-b5r0o91om" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; dct=dct={'1':'one', '2':'two', '3':'three'}
&gt;&gt;&gt; v1=dct.items()
&gt;&gt;&gt; class(v1)
SyntaxError: invalid syntax
&gt;&gt;&gt; type(v1)
&lt;class 'dict_items'&gt;
&gt;&gt;&gt; v2=dct.keys()
&gt;&gt;&gt; type(v2)
&lt;class 'dict_keys'&gt;
&gt;&gt;&gt; v3=dct.values()
&gt;&gt;&gt; type(v3)
&lt;class 'dict_values'&gt;</pre></div></div><p>These view objects can be cast to list or tuples</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-x860m3mbm" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; list(v1)
[('1', 'one'), ('2', 'two'), ('3', 'three')]
&gt;&gt;&gt; tuple(v1)
(('1', 'one'), ('2', 'two'), ('3', 'three'))
&gt;&gt;&gt; list(v2)
['1', '2', '3']
&gt;&gt;&gt; list(v3)
['one', 'two', 'three']</pre></div></div><p>It is possible to run a for loop over these views as they can return an iterator object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-c0y7ncezr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; #using for loop over items() view
&gt;&gt;&gt; for i in v1:
print (i)
('1', 'one')
('2', 'two')
('3', 'three')</pre></div></div><p>As you can see each item in the view is a tuple of key–value pair. We can unpack each tuple in separate k-v objects</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4fcdnbfj3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; for k,v in v1:
print ('key:{} value:{}'.format(k,v))
key:1 value:one
key:2 value:two
key:3 value:three</pre></div></div><p>A view object also supports membership operators.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-gr9xo9fli" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; '2' in v2
True
&gt;&gt;&gt; 'ten' in v3
False</pre></div></div><p>The most important feature of view objects is that they are dynamically refreshed as any add/delete/modify operation is performed on an underlying dictionary object. As a result, we need not constructs views again.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-m8p2e5ev8" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; #update dictionary
&gt;&gt;&gt; dct.update({'4':'four','2':'twenty'})
&gt;&gt;&gt; dct
{'1': 'one', '2': 'twenty', '3': 'three', '4': 'four'}
&gt;&gt;&gt; #automatically refreshed views
&gt;&gt;&gt; v1
dict_items([('1', 'one'), ('2', 'twenty'), ('3', 'three'), ('4', 'four')])
&gt;&gt;&gt; v2
dict_keys(['1', '2', '3', '4'])
&gt;&gt;&gt; v3
dict_values(['one', 'twenty', 'three', 'four'])</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">20. Single and double underscore symbols have special significance in Python. When and where are they used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python identifiers with leading and/or single and/or double underscore characters i.e. _ or __ are used for giving them a peculiar meaning.</p><p>Unlike C++ or Java, Python doesn’t restrict access to instance attributes of a class. In C++ and Java, access is controlled by public, private or protected keywords. These keywords or their equivalents are not defined in Python. All resources of class are public by default.</p><p>However, Python does allow you to indicate that a variable is private by prefixing the name of the variable by double underscore __. In the following example, Student class has ‘name’ as private variable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jg63xofhh" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Student:
def __init__(self):
self.__name='Amar'</pre></div></div><p>Here __name acts as a private attribute of object of Student class. If we try to access its value from outside the class, Python raises AttributeError.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-opvjwjyg0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=Student()
&gt;&gt;&gt; x.__name
Traceback (most recent call last):
&nbsp; File "&lt;pyshell#37&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp; x.__name
AttributeError: 'Student' object has no attribute '__name'</pre></div></div><p>However, Python doesn’t restrict access altogether. Python only internally renames such attribute in the form _classname__attribute. Here __name is renamed as _Student__name. The mechanism is called name mangling</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-grl558bjp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x._Student__name
'Amar'</pre></div></div><p>An attribute with single underscore prefix emulates the behaviour of a protected data member indicating that it is available only to subclass.&nbsp;</p><p>Python uses attributes and methods with double underscore character before and after the name to form magic methods. Examples are __init__() and __dir__() etc.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">21. How do you define a constructor in Python class? Can a class have overloaded constructor in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>A staple in Python basic interview questions, be prepared to answer this one using your hands-on experience. Here is an standard response -</p><p>Python is a completely object oriented language. It has ‘class’ keyword using which a new user defined class can be created.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-q8lsflh9t" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
Pass</pre></div></div><p>In object oriented programming, an object of a class is initialized by automatically invoking a certain method when it is declared. In C++ and Java, a method of the same name as the class acts as a constructor. However, Python uses a special method named as __init__() as a constructor.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-msykcx0rb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
def __init__(self):
print ("new object initialized")
&gt;&gt;&gt; x=Myclass()
new object initialized</pre></div></div><p>Here x is declared as a new object of Myclass and __init__() method is called automatically.&nbsp;</p><p>The constructor method always has one mandatory argument carrying reference of the object that is calling. It is conventionally denoted by ‘self’ identifier although you are free to use any other. Instance attributes are generally initialized within the __init__() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3d6idetrr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
def __init__(self):
self.name='Mack'
self.age=25
&gt;&gt;&gt; x=Myclass()
&gt;&gt;&gt; x.name
'Mack'
&gt;&gt;&gt; x.age
25</pre></div></div><p>In addition to self, __init__() method can have other arguments using which instance attributes can be initialized by user specified data.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1nas88bcb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
def __init__(self, name, age):
self.name=name
self.age=age
&gt;&gt;&gt; x=Myclass('Chris',20)
&gt;&gt;&gt; x.name
'Chris'
&gt;&gt;&gt; x.age
20</pre></div></div><p>However, Python class is not allowed to have overloaded constructor as in C++ or Java. Instead you can use default values to arguments of __init__() method.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8npogsqju" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
def __init__(self, name='Mack', age=20):
self.name=name
self.age=age
&gt;&gt;&gt; x=Myclass()
&gt;&gt;&gt; x.name
'Mack'
&gt;&gt;&gt; x.age
20
&gt;&gt;&gt; y=Myclass('Nancy', 18)
&gt;&gt;&gt; y.name
'Nancy'
&gt;&gt;&gt; y.age
18</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">22. How does destructor work in a Python class?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>In object oriented programming, destructor is a method of class which will be automatically called when its object is no longer in use. Python provides a special (magic) method named __del__() to define destructor. Although destructor is not really required in Python class because Python uses the principle of automatic garbage collection, you can still provide __del__() method for explicit deletion of object memory.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-kwtpr4ab1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
def __init__(self):
print ('object initialized')
def __del__(self):
print ('object destroyed')
&gt;&gt;&gt; x=Myclass()
object initialized
&gt;&gt;&gt; del x
object destroyed</pre></div></div><p>In the above example , ‘del’ keyword in Python is invoked to delete a certain object. As __del__() method is exclusively provided, it is being called.</p><p>Python uses reference counting method for garbage collection. As per this method, an object is eligible for garbage collection if its reference count becomes zero.</p><p>In the following example, first obj becomes object of Myclass so its reference count is 1. But when we assign another object to obj, reference count of Myclass() becomes 0 and hence it is collected, thereby calling __del__() method inside the class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-qoqt5wqws" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class Myclass:
def __init__(self):
print ('object initialized')
def __del__(self):
print ('object destroyed')
&gt;&gt;&gt; obj=Myclass()
object initialized
&gt;&gt;&gt; obj=10
object destroyed</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">23. In what circumstances is the 'elif' keyword recommended to be used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python uses if keyword to implement decision control. Python’s syntax for executing block conditionally is as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hefpqt7lp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">if expr==True:
&nbsp; &nbsp; stmt1
&nbsp; &nbsp; stmt2
&nbsp; &nbsp; ..
stmtN</pre></div></div><p>Any Boolean expression evaluating to True or False appears after if keyword. Use : symbol and press Enter after the expression to start a block with increased indent. One or more statements written with the same level of indent will be executed if the Boolean expression evaluates to True. To end the block, press backspace to de-dent. Subsequent statements after the block will be executed if the expression is false or after the block if expression is true.</p><p>Along with if statement, else clause can also be optionally used to define alternate block of statements to be executed if the Boolean expression (in if statement) is not true. Following code skeleton shows how else block is used.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-uzmbr5ceg" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">if expr==True:
&nbsp; &nbsp; stmt1
&nbsp; &nbsp; stmt2
&nbsp; &nbsp; ..
else:
&nbsp; &nbsp; stmt3
&nbsp; &nbsp; stmt4
&nbsp; &nbsp; ..
stmtN</pre></div></div><p>There may be situations where cascaded or nested conditional statements are required to be used as shown in the following skeleton:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mi6kh0vgi" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">if expr1==True:
&nbsp; &nbsp; stmt1
&nbsp; &nbsp; stmt2
&nbsp; &nbsp; ..
else:
&nbsp; &nbsp; if expr2==True:
&nbsp; &nbsp; &nbsp; &nbsp; stmt3
&nbsp; &nbsp; &nbsp; &nbsp; stmt4
&nbsp; &nbsp; &nbsp; &nbsp; ...
&nbsp; &nbsp; else:
&nbsp; &nbsp; &nbsp; &nbsp; if expr3==True:
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stmt5
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; stmt6
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; ..
stmtN</pre></div></div><p>As you can see, the indentation level of each subsequent block goes on increasing because if block starts after empty else. To avoid these clumsy indentations, we can combine empty else and subsequent if by elif keyword. General syntax of if – elif – else usage is as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-o5b5nw3ky" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">if expr1==True:
&nbsp; &nbsp; #Block To Be Executed If expr1 is True
elif expr2==True:
&nbsp; &nbsp; &nbsp;#Block To Be Executed If expr1 is false and expr2 is true
elif expr3==True:
&nbsp; &nbsp; &nbsp;#Block To Be Executed If expr2 is false and expr3 is true
elif expr4==True:
&nbsp; &nbsp; &nbsp;#Block To Be Executed If expr3 is false and expr4 is true
else:&nbsp;
&nbsp; &nbsp; #Block To Be Executed If all preceding expressions false</pre></div></div><p>In this code, one if block, followed by one or more elif blocks and one else block at the end will appear. Boolean expression in front of elif is evaluated if previous expression fails. Last else block is run only when all previous expressions turn out to be not true. Importantly all blocks have the same level of indentation.</p><p>Here is a simple example to demonstrate the use of elif keyword. The following program computes discount at different rates if the amount is in different slabs.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4s9a0yhyn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">price=int(input("enter price"))
qty=int(input("enter quantity"))
amt=price*qty
if amt&gt;10000:
&nbsp; &nbsp; print ("10% discount applicable")
&nbsp; &nbsp; discount=amt*10/100
&nbsp; &nbsp; amt=amt-discount
elif amt&gt;5000:
&nbsp; &nbsp; print ("5% discount applicable")
&nbsp; &nbsp; discount=amt*5/100
&nbsp; &nbsp; amt=amt-discount
elif amt&gt;2000:
&nbsp; &nbsp; print ("2% discount applicable")
&nbsp; &nbsp; discount=amt*2/100
&nbsp; &nbsp; amt=amt-discount
elif amt&gt;1000:
&nbsp; &nbsp; print ("1% discount applicable")
&nbsp; &nbsp; discount=amt/100
&nbsp; &nbsp; amt=amt-discount
else:
&nbsp; &nbsp; print ("no discount applicable")
print ("amount payable:",amt)</pre></div></div><p dir="ltr"><span style="color:rgb(0, 0, 0)"><strong>Output:</strong></span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5us0mit9i" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">enter price1000
enter quantity11
10% discount applicable
amount payable: 9900.0
========================
enter price1000
enter quantity6
5% discount applicable
amount payable: 5700.0
========================
enter price1000
enter quantity4
2% discount applicable
amount payable: 3920.0
========================&nbsp;
enter price500
enter quantity3
1% discount applicable
amount payable: 1485.0
========================&nbsp;
enter price250
enter quantity3
no discount applicable
amount payable: 750</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">24. Python offers two keywords - while and for - to constitute loops. Can you bring out the difference and similarity in their usage?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Syntax of while loop:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wwxtu3u5r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">while expr==True:
&nbsp; &nbsp; stmt1
&nbsp; &nbsp; stmt2
&nbsp; &nbsp; ..
&nbsp; &nbsp; ..
stmtN</pre></div></div><p>The block of statements with uniform indent is repeatedly executed till the expression in while statement remains true. Subsequent lines in the code will be executed after loop stops when the expression ceases to be true.</p><p>Syntax of for loop:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-piifb2m9d" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">for x in interable:
&nbsp; &nbsp; stmt1
&nbsp; &nbsp; stmt2
&nbsp; &nbsp; ..
stmtN</pre></div></div><p>The looping block is executed for each item in the iterable object like list, or tuple or string. These objects have an in-built iterator that fetches one item at a time. As the items in iterable get exhausted, the loop stops and subsequent statements are executed.</p><p>The construction of while loop requires some mechanism by which the logical expression becomes false at some point or the other. If not, it will constitute an infinite loop. The usual practice is to keep count of the number of repetitions.</p><p>Both types of loops allow use of the else block at the end. The else block will be executed when stipulated iterations are over.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-boehiuw9f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">for x in "hello":
&nbsp; &nbsp; print (x)
else:
&nbsp; &nbsp; print ("loop over")
print ("end")</pre></div></div><p>Both types of loops can be nested. When a loop is placed inside the other, these loops are called nested loops.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2fen5osub" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#nested while loop
x=0
while x&lt;3:
&nbsp; &nbsp; x=x+1
&nbsp; &nbsp; y=0
&nbsp; &nbsp; while y&lt;3:
&nbsp; &nbsp; &nbsp; &nbsp; y=y+1
&nbsp; &nbsp; &nbsp; &nbsp; print (x,y)
#nested for loop
for x in range(1,4):
&nbsp; &nbsp; for y in range(1,4):
&nbsp; &nbsp; &nbsp; &nbsp; print (x,y)</pre></div></div><p>Both versions of nested loops print the following output:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7l3jaehlu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3
1 1
1 2
1 3
2 1
2 2
2 3
3 1
3 2
3 3</pre></div></div><p>A staple in senior Python interview questions with answers, be prepared to answer this one using your hands-on experience. This is also one of the top interview questions to ask a Python developer.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">25. What are some different command line options available for using Python interpreter?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python interpreter is invoked from command terminal of operating system (Windows or Linux). Two most common ways are starting interactive console and running script</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2vju01uw1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">For interactive console
$ python
Python 3.6.6 |Anaconda custom (64-bit)| (default, Oct &nbsp;9 2018, 12:34:16)&nbsp;
[GCC 7.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
&gt;&gt;&gt;</pre></div></div><p dir="ltr">For scripting mode</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8mhv30ee7" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python hello.py</pre></div></div><p>In addition to these common ways, Python command line can have different options. They are listed below:</p><p>-c cmd : program passed in as string. Interpreter executes the Python code in string which can be one or more statements separated by newlines.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-bmz8j2vtc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python -c "print ('hello')"
Hello</pre></div></div><p>-m mod : run library module as a script. the named module and execute its contents as the __main__ module. The following command creates a new virtual environment</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-xg0e8li80" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python -m venv myenv</pre></div></div><p>-i: inspect interactively after running script or code with -c option. The interactive prompt appears after the output. This can be useful to inspect global variables or a stack trace when a script raises an exception.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-30vco84z4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python -i -c "print ('hello')"
hello
$ python -i temp.py
Hello world
&gt;&gt;&gt;</pre></div></div><p><strong>Other options are:</strong></p><ul><li class="CertTheme__listItem pt-spacing10"><strong>B:</strong> don't write .pyc files on import; also PYTHONDONTWRITEBYTECODE=x</li><li class="CertTheme__listItem pt-spacing10"><strong>d: </strong>debug output from parser; also PYTHONDEBUG=x</li><li class="CertTheme__listItem pt-spacing10"><strong>E:</strong> ignore PYTHON* environment variables (such as PYTHONPATH)</li><li class="CertTheme__listItem pt-spacing10"><strong>h:</strong> print this help message and exit (also --help)</li><li class="CertTheme__listItem pt-spacing10"><strong>q:</strong> don't print version and copyright messages on interactive startup</li><li class="CertTheme__listItem pt-spacing10"><strong>v: </strong>verbose (trace import statements) can be supplied multiple times to increase verbosity</li><li class="CertTheme__listItem pt-spacing10"><strong>V:</strong> print the Python version number and exit (also --version)</li><li class="CertTheme__listItem pt-spacing10"><strong>x:</strong> skip first line of source, allowing use of non-Unix forms of #!cmd shebang</li><li class="CertTheme__listItem pt-spacing10"><strong>file: </strong>program read from script file</li></ul><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">26. What is the use of built-in zip() function. Explain with suitable examples.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python’s object hierarchy has a built-in zip object. It is an iterator of tuples containing items on the same index stored in one or more iterables. The zip object is returned by zip() function. With no arguments, it returns an empty iterator.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hg7rdthxc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=zip()
&gt;&gt;&gt; type(a)
&lt;class 'zip'&gt;
&gt;&gt;&gt; list(a)
[]</pre></div></div><p>When one iterable is provided, zip() function returns an iterator of one element tuples.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-l56g8j9ox" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=zip('abcd')
&gt;&gt;&gt; list(a)
[('a',), ('b',), ('c',), ('d',)]</pre></div></div><p>When the function has multiple iterables as arguments, each tuple in zip object contains items at similar index. Following snippet gives two lists to zip() function and the result is an iterator of two element tuples.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-75d4ke2pp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; l1=['pen', 'computer', 'book']
&gt;&gt;&gt; l2=[100,20000,500]
&gt;&gt;&gt; a=zip(l1,l2)
&gt;&gt;&gt; list(a)
[('pen', 100), ('computer', 20000), ('book', 500)]</pre></div></div><p>Iterable arguments may be of different length. In that case the zip iterator stops when the shortest input iterable is exhausted.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-lckch1vvr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; string="HelloWorld"
&gt;&gt;&gt; lst=list(range(6))
&gt;&gt;&gt; tup=(10,20,30,40,50)
&gt;&gt;&gt; a=zip(string, lst, tup)
&gt;&gt;&gt; list(a)
[('H', 0, 10), ('e', 1, 20), ('l', 2, 30), ('l', 3, 40), ('o', 4, 50)]</pre></div></div><p>The zip object can be unpacked in separate iterables by prefixing * to zipped object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-k8uq0p12p" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=['x', 'y', 'z']
&gt;&gt;&gt; b=[10,20,30]
&gt;&gt;&gt; c=zip(a,b)
&gt;&gt;&gt; result=list(c)
&gt;&gt;&gt; result
[('x', 10), ('y', 20), ('z', 30)]
&gt;&gt;&gt; x,y=zip(*result)
&gt;&gt;&gt; x
('x', 'y', 'z')
&gt;&gt;&gt; y
(10, 20, 30)</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">27. Explain built-in any() and all() functions.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>These two built-in functions execute logical or / and operators successively on each of the items in an iterable such as list, tuple or string.</p><p>The all() function returns True only if all items in the iterable return true. For empty iterable, all() function returns true. Another feature of all() function is that the evaluation stops at the first instance of returning false, abandoning the remaining items in the sequence.</p><p>On the other hand any() function returns True even if one item in the sequence returns true. Consequently, any() function returns false only if all items evaluate to false (or it is empty).</p><p>To check the behaviour of these functions, let us define a lambda function and subject each item in the list to it. The lambda function itself returns true if the number argument is even.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ac33r3b7l" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; iseven=lambda x:x%2==0
&gt;&gt;&gt; iseven(100)
True
&gt;&gt;&gt; iseven(101)
False
&gt;&gt;&gt; lst=[50,32,45,90,60]
&gt;&gt;&gt; all(iseven(x) for x in lst)
False
&gt;&gt;&gt; any(iseven(x) for x in lst)
True</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">28. How is multiplication and division of complex numbers done? Verify the process with complex number objects of Python.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>A complex number is made up of a real and an imaginary component. In mathematics, an imaginary number is defined as the square root of (-1) denoted by j. The imaginary component is multiplied by j. Python’s built-in complex object is represented by the following literal expression.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wvb7ilnhr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=3+2j</pre></div></div><p>Python’s built-in complex() function also returns complex object using to float objects, first as a real part and second as an imaginary component.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jjku2nycx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=complex(3,2)
&gt;&gt;&gt; x
(3+2j)</pre></div></div><p>Addition and subtraction of complex numbers is the straightforward addition of the respective real and imaginary components.</p><p>The process of multiplying these two complex numbers is very similar to multiplying two binomials. Multiply each term in the first number by each term in the second number.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9h5dhqkr8" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">a=6+4j
b=3+2j
c=a*b
c=(6+4j)*(3+2j)
c=(18+12j+12j+8*-1)
c=10+24j</pre></div></div><p>Verify this result with Python interpreter</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-gg7dl9kru" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=6+4j
&gt;&gt;&gt; b=3+2j
&gt;&gt;&gt; a*b
(10+24j) </pre></div></div><p>To obtain division of two complex numbers, multiply both sides by the conjugate of the denominator, which is a number with the same real part and the opposite imaginary part.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-w94803kyz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">a=6+4j
b=3+2j
c=a/b
c=(6+4j)*(3-2j)/(3+2j)(3-2j)
c=(18-12j+12j-8*-1)/(9-6j+6j-4*-1)
c=26/13
c=2+0j</pre></div></div><p>Verify this with Python interpreter</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2vhpdqd7q" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=6+4j
&gt;&gt;&gt; b=3+2j
&gt;&gt;&gt; a/b
(2+0j)</pre></div></div><p>This, along with other Python advanced interview questions, is a regular feature in Python interviews. Be ready to tackle it with the approach mentioned.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">29. When should finally clause be used in exception handling process?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python’s exception handling technique involves four keywords: try, except, else and finally. The try block is essentially a script you want to check if it contains any runtime error or exception. If it does, the exception is raised and except block is executed.&nbsp;</p><p>The else block is optional and will get run only if there is no exception in try block. Similarly, finally is an optional clause meant to perform clean up operations to be undertaken under all circumstances, whether try block encounters an exception or not. A finally clause is always executed before leaving the try statement, whether an exception has occurred or not.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-rvk0khu1w" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; try:
raise TypeError
finally:
print ("end of exception handling")
end of exception handling
Traceback (most recent call last):
&nbsp; File "&lt;pyshell#28&gt;", line 2, in &lt;module&gt;
&nbsp; &nbsp; raise TypeError
TypeError</pre></div></div><p>When an unhandled exception occurs in the try block (or it has occurred in an except or else clause), it is re-raised after the finally block executes. The finally clause is also executed when either try, except or else block is left via a break, continue or return statement.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yb4gn44wk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def division():
try:
a=int(input("first number"))
b=int(input("second number"))
c=a/b
except ZeroDivisionError:
print ('divide by 0 not allowed')
else:
print ('division:',c)
finally:
print ('end of exception handling')</pre></div></div><p>Let us call above function number of times to see how finally block works:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fqsokn351" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; division()
first number10
second number2
division: 5.0
end of exception handling
&gt;&gt;&gt; division()
first number10
second number0
divide by 0 not allowed
end of exception handling
&gt;&gt;&gt; division()
first number10
second numbertwo
end of exception handling
Traceback (most recent call last):
&nbsp; File "&lt;pyshell#47&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp; division()
&nbsp; File "&lt;pyshell#42&gt;", line 4, in division
&nbsp; &nbsp; b=int(input("second number"))
ValueError: invalid literal for int() with base 10: 'two'</pre></div></div><p>Note how exception is re-raised after the finally clause is executed. The finally block is typically used for releasing external resources such as file whether or not it was successfully used in previous clauses.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">30. Explain hash() function in the built-in library.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" data-mode="standard"><br></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>The hash() functions hash value of given object. The object must be immutable. Hash value is an integer specific to the object. These hash values are used during dictionary lookup.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Two objects may hash to the same hash value. This is called Hash collision. This means that if two objects have the same hash code, they do not necessarily have the same value.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0dwouqiv3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #hash </span><span class="CertTheme__tokenAttr">of</span><span> a number</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">100</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">100</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">100.00</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">100</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">1E2</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">100</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">100</span><span class="CertTheme__tokenOperator">+</span><span>0j</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">100</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>You can see that hash value of an object of same numeric value is the same.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-h3wx469lc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #hash </span><span class="CertTheme__tokenAttr">of</span><span> string</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"hello"</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">-</span><span class="CertTheme__tokenProperty">1081986780589020980</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #hash </span><span class="CertTheme__tokenAttr">of</span><span> tuple</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">2528502973977326415</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #hash </span><span class="CertTheme__tokenAttr">of</span><span> list</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">]</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenFunction">Traceback</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span>most recent call last</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenOperator">:</span><br><span>&nbsp; File </span><span class="CertTheme__tokenSelector">"&lt;pyshell#23&gt;"</span><span class="CertTheme__tokenPunctuation">,</span><span> line </span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenAttr">in</span><span> </span><span class="CertTheme__tokenOperator">&lt;</span><span>module</span><span class="CertTheme__tokenOperator">&gt;</span><br><span>&nbsp; &nbsp; </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">]</span><span class="CertTheme__tokenPunctuation">)</span><br><span>TypeError</span><span class="CertTheme__tokenOperator">:</span><span> unhashable type</span><span class="CertTheme__tokenOperator">:</span><span> </span><span class="CertTheme__tokenSelector">'list'</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Last case of hash value of list results in TypeError as list is not immutable /not hashable.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>The hash() function internally calls __hash__() magic method. To obtain a hash value of object of user defined class, the class itself should provide overridden implementation of __hash__()</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ee87xjtyt" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenFunction">User</span><span class="CertTheme__tokenOperator">:</span><br><span>&nbsp; &nbsp; def </span><span class="CertTheme__tokenFunction">__init__</span><span class="CertTheme__tokenPunctuation">(</span><span>self</span><span class="CertTheme__tokenPunctuation">,</span><span> age</span><span class="CertTheme__tokenPunctuation">,</span><span> name</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenOperator">:</span><br><span>&nbsp; &nbsp; &nbsp; &nbsp; self</span><span class="CertTheme__tokenPunctuation">.</span><span>age </span><span class="CertTheme__tokenOperator">=</span><span> age</span><br><span>&nbsp; &nbsp; &nbsp; &nbsp; self</span><span class="CertTheme__tokenPunctuation">.</span><span>name </span><span class="CertTheme__tokenOperator">=</span><span> name</span><br><span>&nbsp; &nbsp; def </span><span class="CertTheme__tokenFunction">__hash__</span><span class="CertTheme__tokenPunctuation">(</span><span>self</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenOperator">:</span><br><span>&nbsp; &nbsp; &nbsp; &nbsp; </span><span class="CertTheme__tokenAttr">return</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenPunctuation">(</span><span>self</span><span class="CertTheme__tokenPunctuation">.</span><span>age</span><span class="CertTheme__tokenPunctuation">,</span><span> self</span><span class="CertTheme__tokenPunctuation">.</span><span>name</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenPunctuation">)</span><br><span>x </span><span class="CertTheme__tokenOperator">=</span><span> </span><span class="CertTheme__tokenFunction">User</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">23</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenSelector">'Shubham'</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenFunction">print</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"The hash is: %d"</span><span> </span><span class="CertTheme__tokenOperator">%</span><span> </span><span class="CertTheme__tokenFunction">hash</span><span class="CertTheme__tokenPunctuation">(</span><span>x</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><b><strong class="CertTheme__textBold">Output:</strong></b></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mlip3djkl" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span>The hash is</span><span class="CertTheme__tokenOperator">:</span><span> </span><span class="CertTheme__tokenOperator">-</span><span class="CertTheme__tokenProperty">1916965497958416005</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><br></p></div></div></div></div><div class="relative"><div class="mt-spacing20 z-10 relative text-center flex justify-center mt-0"><button class="flex items-center gap-x-spacing8 py-spacing4"><span class="text-sm underline font-semibold text-mono-black">View all questions</span><i class="icon-chevron-down-double text-xl leading-5 text-neutral-800"></i></button></div><div class="absolute bottom-0 block h-32 w-full bg-gradient-to-t from-subdued/100 from-30% md:from-40%"></div></div></div></div></div><div class="hidden"><div><div class="text-xl text-neutral-800 mb-spacing20 font-bold">Intermediate</div><div class="relative w-full"><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-primary-main outline-2 shadow-card hover:shadow-card visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-t-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden">1. Python's standard library has a built-in function next(). For what purpose is it used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-0 text-neutral-800"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>The built-in next() function calls __next__() method of iterator object to retrieve next item in it. So the next question would be – what is an iterator?</p><p>An object representing stream of data is an iterator. One element from the stream is retrieved at a time. It follows iterator protocol which requires it to support &nbsp;__iter__() and __next__() methods. Python’s built-in method iter() implements __iter__() method and next() implements __next__() method. It receives an iterable and returns iterator object.</p><p>Python uses iterators &nbsp;implicitly while working with collection data types such as list, tuple or string. That's why these data types are called iterables. We normally use ‘for’ loop to iterate through an iterable as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vtfx5jqik" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; numbers=[10,20,30,40,50]
&gt;&gt;&gt; for num in numbers:
print (num)
10
20
30
40
50</pre></div></div><p dir="ltr">We can use iter() function to obtain iterator object underlying any iterable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-28nby1uo1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; iter('Hello World')
&lt;str_iterator object at 0x7f8c11ae2eb8&gt;
&gt;&gt;&gt; iter([1,2,3,4])
&lt;list_iterator object at 0x7f8c11ae2208&gt;
&gt;&gt;&gt; iter((1,2,3,4))
&lt;tuple_iterator object at 0x7f8c11ae2cc0&gt;
&gt;&gt;&gt; iter({1:11,2:22,3:33})
&lt;dict_keyiterator object at 0x7f8c157b9ea8&gt;</pre></div></div><p>Iterator object has __next__() method. Every time it is called, it returns next element in iterator stream. When the stream gets exhausted, StopIteration error is raised.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5g9znvons" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; numbers=[10,20,30,40,50]
&gt;&gt;&gt; it=iter(numbers)
&gt;&gt;&gt; it.__next__()
10
&gt;&gt;&gt; next(it)
20
&gt;&gt;&gt; it.__next__()
30
&gt;&gt;&gt; it.__next__()
40
&gt;&gt;&gt; next(it)
50
&gt;&gt;&gt; it.__next__()
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#16&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;it.__next__()
StopIteration</pre></div></div><p>Remember that next() function implements __next__() method. Hence next(it) is equivalent to it.__next__()</p><p>When we use a for/while loop with any iterable, it actually implements iterator protocol as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-86d23cubr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; while True:
try:
num=it.__next__()
print (num)
except StopIteration:
break
10
20
30
40
50</pre></div></div><p>A disk file, memory buffer or network stream also acts as an iterator object. Following example shows that each line from a file can be printed using next() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-rhg2vkiyb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; file=open('csvexample.py')
&gt;&gt;&gt; while True:
tr
KeyboardInterrupt
&gt;&gt;&gt; while True:
try:
line=file.__next__()
print (line)
except StopIteration:
break</pre></div></div><p>This is one of the most frequently asked Python interview questions for freshers in recent times. Make sure you get this one correct.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">2. Explain with example the technique of list comprehension in Python.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>List comprehension technique is similar to mathematical set builder notation. A classical for/while loop is generally used to traverse and process each item in an iterable. List comprehension is considerably more efficient than processing a list by ‘for’ loop. It is a very concise mechanism of creating new list by performing a certain process on each item of existing list.</p><p>Suppose we want to compute square of each number in a list and store squares in another list object. We can do it by a ‘for’ loop as shown below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1pwq33c5f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">squares=[]
for num in range(6):
&nbsp; &nbsp; &nbsp; &nbsp;squares.append(pow(num,2))
print (squares)</pre></div></div><p>The squares list object is displayed as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-l5as2z5ca" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">[0, 1, 4, 9, 16, 25]</pre></div></div><p>Same result is achieved by list comprehension technique much more efficiently. List comprehension statement uses following syntax:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-grsv6goo3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">newlist = [x for x in sequence]</pre></div></div><p>We use above format to construct list of squares using list comprehension.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-92g5azht6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; numbers=[6,12,8,5,10]
&gt;&gt;&gt; squares = [x**2 for x in numbers]
&gt;&gt;&gt; squares
[36, 144, 64, 25, 100]</pre></div></div><p>We can even generate a dictionary or tuple object as a result of list comprehension.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vhgs01ush" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; [{x:x*10} for x in range(1,6)]
[{1: 10}, {2: 20}, {3: 30}, {4: 40}, {5: 50}]</pre></div></div><p dir="ltr">Nested loops can also be used in a list comprehension expression. To obtain list of all combinations of items from two lists (Cartesian product):</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-k2vknvub6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; [{x:y} for x in range(1,3) for y in (11,22,33)]
[{1: 11}, {1: 22}, {1: 33}, {2: 11}, {2: 22}, {2: 33}]</pre></div></div><p>The resulting list stores all combinations of one number from each list</p><p>We can even have if condition in list comprehension. Following statement will result in list of all non-vowel alphabets in a string.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-sdi72zkte" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; odd=[x for x in range(1,11) if x%2==1]
&gt;&gt;&gt; odd
[1, 3, 5, 7, 9]</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">3. Where and how is Python keyword yield used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python’s yield keyword is typically used along with a generator. A generator is a special type of function that returns an iterator object returning stream of values. Apparently it looks like a normal function , but it doesn’t return a single value. Just as we use return keyword in a function, in a generator yield statement is used.</p><p>A normal function, when called, executes all statements in it and returns back to calling environment. The generator is called just like a normal function. However, it pauses on encountering yield keyword, returning the yielded value to calling environment. Because execution of generator is paused, its local variables and their states are saved internally. It resumes when __next__() method of iterator is called. The function finally terminates when __next__() or next() raises StopIteration.</p><p>In following example function mygenerator() acts as a generator. It yields one character at a time from the string sequence successively on every call of next()</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-aky390nnc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def mygenerator(string):
for ch in string:
print ("yielding", ch)
yield ch</pre></div></div><p dir="ltr">The generator is called which builds the iterator object</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4s6rtg6vj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; it=mygenerator("Hello World")</pre></div></div><p>Each character from string is pushed in iterator every time next() function is called.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ombibaa0l" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; while True:
try:
print ("yielded character", next(it))
except StopIteration:
print ("end of iterator")
break</pre></div></div><p dir="ltr"><span style="color:rgb(0, 0, 0)"><strong>Output:</strong></span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-xq1iodmsb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">yielding H
yielded character H
yielding e
yielded character e
yielding l
yielded character l
yielding l
yielded character l
yielding o
yielded character o
yielding &nbsp;
yielded character &nbsp;
yielding W
yielded character W
yielding o
yielded character o
yielding r
yielded character r
yielding l
yielded character l
yielding d
yielded character d
end of iterator</pre></div></div><p>In case of generator, elements are generated dynamically. Since next item is generated only after first is consumed, it is more memory efficient than iterator.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">4. Explain concept of mutable vs immutable object in Python.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Each Python object, whether representing a built-in class or a user defined class, is stored in computer’s memory at a certain randomly chosen location which is returned by the built-in id() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8890qejnb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; id(x)
94368638893568</pre></div></div><p>Remember that variable in Python is just a label bound to the object. Here x represents the integer object 10 which is stored at a certain location.</p><p>Further, if we assign x to another variable y, it is also referring to the same integer object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-6uogyi4za" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; y=x
&gt;&gt;&gt; id(y)
94368638893568</pre></div></div><p>Let us now change value of x with expression x=x+1. As a result a new integer 11 is stored in memory and that is now referred to by x. The object 10 continues to be in memory which is bound to y.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ztjyrpf5o" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=x+1
&gt;&gt;&gt; id(x)
94368638893600
&gt;&gt;&gt; id(y)
94368638893568</pre></div></div><p>Most striking feature is that the object 10 is not changed to 11. A new object 11 is created. Any Python object whose value cannot be changed after its creation is immutable. All number type objects (int, float, complex, bool, complex) are immutable.</p><p>String object is also immutable. If we try to modify the string by replacing one of its characters, Python interpreter doesn’t allow this, raising TypeError thus implying that a string object is immutable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-q98aczw5p" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; string='Python'
&gt;&gt;&gt; string[2]='T'
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#9&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;string[2]='T'
TypeError: 'str' object does not support item assignment</pre></div></div><p>Same thing is true with tuple which is also immutable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7z5l8nmfz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; tup=(10,20,30)
&gt;&gt;&gt; tup[1]=100
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#11&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;tup[1]=100
TypeError: 'tuple' object does not support item assignment</pre></div></div><p>However, list and dictionary objects are mutable. These objects can be updated in place.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-csz36tcqa" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num=[10,20,30]
&gt;&gt;&gt; num[1]=100
&gt;&gt;&gt; num
[10, 100, 30]
&gt;&gt;&gt; dct={'x':10, 'y':20, 'z':30}
&gt;&gt;&gt; dct['y']=100
&gt;&gt;&gt; dct
{'x': 10, 'y': 100, 'z': 30}</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">5. What is the difference between set and frozenset?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Set is a collection data type in Python. It is a collection of unique and immutable objects, not necessarily of same types. A set object can be created by a literal representation as well as using built-in set() function.</p><p>Comma separated collection of items enclosed in curly brackets is a set object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-32jpa68fm" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s={10,'Hello', 2.52}
&gt;&gt;&gt; type(s)
&lt;class 'set'&gt;</pre></div></div><p>You can also use built-in set() function which in fact is constructor of set class. It constructs a set object from an iterable argument such as list, tuple or string.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0i9vvinjc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s1=set([10,20,30])
&gt;&gt;&gt; s1
{10, 20, 30}
&gt;&gt;&gt; s2=set((100,200,300))
&gt;&gt;&gt; s2
{200, 100, 300}
&gt;&gt;&gt; s3=set('Hello')
&gt;&gt;&gt; s3
{'o', 'e', 'l', 'H'}</pre></div></div><p>Items in the iterable argument may not appear in the same order in set collection. Also, set is a collection of unique objects. Therefore, even if the iterable contains repeated occurrence of an item, it will appear only one in set. You can see just one presence of ‘l’ even if it appears twice in the string.</p><p>Items in the set collection must be mutable. It means a list or a dict object cannot be one of the items in a set although tuple is allowed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5fmplrzp8" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s={1,(2,3)}
&gt;&gt;&gt; s
{1, (2, 3)}
&gt;&gt;&gt; s={1,[2,3]}
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#16&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;s={1,[2,3]}
TypeError: unhashable type: 'list'</pre></div></div><p>Even though set can contain only immutable objects such as number, string or tuple, set itself is mutable. It is possible to perform add/remove/clear operations on set.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9ae8vjs7g" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; s1=set([10,20,30])
&gt;&gt;&gt; s1.add(40)
&gt;&gt;&gt; s1
{40, 10, 20, 30}
&gt;&gt;&gt; s1.remove(10)
&gt;&gt;&gt; s1
{40, 20, 30}</pre></div></div><p>Frozenset object on the other hand is immutable. All other characteristics of frozenset are similar to normal set. Because it is immutable add/remove operations are not possible.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4depsa3fi" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; f=frozenset([10,20,30])
&gt;&gt;&gt; f
frozenset({10, 20, 30})
&gt;&gt;&gt; f.add(40)
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#24&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;f.add(40)
AttributeError: 'frozenset' object has no attribute 'add'</pre></div></div><p>Python’s set data type is implementation of set as in set theory of Mathemetics. Operations such as union, intersection, difference etc. can be done on set as well as frozenset.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">6. Does Python support operator overloading? How?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" data-mode="standard"><br></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Certain non-alphanumeric characters are defined to perform a specified operation. Such characters are called operators. For example the characters +, -, * and / are defined to perform arithmetic operations on two numeric operands. Similarly &lt;, &gt; == and != perform comparison of two numeric operands by default.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Some of built-in classes of Python allow certain operators to be used with non-numeric objects too. For instance the + operator acts as concatenation operator with two strings. We say that + operator is overloaded. In general overloading refers to attaching additional operation to the operator.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yodhx36ib" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #</span><span class="CertTheme__tokenAttr">default</span><span> addition operation </span><span class="CertTheme__tokenAttr">of</span><span> </span><span class="CertTheme__tokenOperator">+</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenOperator">+</span><span class="CertTheme__tokenProperty">5</span><br><span class="CertTheme__tokenProperty">7</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #</span><span class="CertTheme__tokenOperator">+</span><span>operator overloaded </span><span class="CertTheme__tokenAttr">as</span><span> concatenation operator</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenSelector">'Hello'</span><span class="CertTheme__tokenOperator">+</span><span class="CertTheme__tokenSelector">'Python'</span><br><span class="CertTheme__tokenSelector">'HelloPython'</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">]</span><span class="CertTheme__tokenOperator">+</span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">4</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">5</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">6</span><span class="CertTheme__tokenPunctuation">]</span><br><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">4</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">5</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">6</span><span class="CertTheme__tokenPunctuation">]</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #</span><span class="CertTheme__tokenAttr">default</span><span> multiplication operation </span><span class="CertTheme__tokenAttr">of</span><span> </span><span class="CertTheme__tokenOperator">*</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenOperator">*</span><span class="CertTheme__tokenProperty">5</span><br><span class="CertTheme__tokenProperty">10</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #overloaded </span><span class="CertTheme__tokenOperator">*</span><span> operator </span><span class="CertTheme__tokenAttr">as</span><span> repetition operation </span><span class="CertTheme__tokenAttr">with</span><span> sequences</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">]</span><span class="CertTheme__tokenOperator">*</span><span class="CertTheme__tokenProperty">3</span><br><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">1</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">]</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenSelector">'Hello'</span><span class="CertTheme__tokenOperator">*</span><span class="CertTheme__tokenProperty">3</span><br><span class="CertTheme__tokenSelector">'HelloHelloHello'</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>For user defined classes, operator overloading is achieved by overriding relevant magic methods (methods with two underscores before and after name) from the object class. For example, if a class contains overridden definition of __add__() method, it is implemented when + operator is used with objects of that class. Following table shows magic methods and the arithmetic operator they implement:</span></p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><colgroup><col><col></colgroup><tbody><tr><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Operator</span></p></th><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Method</span></p></th></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>+</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__add__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>-</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__sub__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>*</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__mul__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>//</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__floordiv__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>/</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__div__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>%</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__mod__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>**</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__pow__(self, other[, modulo])</span></p></td></tr></tbody></table></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Following script contains a class that overrides __add__() method. It causes + operator overloading.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8lgjpmurp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenFunction">MyClass</span><span class="CertTheme__tokenOperator">:</span><br><span>def </span><span class="CertTheme__tokenFunction">__init__</span><span class="CertTheme__tokenPunctuation">(</span><span>self</span><span class="CertTheme__tokenPunctuation">,</span><span> x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenOperator">:</span><br><span>self</span><span class="CertTheme__tokenPunctuation">.</span><span>x</span><span class="CertTheme__tokenOperator">=</span><span>x</span><br><span>self</span><span class="CertTheme__tokenPunctuation">.</span><span>y</span><span class="CertTheme__tokenOperator">=</span><span>y</span><br><span>def </span><span class="CertTheme__tokenFunction">__add__</span><span class="CertTheme__tokenPunctuation">(</span><span>self</span><span class="CertTheme__tokenPunctuation">,</span><span> obj</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenOperator">:</span><br><span>x</span><span class="CertTheme__tokenOperator">=</span><span>self</span><span class="CertTheme__tokenPunctuation">.</span><span>x</span><span class="CertTheme__tokenOperator">+</span><span>obj</span><span class="CertTheme__tokenPunctuation">.</span><span>x</span><br><span>y</span><span class="CertTheme__tokenOperator">=</span><span>self</span><span class="CertTheme__tokenPunctuation">.</span><span>y</span><span class="CertTheme__tokenOperator">+</span><span>obj</span><span class="CertTheme__tokenPunctuation">.</span><span>y</span><br><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">'x:{} y:{}'</span><span class="CertTheme__tokenPunctuation">.</span><span class="CertTheme__tokenFunction">format</span><span class="CertTheme__tokenPunctuation">(</span><span>x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>We now have two objects of above class and use + operator with them. The __add__() method will implement overloaded behaviour of + operator as below:</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3hymoqp5w" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> m1</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenFunction">MyClass</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">5</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">7</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> m2</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenFunction">MyClass</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">3</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">8</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> m1</span><span class="CertTheme__tokenOperator">+</span><span>m2</span><br><span>x</span><span class="CertTheme__tokenOperator">:</span><span class="CertTheme__tokenProperty">8</span><span> </span><span>y</span><span class="CertTheme__tokenOperator">:</span><span class="CertTheme__tokenProperty">15</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Similarly comparison operators can also be overloaded by overriding following magic methods:</span></p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><colgroup><col><col></colgroup><tbody><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>&lt;</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__lt__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>&lt;=</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__le__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>==</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__eq__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>!=</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__ne__(self, other)</span></p></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" data-mode="standard"><span>&gt;=</span></p></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>object.__ge__(self, other)</span></p></td></tr></tbody></table></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><br></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">7. How is a complex number in Python represented in terms of polar coordinates?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" data-mode="standard"><br></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Complex number z=x+yj is a Cartesian (also called rectangular) representation. It is internally represented in polar coordinates with its modulus r (as returned by built-in abs() function) and the phase angle θ (pronounced as theta) which is counter clockwise angle in radians, between the x axis and line joining x with the origin. Following diagram illustrates polar representation of complex number:</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><img alt="polar coordinates" loading="lazy" width="100" height="100" decoding="async"  class="" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1486312338219-ce68d2c6f44d?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80"></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Functions in cmath module allow conversion of Cartesian representation to polar representation and vice versa.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><b><strong class="CertTheme__textBold">polar() :</strong></b><span> This function returns polar representation of a Cartesian notation of complex number. The return value is a tuple consisting of modulus and phase.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-d56y69ipn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenAttr">import</span><span> cmath</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> a</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">2</span><span class="CertTheme__tokenOperator">+</span><span>4j</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> cmath</span><span class="CertTheme__tokenPunctuation">.</span><span class="CertTheme__tokenFunction">polar</span><span class="CertTheme__tokenPunctuation">(</span><span>a</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">4.47213595499958</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">1.1071487177940904</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Note that the modulus is returned by abs() function</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-a80h58s8a" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">abs</span><span class="CertTheme__tokenPunctuation">(</span><span>a</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">4.47213595499958</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><b><strong class="CertTheme__textBold">phase():</strong></b><span> This function returns counter clockwise angle between x axis and segment joining a with origin. The angle is represented in radians and is between π and -π</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vkhr1avxe" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> cmath</span><span class="CertTheme__tokenPunctuation">.</span><span class="CertTheme__tokenFunction">phase</span><span class="CertTheme__tokenPunctuation">(</span><span>a</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">1.1071487177940904</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><b><strong class="CertTheme__textBold">rect(): </strong></b><span>This function returns Cartesian representation of complex number represented in polar form i.e. in modulus and phase</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jmhx4vied" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> cmath</span><span class="CertTheme__tokenPunctuation">.</span><span class="CertTheme__tokenFunction">rect</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">4.47213595499958</span><span class="CertTheme__tokenPunctuation">,</span><span> </span><span class="CertTheme__tokenProperty">1.1071487177940904</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">2.0000000000000004</span><span class="CertTheme__tokenOperator">+</span><span>4j</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><br></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">8. Recursion is also a kind of iteration. Discuss their relative merits and demerits.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Function is said to be recursive if it calls itself. Recursion is used when a process is defined in terms of itself. A body of recursive function which is executed repeatedly is a type of iteration.</p><p>The difference between a recursive function and the one having a loop such as ‘while’ or ‘for’ loop is that of memory and processor overhead. Let us try to understand with the help of iterative and recursive functions that calculate factorial value of a number.</p><p>Iterative factorial function</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-h0nac67q4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def factorial(x):
f=1
for i in range(1, x+1):
f=f*i
return f
&gt;&gt;&gt; factorial(5)
120</pre></div></div><p dir="ltr">Recursive factorial function</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ypf0wu70c" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def factorial(n): &nbsp; &nbsp;
&nbsp; &nbsp;if n == 1:
&nbsp; &nbsp; &nbsp; &nbsp;print (n)
&nbsp; &nbsp; &nbsp; &nbsp;return 1 &nbsp; &nbsp;
&nbsp; &nbsp;else:
&nbsp; &nbsp; &nbsp; &nbsp;return n * factorial(n-1)
&gt;&gt;&gt; factorial(5)
120</pre></div></div><p>For a function that involves a loop, it is called only once. Therefore only one copy is created for all the variables used in it. Also, as function call uses stack to return function value to calling environment, only limited stack operations are performed.</p><p>In case of recursion, repeated calls to same function with different arguments are initiated. Hence that many copies of local variables are created in the memory and that many stack operations are needed. &nbsp;</p><p>Obviously, a recursive call by function to itself causes an infinite loop. Hence recursive call is always conditional. Recursive approach provides a very concise solution to complex problem having many iterations.</p><p>In case of iterative version of factorial function, it is a straightforward case of cumulative multiplication of numbers in a range. However, in case of recursive function it is implementation of mathematical definition of factorial as below:</p><p><strong>n! = n X (n-1)!</strong></p><p>Here we have used factorial itself to define factorial. Such problems are ideally suited to be expressed recursively.</p><p>We can perform this calculation using a loop as per following code:</p><p>Now we shall try to write recursive equivalent of above loop. Look at mathematical definition of factorial once again.</p><p><strong>n!=nX(n-1)!</strong></p><p>Substitute n with 5. The expression becomes</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yxiqui0q4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">5!=5X4! = 5X4X3! = 5X4X3X2! = 5X4X3X2X1! = 5X4X3X2X1 = 120</pre></div></div><p dir="ltr">Let us see graphically the step by step process of computing factorial value of 5.</p><p data-empty="true"><img alt="Image" loading="lazy" width="100" height="100" decoding="async"  class="fr-fic fr-dib" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1523961131990-521072f1616c?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80"></p><p>The diagram illustrates how successively performing factorial calculation of number by decrementing the number till it reaches 1. This involves more cost of computing.</p><p>Hence it can be seen that recursion is more expensive in terms of resource utilization. It is also difficult to write a recursive function as compared to a straightforward repetitive or iterative solution.</p><p>Having said that, recursion is sometimes preferred especially in cases where iterative solution becomes very big, complex and involves too many conditions to keep track of. There are some typical applications where we have to employ recursive solution. Traversal of binary tree structure, sorting algorithms such as heap sort, finding traversal path etc are typical applications of recursion.</p><p>On a lighter note, to be able to write a recursive solution gives a lot of satisfaction to the programmer!</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">9. What is assert in Python? Is it a function, class or keyword? Where and how is it used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>‘assert’ is one of 33 keywords in Python language. Essentially it checks whether given boolean expression is true. If expression is true, Python interpreter goes on to execute subsequent code. However, if the expression is false, AssertionError is raised bringing execution to halt.</p><p>To demonstrate usage of assert statement, let us consider following function:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ok5fpoxye" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testassert(x,y):
assert y!=0
print ('division=',x/y)</pre></div></div><p>Here, the division will be performed only if boolean condition is true, but AssertionError raised if it is false</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zhyy6gr49" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; testassert(10,2)
division= 5.0
&gt;&gt;&gt; testassert(10,0)
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#8&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;testassert(10,0)
&nbsp;File "&lt;pyshell#6&gt;", line 2, in testassert
&nbsp; &nbsp;assert y!=0
AssertionError</pre></div></div><p>AssertionError is raised with a string in assert statement as custom error message</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jdd7by88v" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testassert(x,y):
assert y!=0, 'Division by Zero not allowed'
print ('division=',x/y)
&gt;&gt;&gt; testassert(10,0)
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#11&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;testassert(10,0)
&nbsp;File "&lt;pyshell#10&gt;", line 2, in testassert
&nbsp; &nbsp;assert y!=0, 'Division by Zero not allowed'
AssertionError: Division by Zero not allowed</pre></div></div><p>Instead of letting the execution terminate abruptly, the AssertionError is handled with try – except construct as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0kw0tnarc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testassert(x,y):
try:
assert y!=0
print ('division', x/y)
except AssertionError:
print ('Division by Zero not allowed')
&gt;&gt;&gt; testassert(10,0)
Division by Zero not allowed</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">10. What is a callable object in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>An object that can invoke a certain action or process is callable. The most obvious example is a function. Any function, built-in or user defined or a method in built-in or user defined class is an object of Function class</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-p6kgelres" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def myfunction():
print ('Hello')
&gt;&gt;&gt; type(myfunction)
&lt;class 'function'&gt;
&gt;&gt;&gt; type(print)
&lt;class 'builtin_function_or_method'&gt;</pre></div></div><p>Python’s standard library has a nuilt-in callable() function that returns true if object is callable. Obviously a function returns true.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-r1jyyrx1x" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; callable(myfunction)
True
&gt;&gt;&gt; callable(print)
True</pre></div></div><p>A callable object with parentheses (having arguments or not) invokes associated functionality. In fact any object that has access to __call__() magic method is callable. Above function is normally called by entering myfunction(). However it can also be called by using __call_() method inherited from function class</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-o04mowb1q" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; myfunction.__call__()
Hello
&gt;&gt;&gt; myfunction()
Hello</pre></div></div><p>Numbers, string, collection objects etc are not callable because they do not inherit __call__() method</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-dq1jrk9n5" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=10
&gt;&gt;&gt; b='hello'
&gt;&gt;&gt; c=[1,2,3]
&gt;&gt;&gt; callable(10)
False
&gt;&gt;&gt; callable(b)
False
&gt;&gt;&gt; callable(c)
False</pre></div></div><p>In Python, class is also an object and it is callable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vht54ymtd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class MyClass:
def __init__(self):
print ('called')
&gt;&gt;&gt; MyClass()
called
&lt;__main__.MyClass object at 0x7f37d8066080&gt;
&gt;&gt;&gt; MyClass.__call__()
called</pre></div></div><p>&lt;__main__.MyClass object at 0x7f37dbd35710&gt;</p><p>However, object of MyClass is not callable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-u4p57rtd0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; m=MyClass()
called
&gt;&gt;&gt; m()
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#23&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;m()
TypeError: 'MyClass' object is not callable</pre></div></div><p>In order that object of user defined be callable, it must override __call__() method</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zpunyg89f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class MyClass:
def __init__(self):
print ('called')
def __call__(self):
print ('this makes object callable')
&gt;&gt;&gt; m=MyClass()
called
&gt;&gt;&gt; m()
this makes object callable</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">11. What is the special significance of * and ** in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>In Python, single and double asterisk (* and **) symbols are defined as multiplication and exponentiation operators respectively. However, when prefixed to a variable, these symbols carry a special meaning. Let us see what that means.</p><p>A Python function is defined to receive a certain number of arguments. Naturally the same number of arguments must be provided while calling the function, otherwise Python interpreter raises TypeError as shown below.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9snprzg60" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(x,y):
return x+y
&gt;&gt;&gt; add(11,22)
33
&gt;&gt;&gt; add(1,2,3)
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#8&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;add(1,2,3)
TypeError: add() takes 2 positional arguments but 3 were given</pre></div></div><p>This is where the use of formal argument prefixed with single * comes. In a function definition, an argument prefixed with * is able to receive variable number of values from the calling environment and stores the values in a tuple object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fgx11292c" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(*numbers):
s=0
for n in numbers:
s=s+n
return s
&gt;&gt;&gt; add(11,22)
33
&gt;&gt;&gt; add(1,2,3)
6
&gt;&gt;&gt; add(10)
10
&gt;&gt;&gt; add()
0</pre></div></div><p>Python allows a function to be called by using the formal arguments as keywords. In such a case, the order of argument definition need not be followed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ogbihrfug" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(x,y):
return x+y
&gt;&gt;&gt; add(y=10,x=20)
30</pre></div></div><p>However, if you want to define a function which should be able to receive variable number of keyword arguments, the argument is prefixed by ** and it stores the keyword: values passed as a dictionary.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-bvg0iykvf" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(**numbers):
s=0
for k,v in numbers.items():
s=s+v
return s
&gt;&gt;&gt; add(a=1,b=2,c=3,d=4)
10</pre></div></div><p>In fact, a function can have positional arguments, variable number of arguments, keyword arguments with defaults and variable number of keyword arguments. In order to use both variable arguments and variable keyword arguments, **variable should appear last in the argument list.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-n4m14jaba" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(x,y,*arg, **kwarg):
print (x,y)
print (arg)
print (kwarg)
&gt;&gt;&gt; add(1,2,3,4,5,6,a=10,b=20,c=30)
1 2
(3, 4, 5, 6)
{'a': 10, 'b': 20, 'c': 30}</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">12. Which type of function calling mechanism is employed in Python? Call by value or Call by reference?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Calling a function by value is found to be used in C/C++ where a variable is actually a named location in computer memory. Hence the passed expression is copied into the formal argument which happens to be a local variable of the called function. Any manipulation of that local variable doesn’t affect the variable that was actually passed.</p><p>The following C program has square() function. It is called from the main by passing x which is copied to the local variable in square(). The change inside called function doesn’t have impact on x in main()</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1v17kz7mx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#include &lt;stdio.h&gt;
int main()
{
&nbsp; &nbsp;int square(int);
int x=10;
printf("\nx before passing: %d",x);
square(x);
printf("\nx after passing: %d",x);
}
int square(int x)
{
x=x*x;
}
result:
x before passing: 10
x after passing: 10</pre></div></div><p>In Python though, a variable is just a label of an object in computer memory. Hence formal as well as actual argument variables in fact are two different labels of same object – in this case 10. This can be verified by id() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-bmwb40218" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def square(y):
print (id(y))
&gt;&gt;&gt; x=10
&gt;&gt;&gt; id(x)
94172959017792
&gt;&gt;&gt; square(x)
94172959017792</pre></div></div><p>Hence we can infer that Python calls a function by passing reference of actual arguments to formal arguments. However, what happens when the function manipulates the received object depends on the type of object.</p><p>When a function makes modifications to the immutable object received as an argument, &nbsp;changes do not reflect in the object that was passed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-pkwjp0g6r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def square(y):
print ('received',id(y))
y=y**2
print ('changed',id(y),'y=',y)
&gt;&gt;&gt; x=10
&gt;&gt;&gt; id(x)
94172959017792
&gt;&gt;&gt; square(x)
received 94172959017792
changed 94172959020672 y= 100
&gt;&gt;&gt; x
10</pre></div></div><p>It can be seen that x=10 is passed to the square() function. Inside, y is changed. However, y becomes a label of another object 100, which is having different id(). This change doesn’t reflect in x – it being an immutable object. The same thing happens to a string or tuple.</p><p>However, if we pass a mutable object, any changes by called function will also have effect on that object after returning from the function.</p><p>In the example below, we pass a list (it is a mutable object) to a function and then add some more elements to it. After returning from the function, the original list is found to be modified.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-emhco9rvt" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def newlist(list):
print ('received', list, id(list))
list.append(4)
print ('changed', list, id(list))
&gt;&gt;&gt; num=[1,2,3]
&gt;&gt;&gt; id(num)
139635530080008
&gt;&gt;&gt; newlist(num)
received [1, 2, 3] 139635530080008
changed [1, 2, 3, 4] 139635530080008
&gt;&gt;&gt; num
[1, 2, 3, 4]</pre></div></div><p>Hence we can say that a mutable object, passed to a function by reference gets modified by any changes inside the called function.</p><p>A must-know for anyone looking for top Python interview questions, this is one of the frequently asked Python programming interview questions.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">13. Does Python support data encapsulation?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>As per the principles of object oriented programming, data encapsulation is a mechanism by which instance attributes are prohibited from direct access by any environment outside the class. In C++ / Java, with the provision of access control keywords such as public, private and protected it is easy to enforce data encapsulation. The instance variables are usually restricted to have private access, though the methods are publicly accessible.</p><p>However, Python doesn’t follow the doctrine of controlling access to instance or method attributes of a class. In a way, all attributes are public by default. So in a strict sense, Python doesn’t support data encapsulation. In the following example, name and age are instance attributes of User class. They can be directly manipulated from outside the class environment.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-xp8m2oico" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class User:
def __init__(self):
self.name='Amar'
self.age=20
&gt;&gt;&gt; a=User()
&gt;&gt;&gt; a.name
'Amar'
&gt;&gt;&gt; a.age
20
&gt;&gt;&gt; a.age=21</pre></div></div><p>Python even has built-in functions getattr() and setattr() to fetch and set values of an instance attribute.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-gdjmjvbfo" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; getattr(a, 'name')
'Amar'
&gt;&gt;&gt; setattr(a,'name','Ravi')
&gt;&gt;&gt; a.name
'Ravi'</pre></div></div><p>Having said that, Python does have means to emulate private keywords in Java/C++. An instance variable prefixed with ‘__’ (double underscore) behaves as a private variable – which means direct access to it will raise an exception as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-578i8kepa" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class User:
def __init__(self):
self.__name='Amar'
self.__age=20
&gt;&gt;&gt; a=User()
&gt;&gt;&gt; a.__name
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#18&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;a.__name
AttributeError: 'User' object has no attribute '__name'</pre></div></div><p>However, the double underscore prefix doesn’t make price truly private (as in case of Java/C++). It merely performs name mangling by internally renaming the private variable by adding the "_ClassName" to the front of the variable. In this case, variable named "__name" in Book class will be mangled in “_User__name” form.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-snpo071sd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a._User__name
'Amar'</pre></div></div><p>Protected member is (in C++ and Java) accessible only from within the class and its subclasses. Python accomplishes this behaviour by convention of prefixing the name of your member with a single underscore. You’re telling others “don’t touch this, unless you’re a subclass”.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">14. One of the 33 keywords of Python is lambda. How and for what purpose is it used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The def keyword is used to define a new function with a user specified name. Lambda keyword on the other hand is used to create an anonymous (un-named) function. Usually such a function is created on the fly and meant for one-time use. The general syntax of lambda is as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ohyuuk29l" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">lambda arg1, arg2… : expression</pre></div></div><p>A lambda function can have any number of arguments but there’s always a single expression after : symbol. The value of the expression becomes the return value of the lambda function. For example</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8i08kgsw5" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; add=lambda a,b:a+b</pre></div></div><p>This is an anonymous function declared with lambda keyword. It receives a and b and returns a+b.. The anonymous function object is assigned to identifier called add. We can now use it as a regular function call</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-48znc8jgo" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; print (add(2,3))
5</pre></div></div><p>The above lambda function is equivalent to a normal function declared using def keyword as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yueqden1g" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(a,b):
return a+b
&gt;&gt;&gt; print (add(2,3))
5</pre></div></div><p>However, the body of the lambda function can have only one expression. Therefore it is not a substitute for a normal function having complex logic involving conditionals, loops etc.</p><p>In Python, a function is a called a first order object, because function can also be used as argument, just as number, string, list etc. A lambda function is often used as argument function to functional programming tools such as map(), filter() and reduce() functions.</p><p>The built-in &nbsp;map() function subjects each element in the iterable to another function which may be either a built-in function, a lambda function or a user defined function and returns the mapped object. The map() function needs two arguments:</p><p>map(Function, Sequence(s))</p><p>Next example uses a lambda function as argument to map() function. The lambda function itself takes two arguments taken from two lists and returns the first number raised to second. The resulting mapped object is then parsed to output list.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yow25vimy" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; powers=map(lambda x,y: x**y, [10,20,30], [1,2,3])
&gt;&gt;&gt; list(powers)
[10, 400, 27000]</pre></div></div><p>The filter() function also receives two arguments, a function with Boolean return value and an iterable. Only those items for whom the function returns True are stored in a filter object which can be further cast to a list.</p><p>Lambda function can also be used as a filter. The following program uses lambda function that filters all odd numbers from a given range.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-se6w4fdba" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; list(filter(lambda x: x%2 == 1,range(1,11)))
[1, 3, 5, 7, 9]</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">15. Explain how useful Python's "with" statement is.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The intention of ‘with’ statement in Python is to make the code cleaner and much more readable. It simplifies the management of common resources like file streams.</p><p>The ‘with’ statement establishes a context manager object that defines the runtime context. The context manager handles the entry into, and the exit from, the desired runtime context for the execution of the block of code. Context managers are normally invoked using the ‘with’ statement.</p><p>Here is a typical use of with statement. Normally a file object is declared with built-in open() function. After performing file read/write operations the file object must be relieved from memory by its close() method failing which the disk file/stream underneath the object may be corrupted.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hxuyblmlg" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; f=open('file.txt','w')
&gt;&gt;&gt; f.write('Hello')
&gt;&gt;&gt; f.close()</pre></div></div><p>Use of ‘with’ statement sets up a context for the following block of statements. As the block finishes, the context object also automatically goes out of scope. It need not be explicitly destroyed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-om0kc14bh" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; with open('file.txt','w') as f:
f.write('Hello')</pre></div></div><p>Note that the object f is no longer alive after the block and you don’t have to call close() method as earlier. Hence, the code becomes clean and easy to read.</p><p>The file object acts as a context manager object by default. To define a custom context manager, the class must have __enter__() and __exit__() methods.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-p4n5f36vb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class Mycontext:
&nbsp; &nbsp;def __init__(self):
&nbsp; &nbsp; &nbsp; &nbsp;print ('object initialized')
&nbsp; &nbsp;def __enter__(self):
&nbsp; &nbsp; &nbsp; &nbsp;print ('context manager entered')
&nbsp; &nbsp;def __exit__(self, type, value, traceback):
&nbsp; &nbsp; &nbsp; &nbsp;print ('context manager exited')
with Mycontext() as x:
&nbsp; &nbsp;print ('context manager example')</pre></div></div><p><span style="color:rgb(0, 0, 0)"><strong>Output</strong></span>:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3dz0httji" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">object initialized
context manager entered
context manager example
context manager exited</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">16. Explain the concept of packages in Python</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>A module in Python is a Python script that may have definitions of class, functions, variables etc. having certain similar nature or intended for a common purpose. For example math module in Python library contains all frequently required mathematical functions. This modular approach is taken further by the concept of package. A package may contain multiple modules or even subpackages which may be a part of resources required for a certain purpose. For example Python library’s Tkinter package contains various modules that contain functionality required for building GUI.</p><p>Hierarchical arrangement of modules and subpackages is similar to the operating system’s file system. Access to a certain file in the file tree is obtained by using ‘/’. For example a file in a certain folder may have its path as c:\newdir\subdir\file.py. Similarly a module in newdir package will be named as newdir.subdir.py</p><p>For Python to recognize any folder as a package, it must have a special file named __init__.py which may or may not be empty and also serves as a packaging list by specifying resources from its modules to be imported.</p><p>Modules and their contents in a package can be imported by some script which is at the same level. If we have a.py, b.py and c.py modules and __init__.py file in a test folder under newdir folder, one or more modules can be imported by test.py in newdir as under:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-axj47rz5r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#c:/newdir/test.py
from test import a
a.hello()
#to import specific function
from test.a import hello
hello()</pre></div></div><p>The __init__.py file can be customized to allow package level access to functions/classes in the modules under it:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3hl3u08ez" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#__init__.py
from .a import hello
from .b import sayhello</pre></div></div><p>Note that hello() function can now be access from the package instead of its module</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-48o7mhkpk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#test.py
import test
test.hello()</pre></div></div><p>The test package is now being used by a script which is at the same level as the test folder. To make it available for system-wide use, prepare the following setup script:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ka0pt41le" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#setup.py
from setuptools import setup
setup(name='test',
&nbsp; &nbsp; &nbsp;version='0.1',
&nbsp; &nbsp; &nbsp;description='test package',
&nbsp; &nbsp; &nbsp;url='#',
&nbsp; &nbsp; &nbsp;author='....',
&nbsp; &nbsp; &nbsp;author_email='...@...',
&nbsp; &nbsp; &nbsp;license='MIT',
&nbsp; &nbsp; &nbsp;packages=['test'],
&nbsp; &nbsp; &nbsp;zip_safe=False)</pre></div></div><p>To install the test package:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8f3sedtj6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">C:\newdir&gt;pip install .</pre></div></div><p>Package is now available for import from anywhere in the file system. To make it publicly available, you have to upload it to PyPI repository.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">17. Explain the advantage of 'x' as value of mode parameter in open() function.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python’s built-in open() function returns a file object representing a disk file although it can also be used to open any stream such as byte stream or network stream. The open() function takes two arguments:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-54ymocagz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">f=open(“filename”, mode)</pre></div></div><p>Default value of mode parameter is ‘r’ which stands for reading mode. To open a file for storing data, the mode should be set to ‘w’</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-i5p0ujgmx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">f=open(‘file.txt’,’w’)
f.write(‘Hello World’)
f.close()</pre></div></div><p>However, ‘w’ mode causes overwriting file.txt if it is earlier present, thereby the earlier saved data is at risk of being lost. You can of course check if the file already exists before opening, using os module function:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3xs7slixu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import os
if os.path.exists('file.txt')==False:
&nbsp; &nbsp;f=open('file.txt','w')
&nbsp; &nbsp;f.write('Hello world')
&nbsp; &nbsp;f.close()</pre></div></div><p>This can create a race condition though because of simultaneous conditional operation and open() functions. To avoid this ‘x’ mode has been introduced, starting from Python 3.3. Here ‘x’ stands for exclusive. Hence, a file will be opened for write operation only if it doesn’t exist already. Otherwise Python raises FileExistsError</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yptpsfhkq" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">try:
&nbsp; &nbsp;with open('file.txt','x') as f:
&nbsp; &nbsp; &nbsp; &nbsp;f.write("Hello World")
&nbsp; &nbsp;except FileExistsError:
&nbsp; &nbsp; &nbsp; &nbsp;print ("File already exists")</pre></div></div><p>Using ‘x’ mode is safer than checking the existence of file before writing and guarantees avoiding accidental overwriting of files.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">18. How can we check if a certain class is a subclass of another?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python offers more than one way to check if a certain class is inherited from the other. In Python each class is a subclass of object class. This can be verified by running built-in issubclass() function on class A as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nlfhanxvl" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class A:
pass
&gt;&gt;&gt; issubclass(A,object)
True</pre></div></div><p>We now create B class that is inherited from A. The issubclass() function returns true for A as well as object class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-c7kp58hj2" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class B(A):
pass
&gt;&gt;&gt; issubclass(B,A)
True
&gt;&gt;&gt; issubclass(B,object)
True</pre></div></div><p>You can also use __bases__ attribute of a class to find out its super class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-atrzp3n5d" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; A.__bases__
(&lt;class 'object'&gt;,)
&gt;&gt;&gt; B.__bases__
(&lt;class '__main__.A'&gt;,)</pre></div></div><p>Finally the mro() method returns method resolution order of methods in an inherited class. In our case B is inherited from A, which in turn is a subclass of object class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2wccj6a53" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; B.mro()
[&lt;class '__main__.B'&gt;, &lt;class '__main__.A'&gt;, &lt;class 'object'&gt;]</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">19. Explain the concept of global, local and nonlocal variables in Python.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Depending upon where in the program a certain variable is declared, it is classified as a global, local or nonlocal variable. As the name suggests, any variable accessible to any function is a global variable. Any variable declared before a call to function (or any block of statements) is having global scope.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-o5a88x62i" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;print (x*x)
x=10
square()
output:
100</pre></div></div><p>Here, x is a global variable hence it can be accessed from anywhere, including from square() function. If we modify it in the function, its effect is persistent to global variable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-l0695jb9u" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;x=20
&nbsp; &nbsp;print ('in function',x)
x=10
square()
print ('outside function',x)
output:
in function 20
outside function 10</pre></div></div><p>However, if we try to increment x in the function, it raises UnBoundLocalError</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-j3d7hkxdf" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;x=x+1
&nbsp; &nbsp;print ('in function',x)
x=10
square()
print ('outside function',x)
output:
&nbsp; &nbsp;x=x+1
UnboundLocalError: local variable 'x' referenced before assignment</pre></div></div><p>A local variable is one which is declared inside any block of statements such as a function. Such a variable has only local presence which means, if we try to access outside its scope, an error will be reported.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1sjw9pmaw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;x=10
&nbsp; &nbsp;x=x**2
&nbsp; &nbsp;print ('in function',x)
square()
print ('outside function',x)
output:
&nbsp; &nbsp;print ('outside function',x)
NameError: name 'x' is not defined</pre></div></div><p>Note that if we use a variable of the same name as that available in the global namespace inside a function, it becomes a local variable as far as the local namespace is concerned. Hence, it will not modify the global variable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fjhm118zp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;x=5
&nbsp; &nbsp;x=x**2
&nbsp; &nbsp;print ('in function',x)
x=100
square()
print ('outside function',x)
output:
in function 25
outside function 100</pre></div></div><p>If however, you insist that your function needs to access global and local variables of the same name, you need to refer the former with ‘global’ keyword.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-qw44ak8dg" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;global x
&nbsp; &nbsp;x=x**2
&nbsp; &nbsp;print ('global x in function',x)
x=10
square()
print ('global x outside function',x)
output:
global x in function 100
global x outside function 100</pre></div></div><p>Python's global() function returns a dictionary object of all global variables keys and their respective values.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cxmxcc0z3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def square():
&nbsp; &nbsp;print ('global x in function',globals()['x'])
x=10
square()
output:
global x in function 10</pre></div></div><p>Python 3 introduced nonlocal keyword. It should be used to refer to a variable in the scope of an outer function from an inner function. Python does allow definition of nested functions. This nonlocal variable is useful in this context.</p><p>In following program function2 is nested inside function1 which is having var1 as its local variable. For function2 to refer to var1 it has to use a nonlocal keyword because it is neither a local nor a global variable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2qduszw9t" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def function1():
&nbsp; &nbsp;var1=20
&nbsp; &nbsp;def function2():
&nbsp; &nbsp; &nbsp; &nbsp;nonlocal var1
&nbsp; &nbsp; &nbsp; &nbsp;var1=50
&nbsp; &nbsp; &nbsp; &nbsp;print (var1)
&nbsp; &nbsp;print ('nonlocal var1 before inner function',var1)
&nbsp; &nbsp;function2()
&nbsp; &nbsp;print ('nonlocal var1 after inner function',var1)
var1=10
function1()
print ('global var1 after outer function unchanged',var1)
output:
nonlocal var1 before inner function 20
50
nonlocal var1 after inner function 50
global var1 after outer function unchanged 10</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">20. What are various string formatting features available in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Format specification symbols (%d, %f, %s etc) are popularly used in C/C++ for formatting strings. These symbols can be used in Python also. Just as in C, a string is constructed by substituting these symbols with Python objects.</p><p>In the example below, we use the symbols %s and %d in the string and substitute them by values of objects in tuple outside the string, prefixed by % symbol</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-s3dfnxp7r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; name='Ravi'
&gt;&gt;&gt; age=21
&gt;&gt;&gt; string="Hello. My name is %s. I am %d years old" %(name,age)
&gt;&gt;&gt; string
'Hello. My name is Ravi. I am 21 years old'</pre></div></div><p>In numeric formatting symbols, the width of number can be specified before and/or after a decimal point.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-11pjvxiyw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; price=50
&gt;&gt;&gt; weight=21.55
&gt;&gt;&gt; string="price=%3d weight=%3.3f" %(price,weight)
&gt;&gt;&gt; string
'price= 50 weight=21.550'</pre></div></div><p>Since Python 3.x a new format() method has been added in built-in string class which is more efficient and elegant, and is prescribed to be the recommended way of formatting with variable substitution.</p><p>Instead of &nbsp;% formatting operator, {} symbols are used as place holders.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-rufu3lq9d" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; name='Ravi'
&gt;&gt;&gt; age=21
&gt;&gt;&gt; string="Hello. My name is {}. I am {} years old".format(name,age)
&gt;&gt;&gt; string
'Hello. My name is Ravi. I am 21 years old'</pre></div></div><p>Format specification symbols are used with : instead of %. So to insert a string in place holder use {:s} and for integer use {:d}. Width of numeric and string variables is specified as before.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-aef5t41qa" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; price=50
&gt;&gt;&gt; weight=21.55
&gt;&gt;&gt; string="price={:3d} quantity={:3.3f}".format(price,weight)
&gt;&gt;&gt; string
'price= 50 quantity=21.550'</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">21. Consider following expression in Python console: "&gt;&gt;&gt;num=100", Is the above expression valid? If yes, what is the data type of num? Why?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>At first, it gives the impression that given expression is invalid because of railing comma. But it is perfectly valid and Python interpreter doesn’t raise any error.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>As would be expected, expression without railing comma declares an int object.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4tes0j5eu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> num</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">100</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">type</span><span class="CertTheme__tokenPunctuation">(</span><span>num</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&lt;</span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenSelector">'int'</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Note that use of parentheses in the representation of tuple is optional. Just comma separated values form a tuple.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-f08fh5f53" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">20</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">type</span><span class="CertTheme__tokenPunctuation">(</span><span>x</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&lt;</span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenSelector">'tuple'</span><span class="CertTheme__tokenOperator">&gt;</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #</span><span class="CertTheme__tokenAttr">this</span><span> is also a tuple even </span><span class="CertTheme__tokenAttr">if</span><span> there are no parentheses</span><br><span class="CertTheme__tokenOperator">...</span><span> x</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">20</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">type</span><span class="CertTheme__tokenPunctuation">(</span><span>x</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&lt;</span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenSelector">'tuple'</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Hence a number (any object for that matter) followed by comma, and without parentheses forms a tuple with single element.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-x7v1r6bqw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> num</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">100</span><span class="CertTheme__tokenPunctuation">,</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">type</span><span class="CertTheme__tokenPunctuation">(</span><span>num</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&lt;</span><span class="CertTheme__tokenAttr">class</span><span> </span><span class="CertTheme__tokenSelector">'tuple'</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>As mentioned above omitting comma is a regular assignment of int variable.</span></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">22. What is the difference between Python and IPython?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>While the two names sound similar, they are in fact entirely different.</p><p>Python is a general purpose programming language that is on top of the popularity charts among programmers worldwide. IPython, on the other hand, is an interactive command-line terminal for Python.&nbsp;</p><p>Standard Python runs in the interactive mode by invoking it from the command terminal to start a REPL (Read, Evaluate, Print and Loop) with Python prompt &gt;&gt;&gt;</p><p>IPython is an enhanced Python REPL with much more features as compared to standard Python shell. Some of the features are given below:</p><ul><li class="CertTheme__listItem pt-spacing10">Syntax highlighting</li><li class="CertTheme__listItem pt-spacing10">Stores the history of interactions</li><li class="CertTheme__listItem pt-spacing10">Offers features such as Tab completion of keywords, variables and function names</li><li class="CertTheme__listItem pt-spacing10">Has object introspection feature</li><li class="CertTheme__listItem pt-spacing10">Has magic command system for controlling Python environment</li><li class="CertTheme__listItem pt-spacing10">Can be embedded in other Python programs</li><li class="CertTheme__listItem pt-spacing10">Acts as a main kernel for Jupyter notebook.</li></ul><p>IPython has been developed by Fernando Perez in 2001. Its current version is IPython 7.0.1, that runs on Python 3.4 version or higher. IPython has spun off into Project Jupyter that provides a web based interface for the IPython shell.</p><p>IPython is bundled with Anaconda distribution. If you intend to install IPython with standard Python, use pip utility</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-iyo9hfjle" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">pip install ipython</pre></div></div><p>Or better still, you can install Jupyter. IPython, being one of its dependencies, will be installed automatically.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0m4fmhgl7" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">pip install jupyter</pre></div></div><p>The following diagram shows the IPython console.</p><p><img alt="Image" loading="lazy" width="100" height="100" decoding="async"  class="fr-fic fr-dib" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1523961131990-521072f1616c?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80"></p><p>The Jupyter notebook frontend of IPython looks as below:</p><p><img alt="Image" loading="lazy" width="100" height="100" decoding="async"  class="fr-fic fr-dib" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1523961131990-521072f1616c?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80"></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">23. What is a range object in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>In Python, range is one of the built-in objects. It is an immutable sequence of integers between two numbers separated by a fixed interval. The range object is obtained from built-in range() function.</p><p>The range() function has two signatures as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ci7j1y5fb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">range(stop)
range(start, stop[, step])</pre></div></div><p>The function can have one, two or three integer arguments named as start, stop and step respectively. It returns an object that produces a sequence of integers from start (inclusive) to stop (exclusive) by step.</p><p>In case only one argument is given it is treated as stop value and start is 0 by default, step is 1 by default.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-crl0e3e2m" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; #this will result in range from 0 to 9
&gt;&gt;&gt; range(10)
range(0, 10)</pre></div></div><p>If it has two arguments, first is start and second is stop. Here step is 1 by default.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-k2ekvb5ka" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; #this will return range of integers between 1 to 9 incremented by 1
&gt;&gt;&gt; range(1,10)
range(1, 10)</pre></div></div><p>If the function has three arguments, they will be used as start, stop and step parameters. The range will contain integers from start to step-1 separated by step.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-e9a9mdzxs" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; #this will return range of odd numbers between 1 to 9
&gt;&gt;&gt; range(1,10,2)
range(1, 10, 2)</pre></div></div><p>Elements in the range object are not automatically displayed. You can cast range object to list or tuple.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-irolr2rhw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; r=range(1,10,2)
&gt;&gt;&gt; list(r)
[1, 3, 5, 7, 9]</pre></div></div><p>The most common use of range is to traverse and process periodic sequence of integers using ‘for’ loop. The following statement produces the square of all numbers between 1 to 10.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-h3eh9r32d" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; for i in range(11):
print ('square of {} : {}'.format(i,i**2))
square of 0 : 0
square of 1 : 1
square of 2 : 4
square of 3 : 9
square of 4 : 16
square of 5 : 25
square of 6 : 36
square of 7 : 49
square of 8 : 64
square of 9 : 81
square of 10 : 100</pre></div></div><p>The range object has all methods available to a sequence, such as len(), index() and count()</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-tm0aumurl" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; r=range(1,10,2)
&gt;&gt;&gt; len(r)
5
&gt;&gt;&gt; r.index(7)
3
&gt;&gt;&gt; r.count(5)
1</pre></div></div><p>It is also possible to obtain an iterator out of the range object and traverse using next() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-39a1rzdlw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; it=iter(r)
&gt;&gt;&gt; while True:
try:
print(next(it))
except StopIteration:
break
1
3
5
7
9</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">24. What is JSON? How can Python objects be represented in JSON format?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The acronym JSON stands for JavaScript Object Notation based on a subset of the JavaScript language. It is a lightweight data interchange format which is easy for humans to use and easy for machines to parse.</p><p>Python library provides json module for converting Python objects to JSON format and vice versa. It contains dumps() and loads() functions to serialize and de-serialize Python objects.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fh0iqkgza" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import json
&gt;&gt;&gt; #dumps() converts Python object to JSON
&gt;&gt;&gt; data={'name':'Raju', 'subjects':['phy', 'che', 'maths'], 'marks':[50,60,70]} &nbsp;&nbsp;
&gt;&gt;&gt; jso=json.dumps(data)
&gt;&gt;&gt; #loads() converts JSON string back to Python object
&gt;&gt;&gt; Pydata=json.loads(jso)
&gt;&gt;&gt; Pydata
{'name': 'Raju', 'subjects': ['phy', 'che', 'maths'], 'marks': [50, 60, 70]}</pre></div></div><p>The json module has dump() and load() functions that perform serialization and deserialization of Python object to a File like object such as disk file or network stream. In the following example, we store JSON string to a file using load() and retrieve Python dictionary object from it. Note that File object must have relevant ‘write’ and ‘read’ permission.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7sbsmgwtl" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; data={'name':'Raju', 'subjects':['phy', 'che', 'maths'], 'marks':[50,60,70]} &nbsp;&nbsp;
&gt;&gt;&gt; file=open('testjson.txt','w')
&gt;&gt;&gt; json.dump(data, file) &nbsp;&nbsp;
&gt;&gt;&gt; file.close()</pre></div></div><p>The ‘testjson.txt’ file will show following contents:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ocoto87wo" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">{"name": "Raju", "subjects": ["phy", "che", "maths"], "marks": [50, 60, 70]}</pre></div></div><p>To load the json string from file to Python dictionary we use load() function with file opened in ‘r’ mode.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-q1vtrc0rt" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; file=open('testjson.txt','r')
&gt;&gt;&gt; data=json.load(file)
&gt;&gt;&gt; data
{'name': 'Raju', 'subjects': ['phy', 'che', 'maths'], 'marks': [50, 60, 70]}
&gt;&gt;&gt; file.close()</pre></div></div><p>The json module also provides object oriented API for the purpose with the help of JSONEncode and JSONDecoder classes.</p><p>The module also defines the relation between Python object and JSON data type for interconversion, as in the following table:</p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><thead><tr><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)">Python<br></th><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)">JSON<br></th></tr></thead><tbody><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">dict<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">object<br></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">list, tuple<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Array<br></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">str<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">String<br></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int, float, int- &amp; float-derived Enums<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Number<br></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">True<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">True<br></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">False<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">False<br></td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">None<br></td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Null<br></td></tr></tbody></table></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">25. How does Python differentiate between executable script and importable script?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>A Python script has .py extension and can have definition of class, function, constants, variables and even some executable code. Also, any Python script can be imported in another script using import keyword.</p><p>However, if we import a module having certain executable code, it will automatically get executed even if you do not intend to do so. That can be avoided by identifying __name__ property of module.</p><p>When Python is running in interactive mode or as a script, it sets the value of this special variable to '__main__'. It is the name of the scope in which top level is being executed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5vjd9c11g" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; __name__
'__main__'</pre></div></div><p>From within a script also, we find value of __name__ attribute is set to '__main__'. Execute the following script.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jiumspvz1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#example.py
print ('name of module:',__name__)
C:\users&gt;python example.py
name of module: __main__</pre></div></div><p>However, for imported module this attribute is set to the name of the Python script. (excluding the extension .py)</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-tn33h8lsk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import example
&gt;&gt;&gt; messages.__name__
'example'</pre></div></div><p>If we try to import example module in test.py script as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wx1jjsnqe" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#test.py
import example
print (‘name of module:’,__name__)
output:
c:\users&gt;python test.py
name of module:example
name of module: __main__</pre></div></div><p>However we wish to prevent the print statement in the executable part of example.py. To do that, identify the __name__ property of the module. If it is __main__ then only the print statement will be executed if we modify example.py as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-y6rq0dx16" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#example.py
if __name__==”__main__”:
&nbsp; &nbsp; &nbsp;print (‘name of module:,__name__)</pre></div></div><p>Now the output of test.py will not show the name of the imported module.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">26. What are the different ways of importing a module?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python’s import mechanism makes it possible to use code from one script in another. Any Python script (having .py extension) is a module. Python offers more than one way to import a module or class/function from a module in other script.</p><p>Most common practice is to use ‘import’ keyword. For example, to import functions in math module and call a function from it:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-x7r094nys" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import math
&gt;&gt;&gt; math.sqrt(100)
10.0</pre></div></div><p>Another way is to import specific function(s) from a module instead of populating the namespace with all contents of the imported module. For that purpose we need to use ‘from module import function’ syntax as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3oldtj941" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from math import sqrt, exp
&gt;&gt;&gt; sqrt(100)
10.0
&gt;&gt;&gt; exp(5)
148.4131591025766</pre></div></div><p>Use of wild card ‘*’ is also permitted to import all functions although it is discouraged; instead, basic import statement is preferred.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-d8ox4j81m" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from math import *</pre></div></div><p>Python library also has __import__() built-in function. To import a module using this function:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-v0lxwd24r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; m=__import__('math')
&gt;&gt;&gt; m.log10(100)
2.0</pre></div></div><p>Incidentally, import keyword internally calls __import__() function.</p><p>Lastly we can use importlib module for importing a module. It contains __import__() function as an alternate implementation of built-in function. The import_module() function for dynamic imports is as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4zzotohep" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; mod=input('name of module:')
name of module:math
&gt;&gt;&gt; m=importlib.import_module(mod)
&gt;&gt;&gt; m.sin(1.5)
0.9974949866040544</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">27. Does Python support polymorphism? Explain with a suitable example.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Polymorphism is an important feature of object oriented programming. It comes into play when there are commonly named methods across subclasses of an abstract base class.&nbsp;</p><p>Polymorphism is the ability to present the same interface for differing underlying forms. This allows functions to use objects of any of these polymorphic classes without needing to be aware of distinctions across the classes.</p><p>If class B inherits from class A, it doesn’t have to inherit everything about class A, it can do some of the things that class A does differently. It is most commonly used while dealing with inheritance. Method in Python class is implicitly polymorphic. Unlike C++ it need not be made explicitly polymorphic.</p><p>In the following example, we first define an abstract class called shape. It has an abstract method area() which has no implementation.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-66v3j4l4i" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import abc
class Shape(metaclass=abc.ABCMeta):
&nbsp; &nbsp; def __init__(self,tp):
&nbsp; &nbsp; &nbsp; &nbsp; self.shtype=tp
&nbsp; &nbsp; &nbsp; &nbsp; @abc.abstractmethod
&nbsp; &nbsp; &nbsp; &nbsp; def area(self):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass</pre></div></div><p>Two subclasses of shape - Rectangle and Circle are then created. They provide their respective implementation of inherited area() method.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wdvarm438" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class Rectangle(Shape):
&nbsp; &nbsp; &nbsp; &nbsp; def __init__(self,nm):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; super().__init__(nm)
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.l=10
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.b=20
&nbsp; &nbsp; &nbsp; &nbsp; def area(self):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return self.l*self.b
class Circle(Shape):
&nbsp; &nbsp; def __init__(self,nm):
&nbsp; &nbsp; &nbsp; &nbsp; super().__init__(nm)
&nbsp; &nbsp; &nbsp; &nbsp; self.r=5
&nbsp; &nbsp; def area(self):
&nbsp; &nbsp; &nbsp; &nbsp; import math
&nbsp; &nbsp; &nbsp; &nbsp; return math.pi*pow(self.r,2)</pre></div></div><p>Finally we set up objects with each of these classes and put in a collection.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-bd28ux1de" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">r=Rectangle('rect')
c=Circle('circle')
shapes=[r,c]
for sh in shapes:
&nbsp; &nbsp; print (sh.shtype,sh.area())</pre></div></div><p>Run a for loop over a collection. A generic call to area() method calculates the area of respective shape.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-tlhucdxq6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">Output:
rect 200
circle 78.53981633974483</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">28. What are IP address versions? How does Python manage IP addresses?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>IP address is a string of decimal (or hexadecimal) numbers that forms a unique identity of each device connected to a computer network that uses Internet Protocol for data communication. The IP address has two purposes: identifying host and location addressing.</p><p>To start with IP addressing scheme uses 32 bits comprising of four octets each of 8 bits having a value equivalent to a decimal number between 0-255. The octets are separated by dot (.). For example 111.91.41.196</p><p>This addressing scheme is called Ipv4 scheme. &nbsp;As a result of rapid increase in the number of devices directly connected to the internet, this scheme is being gradually replaced by Ipv6 version.</p><p>An IPv6 address uses hexadecimal digits to represent a string of unique 128 bit number. Each position in an IPv6 address represents four bits with a value from 0 to f. The 128 bits are divided into 8 groupings of 16 bits each separated by colons.</p><p>Example: 2001:db8:abcd:100::1/64</p><p>The IPv6 address always uses CIDR notation to determine how many of the leading bits are used for network identification and rest for host/interface identification.</p><p>Python's ipaddress module provides the capability to create, manipulate and operate on IPv4 and IPv6 addresses and networks. Following factory functions help to conveniently create IP addresses, networks and interfaces:</p><p><strong><span style="color:rgb(0, 0, 0)">ip_address():</span></strong></p><p>This function returns an IPv4Address or IPv6Address object depending on the IP address passed as argument.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ycnr5ja37" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import ipaddress
&gt;&gt;&gt; ipaddress.ip_address('192.168.0.1')
IPv4Address('192.168.0.1')
&gt;&gt;&gt; ipaddress.ip_address('2001:ab7::')
IPv6Address('2001:ab7::')</pre></div></div><p><strong><span style="color:rgb(0, 0, 0)">ip_network():</span></strong></p><p>This function returns an IPv4Network or IPv6Network object depending on the IP address passed as argument.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mvjj3kepe" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; ipaddress.ip_network('192.168.100.0/24')
IPv4Network('192.168.100.0/24')
&gt;&gt;&gt; ipaddress.ip_network('2001:db8:abcd:100::/64')
IPv6Network('2001:db8:abcd:100::/64')</pre></div></div><p><strong><span style="color:rgb(0, 0, 0)">ip_interface():</span></strong></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2y1r9l02y" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">This function returns IPv4Interface or IPv6Interface object .
&gt;&gt;&gt; ipaddress.ip_interface('192.168.100.10/24')
IPv4Interface('192.168.100.10/24')
&gt;&gt;&gt; ipaddress.ip_interface('2001:db8:abcd:100::1/64')
IPv6Interface('2001:db8:abcd:100::1/64')</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">29. Explain briefly the usage of pip utility.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The pip is a very popular package management utility used to install and manage Python packages especially those hosted on Python’s official package repository called Python Package index(PyPI).</p><p>The pip utility is distributed by default in standard Python’s distributions with versions 2.7.9 or later or 3.4 or later. For other Python versions, you may have to obtain it by first downloading get-pip.py from <a href="https://bootstrap.pypa.io/get-pip.py" rel="nofollow" target="_blank">https://bootstrap.pypa.io/get-pip.py</a> and running it.</p><p>First, check the installed version of pip on your system.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-p9vtt386z" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip –version</pre></div></div><p>Note that for Python 3.x, the pip utility is named as pip3.</p><p>Most common usage of pip is to install a certain package using the following syntax:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fmk32a613" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip install nameofpackage
#for example
$ pip install flask</pre></div></div><p>In order to install a specific version of the package, version number is followed by name</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-lhbf16v8e" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip install flask==1.0</pre></div></div><p>Use --upgrade option to upgrade the local version of the package to the latest version on PyPi.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-83ygbmusm" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip --upgrade flask</pre></div></div><p>Many a time, a project needs many packages and they may be having a lot of dependencies. In order to install all of them in one go, first prepare a list of all the packages needed in a file called ‘requirements.txt’ and ask pip to use it for batch installation.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vvscemmr1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip -r requirements.txt</pre></div></div><p>Uninstalling a package is easy</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-s1i3uag6u" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip uninstall packagename</pre></div></div><p>If the package needs to be installed from a repository other than PyPI, use –index-url option.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-66w0m0d58" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip --index-url path/to/package/ packagename</pre></div></div><p dir="ltr">There is ‘search’ option to search for a specific package available.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ewjwlh9zf" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip search pyqt</pre></div></div><p>The show option displays additional information of a package</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-c9xj754cz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip show sqlalchemy
Name: SQLAlchemy
Version: 1.1.13
Summary: Database Abstraction Library
Home-page: http://www.sqlalchemy.org
Author: Mike Bayer
Author-email: <a href="cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="214c484a447e4c51615b5b5b424e4c515455484f460f424e4c">[email&#160;protected]</a>
License: MIT License
Location: /home/lib/python3.6/site-packages</pre></div></div><p dir="ltr">The freeze option shows installed packages and their versions.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-neyywwp4v" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip freeze</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">30. Explain the concept of unit testing with a simple example.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Unit testing is one of the various software testing methods where individual units/ components of software are tested. Unit testing refers to tests that verify the functionality of a specific section of code, usually at the function level.&nbsp;</p><p>The unittest module is a part of Python’s standard library. This unit testing framework was originally inspired by Junit. Individual units of source code, such as functions, methods, and class are tested to determine whether they are fit for use. Intuitively, one can view a unit as the smallest testable part of an application. Unit tests are short code fragments created by programmers during the development process.</p><p>Test case is the smallest unit of testing. This checks for a specific response to a particular set of inputs. unittest provides a base class, TestCase, which may be used to create new test cases.</p><p>test suite is a collection of test cases, test suites, or both and is used to aggregate tests that should be executed together. Test suites are implemented by the TestSuite class.</p><p>Following code is a simple example of unit test using TestCase class.</p><p>First let us define a function to be tested. In the following example, add() function is to be tested.</p><p>Next step is to Create a testcase by subclassing unittest.TestCase.</p><p>Inside the class, define a test as a method with name starting with 'test'.</p><p>Each test call assert function of TestCase class. The assertEquals() function compares result of add() function with arg2 argument and throws assertionError if comparison fails.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-yi1sjjtp1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import unittest
def add(x,y):
&nbsp; &nbsp;return x + y
class SimpleTest(unittest.TestCase):
&nbsp; &nbsp;def testadd1(self):
&nbsp; &nbsp; &nbsp; self.assertEquals(add(10,20),30)
if __name__ == '__main__':
&nbsp; &nbsp;unittest.main()</pre></div></div><p dir="ltr">Run above script. Output shows that the test is passed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-15y1zgtgn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">Ran 1 test in 0.060s
OK</pre></div></div><p><strong>Possible outcomes are:</strong></p><ul><li class="CertTheme__listItem pt-spacing10"><strong>OK:</strong> test passes</li><li class="CertTheme__listItem pt-spacing10"><strong>FAIL:</strong> test doesn’t pass and AssertionError exception is raised.</li><li class="CertTheme__listItem pt-spacing10"><strong>ERROR: </strong>test raises exception other than AssertionError</li></ul><p>The unittest module also has a command line interface to be run using Python’s -m option.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mw0zkunx5" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">Python -m unittest example.py</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">31. How is DocTest framework used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python script containing a definition of function, class or module usually contains a ‘docstring’ which appears as a comment but is treated as a description of the corresponding object.</p><p>The doctest module uses the docstring. It searches docstring text for interactive Python sessions and verifies their output if it is exactly as the output of the function itself.</p><p>The doctests are useful to check if docstrings are up-to-date by verifying that all interactive examples still work as documented. They also perform regression testing by verifying interactive examples from a test file or a test object. Lastly they serve as an important tool to write tutorial documentation for a package.</p><p>Following code is a simple example of doctest. The script defines add() function and embeds various test cases in docstring in interactive manner. &nbsp;The doctest module defines testmod() function which runs the interactive examples and checks output of function for mentioned test cases with the one mentioned in docstring. If the output matches, test is passed otherwise it is failed.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vbx6t0zku" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def add(x,y):
&nbsp; &nbsp;"""Return the factorial of n, an exact integer &gt;= 0.
&nbsp; &nbsp;&gt;&gt;&gt; add(10,20)
&nbsp; &nbsp;30
&nbsp; &nbsp;&gt;&gt;&gt; add('aa','bb')
&nbsp; &nbsp;'aabb'
&nbsp; &nbsp;&gt;&gt;&gt; add('aaa',20)
&nbsp; &nbsp;Traceback (most recent call last):
&nbsp; &nbsp;...
&nbsp; &nbsp;TypeError: must be str, not int
&nbsp; &nbsp;"""
&nbsp; &nbsp;return x+y
if __name__ == "__main__":
&nbsp; &nbsp;import doctest
&nbsp; &nbsp;doctest.testmod()</pre></div></div><p>Save the above script as example.py and run it from command line. To get verbose output of doctests use -v option.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1y9ueqzcw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python example.py ##shows no output
$ python example.py -v
Trying:
&nbsp; &nbsp; add(10,20)
Expecting:
&nbsp; &nbsp; 30
ok
Trying:
&nbsp; &nbsp; add('aa','bb')
Expecting:
&nbsp; &nbsp; 'aabb'
ok
Trying:
&nbsp; &nbsp; add('aaa',20)
Expecting:
&nbsp; &nbsp; Traceback (most recent call last):
&nbsp; &nbsp; ...
&nbsp; &nbsp; TypeError: must be str, not int
ok
1 items had no tests:
&nbsp; &nbsp; __main__
1 items passed all tests:
&nbsp; &nbsp;3 tests in __main__.add
3 tests in 2 items.
3 passed and 0 failed.
Test passed</pre></div></div><p>Test examples can be put in a separate textfile and subjected as argument to testfile() function instead of using testmod() function as above.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">32. For what purpose(s) is Python's 'as' keyword used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>There are three distinct situations in Python script where ‘as’ keyword is appropriately used.</p><ol class="CertTheme__ol1 pt-spacing10"><li class="CertTheme__listItem pt-spacing10">to define alias for imported package, module or function.</li></ol><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0ww7ulrug" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">Alias for module in a package
&gt;&gt;&gt; from os import path as p
alias for a module
&gt;&gt;&gt; import math as m
&gt;&gt;&gt; m.sqrt(100)
10.0
alias for imported function
&gt;&gt;&gt; from math import sqrt as underroot
&gt;&gt;&gt; underroot(100)
10.0</pre></div></div><ol class="CertTheme__ol1 pt-spacing10"><li class="CertTheme__listItem pt-spacing10">to define a context manager variable:</li></ol><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-83piu6ivt" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; with open("file.txt",'w') as f:
f.write("Hello")</pre></div></div><ol class="CertTheme__ol1 pt-spacing10"><li class="CertTheme__listItem pt-spacing10">as argument of exception:</li></ol><p>When an exception occurs inside the try block, it may have an associated value known as the argument defined after exception type with ‘as’ keyword. The type of the argument depends on the exception type. The except clause may specify a variable after the exception name. The variable is bound to an exception instance with the arguments stored in instance.args.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-kxz11chmz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def divide(x,y):
try:
z=x/y
print (z)
except ZeroDivisionError as err:
print (err.args)
&gt;&gt;&gt; divide(10,0)
('division by zero',)</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">33. What is a user defined exception? How is it raised in Python script?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Errors detected during execution are called exceptions. In Python, all exceptions must be instances of a class that derives from BaseException. Python library defines many subclasses of BaseException. They are called built-in exceptions. Examples are TypeError, ValueError etc.</p><p>When user code in try: block raises an exception, program control is thrown towards except block of corresponding predefined exception type. However, if the exception is different from built-in ones, user can define a customized exception class. It is called user defined exception.</p><p>Following example defines MyException as a user defined exception.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-291e7d6xn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class MyException(Exception):
&nbsp; &nbsp;def __init__(self, num):
&nbsp; &nbsp; &nbsp; self.num=num
&nbsp; &nbsp;def __str__(self):
&nbsp; &nbsp; &nbsp; return "MyException: invalid number"+str(self.num)</pre></div></div><p>Built-in exceptions are raised implicitly by the Python interpreter. However, exceptions of user defined type must be raised explicitly by using raise keyword.</p><p>The try: block accepts a number from user and raises MyException if the number is beyond the range 0-100. The except block then processes the exception object as defined.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-srglticsi" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">try:
&nbsp; &nbsp;x=int(input('input any number: '))
&nbsp; &nbsp;if x not in range(0,101):
&nbsp; &nbsp; &nbsp; raise MyException(x)
&nbsp; &nbsp;print ("Number is valid")
except MyException as m:
&nbsp; &nbsp;print (m)</pre></div></div><p dir="ltr"><span style="color:rgb(0, 0, 0)"><strong>Output</strong></span>:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4ghlqs167" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">input any number: 55
Number is valid
input any number: -10
MyException: invalid number-10</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">34. The built-in print() function accepts a number of optional arguments. Explain their use with an example.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>This, along with other Python advanced interview questions, is a regular feature in Python interviews. Be ready to tackle it with the approach mentioned.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Obviously, print() is most commonly used Python statements and is used to display the value of one or more objects. However, it accepts other arguments other than objects to be displayed.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-s2imjkmei" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenFunction">print</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenOperator">*</span><span>objects</span><span class="CertTheme__tokenPunctuation">,</span><span> sep</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenSelector">' '</span><span class="CertTheme__tokenPunctuation">,</span><span> end</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenSelector">'\n'</span><span class="CertTheme__tokenPunctuation">,</span><span> file</span><span class="CertTheme__tokenOperator">=</span><span>sys</span><span class="CertTheme__tokenPunctuation">.</span><span>stdout</span><span class="CertTheme__tokenPunctuation">,</span><span> flush</span><span class="CertTheme__tokenOperator">=</span><span>False</span><span class="CertTheme__tokenPunctuation">)</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>The function can have any number of objects as positional arguments, all separated by commas. Other arguments are optional but must be used as keyword arguments.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>By default, the non-keyword arguments that is the list of objects is displayed with whitespace as a separator. However, you can define separator symbol with the help of sep argument.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-j5i37bdc4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> x</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">10</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> y</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">20</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> z</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenProperty">30</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span>x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenPunctuation">,</span><span>z</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">10</span><span> </span><span class="CertTheme__tokenProperty">20</span><span> </span><span class="CertTheme__tokenProperty">30</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> #using comma </span><span class="CertTheme__tokenAttr">as</span><span> separator</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span>x</span><span class="CertTheme__tokenPunctuation">,</span><span>y</span><span class="CertTheme__tokenPunctuation">,</span><span>z</span><span class="CertTheme__tokenPunctuation">,</span><span> sep</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenSelector">','</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenProperty">10</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">20</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenProperty">30</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Second keyword argument controls the end of line character. By default output of each print() statement terminates with newline character or ‘\n’. If you wish you can change it to any desired character.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-y27wqxtas" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"Hello World"</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"Python programming"</span><span class="CertTheme__tokenPunctuation">)</span><br><span>#</span><span class="CertTheme__tokenAttr">this</span><span> will cause output </span><span class="CertTheme__tokenAttr">of</span><span> next statement </span><span class="CertTheme__tokenAttr">in</span><span> same line</span><br><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"Hello World"</span><span class="CertTheme__tokenPunctuation">,</span><span> end</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenSelector">' '</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenFunction">print</span><span> </span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"Python programming"</span><span class="CertTheme__tokenPunctuation">)</span><br><span>output</span><span class="CertTheme__tokenOperator">:</span><br><span>Hello World</span><br><span>Python programming</span><br><span>Hello World Python programming</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>The file argument decides the output stream to which result of print() is directed. By default it is sys.stdout which is standard output</span></p><ul class="CertTheme__ul"><li value="1" class="CertTheme__listItem pt-spacing10"><b><strong class="CertTheme__textBold">device –</strong></b><span> the primary display device of the system. It can be changed to any file like object such as a disk file, bytearray, network stream</span></li><li value="2" class="CertTheme__listItem pt-spacing10"><b><strong class="CertTheme__textBold">etc –</strong></b><span> any object possessing write() method.</span></li></ul><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>The buffer argument is false by default, but if the flush keyword argument is true, the stream is forcibly flushed.</span></p></div></div></div></div><div class="relative"><div class="mt-spacing20 z-10 relative text-center flex justify-center mt-0"><button class="flex items-center gap-x-spacing8 py-spacing4"><span class="text-sm underline font-semibold text-mono-black">View all questions</span><i class="icon-chevron-down-double text-xl leading-5 text-neutral-800"></i></button></div><div class="absolute bottom-0 block h-32 w-full bg-gradient-to-t from-subdued/100 from-30% md:from-40%"></div></div></div></div></div><div class="hidden"><div><div class="text-xl text-neutral-800 mb-spacing20 font-bold">Advanced</div><div class="relative w-full"><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-primary-main outline-2 shadow-card hover:shadow-card visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-t-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden">1. What is a metaclass in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-0 text-neutral-800"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Any class in Python code, whether built-in or user defined, is an object of ‘type’ class which is called a 'metaclass'. &nbsp;A metaclass is a class whose objects are also classes. This relationship can be understood by the following diagram:</p><p><img alt="Metaclass in Python" loading="lazy" width="100" height="100" decoding="async"  class="fr-fic fr-dib" style="color:transparent;width:100%;height:auto;background-size:cover;background-position:50% 50%;background-repeat:no-repeat;background-image:url(&quot;data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http%3A//www.w3.org/2000/svg' viewBox='0 0 100 100'%3E%3Cfilter id='b' color-interpolation-filters='sRGB'%3E%3CfeGaussianBlur stdDeviation='20'/%3E%3C/filter%3E%3Cimage preserveAspectRatio='none' filter='url(%23b)' x='0' y='0' height='100%25' width='100%25' href='data:image/svg+xml;base64,CiAgPHN2ZyB3aWR0aD0iMTAwIiBoZWlnaHQ9IjEwMCIgdmVyc2lvbj0iMS4xIiB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbG5zOnhsaW5rPSJodHRwOi8vd3d3LnczLm9yZy8xOTk5L3hsaW5rIj4KICAgIDxkZWZzPgogICAgICA8bGluZWFyR3JhZGllbnQgaWQ9ImciPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNjY2MiIG9mZnNldD0iMjAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNkZGQiIG9mZnNldD0iNTAlIiAvPgogICAgICAgIDxzdG9wIHN0b3AtY29sb3I9IiNlZWUiIG9mZnNldD0iNzAlIiAvPgogICAgICA8L2xpbmVhckdyYWRpZW50PgogICAgPC9kZWZzPgogICAgPHJlY3Qgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9IiNlZWUiIC8+CiAgICA8cmVjdCBpZD0iciIgd2lkdGg9IjEwMCIgaGVpZ2h0PSIxMDAiIGZpbGw9InVybCgjZykiIC8+CiAgICA8YW5pbWF0ZSB4bGluazpocmVmPSIjciIgYXR0cmlidXRlTmFtZT0ieCIgZnJvbT0iLTEwMCIgdG89IjEwMCIgZHVyPSIxcyIgcmVwZWF0Q291bnQ9ImluZGVmaW5pdGUiICAvPgogIDwvc3ZnPg=='/%3E%3C/svg%3E&quot;)" sizes="(min-width: 767px) 50vw, 100vw" srcSet="" src="https://images.unsplash.com/photo-1522202176988-66273c2fd55f?ixlib=rb-4.0.3&auto=format&fit=crop&w=1000&q=80"></p><p dir="ltr">Python library's built-in function type() returns class to which an object belongs.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-sfp9wu1qu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; num=50
&gt;&gt;&gt; type(num)
&lt;class 'int'&gt;
&gt;&gt;&gt; numbers=[11.,22,33]
&gt;&gt;&gt; type(numbers)
&lt;class 'list'&gt;
&gt;&gt;&gt; lang='Python'
&gt;&gt;&gt; type(lang)
&lt;class 'str'&gt;</pre></div></div><p>Same thing applies to object of a user defined class</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-kkp7fogkb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class user:
def __init__self():
self.name='xyz'
self.age=21
&gt;&gt;&gt; a=user()
&gt;&gt;&gt; type(a)
&lt;class '__main__.user'&gt;</pre></div></div><p>Interestingly, class is also an object in Python. Each class, both built-in class and a user defined class is an object of type class</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7iym5owjl" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; type(int)
&lt;class 'type'&gt;
&gt;&gt;&gt; type(list)
&lt;class 'type'&gt;
&gt;&gt;&gt; type(str)
&lt;class 'type'&gt;
&gt;&gt;&gt; type(user)
&lt;class 'type'&gt;</pre></div></div><p>Can be rephrased and mentioned at the start along with the diagram and the tables above can be used as an example instead.</p><p>The type class is the default metaclass. The type() function used above takes an object as argument. The type() function's three argument variation is used to define a class dynamically. Its prototype is as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zgjgfdpo6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">newclass=type(name, bases, dict)</pre></div></div><p>The function returns class that has been created dynamically. Three arguments of type function are:</p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><tbody><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">name</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">name of the class which becomes __name__ attribute of new class</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">bases</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">tuple consisting of parent classes. Can be blank if not a derived class</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">dict</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">dictionary forming namespace of the new class containing attributes and methods and their values.</td></tr></tbody></table></div><p>Following statement creates user dynamically using type() function:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-bs1lcw5hi" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; user=type('user',(), {'name':'xyz', 'age':21})</pre></div></div><p>We can now use this class in the same manner as we do when it is defined using class statement:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-x0nxcx3hu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=user()
&gt;&gt;&gt; a.name,a.age
('xyz', 21)
&gt;&gt;&gt; type(a)
&lt;class '__main__.user'&gt;</pre></div></div><p>Similarly you can add instance method dynamically.<br><br></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jann1c09v" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def userdata(self):
print('name:{}, age:{}'.format(self.name, self.age))
&gt;&gt;&gt; user=type('user',(), {'name':'xyz', 'age':21,'userdata':userdata})
&gt;&gt;&gt; a=user()
&gt;&gt;&gt; a.userdata()
name:xyz, age:21</pre></div></div><p dir="ltr">Moreover, this class can be used to create an inherited class as well.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ry32yb3ml" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; newuser=type('newuser',(user,),{})
&gt;&gt;&gt; b=newuser()
&gt;&gt;&gt; b.userdata()
name:xyz, age:21</pre></div></div><p dir="ltr">As mentioned above, type is the default metaclass. A class that it inherited from type is a custom metaclass.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8l2eglii3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class NewMetaClass(type):
pass</pre></div></div><p>Using this custom metaclass to create new class as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-51n52xkvx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class newclass(metaclass=NewMetaClass):
pass</pre></div></div><p>Newly created class can even be used as base for other.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-89egcjsdh" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; class subclass(newclass):
pass</pre></div></div><p>The custom metaclass is a type of both the classes.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-sg1ug6v1p" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; type(NewMetaClass)
&lt;class 'type'&gt;
&gt;&gt;&gt; type(newclass)
&lt;class '__main__.NewMetaClass'&gt;
&gt;&gt;&gt; type(subclass)
&lt;class '__main__.NewMetaClass'&gt;</pre></div></div><p>Construction of subclass of user defined metaclass can be customized by overriding __new__ magic method.</p><p>In following example, we declare &nbsp;a metaclass (NewMetaClass) having __new__() method. It returns instance of new class which in turn is initialized by __init__() method as usual in the derived class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hndenhjkg" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">lass NewMetaClass(type):
&nbsp; &nbsp;def __new__(cls, name, bases, dict):
&nbsp; &nbsp; &nbsp; &nbsp;print ('name:',name)
&nbsp; &nbsp; &nbsp; &nbsp;print ('bases:',bases)
&nbsp; &nbsp; &nbsp; &nbsp;print ('dict:',dict) &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp;inst = super().__new__(cls, name, bases, dict)
&nbsp; &nbsp; &nbsp; &nbsp;return inst
class myclass(metaclass=NewMetaClass):
&nbsp; &nbsp;pass
class newclass(myclass,metaclass=NewMetaClass):
&nbsp; &nbsp;def __init__(self):
&nbsp; &nbsp; &nbsp; &nbsp;self.name='xyz'
&nbsp; &nbsp; &nbsp; &nbsp;self.age=21</pre></div></div><p>When we declare an object of newclass and print its attributes, following output is displayed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-w1nh6wni6" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">x=newclass()
print('name:',x.name, 'age:',x.age)
print ('type:',type(x))</pre></div></div><p dir="ltr"><span style="color:rgb(0, 0, 0)"><strong>Output:</strong></span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-elle2k1yd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">name: myclass
bases: ()
dict: {'__module__': '__main__', '__qualname__': 'myclass'}
name: newclass
bases: (&lt;class '__main__.myclass'&gt;,)
dict: {'__module__': '__main__', '__qualname__': 'newclass', '__init__': &lt;function newclass.__init__ at 0x7f65d8dfcf28&gt;}
name: xyz age: 21
type: &lt;class '__main__.newclass'&gt;</pre></div></div><p>We can thus customize the metaclass and creation of its subclasses.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">2. Python doesn't have concept of array as in C/C++/Java etc. But it does have array module in the standard library. How is it used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Array is a collection of more than one element of similar data type in C/C++/Java etc. Python doesn't have any built-in equivalent of array. Its List/tuple data types are collections, but items in it may be of different types.</p><p>Python's array module emulates C type array. The module defines 'array' class whose constructor requires two arguments:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0zaba4qsd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">array(typecode, initializer)</pre></div></div><p>The typecode determines the type of array. Initializer should be a sequence with all elements of matching type.</p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><thead><tr><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)">Type code</th><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)">C Type</th><th class="CertTheme__tableCell CertTheme__tableCellHeader" style="border:1px solid black;width:175px;vertical-align:top;text-align:start;background-color:rgb(242, 243, 245)">Python Type</th></tr></thead><tbody><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'b'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">signed char</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'B'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">unsigned char</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'u'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Py_UNICODE</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Unicode character</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'h'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">signed short</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'H'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">unsigned short</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'i'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">signed int</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'I'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">unsigned int</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'I'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">signed long</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'L'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">unsigned long</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'q'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">signed long long</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'Q'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">unsigned long long</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">int</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'f'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Float</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">float</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">'d'</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Double</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">float</td></tr></tbody></table></div><p>The array module defines typecodes attribute which returns a string. Each character in the string represents a type code.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-a40oiz53c" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; array.typecodes
'bBuhHiIlLqQfd'</pre></div></div><p dir="ltr">Following statement creates an integer array object:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-l2iqptpg1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import array
&gt;&gt;&gt; arr=array.array('i', range(5))
&gt;&gt;&gt; arr
array('i', [0, 1, 2, 3, 4])
&gt;&gt;&gt; type(arr)
&lt;class 'array.array'&gt;</pre></div></div><p dir="ltr">The initializer may be a byte like object. Following example builds an array from byte representation of string.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-76rs8a274" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; arr=array.array('b', b'Hello')
&gt;&gt;&gt; arr
array('b', [72, 101, 108, 108, 111])</pre></div></div><p>Some of the useful methods of the array class are as follows:</p><p><strong>extend():</strong></p><p>This method appends items from list/tuple to the end of the array. Data type of array and iterable list/tuple must match; if not, TypeError will be raised.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cilb8qvpu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; arr=array.array('i', [0, 1, 2, 3, 4])
&gt;&gt;&gt; arr1=array.array('i',[10,20,30])
&gt;&gt;&gt; arr.extend(arr1)
&gt;&gt;&gt; arr
array('i', [0, 1, 2, 3, 4, 10, 20, 30])</pre></div></div><p><strong>fromfile():</strong></p><p>This method reads data from the file object and appends to an array.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-evkzh9sny" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=array.array('i')
&gt;&gt;&gt; file=open('test.txt','rb')
&gt;&gt;&gt; a.fromfile(file,file.tell())
&gt;&gt;&gt; a
array('i', [1819043144, 2035294319, 1852794996])</pre></div></div><p><strong>tofile():</strong></p><p>This method write all items to the file object which must have write mode enabled.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-39byqm0yd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=array.array('i', [10, 20, 30, 40, 50])
&gt;&gt;&gt; file=open("temp.txt","wb")
&gt;&gt;&gt; a.tofile(file)
&gt;&gt;&gt; file.close()
&gt;&gt;&gt; file=open("temp.txt","rb")
&gt;&gt;&gt; file.read()
b'\n\x00\x00\x00\x14\x00\x00\x00\x1e\x00\x00\x00(\x00\x00\x002\x00\x00\x00'</pre></div></div><p><strong>append():</strong></p><p>This method appends a new item to the end of the array</p><p><strong>fromlist():</strong></p><p>This method appends items from the list to array. This is equivalent to for x in list: a.append(x)</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9wgdvupt7" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=array.array('i')
&gt;&gt;&gt; a.append(10)
&gt;&gt;&gt; a
array('i', [10])
&gt;&gt;&gt; num=[20,30,40,50]
&gt;&gt;&gt; a.fromlist(num)
&gt;&gt;&gt; a
array('i', [10, 20, 30, 40, 50])</pre></div></div><p>insert():</p><p>Insert a new item in the array before specified position</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zy3t61kwk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=array.array('i', [10, 20, 30, 40, 50])
&gt;&gt;&gt; a.insert(2,25)
&gt;&gt;&gt; a
array('i', [10, 20, 25, 30, 40, 50])</pre></div></div><p><strong>pop():</strong></p><p>This method returns item at given index after removing it from the array.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jfqensllq" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=array.array('i', [10, 20, 30, 40, 50])
&gt;&gt;&gt; x=a.pop(2)
&gt;&gt;&gt; x
30
&gt;&gt;&gt; a
array('i', [10, 20, 40, 50])</pre></div></div><p><strong>remove():</strong></p><p>This method removes first occurrence of given item from the array.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-svvokeg7e" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=array.array('i', [10, 20, 30, 40, 50])
&gt;&gt;&gt; a.remove(30)
&gt;&gt;&gt; a
array('i', [10, 20, 40, 50])</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">3. Functions are higher order objects in Python. What does this statement mean?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>In programming language context, a first-class object is an entity that can perform all the operations generally available to other scalar data types such as integer, float or string.</p><p>As they say, everything in Python is an object and this applies to function (or method) as well.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-xdx3euocv" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testfunction():
print ("hello")
&gt;&gt;&gt; type(testfunction)
&lt;class 'function'&gt;
&gt;&gt;&gt; type(len)
&lt;class 'builtin_function_or_method'&gt;</pre></div></div><p>As you can see, a built-in function as well as user defined function is an object of function class.</p><p>Just as you can have built-in data type object as argument to a function, you can also declare a function with one of its arguments being a function itself. Following example illustrates it.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zfw9l33ea" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(x,y):
return x+y
&gt;&gt;&gt; def calladd(add, x,y):
z=add(x,y)
return z
&gt;&gt;&gt; calladd(add,5,6)
11</pre></div></div><p>Return value of a function can itself be another function. In following example, two functions add() and multiply() are defined. Third function addormultiply() returns one of the first two depending on arguments passed to it.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ypojocp0u" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def add(x,y):
return x+y
&gt;&gt;&gt; def multiply(x,y):
return x*y
&gt;&gt;&gt; def addormultiply(x,y,op):
if op=='+':
return add(x,y)
else:
if op=='*':
return multiply(x,y)
&gt;&gt;&gt; addormultiply(5,6,'+')
11
&gt;&gt;&gt; addormultiply(5,6,'*')
30</pre></div></div><p>Thus a function in Python is an object of function class and can be passed to other function as argument or a function can return other function. Hence Python function is a high order object.</p><p>This is one of the most frequently asked Python interview questions for Data Science in recent times. Practice this with other data types as well.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">4. What do you mean by object serialization? Is it the same as data persistence?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python has a built-in file object that represents a disk file. The file API has write() and read() methods to store data in Python objects in computer files and read it back.</p><p>To save data in a computer file, file object is first obtained from built-in open() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-p3gir7je0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; fo=open("file.txt","w")
&gt;&gt;&gt; fo.write("Hello World")
11
&gt;&gt;&gt; fo.close()</pre></div></div><p>Here ‘w’ as mode parameter of open() function indicates that file is opened for writing data. To read back the data from file open it with ‘r’ mode.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-54kdnsvnj" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; fo=open("file.txt","r")
&gt;&gt;&gt; fo.read()
'Hello World'</pre></div></div><p>However, the file object can store or retrieve only string data. For other type of objects, they must be either converted to string or their byte representations and store in binary files opened with ‘wb’ mode.</p><p>This type of manual conversion of objects in string or byte format (and vice versa) is very cumbersome. Answer to this situation is object serialization.</p><p>Object serialization means transforming it in a format that can be stored, so as to be able to deserialize it later, recreating the original object from the serialized format. Serialization may be done disk file, byte string or can be transmitted via network sockets. When serialized data is brought back in a form identical to original, the mechanism is called de-serialization.</p><p>Pythonic term for serialization is pickling while de-serialization is often referred to as unpickling. Python’ library contains pickle module that provides dumps() and loads() functions to serialize and deserialize Python objects.</p><p>Following code shows a dictionary object pickled using dumps() function in pickle module.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0kv2lz1hu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import pickle
&gt;&gt;&gt; data={'No':1, 'name':'Rahul', 'marks':50.00}
&gt;&gt;&gt; pckled=pickle.dumps(data)
&gt;&gt;&gt; pckled
b'\x80\x03}q\x00(X\x02\x00\x00\x00Noq\x01K\x01X\x04\x00\x00\x00nameq\x02X\x05\x00\x00\x00Rahulq\x03X\x05\x00\x00\x00marksq\x04G@I\x00\x00\x00\x00\x00\x00u.'</pre></div></div><p>Original state of object is retrieved from pickled representation using loads() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5hk06ffos" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; data=pickle.loads(pckled)
&gt;&gt;&gt; data
{'No': 1, 'name': 'Rahul', 'marks': 50.0}</pre></div></div><p>The serialized representation of data can be persistently stored in disk file and can be retried back using dump() and load() functions.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8vvgl9pag" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import pickle
&gt;&gt;&gt; data={'No':1, 'name':'Rahul', 'marks':50.00}
&gt;&gt;&gt; fo=open('pickledata.txt','wb')
&gt;&gt;&gt; pickle.dump(data, fo)
&gt;&gt;&gt; fo.close()
&gt;&gt;&gt; #unpickle
&gt;&gt;&gt; fo=open('pickledata.txt','rb')
&gt;&gt;&gt; data=pickle.load(fo)
&gt;&gt;&gt; data
{'No': 1, 'name': 'Rahul', 'marks': 50.0}</pre></div></div><p>Pickle data format is Python-specific in nature. To serialize and deserialize data to/from other standard formats Python library provides json, csv and xml modules.</p><p>As we can see, serialized data can be persistently stored in files. However, file created using write() method of file object does store data persistently but is not in serialized form. Hence we can say that serialized data can be stored persistently, but converse is not necessarily true.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow visible"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">5. Python's standard library has random module and secrets module. Both have functions to generate random number. What's the difference?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>This module implements pseudo-random number generator (PRNG) technique that uses the Mersenne Twister algorithm. It produces 53-bit precision floats and has a period of 2**19937-1. The module functions depend on the basic function random(), which generates a random float uniformly in the range 0.0 to 1.0. &nbsp;</p><p>The Mersenne Twister is one of the most extensively tested random number generators in existence. However, being completely deterministic, it is not suitable for cryptographic purposes.</p><p>Starting from Python 3.6, the secrets module has been added to Python standard library for generating cryptographically strong random numbers (CSPRNG) suitable for managing data such as passwords, account authentication, security tokens, etc.</p><p>It is recommended that, secrets should be used in preference to the default pseudo-random number generator in the random module, which is designed for modelling and simulation, not security or cryptography.</p><p>Here’s how a secure password can be generated using secrets module. Let the password have one character each from group of uppercase characters, lowercase characters, digits and special characters.</p><p>Characters in these groups can be obtained by using following attributes defined in string module.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jph0ddts0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import string
&gt;&gt;&gt; upper=string.ascii_uppercase
&gt;&gt;&gt; lower=string.ascii_lowercase
&gt;&gt;&gt; dig=string.digits
&gt;&gt;&gt; sp=string.punctuation</pre></div></div><p dir="ltr">We now randomly choose one character from each group using choice() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-e5y86ep1q" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=secrets.choice(upper)
&gt;&gt;&gt; a
'E'
&gt;&gt;&gt; b=secrets.choice(lower)
&gt;&gt;&gt; b
'z'
&gt;&gt;&gt; c=secrets.choice(dig)
&gt;&gt;&gt; c
'2'
&gt;&gt;&gt; d=secrets.choice(sp)
&gt;&gt;&gt; d
':'</pre></div></div><p>Finally these four characters are shuffled randomly and joined to produce a cryptographically secure password.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ijfthyofb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; pwd=[a,b,c,d]
&gt;&gt;&gt; secrets.SystemRandom().shuffle(pwd)
&gt;&gt;&gt; ''.join(pwd)
':Ez2'</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">6. What do you understand by SQL injection? What is the prescribed method of executing parameterized queries using DB-API?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>SQL injection is the technique of inserting malicious SQL statements in the user input thereby gaining unauthorized access to database and causing harm in an interactive data driven application.</p><p>Most computer applications including Python applications that involve database interaction use relational database products that work on SQL queries. Python has standardized database adapter specifications by DB-API standard. Python standard distribution has sqlite3 module which is a DB-API compliant SQLite driver. For other databases the module must be installed. For example, if using MySQL, you will have to install PyMySQL module.</p><p>Standard procedure of executing SQL queries is to first establish connection with database server, obtain cursor object and then execute SQL query string. Following describes the sequence of steps for SQLite database</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-uaekpog53" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">con=sqlite3.connect(‘testdata.db’)
cur=con.cursor()
cur.execute(SQLQueryString)</pre></div></div><p>For example, following code displays all records in products table whose category is ‘Electronics’</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-l1rh70neu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">qry=”SELECT * from products where ctg==’Electronics’;”</pre></div></div><p>However, if price is taken as user input then the query string will have to be constructed by inserting user input variable.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-86bf3trms" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">catg=input(‘enter category:’)
qry=”select * from prooducts where ctg={};”.format(catg)</pre></div></div><p>if input is Electronics, the query will be built as select * from products where ctg=’Electronics’But a malicious input such as following is given enter category:electronics;drop table products;Now this will cause the query to be as follows:</p><ul><li class="CertTheme__listItem pt-spacing10">select * from products where ctg=’Electronics’;drop table products;</li><li class="CertTheme__listItem pt-spacing10">Subsequent cur.execute(qry) statemnt will inadvertently delete products table as well!</li><li class="CertTheme__listItem pt-spacing10">To prevent this DB-API recommends use of parameterized queries using ? Placeholder.</li><li class="CertTheme__listItem pt-spacing10">cur.execute(‘select * from products where ctg=?’, (catg))</li><li class="CertTheme__listItem pt-spacing10">In some database adapter modules such as mysql, other placeholder may be used</li><li class="CertTheme__listItem pt-spacing10">cur.execute(‘select * from products where ctg=%s’, (catg))</li></ul><p>In such prepared statements, database engine checks validity of interpolated data and makes sure that undesirable query is not executed, preventing SQL injection attack.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">7. What are important features of dataclasses in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The dataclasses module is one of the most recent modules to be added in Python's standard library. It has been introduced since version 3.7 and defines @dataclass decorator that automatically generates following methods in a user defined class:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0w5ciwklz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">constructor method __init__()
string representation method __repr__()
__eq__() method which overloads == operator</pre></div></div><p>The dataclass function decorator has following prototype:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1v8vqgdk4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">@dataclass(init=True, repr=True, eq=True, order=False, unsafe_hash=False, frozen=False)</pre></div></div><p>All the arguments are of Boolean value. Each decides whether a corresponding magic method will be automatically generated or not.</p><p>The 'init' parameter is True by default which will automatically generate __init__() method for the class.</p><p>Let us define Employee class using dataclass decorator as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hcaou8zi7" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#data_class.py
from dataclasses import dataclass
@dataclass
class Employee(object):
&nbsp; &nbsp; &nbsp;name : str
&nbsp; &nbsp; &nbsp;age : int
&nbsp; &nbsp; &nbsp;salary : float</pre></div></div><p dir="ltr">The auto-generated __init__() method is like:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ch5tzm5px" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def __init__(self, name: str, age: int, salary: float):
&nbsp; &nbsp; &nbsp; &nbsp;self.name = name
&nbsp; &nbsp; &nbsp; &nbsp;self.age = age
&nbsp; &nbsp; &nbsp; &nbsp;self.salary = salary</pre></div></div><p>Auto-generation will not happen if the class contsins explicit definition of __init__() method.</p><p>The repr argument is also true by default. &nbsp;A __repr__() method will be generated. Again the repr string will not be auto-generated if class provides explicit definition.</p><p>The eq argument forces __eq__() method to be generated. This method gets called in response to equals comparison operator (==). Similarly other operator overloading magic methods will be generated if the order argument is true (the default is False), __lt__(), __le__(), __gt__(), and __ge__() methods will be generated, they implement comparison operators &lt; &lt;= &gt; ans &gt;= respectively.</p><p>If unsafe_hash argument is set to False (the default), a __hash__() method is generated according to how eq and frozen are set.</p><p>frozen argument: If true (the default is False), it emulates read-only frozen instances.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cplwzt5uh" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from data_class import Employee
&gt;&gt;&gt; e1=Employee('XYZ', 21, 2150.50)
&gt;&gt;&gt; e2=Employee('xyz', 20, 5000.00)
&gt;&gt;&gt; e1==e2
False</pre></div></div><p>Other useful functions in this module are as follows:</p><p><strong>asdict():</strong></p><p>This function converts class instance into a dictionary object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3lexl9gd4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import dataclasses
&gt;&gt;&gt; dataclasses.asdict(e1)
{'name': 'XYZ', 'age': 21, 'salary': 2150.5}</pre></div></div><p><strong>astuple():</strong></p><p>This function converts class instance into a tuple object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0c2aoo2j0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; dataclasses.astuple(e2)
('xyz', 20, 5000.0)</pre></div></div><p><strong>make_dataclass():</strong></p><p>This function creates a new dataclass from the list of tuples given as fields argument.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-qtisnrnec" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; NewClass=dataclasses.make_dataclass('NewClass', [('x',int),('y',float)])
&gt;&gt;&gt; n=NewClass(10,20)
&gt;&gt;&gt; n
NewClass(x=10, y=20)</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">8. What is the advantage of employing keyword arguments in definition of function? How can we force compulsory usage of keyword arguments in function call?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Function is a reusable block of statements. Whenever called, it performs a certain process on parameters or arguments if passed to it. Following function receives two integers and returns their division</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2lw6s7xyp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def division(x,y):
return x/y
&gt;&gt;&gt; division(10,2)
5.0</pre></div></div><p>While calling the function, arguments must be passed in the same sequence in which they have been defined. Such arguments are called positional arguments. If it is desired to provide arguments in any other order, you must use keyword arguments as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-n9yphemez" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def division(x,y):
return x/y
&gt;&gt;&gt; division(y=2, x=10)
5.0</pre></div></div><p>The formal names of arguments are used as keywords while calling the function. However, using keyword arguments is optional. Question is how to define a function that can be called only by using keywords arguments?</p><p>To force compulsory use of keyword arguments, use '*' as one parameter in parameter list. All parameters after * become keyword only parameters. Any parameters before * continue to be positional parameters.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-osb9iw51k" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def division(*,x,y):
return x/y
&gt;&gt;&gt; division(10,2)
Traceback (most recent call last):
&nbsp;File "&lt;pyshell#7&gt;", line 1, in &lt;module&gt;
&nbsp; &nbsp;division(10,2)
TypeError: division() takes 0 positional arguments but 2 were given
&gt;&gt;&gt; division(y=2, x=10)
5.0
&gt;&gt;&gt; division(x=10, y=2)
5.0</pre></div></div><p>In above example, both arguments are keyword arguments. Hence keyword arguments must be used even if you intend to pass values to arguments in the same order in which they have been defined.</p><p>A function can have mix of positional and keyword arguments. In such case, positional arguments must be defined before ‘*’</p><p>In following example, the function has two positional and two keyword arguments. Positional arguments may be passed using keywords also. However, positional arguments must be passed before keyword arguments.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8ix9veh4o" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def sumdivide(a,b,*,c,d):
return (a+b)/(c-d)
&gt;&gt;&gt; sumdivide(10,20,c=10, d=5)
6.0
&gt;&gt;&gt; sumdivide(c=10, d=5,a=10,b=20)
6.0
&gt;&gt;&gt; sumdivide(c=10, d=5,10,20)
SyntaxError: positional argument follows keyword argument</pre></div></div><p>Expect to come across this, one of the most important Python interview questions for experienced professionals in data science, in your next interviews.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">9. What is the importance of using a virtual environment? Explain how to setup, activate and deactivate virtual environment?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>When you install Python and add Python executable to PATH environment variable of your OS, it is available for use from anywhere in the file system. Thereafter, while building a Python application, you may need Python libraries other than those shipped with the standard distribution (or any other distribution you may be using – such as Anaconda). Those libraries are generally installed using pip installer or conda package manager. These packages are installed in site-packages directory under Python’s installation folder.</p><p>However, sometimes, requirement of a specific version of same package may sometimes be conflicting with other application’s requirements. Suppose you have application A that uses library 1.1 and application B requires 1.2 version of the same package which may have modified or deprecated certain functionality of its older version. Hence a system-wide installation of such package is likely to break application A.</p><p>To avoid this situation, Python provides creation of virtual environment. A virtual environment is a complete but isolated Python environment having its own library, site-packages and executables. This way you can work on dependencies of a certain application so that it doesn’t clash with other or system wide environment.</p><p>For standard distribution of Python, virtual environment is set up using following command:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nzdkupgnn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">c:\Python37&gt;python -m venv myenv</pre></div></div><p>Here myenv is the name of directory/folder (along with its path. If none, it will be created under current directory) in which you want this virtual environment be set up. Under this directory, include, lib and scripts folders will be created. Local copy of Python executable along with other utilities such as pip are present in scripts folder. Script older also has activate and deactivate batch files.</p><p>To activate newly created environment, run activate.bat in Scripts folder.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-m0dhg0end" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">C:\myenv&gt;scripts\activate
(myenv)c:\python37&gt;</pre></div></div><p>Name of the virtual environment appears before command prompt. Now you can invoke Python interpreter which create will local copy in the new environment and not system wide Python.</p><p>To deactivate the environment, simply run deactivate.bat</p><p>If using Anaconda distribution, you need to use conda install command.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jon5e44hm" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">conda create --name myenv</pre></div></div><p>This will create new environment under Anaconda installation folder’s envs directory.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">10. Built-in exec() function is provided for dynamic execution of Python code. Explain its usage.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python’s built-in function library contains exec() function that is useful when it comes to dynamic execution of Python code. The prototype syntax of the function is as follows:</p><p>exec(object, globals, locals)</p><p>The object parameter can be a string or code object. The globals and locals parameters are optional. If only globals is provided, it must be a dictionary, which will be used for both the global and the local variables. If both are given, they are used for the global and local variables, respectively. The locals can be any mapping object.</p><p>In first example of usage of exec(), we have a string that contains a Python script.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wsg4w5t7g" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; string='''
x=int(input('enter a number'))
y=int(input('enter another number'))
print ('sum=',x+y)
'''
&gt;&gt;&gt; exec(string)
enter a number2
enter another number4
sum= 6</pre></div></div><p>Secondly, we have a Python script saved as example.py</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-c7rc8zehg" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#example.py
x=int(input('enter a number'))
y=int(input('enter another number'))
print ('sum=',x+y)</pre></div></div><p>The script file is read using built-in open() function as a string and then exec() function executes the code</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-k8po0n9j1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; exec(open('example.py').read())
enter a number1
enter another number2
sum= 3</pre></div></div><p>As a third example, the string containing Python code is first compiled to code object using compile() function</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-584psk5x9" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; string='''
x=int(input('enter a number'))
y=int(input('enter another number'))
print ('sum=',x+y)
'''
&gt;&gt;&gt; obj=compile(string,'example', 'exec')
&gt;&gt;&gt; exec(obj)
enter a number1
enter another number2
sum= 3</pre></div></div><p>Thus we can see how exec() function is useful for dynamic execution of Python code.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">11. What is 'shebang' in a Python script? Is it possible to make a Python script self-executable?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python is an interpreter based language. Hence, a Python program is run by executing one statement at a time. Object version of the entire script is not created as in C or C++. As a result, Python interpreter must be available on the machine on which you intend to run Python program. On a Windows machine, a program is executed by following the command line:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wtzztd0gk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">C:\users&gt;python example.py</pre></div></div><p>The Python executable must be available in the system’s path.</p><p>Although the same command line can be used for running a program on Linux, there is one more option. On Linux, the Python script can be given execute permission by invoking chmod. However, for that to work, the first line in the script must specify the path to Python executable. This line, though it appears as a comment, is called shebang.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-f5o05b91x" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#!/usr/bin/python
def add(x,y):
&nbsp; &nbsp;return x+y
x=10
y=20
print ('addition=',add(x,y))</pre></div></div><p>The first line in above script is the shebang line and mentions the path to the Python executable. This script is now made executable by chmod command:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-dhhf4b7tk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ chmod +x example.py</pre></div></div><p>The Python script now becomes executable and doesn’t need executable’s name for running it.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-3k425wmql" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ ./example.py</pre></div></div><p>However, the system still needs Python installed. So in that sense this is not self-executable. For this purpose, you can use one of the following utilities:</p><p>py2exe</p><p>cx-freeze</p><p>py2app</p><p>pyinstaller</p><p>The pyinstaller is very easy to use. First install pyinstaller with the help of pip</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ylqxoly47" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ pip install pyinstaller</pre></div></div><p>Then run the following command from within the directory in which your Python script is present:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9dmvv8ddn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">~/Desktop/example$ pyinstaller example.py</pre></div></div><p>In the same directory (here <em>Desktop/</em>example) a <em>dist</em> folder will be created. Inside dist, there is another directory with name of script (in this case <em>example</em>) in which the executable will be present. It can now be executed even if the target system doesn’t have Python installed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4em5l4rua" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">~/Desktop/example/dist/example$ ./example</pre></div></div><p>This is how a self-executable Python application is bundled and distributed. The dist folder will contain all modules in the form of libraries.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">12. What are some alternative implementations of Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Instructions written in C/C++ are translated directly in a hardware specific machine code. On the other hand, Java/Python instructions are first converted in a hardware independent bytecode and then in turn the virtual machine which is specific to the hardware/operating system converts them in corresponding machine instructions.</p><p>The official distribution of Python hosted by <a href="https://www.python.org/" rel="nofollow" target="_blank">https://www.python.org/</a> is called Cpython. The Python interpreter (virtual machine) software is written in C. We can call it as a C implementation of Python.</p><p>There are many alternatives to this official implementation. They are explained as below:</p><ul><li class="CertTheme__listItem pt-spacing10">Jython: Jython is a JRE implementation of Python. It is written in Java. It is designed to run on Java platform. Just as a regular Python module/package, a Jython program can import and use any Java class. Jython program also compiles to bytecode. One of the main advantages is that a user interface designed in Python can use GUI elements of AWT, swing or SWT package.</li><li class="CertTheme__listItem pt-spacing10">Jython follows closely the standard Python implementation. Jython was created in 1997 by Jim Hugunin. Jython 2.0 was released in 1999. Current Jython 2.7.0 released in May 2015, corresponds to CPython 2.7. Development of Jython 3.x is under progress. It can be downloaded from https://www.jython.org/downloads.html</li><li class="CertTheme__listItem pt-spacing10">IronPython: IronPython is a .NET implementation of Python. It is completely written in C#. Power of .NET framework can be easily harnessed by Python programs. Python’s rapid development tools are also easily embeddable in .NET applications. Similar to JVM, IronPython runs on Microsoft’s Common Language Runtime (CLR)</li><li class="CertTheme__listItem pt-spacing10">IronPython’s current release, version 2.7.9 can be downloaded from <a href="https://ironpython.net/download/" rel="nofollow" target="_blank">https://ironpython.net/download/</a></li><li class="CertTheme__listItem pt-spacing10">PyPy: PyPy is a fast, compliant alternative implementation of the Python language. It uses Just-in-Time compiler, because of which Python programs often run faster on PyPy. PyPy programs also consume less space than they do in CPython. PyPy is highly compatible with existing Python code. &nbsp;PyPy comes by default with support for stackless mode, providing micro-threads for massive concurrency.</li><li class="CertTheme__listItem pt-spacing10">Both CPython 2.x and 3.x compatible versions of PyPy are available for download on <a href="https://www.pypy.org/download.php" rel="nofollow" target="_blank">https://www.pypy.org/download.html</a></li></ul><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">13. What is a partial object in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Although Python is predominantly an object oriented programming language, it does have important functional programming capabilities included in functools module.</p><p>One such function from the functools module is partial() function which returns a partial object. The object itself behaves like a function. The partial() function receives another function as argument and freezes some portion of a function’s arguments resulting in a new object with a simplified signature.</p><p>Let us consider the signature of built-in int() function which is as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mlv71sb5w" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">int(x, base=10) </pre></div></div><p>This function converts a number or string to an integer, or returns 0 if no arguments are given. &nbsp;If x is a number, returns x.__int__(). For floating point numbers, this truncates towards zero. If x is not a number or if base is given, then x must be a string.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-knomwef2f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; int(20)
20
&gt;&gt;&gt; int('20', base=8)
16</pre></div></div><p>We now use partial() function to create a callable that behaves like the int() function where the base argument defaults to 8.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9p41eefp9" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from functools import partial
&gt;&gt;&gt; partial_octal=partial(int,base=8)
&gt;&gt;&gt; partial_octal('20')
16</pre></div></div><p>In the following example, a user defined function power() is used as argument to a partial function square() by setting a default value on one of the arguments of the original function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-n5btl7nso" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def power(x,y):
return x**y
&gt;&gt;&gt; power(x=10,y=3)
1000
&gt;&gt;&gt; square=partial(power, y=2)
&gt;&gt;&gt; square(10)
100</pre></div></div><p>The functools module also defines partialmethod() function that returns a new partialmethod descriptor which behaves like partial except that it is designed to be used as a method definition rather than being directly callable.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">14. What is the purpose of getpass module in standard library?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>We normally come across login page of web application where a secret input such as a password or PIN is entered in a text field that masks the actual keys. How do we accept user input in a console based program? This is where the getpass module proves useful.</p><p>The getpass module provides a portable way to handle such password inputs securely so that the program can interact with the user via the terminal without showing what the user types on the screen.</p><p>The module has the getpass() function which prompt the user for a password without echoing. The user is prompted using the string prompt, which defaults to 'Password: '.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-24eyaa2yi" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import getpass
pwd=getpass.getpass()
print ('you entered :', pwd)</pre></div></div><p>Run above script as example.py from command line:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-6zvvib4tp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python example.py
Password:
you entered: test</pre></div></div><p>You can change the default prompt by explicitly defining it as argument to getpass() function</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-qv5274yzn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">pwd=getpass.getpass(prompt='enter your password: ')
$ python example.py
enter your password:
you entered test</pre></div></div><p>The getpass() function can also receive optional stream argument to redirect the prompt to a file like object such as sys.stderr – the default value of stream is sys.stdout.</p><p>There is also a getuser() function in this module. It returns the “login name” of the user by checking the environment variables LOGNAME, USER, LNAME and USERNAME.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">15. Python scripts are saved with .py extension. However, .pyc files are frequently found. What do they stand for?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>The mechanism of execution of a Python program is similar to Java. A Python script is first compiled to a bytecode which in turn is executed by a platform specific Python virtual machine i.e. Python interpreter. However, unlike Java, bytecode version is not stored as a disk file. It is held temporarily in the RAM itself and discarded after execution.</p><p>However, things are different when a script imports one or more modules. The imported modules are compiled to bytecode in the form of .pyc file and stored in a directory named as __pycache__.</p><p>Following Python script imports another script as module.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-f40bdeu6h" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#hello.py
def hello():
&nbsp; &nbsp;print ("Hello World")
#example.py
import hello
hello.hello()</pre></div></div><p>Run example.py from command line</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-30xylhwnx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">Python example.py</pre></div></div><p>You will find a __pycache__ folder created in current working directory with hello.cpython-36.pyc file created in it.</p><p>The advantage of this compiled file is that whenever hello module is imported, it need not be converted to bytecode again as long as it is not modified.</p><p>As mentioned above, when executed, .pyc file of the .py script is not created. If you want it to be explicitly created, you can use py_compile and compileall modules available in standard library.</p><p>To compile a specific script</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-5o8ot9se2" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import py_compile
py_compile.compile(‘example.py’, ‘example.pyc’)</pre></div></div><p>This module can be directly used from command line</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-22c8ayw7v" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">python -m py_compile example.py</pre></div></div><p>To compile all files in a directory</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-tj9jso4xq" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import compileall
compileall.compile_dir(‘newdir’)</pre></div></div><p>Following command line usage of compileall module is also allowed:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cs0dwyvps" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">python -m compileall newdir</pre></div></div><p>Where newdir is a folder under current working directory.</p><p>Don't be surprised if this question pops up as one of the top Python interview questions and answers in your next interview. It has all the elements of a standard interview question.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">16. What is garbage collection? How does it work in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Garbage collection is the mechanism of freeing up a computer’s memory by identifying and disposing of those objects that are no longer in use. C and C++ language compilers don’t have the capability of automatically disposing memory contents. That’s why disposal of memory resources has to be manually performed. Runtime environments of Java and Python have automatic garbage collection feature hence they provide efficient memory management.</p><p>Garbage collection is achieved by using different strategies. Java uses a tracing strategy wherein it determines which objects should be added to the garbage, by tracing the objects that are reachable by a chain of references from certain root objects. Those that are not reachable are considered as garbage and collecting them.</p><p>Python on the other hand uses a reference counting strategy. In this case, Python keeps count of the number of references to an object. The count is incremented when a reference to it is created, and decremented when a reference is destroyed. Garbage is identified by having a reference count of zero. When the count reaches zero, the object's memory is reclaimed.</p><p>For example 0 is stored as int object and is assigned to variable a, thereby incrementing its reference count to 1. However, when a is assigned to another object, the reference count of 10 becomes 0 and is eligible for garbage collection.</p><p>Python’s garbage collector works periodically. To identify and collect garbage manually, we have gc module in Python’s library. &nbsp;You can also set the collection threshold value. Here, the default threshold is 700. This means when the number of allocations vs. the number of deallocations is greater than 700, the automatic garbage collector will run.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7hcg241oc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import gc
&gt;&gt;&gt; gc.get_threshold()
(700, 10, 10)</pre></div></div><p>The collect() function identifies and collects all objects that are eligible.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">17. What is "monkey patching"? How is it performed in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The term Monkey patching is used to describe a technique used to dynamically modify the behavior of a piece of code at run-time. This technique allows us to modify or extend the behavior of libraries, modules, classes or methods at runtime without actually modifying the source code.</p><p>Monkey patching technique is useful in the following scenarios:</p><ol class="CertTheme__ol1 pt-spacing10"><li class="CertTheme__listItem pt-spacing10">When we want to extend or modify the behavior of third-party or built-in libraries or methods at runtime without actually modifying the original code.</li></ol><ol class="CertTheme__ol1 pt-spacing10"><li class="CertTheme__listItem pt-spacing10">It is often found to be convenient when writing unit tests.</li></ol><p>In Python, classes are just like any other mutable objects. Hence we can modify them or their attributes including functions or methods at runtime.</p><p>In the following demonstration of monkey patching, let us first write a simple class with a method that adds two operands.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-27mjv89bs" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#monkeytest.py
class MonkeyTest:
&nbsp; &nbsp;def add(self, x,y):
&nbsp; &nbsp; &nbsp; &nbsp;return x+y</pre></div></div><p>We can call add() method straightaway</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9oavmdvqr" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">from monkeytest import MonkeyTest
a=MonkeyTest()
print (a.add(1,2))</pre></div></div><p>However, we now need to modify add() method in the above class to accept a variable number of arguments. What do we do? First define a newadd() function that can accept variable arguments and perform addition.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-fnczpipk9" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def newadd(s,*args):
&nbsp; &nbsp;s=0
&nbsp; &nbsp;for a in args:s=s+int(a)
&nbsp; &nbsp;return s</pre></div></div><p>Now assign this function to the add() method of our MonkeyTest class. The modified behaviour of add() method is now available for all instances of your class.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ic9anfkjd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">MonkeyTest.add=newadd
a=MonkeyTest()
print (a.add(1,2,3))</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">18. Explain how and when Python's built-in property() function should be used?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Python doesn’t implement data encapsulation principle of object oriented programming methodology in the sense that there are no access restrictions like private, public or protected members. Hence a traditional method (as used in Java) of accessing instance variables using getter and setter methods is of no avail in Python.</p><p>Python recommends use of property object to provide easy interface to instance attributes of a class. The built-in property() function uses getter , setter and deleter methods to return a property attribute corresponding to a specific instance variable.</p><p>Let us first write a Student class with name as instance attributes. We shall provide getname() and setname() methods in the class as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-me10hegn9" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class User:
&nbsp; &nbsp;def __init__(self, name='Test'):
&nbsp; &nbsp; &nbsp; &nbsp;self.__name=name
&nbsp; &nbsp;def getname(self):
&nbsp; &nbsp; &nbsp; &nbsp;return self.__name
&nbsp; &nbsp;def setname(self,name):
&nbsp; &nbsp; &nbsp; &nbsp;self.__name=name</pre></div></div><p>We can declare its object and access its name attribute using the above methods.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-lyuahvg56" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from example import User
&gt;&gt;&gt; a=User()
&gt;&gt;&gt; a.getname()
'Test'
&gt;&gt;&gt; a.setname('Ravi')</pre></div></div><p>Rather than calling setter and getter function explicitly, the property object calls them whenever the instance variable underlying it is either retrieved or set. The property() function uses the getter and setter methods to return the property object.</p><p>Let us add name as property object in the above User class by modifying it as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-pl75a9bz8" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class User:
&nbsp; &nbsp;def __init__(self, name='Test'):
&nbsp; &nbsp; &nbsp; &nbsp;self.__name=name
&nbsp; &nbsp;def getname(self):
&nbsp; &nbsp; &nbsp; &nbsp;print ('getname() called')
&nbsp; &nbsp; &nbsp; &nbsp;return self.__name
&nbsp; &nbsp;def setname(self,name):
&nbsp; &nbsp; &nbsp; &nbsp;print ('setname() called')
&nbsp; &nbsp; &nbsp; &nbsp;self.__name=name
&nbsp; &nbsp;name=property(getname, setname)</pre></div></div><p>The name property, returned by property() function hides private instance variable __name. &nbsp;You can use property object directly. Whenever, its value is retrieved, it is internally called getname() method. On the other hand when a value is assigned to name property, internally setname() method is called.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jwwu9c5ow" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from example import User
&gt;&gt;&gt; a=User()
&gt;&gt;&gt; a.name
getname() called
'Test'
&gt;&gt;&gt; a.name='Ravi'
setname() called</pre></div></div><p>The property() function also can have deleter method. A docstring can also be specified in its definition.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-slph553s1" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">property(getter, setter, deleter, docstring)</pre></div></div><p>Python also has @property decorator that encapsulates property() function.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">19. Are there any alternatives to standard input/output functions of Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python’s built-in function library provides input() and print() functions. They are default functions for console IO. The input() function receives data received from standard input stream i.e. keyboard and print() function sends data to standard output stream directed to standard output device i.e. display monitor device.</p><p>In addition to these, we can make use of standard input and output stream objects defined in sys module. The sys.stdin object is a file like object capable of reading data from a console device. It in fact is an object of TextIOWrapper class capable of reading data. Just as built-in File object, read() and readline() methods are defined in TextIOWrapper.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-y7ni30pew" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import sys
&gt;&gt;&gt; a=sys.stdin
&gt;&gt;&gt; type(a)
&lt;class '_io.TextIOWrapper'&gt;
&gt;&gt;&gt; data=a.readline()
Hello Python
&gt;&gt;&gt; data
'Hello Python\n'</pre></div></div><p>Note that unlike input() function, the trailing newline character (\n) is not stripped here.</p><p>On the other hand sys.stdout object is also an object of TextIOWrapper class that is configured to write data in standard output stream and has write() and writelines() methods.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nap5o857n" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; b.write(data)
Hello Python
13</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">20. What is the difference between built-in functions eval() and exec()?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>The eval() function evaluates a single expression embedded in a string. The exec() function on the other hand runs the script embedded in a string. There may be more than one Python statement in the string.</p><p>Simple example of eval():</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-q92smqczf" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=5
&gt;&gt;&gt; sqr=eval('x**2')
&gt;&gt;&gt; sqr
25</pre></div></div><p>Simple example of exec()</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mbaehp33f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; code='''
x=int(input('enter a number'))
sqr=x**2
print (sqr)
'''
&gt;&gt;&gt; exec(code)
enter a number5
25</pre></div></div><p>eval() always returns the result of evaluation of expression or raises an error if the expression is incorrect. There is no return value of exec() function as it just runs the script.</p><p>Use of eval() may pose a security risk especially if user input is accepted through string expression, as &nbsp;any harmful code may be input by the user.</p><p>Both eval() and exec() functions can perform operations on a code object returned by another built-in function compile(). Depending on mode parameter to this function, the code object is prepared for evaluation or execution.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">21. Explain how built-in compile() function works</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>According to Python’s standard documentation, compile() function returns code object from a string containing valid Python statements, a byte string or AST object.</p><p>A code object represents byte-compiled executable version of Python code or simply a bytecode. AST stands for Abstract syntax tree. The AST object is obtained by parsing a string containing Python code.</p><p>Syntax of compile() function looks as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-jjfq64pth" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">compile(source, filename, mode, flags=0, dont_inherit=False, optimize=-1)</pre></div></div><p>The source parameter can be a string, bytestring or AST object. Filename parameter is required if you are reading code from a file. The code object can be executed by exec() or eval() functions which is mode parameter. Other parameters are optional.</p><p>Thee following example compiles given string to a code object for it to be executed using exec() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-i1isjgfz4" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; string='''
x=10
y=20
z=x+y
print (z)
'''
&gt;&gt;&gt; obj=compile(string,'addition', 'exec')
&gt;&gt;&gt; exec(obj)
30</pre></div></div><p>The following example uses eval as mode parameter in compile() function. Resulting code object is executed using eval() function.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-tbcqet6w8" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; obj=compile('x**2', 'square','eval')
&gt;&gt;&gt; val=eval(obj)
&gt;&gt;&gt; val
100</pre></div></div><p>The AST object is first obtained by parse() function which is defined in ast module. It in turn is used to compile a code object.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8dphp6esm" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import ast
&gt;&gt;&gt; astobj=parse(string)
&gt;&gt;&gt; astobj=ast.parse(string)
&gt;&gt;&gt; obj=compile(astobj,'addition', 'exec')
&gt;&gt;&gt; exec(obj)
30</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">22. What does pprint() function do? Is it the same as print() function?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Whereas print() is a built-in function that displays value of one or more arguments on the output console, pprint() function is defined in the pprint built-in module. The name stands for pretty print. The pprint() function produces an aesthetically good looking output of Python data structures. Any data structure that is properly parsed by the Python interpreter is elegantly formatted. It tries to keep the formatted expression in one line as far as possible, but generates into multiple lines if the length exceeds the width parameter of formatting.&nbsp;</p><p>In order to use it, first it must be imported from pprint module.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-dhidmi79c" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">from pprint import pprint</pre></div></div><p>One of the unique features of pprint output is that it automatically sorts dictionaries before the display representation is formatted.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hyt7hfgss" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from pprint import pprint
&gt;&gt;&gt; ctg={'Electronics':['TV', 'Washing machine', 'Mixer'], 'computer':{'Mouse':200, 'Keyboard':150,'Router':1200},'stationery':('Book','pen', 'notebook')}
&gt;&gt;&gt; pprint(ctg)
{'Electronics': ['TV', 'Washing machine', 'Mixer'],
&nbsp;'computer': {'Keyboard': 150, 'Mouse': 200, 'Router': 1200},
&nbsp;'stationery': ('Book', 'pen', 'notebook')}</pre></div></div><p>The pprint module also has definition of PrettyPrinter class, and pprint() method belongs to it.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-qh81vjpfw" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from pprint import PrettyPrinter
&gt;&gt;&gt; pp=PrettyPrinter()
&gt;&gt;&gt; pp.pprint(ctg)
{'Electronics': ['TV', 'Washing machine', 'Mixer'],
&nbsp;'computer': {'Keyboard': 150, 'Mouse': 200, 'Router': 1200},
&nbsp;'stationery': ('Book', 'pen', 'notebook')}</pre></div></div><p>One of the most frequently posed Python technical interview questions, be ready for this conceptual question.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">23. What is the difference between CGI and WSGI?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>CGI, which stands for Common Gateway Interface, is a set of standards for the HTTP server to render the output of executable scripts. CGI is one of the earliest technologies to be used for rendering dynamic content to the client of a web application. All major http web server software, such as Apache, IIS etc are CGI aware. With proper configuration, executable scripts written C/C++, PHP, Python, Perl etc can be executed on the server and the output is dynamically rendered in the HTML form to the client’s browser.</p><p>One important disadvantage of CGI is that the server starts a new process for every request that it receives from its clients. As a result, the server is likely to face severe bottlenecks and is slow.</p><p>WSGI (Web Server Gateway Interface) on the other hand prescribes a set of standards for communication between web servers and web applications written in Python based web application frameworks such as Django, Flask etc. WSGI specifications are defined in PEP 3333 (Python enhanced Proposal)</p><p>WSGI enabled servers are designed to handle multiple requests concurrently. Hence a web application hosted on a WSGI server is faster.</p><p>There are many self-contained WSGI containers available such as Gunicorn and Gevent. You can also configure any Apache server for WSGI by installing and configuring mod_wsgi module. Many shared hosting services are also available for deploying Python web applications built with Django, Flask or other web frameworks. Examples are Heroku, Google App Engine, PythonAnywhere etc.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">24. What is FieldStorage class in Python? Explain its usage.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>FieldStorage class is defined in cgi module of Python’s standard library.&nbsp;</p><p>A http server can be configured to run executable scripts and programs stored in the cgi-bin directory on the server and render response in HTML form towards client. For example a Python script can be executed from cgi-bin directory.</p><p>However, the input to such a script may come from the client in the form of HTTP request either via its GET method or POST method.</p><p>In following HTML script, a form with two text input elements are defined. User data is sent as a HTTP request to a script mentioned as parameter of ‘action’ attribute with GET method.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-i99b6ocdd" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&lt;form action = "/cgi-bin/test.py" method = "get"&gt;
Name: &lt;input type = "text" name = "name"&gt; &nbsp;&lt;br /&gt;
address: &lt;input type = "text" name = "addr" /&gt;
&lt;input type = "submit" value = "Submit" /&gt;
&lt;/form&gt;</pre></div></div><p>In order to process the user input, Python’s CGI script makes use of FieldStorage object. This object is actually a dictionary object with HTML form elements as key and user data as value.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-y0pkjxexf" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">#!/usr/bin/python
# Import CGI module&nbsp;
import cgi
# Create instance of FieldStorage&nbsp;
fso = cgi.FieldStorage()</pre></div></div><p>The fso object now contains form data which can be retrieved using usual dictionary notation.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-7ntl8c84z" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">nm = fso[‘name’]
add=fso[‘addr’]</pre></div></div><p>FieldStorage class also defines the following methods:</p><ul><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>getvalue():</strong>&nbsp;</span><em>This method retrieves value associated with form element.</em>&nbsp;</li><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>getfirst(): </strong></span><em>This method returns only one value associated with form field name. The method returns only the first value in case more values were given under such name.</em></li><li class="CertTheme__listItem pt-spacing10"><span style="color:rgb(0, 0, 0)"><strong>getlist():</strong></span><em>This method always returns a list of values associated with form field name.</em> </li></ul><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">25. What is the difference between bytes() and bytearray() in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Both are built-in functions in standard library. Both functions return sequence objects. However, bytes() returns an immutable sequence, whereas bytearray is a mutable sequence.</p><p>The bytes() function returns a bytes object that is an immutable sequence of integers between 0 to 255.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-wvf32n4rp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; #if argument is an int, creates an array of given size, initialized to null
&gt;&gt;&gt; x=10
&gt;&gt;&gt; y=bytes(x)
&gt;&gt;&gt; y
b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00'
&gt;&gt;&gt; type(y)
&lt;class 'bytes'&gt;</pre></div></div><p>If string object is used with bytes() function, you should use encoding parameter, default is ‘utf-8’</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-chndrrjkp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt; string='Hello'
&gt;&gt;&gt; x='Hello'
&gt;&gt;&gt; y=bytes(x,'utf-8')
&gt;&gt;&gt; y
b'Hello'</pre></div></div><p>Note that the bytes object has a literal representation too. Just prefix the string by b</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zlrv2c3cv" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=b'Hello'
&gt;&gt;&gt; type(x)
&lt;class 'bytes'&gt;</pre></div></div><p>On the other hand bytearray() returns a mutable sequence. If argument is an int, it initializes the array of given size with null.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-hjqasdf33" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; y=bytearray(x)
&gt;&gt;&gt; y
bytearray(b'\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00')
&gt;&gt;&gt; type(y)
&lt;class 'bytearray'&gt;</pre></div></div><p>However, if the argument is an iterable sequence, array size is equal to iterable count and items are initialized by elements of iterable. Following example shows bytearray object obtained from a list.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4179d9cu3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=[2,4,6]
&gt;&gt;&gt; y=bytearray(x)
&gt;&gt;&gt; y
bytearray(b'\x02\x04\x06')</pre></div></div><p>Unlike bytes object, a bytearray object doesn’t have literal representation.</p><p>Both bytes and bytearray objects support all normal sequence operations like find and replace, join and count etc.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0mkanrr2e" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=b'Hello'
&gt;&gt;&gt; x.replace(b'l', b'k')
b'Hekko'</pre></div></div><p>Both objects also support logical functions such as isalpha(), isalphanum(), isupper(), islower() etc.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-bll31zis0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=b'Hello'
&gt;&gt;&gt; x.isupper()
False</pre></div></div><p>Case conversion functions are also allowed.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1rkg6u66k" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=b'Hello'
&gt;&gt;&gt; x.upper()
b'HELLO'</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">26. What are abstract base classes in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>A class having one or more abstract methods is an abstract class. A method on the other hand is called abstract if it has a dummy declaration and carries no definition. Such a class cannot be instantiated and can only be used as a base class to construct a subclass. However, the subclass must implement the abstract methods to be a concrete class.</p><p>Abstract base classes (ABCs) introduce virtual subclasses. They don’t inherit from any class but are still recognized by isinstance() and issubclass() built-in functions.</p><p>For example, numbers module in standard library contains abstract base classes for all number data types. The int, float or complex class will show numbers. Number class is its super class although it doesn’t appear in the __bases__ attribute.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-r74l55e5z" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=10
&gt;&gt;&gt; type(a)
&lt;class 'int'&gt;
&gt;&gt;&gt; int.__bases__
(&lt;class 'object'&gt;,)
#However, issubclass() function returns true for numbers.Number
&gt;&gt;&gt; issubclass(int, numbers.Number)
True
#also isinstance() also returns true for numbers.Number
&gt;&gt;&gt; isinstance(a, numbers.Number)
True</pre></div></div><p>The collections.abc module defines ABCs for Data structures like Iterator, Generator, Set, mapping etc.</p><p>The abc module has ABCMeta class which is a metaclass for defining custom abstract base class. In the following example Shape class is an abstract base class using ABCMeta. The shape class has area() method decorated by @abstractmethod decorator.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-6w0tjfg79" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">import abc
class Shape(metaclass=abc.ABCMeta):
&nbsp; &nbsp; &nbsp; &nbsp; @abc.abstractmethod
&nbsp; &nbsp; &nbsp; &nbsp; def area(self):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; pass</pre></div></div><p>We now create a rectangle class derived from shape class and make it concrete by providing implementation of abstract method area()</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8oh5wyr1y" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class Rectangle(Shape):
&nbsp; &nbsp; &nbsp; &nbsp; def __init__(self, x,y):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.l=x
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; self.b=y
&nbsp; &nbsp; &nbsp; &nbsp; def area(self):
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return self.l*self.b
r=Rectangle(10,20)
print ('area: ',r.area())</pre></div></div><p>If the abstract base class has more than one abstract method, the child class must implement all of them otherwise TypeError will be raised.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">27. What are hashing algorithms? How can we obtain md5 hash value of a string in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Hashing algorithm is a technique of obtaining an encrypted version from a string using a certain mathematical function. Hashing ensures that the message is securely transmitted if it is intended for a particular recipient only.</p><p>Several hashing algorithms are currently in use. Secure hash algorithms SHA1, SHA224, SHA256, SHA384, and SHA512 are defined by Federal Information Processing Standard (FIPS).&nbsp;</p><p>RSA algorithm defines md5 algorithm.</p><p>The hashlib module in standard library provides a common interface to many different secure hash and message digest algorithms.&nbsp;</p><p>hashlib.new(name,[data]) function in the module is a generic constructor that takes the string name of the desired algorithm as its first parameter.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-o7d8turpc" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import hashlib
&gt;&gt;&gt; hash=hashlib.new('md5',b'hello')
&gt;&gt;&gt; hash.hexdigest()
'5d41402abc4b2a76b9719d911017c592'</pre></div></div><p>The hexdigest() function returns a hashed version of string in hexadecimal symbols.</p><p>Instead of using new() as generic constructor, we can use a named constructor corresponding to hash algorithm. For example for md5 hash,</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4o7itaort" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; hash=hashlib.md5(b'hello')
&gt;&gt;&gt; hash.hexdigest()
'5d41402abc4b2a76b9719d911017c592'</pre></div></div><p>The hashlib module also defines algorithms_guaranteed and algorithms_available attributes.</p><p>The algorithms_guaranteed returns a set containing the names of the hash algorithms guaranteed to be supported by this module on all platforms.&nbsp;</p><p>algorithms_available is a set containing the names of the hash algorithms that are available in the running Python interpreter.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-6ujv51aj3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; hashlib.algorithms_guaranteed
{'sha3_512', 'md5', 'sha3_256', 'sha224', 'sha384', 'sha3_224', 'sha256', 'shake_128', 'blake2b', 'sha1', 'sha3_384', 'blake2s', 'shake_256', 'sha512'}
&gt;&gt;&gt; hashlib.algorithms_available
{'mdc2', 'SHA512', 'SHA384', 'dsaWithSHA', 'md4', 'shake_256', 'SHA224', 'sha512', 'DSA', 'RIPEMD160', 'md5', 'sha224', 'sha384', 'sha3_224', 'MD5', 'ripemd160', 'whirlpool', 'MDC2', 'sha', 'blake2b', 'SHA', 'sha1', 'DSA-SHA', 'sha3_512', 'sha3_256', 'sha256', 'SHA1', 'sha3_384', 'ecdsa-with-SHA1', 'shake_128', 'MD4', 'SHA256', 'dsaEncryption', 'blake2s'}</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">28. Give a brief comparison of vars() and dir() built-in functions in Python's standard library.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>The vars() function can be operated upon those objects which have __dict__ attribute. It returns the __dict__ attribute for a module, class, instance, or any other object having a __dict__ attribute. If the object doesn’t have the attribute, it raises a TypeError exception.&nbsp;</p><p>The dir() function returns list of the attributes of any Python object. If no parameters are passed it returns a list of names in the current local scope. &nbsp;For a class , it returns a list of its attributes as well as those of the base classes recursively. For a module, a list of names of all the attributes, contained is returned.</p><p>When you access an object's attribute using the dot operator, python does a lot more than just looking up the attribute in that objects dictionary.</p><p>Let us take a look at the following class:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-xh3aps866" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class myclass:
&nbsp; &nbsp; def __init__(self):
&nbsp; &nbsp; &nbsp; &nbsp; self.x=10
&nbsp; &nbsp; def disp(self):
&nbsp; &nbsp; &nbsp; &nbsp; print (self.x)</pre></div></div><p>The vars() of above class is similar to its __dict__ &nbsp;value</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0bi96xzk2" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; vars(myclass)
mappingproxy({'__module__': '__main__', '__init__': &lt;function myclass.__init__ at 0x7f770e520950&gt;, 'disp': &lt;function myclass.disp at 0x7f770e5208c8&gt;, '__dict__': &lt;attribute '__dict__' of 'myclass' objects&gt;, '__weakref__': &lt;attribute '__weakref__' of 'myclass' objects&gt;, '__doc__': None})
&gt;&gt;&gt; myclass.__dict__
mappingproxy({'__module__': '__main__', '__init__': &lt;function myclass.__init__ at 0x7f770e520950&gt;, 'disp': &lt;function myclass.disp at 0x7f770e5208c8&gt;, '__dict__': &lt;attribute '__dict__' of 'myclass' objects&gt;, '__weakref__': &lt;attribute '__weakref__' of 'myclass' objects&gt;, '__doc__': None})</pre></div></div><p>However, vars() of its object just shows instance attributes</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ehj4n9917" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=myclass()
&gt;&gt;&gt; vars(a)
{'x': 10}
&gt;&gt;&gt; x.__dict__
{'x': 10}</pre></div></div><p>The dir() function returns the attributes and methods of myclass as well as object class, the base class of all Python classes.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-sj2btrk5r" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; dir(myclass)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'disp']</pre></div></div><p>Whereas dir(a), the object of myclass returns instance variables of the object, methods of its class and object base class</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-s83oy0x16" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; a=myclass()
&gt;&gt;&gt; dir(a)
['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__module__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', '__weakref__', 'disp', 'x']</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">29. Python script written using Python 2.x syntax is not compatible with Python 3.x interpreter. How can one automatically port Python 2.x code to Python 3.x?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python 3 was introduced in 2008. It was meant to be backward incompatible although some features have later been backported to Python 2.7. Still because of vast differences in specifications, Python 2.x code won’t run on Python 3.x environment.&nbsp;</p><p>However, Python 3 library comes with a utility to convert Python 2.x code. This module is called 2to3. Command Line usage of this tool is as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ma4xff1pk" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ 2to3 py2.py</pre></div></div><p>To test this usage, save following code as py2.py</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1uqxftbok" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def sayhello(nm):
&nbsp; &nbsp; print "Hello", nm
nm=raw_input("enter name")
sayhello(nm)</pre></div></div><p>Above code uses Python 2.x syntax. The print statement doesn’t require parentheses. Also raw_input() function is not available in Python 3.x. Hence when we convert above code, print() function will have parentheses and raw_input will change to input()</p><p>As we run above command, a diff against the original source file is printed as below:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zz3iysb0f" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ 2to3 py2.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored py2.py
--- py2.py (original)
+++ py2.py (refactored)
@@ -1,5 +1,5 @@
&nbsp;def sayhello(nm):
- &nbsp; &nbsp;print "Hello", nm
+ &nbsp; &nbsp;print("Hello", nm)
-nm=raw_input("enter name")
+nm=input("enter name")
&nbsp;sayhello(nm)
RefactoringTool: Files that need to be modified:
RefactoringTool: py2.py</pre></div></div><p>2to3 can also write the needed modifications right back to the source file which is enabled with the -w flag. Changed version of script will be as shown.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-nlz2sz0vu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ 2to3 -w py2.py
RefactoringTool: Skipping optional fixer: buffer
RefactoringTool: Skipping optional fixer: idioms
RefactoringTool: Skipping optional fixer: set_literal
RefactoringTool: Skipping optional fixer: ws_comma
RefactoringTool: Refactored py2.py
--- py2.py (original)
+++ py2.py (refactored)
@@ -1,5 +1,5 @@
&nbsp;def sayhello(nm):
- &nbsp; &nbsp;print "Hello", nm
+ &nbsp; &nbsp;print("Hello", nm)
-nm=raw_input("enter name")
+nm=input("enter name")
&nbsp;sayhello(nm)
RefactoringTool: Files that were modified:
RefactoringTool: py2.py</pre></div></div><p>The py2.py will be modified to be compatible with python 3.x syntax</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-pn5aselwt" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">def sayhello(nm):
&nbsp; &nbsp; print("Hello", nm)
nm=input("enter name")
sayhello(nm)</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">30. What is the difference between assertion and exception? Explain with the help of suitable Python examples.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>People often get confused between assertions and exceptions and often use the latter when the former should be used in a program (and vice versa).</p><p>The fundamental difference lies in the nature of the error to be caught and processed. Assertion is a statement of something that MUST be true. If not, then the program is terminated and you cannot recover from it. Exception on the other hand is a runtime situation that can be recovered from.</p><p>Python’s assert statement checks for a condition. If the condition is true, it does nothing and your program just continues to execute. But if it evaluates to false, it raises an AssertionError exception with an optional error message.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0ftw5jw0a" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def testassert(x,y):
try:
assert y!=0
print ('division', x/y)
except AssertionError:
print ('Division by Zero not allowed')
&gt;&gt;&gt; testassert(10,0)
Division by Zero not allowed</pre></div></div><p>The proper use of assertions is to inform developers about unrecoverable errors in a program. They’re not intended to signal expected error conditions, like “file not found”, where a user can take corrective action or just try again. The built-in exceptions like FileNotFoundError are appropriate for the same.</p><p>You can think of assert as equivalent to a raise-if statement as follows:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-mklof5f1j" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">if __debug__:
&nbsp; &nbsp; if not expression1:
&nbsp; &nbsp; &nbsp; &nbsp; raise AssertionError(expression2)</pre></div></div><p>__debug__ constant is true by default.&nbsp;</p><p>Python’s assert statement is a debugging aid, not a mechanism for handling run-time errors for which exceptions can be used.</p><p>Assertion can be globally disabled by setting __debug__ to false or starting Python with -O option.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-8kpyzou80" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$python -O
&gt;&gt;&gt; __debug__
False</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">31. How are warnings generated in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Exceptions are generally fatal as the program terminates instantly when an unhandled exception occurs. Warnings are non-fatal. A warning message is displayed but the program won’t terminate. Warnings generally appear if some deprecated usage of certain programming element like keyword/function/class etc. occurs.</p><p>Python’s builtins module defines Warnings class which is inherited from Exception itself. However, custom warning messages can be displayed with the help of warn() function defined in built-in warnings module.</p><p>There are a number of built-in Warning subclasses. User defined subclass can also be defined.</p><div class="overflow-x-auto mt-spacing10 mb-[16.8px] md:mb-6 max-w-full"><table class="min-w-full divide-y divide-gray-200 border"><tbody><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">This is the base class of all warning category classes</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">UserWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">The default category for warn().</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">DeprecationWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings about deprecated features when those warnings are intended for developers</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">SyntaxWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings about dubious syntactic features</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">RuntimeWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings about dubious runtime features</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">FutureWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings about deprecated features when those warnings are intended for end users</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">PendingDeprecationWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings about features that will be deprecated in the future</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">ImportWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings triggered during the process of importing a module</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">UnicodeWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings related to Unicode</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">BytesWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings related to bytes and bytearray</td></tr><tr><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">ResourceWarning</td><td class="CertTheme__tableCell" style="border:1px solid black;width:175px;vertical-align:top;text-align:start">Warnings related to resource usage</td></tr></tbody></table></div><p>Following code defines WarnExample class. When method1() is called, it issues a depreciation warning.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-cwgo2p0nu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"># warningexample.py&nbsp;
import warnings
class WarnExample:
&nbsp; &nbsp; def __init__(self):
&nbsp; &nbsp; &nbsp; &nbsp; self.text = "Warning"
&nbsp; &nbsp; def method1(self):
&nbsp; &nbsp; &nbsp; &nbsp; warnings.warn(
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; "method1 is deprecated, use new_method instead",
&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DeprecationWarning
if __name__=='__main__': &nbsp; &nbsp; &nbsp; &nbsp;
&nbsp; &nbsp; &nbsp; &nbsp; e=WarnExample()
&nbsp; &nbsp; &nbsp; &nbsp; e.method1()</pre></div></div><p dir="ltr"><span style="color:rgb(0, 0, 0)"><strong>Output:</strong></span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ss4391br0" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">$ python -Wd warningexample.py
warningexample.py:10: DeprecationWarning: method1 is deprecated, use new_method instead
&nbsp; DeprecationWarning</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">32. What are the characteristics of Counter object in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Counter class is defined in collections module, which is part of Python’s standard library. It is defined as a subclass of built-in dict class. Main application of Counter object is to keep count of hashable objects. Counter object is a collection of key-value pairs, telling how many times a key has appeared in sequence or dictionary.</p><p>The Counter() function acts as a constructor. Without arguments, an empty Counter object is returned. When a sequence is given as argument, it results in a dictionary holding occurrences of each item.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1k8wqnmcb" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; from collections import Counter
&gt;&gt;&gt; c1=Counter()
&gt;&gt;&gt; c1
Counter()
&gt;&gt;&gt; c2=Counter('MALAYALAM')
&gt;&gt;&gt; c2
Counter({'A': 4, 'M': 2, 'L': 2, 'Y': 1})
&gt;&gt;&gt; c3=Counter([34,21,43,32,12,21,43,21,12])
&gt;&gt;&gt; c3
Counter({21: 3, 43: 2, 12: 2, 34: 1, 32: 1})</pre></div></div><p>Counter object can be created directly by giving a dict object as argument which itself should be k-v pair of element and count.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-scqjuo9dx" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; c4=Counter({'Ravi':4, 'Anant':3, "Rakhi":3})</pre></div></div><p>The Counter object supports all the methods that a built-in dict object has. One important method is elements() which returns a chain object and returns an iterator of element and value repeating as many times as value.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-zxohgg0yn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; list(c4.elements())
['Ravi', 'Ravi', 'Ravi', 'Ravi', 'Anant', 'Anant', 'Anant', 'Rakhi', 'Rakhi', 'Rakhi']</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">33. Give a brief overview of various data compression and archiving APIs in Python's standard library.</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python supports data compression using various algorithms such as zlib, gzip, bzip2 and lzma. Python library also has modules that can manage ZIP and tar archives.</p><p>Data compression and decompression according to zlib algorithm is implemented by zlib module. The gzip module provides a simple interface to compress and decompress files just as very popular GNU utilities GZIP and GUNZIP.</p><p>Following example creates a gzip file by writing compressed data in it.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-sy0jqn769" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import gzip
&gt;&gt;&gt; data=b'Python is Easy'
&gt;&gt;&gt; with gzip.open("test.txt.gz", "wb") as f:
f.write(data)</pre></div></div><p>This will create “test.txt.gz” file in the current directory.</p><p>In order to read this compressed file:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-dd6382chs" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; with gzip.open("test.txt.gz", "rb") as f:
data=f.read()
&gt;&gt;&gt; data
b'Python is Easy'</pre></div></div><p>Note that the gz file should be opened in wb and rb mode respectively for writing and reading.</p><p>The bzip2 compression and decompression is implemented by bz2 module. Primary interface to the module involves following three functions:</p><ol class="CertTheme__ol1 pt-spacing10"><li class="CertTheme__listItem pt-spacing10"><strong>Open():</strong> opens a bzip2 compressed file and returns a file object. The file can be opened as binary/text mode with read/write permissions.&nbsp;</li><li class="CertTheme__listItem pt-spacing10"><strong>write():&nbsp;</strong>the file should be opened in ‘w’ or ‘wb’ mode. In binary mode, it writes compressed binary data to the file. In normal text mode, the file object is wrapped in TetIOWrapper object to perform encoding.</li><li class="CertTheme__listItem pt-spacing10"><strong>read():</strong> When opened in read mode, this function reads it and returns the uncompressed data.</li></ol><p>Following code writes the compressed data to a bzip2 file</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-18vyqflgp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; f=bz2.open("test.bz2", "wb") &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; data=b'SureCertificate Solutions Private Limited' &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; f.write(data)
&nbsp;&gt;&gt;&gt; f.close()</pre></div></div><p>This will create test.bz2 file in the current directory. Any unzipping tool will show a ‘test’ file in it. To read the uncompressed data from this test.bz2 file use the following code:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-0xuz5p9x5" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; f=bz2.open("test.bz2", "rb") &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; data=f.read() &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; data &nbsp; &nbsp; &nbsp; &nbsp;
b'SureCertificate Solutions Private Limited'</pre></div></div><p>The&nbsp;Lempel–Ziv–Markov chain algorithm&nbsp;(LZMA) performs lossless data compression with a higher compression ratio than other algorithms. Python’s lzma module consists of classes and convenience functions for this purpose.</p><p>Following code is an example of lzma compression/decompression:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-i1qx9kshn" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import lzma
&gt;&gt;&gt; data=b"SureCertificate Solutions Private Limited"
&gt;&gt;&gt; f=lzma.open("test.xz","wb")
&gt;&gt;&gt;f.write(data)
&gt;&gt;&gt;f.close()</pre></div></div><p>A ‘test.xz’ file will be created in the current working directory. To fetch uncompressed data from this file use the following code:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-4809b9999" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import lzma
&gt;&gt;&gt; f=lzma.open("test.xz","rb")
&gt;&gt;&gt; data=f.read()
&gt;&gt;&gt; data
b'SureCertificate Solutions Private Limited'</pre></div></div><p>The ZIP is one of the most popular and old file formats used for archiving and compression. It is used by famous PKZIP application.</p><p>The zipfile module in Python’s standard library provides ZipFile() function that returns ZipFile object. Its write() and read() methods are used to create and read archive.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-g3n024ohz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; import zipfile
&gt;&gt;&gt; newzip=zipfile.ZipFile('a.zip','w')
&gt;&gt;&gt; newzip.write('abc.txt')
&gt;&gt;&gt; newzip.close()</pre></div></div><p>To &nbsp;read &nbsp;data from a particular file in the archive</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-b0xwnbjpz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; newzip=zipfile.ZipFile('a.zip','r')
&gt;&gt;&gt; data=newzip.read('abc.txt')
&gt;&gt;&gt; data</pre></div></div><p>Finally, Python’s tarfile module helps you to create a tarball of multiple files by applying different compression algorithms.</p><p>Following example opens a tar file for compression with gzip algorithm and adds a file in it.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2ysgbwgu3" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; fp=tarfile.open("a.tar.gz","w:gz") &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; fp.add("abc.txt") &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; fp.close()</pre></div></div><p>Following code extracts the files from the tar archive, extracts all files and puts them in current folder.&nbsp;</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-vpl78ktyu" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; fp=tarfile.open("a.tar.gz","r:gz") &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; fp.extractall() &nbsp; &nbsp; &nbsp; &nbsp;
&gt;&gt;&gt; fp.close()</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">34. What do you mean by duck typing? How does Python implement duck typing?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p>Duck typing is a special case of dynamic polymorphism and a characteristic found in all dynamically typed languages including Python. The premise of duck typing is a famous quote: "If it walks like a duck and it quacks like a duck, then it must be a duck".</p><p>In programming, the above duck test is used to determine if an object can be used for a particular purpose. With statically typed languages, suitability is determined by an object's type. In duck typing, an object's suitability is determined by the presence of certain methods and properties, rather than the type of the object itself. Here, the idea is that it doesn't actually matter what type data is - just whether or not it is possible to perform a certain operation. &nbsp;</p><p>Take a simple case of addition operation. Normally addition of similar objects is allowed, for example the addition of numbers or strings. In Python, addition of two integers, x+y actually does int.__add__(x+y) under the hood.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-9iwgdesvv" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; x=10
&gt;&gt;&gt; y=20
&gt;&gt;&gt; x+y
30
&gt;&gt;&gt; int.__add__(x,y)
30</pre></div></div><p>Hence, addition operation can be done on any objects whose class supports __add__() method. Python’s data model describes protocols of data types. For example sequence protocol stipulates that any class that supports iterator, len() and __getitem__() methods is a sequence.&nbsp;</p><p>The simple example of duck typing given below demonstrates how any object may be used in any context, up until it is used in a way that it does not support:</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ieooowd40" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">class Duck:
&nbsp; &nbsp; def fly(self):
&nbsp; &nbsp; &nbsp; &nbsp; print("Duck flies")
class Airplane:
&nbsp; &nbsp; def fly(self):
&nbsp; &nbsp; &nbsp; &nbsp; print("Airplane flies")
class Kangaroo:
&nbsp; &nbsp; def swim(self):
&nbsp; &nbsp; &nbsp; &nbsp; print("Kangaroo runs")
d=Duck()
a=Airplane()
k=Kangaroo()
for b in [d,a,k]:
&nbsp; &nbsp;b.fly()
output:
Duck flies
Airplane flies
Traceback (most recent call last):
&nbsp; File "example.py", line 18, in &lt;module&gt;
&nbsp; &nbsp; b.fly()
AttributeError: 'Kangaroo' object has no attribute 'fly'</pre></div></div><p>Duck typing is possible in certain statically typed languages by providing extra type annotations &nbsp;that instruct the compiler to arrange for type checking of classes to occur at run-time rather than compile time, and include run-time type checking code in the compiled output.</p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">35. What are Closures in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p></p><p>Python allows a function to be defined inside another function. Such functions are called nested functions. In such case, a certain variable is located in the order of local, outer, global and lastly built-in namespace order. The inner function can access variable declared in nonlocal scope.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-lf9y2diyy" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def outer():
data=10
def inner():
print (data)
inner()
&gt;&gt;&gt; outer()
10</pre></div></div><p>Whereas the inner function is able to access the outer scope, inner function is able to use variables in the outer scope through closures. Closures maintain references to objects from the earlier scope.&nbsp;</p><p>A closure is a nested function object that remembers values in enclosing scopes even if they are not present in memory.</p><p>Following criteria must be met to create a closure in Python:</p><ul><li class="CertTheme__listItem pt-spacing10">We must have a nested function (function inside a function).</li><li class="CertTheme__listItem pt-spacing10">The nested function must refer to a value defined in the enclosing function.</li><li class="CertTheme__listItem pt-spacing10">The enclosing function must return the nested function.</li></ul><p>Following code is an example of closure.</p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-l1micr056" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm">&gt;&gt;&gt; def outer():
data=10
def inner():
print (data)
return inner
&gt;&gt;&gt; closure=outer()
&gt;&gt;&gt; closure()
10</pre></div></div><p></p></div></div></div></div><div class="rounded-xl mb-spacing24 last:mb-0 outline duration-300 transition ease-in-out outline-1 outline-neutral-200 hover:outline-neutral-400 hover:shadow-neutralShadow hidden"><div class="cursor-pointer items-center justify-between p-4 transition-all duration-500 undefined bg-white p-spacing16 pl-spacing24 flex gap-spacing8 rounded-xl"><div class="flex text-sm font-semibold items-center overflow-x-auto"><h3 class="text-neutral-800 font-bold text-sm leading-5.5 -indent-0 pl-5 overflow-hidden line-clamp-2">36. What is memoryview object in Python?</h3></div><div class="md:w-5 md:h-5 w-6 h-6 ml-spacing8 flex items-center transition-all duration-300"><i class="icon-chevron-up-filled inline-block transition-transform duration-300 text-xl rotate-180 text-primary-main"></i></div></div><div class="overflow-hidden p-0 transition-all duration-500 ease-in-out rounded-b-xl" style="max-height:0px"><div><div class="p-spacing24 bg-white border-t border-neutral-200 faq-editor-content last:rounded-b-xl"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>A memory view object is returned by memoryview() a built-in function in standard library. This object is similar to a sequence but allows access to the internal data of an object that supports the buffer protocol without copying.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Just as in the C language, we access the memory using pointer variables; in Python; we use memoryview to access its referencing memory.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Buffer Protocol allows exporting an interface to access internal memory (or buffer). The built-in types bytes and bytearray supports this protocol and objects of these classes are allowed to expose internal buffer to allow to directly access the data.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Memory view objects are required to access the memory directly instead of data duplication.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>The memoryview() function has one object that supports the buffer protocol as argument.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-x1xdbw92q" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> obj</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenFunction">memoryview</span><span class="CertTheme__tokenPunctuation">(</span><span>b</span><span class="CertTheme__tokenSelector">'HEllo Python'</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> obj</span><br><span class="CertTheme__tokenOperator">&lt;</span><span>memory at </span><span class="CertTheme__tokenProperty">0x7ffa12e2b048</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>This code creates a memoryview of bytesarray</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-ksq4maejp" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> obj1</span><span class="CertTheme__tokenOperator">=</span><span class="CertTheme__tokenFunction">memoryview</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenFunction">bytearray</span><span class="CertTheme__tokenPunctuation">(</span><span class="CertTheme__tokenSelector">"Hello Python"</span><span class="CertTheme__tokenPunctuation">,</span><span class="CertTheme__tokenSelector">'utf-8'</span><span class="CertTheme__tokenPunctuation">)</span><span class="CertTheme__tokenPunctuation">)</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> obj1</span><br><span class="CertTheme__tokenOperator">&lt;</span><span>memory at </span><span class="CertTheme__tokenProperty">0x7ffa12e2b108</span><span class="CertTheme__tokenOperator">&gt;</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>A memoryview supports slicing and indexing to expose its data.</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-1wyri1311" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> obj</span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">7</span><span class="CertTheme__tokenPunctuation">]</span><br><span class="CertTheme__tokenProperty">121</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Slicing creates a subview</span></p><div class="jsx-189f2d4cbe17d436 code-block-wrapper mt-spacing10 mb-[16.8px] md:mb-[24px] bg-black p-4 rounded-[12px] relative text-[#708090] overflow-hidden"><div class="jsx-189f2d4cbe17d436 absolute top-4 right-4 z-10"><div class="jsx-189f2d4cbe17d436 px-spacing12 bg-white rounded-full h-10 flex items-center cursor-pointer"><i class="jsx-189f2d4cbe17d436 text-black text-sm icon-copy"></i></div></div><div class="jsx-189f2d4cbe17d436 overflow-x-auto pb-[12px] w-full"><pre id="code-block-2x54zy3gz" class="jsx-189f2d4cbe17d436 whitespace-pre-wrap break-words w-full font-mono text-sm"><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> v</span><span class="CertTheme__tokenOperator">=</span><span>obj</span><span class="CertTheme__tokenPunctuation">[</span><span class="CertTheme__tokenProperty">6</span><span class="CertTheme__tokenOperator">:</span><span class="CertTheme__tokenPunctuation">]</span><br><span class="CertTheme__tokenOperator">&gt;&gt;&gt;</span><span> </span><span class="CertTheme__tokenFunction">bytes</span><span class="CertTheme__tokenPunctuation">(</span><span>v</span><span class="CertTheme__tokenPunctuation">)</span><br><span>b</span><span class="CertTheme__tokenSelector">'Python'</span></pre></div></div><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>This, along with other Python advanced interview questions, is a regular feature in Python interviews. Be ready to tackle it with the approach mentioned.</span></p></div></div></div></div><div class="relative"><div class="mt-spacing20 z-10 relative text-center flex justify-center mt-0"><button class="flex items-center gap-x-spacing8 py-spacing4"><span class="text-sm underline font-semibold text-mono-black">View all questions</span><i class="icon-chevron-down-double text-xl leading-5 text-neutral-800"></i></button></div><div class="absolute bottom-0 block h-32 w-full bg-gradient-to-t from-subdued/100 from-30% md:from-40%"></div></div></div></div></div></div></div></div></div></div></div></section></div></div><div class="sticky top-0 self-start max-h-screen overflow-y-auto w-full"><div class="w-full overflow-hidden pt-spacing32"><div class="px-spacing16 py-spacing20 rounded-xl border border-neutral-200 bg-white"><div class=""><h5 class="text-lg leading-6 text-mono-black font-bold">Want to Know More?</h5></div><form novalidate="" class="pt-spacing20 w-full"><div class="mb-spacing12"><div class=" relative  w-full  group h-11 flex direction-row justify-between rounded-lg border-none
    hover:border-neutral-400  shadow-customShad focus:border-neutral-600 focus:shadow-neutral "><input type="text" placeholder="full Name" class="w-full h-full  text-sm text-neutral-800 placeholder-transparent leading-5.5 pl-4 pr-8 rounded-lg border-1 peer  focus:outline-none border-neutral-200 hover:border-neutral-400 focus:border-neutral-600 focus:shadow-neutral" name="fullName"><label class="absolute  left-3 -top-2 border-r-none text-sm transition-all peer-focus:-top-2 peer-focus:text-sm pointer-events-none pr-3.75 pl-1  bg-white 
          text-neutral-500 peer-placeholder-shown:text-sm peer-placeholder-shown:text-neutral-500 peer-placeholder-shown:top-3 peer-focus:text-neutral-500 peer-placeholder-shown:leading-5">Full Name<span class="text-red-500 ml-spacing4 pt-0.8 absolute">*</span></label></div></div><div class="mb-spacing12"><div class=" relative  w-full  group h-11 flex direction-row justify-between rounded-lg border-none
    hover:border-neutral-400  shadow-customShad focus:border-neutral-600 focus:shadow-neutral "><input type="text" placeholder="Email" class="w-full h-full text-sm text-neutral-800 leading-5.5 pl-4 pr-8 rounded-lg border-1 peer focus:outline-none border-neutral-200 hover:border-neutral-400 focus:border-neutral-600 focus:shadow-neutral placeholder-transparent" name="email"><label class="absolute  left-3 -top-2 border-r-none text-sm transition-all peer-focus:-top-2 peer-focus:text-sm pointer-events-none pr-3.75 pl-1 bg-white 
          text-neutral-500 peer-placeholder-shown:text-sm peer-placeholder-shown:text-neutral-500 peer-placeholder-shown:top-3 peer-focus:text-neutral-500 peer-placeholder-shown:leading-5">Email<span class="text-red-500 ml-spacing4 pt-0.8 absolute">*</span></label></div></div><div class="mb-spacing16"><div><div class="flex h-11 relative focus-within:shadow-neutral focus-within:border-neutral-600 rounded-lg border-1  focus:placeholder-transparent hover:border-neutral-400 focus:border-neutral-600 focus:shadow-neutral focus:outline-none border-neutral-200 shadow-customShad "><div class="p-3 cursor-pointer m-1 flex justify-center items-center rounded-r-lg !w-auto !px-0 !pr-2 !pl-3 leading-6 w-fit border-neutral-200 rounded-l-lg border-none hover:border-neutral-400 focus:border-neutral-600 focus:shadow-neutral focus:outline-none"><div class="pr-1 font-bold text-base text-blackDar"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#181A93" d="M17.3 0h478.4v342H17.3V0z"></path><path fill="#FFA44A" d="M0 0h513v114H0V0z"></path><path fill="#1A9F0B" d="M0 228h513v114H0V228z"></path><path fill="white" d="M0 114h513v114H0V114z"></path><circle fill="white" cx="256.5" cy="171" r="34.2"></circle><path fill="#181A93" d="M256.5 216.6c-25.1 0-45.6-20.5-45.6-45.6s20.5-45.6 45.6-45.6 45.6 20.5 45.6 45.6-20.5 45.6-45.6 45.6zm0-11.4c18.2 0 34.2-16 34.2-34.2s-15.9-34.2-34.2-34.2-34.2 16-34.2 34.2 16 34.2 34.2 34.2z"></path><circle fill="#181A93" cx="256.5" cy="171" r="22.8"></circle></svg></div><div class="pl-spacing4 text-xs w-6 items-center text-neutral-700 font-semibold">+91</div></div></div><i class="icon-chevron-right text-base rotate-90 leading-4 ml-spacing12"></i></div><input type="text" class="hidden" name="isd" value="+91"><div class="w-full"><div class="inline-block bg-white border-none undefined h-full w-full border-neutral-200 rounded-lg border-1 shadow-customShad group hover:border-neutral-400 focus:border-neutral-600 focus:shadow-neutral focus:outline-none"><input type="text" class="w-full h-full text-sm text-neutral-800 leading-5.5 px-spacing12 border-neutral-200 rounded-r-lg border-none peer focus:outline-none " placeholder="  " name="number"><label class="absolute  bg-white placeholder-transparent left-3 -top-2 text-sm transition-all peer-focus:-top-2 peer-focus:left-3 peer-focus:text-sm pointer-events-none  pr-3.75 pl-1 bg-white 
          text-neutral-500 peer-placeholder-shown:text-sm peer-placeholder-shown:text-neutral-500 peer-placeholder-shown:top-3 peer-focus:text-neutral-500 peer-placeholder-shown:leading-5 peer-placeholder-shown:left-24">Phone Number<span class="text-red-500 ml-spacing4 absolute pt-0.8">*</span></label></div></div></div><div class="max-w-61 !w-auto pt-spacing4 ml-3.5 md:mr-0 mr-4.25 bg-white absolute z-99 h-68 customized-scrollbar overflow-y-scroll border-1 text-xs border-neutral-400 rounded-lg hidden !ml-0"><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#D80027"><path d="M0 0h513v38H0zM0 76h513v38H0zM0 152h513v38H0zM0 228h513v38H0zM0 304h513v38H0z"></path></g><path fill="#2E52B2" d="M0 0h256.5v190H0z"></path><g fill="white"><path d="M47.8 141.9l-4-12.8-4.3 12.8H26.3l10.7 7.7-4 12.8 10.8-7.9 10.7 7.9-4.2-12.8 10.9-7.7zM104.2 141.9l-4.1-12.8-4.2 12.8H82.7l10.7 7.7-4.1 12.8 10.8-7.9 10.7 7.9-4-12.8 10.8-7.7zM160.6 141.9l-4.2-12.8-4 12.8h-13.5l10.9 7.7-4.2 12.8 10.8-7.9 10.9 7.9-4.2-12.8 10.8-7.7zM216.9 141.9l-4.1-12.8-4.2 12.8h-13.2l10.7 7.7-4 12.8 10.7-7.9 10.8 7.9-4.2-12.8 10.9-7.7zM100.1 78.3l-4.2 12.8H82.7L93.4 99l-4.1 12.6 10.8-7.8 10.7 7.8-4-12.6 10.8-7.9h-13.4zM43.8 78.3l-4.3 12.8H26.3L37 99l-4 12.6 10.8-7.8 10.7 7.8L50.3 99l10.9-7.9H47.8zM156.4 78.3l-4 12.8h-13.5l10.9 7.9-4.2 12.6 10.8-7.8 10.9 7.8-4.2-12.6 10.8-7.9h-13.3zM212.8 78.3l-4.2 12.8h-13.2l10.7 7.9-4 12.6 10.7-7.8 10.8 7.8-4.2-12.6 10.9-7.9h-13.4zM43.8 27.7l-4.3 12.6H26.3L37 48.2l-4 12.7L43.8 53l10.7 7.9-4.2-12.7 10.9-7.9H47.8zM100.1 27.7l-4.2 12.6H82.7l10.7 7.9-4.1 12.7 10.8-7.9 10.7 7.9-4-12.7 10.8-7.9h-13.4zM156.4 27.7l-4 12.6h-13.5l10.9 7.9-4.2 12.7 10.8-7.9 10.9 7.9-4.2-12.7 10.8-7.9h-13.3zM212.8 27.7l-4.2 12.6h-13.2l10.7 7.9-4 12.7 10.7-7.9 10.8 7.9-4.2-12.7 10.9-7.9h-13.4z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">United States +1</div></div></div><div class="bg-mono-black/8 pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#181A93" d="M17.3 0h478.4v342H17.3V0z"></path><path fill="#FFA44A" d="M0 0h513v114H0V0z"></path><path fill="#1A9F0B" d="M0 228h513v114H0V228z"></path><path fill="white" d="M0 114h513v114H0V114z"></path><circle fill="white" cx="256.5" cy="171" r="34.2"></circle><path fill="#181A93" d="M256.5 216.6c-25.1 0-45.6-20.5-45.6-45.6s20.5-45.6 45.6-45.6 45.6 20.5 45.6 45.6-20.5 45.6-45.6 45.6zm0-11.4c18.2 0 34.2-16 34.2-34.2s-15.9-34.2-34.2-34.2-34.2 16-34.2 34.2 16 34.2 34.2 34.2z"></path><circle fill="#181A93" cx="256.5" cy="171" r="22.8"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">India +91</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><g fill="#D80027"><path d="M0 0h142v341.3H0zM370 0h142v341.3H370zM306.5 206l50.4-25.2-25.2-12.6V143l-50.4 25.2 25.2-50.4h-25.2L256.1 80l-25.2 37.8h-25.2l25.2 50.4-50.4-25.2v25.2l-25.2 12.6 50.4 25.2-12.6 25.2h50.4V269h25.2v-37.8h50.4z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Canada +1</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><g fill="white"><path d="M222.2 170.7c.3-.3.5-.6.8-.9-.2.3-.5.6-.8.9zM188 212.6l11 22.9 24.7-5.7-11 22.8 19.9 15.8-24.8 5.6.1 25.4-19.9-15.9-19.8 15.9.1-25.4-24.8-5.6 19.9-15.8-11.1-22.8 24.8 5.7zM385.9 241.1l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.6v12.2l-9.4-7.6-9.5 7.6.1-12.2-11.8-2.6 9.5-7.5-5.3-10.9 11.8 2.7zM337.3 125.1l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.7v12.1l-9.4-7.6-9.5 7.6.1-12.1-11.9-2.7 9.5-7.5-5.3-10.9L332 136zM385.9 58.9l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.7v12.1l-9.4-7.6-9.5 7.6.1-12.1-11.8-2.7 9.5-7.5-5.3-10.9 11.8 2.7zM428.4 108.6l5.2 10.9 11.8-2.7-5.3 10.9 9.5 7.5-11.8 2.6V150l-9.4-7.6-9.5 7.6v-12.2l-11.8-2.6 9.5-7.5-5.3-10.9 11.8 2.7zM398 166.5l4.1 12.7h13.3l-10.8 7.8 4.2 12.7-10.8-7.9-10.8 7.9 4.1-12.7-10.7-7.8h13.3z"></path><path d="M254.8 0v30.6l-45.1 25.1h45.1V115h-59.1l59.1 32.8v22.9h-26.7l-73.5-40.9v40.9H99v-48.6l-87.4 48.6H-1.2v-30.6L44 115H-1.2V55.7h59.1L-1.2 22.8V0h26.7L99 40.8V0h55.6v48.6L242.1 0z"></path></g><path fill="#D80027" d="M142.8 0h-32v69.3h-112v32h112v69.4h32v-69.4h112v-32h-112z"></path><path fill="#0052B4" d="M154.6 115l100.2 55.7v-15.8L183 115z"></path><path fill="white" d="M154.6 115l100.2 55.7v-15.8L183 115z"></path><g fill="#D80027"><path d="M154.6 115l100.2 55.7v-15.8L183 115zM70.7 115l-71.9 39.9v15.8L99 115z"></path></g><path fill="#0052B4" d="M99 55.7L-1.2 0v15.7l71.9 40z"></path><path fill="white" d="M99 55.7L-1.2 0v15.7l71.9 40z"></path><g fill="#D80027"><path d="M99 55.7L-1.2 0v15.7l71.9 40zM183 55.7l71.8-40V0L154.6 55.7z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Australia +61</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512V256H0z"></path><g fill="white"><path d="M83.478 170.666c0-24.865 17.476-45.637 40.812-50.734a52.059 52.059 0 00-11.13-1.208c-28.688 0-51.942 23.254-51.942 51.941s23.255 51.942 51.942 51.942c3.822 0 7.543-.425 11.13-1.208-23.336-5.095-40.812-25.867-40.812-50.733zM150.261 122.435l3.684 11.337h11.921l-9.645 7.007 3.684 11.337-9.644-7.006-9.645 7.006 3.685-11.337-9.645-7.007h11.921z"></path><path d="M121.344 144.696l3.683 11.337h11.921l-9.645 7.007 3.684 11.337-9.643-7.006-9.645 7.006 3.685-11.337-9.645-7.007h11.921zM179.178 144.696l3.684 11.337h11.921l-9.645 7.007 3.684 11.337-9.644-7.006-9.644 7.006 3.685-11.337-9.645-7.007h11.921zM168.047 178.087l3.684 11.337h11.921l-9.644 7.007 3.684 11.337-9.645-7.006-9.643 7.006 3.684-11.337-9.644-7.007h11.92zM132.474 178.087l3.683 11.337h11.921l-9.644 7.007 3.684 11.337-9.644-7.006-9.644 7.006 3.684-11.337-9.644-7.007h11.92z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Singapore +65</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.334h512v341.337H0z"></path><g fill="#D80027"><path d="M425.301 233.745l3.388 10.428h10.963l-8.87 6.444 3.388 10.427-8.869-6.444-8.871 6.444 3.388-10.427-8.87-6.444h10.963zM386.107 308.817l5.083 15.642h16.445l-13.305 9.667 5.082 15.64-13.305-9.667-13.305 9.667 5.083-15.64-13.305-9.667h16.445zM387.588 185.971l4.236 13.036h13.704l-11.088 8.054 4.235 13.034-11.087-8.056-11.088 8.056 4.235-13.034-11.087-8.054h13.704zM349.876 233.291l5.082 15.641h16.446l-13.306 9.666 5.084 15.641-13.306-9.666-13.305 9.666 5.082-15.641-13.305-9.666h16.445z"></path></g><path fill="white" d="M256.003 85.329v30.564l-45.178 25.088h45.178v59.359H196.89l59.113 32.846v22.806h-26.69l-73.484-40.826v40.826h-55.652v-48.573l-87.429 48.573H.003v-30.553l45.168-25.099H.003v-59.359h59.103L.003 108.147V85.329h26.68l73.494 40.838V85.329h55.652v48.573l87.43-48.573z"></path><path fill="#D80027" d="M144 85.33h-32v69.334H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path fill="#0052B4" d="M155.826 200.344L256 255.998v-15.739l-71.847-39.915z"></path><path fill="white" d="M155.826 200.344L256 255.998v-15.739l-71.847-39.915z"></path><g fill="#D80027"><path d="M155.826 200.344L256 255.998v-15.739l-71.847-39.915zM71.846 200.344L0 240.259v15.739l100.174-55.654z"></path></g><path fill="#0052B4" d="M100.174 140.983L0 85.33v15.738l71.847 39.915z"></path><path fill="white" d="M100.174 140.983L0 85.33v15.738l71.847 39.915z"></path><g fill="#D80027"><path d="M100.174 140.983L0 85.33v15.738l71.847 39.915zM184.154 140.983L256 101.068V85.33l-100.174 55.653z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">New Zealand +64</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.337H0z"></path><path d="M0 85.331h512v113.775H0z"></path><path fill="#FFDA44" d="M0 312.882h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Germany +49</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#6DA544" d="M0 0h513v114H0z"></path><path d="M0 228h513v114H0z"></path><path fill="#dd0d12" d="M0 0h171v342H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">United Arab Emirates +971</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"></path><g fill="white"><path d="M274.2 119.8c-5.1 21.1-14.1 17.1-18.5 35.5-26.1-6.3-42.1-32.5-35.9-58.6 6.3-26.1 32.5-42.1 58.5-35.9-8.7 36.9.5 40.1-4.1 59zM206.6 135.4c18.5 11.3 11.9 18.7 28 28.6-14 22.9-43.9 30-66.8 16s-30-43.9-16-66.8c32.3 19.8 38.2 12.1 54.8 22.2zM200.6 204.6c16.5-14.1 21.4-5.5 35.8-17.8 17.4 20.4 15 51-5.4 68.4-20.4 17.4-51 15-68.4-5.4 28.7-24.6 23.2-32.6 38-45.2zM264.5 231.7c-8.3-20.1 1.4-22.1-5.9-39.6 24.8-10.3 53.2 1.5 63.4 26.3 10.3 24.8-1.5 53.2-26.3 63.4-14.5-35-23.8-32.2-31.2-50.1zM310 179.3c-21.6 1.7-20.6-8.1-39.5-6.6-2.1-26.7 17.9-50.1 44.6-52.2 26.7-2.1 50.1 17.9 52.2 44.6-37.7 2.9-37.9 12.7-57.3 14.2z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Hong Kong +852</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.326H0z"></path><path fill="#6DA544" d="M0 85.331h170.663v341.337H0z"></path><path fill="#FF9811" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Ireland +353</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#DB3E00" d="M0 0h513v342H0z"></path><path fill="#479900" d="M331 0h182v342H331z"></path><path d="M0 0h181.8v342H0z"></path><path fill="white" d="M256 126.7c-19.4 0-35.2 15.8-35.2 35.2v52.8h70.4v-52.8c0-19.5-15.8-35.2-35.2-35.2z"></path><path fill="white" d="M256 84.3c-47.7 0-86.4 38.7-86.4 86.4S208.3 257 256 257s86.4-38.7 86.4-86.4-38.7-86.3-86.4-86.3zm0 157.7c-39.4 0-71.4-32-71.4-71.4 0-39.4 32-71.4 71.4-71.4 39.4 0 71.4 32 71.4 71.4 0 39.5-32 71.4-71.4 71.4z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Afghanistan +93</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><path fill="#FFDA44" d="M513 210.9H202.2V342h-79.8V210.9H0V131.1h122.4V0h79.8v131.1H513v61.2z"></path><path fill="#D80027" d="M513 149.7v42.6H183.7V342H141V192.3H0v-42.6h141V0h42.7v149.7z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Aland Islands +358</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 60"><path fill="#ED2024" d="M0 0h90v60H0z"></path><path fill="#212121" d="M32.5 12.2v16l7.1 2.5-5 4.9 2.4 3 5.3-5.5 1.2 2.3-3 4.9 3.6 5.6-1.8 2.6 2.8 3.6 2.7-3.7-1.5-2.6 3-5.8-2.7-4.6 1.2-2.3 5.2 5.5 2.5-2.9-5.2-5.1 7.2-2.6V12.2l-5.2 1.9-.1 3.8-3.3.3v-2.6l1.7-2.3 5.6-2.2-2.3-.4 1.4-1.2.9.4-.8-1.4L54 9l-1-1.1L47.5 9l1.4 1.1-3.8 4.9-3.8-4.8 1.3-1.1-5-1.2L36.2 9l-1.5-.4-.8 1.4.9-.6 1.6 1.1-2.3.5 5.5 2 1.6 2.3v2.9l-3.3-.3v-3.6z"></path><g fill="#212121"><path d="M26.2 25h6.4v2.5h-6.4zM26.2 20.9h6.4v2.7h-6.4zM26.2 16.7h6.4v2.6h-6.4zM26.2 12.7h6.4v2.5h-6.4z"></path></g><g fill="#212121"><path d="M57.4 25h6.4v2.5h-6.4zM57.4 20.9h6.4v2.7h-6.4zM57.4 16.7h6.4v2.6h-6.4zM57.4 12.7h6.4v2.5h-6.4z"></path></g><path fill="#212121" d="M53.4 36.1h6.4V38h-6.4zM30.2 36.1h6.4V38h-6.4z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Albania +355</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#41662E" d="M0 0h512v341.3H0z"></path><path fill="white" d="M256 0h256v341.3H256z"></path><g fill="#D80027"><path d="M341.5 105.3l-29.4 40.4-47.5-15.4 29.4 40.4-29.4 40.4 47.5-15.4 29.4 40.4v-50l47.5-15.5-47.5-15.4z"></path><path d="M309.9 276.7c-58.5 0-106-47.5-106-106s47.5-106 106-106c18.3 0 35.4 4.6 50.4 12.7-23.5-23-55.7-37.2-91.2-37.2-72 0-130.4 58.4-130.4 130.4S197.1 301 269.1 301c35.5 0 67.7-14.2 91.2-37.2-14.9 8.2-32.1 12.9-50.4 12.9z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Algeria +213</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M513 33L95.3 171 513 310.76v30.57L0 171 513 0z"></path><path fill="white" d="M513 287.18v24.58L81.72 171 513 30v24.16"></path><path fill="#A2001D" d="M476.98 140.21l-21.89 10.68-3.18-15.32 31.19-29.77s-9.42-40.65-13.75-44.98l-112.32 55.82-6.84 36.76-31.9 28.59-.4 34.2 34.29-22.76 67.23-2.66-1.51 38.11h22.23l11.9-44.64 31.55-24.61-6.6-19.42z"></path><path fill="#EFC100" stroke="#231F20" stroke-miterlimit="10" d="M317.89 238.41l-22.24-11.11 22.24-11.11h144.46v22.22z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">AmericanSamoa +1684</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFDA44" d="M0 0h513v342H0z"></path><path fill="#0052B4" d="M0 0h171v342H0z"></path><path fill="#D80027" d="M342 0h171v342H342zM198.92 113.58H256v64.8h-57.08zM309.16 228.68L256 243.18v-64.8h57.08z"></path><path fill="#BC8B00" d="M182.24 95.92v92.2c0 34.32 27.26 54.17 48.63 64.46-.8 1.37 25.13 8.26 25.13 8.26s25.93-6.9 25.13-8.26c21.38-10.29 48.63-30.14 48.63-64.46v-92.2H182.24zm129.86 92.2c0 16.88-10 29.43-32.76 43.9-8.62 5.48-17.54 9.03-23.34 11.01-5.8-1.98-14.72-5.53-23.34-11.01-22.76-14.47-32.76-28.02-32.76-43.9v-74.54h112.2v74.54z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Andorra +376</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path d="M0 171h513v171H0z"></path><path fill="#D80027" d="M0 0h513v171H0z"></path><g fill="#FFDA44"><path d="M197.01 139.81c-9.32 12.37-9 27.81 3.37 37.12 0 0 162.62 122.13 164.64 123.93 2.02 1.8 6.3 2.38 11-3.27 4.46-5.36 3.31-9.78 1.04-11.63S197.01 139.81 197.01 139.81zM264.42 79.12l11.72 24.03 26.45 3.96-19.23 18.58 4.4 26.38-23.61-12.55-23.73 12.33 4.64-26.33L226 106.77l26.47-3.73z"></path><path d="M268.67 39.2l-3.2 22.04c51.81 3.9 92.64 47.18 92.64 99.99 0 55.38-44.9 100.28-100.28 100.28-40.82 0-75.94-24.39-91.59-59.4l-18.4 13.11c19.96 40.59 61.71 68.52 110 68.52 67.66 0 122.51-54.85 122.51-122.51-.01-64.01-49.1-116.54-111.68-122.03z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Angola +244</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><path fill="white" d="M454.8 265.38c7.94-10.93 13.24-24.27 13.24-40.42V104.89a59.754 59.754 0 01-36.02 12.01c-19.64 0-37.07-9.43-48.03-24.01-10.95 14.58-28.39 24.01-48.03 24.01-13.52 0-25.99-4.47-36.02-12v120.06c0 16.16 5.3 29.5 13.24 40.42H454.8z"></path><path fill="#8DCCFF" d="M310.23 260.98C332.65 296.96 384 309 384 309s51.35-12.04 73.77-48.02H310.23z"></path><path fill="#D87B00" d="M396.66 172.21c.32 1.42 8.72 10.17 17.56 20.15 1.39 1.57-8.74 12.63-6.91 12.59 4.75-.12 19.27-17.26 19.34 6.65.05 15.94-30 27.51-30 27.51h17.47l.65 14.96s4.97-13.34 7.59-16.57c8.1-9.97 20.18-30.07 34.59-27.1 14.41 2.97-13.66-13.92-13.66-13.92s-5.2-15.19-16.63-16.97c-10.06-1.57-14.29-2.51-26.64-7.3-1.68-.65-3.88-2.32-3.36 0z"></path><path fill="#D87B00" d="M359.69 198.69c1.07-.99 4.46-12.63 8.69-25.28.67-1.99 15.31 1.27 14.35-.3-2.47-4.06-24.58-8.08-3.9-20.08 13.79-8 38.82 12.27 38.82 12.27l-8.72-15.14 12.64-8.03s-14.05 2.35-18.14 1.69c-12.68-2.04-36.13-2.48-40.75-16.45-4.62-13.97-5.25 18.79-5.25 18.79s-10.56 12.08-6.4 22.88c3.66 9.5 4.96 13.64 6.97 26.73.29 1.79-.06 4.53 1.69 2.92z"></path><path fill="#D87B00" d="M395.67 219.87c-1.39-.43-13.16 2.49-26.22 5.18-2.06.42-6.59-13.88-7.47-12.26-2.27 4.17 5.36 25.31-15.41 13.45-13.84-7.91-8.89-39.73-8.89-39.73l-8.71 15.14-13.29-6.9s9.09 10.96 10.57 14.84c4.6 11.99 16 32.49 6.24 43.49-9.76 11.01 18.88-4.9 18.88-4.9s15.76 3.07 23-5.96c6.38-7.94 9.3-11.14 19.61-19.45 1.43-1.12 3.97-2.19 1.69-2.9z"></path><path fill="white" d="M256.5 0h-23.1L160 48.9V0H96v48.9L22.6 0H0v22.7l46.1 30.7H0v64h46.1L0 148.1V171h22.6L96 121.8V171h64v-49.2l73.4 49.2h23.1v-22.9l-46.6-30.7h46.6v-64h-46.6l46.6-30.7z"></path><path fill="#D80027" d="M144 0h-32v69.4H0v32h112V171h32v-69.6h112.5v-32H144z"></path><path fill="#D80027" d="M0 171v-11.3l62.5-42.3h22.6L7.3 171zM7.3.1l77.8 53.2H62.5L0 11.1V.1zM256.5.1v11l-63 42.3h-22.6L248.7.1zM248.7 171l-77.8-53.6h22.6l63 42.3V171z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Anguilla +1264</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 744 496"><path fill="#3A7DCE" d="M0 0h744v496H0V0z"></path><path fill="white" d="M120 125l90 63 54-14 23-81 61-36 92 14 105 55 6 90 34 12v92l-65 115-78 24-72-17 18-30-8-32-10 9-162-25-49-85 20-46-49-62z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Antarctica +672</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path d="M0 0h513v342H0z"></path><path fill="#186DD2" d="M88.8 136.5c-2.2 12.9-3.4 26.2-3.4 39.8 0 13.6 1.2 27 3.4 39.8L256 228.3l167.2-12.1c2.2-12.9 3.4-26.2 3.4-39.8s-1.2-27-3.4-39.8"></path><path fill="white" d="M423.2 219H88.8c15.8 69.8 84.7 122.3 167.2 122.3S407.4 288.8 423.2 219z"></path><path fill="#FFDA44" d="M365.9 136.5H146.1l44.9-21.1-23.9-43.5 48.8 9.4L222 32l34 36.2L290 32l6.1 49.3 48.8-9.4-23.9 43.5z"></path><g fill="#C32500"><path d="M256.5 342L0 0v342z"></path><path d="M513 342V0L256 342z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Antigua and Barbuda +1268</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h512v342H0z"></path><path fill="#338AF3" d="M0 0h512v114H0zM0 228h512v114H0z"></path><circle fill="#FFDA44" stroke="#d6ab00" stroke-width="5" cx="256.5" cy="171" r="40"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Argentina +54</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M0 0h513v114H0z"></path><path fill="#FF9811" d="M0 228h513v114H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Armenia +374</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 363 242"><path fill="#338AF3" d="M0 0h363v242H0z"></path><path fill="white" d="M57 96.9L14.7 78.2 57 59.6l18.6-42.2 18.6 42.2 42.3 18.6-42.3 18.7-18.6 42.2z"></path><path fill="#D80027" d="M75.6 40.6l11.5 26.1 26.1 11.5-26.1 11.5-11.5 26.1-11.5-26.1L38 78.2l26.1-11.5z"></path><g fill="#FFDA44"><path d="M0 152.2h363v15.7H0zM0 183.6h363v15.7H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Aruba +297</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><path fill="white" d="M440.1 181.1c-.1 39.2-6.4 81.4-57.4 101.5-51.1-20.1-57.3-62.3-57.4-101.5h114.8z"></path><path fill="#29DBFF" d="M439.6 197.7c-2.8 34.9-12.4 67.4-57 85-44.4-17.6-54.5-51.2-56.9-84.9"></path><path fill="white" d="M437.8 214.1c-3.2 24.3-16.7 53.5-55.1 68.6-38.4-15.1-50.5-42.5-55.1-68.4"></path><path fill="#29DBFF" d="M434.2 230.3c-5.7 17.7-19.3 39.4-51.3 52.8-32-12.6-45.2-33.8-51.4-53"></path><path fill="white" d="M426.7 246.9c-6.5 11.3-17.7 25.4-44 35.9-27.5-11.5-37.4-25.3-44-36.1"></path><path fill="#29DBFF" d="M412.4 265.1c-8.1 7.2-12 11.2-29.6 17.9-20.1-7.9-22.6-11.6-29.2-17.5"></path><path fill="#5CC85C" d="M383.3 231.6c-.2-.2-27.9 35.7-27.9 35.7-1.8-1.3-10-9.5-13.3-15l41.3-50.1 40.2 49.7c-3.9 6.5-11.4 13.6-13.2 15M382.6 85.3l-26.5 45h53z"></path><ellipse transform="rotate(-82.3 291.431 225.686)" fill="#F7A226" cx="291.4" cy="225.7" rx="48.7" ry="15.7"></ellipse><ellipse transform="rotate(-68.099 303.087 164.67)" fill="#DDC7AB" cx="303.1" cy="164.7" rx="11.7" ry="7.2"></ellipse><ellipse transform="rotate(-81.738 291.697 271.697)" fill="#DDC7AB" cx="291.7" cy="271.7" rx="11.4" ry="3.3"></ellipse><ellipse transform="matrix(.9986 -.05353 .05353 .9986 -13.992 16.424)" fill="#DDC7AB" cx="299.6" cy="269.4" rx="3.3" ry="11"></ellipse><ellipse transform="rotate(-21.518 314.54 201.06)" fill="#DDC7AB" cx="314.5" cy="201.1" rx="4.1" ry="13.7"></ellipse><ellipse transform="rotate(-21.518 317.511 178.077)" fill="#DDC7AB" cx="317.5" cy="178.1" rx="13.7" ry="4.1"></ellipse><ellipse transform="rotate(-7.7 473.781 225.857)" fill="#F7A226" cx="473.6" cy="225.9" rx="15.7" ry="48.7"></ellipse><ellipse transform="rotate(-21.901 462.057 164.866)" fill="#DDC7AB" cx="462" cy="164.9" rx="7.2" ry="11.7"></ellipse><ellipse transform="rotate(-8.27 473.27 271.908)" fill="#DDC7AB" cx="473.4" cy="271.9" rx="3.3" ry="11.4"></ellipse><ellipse transform="matrix(.05353 -.9986 .9986 .05353 171.34 719.998)" fill="#DDC7AB" cx="465.5" cy="269.6" rx="11" ry="3.3"></ellipse><ellipse transform="rotate(-68.482 450.552 201.247)" fill="#DDC7AB" cx="450.6" cy="201.2" rx="13.7" ry="4.1"></ellipse><ellipse transform="rotate(-68.482 447.58 178.265)" fill="#DDC7AB" cx="447.6" cy="178.3" rx="4.1" ry="13.7"></ellipse><path fill="#B0C6CC" d="M373.3 130.3L356.1 155l17.8 26.1H396l4.7-25.4-5.4-25.4z"></path><path fill="white" d="M256 0v117.4h-46.1l46.1 30.7v22.6h-22.6L160 121.8v48.9H96v-48.9l-73.4 48.9H0v-22.6l46.1-30.7H0v-64h46.1L0 22.7V0h22.6L96 48.9V0h64v48.9L233.4 0z"></path><path fill="#D80027" d="M144 0h-32v69.4H0v32h112v69.3h32v-69.3h112v-32H144z"></path><path fill="#2E52B2" d="M256 22.7v30.7h-46.1z"></path><g><path fill="#D80027" d="M0 170.7v-11l62.5-42.3h22.6L7.3 170.7z"></path></g><path fill="#D80027" d="M7.3.1l77.8 53.2H62.5L0 11.1V.1zM256 .1v11l-62.5 42.3h-22.6L248.7.1zM248.7 170.7l-77.8-53.3h22.6l62.5 42.3v11z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Ascension Island +247</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 114h513v114H0z"></path><path fill="#D80027" d="M0 0h513v114H0zM0 228h513v114H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Austria +43</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"></path><path fill="#338AF3" d="M0 0h513v114H0z"></path><path fill="#6DA544" d="M0 228h513v114H0z"></path><g fill="white"><path d="M265.6 212.6c-23 0-41.6-18.6-41.6-41.6s18.6-41.6 41.6-41.6c7.2 0 13.9 1.8 19.8 5-9.2-9-21.9-14.6-35.8-14.6-28.3 0-51.2 22.9-51.2 51.2s22.9 51.2 51.2 51.2c13.9 0 26.6-5.6 35.8-14.6-5.9 3.2-12.6 5-19.8 5z"></path><path d="M297.6 142.2l5.5 15.5 14.9-7.1-7.1 14.9 15.5 5.5-15.5 5.5 7.1 14.9-14.9-7.1-5.5 15.5-5.5-15.5-14.9 7.1 7.1-14.9-15.5-5.5 15.5-5.5-7.1-14.9 14.9 7.1z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Azerbaijan +994</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><g fill="#338AF3"><path d="M0 85.337h512v113.775H0zM0 312.888h512v113.775H0z"></path></g><path d="M256 256.006L0 426.668V85.331z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bahamas +1242</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M2.216 86.076H512v339.848H2.216z"></path><path fill="white" d="M209.455 154.969l-50.236 25.267 50.236 25.257-50.236 25.267 50.236 25.257-50.236 25.266 50.236 25.257-50.236 25.268 50.236 25.257-50.236 25.267 50.236 25.268-36.45 18.33H0V86.07h172.939l36.516 18.364-50.236 25.267z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bahrain +973</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.331h512v341.337H0z"></path><circle fill="#F40B32" cx="218.902" cy="255.994" r="115"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bangladesh +880</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.33"><path fill="#FFDA44" d="M0 0h512v341.34H0z"></path><g fill="#0052B4"><path d="M0 0h170.66v341.34H0zM341.34 0H512v341.34H341.34z"></path></g><path d="M325.74 101.02l-31.97 12.4c-.68 1.35-5.79 7.54-8.18 53.06h-17.05v-60.42L256 78.68l-12.54 27v60.8H226.4c-2.39-45.53-7.8-52.48-8.47-53.84l-31.68-11.63c.15.31 15.4 31.34 15.4 78.01v12.54h41.81v71.07h25.08v-71.07h41.81v-12.54c0-24.13 4.17-44.02 7.68-56.46 3.82-13.57 7.7-21.49 7.74-21.57l-.03.03z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Barbados +1246</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#75AF2B" d="M.6.2H512v341H.6z"></path><path fill="#D32424" d="M0 230h512V.2H0"></path><path fill="white" d="M100.1 230V.2H0v340.9h511.4-411.3z"></path><path fill="#D32424" d="M51.6 218l-38-47.7 38-46.9 38 46.9zM51.6 113.4l-38-47.7 38-46.9 38 46.9zM51.6 322.6l-38-47.7 38-46.9 38 46.9z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Belarus +375</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.326H0z"></path><path d="M0 85.331h170.663v341.337H0z"></path><path fill="#D80027" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Belgium +32</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#0052B4" d="M0 0h512v341.3H0z"></path><circle fill="white" cx="260.9" cy="170.9" r="118.9"></circle><circle fill="none" stroke="#6DA544" stroke-width="18" stroke-miterlimit="10" cx="261.9" cy="173.1" r="94.5"></circle><g stroke="black"><path fill="#0052B4" d="M261.9 151.5l-50.6 23.4v20c0 11.8 6.1 22.8 16.2 28.9L262 239l34.5-15.2c10-6.2 16.2-17.1 16.2-28.9v-20l-50.8-23.4z"></path><path fill="#FFDA44" d="M211.3 128.1h101.3v46.7H211.3z"></path></g><g fill="#BC0029"><path d="M0 0h512v35H0zM0 306h512v35H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Belize +501</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M196.641 85.337H512V256H196.641z"></path><path fill="#D80027" d="M196.641 256H512v170.663H196.641z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Benin +229</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.33"><path fill="#D80027" d="M0 0h512v341.34H0z"></path><path fill="#0052B4" d="M0 .1h256v170.6H0z"></path><path fill="white" d="M256 0h-22.6L160 48.9V0H96v48.9L22.6 0H0v22.7l46.1 30.7H0v64h46.1L0 148.1v22.6h22.6L96 121.8v48.9h64v-48.9l73.4 48.9H256v-22.6l-46.1-30.7H256v-64h-46.1L256 22.7z"></path><path fill="#D80027" d="M144 0h-32v69.4H0v32h112v69.3h32v-69.3h112v-32H144z"></path><path fill="#D80027" d="M0 170.7v-11l62.5-42.3h22.6L7.3 170.7zM7.3.1l77.8 53.2H62.5L0 11.1V.1zM256 .1v11l-62.5 42.3h-22.6L248.7.1zM248.7 170.7l-77.8-53.3h22.6l62.5 42.3v11z"></path><g transform="translate(13 5)"><path fill="white" d="M303.9 94.94v99.69c0 59.81 79.75 99.69 79.75 99.69s79.75-39.88 79.75-99.69V94.94H303.9z"></path><path fill="#2F8F22" d="M436.37 254.44H330.93c23.13 25.08 52.72 39.88 52.72 39.88s29.59-14.8 52.72-39.88z"></path><circle fill="#65B5D2" cx="383.65" cy="214.56" r="39.88"></circle><circle fill="#D80027" cx="343.77" cy="194.63" r="19.94"></circle><circle fill="#D80027" cx="423.52" cy="194.63" r="19.94"></circle><circle fill="#D80027" cx="383.65" cy="154.75" r="19.94"></circle></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bermuda +1441</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#FF7415" d="M0 0h512v341.3H0z"></path><path fill="#FFDA44" d="M512 0H0v341.3"></path><path fill="none" stroke="white" stroke-width="42" stroke-miterlimit="10" d="M128.7 255.5s35 54 67.3 32.4c56.9-37.9-68.9-108.6-2.9-152.6 58.3-38.8 76.6 103.5 137.6 62.8 59-39.3-64.7-111.4-9.2-148.4 33.4-22.2 67.1 32.6 67.1 32.6"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bhutan +975</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#6DA544" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bolivia +591</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.334h512v341.337H0z"></path><path fill="#FFDA44" d="M99.905 85.329h341.333v341.334"></path><g fill="white"><path d="M36.561 100.645l14.843-10.807 14.867 10.794-4.979-15.302H41.525z"></path><path d="M88.332 103.632L82.649 86.16l-5.672 17.472-18.365.012 14.867 10.796-5.661 17.461 14.843-10.806 14.866 10.795-5.684-17.474 14.854-10.795z"></path><path d="M119.59 134.89l-5.684-17.474-5.673 17.474-18.365.011 14.867 10.795-5.661 17.462 14.844-10.807 14.866 10.796-5.685-17.474 14.856-10.794z"></path><path d="M150.846 166.146l-5.683-17.473-5.673 17.473-18.364.011 14.866 10.796-5.661 17.461 14.843-10.806 14.866 10.795-5.683-17.474 14.855-10.794z"></path><path d="M182.103 197.403l-5.683-17.474-5.672 17.474-18.366.011 14.866 10.795-5.66 17.462 14.843-10.807 14.866 10.796-5.684-17.473 14.855-10.795z"></path><path d="M213.359 228.659l-5.683-17.472-5.672 17.472-18.365.012 14.866 10.795-5.66 17.462 14.842-10.806 14.866 10.794-5.683-17.473 14.855-10.795z"></path><path d="M244.616 259.916l-5.683-17.473-5.672 17.473-18.366.012 14.867 10.795-5.661 17.462 14.844-10.807 14.866 10.794-5.685-17.472 14.855-10.794z"></path><path d="M275.872 291.173L270.19 273.7l-5.673 17.473-18.365.011 14.867 10.796-5.661 17.461 14.843-10.806 14.866 10.795-5.683-17.474 14.853-10.794z"></path><path d="M307.13 322.43l-5.683-17.474-5.674 17.474-18.364.011 14.866 10.795-5.661 17.462 14.844-10.807 14.866 10.796-5.684-17.474 14.855-10.794z"></path><path d="M338.386 353.686l-5.683-17.472-5.672 17.472-18.365.012 14.866 10.795-5.661 17.462 14.843-10.807 14.866 10.795-5.683-17.472 14.855-10.796z"></path><path d="M369.643 384.943l-5.683-17.473-5.672 17.473-18.366.012 14.866 10.794-5.66 17.463 14.843-10.807 14.866 10.795-5.684-17.473 14.855-10.795z"></path><path d="M395.216 398.727l-5.672 17.472-18.365.012 14.394 10.453h19.278l14.414-10.476-18.366.011z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bosnia and Herzegovina +387</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><g fill="#338AF3"><path d="M0 322.783h512v103.88H0zM0 85.337h512v104.515H0z"></path></g><path d="M0 210.877h512v89.656H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Botswana +267</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#6DA544" d="M0 0h512v341.3H0z"></path><path fill="#FFDA44" d="M256 19.3l205.4 151.4L256 322 50.6 170.7z"></path><circle fill="white" cx="256" cy="170.7" r="86.5"></circle><g fill="#0052B4"><path d="M212.8 165.3c-15 0-29.5 2.3-43.2 6.5.6 47.2 39.1 85.3 86.4 85.3 29.3 0 55.2-14.6 70.8-36.9-26.7-33.4-67.9-54.9-114-54.9zM340.9 187.2c1-5.4 1.6-10.9 1.6-16.6 0-47.8-38.7-86.5-86.5-86.5-35.6 0-66.2 21.6-79.5 52.3 11.7-2.4 23.8-3.7 36.2-3.7 50.3.1 95.7 21 128.2 54.5z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Brazil +55</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0-.3h513V342H0V-.3z"></path><path fill="#0052B4" d="M462.9 198.1c-4 0-14-5-21-9-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-16 9-20 9s-14-5-20-9c-11-6-22-12-32.1-12-9 0-20 6-31.1 12-7 4-16 9-20 9s-13-5-20-9c-11-6-22-12-31.1-12-10 0-21 6-32.1 12-6 4-16 9-20 9s-13-5-20-9c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-17 9-21 9s-13-5-20-9c-10-6-20-12-30.1-12v22l19 10c11 6 21 12 31.1 12s21-6 32.1-12c6-4 16-10 20-10s13 6 20 10c11 6 21 12 31.1 12s20-6 31.1-12c7-4 17-10 21-10s13 6 20 10c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-10 20-10s14 6 21 10c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-10 20-10s14 6 20 10c11 6 22 12 32.1 12s20-6 31.1-12l19-10v-22c-10 0-20 6-30.1 12-7 4-16 9-20 9zM0 31.7l19 10c11 6 21 12 31.1 12s21-6 32.1-12c6-4 16-10 20-10s13 6 20 10c11 6 21 12 31.1 12s20-6 31.1-12c7-4 17-10 21-10s13 6 20 10c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-10 20-10s14 6 21 10c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-10 20-10s14 6 20 10c11 6 22 12 32.1 12s20-6 31.1-12l19-10v-22c-10 1-20 6-30.1 12-7 4-16 9-20 9s-14-5-21-9c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-16 9-20 9s-14-5-20-9c-11-6-22-12-32.1-12s-20 6-31.1 12c-7 4-16 9-20 9s-13-5-20-9c-11-6-22-12-31.1-12s-21 6-32.1 12c-6 4-16 9-20 9s-13-5-20-9c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-17 9-21 9s-13-5-20-9c-10-6-20-11-30.1-12v22zm462.9 55.2c-4 0-14-5-21-9-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-16 9-20 9s-14-5-20-9c-11-6-22-12-32.1-12-9 0-20 6-31.1 12-7 4-16 9-20 9s-13-5-20-9c-11-6-22-12-31.1-12-10 0-21 6-32.1 12-6 4-16 9-20 9s-13-5-20-9c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-17 9-21 9s-13-5-20-9c-10-6-20-12-30.1-12v22l19 9c11 6 21 12 31.1 12s21-6 32.1-12c6-4 16-9 20-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 17-9 21-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 21 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 20 9c11 6 22 12 32.1 12s20-6 31.1-12l19-9v-22c-10 0-20 6-30.1 12-7 3.9-16 9-20 9zm50.1 34c-10 1-20 6-30.1 12-7 4-16 10-20 10s-14-6-21-10c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-16 10-20 10s-14-6-20-10c-11-6-22-12-32.1-12s-20 6-31.1 12c-7 4-16 10-20 10s-13-6-20-10c-11-6-22-12-31.1-12s-21 6-32.1 12c-6 4-16 10-20 10s-13-6-20-10c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-17 10-21 10s-13-6-20-10c-10-6-20-11-30.1-12v23c4 1 13 5 19 9 11 6 21 12 31.1 12s21-6 32.1-12c6-4 16-9 20-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 17-9 21-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 21 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 20 9c11 6 22 12 32.1 12s20-6 31.1-12c6-4 15-8 19-9v-23zm-50.1 133.3c-4 0-14-5-21-9-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-16 9-20 9s-14-5-20-9c-11-6-22-12-32.1-12-9 0-20 6-31.1 12-7 4-16 9-20 9s-13-5-20-9c-11-6-22-12-31.1-12-10 0-21 6-32.1 12-6 4-16 9-20 9s-13-5-20-9c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-17 9-21 9s-13-5-20-9c-10-6-20-12-30.1-12v22l19 9c11 6 21 12 31.1 12s21-6 32.1-12c6-4 16-9 20-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 17-9 21-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 21 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 20 9c11 6 22 12 32.1 12s20-6 31.1-12l19-9v-22c-10 0-20 6-30.1 12-7 4-16 9-20 9zm50.1 34c-10 1-20 6-30.1 12-7 4-16 10-20 10s-14-6-21-10c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-16 10-20 10s-14-6-20-10c-11-6-22-12-32.1-12s-20 6-31.1 12c-7 4-16 10-20 10s-13-6-20-10c-11-6-22-12-31.1-12s-21 6-32.1 12c-6 4-16 10-20 10s-13-6-20-10c-11-6-21-12-31.1-12s-20 6-31.1 12c-7 4-17 10-21 10s-13-6-20-10c-10-6-20-11-30.1-12v23c4 0 13 5 19 9 11 6 21 12 31.1 12s21-6 32.1-12c6-4 16-9 20-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 17-9 21-9s13 5 20 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 21 9c11 6 21 12 31.1 12s20-6 31.1-12c7-4 16-9 20-9s14 5 20 9c11 6 22 12 32.1 12s20-6 31.1-12c6-4 15-9 19-9v-23z"></path><path fill="white" d="M0-.3h256v171H0V-.3z"></path><path d="M389.8 119.9H408v78.8h-18.3l.1-78.8zm0 117.8H408v75.1h-18.3l.1-75.1z" fill="#A2001D"></path><g fill="#D80027"><path d="M144-.3h-32v70H0v32h112v69h32v-69h112v-32H144v-70z"></path><path d="M0-.3v15l57 39h23L0-.3zM256-.3v15l-57 39h-23l80-54z"></path><path d="M0-.3v15l57 39h23L0-.3zM256-.3v15l-57 39h-23l80-54zM0 170.7v-15l57-38h23l-80 53zM256 170.7v-15l-57-38h-23l80 53z"></path></g><g fill="#2E52B2"><path d="M0 22.7v31h46l-46-31zm96-23v49L23-.3h73zM256 22.7v31h-46l46-31zm-96-23v49l73-49h-73z"></path><path d="M0 22.7v31h46l-46-31zm96-23v49L23-.3h73zM256 22.7v31h-46l46-31zm-96-23v49l73-49h-73zM0 147.7v-30h46l-46 30zm96 23v-49l-73 49h73zM256 147.7v-30h-46l46 30zm-96 23v-49l73 49h-73z"></path></g><path fill="#5DA51E" stroke="#45602C" stroke-width="4" stroke-miterlimit="10" d="M462.8 91.5h-29.1l25.7-25.7c4.5-4.4 4.5-11.4 0-15.8l-3.4-3.4c-4.4-4.4-11.4-4.4-15.8 0l-25.9 25.9V37.4c0-6.2-5.1-11.3-11.3-11.3h-4.7c-6.2 0-11.3 5.1-11.3 11.3v31.7l-23.5-23.8c-4.7-4.7-12.2-4.7-16.9 0l-3.6 3.6c-4.7 4.7-4.7 12.4 0 17.2l25 25.4h-30.6c-6 0-10.9 4.9-10.9 10.9v4.6c0 6 4.9 10.9 10.9 10.9H369l-20.7 20.7c-4.4 4.4-4.4 11.4 0 15.8l3.4 3.4c4.4 4.4 11.4 4.4 15.8 0l19.6-19.6V167c0 6.1 5.1 11.1 11.3 11.3h4.7c6.2 0 11.3-5.1 11.3-11.3v-28.3l22.2 22.6c4.7 4.7 12.4 4.7 17.1 0l3.6-3.6c4.7-4.7 4.7-12.4 0-17.2L435.2 118h27.6c5.9 0 10.7-4.9 10.9-10.9v-4.6c0-6.1-4.9-11-10.9-11z"></path><path fill="#E2DD24" stroke="#525625" stroke-width="4" stroke-miterlimit="10" d="M439.2 249.1h-79.8s-.9-13.4-6-21.8c-6.2-10.4-13.9-28.1-1.4-36.7 15.9-10.9 33.7.8 48.2.8 11.8.1 26.9-14 45-.8 12.2 8.9 3.9 28.2-1.3 36.7-7 11.5-4.7 21.8-4.7 21.8z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">British Indian Ocean Territory +246</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.33"><path fill="#FFDA44" d="M0 0h512v341.33H0z"></path><path d="M0 193.74l512 127.19V214.26L0 97.08z"></path><path fill="white" d="M512 234.26v-86.67L0 20.41v86.67"></path><g fill="#D80027" stroke="#231F20" stroke-width="3" stroke-miterlimit="10"><path d="M306.4 134.01a50.28 50.28 0 016.07 24.02c0 21.55-13.51 39.94-32.52 47.19v-59.51c5.7-1.19 10-6.37 10-12.59 6.9 0 12.5-5.75 12.5-12.85h-.42c6.9 0 12.91-5.75 12.91-12.85h-34.99V76.58l-14.99-27.71-15 27.71v30.84h-34.99c0 7.1 6.01 12.85 12.91 12.85h-.42c0 7.1 5.6 12.85 12.5 12.85 0 6.22 4.29 11.4 9.99 12.59v61.37c-22.09-5.39-38.48-25.3-38.48-49.05 0-8.7 2.2-16.88 6.07-24.02-10.96 11.21-17.72 26.53-17.72 43.44 0 34.32 27.82 62.15 62.15 62.15s62.15-27.83 62.15-62.15c0-16.91-6.77-32.24-17.72-43.44z"></path><path d="M198.46 226.81s20.69 27.71 66.5 27.71 66.5-27.71 66.5-27.71l13.47 28.37s-21.03 27.71-79.97 27.71-79.97-27.71-79.97-27.71l13.47-28.37zM129.24 133.18h20.88l24.93 27.26v73.45h-26.28v-68.37zM400 133.18h-20.88l-24.93 27.26v73.45h26.27v-68.37z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Brunei Darussalam +673</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.337h512v341.326H0z"></path><path fill="white" d="M0 85.337h512v113.775H0z"></path><path fill="#D80027" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Bulgaria +359</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#6DA544" d="M0 0h512v341.3H0z"></path><path fill="#D80027" d="M0 0h512v170.7H0z"></path><path fill="#FFDA44" d="M256 66.9l25.8 79.3h83.3l-67.4 49 25.7 79.3-67.4-49-67.4 49 25.7-79.3-67.4-49h83.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Burkina Faso +226</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#D80027" d="M0 0h512v341.3H0z"></path><g fill="#6DA544"><path d="M215.9 170.7L0 314.6V26.8zM512 26.8v287.8L296.1 170.7z"></path></g><path fill="#0052B4" d="M512 26.8L296.1 170.7 512 314.6v26.7h-40.1L256 197.4 40.1 341.3H0v-26.7l215.9-143.9L0 26.8V0h40.1L256 143.9 471.9 0H512z"></path><path fill="white" d="M512 26.8L296.1 170.7 512 314.6v26.7h-40.1L256 197.4 40.1 341.3H0v-26.7l215.9-143.9L0 26.8V0h40.1L256 143.9 471.9 0H512z"></path><circle fill="white" cx="251.6" cy="170.7" r="100.2"></circle><g fill="#D80027"><path d="M251.6 93.3l10.1 17.5h20.2l-10.1 17.5 10.1 17.5h-20.2l-10.1 17.5-10.1-17.5h-20.2l10.1-17.5-10.1-17.5h20.2zM210.3 163.4l10.1 17.5h20.3l-10.1 17.5 10.1 17.5h-20.3l-10.1 17.5-10.1-17.5H180l10.1-17.5-10.1-17.5h20.2zM292.8 163.4l10.1 17.5h20.2L313 198.4l10.1 17.5h-20.2l-10.1 17.5-10.1-17.5h-20.2l10.1-17.5-10.1-17.5h20.2z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Burundi +257</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><g fill="#0052B4"><path d="M0 85.337h512v113.775H0zM0 312.888h512v113.775H0z"></path></g><path fill="white" d="M303.49 281.971v-17.809h-11.873v-23.745l-11.872-11.872-11.872 11.872v-23.744L256 204.8l-11.873 11.873v23.744l-11.872-11.872-11.872 11.872v23.745H208.51v17.809h-11.872v17.808h118.724v-17.808z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cambodia +855</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#D80027" d="M0 0h512v341.3H0z"></path><path fill="#496E2D" d="M0 0h170.7v341.3H0z"></path><g fill="#FFDA44"><path d="M341.3 0H512v341.3H341.3zM256 102.2l17.2 53H329L283.9 188l17.2 53-45.1-32.7-45.1 32.7 17.2-53-45.1-32.8h55.8z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cameroon +237</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#0052B4" d="M0 0h512v341.3H0z"></path><path fill="#D80027" d="M0 182.2h512v41.4H0z"></path><path fill="white" d="M0 140.8h512v41.4H0zM0 223.6h512V265H0z"></path><g fill="#FFDA44" stroke="black" stroke-miterlimit="10"><path d="M150.4 70l6.9 21.1h22.2l-18 13.1 6.9 21.1-18-13.1-17.9 13.1 6.8-21.1-17.9-13.1h22.2zM150.4 279.7l6.9 21.1h22.2l-18 13 6.9 21.2-18-13.1-17.9 13.1 6.8-21.2-17.9-13h22.2zM52.8 208.8l6.9 21.1h22.2l-18 13 6.9 21.2-18-13.1-17.9 13.1 6.8-21.2-17.9-13H46zM90.1 91l6.9 21.1h22.2l-18 13 6.9 21.2-18-13.1-17.9 13.1 6.8-21.2-18-13h22.3zM23.8 162H46l6.8-21.1 6.9 21.1h22.2l-18 13.1 6.9 21.1-18-13-17.9 13 6.8-21.1zM72.2 310.9l6.8-21.1-18-13h22.3l6.8-21.2 6.9 21.2h22.2l-18 13 6.9 21.1-18-13zM248 208.8l-6.9 21.1h-22.2l18 13-6.9 21.2 18-13.1 18 13.1-6.9-21.2 18-13h-22.2zM210.7 91l-6.8 21.1h-22.2l17.9 13-6.8 21.2 17.9-13.1 18 13.1-6.9-21.2 18-13h-22.2zM277.1 162h-22.2l-6.9-21.1-6.9 21.1h-22.2l18 13.1-6.9 21.1 18-13 18 13-6.9-21.1zM228.7 310.9l-6.9-21.1 18-13h-22.2l-6.9-21.2-6.8 21.2h-22.2l17.9 13-6.8 21.1 17.9-13z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cape Verde +238</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.334h512v341.337H0z"></path><circle fill="#6DA544" cx="384" cy="181.79" r="29.682"></circle><path fill="#D80027" d="M332.054 174.377h103.88v44.522h-103.88z"></path><path fill="#496E2D" d="M435.942 255.997v-.001.001z"></path><path fill="#FFDA44" d="M332.058 285.678v29.682h15.616c9.364 9.176 22.18 14.84 36.326 14.84 14.147 0 26.962-5.664 36.326-14.84h15.616v-29.682H332.058z"></path><path fill="#338AF3" d="M332.058 211.475v44.522c0 39.759 51.942 51.942 51.942 51.942s51.942-12.182 51.942-51.942v-44.522H332.058z"></path><g fill="#F3F3F3"><path d="M383.997 235.256c-12.985 0-12.985 11.873-25.97 11.873s-12.985-11.873-25.97-11.873v20.777c12.985 0 12.985 11.873 25.97 11.873s12.985-11.873 25.97-11.873c12.986 0 12.986 11.873 25.973 11.873 12.986 0 12.986-11.873 25.973-11.873v-20.777c-12.986 0-12.986 11.873-25.973 11.873-12.986-.001-12.986-11.873-25.973-11.873zM383.997 193.666c-12.985 0-12.985 11.873-25.97 11.873s-12.985-11.873-25.97-11.873v20.777c12.985 0 12.985 11.873 25.97 11.873s12.985-11.873 25.97-11.873c12.986 0 12.986 11.873 25.973 11.873 12.986 0 12.986-11.873 25.973-11.873v-20.777c-12.986 0-12.986 11.873-25.973 11.873-12.986 0-12.986-11.873-25.973-11.873z"></path></g><path fill="white" d="M256 85.334v22.617l-46.069 30.709H256v64h-46.069L256 233.38v22.617h-22.628L160 207.078v48.919H96v-48.919l-73.372 48.919H0V233.38l46.069-30.72H0v-64h46.069L0 107.951V85.334h22.628L96 134.241V85.334h64v48.907l73.372-48.907z"></path><g fill="#D80027"><path d="M144 85.329h-32v69.334H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path d="M0 85.329v15.082l57.377 38.252H80zM256 85.329v15.082l-57.377 38.252H176z"></path><path d="M0 85.329v15.082l57.377 38.252H80zM256 85.329v15.082l-57.377 38.252H176zM0 255.997v-15.082l57.377-38.252H80zM256 255.997v-15.082l-57.377-38.252H176z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cayman Islands +1345</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#D80027" d="M0 0h512v341.3H0z"></path><g fill="#6DA544"><path d="M0 170.7h211.5V256H0zM300.5 170.7H512V256H300.5z"></path></g><path fill="#0052B4" d="M0 0v85.3h211.5V0h89v85.3H512V0z"></path><g fill="white"><path d="M300.5 85.3H512v85.3H300.5zM0 85.3h211.5v85.3H0z"></path></g><g fill="#FFDA44"><path d="M300.5 341.3h-89V256H0v85.3h512V256H300.5zM105.7 8.6l8.6 26.2h27.5L119.5 51l8.6 26.2L105.7 61 83.4 77.2 91.9 51 69.6 34.8h27.6z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Central African Republic +236</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.337H0z"></path><path fill="#0052B4" d="M0 85.331h170.663v341.337H0z"></path><path fill="#D80027" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Chad +235</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="white" d="M256 85.337h256V256H256z"></path><path fill="#0052B4" d="M0 85.337h256V256H0z"></path><path fill="white" d="M128 109.801l15.108 46.498H192l-39.554 28.739 15.108 46.498L128 202.799l-39.554 28.737 15.108-46.498L64 156.299h48.892z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Chile +56</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#D80027" d="M0 0h512v341.3H0z"></path><g fill="#FFDA44"><path d="M352.3 312.6L328 294.9l-24.4 17.7 9.3-28.6-24.3-17.7h30.1l9.3-28.6 9.3 28.6h30.1L343 284zM415.9 120.9l-24.4 17.7 9.3 28.6-24.3-17.7-24.4 17.7 9.3-28.6-24.3-17.7h30.1l9.3-28.6 9.3 28.6zM367.4 57.4L343 75l9.3 28.7L328 86l-24.4 17.7 9.3-28.7-24.3-17.6h30.1l9.3-28.7 9.3 28.7zM415.9 204.4L391.5 222l9.3 28.7-24.3-17.7-24.4 17.7 9.3-28.7-24.3-17.6h30.1l9.3-28.7 9.3 28.7z"></path></g><path fill="#FFDA44" d="M167.6 64.4l26 80.3h84.5l-68.3 49.6 26.1 80.4-68.3-49.7-68.4 49.7 26.1-80.4L57 144.7h84.5z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">China +86</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#0052B4" d="M0 0h512v341.3H0z"></path><path fill="#6DA544" d="M0 0h512v341.3"></path><g fill="white"><path d="M77.6 272l5.7 11.9 12.8-3-5.7 11.9 10.3 8.1-12.8 2.9V317l-10.3-8.3-10.2 8.3v-13.2l-12.8-2.9 10.3-8.1-5.8-11.9 12.9 3zM40.5 173.1l5.7 11.9 12.8-3-5.7 11.8 10.3 8.2-12.9 2.9.1 13.2-10.3-8.3-10.3 8.3.1-13.2-12.9-2.9 10.4-8.2L22 182l12.8 3zM77.6 92.2l5.7 11.8 12.8-2.9-5.7 11.8 10.3 8.2-12.8 2.9v13.1l-10.3-8.2-10.2 8.2V124l-12.8-2.9 10.3-8.2-5.8-11.8L72 104zM123.7 155.1l5.7 11.9 12.8-3-5.7 11.9 10.3 8.1-12.8 2.9v13.2l-10.3-8.2-10.2 8.2v-13.2l-12.8-2.9 10.3-8.1-5.7-11.9 12.8 3zM90.8 209.1l4.4 13.7h14.5L98 231.3l4.5 13.7-11.7-8.4-11.7 8.4 4.5-13.7-11.7-8.5h14.4z"></path></g><circle fill="#FFDA44" cx="267.1" cy="170.7" r="74.5"></circle><path fill="#6DA544" d="M267.1 220.3h24.8s10.8-19 0-37.2l24.8-24.8-12.4-24.8h-12.4s-6.2 18.6-31 18.6-31-18.6-31-18.6h-12.4l12.4 24.8-12.4 24.8 12.4 12.4s12.4-24.8 37.2-12.4c0 0 10.5 15.5 0 37.2z"></path><path fill="#FFDA44" d="M464.4 92.2c.6-2.9-.2-17.6-.2-20.7 0-21.3-13.9-39.4-33.2-45.7 5.9 12 9.2 25.4 9.2 39.7 0 4.8-.4 9.5-1.1 14.1-2.9-4.7-6.6-8.9-11.2-12.6-17.1-13.6-40.6-14-57.9-2.5 13.4 2.9 26.3 8.9 37.7 18 9 7.1 16.2 16.8 21.7 26.1 0 0-17.8 10.9-31 15.1s-42.3 7.9-42.3 7.9c72 12 132-36 132-36-6.5-13.4-15.8-4-23.7-3.4z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Christmas Island +61</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#6DA544" d="M0 0h512v341.3H0z"></path><g fill="#FFDA44"><path d="M422.7 252.4l6.2 12.8 13.8-3.2-6.2 12.8 11.2 8.8-13.9 3.2V301l-11.1-8.9-11.1 8.9v-14.2l-13.8-3.2 11.1-8.8-6.2-12.8 13.9 3.2zM376.1 116.1l6.2 12.9 13.8-3.2-6.2 12.8 11.2 8.8-13.9 3.1v14.3l-11.1-8.9-11.1 8.9.1-14.3-13.9-3.1 11.1-8.8-6.2-12.8L370 129zM413.1 38.3l6.2 12.8 13.8-3.2-6.2 12.8 11.2 8.9-13.9 3.1v14.2L413.1 78 402 86.9l.1-14.2-13.9-3.1 11.1-8.9-6.2-12.8 13.9 3.2zM464.9 96.7l6.2 12.8 13.9-3.2-6.3 12.8 11.2 8.9-13.9 3.1.1 14.2-11.2-8.9-11.1 8.9.1-14.2L440 128l11.2-8.9-6.3-12.8 13.9 3.2zM436.9 164.8l4.9 14.8h15.6l-12.6 9.2 4.8 14.9-12.7-9.2-12.6 9.2 4.8-14.9-12.6-9.2h15.6z"></path></g><path fill="#FFDA44" d="M306.8 254.7c-49.2 0-89.1-39.9-89.1-89.1s39.9-89.1 89.1-89.1c15.3 0 29.8 3.9 42.4 10.7C329.4 67.9 302.3 56 272.5 56c-60.5 0-109.6 49.1-109.6 109.6S212 275.3 272.5 275.3c29.8 0 56.9-11.9 76.6-31.3-12.6 6.8-27 10.7-42.3 10.7zM140.4 59.5C129.7 41 109.7 28.6 86.8 28.6S44 41 33.3 59.5h107.1zM140.6 59.9l-53.8 53.8-53.7-53.8C28 68.9 25 79.3 25 90.5c0 34.2 27.7 61.9 61.9 61.9s61.9-27.7 61.9-61.9c-.1-11.2-3.1-21.6-8.2-30.6z"></path><path fill="#A2001D" d="M71.4 98.2v52.2c4.9 1.3 10.1 1.9 15.5 1.9s10.5-.7 15.5-1.9V98.2h-31z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cocos (Keeling) Islands +61</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 343.096h512v83.567H0z"></path><path fill="#0052B4" d="M0 256h512v87.096H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Colombia +57</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M0 85.337h512v85.337H0z"></path><path fill="white" d="M0 170.663h512V256H0z"></path><path fill="#D80027" d="M0 256h512v85.337H0z"></path><path fill="#6DA544" d="M256 256.006L0 426.668V85.331z"></path><g fill="white"><path d="M68.638 256c0-24.865 17.476-45.638 40.812-50.734a52.059 52.059 0 00-11.13-1.208c-28.688 0-51.942 23.255-51.942 51.942s23.255 51.942 51.942 51.942c3.822 0 7.543-.425 11.13-1.208-23.337-5.096-40.812-25.869-40.812-50.734z"></path><path d="M108.877 211.478l2.762 8.503h8.94l-7.232 5.256 2.762 8.502-7.232-5.255-7.234 5.255 2.764-8.502-7.234-5.256h8.94zM108.877 233.739l2.762 8.503h8.94l-7.232 5.255 2.762 8.503-7.232-5.255-7.234 5.255 2.764-8.503-7.234-5.255h8.94zM108.877 256l2.762 8.503h8.94l-7.232 5.255 2.762 8.503-7.232-5.255-7.234 5.255 2.764-8.503-7.234-5.255h8.94zM108.877 278.261l2.762 8.502h8.94l-7.232 5.256 2.762 8.503-7.232-5.255-7.234 5.255 2.764-8.503-7.234-5.256h8.94z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Comoros +269</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.337H0z"></path><path fill="#6DA544" d="M443.726 85.331L102.4 426.657H0V85.331z"></path><path fill="#FFDA44" d="M500.124 85.331L158.798 426.657H11.876L353.202 85.331z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Congo +242</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.332h512v341.337H0z"></path><g fill="white"><path d="M384 156.705l5.283 16.254h17.089l-13.826 10.045 5.281 16.254L384 189.211l-13.825 10.047 5.28-16.254-13.825-10.045h17.089zM313.791 185.786l15.228 7.758 12.084-12.083-2.673 16.879 15.227 7.759-16.879 2.673-2.674 16.88-7.76-15.227-16.878 2.673 12.086-12.084zM284.71 255.995l16.254-5.281.001-17.089 10.044 13.825 16.254-5.282-10.046 13.827 10.046 13.826-16.254-5.28-10.044 13.825v-17.09zM313.791 326.204l7.759-15.229-12.084-12.084 16.881 2.674 7.757-15.227 2.674 16.879 16.879 2.672-15.227 7.759 2.673 16.882-12.084-12.087zM384 355.284l-5.281-16.253h-17.091l13.827-10.045-5.28-16.254L384 322.776l13.827-10.044-5.281 16.254 13.826 10.045h-17.089zM454.209 326.204l-15.229-7.758-12.083 12.084 2.673-16.882-15.227-7.756 16.879-2.675 2.675-16.879 7.756 15.227 16.881-2.674-12.086 12.085zM483.29 255.995l-16.254 5.281v17.09l-10.045-13.826-16.254 5.281 10.046-13.826-10.046-13.827 16.254 5.282 10.045-13.825v17.089zM454.209 185.788l-7.757 15.226 12.082 12.084-16.881-2.673-7.756 15.227-2.675-16.88-16.879-2.675 15.227-7.757-2.673-16.878 12.084 12.082zM0 186.665v16h46.069L0 233.377v7.539l57.377-38.252H80L0 255.998h112v-69.334H0zm96 69.331H22.628L96 207.083v48.913zM176 138.665l80-53.334H144v69.334h112v-16h-46.069L256 107.951v-7.539l-57.377 38.251H176v.002zm-16-53.332h73.372L160 134.246V85.333zM144 255.998h112l-80-53.334h22.623L256 240.917v-7.539l-46.069-30.713H256v-16H144v69.333zm16-48.915l73.372 48.913H160v-48.913zM112 85.331H0l80 53.334H57.377L0 100.413v7.539l46.069 30.712H0v16h112V85.331zm-16 48.915L22.628 85.333H96v48.913z"></path></g><g fill="#D80027"><path d="M144 85.331h-32v69.334H0v32h112v69.333h32v-69.333h112v-32H144z"></path><path d="M80 138.665L0 85.331v15.082l57.377 38.252zM176 138.665h22.623L256 100.413V85.331zM57.377 202.665L0 240.917v15.081l80-53.333zM176 202.665l80 53.333v-15.081l-57.377-38.252z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cook Islands +682</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.326H0z"></path><path fill="#D80027" d="M0 211.473h512v89.043H0z"></path><g fill="#0052B4"><path d="M0 352.462h512v74.207H0zM0 85.331h512v74.207H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Costa Rica +506</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.326H0z"></path><path fill="#6DA544" d="M330.207 85.331H512v341.337H330.207z"></path><path fill="#FF9811" d="M0 85.331h181.793v341.337H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cote d'Ivoire +225</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M0 0h513v114H0z"></path><path fill="#0052B4" d="M0 228h513v114H0z"></path><g fill="#338AF3"><path d="M309.3 113.2v-44l17.5-14.4 17.7 14.4v44zM203.7 113.2v-44l-17.3-14.4-17.9 14.4v44zM238.9 113.2v-44l17.6-14.4 17.6 14.4v44z"></path></g><g fill="#0052B4"><path d="M309.3 113.2h-35.2v-44l17.5-14.4 17.7 14.4zM238.9 113.2h-35.2v-44l17.5-14.4 17.7 14.4z"></path></g><path stroke="#D80027" fill="white" d="M168.5 113.2v101.9c0 24.3 14.4 46.2 35.4 59.4 21.3 13.4 42.1 14.7 52.6 14.7s31.4-1.7 52.6-14.8c21-13 35.4-35.1 35.4-59.3V113.2h-176z"></path><g fill="#D80027"><path d="M168.5 113.2h35.2v35.2h-35.2zM238.9 113.2h35.2v35.2h-35.2zM309.3 113.2h35.2v35.2h-35.2zM203.7 148.4h35.2v35.2h-35.2zM274.1 148.4h35.2v35.2h-35.2zM168.5 183.6h35.2v35.2h-35.2zM203.7 218.8h35.2V254h-35.2zM238.9 183.6h35.2v35.2h-35.2zM309.3 183.6h35.2v35.2h-35.2zM274.1 218.8h35.2V254h-35.2zM309.3 274.3c8.6-5.4 16.2-12.3 22-20.3h-22v20.3zM181.7 254c5.8 8 13.3 14.9 22 20.4V254h-22zM238.9 254v33.7c7.2 1.2 13.3 1.5 17.6 1.5 4.3 0 10.4-.3 17.6-1.6V254h-35.2z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Croatia +385</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#FF9811" d="M0-40.8v422.9-211.4z"></path><path fill="white" d="M0 0h512v341.3H0z"></path><g fill="#0052B4"><path d="M0 0h512v68.3H0zM0 136.5h512v68.3H0zM0 273.1h512v68.3H0z"></path></g><path fill="#D80027" d="M256 170.7L0 341.3V0z"></path><path fill="white" d="M81.5 94.8l16.9 51.9H153l-44.2 32.1 16.9 52-44.2-32.1-44.2 32.1 16.9-52L10 146.7h54.6z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cuba +53</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><path fill="#6DA544" d="M371.5 275.9l-11.1-15c-22.4 16.1-67.7 35.8-104.3 35.8-35.8 0-79.6-17.1-104.3-35.8l-11.1 15c10 10.3 46.9 27 88.4 38.4-3.9 6-1.6 6.1 2.6 10.8 8.5-6.6 17.4-1.5 24.9-7.3 7.5 5.8 16.3.7 24.9 7.3 5.4-5.6 5.4-5.6 2.5-11.1 41-11.7 77-27.6 87.5-38.1z"></path><path fill="#DB7D00" d="M113.7 168.7s.2 79.9 89 77.8L208 263h10.6s-8.9-49 71.7-49.4c0 0 0-32.9 32.9-32.9h49.4S294 119 442.8 40.1l2.2-15.6s-154.8 84.6-237 68.1c0 0 12.7 50.7-12.9 50.7-12.8 0-11.6-9.6-38.4-9.6-22.3 0-20.6 23.5-31.3 23.2S103 142.3 102 144.8s11.7 23.9 11.7 23.9z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Cyprus +357</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M512 256v170.663H0L215.185 256z"></path><path fill="white" d="M512 85.337V256H215.185L0 85.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Czech Republic +420</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#338AF3" d="M0 0h512v341.3H0z"></path><path fill="#FFDA44" d="M512 66.9V0H411.7L0 274.4v66.9h100.3z"></path><path fill="#D80027" d="M512 0v40.1L60.2 341.3H0v-40.1L451.8 0z"></path><path fill="#FFDA44" d="M93.6 31.2l16.3 50.4H163l-42.9 31.2 16.4 50.5-42.9-31.2-43 31.2L67 112.8 24.1 81.6h53.1z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Democratic Republic of the Congo +243</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"></path><path fill="white" d="M190 0h-60v140H0v60h130v142h60V200h323v-60H190z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Denmark +45</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#6DA544" d="M0 0h512v341.3H0z"></path><path fill="#338AF3" d="M512 0v166.7L0 170.8V0z"></path><path fill="white" d="M256 170.7L0 341.3V0z"></path><path fill="#D80027" d="M89.8 92.5l17 52.4H162l-44.6 32.5 17 52.4-44.6-32.4-44.6 32.4 17-52.4-44.6-32.5h55.2z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Djibouti +253</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#496E2D" d="M0 0h512v341.3H0z"></path><path d="M0 110.7v120h512v-120z"></path><path fill="#FFDA44" d="M0 110.7h512v40H0z"></path><path fill="white" d="M0 190.7h512v40H0z"></path><path d="M196 0h120v341.3H196z"></path><path fill="#FFDA44" d="M196 0h40v341.3h-40z"></path><path fill="white" d="M274.7 0h40v341.3h-40z"></path><circle fill="#D80027" cx="256" cy="170.7" r="123.1"></circle><g fill="#496E2D"><path d="M256 58.6l4.6 14.2h15l-12.1 8.9 4.6 14.2-12.1-8.8-12.1 8.8 4.6-14.2-12.1-8.9h15zM190.1 80l12.2 8.8 12.1-8.8-4.6 14.3 12.1 8.8h-15l-4.6 14.2-4.7-14.2h-15l12.1-8.8zM149.4 136h15l4.6-14.2 4.7 14.2h15l-12.2 8.8 4.7 14.3-12.2-8.8-12.1 8.8 4.6-14.3zM149.4 205.3l12.1-8.8-4.6-14.3L169 191l12.2-8.8-4.7 14.3 12.2 8.8h-15l-4.7 14.3-4.6-14.3zM190.1 261.4l4.6-14.3-12.1-8.8h15l4.7-14.3 4.6 14.3h15l-12.1 8.8 4.6 14.3-12.1-8.9zM256 282.8l-4.6-14.3h-15l12.1-8.8-4.6-14.3 12.1 8.8 12.1-8.8-4.6 14.3 12.1 8.8h-15zM321.9 261.4l-12.2-8.9-12.1 8.9 4.6-14.3-12.1-8.8h15l4.6-14.3 4.7 14.3h15l-12.1 8.8zM362.6 205.3h-15l-4.6 14.3-4.7-14.3h-15l12.2-8.8-4.7-14.3L343 191l12.1-8.8-4.6 14.3zM362.6 136l-12.1 8.8 4.6 14.3-12.1-8.8-12.2 8.8 4.7-14.3-12.2-8.8h15l4.7-14.2 4.6 14.2zM321.9 80l-4.6 14.3 12.1 8.8h-15l-4.7 14.2-4.6-14.2h-15l12.1-8.8-4.6-14.3 12.1 8.8z"></path></g><path fill="#496E2D" d="M279.3 168.7c-11-21.1-14.5-25.1-14.5-25.1s.4-9.7.4-15.6c0-8.8-7.4-15.8-16.5-15.8-8.6 0-15.7 2.9-16.5 11-4.2.9-8.6 4.1-8.6 10.7 0 4.8 1 7.3 5.2 9.3 2.1-4.6 4.3-4.8 9.3-6.4.8.6 1.7 3 2.6 3.4l.3 1s-13.3 6.6-13.3 30.9c0 29.5 22 45.4 22 45.4l-1.8.3-1.9 7.1h22v-7.2l11 17.5c.3-.3 10.2-47.6.3-66.5z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Dominica +1767</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><path fill="#D80027" d="M0 215.2h211.5v126.1H0z"></path><path fill="#0052B4" d="M0 0h211.5v126.2H0z"></path><path fill="#D80027" d="M300.5 0H512v126.2H300.5z"></path><path fill="#0052B4" d="M300.5 215.2H512v126.1H300.5z"></path><g stroke="white" stroke-width="5" stroke-miterlimit="10"><path fill="#0052B4" d="M256 130h-49.9v49.4s19.5 6 49.9 6V130z"></path><path fill="#D80027" d="M206.1 179.4v6c0 27.5 22.3 49.9 49.9 49.9v-49.9c-30.4 0-49.9-6-49.9-6z"></path><path fill="#0052B4" d="M256 235.3c27.5 0 49.9-22.3 49.9-49.9v-6s-19.5 6-49.9 6v49.9z"></path><path fill="#D80027" d="M256 130v55.4c30.4 0 49.9-6 49.9-6V130H256z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Dominican Republic +1849</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#FFDA44" d="M0 0h512v341.3H0z"></path><path fill="#0052B4" d="M0 170.7h512V256H0z"></path><path fill="#D80027" d="M0 256h512v85.3H0z"></path><circle fill="#FFDA44" cx="256" cy="170.7" r="59.4"></circle><path fill="#4C1F00" d="M369.2 79.9s-27.2-13.8-33.9-16c-6.7-2.2-49.1-13.2-49.1-7 0 10.3-13.5 12-15.5 12s-2-5.3-14.8-5.3-13.7 4.8-15.8 4.8c-2.2 0-14.5-1-14.5-11.5 0-5.2-42.9 4-49.1 7-6.1 3.1-33.9 16-33.9 16s45.8 2.7 53.9 6.2 43.8 16.5 43.8 16.5l-2.8 13.3h37.8l-3.8-13.3s35.1-12.7 43.8-16.5 53.9-6.2 53.9-6.2z"></path><path fill="#57BA17" d="M217.7 171.7c0 21.1 17.2 38.3 38.3 38.3 21.1 0 38.3-17.2 38.3-38.3v-11.5h-76.5v11.5z"></path><path fill="#338AF3" d="M256 110.5c-21.1 0-38.3 17.2-38.3 38.3v11.5h76.5v-11.5c.1-21.1-17.1-38.3-38.2-38.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Ecuador +593</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><path fill="#D80027" d="M0 0h512v113.8H0z"></path><path d="M0 227.6h512v113.8H0z"></path><path fill="#C09300" d="M220.3 204.4s0-58.4 4.5-64.7c3.1-4.3 16.8 5.2 22.7 4.5 0 0 4.2-7.5 4.5-12 .3-4.6-1.1-7.6-4.9-6.2 0 0-1.2-2.1.5-3.3 1.6-1.2 5.6.1 5.6.1s-.5-1 1.6-.9c2.9.2 7.2 1.4 7.4 5.6.2 3.1.3 7.7.4 8.7.7 6.8 2.7 8.7 2.7 8.7s18.4-9.2 22-5.2c3.3 3.8 4.5 64.7 4.5 64.7l-18.1-16.8 12.1 29.5s-14.4 2.4-28.9 2.4c-14.5 0-31.1-4.2-31.1-4.2l13.8-28.2-19.3 17.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Egypt +20</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><g fill="#0052B4"><path d="M0 85.337h512v113.775H0zM0 312.888h512v113.775H0z"></path></g><path fill="#FFDA44" d="M228.582 261.936L256 214.447l27.418 47.489z"></path><path fill="#6DA544" d="M291.616 277.616L256 295.425l-35.616-17.809v-23.744h71.232z"></path><path fill="#FFDA44" d="M289.579 216.485l-12.592 12.592c5.37 5.372 8.693 12.791 8.693 20.988 0 16.392-13.289 29.68-29.68 29.68-16.392 0-29.68-13.289-29.68-29.68 0-8.195 3.322-15.616 8.693-20.988l-12.592-12.592c-8.594 8.594-13.91 20.466-13.91 33.579 0 26.228 21.261 47.489 47.489 47.489s47.489-21.261 47.489-47.489c0-13.114-5.316-24.987-13.91-33.579z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">El Salvador +503</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#6DA544" d="M0 0h513v113.8H0z"></path><path fill="#D80027" d="M0 227.6h513V342H0z"></path><path fill="#0070C8" d="M126 170.7L0 341.3V0z"></path><path fill="none" stroke="black" stroke-miterlimit="10" d="M233.8 139.4v40.4c0 35.6 35.6 35.6 35.6 35.6s35.6 0 35.6-35.6v-40.4h-71.2z"></path><path fill="#786145" d="M264.5 179.8h9.8l4 25.8h-17.8z"></path><path fill="#6DA544" d="M287.2 162c0-9.8-8-14.8-17.8-14.8s-17.8 5-17.8 14.8c-4.9 0-8.9 4-8.9 8.9s4 8.9 8.9 8.9h35.6c4.9 0 8.9-4 8.9-8.9s-4-8.9-8.9-8.9z"></path><g fill="#FFDA00" stroke="black" stroke-miterlimit="10"><path d="M230.7 120l1.9 3.3h3.8l-1.9 3.3 1.9 3.2h-3.8l-1.9 3.3-1.9-3.3H225l1.9-3.2-1.9-3.3h3.8zM246 120l1.9 3.3h3.7l-1.9 3.3 1.9 3.2h-3.7l-1.9 3.3-1.9-3.3h-3.8l1.9-3.2-1.9-3.3h3.8zM261.3 120l1.9 3.3h3.7l-1.9 3.3 1.9 3.2h-3.7l-1.9 3.3-1.9-3.3h-3.8l1.9-3.2-1.9-3.3h3.8zM277.1 120l1.9 3.3h3.8l-1.9 3.3 1.9 3.2H279l-1.9 3.3-1.9-3.3h-3.7l1.8-3.2-1.8-3.3h3.7zM293.1 120l1.9 3.3h3.8l-1.9 3.3 1.9 3.2H295l-1.9 3.3-1.9-3.3h-3.7l1.8-3.2-1.8-3.3h3.7zM308.1 120l1.9 3.3h3.7l-1.9 3.3 1.9 3.2H310l-1.9 3.3-1.9-3.3h-3.8l1.9-3.2-1.9-3.3h3.8z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Equatorial Guinea +240</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#338AF3" d="M0 0h512v341.3H0z"></path><path fill="#56AF35" d="M0 0h512v170.7H0z"></path><path fill="#D80027" d="M0 341.3l512-170.7L0 0v341.3z"></path><g fill="#ffc945"><path d="M134.7 231.5c33.6 0 60.8-27.2 60.8-60.8s-27.2-60.8-60.8-60.8-60.8 27.2-60.8 60.8 27.2 60.8 60.8 60.8zm0 24.3c-47 0-85.2-38.1-85.2-85.2s38.1-85.2 85.2-85.2 85.2 38.1 85.2 85.2-38.2 85.2-85.2 85.2z"></path><circle cx="119.5" cy="148.3" r="17.5"></circle><circle cx="148.9" cy="158.5" r="17.5"></circle><circle cx="134.7" cy="135.2" r="17.5"></circle><circle cx="119.5" cy="172.7" r="17.5"></circle><circle cx="149.9" cy="182.8" r="17.5"></circle><circle cx="122.5" cy="198" r="17.5"></circle><circle cx="145.9" cy="205.2" r="17.5"></circle></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Eritrea +291</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#111" d="M0 85.337h512v341.326H0z"></path><path fill="#368FD8" d="M0 85.337h512v113.775H0z"></path><path fill="white" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Estonia +372</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600"><path fill="#2B5DEA" d="M0 0h900v600H0V0z"></path><path fill="#FFDF29" d="M0 100h900v400H0V100z"></path><path fill="#D70000" d="M0 150h900v300H0V150z"></path><path fill="white" d="M450 171.4v257.2c114.3 0 171.4-85.7 214.3-128.6-42.9-42.9-100-128.6-214.3-128.6z"></path><path d="M450 171.4c-100 0-171.4 85.7-214.3 128.6C278.6 342.9 350 428.6 450 428.6V171.4z"></path><path fill="white" d="M346.3 254.3h21v91.3h-21zM398.2 254.3h21v91.3h-21z"></path><path d="M477.8 254.3h21v91.3h-21zM529.7 254.3h21v91.3h-21z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Eswatini +268</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22.5 15"><path fill="#20AA46" d="M0 0h22.5v5H0V0z"></path><path fill="#E92F3B" d="M0 10h22.5v5H0v-5z"></path><path fill="#FADF50" d="M0 5h22.5v5H0V5z"></path><circle fill="#205CCA" cx="11.3" cy="7.5" r="5.2"></circle><path fill="#FFDB3D" d="M11.2 9.2L8.8 11l.9-2.9-2.4-1.8h3l1-2.8 1 2.9h3l-2.4 1.8.9 2.9-2.6-1.9zm0-1l.9.6-.3-1.1.9-.7h-1.1l-.4-1.1-.4 1.1H9.7l.9.7-.3 1.1c0 .1.9-.6.9-.6z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Ethiopia +251</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#0052B4" d="M0 0h512v341.3H0z"></path><path fill="white" d="M256 0v30.6l-45.2 25.1H256V115h-59.1l59.1 32.8v22.9h-26.7l-73.5-40.9v40.9h-55.6v-48.6l-87.5 48.6H0v-30.6L45.2 115H0V55.7h59.1L0 22.8V0h26.7l73.5 40.8V0h55.6v48.6L243.3 0z"></path><path fill="#D80027" d="M144 0h-32v69.3H0v32h112v69.4h32v-69.4h112v-32H144z"></path><path fill="#0052B4" d="M155.8 115L256 170.7v-15.8L184.2 115z"></path><path fill="white" d="M155.8 115L256 170.7v-15.8L184.2 115z"></path><g fill="#D80027"><path d="M155.8 115L256 170.7v-15.8L184.2 115zM71.8 115L0 154.9v15.8L100.2 115z"></path></g><path fill="#0052B4" d="M100.2 55.6L0 0v15.7l71.8 39.9z"></path><path fill="white" d="M100.2 55.6L0 0v15.7l71.8 39.9z"></path><g fill="#D80027"><path d="M100.2 55.6L0 0v15.7l71.8 39.9zM184.2 55.6L256 15.7V0L155.8 55.6z"></path></g><path fill="#1F8BDE" d="M312.2 194.2v-90c0-8.5 6.5-15.3 15-15.3h120.5c8.3 0 15 6.8 15 15.3v90c0 75.2-75.2 105.3-75.2 105.3s-75.3-30.1-75.3-105.3z"></path><path fill="white" d="M312.2 194.2v-90c0-8.5 6.5-15.3 15-15.3h120.5c8.3 0 15 6.8 15 15.3v90c0 75.2-75.2 105.3-75.2 105.3s-75.3-30.1-75.3-105.3zm79.6 86.3c7.9-4.5 15.9-10 23.2-16.7 20.5-18.5 32.6-41.4 32.6-69.7v-90c0-.3-120.4-.3-120.4-.3v90.3c0 28.3 12.1 51.2 32.6 69.7 8.3 7.5 17.6 13.9 27.6 19 1.4-.6 2.8-1.4 4.4-2.3z"></path><path fill="#187536" d="M347.1 193.4c-2.6-7.9 1.7-14.3 10.1-14.3h60.5c8.2 0 12.8 6.3 10.1 14.3l-5.5 16.5c-2.6 7.9-8.9 9.2-15.8 4 0 0 2.6-4.8-19.1-4.8-21.7 0-19.1 4.8-19.1 4.8-6.1 5.7-13.1 4-15.8-4 .1.1-5.4-16.5-5.4-16.5z"></path><path fill="white" d="M357.4 179.1c8.1 1.6 17.8-15 30.1-15 13.1 0 21.8 17.1 30.1 15 7.4-1.8 15-22.2 15-30.1 0-16.6-20.2-30.1-45.1-30.1-24.9 0-45.1 13.5-45.1 30.1-.1 8.5 6.6 28.5 15 30.1zM356 270.7c6.2.4 12.5-1.8 17.2-6.5l9-9c2.9-2.9 7.5-2.9 10.4 0l9 9c4.7 4.7 11 6.9 17.1 6.5 5.3-.3 32.5-33.5 25.7-32.6-4.6.6-9.1 2.8-12.7 6.3l-.1.1-9 9c-2.9 2.9-7.5 2.9-10.4 0l-9-9c-8.7-8.8-22.9-8.8-31.7-.1l-.1.1-9 9c-2.9 2.9-7.5 2.9-10.4 0l-9-9c-3.5-3.5-7.8-5.6-12.3-6.3-6.7-1.1 20.1 32.2 25.3 32.5zM322.1 210c2.9-2.9 7.5-2.9 10.4 0l9 9c8.8 8.7 22.9 8.7 31.7 0l9-9c2.9-2.9 7.5-2.9 10.4 0l9 9c8.8 8.7 22.9 8.7 31.7 0l9-9c2.9-2.9 7.5-2.9 10.4 0 0 0 5.5-14.8 2.5-15.9-7.9-2.9-17.2-1.2-23.5 5.2l-.1.1-9 9c-2.9 2.9-7.5 2.9-10.4 0l-9-9c-8.7-8.8-22.9-8.8-31.7-.1l-.1.1-9 9c-2.9 2.9-7.5 2.9-10.4 0l-9-9c-6.2-6.2-15.1-8-22.8-5.5-3.1 1.1 1.9 16.1 1.9 16.1z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Falkland Islands (Malvinas) +500</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><path fill="#0F61A5" d="M512 214.5H206.2v126.8H118.4V214.5H0v-87.7h118.4V0H206.2v126.8H512V192z"></path><path fill="#E50E3D" d="M512 149.3V192H183.7v149.3H141V192H0v-42.7h141V0h42.7v149.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Faroe Islands +298</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#2E52B2" d="M0 0h512v341.3H0z"></path><path fill="white" d="M256 0v22.6l-46.1 30.7H256v64h-46.1L256 148v22.7h-22.6l-73.4-49v49H96v-49l-73.4 49H0V148l46.1-30.7H0v-64h46.1L0 22.6V0h22.6L96 48.9V0h64v48.9L233.4 0z"></path><g fill="#D80027"><path d="M144 0h-32v69.3H0v32h112v69.4h32v-69.4h112v-32H144z"></path><path d="M0 0v15.1l57.4 38.2H80zM256 0v15.1l-57.4 38.2H176z"></path><path d="M0 0v15.1l57.4 38.2H80zM256 0v15.1l-57.4 38.2H176zM0 170.7v-15.1l57.4-38.3H80zM256 170.7v-15.1l-57.4-38.3H176z"></path></g><path fill="#F3F3F3" d="M307.1 127.1v92c0 61.6 80.5 80.5 80.5 80.5s80.4-19 80.4-80.6v-92l-80.5-23-80.4 23.1z"></path><path fill="#D80027" d="M468 132.8V98.3H307.1v34.5h69v69h-69v23h69V296c6.9 2.5 11.5 3.5 11.5 3.5s4.6-1.1 11.5-3.5v-71.2h69v-23h-69v-69H468z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Fiji +679</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><path fill="#2E52B2" d="M512 129.3V212H203.7v129.3H121V212H0v-82.7h121V0h82.7v129.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Finland +358</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><path fill="#0052B4" d="M0 85.331h170.663v341.337H0z"></path><path fill="#D80027" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">France +33</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 60"><path fill="#FDEB01" d="M0 0l90 60H0z"></path><path fill="#58A846" d="M90 0v60L0 0z"></path><path fill="#ED3D24" stroke="#A02021" stroke-miterlimit="10" d="M54.1 35.3l14.7-10.7H50.6L45 7.3l-5.6 17.3H21.2l14.7 10.7-5.6 17.4L45 42l14.7 10.7z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">French Guiana +594</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><g fill="#D80027"><path d="M0 85.337h512v113.775H0zM0 312.888h512v113.775H0z"></path></g><path fill="#FFDA44" d="M293.991 256c0 20.982-17.01 33.243-37.992 33.243S218.008 276.982 218.008 256s17.01-37.992 37.992-37.992 37.991 17.01 37.991 37.992z"></path><path fill="#0052B4" d="M293.991 256c0 20.982-17.01 37.992-37.992 37.992s-37.992-17.01-37.992-37.992"></path><g fill="#D80027"><path d="M232.259 246.506h9.498v19h-9.498zM270.247 246.506h9.498v19h-9.498zM251.247 232.259h9.498v33.243h-9.498z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">French Polynesia +689</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><path fill="#6DA544" d="M0 85.337h512v113.775H0z"></path><path fill="#0052B4" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Gabon +241</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#1a7e25" d="M0 322.783h512v103.88H0z"></path><path fill="#cf0d19" d="M0 85.337h512v104.515H0z"></path><path fill="#0052B4" d="M0 210.877h512v89.656H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Gambia +220</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22.5 15"><path fill="white" d="M.8 0h21v15H.8V0z"></path><path fill="#eb000e" d="M9.8 6H0v3h9.8v6h3V9h9.8V6h-9.8V0h-3v6z"></path><path fill="#eb000e" d="M17.3 2.7l-.2-1.2h1l-.2 1.2 1.2-.2v1l-1.2-.2.2 1.2h-1l.2-1.2-1.2.2v-1l1.2.2zm-12.7 0l-.2-1.2h1l-.2 1.2 1.2-.2v1l-1.2-.2.2 1.2h-1l.2-1.2-1.2.2v-1l1.2.2zm0 9l-.2-1.2h1l-.2 1.2 1.2-.2v1l-1.2-.2.2 1.2h-1l.2-1.2-1.2.2v-1l1.2.2zm12.7 0l-.2-1.2h1l-.2 1.2 1.2-.2v1l-1.2-.2.2 1.2h-1l.2-1.2-1.2.2v-1l1.2.2z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Georgia +995</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#496E2D" d="M0 312.888h512v113.775H0z"></path><path d="M255.883 199.111l14.119 43.458 40.366 3.2-36.969 26.861 19.453 40.259-36.969-26.859-36.97 26.859 14.123-43.459-36.969-26.861h45.696z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Ghana +233</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M0 230h513v112H0z"></path><path fill="#D80027" stroke="black" stroke-miterlimit="10" d="M363.1 131.8V99.1H374V77.3h-21.9v10.9h-21.8V77.3h-21.8v21.8h10.9v32.7h-21.8V55.5h10.9V33.7h-21.8v10.9h-10.9V33.7H254v10.9h-10.9V33.7h-21.8v21.8h10.9v76.3h-21.8V99.1h10.9V77.3h-21.8v10.9h-21.8V77.3h-21.8v21.8h10.9v32.7H145V219h239.9v-87.2z"></path><path fill="#FFDA44" stroke="black" stroke-miterlimit="10" d="M264.9 235.5l-24.2 18.2 19.1 14.3v31.3h-23.2v9h23v7.9h-23v9.3H270V268l19.1-14.3-24.2-18.2zm0 25.3l-10.1-7.1 10.1-7.1 10.1 7.1-10.1 7.1z"></path><path d="M239.6 209.7v-27.9s.1-22.3 25-22.3c24.8 0 25.7 22 25.7 22v28.2h-50.7zM170.5 209.7v-24.3s.1-18.7 19.6-18.7 20.2 18.4 20.2 18.4v24.5h-39.8z"></path><path d="M169.1 209.7v-24.3s.1-18.7 19.6-18.7 20.2 18.4 20.2 18.4v24.5h-39.8zM320.9 209.7v-24.3s.1-18.7 19.6-18.7 20.2 18.4 20.2 18.4v24.5h-39.8zM329.3 132v-15.7s.1-12.1 11.3-12.1c11.3 0 11.7 11.9 11.7 11.9V132h-23zM250.5 132v-23.7s.1-18.3 14.3-18.3c14.2 0 14.7 18 14.7 18v24h-29zM177.5 132v-15.7s.1-12.1 11.3-12.1 11.7 11.9 11.7 11.9V132h-23z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Gibraltar +350</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#1571CC"><path d="M0 0h513v38H0zM0 76h513v38H0zM0 152h513v38H0zM0 228h513v38H0zM0 304h513v38H0z"></path></g><path fill="#1571CC" d="M0 0h190v190H0z"></path><g fill="white"><path d="M0 76h190v38H0z"></path><path d="M76 0h38v190H76z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Greece +30</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"></path><path fill="white" d="M513 0v171H0V0z"></path><circle fill="white" cx="185.8" cy="171.2" r="117.8"></circle><path fill="#D80027" d="M68 171c0-65.1 52.8-117.8 117.8-117.8 65.1 0 117.8 52.8 117.8 117.8"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Greenland +299</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#c60a0a" d="M0 0h512v341.3H0z"></path><path fill="#3E8446" d="M256 170.7L44.5 296.8V44.5z"></path><g fill="#FFDA44"><path d="M256 170.7l211.5 126.1h-423zM467.5 44.5L256 170.7 44.5 44.5z"></path></g><path fill="#3E8446" d="M467.5 44.5v252.3L256 170.7z"></path><g fill="#FFDA44"><path d="M256 10.4l3.3 10.2H270l-8.6 6.3 3.3 10.2-8.7-6.3-8.7 6.3 3.3-10.2-8.6-6.3h10.7zM170.1 10.4l3.3 10.2h10.7l-8.6 6.3 3.3 10.2-8.7-6.3-8.7 6.3 3.3-10.2-8.6-6.3h10.7zM341.9 10.4l3.3 10.2H356l-8.7 6.3 3.3 10.2-8.7-6.3-8.7 6.3 3.3-10.2-8.6-6.3h10.7zM256 304.2l3.3 10.2H270l-8.6 6.3 3.3 10.2-8.7-6.3-8.7 6.3 3.3-10.2-8.6-6.3h10.7zM170.1 304.2l3.3 10.2h10.7l-8.6 6.3 3.3 10.2-8.7-6.3-8.7 6.3 3.3-10.2-8.6-6.3h10.7zM341.9 304.2l3.3 10.2H356l-8.7 6.3 3.3 10.2-8.7-6.3-8.7 6.3 3.3-10.2-8.6-6.3h10.7z"></path></g><circle fill="#c60a0a" cx="244.5" cy="170.7" r="76.2"></circle><path fill="#FFDA44" d="M244.5 110.1l13.6 41.8h44l-35.6 25.8 13.6 41.8-35.6-25.8-35.5 25.8 13.6-41.8-35.6-25.8h44zM107.7 167.8c4.4 6.9 2.3 16.1-4.6 20.5s-16.1 2.3-20.5-4.6c-7.9-12.5-3.3-33-3.3-33s20.4 4.6 28.4 17.1z"></path><circle fill="#A2001D" cx="99.1" cy="182.1" r="7.4"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Grenada +1473</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><path fill="#0052B4" d="M0 85.331h170.663v341.337H0z"></path><path fill="#D80027" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guadeloupe +590</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h512v341.3H0z"></path><path fill="#0052B4" d="M11.1 11.1h489.7v319.1H11.1z"></path><path fill="#7DBEF1" d="M256 285.3s76.4-51.3 76.4-114.6S256 56 256 56s-76.4 51.3-76.4 114.6S256 285.3 256 285.3z"></path><path fill="#1C8AE6" d="M179.8 180.7h152.6l-29.3 64.9h-95.2z"></path><path fill="#FFF042" d="M192.3 205.9s40.5 38.2 51 38.2c12.4 0 12.6-18.4 25.5-25.5 20.2-11.1 51-12.7 51-12.7L297 248.7l-41 36.6-46.8-39.7-16.9-39.7z"></path><path fill="#259C7B" d="M256 157.5l-22.5 15.6 7.9-26.2-21.8-16.5 27.4-.5 9-25.9 9 25.9 27.4.5-21.8 16.6 7.9 26.2-22.5-15.7z"></path><path fill="#8E5715" d="M249.7 144.6c-.9 9.2-1.5 18.4-1.7 27.6-.3 11.9.3 20.7 2 26 2.2 6.6 7.2 12.9 14.2 18.9 5.3 4.6 10.6 8.1 14.2 10.1 3.1 1.7 7 .6 8.7-2.4 1.7-3.1.6-7-2.4-8.7-4.3-2.5-8.4-5.4-12.2-8.7-5.4-4.6-9.1-9.2-10.4-13.3-1.1-3.4-1.6-11.3-1.4-21.7.2-8.9.8-17.8 1.7-26.6.4-3.5-2.2-6.6-5.7-7-3.6-.3-6.7 2.3-7 5.8z"></path><path fill="white" d="M217.8 170.7l25.5 38.2h-25.5v-38.2z"></path><path fill="none" stroke="#D80027" stroke-width="12" stroke-miterlimit="10" d="M256 285.3s76.4-51.3 76.4-114.6S256 56 256 56s-76.4 51.3-76.4 114.6S256 285.3 256 285.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guam +1671</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#338AF3"><path d="M0 0h171v342H0zM342 0h171v342H342z"></path></g><circle fill="#DCC26D" cx="256" cy="155.8" r="25.5"></circle><path fill="#628A40" d="M194.2 155.9c0 22.1 11.8 42.5 30.8 53.5 5.9 3.4 13.5 1.4 16.9-4.5 3.4-5.9 1.4-13.5-4.5-16.9-11.5-6.6-18.5-18.9-18.5-32.1 0-6.8-5.5-12.4-12.4-12.4s-12.3 5.5-12.3 12.4zm95.1 52.1c17.8-11.4 28.6-31 28.5-52.1 0-6.8-5.5-12.4-12.4-12.4-6.8 0-12.4 5.5-12.4 12.4 0 12.7-6.5 24.5-17.1 31.3-5.8 3.6-7.7 11.2-4.1 17 3.6 5.8 11.2 7.7 17 4.1.2-.1.3-.2.5-.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guatemala +502</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M308 0H204v118.7H0v104h204V342h104V222.7h205v-104H308z"></path><path fill="#FFDA44" d="M368.6 188l26 17.3V136l-26 17.3h-95.3V58.1l17.3-26h-69.2l17.3 26v95.2h-95.3l-26-17.3v69.3l26-17.3h95.3v95.2l-17.3 26h69.2l-17.3-26V188z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guernsey +44</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFDA44" d="M0 0h512v342H0z"></path><path fill="#6DA544" d="M342 0h171v342H342z"></path><path fill="#D80027" d="M0 0h171v342H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guinea +224</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M0 85.331h512v341.337H0z"></path><path fill="#FFDA44" d="M0 85.331h512v170.663H0z"></path><path fill="#D80027" d="M0 85.331h181.793v341.337H0z"></path><path d="M98.32 195.127l15.107 46.497h48.894l-39.555 28.74 15.108 46.498-39.554-28.737-39.556 28.737 15.111-46.498-39.554-28.74h48.891z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guinea-Bissau +245</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600"><path fill="#009E49" d="M0 0h900v600H0V0z"></path><path fill="white" d="M0 0l947 300L0 600V0z"></path><path fill="#FFD00D" d="M0 26.1L870 300 0 573.9V26.1z"></path><path fill="#2D2D2D" d="M0 0l450 300L0 600V0z"></path><path fill="#D3132F" d="M0 35l397.5 265L0 565V35z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Guyana +592</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#A2001D" d="M0 0h513v172H0z"></path><path fill="#0052B4" d="M0 172h513v172H0z"></path><path fill="white" d="M381.4 251.5l-110.7-13.8-110.8 13.8V85.4h221.5z"></path><circle fill="#0052B4" cx="270.7" cy="182.3" r="55.4"></circle><circle fill="#A2001D" cx="270.7" cy="182.3" r="27.7"></circle><path fill="#6DA544" d="M229.1 113.1h83.1l-41.5 41.5z"></path><path fill="#FFDA44" d="M256.8 140.8h27.7v83h-27.7z"></path><path fill="#6DA544" d="M314.9 215.5h-88.5l-66.5 36h221.5z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Haiti +509</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.326H0z"></path><path fill="white" d="M256 85.331h256v341.337H256z"></path><path fill="#ACABB1" d="M321.353 233.837l32.073 42.43c-5.053 7.651-5.026 17.961.817 25.692 7.414 9.807 21.374 11.748 31.182 4.335 9.807-7.414 11.748-21.374 4.334-31.182-5.843-7.731-15.756-10.568-24.495-7.795l-49.988-66.129-11.838 8.949-17.759 13.424 17.899 23.677 17.775-13.401zm46.175 48.78a7.421 7.421 0 118.95 11.84 7.421 7.421 0 01-8.95-11.84z"></path><path fill="#FFDA44" d="M376.367 247.24l17.899-23.677-17.759-13.424-11.838-8.949-49.988 66.129c-8.74-2.775-18.651.063-24.495 7.795-7.414 9.808-5.473 23.768 4.334 31.182 9.808 7.414 23.768 5.473 31.182-4.335 5.845-7.731 5.871-18.041.817-25.692l32.073-42.43 17.775 13.401zm-62.504 45.771a7.42 7.42 0 11-11.84-8.95 7.42 7.42 0 0111.84 8.95z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Holy See (Vatican City State) +379</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#338AF3"><path d="M0 0h513v114H0zM0 228h513v114H0zM203.5 117.9l6.7 16.6 17.6 1-14 10.9 4.7 17.7-15-9.9-15 9.9 4.7-17.7-14-10.9 17.6-1zM308.5 117.9l6.7 16.6 17.6 1-14 10.9 4.7 17.7-15-9.9-15 9.9 4.7-17.7-14-10.9 17.6-1zM256 147.6l6.7 16.6 17.6 1-14 10.9 4.7 17.7-15-9.9-15 9.9 4.7-17.7-14-10.9 17.6-1zM203.5 177.3l6.7 16.6 17.6 1-14 10.9 4.7 17.6-15-9.9-15 9.9 4.7-17.6-14-10.9 17.6-1zM308.5 177.3l6.7 16.6 17.6 1-14 10.9 4.7 17.6-15-9.9-15 9.9 4.7-17.6-14-10.9 17.6-1z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Honduras +504</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#6DA544" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Hungary +36</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.334h512v341.337H0z"></path><path fill="white" d="M512 295.883H202.195v130.783H122.435V295.883H0V216.111h122.435V85.329H202.195v130.782H512V277.329z"></path><path fill="#D80027" d="M512 234.666v42.663H183.652v149.337h-42.674V277.329H0v-42.663h140.978V85.329h42.674v149.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Iceland +354</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#A2001D" d="M0 85.337h512V256H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Indonesia +62</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h512v342H0z"></path><path fill="#6DA544" d="M0 0h513v114H0z"></path><g fill="#D80027"><path d="M0 227.9h513v114H0zM278.8 134.8c.1 2 8.7 26.2 4.4 39.4-6.6 20.3-15.8 21.8-19.8 24.5V134l-6.9-4.2-6.9 4.2v64.7c-4-2.7-12.4-2.4-19.8-24.5-4.3-12.7 5.7-37.3 5.8-39.2 0 0-9.5 8.1-15.8 24-5.9 14.8 1.9 49.6 29.5 54.8 2.3.4 4.7 5.6 7.2 5.6 2.1 0 4.1-5.2 6-5.5 28.4-4.6 35-41.7 29.9-55.6-5.4-14.6-13.6-23.5-13.6-23.5z"></path></g><g fill="white" opacity=".5"><path d="M44.6 98.9h22.3v24.4H44.6zM0 98.9h22.3v24.4H0zM89.2 98.9h22.3v24.4H89.2zM133.8 98.9h22.3v24.4h-22.3zM178.4 98.9h22.3v24.4h-22.3zM223 98.9h22.3v24.4H223zM267.7 98.9H290v24.4h-22.3zM312.3 98.9h22.3v24.4h-22.3zM356.9 98.9h22.3v24.4h-22.3zM401.5 98.9h22.3v24.4h-22.3zM446.1 98.9h22.3v24.4h-22.3zM490.7 98.9H513v24.4h-22.3zM44.6 216.9h22.3v25.5H44.6zM0 216.9h22.3v25.5H0zM89.2 216.9h22.3v25.5H89.2zM133.8 216.9h22.3v25.5h-22.3zM178.4 216.9h22.3v25.5h-22.3zM223 216.9h22.3v25.5H223zM267.7 216.9H290v25.5h-22.3zM312.3 216.9h22.3v25.5h-22.3zM356.9 216.9h22.3v25.5h-22.3zM401.5 216.9h22.3v25.5h-22.3zM446.1 216.9h22.3v25.5h-22.3zM490.7 216.9H513v25.5h-22.3z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Iran +98</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#CE1126" d="M0 0h513v114H0z"></path><path d="M0 228h513v114H0z"></path><g fill="#547C31"><path d="M219.2 160.7h-29.3c1.5-5.7 6.6-9.9 12.8-9.9v-19.9c-18.3 0-33.1 14.9-33.1 33.1v16.5h49.6c1.8 0 3.3 1.5 3.3 3.3v6.6h-66.2v19.9h86.1v-26.5c0-12.7-10.4-23.1-23.2-23.1zM268.8 190.5v-59.6H249v79.5h33.1v-19.9zM335 190.5v-59.6h-19.8v59.6h-6.6v-19.8h-19.9v39.7h59.6v-19.9z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Iraq +964</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#E52D42" d="M0 0h513v342H0z"></path><path fill="white" d="M393.3 68.2h-45.8l-33.8 80.2-34.4-22.9s-24.7-59.1-34.4-68.2c-9.7-9.7-18.7-.6-48.9 7.8-29.6 8.4-30.8 18.7-42.2 18.7-4.8 0-19.9-17.5-27.7-22.3-12.1-7.8-16.9-4.2-13.9 7.2 1.2 4.8 10.9 10.9 16.9 19.9 7.8 11.5 12.7 25.9 12.7 25.9s10.9-10.3 16.9-12.1c9-2.4 19.3 1.8 31.4 0 15.1-2.4 31.4-10.9 31.4-10.9l4.2 43.4s-54.3 50.7-49.5 70.6 56.1 44.6 68.2 62.7c12.1 17.5-7.2 24.1-7.2 32.6s-1.8 19.9 7.2 16.3c9-3.6 10.3-18.1 18.7-31.4 6-9 10.3-13.9 11.5-17.5 1.8-9-23.5-32-37.4-48.9-6.6-7.8-19.9-18.7-19.9-18.7l39.2-29.6s67.6 27.7 82.6 18.7c15.1-9 19.3-98.3 19.3-98.3l47-11.5-12.1-11.7z"></path><path fill="#F8DD4E" d="M279.3 262.4c-6 0-11.5-4.8-11.5-11.5s4.8-11.5 11.5-11.5c6 0 11.5 4.8 11.5 11.5s-5.5 11.5-11.5 11.5zm45.8-182.8c-6 0-11.5-4.8-11.5-11.5s4.8-11.5 11.5-11.5c6 0 11.5 4.8 11.5 11.5s-5.5 11.5-11.5 11.5zm0 91.1c-6 0-11.5-4.8-11.5-11.5 0-6 4.8-11.5 11.5-11.5 6 0 11.5 4.8 11.5 11.5-.6 6.7-5.5 11.5-11.5 11.5zm-136.9 45.8c-6 0-11.5-4.8-11.5-11.5 0-6 4.8-11.5 11.5-11.5 6.6 0 11.5 4.8 11.5 11.5s-5.5 11.5-11.5 11.5zm45.2-136.9c-6 0-11.5-4.8-11.5-11.5s4.8-11.5 11.5-11.5c6 0 11.5 4.8 11.5 11.5s-4.8 11.5-11.5 11.5zm22.9 91.1c-6 0-11.5-10.3-11.5-22.9s4.8-22.9 11.5-22.9c6 0 11.5 10.3 11.5 22.9s-4.8 22.9-11.5 22.9zm-114-45.2c-6 0-11.5-4.8-11.5-11.5 0-6.6 4.8-11.5 11.5-11.5 6.6 0 11.5 4.8 11.5 11.5 0 6.6-4.8 11.5-11.5 11.5z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Isle of Man +44</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#2E52B2"><path d="M340.6 122.4h-56.1l-28-48.6-28 48.6h-56.1l28 48.6-28 48.6h56.1l28 48.6 28-48.6h56.1l-28-48.6 28-48.6zM293.2 171L276 204.2h-38.9L219.8 171l17.2-33.2h38.9l17.3 33.2zm-36.7-71.8l11.9 23.3h-23.9l12-23.3zm-58.3 38.6h23.9l-10.8 21-13.1-21zm0 66.4l13-22.1 11.9 22.1h-24.9zm58.3 37.5l-11.9-22.1h23.9l-12 22.1zm59.4-37.5h-25l11.9-22.1 13.1 22.1zm-26.1-66.4h26.1l-13 22.1-13.1-22.1zM0 21.3h512V64H0zM0 277.3h512V320H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Israel +972</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M341.334 85.33H0v341.332h512V85.33z"></path><path fill="#6DA544" d="M0 85.333h170.663V426.67H0z"></path><path fill="#D80027" d="M341.337 85.333H512V426.67H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Italy +39</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M0 85.337h512v341.326H0z"></path><path d="M215.864 256.006L0 399.911V112.089zM512 112.089v287.822L296.136 256.006z"></path><path fill="#0052B4" d="M512 112.089L296.136 256.006 512 399.911v26.757h-40.125L256 282.752 40.125 426.668H0v-26.757l215.864-143.905L0 112.089V85.331h40.125L256 229.248 471.875 85.331H512z"></path><path fill="#FFDA44" d="M512 112.089L296.136 256.006 512 399.911v26.757h-40.125L256 282.752 40.125 426.668H0v-26.757l215.864-143.905L0 112.089V85.331h40.125L256 229.248 471.875 85.331H512z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Jamaica +1876</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><circle fill="#D80027" cx="256" cy="255.994" r="96"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Japan +81</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M301.8 171L513 30.2V0h-45.3L256.5 140.8 45.3 0H0v30.2L211.2 171 0 311.8V342h45.3l211.2-140.8L467.7 342H513v-30.2z"></path><path fill="#FFDA44" d="M233.7 44.6l22.3 5.6 22.3-5.6 4-20.9-14.9 6.5L256 14.8l-11.4 15.4-14.9-6.5z"></path><path fill="#D80027" d="M233.7 44.6s-4 12.9-4 29.9c0 27.9 26.3 41.3 26.3 41.3s26.3-15.5 26.3-41.3c0-15.4-4-29.9-4-29.9s-8.1-5-22.3-5-22.3 5-22.3 5z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Jersey +44</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.339h512v341.326H0z"></path><path d="M0 85.339h512v113.775H0z"></path><path fill="#6DA544" d="M0 312.89h512v113.775H0z"></path><path fill="#D80027" d="M256 256.006L0 426.669V85.331z"></path><path fill="white" d="M77.913 224.802l7.876 16.469 17.786-4.11-7.965 16.426 14.303 11.343-17.808 4.014.049 18.255-14.241-11.421-14.241 11.421.05-18.255-17.809-4.014 14.303-11.343-7.965-16.426 17.786 4.11z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Jordan +962</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#36B6CC" d="M0 0h513v342H0V0z"></path><circle fill="#FFD400" cx="256.5" cy="170.9" r="68.4"></circle><path fill="#FFD400" d="M256.5 251.5l-27.9 41.7-7.1-49.7-43.2 25.5 15.2-47.8-50 4.2 34.4-36.5-46.9-18 46.8-18-34.4-36.5 50 4.2-15.2-47.8 43.2 25.4 7.1-49.7 27.9 41.7 27.9-41.7 7.1 49.7 43.2-25.4-15.2 47.8 50-4.2-34.3 36.6 46.8 17.9-46.8 18 34.4 36.5-50-4.2 15.2 47.8-43.2-25.4-7.1 49.7c0-.1-27.9-41.8-27.9-41.8zm0-.8c44.1 0 79.9-35.8 79.9-79.9S300.6 91 256.5 91s-79.9 35.8-79.9 79.9 35.8 79.8 79.9 79.8zM22.8 28.3c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6v-.1-11.3zm0 45.7c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6V74zm0 45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6v-.1-11.3zm0 45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6v-.1-11.3zm0 45.7c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6v-11.4zm0 45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6v-11.4zm0 45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H28.5c-3.1 0-5.7-2.5-5.7-5.6v-11.4zm22.8-22.8c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H51.3c-3.1 0-5.7-2.5-5.7-5.6v-11.4zm0-45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7V245c.1 3.1-2.4 5.7-5.6 5.7H51.3c-3.1 0-5.7-2.5-5.7-5.6v-11.4zm0-45.7c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H51.3c-3.1 0-5.7-2.5-5.7-5.6V188zm0-45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H51.3c-3.1 0-5.7-2.5-5.7-5.6v-.1-11.3zm0-45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H51.3c-3.1 0-5.7-2.5-5.7-5.6v-.1-11.3zm0-45.6c0-3.2 2.4-5.7 5.7-5.7h11.3c3.2 0 5.7 2.4 5.7 5.7v11.3c.1 3.1-2.4 5.7-5.6 5.7H51.3c-3.1 0-5.7-2.5-5.7-5.6V51.2z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Kazakhstan +77</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><path d="M0 85.331h512v90.579H0z"></path><path fill="#496E2D" d="M0 336.089h512v90.568H0z"></path><path fill="#A2001D" d="M0 198.606h512v114.799H0z"></path><g fill="white"><path d="M323.265 139.803l-25.583-11.809L256 222.376l-41.682-94.382-25.583 11.809 51.749 116.191-51.749 116.192 25.583 11.808L256 289.613l41.682 94.381 25.583-11.808-51.749-116.192z"></path><path d="M273.376 150.931C263.472 140.115 256 133.898 256 133.898s-7.472 6.216-17.376 17.032v210.127C248.528 371.873 256 378.091 256 378.091s7.472-6.216 17.376-17.033V150.931z"></path></g><g fill="#A2001D"><path d="M209.04 191.226v129.535c10.465 18.542 23.274 33.742 32.872 43.818V147.408c-9.599 10.076-22.408 25.275-32.872 43.818zM302.96 191.226c-10.465-18.543-23.274-33.742-32.872-43.818V364.58c9.599-10.077 22.407-25.276 32.872-43.818V191.226z"></path></g><path d="M302.96 191.226v129.535c10.594-18.774 18.784-40.973 18.784-64.767s-8.19-45.993-18.784-64.768zM209.04 191.226v129.535c-10.594-18.774-18.784-40.973-18.784-64.767s8.19-45.993 18.784-64.768z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Kenya +254</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 450 300"><path fill="#CE1126" d="M0 0h450v300H0V0z"></path><g fill="#FCD116"><circle cx="227.6" cy="161.2" r="56.2"></circle><path d="M254.1 73.4l-23.7 26 28.6 6.5zM202.6 73.6l-4.8 33.1 28.5-8zM296.9 100.3l-34.7 8.5 20.1 23.7zM158.6 98.5l15.5 32.7 20.2-22.7zM317.6 143.8l-34.4-9.9 5.6 29.5zM135.6 141.2l31.9 19.8 5.2-27.7z"></path></g><path fill="#003F87" d="M0 175h450v125H0V175z"></path><path fill="white" d="M0 267c15 0 30 13 45 13s30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13v-21c-15 0-30 13-45 13s-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13v21zm0-43c15 0 30 13 45 13s30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13v-21c-15 0-30 13-45 13s-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13v21zm0-43c15 0 30 13 45 13s30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13 30 13 45 13 30-13 45-13v-21c-15 0-30 13-45 13s-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13-30 13-45 13-30-13-45-13v21z"></path><path fill-rule="evenodd" clip-rule="evenodd" fill="#FCD116" d="M183.2 48.3l-1.1-5.3 22.4-3.7s-30.1-7.1-40-10.7c-14.3-5.1-16.3-12.1-16.3-12.1s44.7 11 64.8 11c4.3 0 12.8 10.7 12.8 10.7s14.8-14.9 21.9-15.4c32.1-2.3 66.6-6.4 66.6-6.4s-10 6.7-16 8.5c-16.2 4.9-50.6 11.7-50.6 11.7l-4.8 7.5H277l-14.4 4.3 7.4 6.9s-7.8-4.1-18.1-2.1c-7.1 1.3-15.4 6-22.9 8-18.7 4.8-29.9-12.8-29.9-12.8l-15.9-.1z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Kiribati +686</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#91DC5A" d="M0 85.331h512v341.337H0z"></path><path fill="white" d="M0 85.331h512v341.337H0z"></path><g fill="#0052B4"><path d="M0 85.331h512v57.188H0zM0 369.48h512v57.177H0z"></path></g><path fill="#D80027" d="M0 165.215h512v181.582H0z"></path><circle fill="white" cx="190.33" cy="255.994" r="65.668"></circle><path fill="#D80027" d="M190.332 190.332l14.734 45.346h47.757l-38.65 28.028 14.849 45.481-38.69-28.16-38.631 28.107 14.79-45.428-38.616-28.028h47.722z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Korea, Democratic People's Republic of Korea +850</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600"><path fill="white" d="M0 0h900v600H0z"></path><g transform="rotate(-56.31)"><g stroke="black" stroke-width="25"><path d="M-75 228.3H75m-150 37.5H75m-150 37.5H75M-75 778.3H75m-150 37.5H75m-150 37.5H75"></path></g><path stroke="white" stroke-width="12.5" d="M0 753.3v125"></path><circle fill="#ca163a" cy="540.8" r="150"></circle><path fill="#0e4896" d="M0 390.8c-41.4 0-75 33.6-75 75s33.6 75 75 75 75 33.6 75 75-33.6 75-75 75c-82.8 0-150-67.2-150-150s67.2-150 150-150z"></path></g><g stroke="black" stroke-width="25"><path d="M231.56 535.73l-83.205-124.808M262.76 514.928l-83.205-124.807m114.407 104.006l-83.205-124.808M689.187 230.644l-83.205-124.807M720.39 209.843L637.184 85.036m114.407 104.006L668.386 64.234"></path></g><path stroke="white" stroke-width="12.5" d="M205.6 462.897l31.202-20.8m389.981-259.989l36.444-24.296m31.202-20.801l31.202-20.801"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Korea, Republic of South Korea +82</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.33"><path fill="#0052B4" d="M0 0h512v341.34H0z"></path><g fill="white"><path d="M220.72 42.63l7.95 16.11 17.77 2.58-12.86 12.54 3.04 17.7-15.9-8.36-15.9 8.36 3.03-17.7-12.86-12.54 17.78-2.58zM291.28 42.57l7.95 16.1 17.78 2.59-12.86 12.53 3.03 17.71-15.9-8.36-15.9 8.36 3.04-17.71-12.86-12.53 17.77-2.59zM353.36 53.93l7.95 16.11 17.77 2.58-12.86 12.54 3.04 17.7-15.9-8.35-15.9 8.35 3.04-17.7-12.87-12.54 17.78-2.58zM416.37 72.23l7.95 16.11 17.77 2.59-12.86 12.53 3.04 17.71-15.9-8.36-15.9 8.36 3.03-17.71-12.86-12.53 17.78-2.59zM158.64 53.93l7.95 16.11 17.78 2.58-12.87 12.54 3.04 17.7-15.9-8.35-15.9 8.35 3.04-17.7-12.86-12.54 17.77-2.58zM95.63 72.23l7.95 16.11 17.78 2.59-12.86 12.53 3.03 17.71-15.9-8.36-15.9 8.36 3.04-17.71-12.86-12.53 17.77-2.59z"></path></g><path fill="#FFDA44" d="M217.53 259.33l-27.22-13.61-27.22-54.43h27.22l27.22-27.22 13.61-27.22 27.22-13.61 13.61 13.61 27.22 13.61v13.61l13.61 13.61 40.83 27.22L340 245.73l-40.83 40.83-13.61-27.22-40.83 27.22v27.22l-13.61-13.61-13.59-40.84z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Kosovo +383</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 342"><g fill="#D80027"><path d="M0 0h513v342H0z"></path><circle cx="256" cy="170.7" r="170.7"></circle></g><path fill="#FFDA44" d="M382.4 170.7L330.8 195l27.5 50-56.1-10.7-7.1 56.6-39.1-41.7-39.1 41.7-7.1-56.6-56.1 10.7 27.5-50-51.6-24.3 51.6-24.3-27.5-50.1 56.1 10.8 7.1-56.7L256 92.1l39.1-41.7 7.1 56.7 56.1-10.8-27.5 50.1z"></path><circle fill="#D80027" cx="257.4" cy="170.7" r="71.6"></circle><g fill="#FFDA44"><path d="M214.2 170.7c-2.1 0-4.1.1-6.2.3.1 12 4.4 22.9 11.6 31.5 3.8-10.3 9.5-19.6 16.7-27.7-6.9-2.7-14.3-4.1-22.1-4.1zM240.8 217.2c5.2 1.9 10.8 2.9 16.6 2.9 5.8 0 11.4-1 16.6-2.9-2.8-11.1-8.7-21-16.6-28.8-7.9 7.8-13.8 17.7-16.6 28.8zM300.2 146c-8.5-14.8-24.5-24.7-42.8-24.7-18.3 0-34.2 9.9-42.8 24.7 15.6.1 30.2 4.3 42.8 11.6 12.6-7.3 27.2-11.6 42.8-11.6zM278.5 174.8c7.2 8 12.9 17.4 16.7 27.7 7.2-8.5 11.5-19.5 11.6-31.5-2-.2-4.1-.3-6.2-.3-7.7 0-15.2 1.4-22.1 4.1z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Kyrgyzstan +996</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#0052B4" d="M0 0h513v342H0z"></path><g fill="#D80027"><path d="M0 .1h513v90.7H0zM0 251.3h513V342H0z"></path></g><circle fill="white" cx="256.5" cy="171" r="65.9"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Laos +856</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#A2001D"><path class="prefix__st1" d="M0 0h513v127.6H0zM0 214.4h513V342H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Latvia +371</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#D80027"><path d="M0 .2h513v90.7H0zM.5 251.3H513V342H.5z"></path></g><path fill="#6DA544" d="M290.3 193.5L256 130.7l-34.3 62.8h25.7v17.2h17.2v-17.2z"></path><path fill="#14AF5A" d="M241.3 213.1c4.4-4.4 4.4-11.6-.1-16l4.7 4.7c-5.2-4.7-12.2-6.6-19.1-5.3l-23.5 5.9c-6.1 1.5-6.8-.4-1.8-4.2l27.1-20.3c5.1-3.8 4.2-6.9-2.3-6.9h-11c-6.4 0-7-2.3-1.5-5.1l25.3-12.7c5.6-2.8 5.1-5.1-1.5-5.1h-11c-6.4 0-7.4-3.1-2.3-6.9l27.1-20.3c5.6-3.8 12.9-3.8 18.5 0l27.1 20.3c5.1 3.8 4.2 6.9-2.3 6.9h-11c-6.4 0-7 2.3-1.5 5.1l25.3 12.7c5.6 2.8 5.1 5.1-1.5 5.1h-11c-6.4 0-7.4 3.1-2.3 6.9l27.1 20.3c5.1 3.8 4.4 5.7-1.8 4.2l-23.5-5.9c-6.8-1.3-13.9.6-19.1 5.3l4.7-4.7c-4.4 4.4-4.5 11.5-.1 16l6.8 6.8c4.4 4.4 3.1 8-3.3 8h-45.8c-6.2 0-7.7-3.6-3.3-8 .1.1 6.9-6.8 6.9-6.8z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Lebanon +961</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><path fill="#0052B4" d="M0 0h513v114H0z"></path><path fill="#6DA544" d="M0 227.6h513v114H0z"></path><path d="M245.2 171l7.7-23.1c2-5.9 5.1-6 7.1 0l7.7 23.1 19.4 29.1c1.7 2.6 1.3 6.3-1.2 8 0 0-6.9 8-29.5 8s-29.5-8-29.5-8c-2.4-2-2.9-5.4-1.2-8l19.5-29.1z"></path><path d="M256.5 171c-12.5 0-22.6-10.1-22.6-22.6 0-12.5 10.1-22.6 22.6-22.6s22.6 10.1 22.6 22.6c0 12.5-10.2 22.6-22.6 22.6zm0 0c6.2 0 11.3-16.3 11.3-22.6 0-6.2-5.1-11.3-11.3-11.3-6.2 0-11.3 5.1-11.3 11.3 0 6.3 5 22.6 11.3 22.6z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Lesotho +266</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 91.476h512v341.337H0z"></path><g fill="#D80027"><path d="M0 91.476h512v31.031H0zM0 153.539h512v31.031H0zM0 215.603h512v31.031H0zM0 277.666h512v31.031H0zM0 339.729h512v31.031H0zM0 401.793h512v31.031H0z"></path></g><path fill="#0052B4" d="M0 79.177h256v167.457H0z"></path><path fill="white" d="M127.999 118.382l11.05 34.01h35.764l-28.932 21.021 11.05 34.012-28.932-21.021-28.933 21.021 11.053-34.012-28.932-21.021h35.762z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Liberia +231</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#496E2D" d="M0 312.888h512v113.775H0z"></path><g fill="white"><path d="M281.424 236.026l8.962 12.35 14.513-4.706-8.975 12.339 8.961 12.349-14.509-4.724-8.976 12.34.01-15.258-14.51-4.725 14.514-4.706z"></path><path d="M256.965 286.868c-17.048 0-30.868-13.821-30.868-30.868s13.821-30.868 30.868-30.868a30.742 30.742 0 0114.684 3.71c-6.851-6.698-16.218-10.833-26.556-10.833-20.982 0-37.992 17.01-37.992 37.992s17.01 37.992 37.992 37.992c10.338 0 19.706-4.135 26.556-10.833a30.738 30.738 0 01-14.684 3.708z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Libya +218</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"></path><path fill="#0052B4" d="M0 0h513v171H0z"></path><path fill="#FFDA44" d="M149.3 98.1c0-14-11.3-25.3-25.3-25.3-6.5 0-12.4 2.4-16.9 6.4V64.4h8.4V47.5h-8.4v-8.4H90.3v8.4h-8.4v16.9h8.4v14.9c-4.5-4-10.4-6.4-16.9-6.4-14 0-25.3 11.3-25.3 25.3 0 7.5 3.3 14.2 8.4 18.8v14.9h84.3V117c5.3-4.7 8.5-11.5 8.5-18.9z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Liechtenstein +423</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M0 85.337h512v113.775H0z"></path><path fill="#D80027" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Lithuania +370</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#338AF3" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Luxembourg +352</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.331h512v341.337H0z"></path><path fill="white" d="M285.682 248.878c-4.19 0-8.166.836-11.861 2.164 2.023-4.509 3.379-9.527 3.379-14.885 0-21.201-21.201-37.101-21.201-37.101s-21.201 15.901-21.201 37.101c0 5.357 1.356 10.375 3.379 14.885-3.693-1.328-7.671-2.164-11.861-2.164-21.201 0-37.101 21.201-37.101 21.201s15.901 21.201 37.101 21.201c12.429 0 23.031-7.286 29.682-13.315 6.65 6.03 17.251 13.315 29.682 13.315 21.201 0 37.101-21.201 37.101-21.201s-15.899-21.201-37.099-21.201z"></path><g fill="#FFDA44"><path d="M256 152.111l4.38 13.476h14.171l-11.464 8.332 4.376 13.476-11.463-8.33-11.463 8.33 4.376-13.476-11.464-8.332h14.171zM202.112 175.683l8.425 7.585 9.818-5.667-4.61 10.355 8.423 7.588-11.274-1.185-4.611 10.355-2.358-11.088-11.275-1.185 9.818-5.669zM162.662 215.132l11.09 2.358 5.668-9.818 1.186 11.274 11.089 2.358-10.357 4.61 1.186 11.274-7.587-8.423-10.357 4.61 5.669-9.818zM309.889 175.683l-8.425 7.585-9.818-5.667 4.611 10.355-8.425 7.588 11.275-1.185 4.61 10.355 2.359-11.088 11.275-1.185-9.818-5.669zM349.338 215.132l-11.089 2.358-5.669-9.818-1.186 11.274-11.088 2.358 10.357 4.61-1.185 11.274 7.586-8.423 10.357 4.61-5.669-9.818z"></path></g><g fill="white"><path d="M256 350.642c16.84 0 32.363-5.619 44.816-15.073h-89.63c12.451 9.454 27.974 15.073 44.814 15.073zM187.977 306.12a74.138 74.138 0 008.85 15.073h118.345a74.13 74.13 0 008.85-15.073H187.977z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Macau +853</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M512 426.666V85.329H0v341.337h512z"></path><path fill="#D80027" d="M512 85.331H0v170.666h512V85.331z"></path><path fill="white" d="M0 85.334h181.793v341.337H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Madagascar +261</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path d="M0 85.337h512v113.775H0z"></path><path fill="#496E2D" d="M0 312.888h512v113.775H0z"></path><path fill="#D80027" d="M307.01 166.957l-20.842-9.804 11.099-20.186-22.634 4.329-2.868-22.864L256 135.248l-15.764-16.816-2.869 22.864-22.633-4.329 11.099 20.186-20.843 9.804z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Malawi +265</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><g fill="#D80027"><path d="M0 42.7h512v42.7H0zM0 128h512v42.7H0zM0 213.3h512V256H0zM0 298.7h512v42.7H0z"></path></g><path fill="#0052B4" d="M0 0h256v170.7H0z"></path><g fill="#FFDA44"><path d="M141.1 134.8c-28 0-45.9-24.8-45.9-49.5 0-24.8 17.9-49.5 45.9-49.5 8.7 0 18.1 1 25.3 4.9-11.2-11-26.6-17.8-43.6-17.8-34.4 0-62.4 27.9-62.4 62.4s27.9 62.4 62.4 62.4c17 0 32.3-6.8 43.6-17.8-7.1 3.9-16.5 4.9-25.3 4.9z"></path><path d="M171 49.7l9 18.8 20.3-4.7-9.1 18.8 16.4 12.9-20.4 4.6.1 20.9-16.3-13.1-16.2 13.1v-20.9l-20.3-4.6 16.3-12.9-9.1-18.8 20.3 4.7z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Malaysia +60</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.333H0z"></path><path fill="#6DA544" d="M144.696 174.375h222.609v163.25H144.696z"></path><path fill="white" d="M283.484 304.226c-26.637 0-48.232-21.594-48.232-48.232s21.594-48.232 48.232-48.232c8.306 0 16.12 2.1 22.943 5.797-10.703-10.467-25.341-16.927-41.494-16.927-32.784 0-59.362 26.577-59.362 59.362s26.578 59.362 59.362 59.362c16.154 0 30.791-6.461 41.494-16.927-6.822 3.698-14.636 5.797-22.943 5.797z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Maldives +960</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.337H0z"></path><path fill="#6DA544" d="M0 85.331h170.663v341.337H0z"></path><path fill="#D80027" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mali +223</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.326H0z"></path><path fill="#D80027" d="M256 85.331h256v341.337H256z"></path><path fill="#ACABB1" d="M208.231 138.671v-21.334h-21.332v21.334h-21.334v21.332h21.334v21.334h21.332v-21.334h21.334v-21.332z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Malta +356</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.337h512v341.326H0z"></path><g fill="white"><path d="M233.839 185.115l-20.844 9.803 11.1 20.187-22.633-4.33-2.868 22.864-15.765-16.816-15.766 16.816-2.867-22.864-22.634 4.33 11.1-20.187-20.843-9.803 20.843-9.805-11.1-20.185 22.633 4.328 2.869-22.864 15.765 16.816 15.765-16.816 2.868 22.864 22.634-4.328-11.1 20.186zM426.917 85.337L0 421.52v3.762L503.756 85.337z"></path></g><path fill="#FF9811" d="M512 85.337h-8.244L0 425.282v1.381h3.723L512 136.998z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Marshall Islands +692</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.331h512v341.337H0z"></path><g fill="white"><path d="M512 233.734v44.521H278.261v148.402h-44.522V278.255H0v-44.521h233.739V85.331h44.522v148.403z"></path><path d="M386.607 175.885a4.119 4.119 0 014.115-4.114h8.816c13.936 0 25.274-11.337 25.274-25.273 0-13.935-11.337-25.273-25.274-25.273h-8.372c-2.733-2.052-6.399-3.318-10.443-3.318-8.436 0-15.273 5.471-15.273 12.219 0 6.683 6.707 12.104 15.029 12.209l-.003.049h19.062c2.27 0 4.115 1.845 4.115 4.115s-1.845 4.114-4.115 4.114h-8.816c-13.936 0-25.273 11.337-25.273 25.273 0 13.935 11.336 25.273 25.273 25.273h34.09V180h-34.09a4.12 4.12 0 01-4.115-4.115zM108.346 175.885a4.119 4.119 0 014.115-4.114h8.816c13.936 0 25.274-11.337 25.274-25.273 0-13.935-11.337-25.273-25.274-25.273h-8.372c-2.733-2.052-6.399-3.318-10.443-3.318-8.436 0-15.273 5.471-15.273 12.219 0 6.683 6.707 12.104 15.029 12.209l-.003.049h19.062c2.27 0 4.115 1.845 4.115 4.115s-1.845 4.114-4.115 4.114h-8.816c-13.936 0-25.273 11.337-25.273 25.273 0 13.935 11.336 25.273 25.273 25.273h34.09V180h-34.09a4.12 4.12 0 01-4.115-4.115zM386.607 368.809a4.119 4.119 0 014.115-4.114h8.816c13.936 0 25.274-11.337 25.274-25.273 0-13.935-11.337-25.273-25.274-25.273h-8.372c-2.733-2.052-6.399-3.318-10.443-3.318-8.436 0-15.273 5.471-15.273 12.219 0 6.683 6.707 12.104 15.029 12.209l-.003.049h19.062c2.27 0 4.115 1.845 4.115 4.115s-1.845 4.114-4.115 4.114h-8.816c-13.936 0-25.273 11.337-25.273 25.273 0 13.935 11.336 25.273 25.273 25.273h34.09v-21.159h-34.09a4.119 4.119 0 01-4.115-4.115zM108.346 368.809a4.119 4.119 0 014.115-4.114h8.816c13.936 0 25.274-11.337 25.274-25.273 0-13.935-11.337-25.273-25.274-25.273h-8.372c-2.733-2.052-6.399-3.318-10.443-3.318-8.436 0-15.273 5.471-15.273 12.219 0 6.683 6.707 12.104 15.029 12.209l-.003.049h19.062c2.27 0 4.115 1.845 4.115 4.115s-1.845 4.114-4.115 4.114h-8.816c-13.936 0-25.273 11.337-25.273 25.273 0 13.935 11.336 25.273 25.273 25.273h34.09v-21.159h-34.09a4.119 4.119 0 01-4.115-4.115z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Martinique +596</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.331h512v341.337H0z"></path><g fill="#FFDA44"><path d="M256 298.851c-45.956 0-84.348-32.298-93.767-75.429A96.288 96.288 0 00160 243.994c0 53.02 42.979 96 96 96s96-42.98 96-96c0-7.066-.785-13.942-2.233-20.572-9.419 43.131-47.811 75.429-93.767 75.429z"></path><path d="M255.999 171.994l8.935 27.502h28.918l-23.394 16.996 8.936 27.503-23.395-16.998-23.394 16.998 8.937-27.503-23.394-16.996h28.915z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mauritania +222</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.326H0z"></path><path fill="#D80027" d="M0 85.331h512v85.337H0z"></path><path fill="#0052B4" d="M0 170.657h512v85.337H0z"></path><path fill="#6DA544" d="M0 341.331h512v85.337H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mauritius +230</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 90 60"><path fill="white" d="M0 0h90v60H0z"></path><path stroke="#7f7f7f" stroke-width=".25" fill="#ABABAB" d="M12.8 38.5s4 1.6 1.2-.5c-2.4-1.7-5 2.4-5 5.1s1.2 7 7.5 7c7.6 0 11.4-5.7 11.4-11.4 0-4.8-3.7-13.5-6.5-14.6-3.1-1.2-6.7-3.5-6.8-5 0-.5 1.4-.1 3.3.9 3.1 1.7 6.6 2.5 6.6 1.4s-2.9-3.1-4-4.6c-1.2-1.6-.9-5.5-3-5.5-7.6 0-9.9 7.7-7 11.7 1.9 2.6-4.3 1-4.3 1s0 5.3 3.2 7.3c3 1.8 4.8 3.9 4.8 3.9s-.2-4.6.5-3.9c.6.7 11.1 4.5 10.3 12-.3 3-4.5 5.4-8.5 5.2-4-.2-6.8-2.4-6.4-5.4.2-4.2 2.7-4.6 2.7-4.6zM77.2 38.5s-4 1.6-1.2-.5c2.4-1.8 5.1 2.3 5.1 5.1s-1.2 7-7.5 7c-7.6 0-11.4-5.7-11.4-11.4 0-4.8 3.7-13.5 6.5-14.6 3.1-1.2 6.7-3.5 6.8-5 0-.5-1.4-.1-3.3.9-3.1 1.7-6.6 2.5-6.6 1.4s2.9-3.1 4-4.6c1.2-1.6.9-5.5 3-5.5 7.6 0 9.9 7.7 7 11.7-1.9 2.6 4.3 1 4.3 1s0 5.3-3.2 7.3c-3 1.8-4.8 3.9-4.8 3.9s.2-4.6-.5-3.9c-.6.7-11.1 4.5-10.3 12 .3 3 4.5 5.4 8.5 5.2 4-.2 6.8-2.4 6.4-5.4-.3-4.2-2.8-4.6-2.8-4.6z"></path><path fill="#DE393A" d="M31 28.8v14c0 1.9 2.1 1.6 2.1 1.6h9.3c1.2 0 2.6 2.3 2.6 2.3s1.4-2.3 2.5-2.3h9.6s2 .2 2-1.8V28.7H31z"></path><path fill="#3951A3" d="M31 13.1h28v15.7H31z"></path><path fill="white" d="M50.1 16.5c-.4 2.4-2.5 4.2-5.1 4.2-2.5 0-4.6-1.8-5.1-4.2-.5.9-.8 1.9-.8 3 0 3.3 2.6 5.9 5.9 5.9 3.3 0 5.9-2.6 5.9-5.9 0-1.1-.3-2.1-.8-3z"></path><circle fill="#FEE05F" cx="39.1" cy="36.5" r="3"></circle><circle fill="#FEE05F" cx="50.9" cy="36.5" r="3"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mayotte +262</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M341.334 85.33H0v341.332h512V85.33z"></path><path fill="#6DA544" d="M0 85.333h170.663V426.67H0z"></path><path fill="white" d="M170.663 85.333h170.663V426.67H170.663z"></path><path fill="#6DA544" d="M208 255.996c0 26.509 21.491 48 48 48s48-21.491 48-48v-16h-96v16z"></path><path fill="#FF9811" d="M320 223.996h-48c0-8.836-7.164-16-16-16s-16 7.164-16 16h-48c0 8.836 7.697 16 16.533 16H208c0 8.836 7.164 16 16 16 0 8.836 7.164 16 16 16h32c8.836 0 16-7.164 16-16 8.836 0 16-7.164 16-16h-.533c8.836 0 16.533-7.163 16.533-16z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mexico +52</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#338AF3" d="M0 0h512v341.3H0z"></path><g fill="white"><path d="M256 37.9l10.1 31.2H299l-26.6 19.3 10.2 31.2-26.6-19.3-26.6 19.3 10.2-31.2L213 69.1h32.9zM123.2 170.7l31.2-10.2v-32.8l19.3 26.6 31.2-10.2-19.3 26.6 19.3 26.5-31.2-10.1-19.3 26.5v-32.8zM256 303.5l-10.1-31.2H213l26.6-19.3-10.2-31.3L256 241l26.6-19.3-10.2 31.3 26.6 19.3h-32.9zM388.8 170.7l-31.2 10.1v32.8l-19.3-26.5-31.2 10.1 19.3-26.5-19.3-26.6 31.2 10.2 19.3-26.6v32.8z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Micronesia, Federated States of Micronesia +691</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#FFDA44" d="M0 0h513v342H0z"></path><path fill="#D80027" d="M342 0h171v342H342z"></path><path fill="#0052B4" d="M0 0h171v342H0z"></path><path fill="#AF7F59" d="M206.2 129.1h33.2L256 79.3l16.6 49.8h33.2v99.6L256 262l-49.8-33.2v-99.7zm33.2 33.3v49.8h33.2v-49.8h-33.2z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Moldova +373</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.34h512v341.326H0z"></path><path fill="#D80027" d="M512 85.334v166.69L0 256.175V85.334z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Monaco +377</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.331h512v341.326H0z"></path><g fill="#A2001D"><path d="M330.207 85.331H512v341.337H330.207zM0 85.331h181.793v341.337H0z"></path></g><g fill="#FFDA44"><path d="M113.163 267.125h14.84v59.359h-14.84zM53.793 267.125h14.84v59.359h-14.84z"></path><circle cx="90.902" cy="289.386" r="14.84"></circle><circle cx="90.902" cy="237.44" r="7.421"></circle><path d="M76.054 311.647h29.682v14.84H76.054zM76.054 252.288h29.682v14.84H76.054zM90.897 185.502l5.255 16.173h17.006l-13.757 9.996 5.252 16.173-13.756-9.996-13.756 9.996 5.251-16.173-13.756-9.996h17.005z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mongolia +976</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><path fill="#A2001D" d="M0 115.011h512v281.978H0z"></path><g fill="#FFDA44"><path d="M218.899 211.478h74.202v-29.681l-14.84 7.42L256 166.957l-22.261 22.26-14.84-7.42zM322.783 256h-37.088a17 17 0 002.3-8.543c0-9.458-7.668-17.124-17.124-17.124-6.534 0-12.209 3.661-15.096 9.041-2.887-5.38-8.562-9.041-15.096-9.041-9.456 0-17.124 7.666-17.124 17.124 0 3.114.846 6.026 2.3 8.543h-36.636c0 11.349 9.885 20.549 21.232 20.549h-.685c0 9.31 6.192 17.168 14.68 19.694l-16.678 16.678 15.741 15.741 22.329-22.329c.875.321 1.78.577 2.714.752l-13.492 30.464c6.466 2.629 13.531 4.088 20.941 4.088s14.475-1.46 20.941-4.088l-13.492-30.464a17.108 17.108 0 002.714-.752l22.329 22.329 15.741-15.741-16.678-16.678c8.488-2.526 14.68-10.385 14.68-19.694h-.685c11.347 0 21.232-9.2 21.232-20.549z"></path></g><path fill="#6DA544" d="M256 267.13l-24.116 11.131v22.261L256 315.362l24.116-14.84v-22.261z"></path><path fill="#0052B4" d="M231.88 256h48.228v29.682H231.88z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Montenegro +382</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.333h512V426.67H0z"></path><path fill="#338AF3" d="M334.222 191.996v78.221c0 38.103 49.777 49.779 49.777 49.779s49.778-11.675 49.778-49.779v-78.221h-99.555z"></path><path fill="#A2001D" d="M334.222 270.217c0 38.103 49.777 49.779 49.777 49.779s49.778-11.675 49.778-49.779h-99.555z"></path><path d="M405.334 227.552H391.11v-14.223h-14.222v14.223h-14.222v14.223h14.222v42.665h14.222v-42.665h14.224z"></path><path fill="white" d="M256 85.333v30.553l-45.167 25.099H256v59.359h-59.103L256 233.179v22.817h-26.68l-73.494-40.826v40.826h-55.652v-48.573l-87.43 48.573H0v-30.554l45.167-25.098H0v-59.359h59.103L0 108.139V85.333h26.68l73.494 40.825V85.333h55.652v48.572l87.43-48.572z"></path><path fill="#D80027" d="M144 85.33h-32v69.332H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path fill="#0052B4" d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915z"></path><path fill="white" d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915z"></path><g fill="#D80027"><path d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915zM71.846 200.344L0 240.259v15.737l100.174-55.652z"></path></g><path fill="#0052B4" d="M100.174 140.982L0 85.33v15.737l71.847 39.915z"></path><path fill="white" d="M100.174 140.982L0 85.33v15.737l71.847 39.915z"></path><g fill="#D80027"><path d="M100.174 140.982L0 85.33v15.737l71.847 39.915zM184.154 140.982L256 101.067V85.33l-100.174 55.652z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Montserrat +1664</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337v341.326h512V85.337z"></path><path fill="#20661b" d="M352 226.484h-73.337L256 156.738l-22.663 69.748H160l59.331 43.107-22.663 69.749L256 296.232l59.332 43.107-22.663-69.749L352 226.484zm-116.063 37.711l7.663-23.585h24.8l7.663 23.585v.001L256 278.772l-20.063-14.577zm27.873-37.711h-15.619L256 202.447l7.81 24.037zm24.269 28.982l-4.827-14.856h25.274l-20.447 14.856zm-59.331-14.856l-4.827 14.856-20.447-14.856h25.274zm-5.211 61.748l7.81-24.036 12.636 9.181-20.446 14.855zm44.479-14.856l12.636-9.181 7.81 24.036-20.446-14.855z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Morocco +212</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M0 322.783h512v103.88H0z"></path><path fill="#496E2D" d="M0 85.337h512v104.515H0z"></path><path d="M0 210.877h512v89.656H0z"></path><path fill="#A2001D" d="M256 256.006L0 426.668V85.331z"></path><path fill="#FFDA44" d="M83.477 195.132l15.107 46.498h48.894l-39.554 28.739 15.107 46.499-39.554-28.738-39.555 28.738 15.11-46.499-39.554-28.739H68.37z"></path><path fill="white" d="M39.268 256h88.42v40.578h-88.42z"></path><path d="M144.443 209.479l-14.347-14.347-46.618 46.618-46.617-46.618-14.347 14.347 46.658 46.577-46.658 46.658 14.347 14.154 46.617-46.534 46.618 46.534 14.347-14.154-46.659-46.658z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Mozambique +258</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M0 85.337h512v113.775H0z"></path><path fill="#D80027" d="M0 312.888h512v113.775H0z"></path><path fill="white" d="M384 227.261h-97.783L256 134.265l-30.217 92.997H128l79.108 57.475-30.217 92.998L256 320.925l79.108 56.81-30.217-92.998L384 227.261z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Myanmar +95</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.337h512v341.326H0z"></path><path fill="#0052B4" d="M0 426.663V85.337h512"></path><path fill="white" d="M512 152.222V85.337H411.67L0 359.778v66.885h100.33z"></path><path fill="#A2001D" d="M512 85.337v40.125L60.193 426.663H0v-40.125L451.807 85.337z"></path><path fill="#FFDA44" d="M187.737 189.212l-22.741 10.696 12.11 22.024-24.693-4.724-3.129 24.945-17.199-18.347-17.2 18.347-3.129-24.945-24.693 4.723 12.109-22.023-22.739-10.696 22.74-10.697-12.11-22.022 24.693 4.722 3.13-24.944 17.199 18.347 17.2-18.347 3.128 24.944 24.693-4.722-12.108 22.024z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Namibia +264</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M0 239.994h512v32H0z"></path><path fill="white" d="M174.802 341.329l-19.124 8.996 10.184 18.521-20.767-3.973-2.631 20.978L128 370.422l-14.465 15.429-2.63-20.978-20.767 3.973 10.183-18.521-19.123-8.996 19.124-8.995-10.184-18.52 20.766 3.971 2.632-20.978L128 312.236l14.465-15.429 2.63 20.978 20.767-3.971-10.183 18.521z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Nauru +674</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#0052B4" d="M0 426.663V85.337l280.419 174.75H87.61l183.576 166.576z"></path><path fill="#D80027" d="M244.769 249.888L10.199 103.71v312.754h234.57L61.193 249.888z"></path><g fill="white"><path d="M98.003 324.433l-14.589-6.863 7.77-14.13-15.844 3.03-2.008-16.005-11.035 11.772-11.036-11.772-2.008 16.005-15.843-3.031 7.77 14.131-14.591 6.863 14.591 6.862-7.77 14.13 15.844-3.029 2.007 16.004 11.036-11.772L73.332 358.4l2.008-16.004 15.843 3.03-7.769-14.13zM88.268 191.662l-10.612-4.991 5.651-10.278-11.523 2.205-1.461-11.641-8.026 8.561-8.026-8.561-1.46 11.641-11.525-2.205 5.652 10.278-10.613 4.991 25.972 5.194z"></path><path d="M93.462 191.662c0 17.212-13.953 31.165-31.165 31.165s-31.165-13.953-31.165-31.165"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Nepal +977</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#A2001D" d="M0 85.337h512v113.775H0z"></path><path fill="#0052B4" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Netherlands +31</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 640 426.7"><path fill="#009543" d="M0 293h640v133.7H0V293z"></path><path fill="#ED4135" d="M0 132h640v161.3H0V132z"></path><path fill="#0035AD" d="M0 0h640v133.3H0V0z"></path><circle fill="#FAE600" stroke="black" stroke-width="5.3" cx="240" cy="213.3" r="157.3"></circle><path d="M307.9 354.5l-31.8 12-36.1 4.2-37.8-2.4-35.9-15.5s28.6-29.3 40.7-33.5c8.6-3 22.4-3.7 22.4-3.7V122l-.3-66H246l-.5 67.5v191.7s15.3 1.2 22.1 4.1c11.3 4.9 40.3 35.2 40.3 35.2z"></path><path d="M212.727 102.375l42.955-21.418 5.577 11.187-42.955 21.417z"></path><ellipse cx="237.8" cy="280.5" rx="16.8" ry="26.5"></ellipse><circle cx="237.4" cy="143.4" r="20.9"></circle><ellipse cx="238.4" cy="211.1" rx="19.9" ry="12.1"></ellipse><path d="M213.8 177h47v10h-47zM213.8 234h47v10h-47z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">New Caledonia +687</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><g fill="#338AF3"><path d="M0 85.337h512v113.775H0zM0 312.888h512v113.775H0z"></path></g><path fill="#FFDA44" d="M256 214.447c-22.949 0-41.553 18.603-41.553 41.553S233.05 297.553 256 297.553c22.949 0 41.553-18.603 41.553-41.553S278.949 214.447 256 214.447zm0 65.298c-13.114 0-23.745-10.631-23.745-23.745s10.631-23.745 23.745-23.745 23.745 10.631 23.745 23.745-10.631 23.745-23.745 23.745z"></path><path fill="#0052B4" d="M276.563 261.936L256 256l-20.563 5.936-6.855 11.873h54.836z"></path><path fill="#338AF3" d="M256 226.32l-13.709 23.744L256 256l13.709-5.936z"></path><path fill="#6DA544" d="M235.437 261.936h41.126l-6.854-11.872h-27.418z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Nicaragua +505</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#FF9811" d="M0 85.337h512v113.775H0z"></path><path fill="#6DA544" d="M0 312.888h512v113.775H0z"></path><circle fill="#FF9811" cx="256" cy="256" r="32"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Niger +227</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><g fill="#6DA544"><path d="M0 85.331h170.663v341.337H0zM341.337 85.331H512v341.337H341.337z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Nigeria +234</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.334h512v341.337H0z"></path><path fill="white" d="M0 85.334h256v170.663H0z"></path><g fill="#D80027"><path d="M144 85.33h-32v69.333H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path d="M0 85.329v15.083l57.377 38.251H80z"></path></g><g fill="#2E52B2"><path d="M0 107.951v30.712h46.069zM96 85.331v48.913L22.628 85.331z"></path></g><path fill="#D80027" d="M256 85.329v15.083l-57.377 38.251H176z"></path><g fill="#2E52B2"><path d="M256 107.951v30.712h-46.069zM160 85.331v48.913l73.372-48.913z"></path></g><path fill="#D80027" d="M0 85.329v15.083l57.377 38.251H80z"></path><g fill="#2E52B2"><path d="M0 107.951v30.712h46.069zM96 85.331v48.913L22.628 85.331z"></path></g><path fill="#D80027" d="M256 85.329v15.083l-57.377 38.251H176z"></path><g fill="#2E52B2"><path d="M256 107.951v30.712h-46.069zM160 85.331v48.913l73.372-48.913z"></path></g><path fill="#D80027" d="M0 255.997v-15.082l57.377-38.252H80z"></path><g fill="#2E52B2"><path d="M0 233.376v-30.713h46.069zM96 255.994v-48.912l-73.372 48.912z"></path></g><path fill="#D80027" d="M256 255.997v-15.082l-57.377-38.252H176z"></path><g fill="#2E52B2"><path d="M256 233.376v-30.713h-46.069zM160 255.994v-48.912l73.372 48.912z"></path><circle cx="128" cy="170.66" r="22.627"></circle></g><g fill="#FFDA44"><path d="M128 154.663l3.97 12.222h12.854l-10.398 7.556 3.971 12.222L128 179.109l-10.398 7.554 3.972-12.222-10.398-7.556h12.853zM128 219.803l2.364 7.278h7.653l-6.19 4.498 2.364 7.278-6.191-4.498-6.191 4.498 2.364-7.278-6.19-4.498h7.652zM128 102.469l2.364 7.278h7.653l-6.19 4.498 2.364 7.278-6.191-4.498-6.191 4.498 2.364-7.278-6.19-4.498h7.652zM197.931 161.136l2.365 7.277h7.653l-6.192 4.499 2.365 7.279-6.191-4.498-6.191 4.498 2.365-7.279-6.191-4.499h7.652zM58.069 161.136l2.364 7.277h7.653l-6.191 4.499 2.364 7.279-6.19-4.498-6.191 4.498 2.365-7.279-6.192-4.499h7.653z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Niue +683</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><g fill="#6DA544"><path d="M0 85.331h170.663v341.337H0zM341.337 85.331H512v341.337H341.337zM304 311.995l-48-152.001-48 152.001h36v39.999h24v-39.999z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Norfolk Island +672</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.333h512V426.67H0z"></path><g fill="#D80027"><path d="M383.875 426.662L256 252.286l26.827 174.376zM133.565 85.33L256 252.286 230.314 85.33zM229.171 426.662L256 252.286 128.124 426.662zM0 85.33V212.9l256 39.386L28.333 85.33zM0 426.662h18.212L256 252.286 0 291.67zM256 252.286L512 212.9V85.33h-28.331zM281.686 85.33L256 252.286 378.434 85.33zM512 426.662V291.671l-256-39.385 237.787 174.376z"></path><circle cx="256" cy="252.29" r="59.359"></circle></g><circle fill="#FFDA44" cx="256" cy="252.29" r="44.522"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">North Macedonia +389</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 750 500"><path fill="#0071BC" d="M0 0h750v500H0V0z"></path><g fill="white" stroke="black" stroke-width="1.9"><circle cx="375" cy="245" r="225" fill="white"></circle><circle cx="375" cy="245" r="165" fill="#0071BC"></circle></g><g stroke="black"><path fill="#8C8A8C" stroke-width="1.9" d="M444.7 450c.7 11-7.8 20-18.8 20H323.6c-11 0-19.5-9-19-20l16.7-325c.6-11 10-20 21-20h61.4c11 0 20.5 9 21.2 20l19.8 325z"></path><path fill="white" stroke-width="2" stroke-linejoin="round" d="M373 114l30 93h97l-78 56 29 92-78-56-78 57 30-93-79-57h97l30-92z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Northern Mariana Islands +1670</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.334h512v341.337H0z"></path><path fill="white" d="M512 295.883H202.195v130.783H122.435V295.883H0V216.111h122.435V85.329H202.195v130.782H512V277.329z"></path><path fill="#2E52B2" d="M512 234.666v42.663H183.652v149.337h-42.674V277.329H0v-42.663h140.978V85.329h42.674v149.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Norway +47</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><g fill="#D80027"><path d="M0 85.331h512v341.326H0z"></path><path d="M0 85.331h512v341.337H0z"></path></g><g fill="white"><path d="M189.746 160.439l-15.739-15.741-10.494 10.494-10.493-10.494-15.741 15.741 10.494 10.493-10.495 10.494 15.74 15.741 10.494-10.494 10.495 10.494 15.739-15.741-10.494-10.494zM211.478 85.331H512v111.315H211.478z"></path></g><path fill="#6DA544" d="M211.478 315.353H512v111.304H211.478z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Oman +968</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><g fill="white"><path d="M393.508 170.516l17.512 18.875 23.363-10.821-12.541 22.487 17.513 18.876-25.263-4.978-12.539 22.488-3.073-25.564-25.263-4.978 23.363-10.82z"></path><path d="M0 85.343h512v341.326H0z"></path></g><path fill="#496E2D" d="M128 85.331h384v341.337H128z"></path><g fill="white"><path d="M361.909 298.793c-31.037 22.426-74.378 15.446-96.804-15.592-22.427-31.038-15.446-74.379 15.593-96.804 9.677-6.992 20.55-11.125 31.613-12.563-21.283-3.183-43.777 1.613-62.598 15.211-38.2 27.602-46.792 80.944-19.191 119.145 27.601 38.199 80.944 46.792 119.145 19.189 18.82-13.598 30.436-33.448 34.096-54.655-4.839 10.05-12.176 19.076-21.854 26.069zM360.58 172.889l17.484 18.842 23.322-10.802-12.519 22.447 17.483 18.844-25.219-4.968-12.519 22.45-3.067-25.521-25.22-4.969 23.323-10.802z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Pakistan +92</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#338AF3" d="M0 85.331h512v341.337H0z"></path><circle fill="#FFDA44" cx="218.902" cy="255.994" r="74.207"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Palau +680</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path d="M0 85.337h512v113.775H0z"></path><path fill="#6DA544" d="M0 312.888h512v113.775H0z"></path><path fill="#D80027" d="M256 256.006L0 426.668V85.331z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Palestine +970</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path d="M0 85.333h512V426.67H0z"></path><path fill="#A2001D" d="M0 85.33h512v341.332"></path><g fill="white"><path d="M204.631 326.488l2.762 8.504h8.941l-7.233 5.255 2.763 8.502-7.233-5.254-7.233 5.254 2.762-8.502-7.233-5.255h8.94zM181.797 244.866l4.605 14.172h14.901l-12.056 8.757 4.605 14.172-12.055-8.759-12.055 8.759 4.606-14.172-12.056-8.757h14.901zM181.797 348.749l4.604 14.173h14.902l-12.057 8.757 4.606 14.173-12.055-8.759-12.055 8.759 4.604-14.173-12.054-8.757h14.899zM225.363 281.967l4.606 14.172h14.901l-12.056 8.758 4.605 14.172-12.056-8.759-12.054 8.759 4.606-14.172-12.056-8.758h14.901zM138.23 281.967l4.606 14.172h14.899l-12.054 8.758 4.603 14.172-12.054-8.759-12.055 8.759 4.605-14.172-12.055-8.758h14.9z"></path></g><path fill="#FFDA44" d="M376.526 204.163c-7.628-7.628-17.538-12.133-28.189-12.908l31.88-24.795c-12.698-12.698-29.714-18.431-46.319-17.218a44.31 44.31 0 00-11.396-19.511l-12.593 25.186a18.47 18.47 0 00-3.148-4.197c-7.245-7.245-18.991-7.244-26.234 0s-7.245 18.99 0 26.234a18.536 18.536 0 004.197 3.148l-25.186 12.593a44.303 44.303 0 0019.519 11.399c-1.217 16.606 4.511 33.619 17.209 46.317L324.12 214.6a11.053 11.053 0 017.807-3.202c2.973 0 5.768 1.158 7.87 3.26a11.055 11.055 0 013.26 7.87c0 2.974-1.158 5.768-3.26 7.87l10.494 10.494c4.905-4.905 7.607-11.428 7.607-18.364 0-5.675-1.81-11.071-5.153-15.534a29.492 29.492 0 0113.288 7.662c11.573 11.572 11.573 30.403 0 41.975l10.494 10.494c8.409-8.409 13.039-19.59 13.039-31.481-.001-11.892-4.632-23.072-13.04-31.481z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Papua New Guinea +675</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#0052B4" d="M0 312.888h512v113.775H0z"></path><path fill="#6DA544" d="M289.579 216.738l-12.592 12.592c5.37 5.372 8.693 12.792 8.693 20.988 0 16.392-13.289 29.68-29.68 29.68-16.392 0-29.68-13.289-29.68-29.68 0-8.195 3.322-15.616 8.693-20.988l-12.592-12.592c-8.594 8.594-13.91 20.466-13.91 33.579 0 26.228 21.261 47.489 47.489 47.489s47.489-21.261 47.489-47.489c0-13.112-5.316-24.985-13.91-33.579z"></path><path fill="#FFDA44" d="M256 232.51l4.421 13.605h14.304l-11.573 8.408 4.421 13.604L256 259.719l-11.573 8.408 4.421-13.604-11.573-8.408h14.304z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Paraguay +595</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.326H0z"></path><g fill="#D80027"><path d="M0 85.331h170.663v341.337H0zM341.337 85.331H512v341.337H341.337z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Peru +51</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#0052B4" d="M512 85.337V256H256L0 85.337z"></path><path fill="#D80027" d="M512 256v170.663H0L256 256z"></path><g fill="#FFDA44"><path d="M161.908 256l-27.288-12.835 14.532-26.428-29.632 5.668-3.755-29.933-20.64 22.015-20.639-22.015-3.755 29.933-29.631-5.669 14.531 26.428L28.343 256l27.288 12.835L41.1 295.263l29.633-5.668 3.753 29.933 20.639-22.015 20.64 22.015 3.755-29.933 29.631 5.669-14.532-26.427zM21.789 117.607l9.081 12.696 14.879-4.714-9.268 12.56 9.081 12.694-14.809-4.932-9.268 12.559.117-15.608-14.809-4.934 14.88-4.712zM21.789 353.53l9.081 12.696 14.879-4.714-9.268 12.56 9.081 12.695-14.809-4.933-9.268 12.558.117-15.607-14.809-4.934 14.88-4.712zM210.395 235.569l-9.081 12.695-14.879-4.713 9.268 12.559-9.081 12.696 14.809-4.933 9.268 12.558-.117-15.607 14.809-4.934-14.88-4.713z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Philippines +63</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.333h512V426.67H0z"></path><path fill="#ACABB1" d="M400.696 219.822L384 225.387l-16.696-5.565-5.565-13.913 5.565-13.913h33.392l-5.566 13.913z"></path><path fill="#338AF3" d="M345.043 219.822v61.217c0 29.821 38.957 38.957 38.957 38.957s38.957-9.137 38.957-38.957v-61.217h-77.914z"></path><path fill="#6DA544" d="M348.555 295.541C358.131 313.927 384 319.996 384 319.996s25.869-6.069 35.445-24.455L384 236.518l-35.445 59.023z"></path><path fill="#FFDA44" d="M422.957 280.421L384 219.822l-38.957 60.599v.618c0 5.518 1.337 10.328 3.512 14.503L384 240.405l35.445 55.137c2.175-4.175 3.512-8.983 3.512-14.503v-.618z"></path><path fill="white" d="M256 85.333v30.553l-45.167 25.099H256v59.359h-59.103L256 233.179v22.817h-26.68l-73.494-40.826v40.826h-55.652v-48.573l-87.43 48.573H0v-30.554l45.167-25.098H0v-59.359h59.103L0 108.139V85.333h26.68l73.494 40.825V85.333h55.652v48.572l87.43-48.572z"></path><path fill="#D80027" d="M144 85.33h-32v69.332H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path fill="#0052B4" d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915z"></path><path fill="white" d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915z"></path><g fill="#D80027"><path d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915zM71.846 200.344L0 240.259v15.737l100.174-55.652z"></path></g><path fill="#0052B4" d="M100.174 140.982L0 85.33v15.737l71.847 39.915z"></path><path fill="white" d="M100.174 140.982L0 85.33v15.737l71.847 39.915z"></path><g fill="#D80027"><path d="M100.174 140.982L0 85.33v15.737l71.847 39.915zM184.154 140.982L256 101.067V85.33l-100.174 55.652z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Pitcairn +872</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><g fill="white"><path d="M0 85.337h512v341.326H0z"></path><path d="M0 85.337h512V256H0z"></path></g><path fill="#D80027" d="M0 256h512v170.663H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Poland +48</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="#6DA544" d="M196.641 85.337v341.326H0V85.337z"></path><circle fill="#FFDA44" cx="196.641" cy="256" r="64"></circle><path fill="#D80027" d="M160.638 224v40.001c0 19.882 16.118 36 36 36s36-16.118 36-36V224h-72z"></path><path fill="white" d="M196.638 276c-6.617 0-12-5.383-12-12v-16h24.001v16c-.001 6.616-5.385 12-12.001 12z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Portugal +351</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><g fill="#D80027"><path d="M0 85.337h512V153.6H0zM0 221.863h512v68.263H0zM0 358.4h512v68.263H0z"></path></g><path fill="#0052B4" d="M256 256.006L0 426.668V85.331z"></path><path fill="white" d="M83.477 195.132l15.107 46.498h48.894l-39.554 28.739 15.107 46.499-39.554-28.738-39.555 28.738 15.11-46.499-39.554-28.739H68.37z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Puerto Rico +1939</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#751A46" d="M2.216 86.076H512v339.848H2.216z"></path><path fill="white" d="M209.455 154.969l-50.236 25.267 50.236 25.257-50.236 25.267 50.236 25.257-50.236 25.266 50.236 25.257-50.236 25.268 50.236 25.257-50.236 25.267 50.236 25.268-36.45 18.33H0V86.07h172.939l36.516 18.364-50.236 25.267z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Qatar +974</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 26.666 640 426.666"><g fill-rule="evenodd" stroke-width="1pt"><path fill="white" d="M0 0h640v480H0z"></path><path fill="#00267f" d="M0 0h213.3v480H0z"></path><path fill="#f31830" d="M426.7 0H640v480H426.7z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Reunion +262</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.326H0z"></path><path fill="#0052B4" d="M0 85.331h170.663v341.337H0z"></path><path fill="#D80027" d="M341.337 85.331H512v341.337H341.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Romania +40</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.33v341.332h512V85.33z"></path><path fill="#0052B4" d="M0 85.333h512V426.67H0z"></path><path fill="white" d="M0 85.333h512v113.775H0z"></path><path fill="#D80027" d="M0 312.884h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Russia +7</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#338AF3" d="M0 85.331h512v341.337H0z"></path><path fill="#FFDA44" d="M0 255.994h512v81.619H0z"></path><path fill="#496E2D" d="M0 337.614h512v89.043H0z"></path><path fill="#FFDA44" d="M278.261 185.209l20.844 9.804-11.099 20.186 22.632-4.33 2.868 22.865 15.765-16.816 15.766 16.816 2.867-22.865 22.633 4.33-11.099-20.186 20.843-9.804-20.844-9.805 11.1-20.185-22.633 4.329-2.868-22.864-15.765 16.816-15.766-16.816-2.867 22.864-22.634-4.329 11.1 20.187z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Rwanda +250</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.33"><path fill="white" d="M0 0h512v341.33H0z"></path><path fill="#E6BC00" d="M157.31 199.76s-9.04 43.93-19.31 40.39c-10.62-3.54-17.53-18.76-17.53-18.76l-14.52 21.24s38.18 8.48 41.01 5.47c1.22-1.14 8.21-15.1 10.34-26.05v-22.29zm-56.13 60.57s-2.48 20.18-1.06 22.66c1.24 2.3 39.48 11.33 39.48 11.33s-24.96 16.46-29.74 20.54L91.8 284.94l-.71-24.61h10.09zM112.51 94.64s39.65 41.6 40.36 45.5c.71 3.72-4.25 3.19-4.25 3.19s-44.79-37.53-49.92-41.07c-5.31-3.55 13.81-7.62 13.81-7.62z"></path><path fill="#ADADAD" d="M99.41 104.73s16.99-.71 16.64-11.51c-.35-10.62-11.15-14.87-19.12-12.39-7.97 2.3-23.01 13.45-13.63 35.05 9.38 21.42 23.37 29.39 26.2 47.8 0 0-5.46 9.86-19.12.35-16.9-11.77-6.2-38.24-10.44-44.96-4.25-7.08-40.95-38.92-40.95-38.92s-30.24 39.37-18 74.92c16.95 49.21 51.74 31.98 64.61 36.76 0 0-42.13 61.96-49.57 67.09 0 0 24.08 8.32 47.8-18.76 0 0 5.84 9.74 7.08 20.18h10.27c4.78-26.2 51.51-64.26 49.92-82.32-1.77-21.25-49.21-49.39-51.69-73.29z"></path><path fill="#E6BC00" d="M359.17 201.27s8.96 42.43 19.23 38.89c10.62-3.54 17.53-18.76 17.53-18.76l14.52 21.24s-37 8.48-39.83 5.47c-1.21-1.14-9.32-13.79-11.52-24.66l.07-22.18zm56.05 59.06s2.48 20.18 1.06 22.66c-1.24 2.3-39.48 11.33-39.48 11.33s24.96 16.46 29.74 20.54l18.06-29.92.71-24.61h-10.09zM403.89 94.64s-39.65 41.6-40.36 45.5c-.71 3.72 4.25 3.19 4.25 3.19s44.79-37.53 49.92-41.07c5.14-3.55-13.81-7.62-13.81-7.62z"></path><path fill="#125ECC" d="M157.31 87.06H359.1v145.46c0 16.06-9.69 21.39-21.91 31.85l-45.92 39.41c-18.25 15.62-47.91 15.57-66.07 0l-46.01-39.43c-12.08-10.35-21.88-15.71-21.88-31.82V87.06z"></path><path fill="#FFE600" d="M200.55 147.71c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41zm57.65-3c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41zm57.65 3c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41zM214.96 274.43c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41c.01 7.96-6.45 14.41-14.41 14.41zm43.24 14.42c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41c0 7.95-6.45 14.41-14.41 14.41zm43.24-14.42c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41z"></path><path fill="#D60537" d="M157.31 175.36H359.1v57.65H157.31v-57.65z"></path><path fill="#EACE00" d="M142.9 43.82s57.65-14.41 115.31-14.41 115.31 14.41 115.31 14.41l-14.41 57.65s-50.45-14.41-100.89-14.41-100.89 14.41-100.89 14.41L142.9 43.82z"></path><path fill="#7A6920" d="M258.2 72.65c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41zm57.65 5c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41zm-115.3 0c-7.96 0-14.41-6.45-14.41-14.41s6.45-14.41 14.41-14.41 14.41 6.45 14.41 14.41-6.45 14.41-14.41 14.41z"></path><path fill="#ADADAD" d="M365.08 178.02c-1.59 18.06 45.14 56.12 49.92 82.32h10.27c1.24-10.44 7.08-20.18 7.08-20.18 23.72 27.09 47.8 18.76 47.8 18.76-7.44-5.13-49.57-67.09-49.57-67.09 12.88-4.78 47.67 12.45 64.61-36.76 12.24-35.55-18-74.92-18-74.92s-36.7 31.84-40.95 38.92c-4.25 6.73 6.46 33.2-10.44 44.96-13.66 9.51-19.12-.35-19.12-.35 2.83-18.41 16.82-26.38 26.2-47.8 9.38-21.6-5.66-32.75-13.63-35.05-7.97-2.48-18.76 1.77-19.12 12.39-.35 10.8 16.64 11.51 16.64 11.51-2.48 23.9-49.92 52.04-51.69 73.29z"></path><circle fill="white" cx="258.2" cy="204.19" r="16.93"></circle></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Barthelemy +590</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#0052B4" d="M0 0h512v341.3H0z"></path><path fill="white" d="M256 0v117.4h-46.1l46.1 30.7v22.6h-22.6L160 121.8v48.9H96v-48.9l-73.4 48.9H0v-22.6l46.1-30.7H0v-64h46.1L0 22.7V0h22.6L96 48.9V0h64v48.9L233.4 0z"></path><g fill="#D80027"><path d="M144 0h-32v69.4H0v32h112v69.3h32v-69.3h112v-32H144z"></path><path d="M0 0v15.1l57.4 38.3H80zM256 0v15.1l-57.4 38.3H176z"></path></g><path fill="#2E52B2" d="M256 22.7v30.7h-46.1z"></path><g fill="#D80027"><path d="M0 0v15.1l57.4 38.3H80zM256 0v15.1l-57.4 38.3H176z"></path></g><path fill="#2E52B2" d="M256 22.7v30.7h-46.1z"></path><g fill="#D80027"><path d="M0 170.7v-15.1l57.4-38.2H80zM256 170.7v-15.1l-57.4-38.2H176z"></path></g><path fill="#29DBFF" d="M449 139.7c-.1 44.4-7.2 92.1-65 114.9-57.8-22.8-64.9-70.5-65-114.9h130z"></path><path fill="#ffda44" d="M449 139.7c0-16.7-.9-32.9-.5-47.1C426.9 83 398.4 81 383.9 81s-42.9 2-64.6 11.6c.4 14.2-.5 30.4-.5 47.1H449z"></path><path fill="#BF521B" d="M369.5 204.5l.3 10.3-12.8.2 4.9 13.2h-17.3c-18-20.2-23.4-42.4-24.9-68.1l9.1-9.7 8.3 14.3 10.8-12.8 7 7.8.8 15.7 13.8 29.1z"></path><path fill="#474747" d="M436.6 192.5l-8.6 18.3h-47l-29.2-19.5 25.7 10.5h25.1l3.7-6.5 7.2.2 2-3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Helena, Ascension and Tristan Da Cunha +290</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#D80027" d="M0 0h513v342H0z"></path><path fill="#6DA544" d="M512 0H0v342"></path><path fill="#FFDA44" d="M307.7 0L0 194.5V342h206.9L513 148.5V0z"></path><path d="M513 0H385.2L0 249.4V341l126.2 1L513 91.6z"></path><g fill="white"><path d="M141.1 187l31.2 24 32.3-22.2-13.1 37 31.1 23.9-39.2-1.1-13.2 37-11.1-37.6-39.2-1.1 32.3-22.2zM310.6 70.8l31.2 23.9 32.3-22.2-13.1 37 31.1 23.9-39.2-1.1-13.2 37-11.1-37.6-39.2-1.1 32.4-22.2z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Kitts and Nevis +1869</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="#55B2FF" d="M0 0h513v342H0z"></path><path fill="#F3F3F3" d="M148.5 298.1h216l-108-254.2z"></path><path fill="#333" d="M186 272.7l70.5-160.3L327 272.7z"></path><path fill="#FFDA44" d="M148.5 298.1h216l-108-101.7z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Lucia +1758</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 108 72"><path d="M0 0h108v72H0z" fill="#003787"></path><path d="M0 0h108L60 48v24H48V48z" fill="white"></path><circle cx="54" cy="30" r="8" fill="#f9d90f"></circle><path d="M44 30h20L54 48z" fill="white"></path><path d="M54 48L38 33h32z" fill="#cf142b"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Martin +590</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 26.666 640 426.666"><g fill-rule="evenodd" stroke-width="1pt"><path fill="white" d="M0 0h640v480H0z"></path><path fill="#00267f" d="M0 0h213.3v480H0z"></path><path fill="#f31830" d="M426.7 0H640v480H426.7z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Pierre and Miquelon +508</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.337H0z"></path><path fill="#338AF3" d="M0 85.331h170.663v341.337H0z"></path><g fill="#6DA544"><path d="M341.337 85.331H512v341.337H341.337zM214.261 283.82l-33.393-50.086 33.392-50.087 33.392 50.087zM297.739 283.82l-33.391-50.086 33.391-50.087 33.393 50.087zM256 350.603l-33.391-50.087L256 250.429l33.391 50.087z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saint Vincent and the Grenadines +1784</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.337H0z"></path><path fill="#0052B4" d="M0 85.331h256v170.663H0z"></path><g fill="white"><path d="M165.483 181.79l2.764 8.504h8.939l-7.232 5.254 2.763 8.503-7.234-5.255-7.233 5.255 2.763-8.503-7.233-5.254h8.94zM120.579 115.007l4.606 14.173h14.9l-12.055 8.757 4.605 14.171-12.056-8.758-12.054 8.758 4.605-14.171-12.056-8.757h14.901zM165.101 129.848l4.606 14.172h14.9l-12.055 8.757 4.604 14.173-12.055-8.76-12.054 8.76 4.604-14.173-12.055-8.757h14.9zM129.909 189.211l4.606 14.172h14.9l-12.055 8.758 4.604 14.171-12.055-8.759-12.054 8.759 4.604-14.171-12.055-8.758h14.9zM90.899 152.108l4.605 14.173h14.9l-12.055 8.757 4.604 14.173-12.054-8.76-12.055 8.76 4.604-14.173-12.055-8.757h14.9z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Samoa +685</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#338AF3" d="M0 85.34h512v341.326H0z"></path><path fill="white" d="M512 85.334v166.69L0 256.175V85.334z"></path><path fill="#6DA544" d="M323.744 203.099L256 270.843l-67.744-67.744a81.156 81.156 0 00-13.879 45.483v22.261c0 35.744 23.097 66.193 55.148 77.213-4.277 8.385-3.556 18.848 2.712 26.671l24.258-19.439 24.258 19.439c6.342-7.915 7.011-18.534 2.564-26.968 31.614-11.261 54.308-41.485 54.308-76.916v-22.261a81.174 81.174 0 00-13.881-45.483z"></path><path fill="#FFDA44" d="M256 330.206c-32.732 0-59.362-26.63-59.362-59.362v-22.261c0-32.733 26.63-59.363 59.362-59.363s59.362 26.63 59.362 59.362v22.261c0 32.733-26.63 59.363-59.362 59.363z"></path><path fill="#338AF3" d="M293.101 270.843v-22.261c0-20.458-16.643-37.101-37.101-37.101s-37.101 16.643-37.101 37.101v22.261L256 278.264l37.101-7.421z"></path><path fill="#6DA544" d="M218.899 270.843c0 20.458 16.643 37.101 37.101 37.101s37.101-16.643 37.101-37.101h-74.202z"></path><path fill="#FFDA44" d="M300.522 189.22c0-12.295-9.966-22.261-22.261-22.261a22.173 22.173 0 00-14.84 5.672v-13.093h7.421v-14.84h-7.421v-7.421h-14.84v7.421h-7.421v14.84h7.421v13.093a22.177 22.177 0 00-14.841-5.672c-12.295 0-22.261 9.966-22.261 22.261 0 6.591 2.867 12.512 7.421 16.589v13.093h74.203v-13.093c4.552-4.077 7.419-9.997 7.419-16.589z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">San Marino +378</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><g fill="#6DA544"><path d="M0 85.337h512v113.775H0zM0 312.888h512v113.775H0z"></path></g><path fill="#D80027" d="M256 256.006L0 426.668V85.331z"></path><path d="M302.049 226.318l7.368 22.674h23.842l-19.288 14.016 7.366 22.674-19.288-14.015-19.287 14.015 7.366-22.674-19.288-14.016h23.842zM376.252 226.318l7.367 22.674h23.842l-19.288 14.016 7.367 22.674-19.288-14.015-19.288 14.015 7.367-22.674-19.288-14.016h23.842z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Sao Tome and Principe +239</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#6DA544" d="M0 85.331h512v341.337H0z"></path><g fill="white"><path d="M183.548 289.386c0 12.295 9.731 22.261 21.736 22.261h65.208c0 10.244 8.11 18.551 18.114 18.551h21.736c10.004 0 18.114-8.306 18.114-18.551v-22.261H183.548zM330.264 181.791v51.942c0 8.183-6.5 14.84-14.491 14.84v22.261c19.976 0 36.226-16.643 36.226-37.101v-51.942h-21.735zM174.491 233.734c0 8.183-6.5 14.84-14.491 14.84v22.261c19.976 0 36.226-16.643 36.226-37.101v-51.942H174.49v51.942z"></path><path d="M297.661 181.788h21.736v51.942h-21.736zM265.057 211.473c0 2.046-1.625 3.71-3.623 3.71-1.998 0-3.623-1.664-3.623-3.71v-29.682h-21.736v29.682c0 2.046-1.625 3.71-3.623 3.71s-3.623-1.664-3.623-3.71v-29.682h-21.736v29.682c0 14.32 11.376 25.971 25.358 25.971 5.385 0 10.38-1.733 14.491-4.677 4.11 2.944 9.106 4.677 14.491 4.677 1.084 0 2.15-.078 3.2-.215-1.54 6.499-7.255 11.345-14.068 11.345v22.261c19.976 0 36.226-16.643 36.226-37.101v-51.943h-21.736l.002 29.682z"></path><path d="M207.093 248.57h32.601v22.261h-32.601z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Saudi Arabia +966</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.326H0z"></path><path fill="#D80027" d="M330.207 85.331H512v341.337H330.207z"></path><g fill="#496E2D"><path d="M0 85.331h181.793v341.337H0zM255.999 196.632l14.733 45.347h47.685l-38.576 28.029 14.734 45.348-38.576-28.026-38.577 28.026 14.737-45.348-38.576-28.029h47.681z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Senegal +221</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.331h512v341.337H0z"></path><path fill="#D80027" d="M0 85.331h512v113.775H0z"></path><path fill="white" d="M0 312.882h512v113.775H0z"></path><path fill="#D80027" d="M129.468 181.793v85.136c0 48.429 63.267 63.267 63.267 63.267S256 315.356 256 266.929v-85.136H129.468z"></path><g fill="#FFDA44"><path d="M155.634 196.634h74.201v-29.681l-14.841 7.42-22.261-22.26-22.259 22.26-14.84-7.42zM241.16 278.782l-48.231-48.231-48.231 48.231 15.741 15.74 32.49-32.49 32.49 32.49z"></path></g><path fill="white" d="M241.16 233.734h-22.504a14.74 14.74 0 002.001-7.418c0-8.196-6.645-14.84-14.84-14.84-5.663 0-10.581 3.172-13.083 7.836-2.502-4.663-7.421-7.836-13.083-7.836-8.195 0-14.84 6.644-14.84 14.84 0 2.706.736 5.235 2.001 7.418h-22.114c0 8.196 7.139 14.84 15.334 14.84h-.494c0 8.196 6.644 14.84 14.84 14.84 0 7.257 5.211 13.286 12.094 14.576l-11.694 26.401a48.075 48.075 0 0018.149 3.544 48.079 48.079 0 0018.149-3.544l-11.694-26.401c6.883-1.29 12.094-7.319 12.094-14.576 8.196 0 14.84-6.644 14.84-14.84h-.494c8.199 0 15.338-6.644 15.338-14.84z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Serbia +381</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M235.454 85.337L0 426.663 427.345 85.337z"></path><path fill="#6DA544" d="M512 329.393L0 426.663h512z"></path><path fill="#D80027" d="M512 85.337h-84.655L0 426.663l512-204.512z"></path><path fill="#0052B4" d="M0 85.337v341.326L235.454 85.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Seychelles +248</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#6DA544" d="M0 85.337h512v113.775H0z"></path><path fill="#338AF3" d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Sierra Leone +232</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M512 85.331v166.69L0 256.173V85.331z"></path><path fill="white" d="M256 256.006L0 426.668V85.331z"></path><g fill="#FFDA44"><path d="M59.621 256a59.546 59.546 0 00-.193 4.57c0 32.821 26.607 59.429 59.429 59.429s59.429-26.607 59.429-59.429c0-1.539-.078-3.061-.193-4.57H59.621z"></path><circle cx="118.862" cy="210.287" r="18.286"></circle></g><path fill="#D80027" d="M77.715 205.714v59.429c0 31.494 41.144 41.143 41.144 41.143s41.144-9.649 41.144-41.143v-59.429H77.715z"></path><path fill="#338AF3" d="M118.877 287.148c-7.632-2.746-22.876-9.767-22.876-22.006v-41.144h45.715v41.144c-.001 12.28-15.244 19.283-22.839 22.006z"></path><path fill="#F3F3F3" d="M128.001 246.856v-9.142l-9.144-4.571-9.142 4.571v9.142l-4.571 4.573v18.285h27.428v-18.285z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Sint Maarten +1721</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#0052B4" d="M0 196.641h512v118.717H0z"></path><path fill="#D80027" d="M0 315.359h512v111.304H0z"></path><path fill="white" d="M129.468 181.799v85.136c0 48.429 63.267 63.267 63.267 63.267S256 315.362 256 266.935v-85.136H129.468z"></path><path fill="#D80027" d="M146.126 184.294v81.941c0 5.472 1.215 10.64 3.623 15.485h85.97c2.408-4.844 3.623-10.012 3.623-15.485v-81.941h-93.216z"></path><path fill="white" d="M221.301 241.427h-21.425v-14.283h14.284v-14.283h-14.284v-14.284h-14.283v14.284h-14.282v14.283h14.282v14.283h-21.426v14.284h21.426v14.283h14.283v-14.283h21.425z"></path><path fill="#0052B4" d="M169.232 301.658c9.204 5.783 18.66 9.143 23.502 10.636 4.842-1.494 14.298-4.852 23.502-10.636 9.282-5.833 15.79-12.506 19.484-19.939a24.878 24.878 0 00-14.418-4.583c-1.956 0-3.856.232-5.682.657-3.871-8.796-12.658-14.94-22.884-14.94-10.227 0-19.013 6.144-22.884 14.94a25.048 25.048 0 00-5.682-.657 24.88 24.88 0 00-14.418 4.583c3.691 7.433 10.198 14.106 19.48 19.939z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Slovakia +421</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#0052B4" d="M0 199.112h512v113.775H0z"></path><path fill="#D80027" d="M0 312.888h512v113.775H0z"></path><path fill="white" d="M233.606 196.639v14.837c0 34.081-44.522 44.522-44.522 44.522s-44.522-10.44-44.522-44.522v-14.837l-.145-44.188 89.043-.266.146 44.454z"></path><path fill="#0052B4" d="M233.606 196.639v14.837c0 34.081-44.522 44.522-44.522 44.522s-44.522-10.44-44.522-44.522v-14.837l-.145-44.188 89.043-.266.146 44.454z"></path><path fill="white" d="M233.606 196.639v14.837c0 34.081-44.522 44.522-44.522 44.522s-44.522-10.44-44.522-44.522v-14.837l14.848 14.837 29.674-22.261 29.685 22.261 14.837-14.837z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Slovenia +386</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.334h512v341.337H0z"></path><path fill="#0052B4" d="M0 426.663V85.329h512"></path><path fill="#FFDA44" d="M0 396.494v30.169h45.255L512 115.499v-30.17h-45.255z"></path><g fill="white"><path d="M85.688 108.787l5.12 15.756h16.566l-13.403 9.737 5.12 15.757-13.403-9.738-13.405 9.738 5.12-15.757L64 124.543h16.567zM170.312 108.787l5.121 15.756H192l-13.403 9.737 5.12 15.757-13.405-9.738-13.403 9.738 5.12-15.757-13.403-9.737h16.566zM85.688 191.289l5.12 15.756h16.566l-13.403 9.738 5.12 15.757-13.403-9.739-13.405 9.739 5.12-15.757L64 207.045h16.567zM170.312 191.289l5.121 15.756H192l-13.403 9.738 5.12 15.757-13.405-9.739-13.403 9.739 5.12-15.757-13.403-9.738h16.566zM128 150.037l5.12 15.756h16.568l-13.405 9.738 5.12 15.758L128 181.55l-13.403 9.739 5.12-15.758-13.405-9.738h16.568z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Solomon Islands +677</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#338AF3" d="M0 85.331h512v341.337H0z"></path><path fill="white" d="M256 157.273l22.663 69.748H352l-59.332 43.106 22.664 69.749L256 296.769l-59.332 43.107 22.664-69.749L160 227.021h73.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Somalia +252</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path d="M114.024 256.001L0 141.926v228.17z"></path><path fill="#FFDA44" d="M161.192 256L0 94.7v47.226l114.024 114.075L0 370.096v47.138z"></path><path fill="#6DA544" d="M509.833 289.391c.058-.44.804-.878 2.167-1.318v-65.464H222.602L85.33 85.337H0V94.7L161.192 256 0 417.234v9.429h85.33l137.272-137.272h287.231z"></path><path fill="#0052B4" d="M503.181 322.783H236.433l-103.881 103.88H512v-103.88z"></path><path fill="#D80027" d="M503.181 189.217H512V85.337H132.552l103.881 103.88z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">South Africa +27</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#0052B4" d="M0 0h512v341.3H0z"></path><path fill="white" d="M256 0v117.4h-46.1l46.1 30.7v22.6h-22.6L160 121.8v48.9H96v-48.9l-73.4 48.9H0v-22.6l46.1-30.7H0v-64h46.1L0 22.7V0h22.6L96 48.9V0h64v48.9L233.4 0z"></path><path fill="#D80027" d="M144 0h-32v69.4H0v32h112v69.3h32v-69.3h112v-32H144z"></path><path fill="#2E52B2" d="M256 22.7v30.7h-46.1z"></path><path fill="#D80027" d="M0 170.7v-11l62.5-42.3h22.6L7.3 170.7zM7.3.1l77.8 53.2H62.5L0 11.1V.1zM256 .1v11l-62.5 42.3h-22.6L248.7.1zM248.7 170.7l-77.8-53.3h22.6l62.5 42.3v11z"></path><g><ellipse fill="white" cx="443.4" cy="233.6" rx="29" ry="43.5"></ellipse><ellipse fill="#FFCE00" cx="406.9" cy="317.7" rx="22" ry="9.3"></ellipse><ellipse fill="#FFCE00" cx="364" cy="317.7" rx="22" ry="9.3"></ellipse><path fill="#39B200" d="M342 190.1l43.4 86.9 43.5-86.9z"></path><ellipse fill="#9B9B9B" cx="327.5" cy="233.6" rx="29" ry="43.5"></ellipse><path fill="#757575" d="M371 175.6l-14.5 14.5h57.9l-14.5-14.5 14.5-43.5s-13-29-29-29-29 29-29 29l14.6 43.5z"></path><circle fill="#C6B56F" cx="385.4" cy="67" r="29"></circle><circle fill="#A54A00" cx="386" cy="88.7" r="29"></circle><circle fill="white" cx="443.4" cy="117.7" r="29"></circle><circle fill="#0049FF" cx="342.2" cy="146.7" r="29"></circle><circle fill="#0041F9" cx="429.8" cy="146.7" r="29"></circle><circle fill="#F7D71E" cx="386" cy="233.6" r="29"></circle><circle fill="#CEC851" cx="457.9" cy="190.1" r="29"></circle><circle fill="white" cx="385.4" cy="289.5" r="29"></circle><path fill="#7C0B29" d="M371 135.7l14.5-3.5 14.5 3.5c0 7.5-14.5 11-14.5 11s-14.5-3.5-14.5-11z"></path><circle fill="white" cx="327.5" cy="117.4" r="29"></circle></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">South Georgia and the South Sandwich Islands +500</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#496E2D" d="M0 322.783h512v103.88H0z"></path><path d="M0 85.337h512v104.515H0z"></path><path fill="#A2001D" d="M0 210.877h512v89.656H0z"></path><path fill="#0052B4" d="M256 256.006L0 426.668V85.331z"></path><path fill="#FFDA44" d="M73.178 209.188l20.831 29.067 34.084-10.83-21.207 28.795 20.83 29.069-33.939-11.271-21.208 28.794.234-35.762-33.94-11.273 34.083-10.83z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">South Sudan +211</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.331h512v341.337H0z"></path><g fill="#D80027"><path d="M0 85.331h512v113.775H0zM0 312.882h512v113.775H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Spain +34</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.329v341.337h512V85.329H0zm489.739 319.076h-267.13V107.59h267.13v296.815z"></path><path fill="#A2001D" d="M222.609 107.595h267.13V404.41h-267.13z"></path><path fill="#D80027" d="M22.261 107.595h200.348V404.41H22.261z"></path><path fill="#FFDA44" d="M200.348 85.334h22.261v341.337h-22.261z"></path><path fill="#6DA544" d="M22.261 107.595h89.043V404.41H22.261z"></path><path fill="#FF9811" d="M111.304 107.595h89.043V404.41h-89.043z"></path><g fill="#FFDA44"><path d="M358.675 250.438v-44.522c0-7.424-11.13-14.848-11.13-14.848s-11.13 7.424-11.13 14.848h-44.522v44.522h22.261v22.261c0 4.875.979 9.539 2.76 13.768l-10.184 8.493h-29.674V157.677c-12.299 0-22.261 9.973-22.261 22.261v96.467a22.19 22.19 0 007.413 16.584v35.361h14.848v-18.554h66.783v29.685H328.99v14.837h29.685v-29.685l13.601-14.837h44.288v29.685h-14.848v14.837h29.685v-29.685l13.601-14.837 12.552-40.259-11.038-19.1h-38.945c-14.169-.122-40.637.09-48.896.001z"></path><path d="M370.551 211.844v25.229h71.513v13.365h4.452v-17.817h-71.513v-16.325h75.965v-4.452zM222.609 107.595h22.261v22.261h-22.261zM467.478 107.595h22.261v22.261h-22.261zM222.609 382.138h22.261v22.261h-22.261zM467.478 382.138h22.261v22.261h-22.261z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Sri Lanka +94</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path d="M0 312.888h512v113.775H0z"></path><path fill="#496E2D" d="M0 426.668V85.331l256 170.675z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Sudan +249</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><path fill="#A2001D" d="M0 196.636h512v118.728H0z"></path><g fill="#6DA544"><path d="M0 352.462h512v74.207H0zM0 85.331h512v74.207H0z"></path></g><path fill="#FFDA44" d="M256.742 218.003l9.43 29.021h30.518L272 264.963l9.431 29.023-24.689-17.937-24.689 17.937 9.431-29.023-24.69-17.939h30.518z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Suriname +597</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.334h512v341.337H0z"></path><path fill="white" d="M512 295.883H202.195v130.783H122.435V295.883H0V216.111h122.435V85.329H202.195v130.782H512V277.329z"></path><path fill="#2E52B2" d="M512 234.666v42.663H183.652v149.337h-42.674V277.329H0v-42.663h140.978V85.329h42.674v149.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Svalbard and Jan Mayen +47</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.333h512V426.67H0z"></path><path fill="#FFDA44" d="M192 85.33h-64v138.666H0v64h128v138.666h64V287.996h320v-64H192z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Sweden +46</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="white" d="M356.174 222.609h-66.783v-66.783h-66.782v66.783h-66.783v66.782h66.783v66.783h66.782v-66.783h66.783z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Switzerland +41</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.331h512v341.337H0z"></path><path fill="#D80027" d="M0 85.331h512v113.775H0z"></path><path d="M0 312.882h512v113.775H0z"></path><g fill="#6DA544"><path d="M187.31 215.184l9.208 28.341h29.802l-24.11 17.518 9.209 28.342-24.109-17.516-24.11 17.516 9.209-28.342-24.109-17.518h29.801zM324.69 215.184l9.209 28.341H363.7l-24.109 17.518 9.209 28.342-24.11-17.516-24.109 17.516 9.209-28.342-24.11-17.518h29.802z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Syrian Arab Republic +963</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="#0052B4" d="M0 85.337h256V256H0z"></path><path fill="white" d="M186.435 170.669L162.558 181.9l12.714 23.125-25.927-4.961-3.286 26.192L128 206.993l-18.06 19.263-3.285-26.192-25.927 4.96 12.714-23.125-23.877-11.23 23.877-11.231-12.714-23.125 25.927 4.96 3.286-26.192L128 134.344l18.06-19.263 3.285 26.192 25.928-4.96-12.715 23.125z"></path><circle fill="#0052B4" cx="128" cy="170.674" r="29.006"></circle><path fill="white" d="M128 190.06c-10.692 0-19.391-8.7-19.391-19.391 0-10.692 8.7-19.391 19.391-19.391 10.692 0 19.391 8.7 19.391 19.391 0 10.691-8.699 19.391-19.391 19.391z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Taiwan +886</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path fill="#6DA544" d="M0 312.888h512v113.775H0z"></path><g fill="#FFDA44"><path d="M226.318 300.522h59.364v-25.23l-11.873 5.937L256 263.421l-17.809 17.808-11.873-5.937zM192.355 270.84l2.763 8.504h8.94l-7.233 5.255 2.763 8.502-7.233-5.255-7.234 5.255 2.763-8.502-7.233-5.255h8.94zM200.921 241.16l2.763 8.502h8.94l-7.233 5.255 2.763 8.504-7.233-5.256-7.234 5.256 2.763-8.504-7.233-5.255h8.94zM225.409 218.899l2.763 8.502h8.94l-7.233 5.255 2.763 8.504-7.233-5.256-7.234 5.256 2.763-8.504-7.233-5.255h8.94zM319.645 270.84l-2.763 8.504h-8.94l7.233 5.255-2.763 8.502 7.233-5.255 7.234 5.255-2.763-8.502 7.233-5.255h-8.94zM311.079 241.16l-2.763 8.502h-8.94l7.233 5.255-2.763 8.504 7.233-5.256 7.234 5.256-2.763-8.504 7.233-5.255h-8.94zM286.591 218.899l-2.763 8.502h-8.94l7.233 5.255-2.763 8.504 7.233-5.256 7.234 5.256-2.763-8.504 7.233-5.255h-8.94zM256 207.767l2.763 8.503h8.941l-7.234 5.256 2.763 8.502-7.233-5.254-7.233 5.254 2.763-8.502-7.234-5.256h8.941z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Tajikistan +992</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#338AF3" d="M0 85.337h512v341.326H0z"></path><path fill="#6DA544" d="M0 426.663V85.337h512"></path><path fill="#FFDA44" d="M512 152.222V85.337H411.67L0 359.778v66.885h100.33z"></path><path d="M512 85.337v40.125L60.193 426.663H0v-40.125L451.807 85.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Tanzania, United Republic of Tanzania +255</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.334h512V426.66H0z"></path><path fill="#0052B4" d="M0 194.056h512v123.882H0z"></path><g fill="#D80027"><path d="M0 85.334h512v54.522H0zM0 372.143h512v54.522H0z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Thailand +66</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="#FFDA44" d="M256 256L0 90.691v44.242L155.826 256 0 377.067v44.242z"></path><path d="M0 90.691v330.618L189.217 256z"></path><path fill="white" d="M44.184 213.36l24.912 23.577 30.121-16.41-14.723 30.98 24.911 23.575-34.012-4.43L60.67 301.63l-6.296-33.716-34.012-4.43 30.119-16.408z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Timor-Leste +670</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><g fill="#496E2D"><path d="M0 85.337h512V153.6H0zM0 358.4h512v68.263H0zM0 221.863h512v68.263H0z"></path></g><path fill="#D80027" d="M0 85.337h204.054v204.054H0z"></path><path fill="white" d="M102.026 133.938l13.26 40.812h42.916l-34.718 25.226 13.26 40.814-34.718-25.224-34.719 25.224 13.263-40.814-34.718-25.226h42.913z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Togo +228</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.337h512v341.326H0z"></path><g fill="white"><path d="M210.715 174.377l3.684 11.338h11.919l-9.643 7.006 3.684 11.337-9.644-7.007-9.644 7.007 3.684-11.337-9.645-7.006h11.921zM116.816 281.971l4.605 14.172h14.9l-12.055 8.757 4.606 14.173-12.056-8.76-12.055 8.76 4.604-14.173-12.054-8.757h14.899zM144.696 119.679l4.604 14.172h14.901l-12.056 8.758 4.606 14.171-12.055-8.759-12.056 8.759 4.606-14.171-12.055-8.758h14.9zM69.539 175.331l4.604 14.172h14.9l-12.055 8.758 4.606 14.171-12.055-8.758-12.056 8.758 4.606-14.171-12.055-8.758h14.9z"></path></g><g fill="#FFDA44"><path d="M483.386 354.503H117.801s109.234-88.562 310.593-220.938c.001 0-88.443 128.935 54.992 220.938zM117.801 366.089c-11.177 0-11.195 17.37 0 17.37h365.585c11.177 0 11.195-17.37 0-17.37H117.801z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Tokelau +690</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.337H0z"></path><path fill="white" d="M0 85.331h256v170.663H0z"></path><path fill="#D80027" d="M141.357 157.303V130.59h-26.714v26.713H87.93v26.713h26.713v26.713h26.714v-26.713h26.713v-26.713z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Tonga +676</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="white" d="M6.066 85.337l207.961 212.636 131.584 128.69h160.323L297.973 214.027 166.389 85.337z"></path><path d="M43.364 85.337L384.69 426.663h83.946L127.31 85.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Trinidad and Tobago +1868</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.331h512v341.337H0z"></path><circle fill="white" cx="256" cy="255.994" r="96"></circle><g fill="#D80027"><path d="M267.826 219.291l16.47 22.695 26.673-8.649-16.496 22.676 16.468 22.695-26.664-8.681-16.495 22.676.017-28.04-26.664-8.682 26.674-8.648z"></path><path d="M277.818 312.724c-31.33 0-56.727-25.397-56.727-56.727s25.397-56.727 56.727-56.727c9.769 0 18.96 2.47 26.985 6.819-12.589-12.31-29.804-19.909-48.803-19.909-38.558 0-69.818 31.259-69.818 69.818s31.26 69.818 69.818 69.818c18.999 0 36.215-7.599 48.803-19.909-8.026 4.347-17.216 6.817-26.985 6.817z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Tunisia +216</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 450 300"><path fill="#d80027" d="M0 150V0h450v300H0V150z"></path><path fill="white" d="M247.3 118.3l35.2 5.8L307.4 99l5.1 32.8L344 150l-31.5 18.2-4.9 33.5-25.1-25.9-35.2 5.8L263 150z"></path><path fill="white" d="M240.6 228.6c-43.3 0-78.3-35.1-78.3-78.3S197.4 72 240.6 72c8.1 0 15.8 1.2 23.2 3.5-17.3-15-39.8-24-64.5-24-54.4 0-98.6 44.1-98.6 98.6s44.1 98.6 98.6 98.6c24.2 0 46.3-8.7 63.4-23.1-7 1.9-14.4 3-22.1 3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Turkey +90</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.337h512v341.326H0z"></path><g fill="white"><path d="M357.208 183.679c8.397-23.404-1.036-48.858-21.281-61.536a52.131 52.131 0 0110.884 2.621c27.002 9.688 41.038 39.428 31.35 66.431s-39.428 41.038-66.431 31.35a52.182 52.182 0 01-10.069-4.895c23.686 3.084 47.15-10.566 55.547-33.971zM310.637 115.729l-7.297 9.427-11.22-4.026 6.712 9.852-7.296 9.427 11.443-3.338 6.712 9.852.361-11.914 11.444-3.339-11.221-4.025z"></path><path d="M330.338 146.448l-7.296 9.427-11.221-4.026 6.712 9.852-7.296 9.427 11.443-3.339 6.712 9.853.36-11.915 11.445-3.34-11.221-4.024zM275.9 126.916l-7.296 9.427-11.219-4.024 6.711 9.851-7.296 9.426 11.443-3.338 6.712 9.852.361-11.915 11.444-3.337-11.221-4.027zM275.101 162.105l-7.296 9.427-11.221-4.026 6.712 9.852-7.296 9.427 11.444-3.338 6.711 9.852.362-11.915 11.443-3.338-11.22-4.026zM308.585 174.118l-7.296 9.427-11.22-4.026 6.712 9.853-7.297 9.426 11.444-3.338 6.712 9.852.36-11.915 11.443-3.338-11.219-4.025z"></path></g><path fill="#D80027" d="M83.478 85.337h89.043v341.326H83.478z"></path><path fill="white" d="M117.458 175.191l-14.908-11.105v-15.705l14.908-11.105h21.084l14.908 11.105v15.705l-14.908 11.105z"></path><g fill="#FF9811"><path d="M128 137.276h-10.542l-14.908 11.105v7.678H128zM128 175.191h10.542l14.908-11.105v-8.012H128z"></path></g><path fill="white" d="M117.458 374.725l-14.908-11.106v-15.704l14.908-11.105h21.084l14.908 11.105v15.704l-14.908 11.106z"></path><g fill="#FF9811"><path d="M128 336.81h-10.542l-14.908 11.105v7.678H128zM128 374.725h10.542l14.908-11.106v-8.011H128z"></path></g><g fill="#496E2D"><path d="M117.458 274.957l-14.908-11.105v-15.703l14.908-11.106h21.084l14.908 11.106v15.703l-14.908 11.105zM153.971 299.391h-6.493v-6.493h-11.411l-8.068-8.068-8.067 8.068h-11.41v6.493h-6.493v12.986h6.493v6.492h11.41l8.068 8.069 8.068-8.069h11.41v-6.492h6.493zM153.971 199.623h-6.493v-6.492h-11.411l-8.068-8.069-8.067 8.069h-11.41v6.492h-6.493v12.986h6.493v6.492h11.41l8.068 8.07 8.068-8.07h11.41v-6.492h6.493z"></path></g><g fill="#D80027"><path d="M120.576 248.576h14.84v14.84h-14.84z"></path><circle cx="128" cy="206.113" r="7.421"></circle><circle cx="128" cy="305.887" r="7.421"></circle></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Turkmenistan +993</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.333h512V426.67H0z"></path><path fill="#FFDA44" d="M332.058 191.996v78.221c0 38.103 51.942 49.779 51.942 49.779s51.942-11.675 51.942-49.779v-78.221H332.058z"></path><path fill="#FF9811" d="M376.579 220.44c0 7.855-6.644 28.445-14.84 28.445s-14.84-20.589-14.84-28.445c0-7.856 14.84-14.222 14.84-14.222s14.84 6.367 14.84 14.222z"></path><path fill="#A2001D" d="M415.961 235.93c2.394-5.6 4.257-13.785 4.257-17.86 0-6.546-8.904-11.852-8.904-11.852s-8.904 5.306-8.904 11.852c0 4.075 1.862 12.26 4.257 17.86l-5.141 11.123a26.898 26.898 0 009.788 1.831c3.463 0 6.766-.654 9.788-1.831l-5.141-11.123z"></path><path fill="#6DA544" d="M372.87 270.217s-7.421 14.222-7.421 28.445h37.101c0-14.222-7.421-28.445-7.421-28.445l-11.13-7.111-11.129 7.111z"></path><path fill="#D80027" d="M395.13 270.217v-3.555c0-5.891-4.983-10.666-11.13-10.666-6.147 0-11.13 4.776-11.13 10.666v3.555h22.26z"></path><path fill="white" d="M256 85.333v30.553l-45.167 25.099H256v59.359h-59.103L256 233.179v22.817h-26.68l-73.494-40.826v40.826h-55.652v-48.573l-87.43 48.573H0v-30.554l45.167-25.098H0v-59.359h59.103L0 108.139V85.333h26.68l73.494 40.825V85.333h55.652v48.572l87.43-48.572z"></path><path fill="#D80027" d="M144 85.33h-32v69.332H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path fill="#0052B4" d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915z"></path><path fill="white" d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915z"></path><g fill="#D80027"><path d="M155.826 200.344L256 255.996v-15.737l-71.847-39.915zM71.846 200.344L0 240.259v15.737l100.174-55.652z"></path></g><path fill="#0052B4" d="M100.174 140.982L0 85.33v15.737l71.847 39.915z"></path><path fill="white" d="M100.174 140.982L0 85.33v15.737l71.847 39.915z"></path><g fill="#D80027"><path d="M100.174 140.982L0 85.33v15.737l71.847 39.915zM184.154 140.982L256 101.067V85.33l-100.174 55.652z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Turks and Caicos Islands +1649</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 900 600"><path fill="#0052B4" d="M0 0h900v600H0z"></path><path fill="#00B2EE" d="M0 300h450V0h450v600H0V300z"></path><path fill="#FFDA44" d="M345.3 480.9l29.4 90.6-77.1-56H393l-77.1 56 29.4-90.6zM706.4 340l29.4 90.6-77.1-56H754l-77.1 56 29.5-90.6zM812.8 261.5l29.4 90.6-77.1-56h95.3l-77.1 56 29.5-90.6zM812.8 37.4l29.4 90.6-77.1-56h95.3l-77.1 56 29.5-90.6z"></path><path fill="white" d="M449.9 0v206.3h-81l81 54V300h-39.7l-129-85.9V300H168.7v-85.9L39.7 300H0v-39.7l81-54H0V93.8h81L0 39.9V0h39.7l129 85.9V0h112.5v85.9L410.2 0z"></path><path fill="#D80027" d="M253.1 0h-56.3v122H0v56.2h196.8V300h56.3V178.2h196.8V122H253.1z"></path><path fill="#2E52B2" d="M449.9 39.9v53.9h-81z"></path><path fill="#D80027" d="M0 300v-19.3l109.9-74.4h39.7L12.8 300zM12.8.1l136.8 93.7h-39.7L0 19.4V.1zM449.9.2v19.3L340 93.8h-39.7L437.1.2zM437.1 300l-136.8-93.7H340l109.9 74.4V300z"></path><path fill="#FFDA44" d="M719.9 131.6l29.4 90.6-77.1-56h95.3l-77.1 56 29.5-90.6zM584 187.7l29.4 90.6-77.1-56h95.3l-77.1 56 29.5-90.6zM614 430.6l29.4 90.6-77.1-56h95.3l-77.1 56 29.5-90.6zM488 332l29.4 90.6-77.1-56h95.3l-77.1 56L488 332zM488 464l29.4 90.6-77.1-56h95.3l-77.1 56L488 464z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Tuvalu +688</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="#232323" d="M0 0h512v341.3H0z"></path><path fill="#FFDA44" d="M0 56.9h512v56.9H0z"></path><path fill="#D32300" d="M0 113.8h512v56.9H0z"></path><path fill="#FFDA44" d="M0 227.6h512v56.9H0z"></path><path fill="#D32300" d="M0 284.4h512v56.9H0z"></path><circle fill="white" cx="256" cy="170.7" r="80.7"></circle><path d="M234.5 127.5c.9-1.4-19.6-2-19.6-2 1.7-2.5 18.4-10.5 18.4-10.5s-.9-6 2.7-9.8l-4.5-9.8s7-3.4 18.4-3.4 19.9 7 21 13.1l-6.4 3.4c-.1 4.7 1.7 11.6-4.3 17.3-5.9 5.7-8.3 6.9-8.5 18.8 0 3.9 2.3 8.2 8.8 11.7 17.4 9.3 38.6 28.2 44.6 33.9 6.1 5.7 5.1 19.2 2.6 25.2s-12.1 14.3-14.3 13.6c-2.2-.6 1.2-9.2-3.5-11.6 0 0-8.9-7.6-16.8.6s-.2 25.2 3.9 28c4.1 2.8 1.7 5-1.9 5H247c-3.8 0-5.4-2.3-1.9-5 7.6-3.8 12.4-15.3 7.4-20.3-4.9-4.9-18.3 1.5-21.5 6.3-2.8 2.8-8.8 3.6-12.9-1.4s-4.1-10.4-1.1-12.5c7-4.8 0 0 .1-.1 0 0 11.9-8.6 29.9-9 3.9 0 4.8-2.2 2.2-4.8 0 0-30.9-27.4-28.1-44.2 3-18.3 20-26.3 13.4-32.5-1.3-1.8 0 0 0 0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Uganda +256</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#FFDA44" d="M0 85.337h512v341.326H0z"></path><path fill="#338AF3" d="M0 85.337h512V256H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Ukraine +380</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.333h512V426.67H0z"></path><path fill="#D80027" d="M288 85.33h-64v138.666H0v64h224v138.666h64V287.996h224v-64H288z"></path><g fill="#0052B4"><path d="M393.785 315.358L512 381.034v-65.676zM311.652 315.358L512 426.662v-31.474l-143.693-79.83zM458.634 426.662l-146.982-81.664v81.664z"></path></g><path fill="white" d="M311.652 315.358L512 426.662v-31.474l-143.693-79.83z"></path><path fill="#D80027" d="M311.652 315.358L512 426.662v-31.474l-143.693-79.83z"></path><g fill="#0052B4"><path d="M90.341 315.356L0 365.546v-50.19zM200.348 329.51v97.151H25.491z"></path></g><path fill="#D80027" d="M143.693 315.358L0 395.188v31.474l200.348-111.304z"></path><g fill="#0052B4"><path d="M118.215 196.634L0 130.958v65.676zM200.348 196.634L0 85.33v31.474l143.693 79.83zM53.366 85.33l146.982 81.664V85.33z"></path></g><path fill="white" d="M200.348 196.634L0 85.33v31.474l143.693 79.83z"></path><path fill="#D80027" d="M200.348 196.634L0 85.33v31.474l143.693 79.83z"></path><g fill="#0052B4"><path d="M421.659 196.636L512 146.446v50.19zM311.652 182.482V85.331h174.857z"></path></g><path fill="#D80027" d="M368.307 196.634L512 116.804V85.33L311.652 196.634z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">United Kingdom +44</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 513 342"><path fill="white" d="M0 0h513v342H0z"></path><g fill="#338AF3"><path d="M0 38h513v38H0zM0 114h513v38H0zM0 190h513v38H0zM0 266h513v38H0z"></path></g><path fill="white" d="M0 0h256.5v190H0z"></path><path fill="#FFDA44" d="M192 95l-26.2 12.3 14 25.3-28.4-5.4-3.6 28.7-19.8-21.1-19.8 21.1-3.6-28.7-28.4 5.4 14-25.3L64 95l26.2-12.3-14-25.3 28.4 5.4 3.6-28.7L128 55.2l19.8-21.1 3.6 28.7 28.4-5.4-14 25.3z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Uruguay +598</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M0 85.337h512v341.326H0z"></path><path fill="#6DA544" d="M0 322.783h512v103.88H0z"></path><path fill="#338AF3" d="M0 85.337h512v104.515H0z"></path><path fill="white" d="M0 210.877h512v89.656H0z"></path><path fill="#338AF3" d="M0 85.337h512v104.515H0z"></path><g fill="white"><path d="M188.688 137.589c0-15.984 11.234-29.339 26.236-32.614a33.531 33.531 0 00-7.155-.777c-18.442 0-33.391 14.949-33.391 33.391s14.949 33.391 33.391 33.391c2.458 0 4.85-.273 7.155-.777-15.002-3.275-26.236-16.63-26.236-32.614zM234.658 152.766l2.261 6.957h7.315l-5.918 4.301 2.261 6.956-5.919-4.3-5.918 4.3 2.261-6.956-5.918-4.301h7.315zM258.006 152.766l2.26 6.957h7.315l-5.918 4.301 2.261 6.956-5.918-4.3-5.918 4.3 2.26-6.956-5.917-4.301h7.314zM281.353 152.766l2.26 6.957h7.315l-5.917 4.301 2.26 6.956-5.918-4.3-5.918 4.3 2.26-6.956-5.918-4.301h7.315zM304.7 152.766l2.262 6.957h7.315l-5.919 4.301 2.261 6.956-5.919-4.3-5.918 4.3 2.262-6.956-5.919-4.301h7.314zM328.048 152.766l2.26 6.957h7.315l-5.918 4.301 2.261 6.956-5.918-4.3-5.918 4.3 2.26-6.956-5.917-4.301h7.314zM258.006 128.482l2.26 6.956h7.315l-5.918 4.3 2.261 6.957-5.918-4.299-5.918 4.299 2.26-6.957-5.917-4.3h7.314zM281.353 128.482l2.26 6.956h7.315l-5.917 4.3 2.26 6.957-5.918-4.299-5.918 4.299 2.26-6.957-5.918-4.3h7.315zM304.7 128.482l2.262 6.956h7.315l-5.919 4.3 2.261 6.957-5.919-4.299-5.918 4.299 2.262-6.957-5.919-4.3h7.314zM328.048 128.482l2.26 6.956h7.315l-5.918 4.3 2.261 6.957-5.918-4.299-5.918 4.299 2.26-6.957-5.917-4.3h7.314zM281.353 104.198l2.26 6.956h7.315l-5.917 4.3 2.26 6.957-5.918-4.3-5.918 4.3 2.26-6.957-5.918-4.3h7.315zM304.7 104.198l2.262 6.956h7.315l-5.919 4.3 2.261 6.957-5.919-4.3-5.918 4.3 2.262-6.957-5.919-4.3h7.314zM328.048 104.198l2.26 6.956h7.315l-5.918 4.3 2.261 6.957-5.918-4.3-5.918 4.3 2.26-6.957-5.917-4.3h7.314z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Uzbekistan +998</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path d="M0 85.337h512v341.326H0z"></path><path fill="#6DA544" d="M512 256v170.663H0L215.185 256z"></path><path fill="#D80027" d="M512 85.337V256H215.185L0 85.337z"></path><path d="M221.001 239.304L26.868 85.337H8.956l208.168 165.098H512v-11.131zM8.956 426.663h17.912l194.133-153.967H512v-11.131H217.124zM0 92.44v14.206L188.317 256 0 405.354v14.205L206.229 256z"></path><g fill="#FFDA44"><path d="M8.956 85.337H0v7.103L206.229 256 0 419.559v7.104h8.956l208.168-165.098H512v-11.13H217.124z"></path><path d="M63.718 292.382v-14.295c14.265 0 25.87-11.606 25.87-25.869 0-10.092-8.211-18.303-18.304-18.303-6.875 0-12.469 5.593-12.469 12.469 0 4.397 3.577 7.974 7.974 7.974a4.514 4.514 0 004.508-4.508h14.295c0 10.368-8.435 18.804-18.802 18.804-12.279-.002-22.269-9.993-22.269-22.271 0-14.758 12.006-26.764 26.764-26.764 17.975 0 32.599 14.623 32.599 32.599 0 22.145-18.018 40.164-40.166 40.164z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Vanuatu +678</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 22.5 15"><path fill="#FFCE00" d="M0 0h22.5v5H0z"></path><path fill="#203899" d="M0 5h22.5v5H0z"></path><path fill="#D82B2B" d="M0 10h22.5v5H0z"></path><path fill="white" d="M12.13 5.38l.14.46.45.14-.39.27.01.48-.38-.29-.45.15.15-.44-.28-.38h.47zM10.36 5.38l.27.39h.47l-.28.38.15.45-.45-.16-.38.28.01-.47-.39-.28.45-.13zM13.8 5.94l-.01.48.39.27-.46.14-.14.45-.27-.38h-.48l.29-.38-.15-.45.45.16zM8.69 5.96l.4.27.44-.18-.13.46.3.36-.47.02-.26.4-.16-.44-.46-.12.37-.3zM15.24 7.13l-.2.44.25.4-.47-.05-.31.36-.1-.46-.43-.18.41-.24.03-.47.35.31zM15.43 8.25l.21.43.47.07-.34.33.08.46-.42-.22-.42.22.08-.46-.34-.33.47-.07zM7 8.2l.21.43.47.06-.34.33.08.47L7 9.27l-.42.22.08-.47-.34-.33.47-.06zM7.31 7.05l.45.14.38-.29v.48l.39.26-.45.15-.13.46-.28-.38-.47.01.27-.38z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Venezuela, Bolivarian Republic of Venezuela +58</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#D80027" d="M196.641 85.337H0v341.326h512V85.337z"></path><path fill="#FFDA44" d="M256 157.279l22.663 69.747H352l-59.332 43.106 22.664 69.749L256 296.774l-59.332 43.107 22.664-69.749L160 227.026h73.337z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Vietnam +84</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#0052B4" d="M0 85.334h512v341.337H0z"></path><path fill="white" d="M256 85.334V202.66h-46.069L256 233.38v22.617h-22.628L160 207.078v48.919H96v-48.919l-73.372 48.919H0V233.38l46.069-30.72H0v-64h46.069L0 107.951V85.334h22.628L96 134.241V85.334h64v48.907l73.372-48.907z"></path><g fill="#D80027"><path d="M144 85.33h-32v69.333H0v32h112v69.334h32v-69.334h112v-32H144z"></path><path d="M0 85.329v15.083l57.377 38.251H80zM256 85.329v15.083l-57.377 38.251H176z"></path></g><path fill="#2E52B2" d="M256 107.951v30.712h-46.069z"></path><g fill="#D80027"><path d="M0 85.329v15.083l57.377 38.251H80zM256 85.329v15.083l-57.377 38.251H176z"></path></g><path fill="#2E52B2" d="M256 107.951v30.712h-46.069z"></path><g fill="#D80027"><path d="M0 255.997v-15.082l57.377-38.252H80zM256 255.997v-15.082l-57.377-38.252H176z"></path></g><path fill="#FFDA44" d="M384 259.706l-46.129 46.129c8.645 16.675 26.051 28.074 46.129 28.074s37.484-11.4 46.129-28.074L384 259.706z"></path><path fill="#6DA544" d="M332.058 178.084V259.708c.001 39.759 51.942 51.941 51.942 51.941s51.941-12.182 51.942-51.942v-81.623H332.058z"></path><path fill="white" d="M372.87 215.181h22.261v59.359H372.87z"></path><circle fill="#A2001D" cx="384" cy="215.181" r="11.13"></circle><g fill="#FFDA44"><path d="M346.902 192.92h14.84v14.84h-14.84zM346.902 226.312h14.84v14.84h-14.84zM346.902 259.703h14.84v14.84h-14.84zM406.261 192.92h14.84v14.84h-14.84zM406.261 226.312h14.84v14.84h-14.84zM406.261 259.703h14.84v14.84h-14.84z"></path></g></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Virgin Islands, British +1284</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 341.3"><path fill="white" d="M0 0h512v341.3H0z"></path><path fill="#1583C4" d="M397.7 166.3l-51 97.7c-1.1 2-.3 4.5 1.8 5.6 2 1.1 4.5.3 5.6-1.8l51-97.7c1-2.1.1-4.6-2-5.5-2-.9-4.3-.2-5.4 1.7z"></path><path fill="#1583C4" d="M404.9 188l-57.8 75.4c-1.3 1.9-.8 4.5 1.1 5.8 1.7 1.2 4.1.9 5.5-.7l57.8-75.4c1.4-1.8 1.1-4.4-.8-5.8-1.8-1.5-4.4-1.1-5.8.7z"></path><path fill="#1583C4" d="M379 181.3l-32.5 83.1c-.8 2.1.2 4.6 2.4 5.4 2.1.8 4.6-.2 5.4-2.4l32.5-83.1c.7-2.2-.4-4.5-2.6-5.3-2.1-.6-4.3.4-5.2 2.3z"></path><path fill="#409347" d="M122.1 171.9c.4 1.7 1.2 4.7 2.2 8.5 1.7 6.4 3.6 12.8 5.6 18.7 2.3 6.9 14.7 31.4 20.2 39.1 6.9 9.7 14.1 19.3 21.5 28.6 1.6 1.9 4.5 2.1 6.4.5 1.8-1.6 2.1-4.3.7-6.2-7.3-9.2-14.4-18.6-21.2-28.2-4.2-5.8-17.2-31.1-19-36.7-2.9-8.7-5.4-17.6-7.6-26.5-.5-2.4-2.9-4-5.3-3.5s-4 2.9-3.5 5.3c-.1.2 0 .3 0 .4z"></path><g fill="#FFD836" stroke="#231F20" stroke-miterlimit="10"><path d="M297.1 114.9S279.5 42.8 261 42.8c-6.9 0-11.9-.6-15.4 6.4-.9 1.7-20.7-1.6-19.1 20.8.5 6.9 1.1-9.8 14.9-3.4 6.3 3-16.4 48.2-16.4 48.2h72.1z"></path><path d="M466.1 48.4l-90.9 22c-75.3 18.3-42.1 44.4-42.1 44.4l-72.1 12-72.1-12s33.2-26.1-42.1-44.4l-90.9-22C43.1 45.3 38.1 51.8 45.3 63c0 0 106.6 104 126.8 112 20.2 8.1 40.8 0 40.8 0s-14.9 8.7-24 24c-9.2 15.3-4.6 34.7-38.9 40.2-5.5 6.6-5 14 2.9 19.9 7.9 5.8 72.1-48.1 72.1-48.1s-24 24.4-24 36.1c0 5.1 44.1 53.8 60.1 53.8s60.1-48.7 60.1-53.8c0-11.7-24-36.1-24-36.1s64.2 53.9 72.1 48.1 11.4-19.3 2.8-19.9c-28-1.8-29.7-24.9-38.9-40.2-9.2-15.3-24-24-24-24s20.6 8.1 40.8 0S476.7 63 476.7 63c7.2-11.2 2.3-17.7-10.6-14.6z"></path></g><path fill="white" stroke="#231F20" stroke-miterlimit="10" d="M201.3 111.8v80.3c0 45.7 59.7 59.7 59.7 59.7s59.7-14 59.7-59.7v-80.3H201.3h0z"></path><g fill="#D80027"><path d="M225.2 137.7V235c8.2 6 17 10.2 23.9 12.9V137.7h-23.9zM296.8 137.7V235c-8.2 6-17 10.2-23.9 12.9V137.7h23.9z"></path></g><path fill="#0052B4" d="M201.3 111.8h119.4v37.9H201.3z"></path><path fill="#1583C4" d="M60.1 210.5l-21.9-58.1H15.7l31.8 80.8h25.2l31.5-80.8H81.7zM451.5 151.9h18.9v81.7h-18.9z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Virgin Islands, U.S. +1340</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 150 100"><path fill="#ED2939" d="M0 0h150v100H0z"></path><path fill="#002395" d="M0 0h20v44.33H0z"></path><path fill="white" d="M20 0h20v44.33H20z"></path><path fill="none" stroke="white" stroke-width="3" d="M0 44.33h62.75V0"></path><path fill="white" d="M108.08 43.29L87.96 23.17h40.25l-20.13 20.12zm-6.7 6.71L81.25 29.88v40.25L101.38 50zm6.7 6.71L87.96 76.83h40.25l-20.13-20.12zm6.71-6.71l20.13-20.13v40.25L114.79 50z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Wallis and Futuna +681</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="white" d="M0 85.337h512v341.326H0z"></path><path fill="#D80027" d="M0 85.337h512v113.775H0z"></path><path d="M0 312.888h512v113.775H0z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Yemen +967</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path fill="#496E2D" d="M0 85.331h512v341.337H0z"></path><path fill="#FF9811" d="M490.668 195.476h-48c0-8.836-7.164-16-16-16s-16 7.164-16 16h-48c0 8.836 7.697 16 16.533 16h-.533c0 8.836 7.162 16 16 16 0 8.836 7.162 16 16 16h32c8.836 0 16-7.164 16-16 8.836 0 16-7.164 16-16h-.533c8.837 0 16.533-7.164 16.533-16z"></path><path fill="#D80027" d="M341.337 255.994h56.888v170.663h-56.888z"></path><path fill="#FF9811" d="M455.112 255.994H512v170.663h-56.888z"></path><path d="M398.225 255.994h56.888v170.663h-56.888z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Zambia +260</div></div></div><div class="bg-white pr-spacing10 pl-spacing16 pt-spacing10 pb-spacing10 w-full font-normal text-xs text-gray cursor-pointer border-1 border-white hover:border-neutral-400"><div class="flex items-center font-Inter"><div class="w-5 h-5 flex items-center"><svg xmlns="http://www.w3.org/2000/svg" viewBox="0 85.333 512 341.333"><path d="M0 85.333h512V426.67H0z"></path><g fill="#FFDA44"><path d="M0 134.196h512v48.868H0zM0 329.668h512v48.868H0z"></path></g><path fill="#6DA544" d="M0 85.333h512v48.868H0z"></path><g fill="#D80027"><path d="M0 183.069h512v48.868H0zM0 280.806h512v48.868H0z"></path></g><path fill="#6DA544" d="M0 378.542h512v48.128H0z"></path><path fill="white" d="M276.992 255.996L106.329 426.659H0V85.333h106.329z"></path><path d="M256 255.996L85.334 426.662h20.987l170.667-170.666L106.321 85.33H85.334z"></path><path fill="#D80027" d="M102.465 202.57l13.259 40.812h42.917l-34.718 25.226 13.26 40.814-34.718-25.224-34.72 25.224 13.262-40.814-34.718-25.226h42.915z"></path><path fill="#FFDA44" d="M138.94 259.335l-34.559-12.243s-2.553-23.955-2.708-24.766c-1.173-6.18-6.603-10.851-13.123-10.851-7.376 0-13.357 5.98-13.357 13.357 0 1.223.178 2.402.486 3.528l-9.689 9.755h17.229c0 17.882-13.344 17.882-13.344 35.691l7.402 17.809h44.522l7.422-17.809h-.004a17.782 17.782 0 001.381-5.231c6.397-2.589 8.342-9.24 8.342-9.24z"></path></svg></div><div class="pl-spacing4 w-6 items-center text-neutral-700 font-semibold md:!w-45 !w-auto pl-spacing8 text-sm">Zimbabwe +263</div></div></div></div></div></div><div class="flex flex-col justify-start items-start self-stretch flex-grow-0 flex-shrink-0 relative mb-spacing16"><p class="text-xs leading-4.5"><span class="text-xs text-neutral-600 self-stretch flex-grow-0 flex-shrink-0 text-left mr-1">By Signing up, you agree to our</span><a href="terms-conditions" target="_blank" class="text-xs"><span class="text-xs text-neutral-600 underline underline-offset-3 font-medium self-stretch flex-grow-0 flex-shrink-0">Terms &amp; Conditions</span></a><span class="text-xs text-neutral-600 self-stretch flex-grow-0 flex-shrink-0 text-left mx-1">and our</span><a href="privacy-policy" target="_blank" class="text-xs"><span class="text-xs leading-4.5 text-neutral-600 underline underline-offset-3 font-medium self-stretch flex-grow-0 flex-shrink-0">Privacy and Policy</span></a></p></div><button tabindex="-1" type="submit" class="bg-transparent text-mono-black border-neutral-700 hover:bg-mono-black/4 transition duration-300 ease-in-out border-2 font-bold text-base rounded px-spacing16 md:h-11 md:min-w-24 !w-full flex items-center justify-center"><div class="flex justify-center items-center">Talk to our advisor</div></button></form></div><div class="relative 
   w-full mt-spacing28 h-auto 
     h-33  bg-white overflow-hidden rounded-12 -z-0"><div class="w-6.5 h-8 bg-white rounded-xl border border-bootcamp-green-700 absolute -right-3.5 top-12.5 z-10"></div><div class="w-6.5 h-8 bg-white rounded-xl border border-bootcamp-green-700 absolute -left-3.5 top-12.5 z-10"></div><div class="border rounded-12 border-bootcamp-green-700 bg-bootcamp-green-200 w-full h-full py-spacing10 px-spacing16 shadow-elevation relative overflow-hidden"><div class="absolute -top-1 -right-1"><img alt="pattern" loading="lazy" width="95" height="153" decoding="async"  style="color:transparent" src="infinity_images/Pattern.svg"></div><div class="flex items-center h-full justify-between relative z-1"><div class="flex flex-col gap-spacing8"><div class="flex gap-spacing4 items-center"><i class="icon-percentage-filled md:text-2xl xs:text-md text-bootcamp-green-900 "></i><h5 class="text-xl text-bootcamp-green-900 font-bold">10% OFF</h5></div><div class="flex flex-col "><div><span class="text-bootcamp-green-900 font-normal text-sm">Coupon Code</span><span class="text-sm leading-4 text-bootcamp-green-900 font-bold">&nbsp;"LEVEL10"</span></div><div><span class="text-bootcamp-green-900 font-normal text-sm">Coupon Expires</span><span class="text-sm leading-4 text-bootcamp-green-900 font-bold">&nbsp; 13/04</span></div></div></div><div class="bg-bootcamp-green-500 rounded-full px-spacing12 h-8 flex items-center shadow-elevation gap-spacing6 cursor-pointer"><i class="text-white text-sm icon-copy"></i><div class="text-xs text-white font-normal text-right cursor-pointer">Copy</div></div></div></div></div></div></div></div></div></div></div></section></div><div><div><div></div><div class="transition-all duration-1000 z-[20] md:block hidden"></div></div><!--$--><div><section class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0 bg-interview-white-1 py-spacing48 xs:!mt-spacing48"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div class="row g-4"><div class="col-12 md:flex-col"><h3 class="text-interview-black-1 font-[700] md:text-title2 xs:text-title3 pb-spacing10">Description</h3><div class="relative "><div class="text-neutral7 font-normal md:text-bodyNormal xs:text-bannerPoints pb-spacing24"><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Python has turned out to be the most in-demand programming language in recent years. Many IT companies that hunt for good Python programmers are ready to pay the best salaries to the eligible candidates. Hence, we have covered the top commonly asked Python interview questions to familiarize you with the knowledge and skills required to succeed in your next Python job interview.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>It's time to view what companies use Python. Companies like Google, Facebook, Netflix etc uses Python. Among </span><a href="blog/programming/list-of-programming-languages" class="CertTheme__link"><span>programming languages</span></a><span>, Python is the most promising career option for techies. Companies today, both in India and the US, are looking out for the qualified and skilled workforce to meet the needs of customers. Python, SQL, Java, JavaScript, .NET, C, C#, AngularJS, C++, PHP, ReactJS, Android, iOS, Ruby, NodeJS, Go, and Perl is some of the hot skills that will help you rock for 2019 and beyond. According to GitHub and Stack Overflow, taking up </span><a href="programming/python-deep-dive-training" target="_blank" class="CertTheme__link"><span>Python Course</span></a><span> will be an added advantage. A </span><a href="blog/programming/how-to-become-a-python-developer" class="CertTheme__link"><span>Python Developer</span></a><span> will earn an average of 4,41,248 per year.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Interviews can be scary, but preparing these top 100 Python interview questions and answers will help you in pursuing your dream career. It’s important to be prepared to respond effectively to the questions that employers typically ask in an interview. Since these interview questions on Python are very common, your prospective recruiters will expect you to be able to answer. These Python interview questions and answers will increase your confidence that you need to ace the interview and motivation as well.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Going through these Python programming interview questions and answers will help you to land your dream job in Data Science, Machine Learning or just Python coding. These Python basic interview questions will surely boost your confidence to face an interview and will definitely prepare you to answer the toughest of questions in the best way possible. These Python developer interview questions are suggested by experts and have proven to have great value.</span></p><p class="CertTheme__paragraph" dir="ltr" data-mode="standard"><span>Not only the job aspirants but also the recruiters can also refer these Python basic interview questions to know the right set of questions to assess a candidate. It is easier to prepare for interviews while taking </span><a href="programming-certification" target="_blank" class="CertTheme__link"><span>programming courses</span></a><span> as well. Treat your next Python interview as an entrance to success. Give it your best and get the job. Wish you all the luck and confidence.</span></p></div></div></div></div></div></section></div><!--/$--><!--$--><div><section class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0 z-[21] relative bg-white"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div><div class="max-w-133"><h2 class="text-sm uppercase font-semibold text-neutral-500">Recommended Courses</h2><div class="text-3xl leading-9.75 font-bold text-mono-black mt-spacing6">Learners Enrolled For</div></div><div class="relative"><div><div class="absolute flex gap-spacing16  right-0 -top-10 "><button class="border-2 rounded-full h-8 w-8 flex items-center justify-center border-solid border-neutral-700 pr-spacing2 disabled:border-neutral-200 transition duration-300 ease-in-out hover:bg-neutral-100 text-neutral-800 disabled:text-neutral-300 disabled:bg-transparent recommendedCourses-sliderprev-button undefined"><i class="icon-chevron-right text-2xl leading-6 rotate-180 pointer-events-none"></i></button><button class="border-2 rounded-full h-8 w-8 flex items-center justify-center border-solid pl-spacing2 border-neutral-700 disabled:border-neutral-200 text-neutral-800 disabled:text-neutral-300 transition duration-300 ease-in-out hover:bg-neutral-100 disabled:bg-transparent recommendedCourses-slidernext-button undefined"><i class="icon-chevron-right text-2xl leading-6 pointer-events-none"></i></button></div><div class="arrow-slider-wrapper pt-spacing40"><div class="swiper !-m-3 !p-3"><div class="swiper-wrapper"></div></div></div></div></div></div></div></section></div><!--/$--><!--$--><div class="md:pt-spacing48 pt-spacing44"><div><section data-id="ow-cta1-1" id="ow-cta1-1" class="py-spacing44 sm:py-spacing48 xl:px-spacing80 sm:px-spacing112 px-0 bg-home-cta !p-0"><div class="px-spacing20 md:px-0 w-full 2xl:max-w-7xl mx-auto"><div class="row g-4"><div class="col-12 md:flex-col"><div class="flex md:flex-row flex-col gap-spacing32 justify-center md:p-0 py-spacing24 px-spacing4 md:gap-spacing80"><img alt="CTA" loading="lazy" width="100" height="100" decoding="async"  class="self-end w-80 h-54" style="color:transparent" src="https://d2o2utebsixu4k.cloudfront.net/IllustrationCTA-5a461054ff2a4b0daa61b1369df49999.svg"><div class="flex justify-center md:w-140  items-center flex-col gap-spacing8"><div class="text-sm font-semibold uppercase text-secondary-700">Got more questions? We've got answers.</div><div class="text-2xl text-mono-black text-center font-bold">Book Your Free Counselling Session Today.</div></div><div class="flex justify-center items-center"><div class="group flex justify-center md:pb-0 m-0"><button class="transition duration-300 ease-in-out bg-mono-black md:hover:bg-primary-main active:bg-primary-main rounded text-white px-6 py-4 flex items-center justify-center md:w-auto w-fit h-11 md:h-14 whitespace-nowrap !bg-home-red-main text-sm md:text-base font-bold md:!pl-spacing28 md:!pr-spacing20 !pl-spacing16 !pr-spacing12 !py-0" tabindex="-1"><p class="">Connect With Us</p><i class="icon-chevron-right leading-5 ml-spacing8 md:ml-spacing12 text-xl text-white"></i></button><div class="relati"></div></div></div></div></div></div></div></section></div></div><!--/$--></div><div id="chatContainer" class="hidden fixed right-2.5 bottom-20 z-50 items-end"><div class="hidden md:flex items-end"><div id="chatToolTip" class="hidden relative tooltip-bottom chatToolTipDiv"><span class="font-bold">Hello! Ready to elevate your career? Explore 500+ future-ready courses with SureCertificate  🚀</span><span id="toolTipClose" class="cursor-pointer absolute top-0 right-1.5">x</span></div><div id="chatButton" class="cursor-pointer relative"><div class="h-15 w-15 flex items-center justify-center rounded-128 bg-primary-main text-mono-white"><i class="icon-message-filled text-1.75xl"></i></div><div id="notificationCounter" class="hidden absolute top-0 right-0 md:top-1 md:right-1 w-3.5 h-3.5 bg-red-600 rounded-full outline outline-1 outline-white text-center text-white text-xs leading-3 font-bold">1</div></div></div><div class="flex items-center gap-spacing4 md:hidden"><div id="chatButtonMobile" class="flex justify-center items-center h-12 w-12 bg-mono-white shadow-elevation rounded-128"><i class="icon-message-filled text-2xl text-mono-black"></i></div></div></div>
<?php include __DIR__ . '/../../footer.php'; ?>
