29 Aug Wednesday 17:00 Python Practice – 22.08.24.
Question: We have learned how to make the pirate ship bouncing left and right, try the following: How to make the pirate ship move and bounce diagonally when it reaches the edge. ...
Question: We have learned how to make the pirate ship bouncing left and right, try the following: How to make the pirate ship move and bounce diagonally when it reaches the edge. ...
Question 1: Draw the following picture in the pygame window: (could be different color) Hint: using pygame.draw.circle Question 2: Draw below image using pygame. (could using different color) ...
Question: Create a Rocketclass with two attributes: nameand destination. SpaceRocketclass is the inherited class from the base class Rocket. Besides the two attributes the base class has, SpaceRocketclass has an attribute maker. The Rocketclass has a method called launch(), it returns a string like “Falcon 9(which is name) is launched to low Earth orbit(which is destination)” The SpaceRocketclass...
Question: Create a Python class Person with attributes: name and age of type string. Create a display() method that displays the name and age of an object created via the Person class. Create a child class Student which inherits from the Person class and which also has a section attribute. Create a method displayStudent() that...
Question: Write a Rectangle class in Python language, allowing you to build a rectangle with length and width attributes. Create a getPerimeter() method to calculate the perimeter of the rectangle and an getArea() method to calculate the area of the rectangle. Use print to show the length, width,...
Question 1: Create a Student class and make the following methods to : __init__() – Initialize it with name and roll number. __str__() – Display all information of the student. setAge() – It should assign age to student. setMarks() – It should assign marks to the...
Question 1: Create a Tank class which have the attributes of: model direction(use ‘up’, ‘down’, ‘left’ or ‘right’) x position and y position The class also have the following method: move () method can change the x or y position by 10 base on the tank’s direction. (‘up’...
Question: Make a class definition for a BankAccount. It should have attributes for : – its name (a string), – account number (a string or integer), – and balance (a float). It should have methods to: – make deposits with displaying the balance, – and make withdrawals with displaying the balance. Hint: ...
uestion 1: Write a program that asks the user to enter his/her name, age, favorite color, and favorite food. Have the program save all four items to a text file called myinfo.txt, each one on a separate line. Question 2: Write a program that asks the user to enter...
Question: Use input() to take 10 input from user, each item is separated by space. Then try to complete the following task: Create a list from the input Delete all repeated elements of the list. Sample Input 1: 1 2 3 2 1 3 98 98 67 Sample Output...