0% found this document useful (0 votes)
5 views6 pages

Python Programming Assignment Questions

Uploaded by

predator4632
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views6 pages

Python Programming Assignment Questions

Uploaded by

predator4632
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Python Programming

Assignment
Assignment Questions
Question 1
●Write a Python program that takes an
integer input and checks whether it is
positive, negative, or zero.
●If the number is positive, print all even
numbers from 1 to that number using a
loop.
Question 2
●Write a Python program that takes a string
input from the user.
●Store the frequency of each character in a
dictionary and store all unique characters
in a set.
Question 3
●Define a function calculate_factorial(n) that
returns the factorial of a number.
●Call the function from the main program
and handle negative input.
Question 4
●Create a class Student with attributes
name and marks.
●Use encapsulation to make marks private.
●Create a child class GraduateStudent to
demonstrate inheritance and
polymorphism.
Question 5
●Write a Python program that writes user
input text into a file and then reads the
content back.
●Handle exceptions such as
FileNotFoundError and invalid input.

You might also like