0% found this document useful (0 votes)
2 views2 pages

Basic Python Main

The document contains a comprehensive list of questions and programming tasks related to Python, covering key features, operators, functions, data structures, file handling, and exception management. It includes practical programming exercises such as reversing a string, calculating Fibonacci series, and handling JSON data. The content serves as a guide for learning Python programming concepts and practices.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views2 pages

Basic Python Main

The document contains a comprehensive list of questions and programming tasks related to Python, covering key features, operators, functions, data structures, file handling, and exception management. It includes practical programming exercises such as reversing a string, calculating Fibonacci series, and handling JSON data. The content serves as a guide for learning Python programming concepts and practices.
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1. What are the key features of Python?

2. How do you write a comment in Python?


3. What is the difference between and, or, and not operators?
4. Predict the output:
x=5
x += 3
print(x)
5. Can you write an if statement in a single line? Give example.
6. What is the difference between nested if and elif?
7. What is the use of range() function?
8. What is the difference between break and continue?
9. What is the difference between return and print?
[Link] are variable-length arguments (*args and **kwargs)?
[Link] are built-in functions in Python? Give examples.
[Link] are list methods? Give 3 examples.
[Link] is the difference between list and tuple?
[Link] do you access dictionary keys and values?
[Link] a program to reverse a string.
[Link] is the difference between isalpha() and isalnum()?
[Link] to read a file line by line?
[Link] are file modes in Python?
[Link] is the difference between import module and from module import?
[Link] are built-in modules? Give examples.
[Link] is the difference between error and exception?
[Link] we use multiple except blocks?
[Link] an example for user-defined exception.
[Link] a program to find the sum of first N natural numbers.
[Link] a program to print Fibonacci series up to N terms.
[Link] a program to check whether a string is palindrome.
[Link] a program to remove all whitespace from a string.
[Link] a program to find the sum and average of elements in a list.
[Link] a program to convert a tuple into a list and vice versa.
[Link] a program to convert a tuple into a list and vice versa.
[Link] a lambda function to add two numbers.
[Link] a function to return the maximum of three numbers.
[Link] a program to count the number of lines, words, and characters in a
file.
[Link] a program to handle file not found exception while reading a file.
[Link] a program to store dictionary data (key-value pairs) into a text
file.
[Link] a program to merge two text files into a third file.
[Link] a program to check if a file exists, if not create one.
[Link] a program to handle FileNotFoundError while opening a file.
[Link] a program to store and read JSON data using json module.
[Link] a program that uses try-else-except-finally block.
[Link] a program that imports the math module and finds square root and
power of a number.
[Link] a program using datetime module to display the current date and
time.

You might also like