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
Create a Python script that will reduce an input fraction to its lowest term. The program requirements will be:
Sample Output:
Input a fraction? : 4/6
Reduced fraction is 2/3
I need the code to have an output stated above and that the requirements are met in the code.
Machine 8
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
Program Requirements:
1. Define a function that will check first if the input fraction is a VALID fraction.
2. Define a function that will split a VALID fraction and return a list that consists the numerator and denominator.
3. Define a function that will accept two parameters (numerator and denominator to determine the greatest common divisor.
4. Define a function that will accept two parameters (numerator, denominator) and will return the reduced fraction.
Sample Output:
Input a fraction: 4/6
Reduced fraction is 2/3
Kaye Keith C. Ruden
Machine Problem 3
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
Program Requirements:
1. Define a function that will check first if the input fraction is a VALID fraction.
2. Define a function that will split a VALID fraction and return a list that consists the numerator and denominator.
3. Define a function that will accept two parameters (numerator and denominator to determine the greatest common divisor.
4. Define a function that will accept two parameters (numerator, denominator) and will return the reduced fraction.
Sample Output:
Input a fraction? 5/0
Invalid fraction
Kaye Keith C. Ruden
Machine Problem 3
Reducing Fraction to Lowest Term
Create a Python script that will reduce an input fraction to its lowest term.
Program Requirements:
1. Define a function that will check first if the input fraction is a VALID fraction.
2. Define a function that will split a VALID fraction and return a list that consists the numerator and denominator.
3. Define a function that will accept two parameters (numerator and denominator to determine the greatest common divisor.
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
This program will involve the creation Red-Black Tree Class.
Recall a Red-Black Tree is a special form of a binary Tree.
Refer to Red–black tree - Wikipedia.
The Red-Black Tree will be used to encode the number of word occurrences within a document.
You may select any text document you like to test your code.
You must implement the following class methods;
1. A method that will allow user input of the text file to load
2. A method to read the text file and decompose the file into a list of words
3. A method to add a word to the tree.
4. A method to locate a word within the tree and extract the number of occurrences.
5. A method to allow the user to find a word in the tree
6. A method to gather stats on the tree...word with maximum number of occurrences, minimum occurrences, average number of occurrences, total number of words, tree depth and any other statistics you can think of.
7. A method to remove a word from the tree.
8. A method to save the tree to a file for recall/reuse in JSON format.
A . An airline intends to extend its air fleet by purchasing three types of aircrafts, denoted by I, II and III respectively. The available budget is 5000 units. The three types have the following features:
l .costs 100 units, has a range of 6.000 km and the collision avoidance system range is 30 km;
II. costs 60 units, has a range of 4.200 km and the collision avoidance system range is 48 km;
III. costs 50 units, has a range of 2.800 km and the collision avoidance system range is 32 km;
Compute how many aircrafts from each type should be purchased such that
-the budget is not exceeded
-the mean flight range is maximized the mean of
-the collision avoidance system range is at least 40 km.
A. N queens-problem
Q. Design a genotype-phenotype representation along with an appropriate way to define the neighborhood of a given configuration to solve the N queens problem by the hill climbing algorithm.
A . An airline intends to extend its air fleet by purchasing three types of aircrafts, denoted by I, II and III respectively. The available budget is 5000 units. The three types have the following features:
l .costs 100 units, has a range of 6.000 km and the collision avoidance system range is 30 km;
II. costs 60 units, has a range of 4.200 km and the collision avoidance system range is 48 km;
III. costs 50 units, has a range of 2.800 km and the collision avoidance system range is 32 km;
Compute how many aircrafts from each type should be purchased such that
-the budget is not exceeded
-the mean flight range is maximized the mean of
-the collision avoidance system range is at least 40 km.
Q. Solve A using the backtracking algorithm.