1. What is Python?
Python is an interpreted, interactive, object-oriented programming language and automatic memory management. The benefits of pythons are that it is simple and easy, portable, extensible, build-in data structure and it is an open source.
2. Data types available in Python?
3. Delete a file using python?
os.remove (filename) or os.unlink(filename)
4. Difference between del() and remove() methods of the list?
remove() method is used to delete a single element from the list.
del() method is used to delete the whole list.
5. How can you make a Python Script executable on Unix?
You need to do two things,
• Executable Access to file
• Add this line ( #!/usr/local/bin/python) to the file.
6. local and global variables in Python?
Local variables: If a variable is assigned a new value anywhere within the function’s body, it’s assumed to be local.
Global variables: Those variables that are only referenced inside a function are implicitly global.
7. convert a number to a string?
built-in function <str()>
8. Difference between list and tuple?
List is mutable and tuples is immutable. The main difference between mutable and immutable is memory usage when you are trying to append an item.
9. Copy an object in Python?
Use copy.copy () or copy.deepcopy()
10. Python slice()
The slice object is used to slice a given sequence (string, bytes, tuple, list or range) or any object which supports sequence protocol
slice(start, stop, step)