Group1 Project
Group1 Project
Group1 Project
Problem Set 1
Python Function
1. Write a function named calculator, that takes three parameters, two numbers and a string
representing an operation (add, subtract, multiply and divide). The function should
perform the operation and return the result.
Sample Output:
Enter number 1: 10
Enter number 2: 5
Enter operator: +
The sum of 10 and 5 is: 15
2. Write a function named count_words that takes a string as a parameter and returns the
number of words in the string. Assume that words are separated by spaces.
Sample output:
programming.txt
4. Create a text file named ‘multimedia.txt’, the program must read the file and display the
text in the console or output window.
multimedia.txt
Multimedia refers to the integration of various forms of media, such as text, graphics, audio,
video, and animation, in a digital format. It involves the combination of different elements to
create interactive and dynamic content that engages the senses.
Python List
5. Write a program that calculates the sum of all the elements in a list of numbers, supposed
the list of numbers is [5,3,7,8,9,10,6,12]
Sample output:
The sum of all the elements in a list is: 60
6. Write a program that calculates the average of all the elements in a list of numbers,
supposed the list of numbers is [7,5,23,12,45,6,9,8,14]
Sample output:
The sum of all the elements in a list is: 129
The average of all elements in a list is: 14.3333
7. Write a Python program that will find the maximum element in a list of numbers,
supposed the list of numbers is [7,5,23,12,45,6,9,8,14].
Sample output:
The maximum element in a list is: 45
Python OOP
8. Create a class named Person with attributes name, age, address, and gender. Write a
method named display that prints the name, age, address and gender of the person then
create an object or instance of the Person class and call the display method.
9. Create a python program that defines a basic class and create an object with the following
steps.
a. Define a class named ‘Computer’ with attributes (casing, processor, processor,
monitor and HDD)
b. Add a method to display the computer information.
c. Create objects of the class and display their information
Python Turtle
10. Create a python turtle to draw a star pattern on the screen.
Python TKinter
11. Write a python Tkinter to compute salary of individual employee with the given formula:
12. Write a python Tkinter to calculates and displays the area of a parallelogram.
13. Write a python program using Tkinter to compute price of a tarpaulin using the formula:
Price = (Length * Widht * 25)