Saving variables with shelve module.
6. Briefly explain saving variables with shelve module. Answer: Saving Variables with shelve Module The shelve module allows storing Python objects (like lists, dictionaries, etc.) in a file.It works like…
6. Briefly explain saving variables with shelve module. Answer: Saving Variables with shelve Module The shelve module allows storing Python objects (like lists, dictionaries, etc.) in a file.It works like…
5. Explain the concept of file path. Also discuss absolute and relative file path. Write a program to accept string and display total number of alphabets. Answer: File Paths in…
4. Explain the concept of file handling. Also explain reading and writing access with suitable example. Answer: File Handling in Python File handling lets you read from and write to…
3. Develop a python code to determine whether the given string is a palindrome or not a palindrome. Answer: Palindrome Check in Python A palindrome is a word or phrase…
2. Explain with examples:i) isalpha()ii) isalnum()iii) isspace()iv) isdcimalv) istitle Answer: String Methods i) isalpha() Returns True if all characters in the string are only alphabets (A–Z or a–z). ii) isalnum()…
1. Explain join() and split() method with examples. Answer: join() Method Used to combine a list of strings into one single string.Syntax: ‘separator’.join(list) Example: Here, ‘ ‘ (a space) is…
Module 1 Q1. What is the need for role of precedence? Illustrate the rules of precedence in Python with example. Q2. What are functions? Explain Python function with parameters and…
Python is an object-oriented programming language that supports the key principles of object-oriented design. These characteristics help in creating modular, reusable, and structured code. The four main object-oriented characteristics possessed…
What is class? How do we define class? How class members are accessed? Explain with examples Class A class is a programmer-defined type that acts as a blueprint for creating…
Operator Overloading Example: Overloading + for Time class (from 17.7) Usage: Python internally calls start.__add__(duration). Five Common Operators and Their Special Methods Operator Special Method Usage Example + __add__(self, other)…