Create a class in Python called Sorting which takes in a file name as an argument. An object of class Sorting will have methods called:
Hint: Use BubbleSort and take in the array or list from the GetData method as an argument.
Hint: You can use any method of reversing a list or array for this requirement. This can be done using slicing, by using the build in reversed() method, or by importing/using modules like array and NumPy. Keep in mind the last two methods require pip installs!
Write a script that will accept the sides of a triangle, let them be “a”, “b”, “c”. Based on these
variable values determine if the triangle is right angled or not, by using Pythagoras theorem.
Hint: if c2 = a2 + b2 then the given sides are right angled triangle else not a right-angled triangle
3.1 Write a function named "reverse” that takes as its arguments the following:
(a) an array of floating point values; (15)
(b) an integer that tells how many floating point values are in the array. (15)
The function must reverse the order of the values in the array.
Thus, for example, if the array that's passed to the function looks like this:
0 1 2 3 4
5.8 | 2.6 | 9.0 | 3.4 | 7.1
then when the function returns, the array will have been modified so that it looks like this:
0 1 2 3 4
7.1 | 3.4 | 9.0 | 2.6 | 5.8
The function should not return any value.
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
4. Define a function that will accept two parameters (numerator, denominator) and will return the reduced fraction.
Sample Output 1:
Input a fraction: 4/6
Reduced fraction is 2/3
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
3. Define a function that will accept two parameters (numerator and denominator to determine the greatest common divisor.
Sample Output 1:
Input a fraction: 4/6
Reduced fraction is 2/3
Variables, python operators,data types,string slicing, range of string using list, python conditional statements,user input, looping statement s, python function s, exception handling, file handling, module concept write a demart code using all these things
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
2. Define a function that will split a VALID fraction and return a list that consists the numerator and denominator.
Sample Output 1:
Input a fraction: 4/6
Reduced fraction is 2/3
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
1. Define a function that will check first if the input fraction is a VALID fraction.
Sample Output 1:
Input a fraction: 4/6
Reduced fraction is 2/3
1. Write a simple decryption program using string functions which will apply the Substitution Method. Here is the given Substitution Table.
Using the Employee table below, write the rational schema and draw it’s dependency diagram. Identify all dependencies.
EMP_NO
EMP_NAME
CUST_NO
CUST_NAME
CUST_PHONE
PROD_NO
PROD_NAME
DATE
215
SPHELELE
15
HUGUETTE
0834528787
10
SOAP
20/03/2012
216
BOKHOSI
16
TANDIWE
0784521635
12
BRAID
20/03/2012
217
THEMBA
16
TANDIWE
0784521635
15
PHONE
21/04/2012
218
LEFA
14
BUSISIWE
0618578542
12
PEN
22/04/2012
219
VALENTINE
14
BUSISIWE
0618578542
13
LAPTOP
22/04/2012
220
PROMISE
18
GIRLY
0829687841
13
LAPTOP
22/04/2012
4.2 Using the Employee table above, write the rational schema and draw it’s dependency diagram. (9)