{"id":12226,"date":"2024-08-19T10:00:56","date_gmt":"2024-08-19T04:30:56","guid":{"rendered":"https:\/\/www.placementpreparation.io\/blog\/?p=12226"},"modified":"2024-12-26T17:17:43","modified_gmt":"2024-12-26T11:47:43","slug":"python-interview-questions-for-freshers","status":"publish","type":"post","link":"https:\/\/www.placementpreparation.io\/blog\/python-interview-questions-for-freshers\/","title":{"rendered":"Top Python Interview Questions for Freshers"},"content":{"rendered":"<?xml encoding=\"utf-8\" ?><p>Are you preparing for your first Python interview and wondering what questions you might face? Understanding the key Python interview questions for freshers can give you more clarity.<\/p><p>This blog is here to help you get ready with practical questions that test your real-world problem-solving skills. We&rsquo;ve gathered some of the most common basic Python interview questions that freshers often encounter.<\/p><p>With this guide, you&rsquo;ll be well-prepared to tackle these Python interview questions and answers for freshers and make a strong impression in your interview.<\/p><p><a href=\"https:\/\/www.guvi.in\/courses\/programming\/python\/?utm_source=placement_preparation&amp;utm_medium=blog_banner&amp;utm_campaign=python_interview_questions_for_freshers_horizontal\" target=\"_blank\" rel=\"noopener\"><img decoding=\"async\" class=\"alignnone wp-image-10467 size-full\" src=\"https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal.webp\" alt=\"python course desktop banner horizontal\" width=\"2270\" height=\"600\" srcset=\"https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal.webp 2270w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal-300x79.webp 300w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal-1024x271.webp 1024w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal-768x203.webp 768w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal-1536x406.webp 1536w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal-2048x541.webp 2048w, https:\/\/www.placementpreparation.io\/blog\/wp-content\/uploads\/2024\/05\/python-course-desktop-banner-horizontal-150x40.webp 150w\" sizes=\"(max-width: 2270px) 100vw, 2270px\"><\/a><\/p><h2 id=\"practice-python-interview-questions\">Practice Python Interview Questions and Answers<\/h2><p>Below are the 50 Python interview questions for freshers with answers:<\/p><h3 id=\"check-even-or-odd-number\">1. Write a Python program to check if a given number is even or odd using the modulo operator.<\/h3><p><strong>Answer:<\/strong><\/p><p>The solution checks if the number is divisible by 2 using the modulo operator. If the result is 0, the number is even; otherwise, it&rsquo;s odd.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def check_even_odd(num):<br>\nif num % 2 == 0:<br>\nreturn &ldquo;Even&rdquo;<br>\nelse:<br>\nreturn &ldquo;Odd&rdquo;<\/p>\n<p>number = int(input(&ldquo;Enter a number: &ldquo;))<br>\nprint(check_even_odd(number))<\/p>\n<\/div><\/div><h3 id=\"swap-variables-without-temp\">2. How would you swap two variables in Python without using a temporary variable?<\/h3><p><strong>Answer:<\/strong><\/p><p>You can swap two variables using tuple unpacking.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>a = 5<br>\nb = 10<br>\na, b = b, a<br>\nprint(a, b) # Output: 10 5<\/p>\n<\/div><\/div><h3 id=\"find-maximum-of-three-numbers\">3. Write a Python program to find the maximum of three numbers using comparison operators.<\/h3><p><strong>Answer:<\/strong><\/p><p>The solution compares three numbers using nested if-else statements to determine the maximum value.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def find_maximum(a, b, c):<br>\nif a &gt;= b and a &gt;= c:<br>\nreturn a<br>\nelif b &gt;= a and b &gt;= c:<br>\nreturn b<br>\nelse:<br>\nreturn c<\/p>\n<p>print(find_maximum(10, 20, 15))<\/p>\n<\/div><\/div><h3 id=\"check-number-in-specific-range\">4. Write a Python program to check if a given number lies within a specific range (10 to 50).<\/h3><p><strong>Answer:<\/strong><\/p><p>The solution uses the logical and operator to check if the number lies between 10 and 50.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def is_within_range(num):<br>\nif 10 &lt;= num &lt;= 50:<br>\nreturn True<br>\nelse:<br>\nreturn False<\/p>\n<p>print(is_within_range(25))<\/p>\n<\/div><\/div><h3 id=\"increment-variable-by-5\">5. Write a Python program to increment a variable by 5 using a compound assignment operator.<\/h3><p><strong>Answer:<\/strong><\/p><p>The solution demonstrates the use of the += operator to add 5 to a given variable.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def increment_by_five(n):<br>\nn += 5<br>\nreturn n<\/p>\n<p>number = 10<br>\nprint(increment_by_five(number))<\/p>\n<\/div><\/div><h3 id=\"difference-between-==-and-is\">6. What is the difference between == and is in Python?<\/h3><p><strong>Answer:<\/strong><\/p><ul>\n<li>== checks if the values of two objects are equal.<\/li>\n<li>is checks if two objects are the same instance (i.e., they have the same memory address).<\/li>\n<\/ul><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>a = [1, 2, 3]\nb = [1, 2, 3]\nprint(a == b) # Output: True<br>\nprint(a is b) # Output: False<\/p>\n<\/div><\/div><h3 id=\"check-if-string-is-palindrome\">7. How can you check if a string is a palindrome in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>A palindrome is a string that reads the same forward and backward. You can check this by comparing the string with its reverse.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def is_palindrome(s):<br>\nreturn s == s[::-1]\n<\/p><p>print(is_palindrome(&ldquo;radar&rdquo;)) # Output: True<br>\nprint(is_palindrome(&ldquo;hello&rdquo;)) # Output: False<\/p>\n<\/div><\/div><h3 id=\"check-sign-of-a-number\">8. Write a Python program to check whether a number is positive, negative, or zero.<\/h3><p><strong>Answer:<\/strong><\/p><p>The solution uses if-elif-else statements to determine the sign of the number.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def check_sign(num):<br>\nif num &gt; 0:<br>\nreturn &ldquo;Positive&rdquo;<br>\nelif num &lt; 0:<br>\nreturn &ldquo;Negative&rdquo;<br>\nelse:<br>\nreturn &ldquo;Zero&rdquo;<\/p>\n<p>number = int(input(&ldquo;Enter a number: &ldquo;))<br>\nprint(check_sign(number))<\/p>\n<\/div><\/div><h3 id=\"find-sum-of-digits\">9. Write a Python program to find the sum of the digits of a number.<\/h3><p><strong>Answer:<\/strong><\/p><p>The solution uses a for loop to iterate through each digit of the number and accumulate the sum.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def sum_of_digits(n):<br>\ntotal = 0<br>\nfor digit in str(n):<br>\ntotal += int(digit)<br>\nreturn total<\/p>\n<p>print(sum_of_digits(1234))<\/p>\n<\/div><\/div><h3 id=\"understand-python-decorators\">10. What are Python decorators, and how do they work?<\/h3><p><strong>Answer:<\/strong><\/p><p>Decorators are a way to modify the behavior of a function or method. They allow you to wrap another function to extend its behavior.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def my_decorator(func):<br>\ndef wrapper():<br>\nprint(&ldquo;Something is happening before the function is called.&rdquo;)<br>\nfunc()<br>\nprint(&ldquo;Something is happening after the function is called.&rdquo;)<br>\nreturn wrapper<\/p>\n<p>@my_decorator<br>\ndef say_hello():<br>\nprint(&ldquo;Hello!&rdquo;)<\/p>\n<p>say_hello()<br>\n# Output:<br>\n# Something is happening before the function is called.<br>\n# Hello!<br>\n# Something is happening after the function is called.<\/p>\n<\/div><\/div><h3 id=\"define-factorial-function\">11. How would you define a function that calculates the factorial of a number?<\/h3><p><strong>Answer:<\/strong><\/p><p>The function takes a number as input and returns its factorial using a loop or recursion.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def factorial(n):<br>\nif n == 0:<br>\nreturn 1<br>\nelse:<br>\nreturn n * factorial(n-1)<\/p>\n<p>print(factorial(5)) # Output: 120<\/p>\n<\/div><\/div><h3 id=\"handle-extra-function-arguments\">12. What happens if you pass more arguments to a function than it is defined to accept?<\/h3><p><strong>Answer:<\/strong><\/p><p>Python will raise a <em><strong>TypeError<\/strong><\/em> indicating that the function received too many arguments.<\/p><h3 id=\"define-function-with-arguments\">13. How can you define a function with both positional and keyword arguments?<\/h3><p><strong>Answer:<\/strong><\/p><p>You define a function where some arguments are positional, and others have default values.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def greet(name, message=&rdquo;Hello&rdquo;):<br>\nreturn f&rdquo;{message}, {name}!&rdquo;<\/p>\n<p>print(greet(&ldquo;John&rdquo;)) # Output: Hello, John!<\/p>\n<\/div><\/div><h3 id=\"purpose-of-\">14. What is the purpose of the *args and **kwargs in function arguments?<\/h3><p><strong>Answer:<\/strong><\/p><p><em><strong>*args<\/strong><\/em> allows you to pass a variable number of positional arguments, while <em><strong>**kwargs<\/strong><\/em> allows for keyword arguments.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def func(*args, **kwargs):<br>\nprint(args)<br>\nprint(kwargs)<\/p>\n<p>func(1, 2, 3, a=4, b=5) # Output: (1, 2, 3) {&lsquo;a&rsquo;: 4, &lsquo;b&rsquo;: 5}<\/p>\n<\/div><\/div><h3 id=\"create-lambda-to-square-number\">15. How would you create a lambda function that squares a number?<\/h3><p><strong>Answer:<\/strong><\/p><p>A lambda function is a short anonymous function defined using the lambda keyword.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>square = lambda x: x**2<br>\nprint(square(4)) # Output: 16<\/p>\n<\/div><\/div><h3 id=\"return-multiple-values-from-function\">16. How can you return multiple values from a function?<\/h3><p><strong>Answer:<\/strong><\/p><p>You can return multiple values by separating them with commas.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def get_min_max(numbers):<br>\nreturn min(numbers), max(numbers)<\/p>\n<p>print(get_min_max([1, 2, 3, 4])) # Output: (1, 4)<\/p>\n<\/div><\/div><h3 id=\"define-function-inside-function\">17. What happens when you define a function inside another function?<\/h3><p><strong>Answer:<\/strong><\/p><p>The inner function is locally scoped to the outer function and can only be called within it.<\/p><h3 id=\"understand-default-mutable-arguments\">18. How does Python handle default mutable arguments in functions?<\/h3><p><strong>Answer:<\/strong><\/p><p>Default mutable arguments (like lists) retain their state across function calls, leading to unexpected behavior.<\/p><h3 id=\"modify-global-variable-in-function\">19. How would you modify a global variable inside a function?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the global keyword to modify a global variable within a function.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>x = 10<br>\ndef modify_global():<br>\nglobal x<br>\nx = 20<\/p>\n<p>modify_global()<br>\nprint(x) # Output: 20<\/p>\n<\/div><\/div><h3 id=\"use-nonlocal-in-nested-functions\">20. How would you use the nonlocal keyword in nested functions?<\/h3><p><strong>Answer:<\/strong><\/p><p>nonlocal allows you to modify a variable in the nearest enclosing scope that is not global.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>def outer():<br>\nx = 5<br>\ndef inner():<br>\nnonlocal x<br>\nx = 10<br>\ninner()<br>\nreturn x<\/p>\n<p>print(outer()) # Output: 10<\/p>\n<\/div><\/div><h3 id=\"create-list-of-even-numbers\">21. How do you create a list of even numbers from 1 to 10 using list comprehension?<\/h3><p><strong>Answer:<\/strong><\/p><p>List comprehension is a concise way to create lists in Python.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>evens = [x for x in range(1, 11) if x % 2 == 0]\nprint(evens) # Output: [2, 4, 6, 8, 10]\n<\/p><\/div><\/div><h3 id=\"remove-last-element-from-list\">22. How would you remove the last element from a list in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>You can use the pop() method without an argument to remove the last element.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>my_list = [1, 2, 3]\nmy_list.pop()<br>\nprint(my_list) # Output: [1, 2]\n<\/p><\/div><\/div><h3 id=\"merge-two-dictionaries\">23. How can you merge two dictionaries in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>You can merge two dictionaries using the update() method or the {**dict1, **dict2} syntax.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>dict1 = {&lsquo;a&rsquo;: 1, &lsquo;b&rsquo;: 2}<br>\ndict2 = {&lsquo;b&rsquo;: 3, &lsquo;c&rsquo;: 4}<br>\ndict1.update(dict2)<br>\nprint(dict1) # Output: {&lsquo;a&rsquo;: 1, &lsquo;b&rsquo;: 3, &lsquo;c&rsquo;: 4}<\/p>\n<\/div><\/div><h3 id=\"difference-between-list-and-tuple\">24. What is the difference between a list and a tuple?<\/h3><p><strong>Answer:<\/strong><\/p><p>A list is mutable, while a tuple is immutable. Lists use square brackets [], and tuples use parentheses ().<\/p><h3 id=\"check-key-existence-in-dictionary\">25. How would you check if a key exists in a dictionary?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the in keyword to check if a key is in a dictionary.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>my_dict = {&lsquo;a&rsquo;: 1, &lsquo;b&rsquo;: 2}<br>\nprint(&lsquo;a&rsquo; in my_dict) # Output: True<\/p>\n<\/div><\/div><h3 id=\"sort-list-of-tuples-by-second-element\">26. How can you sort a list of tuples based on the second element in each tuple?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the sorted() function with a lambda function as the key.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>my_list = [(1, 3), (2, 2), (3, 1)]\nsorted_list = sorted(my_list, key=lambda x: x[1])<br>\nprint(sorted_list) # Output: [(3, 1), (2, 2), (1, 3)]\n<\/p><\/div><\/div><h3 id=\"remove-duplicate-elements-from-list\">27. How would you remove duplicate elements from a list?<\/h3><p><strong>Answer:<\/strong><\/p><p>Convert the list to a set and back to a list to remove duplicates.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>my_list = [1, 2, 2, 3, 4, 4, 5]\nunique_list = list(set(my_list))<br>\nprint(unique_list) # Output: [1, 2, 3, 4, 5]\n<\/p><\/div><\/div><h3 id=\"count-occurrences-in-a-list\">28. How do you count the occurrences of each element in a list?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use a dictionary to count the occurrences of each element.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>my_list = [1, 2, 2, 3, 3, 3]\ncount_dict = {}<br>\nfor item in my_list:<br>\ncount_dict[item] = count_dict.get(item, 0) + 1<br>\nprint(count_dict) # Output: {1: 1, 2: 2, 3: 3}<\/p>\n<\/div><\/div><h3 id=\"create-set-from-a-list\">29. How would you create a set from a list?<\/h3><p><strong>Answer:<\/strong><\/p><p>Convert the list to a set using the set() function.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>my_list = [1, 2, 3, 4, 4, 5]\nmy_set = set(my_list)<br>\nprint(my_set) # Output: {1, 2, 3, 4, 5}<\/p>\n<\/div><\/div><h3 id=\"create-dict-with-default-values\">30. How can you create a dictionary with default values for keys?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>defaultdict<\/strong> from the <strong>collections<\/strong> module to create a dictionary with default values.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>from collections import defaultdict<br>\nmy_dict = defaultdict(int)<br>\nmy_dict[&lsquo;a&rsquo;] += 1<br>\nprint(my_dict) # Output: {&lsquo;a&rsquo;: 1}<\/p>\n<\/div><\/div><h3 id=\"define-a-class-in-python\">31. How do you define a class in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>class<\/strong> keyword followed by the class name and a colon.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class MyClass:<br>\npass<\/p>\n<\/div><\/div><h3 id=\"initialize-object-with-attributes\">32. How would you initialize an object with specific attributes?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>__init__<\/strong> method to initialize an object&rsquo;s attributes when it is created.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Car:<br>\ndef __init__(self, make, model):<br>\nself.make = make<br>\nself.model = model<\/p>\n<p>my_car = Car(&ldquo;Toyota&rdquo;, &ldquo;Corolla&rdquo;)<br>\nprint(my_car.make, my_car.model) # Output: Toyota Corolla<\/p>\n<\/div><\/div><h3 id=\"instance-vs-class-variables\">33. What is the difference between instance variables and class variables?<\/h3><p><strong>Answer:<\/strong><\/p><p>Instance variables are unique to each instance, while class variables are shared across all instances of the class.<\/p><h3 id=\"implement-inheritance-in-python\">34. How would you implement inheritance in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Define a new class that inherits from an existing class by passing the parent class as an argument.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Animal:<br>\ndef speak(self):<br>\nreturn &ldquo;Animal speaks&rdquo;<\/p>\n<p>class Dog(Animal):<br>\ndef speak(self):<br>\nreturn &ldquo;Dog barks&rdquo;<\/p>\n<p>my_dog = Dog()<br>\nprint(my_dog.speak()) # Output: Dog barks<\/p>\n<\/div><\/div><h3 id=\"understand-polymorphism-in-python\">35. What is polymorphism in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Polymorphism allows different classes to be treated as instances of the same class through inheritance. The method is overridden in derived classes.<\/p><h3 id=\"achieve-encapsulation-in-python\">36. How do you achieve encapsulation in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Encapsulation is achieved by using private variables and methods, typically prefixed with an underscore (_).<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Example:<br>\ndef __init__(self):<br>\nself._private_var = 10<\/p>\n<\/div><\/div><h3 id=\"implement-abstraction-in-python\">37. What is abstraction, and how do you implement it in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Abstraction hides implementation details and shows only the essential features. It can be achieved using abstract classes and methods.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>from abc import ABC, abstractmethod<\/p>\n<p>class Animal(ABC):<br>\n@abstractmethod<br>\ndef sound(self):<br>\npass<\/p>\n<\/div><\/div><h3 id=\"override-str-method-in-class\">38. How would you override the __str__ method in a class?<\/h3><p><strong>Answer:<\/strong><\/p><p>Override the <strong>__str__<\/strong> method to define how the object should be represented as a string.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class Car:<br>\ndef __init__(self, make, model):<br>\nself.make = make<br>\nself.model = model<\/p>\n<p>def __str__(self):<br>\nreturn f&rdquo;{self.make} {self.model}&rdquo;<\/p>\n<p>my_car = Car(&ldquo;Toyota&rdquo;, &ldquo;Corolla&rdquo;)<br>\nprint(my_car) # Output: Toyota Corolla<\/p>\n<\/div><\/div><h3 id=\"implement-class-method-in-python\">39. How would you implement a class method in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>@classmethod<\/strong> decorator to define a method that belongs to the class rather than an instance.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class MyClass:<br>\ncount = 0<\/p>\n<p>@classmethod<br>\ndef increment_count(cls):<br>\ncls.count += 1<\/p>\n<p>MyClass.increment_count()<br>\nprint(MyClass.count) # Output: 1<\/p>\n<\/div><\/div><h3 id=\"purpose-of-len-magic-method\">40. What is the purpose of the __len__ magic method?<\/h3><p><strong>Answer:<\/strong><\/p><p>The <strong>__len__<\/strong> method is used to return the length of an object when len() is called on it.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class MyList:<br>\ndef __init__(self, items):<br>\nself.items = items<\/p>\n<p>def __len__(self):<br>\nreturn len(self.items)<\/p>\n<p>my_list = MyList([1, 2, 3])<br>\nprint(len(my_list)) # Output: 3<\/p>\n<\/div><\/div><h3 id=\"append-data-to-existing-file\">41. How can you append data to an existing file?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the mode <strong>&lsquo;a&rsquo;<\/strong> with the <strong>open()<\/strong> function to append data to a file.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>with open(&lsquo;file.txt&rsquo;, &lsquo;a&rsquo;) as file:<br>\nfile.write(&ldquo;\\nAppended text&rdquo;)<\/p>\n<\/div><\/div><h3 id=\"read-file-line-by-line\">42. How do you read a file line by line in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use a loop to iterate over the file object.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>with open(&lsquo;file.txt&rsquo;, &lsquo;r&rsquo;) as file:<br>\nfor line in file:<br>\nprint(line, end=&rdquo;)<\/p>\n<\/div><\/div><h3 id=\"read-binary-file-in-python\">43. How would you read a binary file in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the mode <strong>&lsquo;rb&rsquo;<\/strong> with the <strong>open()<\/strong> function to read a binary file.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>with open(&lsquo;image.jpg&rsquo;, &lsquo;rb&rsquo;) as file:<br>\ndata = file.read()<\/p>\n<\/div><\/div><h3 id=\"move-a-file-in-python\">44. How can you move a file in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>os.rename()<\/strong> function to move a file to a new location.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>import os<br>\nos.rename(&lsquo;old_path\/file.txt&rsquo;, &lsquo;new_path\/file.txt&rsquo;)<\/p>\n<\/div><\/div><h3 id=\"delete-a-file-in-python\">45. How do you delete a file in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>os.remove()<\/strong> function to delete a file.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>import os<br>\nos.remove(&lsquo;file.txt&rsquo;)<\/p>\n<\/div><\/div><h3 id=\"list-files-with-specific-extension\">46. How would you list all files in a directory with a specific extension?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use <strong>os.listdir()<\/strong> combined with a list comprehension to filter files by extension.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>import os<br>\nfiles = [f for f in os.listdir(&lsquo;.&rsquo;) if f.endswith(&lsquo;.txt&rsquo;)]\nprint(files)<\/p>\n<\/div><\/div><h3 id=\"copy-a-file-in-python\">47. How do you copy a file in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>shutil.copy()<\/strong> function from the <strong>shutil<\/strong> module to copy a file.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>import shutil<br>\nshutil.copy(&lsquo;source.txt&rsquo;, &lsquo;destination.txt&rsquo;)<\/p>\n<\/div><\/div><h3 id=\"raise-an-exception-manually\">48. How do you raise an exception in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use the <strong>raise<\/strong> keyword to raise an exception manually.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>raise ValueError(&ldquo;Invalid value provided&rdquo;)<\/p>\n<\/div><\/div><h3 id=\"create-custom-exception-in-python\">49. How would you create a custom exception in Python?<\/h3><p><strong>Answer:<\/strong><\/p><p>Define a new class that inherits from the built-in <strong>Exception<\/strong> class.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>class MyCustomError(Exception):<br>\npass<\/p>\n<p>raise MyCustomError(&ldquo;This is a custom exception&rdquo;)<\/p>\n<\/div><\/div><h3 id=\"handle-exceptions-in-a-loop\">50. How can you handle exceptions in a loop without breaking the loop?<\/h3><p><strong>Answer:<\/strong><\/p><p>Use a <strong>try-except<\/strong> block inside the loop to handle exceptions for each iteration.<\/p><div class=\"su-note\" style=\"border-color:#e5dbc7;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\"><div class=\"su-note-inner su-u-clearfix su-u-trim\" style=\"background-color:#FFF5E1;border-color:#ffffff;color:#333333;border-radius:3px;-moz-border-radius:3px;-webkit-border-radius:3px;\">\n<p>for i in range(5):<br>\ntry:<br>\nprint(1 \/ i)<br>\nexcept ZeroDivisionError:<br>\nprint(&ldquo;Cannot divide by zero&rdquo;)<\/p>\n<\/div><\/div><h2>Final Words<\/h2><p>Getting ready for an interview can feel overwhelming, but going through these Python fresher interview questions can help you feel more confident. This guide focuses on the kinds of Python developer interview questions for fresher roles that you&rsquo;re likely to face.<\/p><p>Don&rsquo;t forget to practice the Python basic coding interview questions too! With the right preparation, you&rsquo;ll ace your Python interview and take that important step in your career.<\/p><hr><h2>Frequently Asked Questions<\/h2><h3>1. What are the most common interview questions for Python?<\/h3><p>The most common interview questions for Python are usually centered around basic syntax, control flow, data structures, and simple algorithms.<\/p><h3>2. What are the important Python topics freshers should focus on for interviews?<\/h3><p>Freshers should focus on data types, loops, functions, OOP concepts, and basic problem-solving.<\/p><h3>3. How should freshers prepare for Python technical interviews?<\/h3><p>Freshers should practice coding regularly, understand core concepts, and work on sample interview questions.<\/p><h3>4. What strategies can freshers use to solve Python coding questions during interviews?<\/h3><p>Freshers should break down problems into smaller parts, write clear and simple code, and test their solutions thoroughly.<\/p><h3>5. Should freshers prepare for advanced Python topics in interviews?<\/h3><p>Yes, freshers should be familiar with advanced topics like file handling, exceptions, and libraries, depending on the job requirements.<\/p><hr><h2>Explore More Python Resources<\/h2><ul class=\"explore-more\">\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/best-websites-to-learn-python\/\">Python Learning Websites<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/best-websites-to-practice-python\/\">Python Practicing Websites<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/best-youtube-channels-to-learn-python\/\">Python YouTube Channels<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/python-project-ideas-for-beginners\/\">Python Project Ideas<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/best-python-frameworks\/\">Python Frameworks<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/best-apps-to-learn-python\/\">Python Apps<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/python-ides-and-code-editors\/\">Python IDEs<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/mcq\/python\/\">Python MCQ<\/a><\/li>\n<\/ul><h2>Explore More Interview Questions<\/h2><ul class=\"explore-more\">\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/java-interview-questions-for-freshers\/\">Java<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/sql-interview-questions-for-freshers\/\">SQL<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/react-interview-questions-for-freshers\/\">React<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/javascript-interview-questions-for-freshers\/\">JavaScript<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/c-programming-interview-questions-for-freshers\/\">C Programming<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/html-interview-questions-for-freshers\/\">HTML<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/css-interview-questions-for-freshers\/\">CSS<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/angular-interview-questions-for-freshers\/\">Angular<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/cpp-interview-questions-for-freshers\/\">C++<\/a><\/li>\n<li><a href=\"https:\/\/www.placementpreparation.io\/blog\/spring-boot-interview-questions-for-freshers\/\">Spring Boot<\/a><\/li>\n<\/ul>\n","protected":false},"excerpt":{"rendered":"<p>Are you preparing for your first Python interview and wondering what questions you might face? Understanding the key Python interview questions for freshers can give you more clarity.This blog is here to help you get ready with practical questions that test your real-world problem-solving skills. We&rsquo;ve gathered some of the most common basic Python interview [&hellip;]<\/p>\n","protected":false},"author":4,"featured_media":12440,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[45],"tags":[],"class_list":["post-12226","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-programming-interview-questions"],"_links":{"self":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts\/12226","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/users\/4"}],"replies":[{"embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/comments?post=12226"}],"version-history":[{"count":56,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts\/12226\/revisions"}],"predecessor-version":[{"id":12461,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/posts\/12226\/revisions\/12461"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/media\/12440"}],"wp:attachment":[{"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/media?parent=12226"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/categories?post=12226"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.placementpreparation.io\/blog\/wp-json\/wp\/v2\/tags?post=12226"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}