1-Choose your types of list as follows: Plants, Animals, Cities,
Countries, Football Teams, Classmates, Customers, Chemical elements, etc.
2-Draw flow chart and write python program in according to
following instruction:
*Add elements to your list.
*Remove element from tour list.
*Edit element on your list.
*Sort your elements.
*Print one element from your list.
*Print all of the elements from
your list.
Add two polynomials:
Given two polynomials A and B, write a program that adds the given two polynomials A and B.
Output:
Print the addition of polynomials A and B.
The format for printing polynomials is: Cix^Pi +Ci-1x*Pi-1t +C1x + CO, where Pi's are powers in decreasing order, Ci is co-efficient and CO is constant, there will be space before and after the plus or minus sign.If co-efficient is zero then don't print the term.If the term with highest degree is negative, the term should be represented as -Cix^Pi.For the term where power is 1 represent it as C1x instead of C1x^1.
If the degree of polynomial is zero and the
constant term is also zero, then just print 0 to represent the polynomial.
For term Cix°Pi, if the coefficient of the term CI is 1, simply print x*Pi instead of 1x^Pi.
Sample Input
4
05
10
2 10
3 6
3
01
12
24
Sample Output
6x3 + 14x^2 +2x + 6
O
Program to check the addition result is divisible by 10
Class 1 - Return addition result of two numbers
Class 2 -Check the addition result is divisible by 10(use super keyword)
Write a loop that will calculate the sum of every third integer beginning with i = 2 (i-e. calculate the sum of 2+5+8+11+) for all values of i that are less than 100, Write the loop in
two ways:
(1) Using a do---- while statement.
() Using a for statement.
Write a loop that will calculate the sum of every third integer beginning with i = 2 (i-e. calculate the sum of 2+5+8+11+) for all values of i that are less than 100, Write the loop in
two ways:
(1) Using a do---- while statement.
() Using a for statement.
Find the first address, last address and the number of addresses of a network whose one
of the IP addresses is 50.28.22.75 / 28.( whth all the steps). (5 marks question)
a point as an object with an x and y as key attributes, another properties is to check if the point is the origin or not. use methods such as getters, setters and constructors, your class should have the following functionality listed
isOrigin() : returns true if the values of x = 0 and y =0
distanceTo() : Takes in another point and finds the distance between the two points.
distanceToX(): Calculates the distance to the x-axis
Provide a toString() : to represent all the point attributes and the value returned by the isOrigin method 1.Provide a simple Class and object diagram for the above scenario 2.Implement class modelled above and test its functionality as specified below
Sample Run1
Enter the x&y values separated by a space: 9 4
Enter the x&y values separated by a space: 3 5
Output1:
Point A(9,4) not the Origin
Point B(3, 5) not the Origin
Distance from Point A(9,4) to Point B(3,5) = 6.08
Distance of Point B (3,5) to the X-axis = 5
Point A represented with toString : x = 9, y = 4
isOrigin : False
fraction as an object with a numerator and denominator as key attributes, check if the fraction is positive or negative. Use instance methods such as getters, setters and constructors, your class should have functionality listed below:
A) isImproper() : returns true if the numerator is bigger than the denominator e.g 5/4
B) toMixed() : converts an improper fraction to mixed e.g. 9/4 = 4 1⁄2 C) AddFraction(): takes in another fraction and add them up as follows, a/b + c/d = (a x b) + (b x c) /bxd
D) Provide a toString() : to represent the fraction as X/Y or X/Y/Z for improper fractions 1.1. Provide a simple Class and object diagram for the above scenario
1.2. Implement class modelled above and test its functionality as specified below
Sample Run1
Enter the numerator and denominator separated by a space: 9 4
Enter the numerator and denominator separated by a space: 3 5
Output1:
9/4 is an Improper Fraction
3/5 is a Proper Fraction
9/4 PLUS 3/5 = 57/20
The addition result represented with toString : 2/17/20
Create a program with two methods, one method for displaying your full name and the
other method displays your address.
I am Carla May Laput and my address is 067, Purok Bougainvilla, Larayan Dapitan City 7101
Create a program that contains two methods, one for displaying all even numbers from 1
to 10 and the other one displays all odd numbers from 1-10.