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

QP Python Suggestion

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

QP Python Suggestion

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

1.

Create a Python class called SalesPerson that has the following characteristics
a. It has a dynamic variable called firstName and lastName that provide the
saleperson’s first and last names. (Don’t forget about init function)
b. It has a variable sales that tracks the salesperson’s sales over time.
c. It has a method called makeSales that takes an integer and adds that integer to
sales.
d. It has a method called salesReport that prints a string ‘My total sales are {sales}.’
e. Once this is done, create a SalesPerson instance with firstName = “Dipti” and
lastName = “Kumari”. Have the salesperson make a sale worth 500 and then run the
salesReport method.
2. Write a program that overloads the + operator on a class Student that has attributes sname
and marks.
3. Write a Python program that calculates the factorial of a given number using
recursion.
4. Write a python program to find the exponentiation of a number using recursion.
5. To write a python program to create, slice, change, delete and index elements using Tuple.
6. Write a program to find GCD among two numbers.
7. Write a program to create a list of first 20 odd numbers using list comprehension.
8. Write a program that has a class Circle. Use a class variable to define the value of constant
PI. Use this class variable to calculate area and circumference of a circle with specified
radius.
9. Write a python program to implement polymorphism using abstract Class.
10. Write a program to implement all types of inheritance in a single program.

You might also like