0% found this document useful (0 votes)
3 views

Python Assignment

The document outlines a Python assignment consisting of various questions related to Python programming concepts. It covers topics such as the definition and uses of Python, modules, loops, data types, and practical programming tasks involving lists, tuples, dictionaries, and recursion. Each question requires explanations, examples, or code implementations to demonstrate understanding of Python.

Uploaded by

anshikaoberoi40
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Python Assignment

The document outlines a Python assignment consisting of various questions related to Python programming concepts. It covers topics such as the definition and uses of Python, modules, loops, data types, and practical programming tasks involving lists, tuples, dictionaries, and recursion. Each question requires explanations, examples, or code implementations to demonstrate understanding of Python.

Uploaded by

anshikaoberoi40
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 2

Python Assignment: Questions

Q1. What is Python? List at least three major uses of Python. Who created
Python, and when was it first released? What are some key differences between
Python 2.x and Python 3.x?
Q2. What is a module in Python? Provide an example of how to import and use
a module. Explain the difference between a module and a package in Python.
Q3. Write a Python expression using a logical operator to check if a number is
both greater than 10 and less than 20.
Q4. What is the difference between mutable and immutable types in Python?
Provide examples of each. Convert the string "1234" to an integer and a float.
Q5. What is the difference between a while loop and a for loop? Provide an
example of each. Write a Python program to check whether a no. is prime or
not.
Q6. What is the effect of using break, continue, pass, and else in loops?
Demonstrate each with examples.
Q7. Write a Python program to:
A)
 Create a list of 5 different integers.
 Append a new element to the list.
 Remove the second element from the list.
 Sort the list in ascending order.
 Print the final list.
B) Given a list number = [10, 20, 30, 40, 50], write a Python program to
calculate the sum of all elements.
Q8. Given a tuple t = (5, 10, 15, 20, 25), write a program to find the index of the
element 15.
Q9. Given a dictionary student = {"name": "Alice", "age": 20, "marks": 85},
write a program to check if a key ("age") exists in the dictionary.
Q10. What is recursion? Write a recursive function to find the Fibonacci series
up to n terms.
Q11. Write a Python program to:
 Take a string input from the user.
 Convert the string to uppercase and lowercase.
 Reverse the string.

You might also like