Number of moves:
you are given a nxn square chessboard with one bishop and k number of obstacles placed on it. A bishop can go to different places in a single move. find the total no.of places that are possible for the bishop in a single move. Each square is referenced by a type describing the row, R, and column, C, where the square is located.
explanation: given N=6 K=2
bishop position 5 2
obstacle positions (2 2), (1 5)
the bishop can move in so o/p is 6
I/p:
6 2
5 2
2 2
1 6
O/p:
6
I/p:
6 4
3 3
1 3
3 1
5 1
1 5
O/p: 7
Write a program that requests the user for a year (you can assume the year will always be at
least 2000), the population of Brazil in that year (in terms of millions of people) and the annual
population growth rate (always as a real number in the range 0 – 1), and then uses the two
methods written above to determine and display the year in which Brazil’s population first
exceeded/exceeds 180 million people. The program must also display Brazil’s total population
in this year.
a) Write a method PopulationTotal that accepts 2 positive values, namely the current
population (in millions, e.g. a value of 1.5 means 1.5 million people) and the growth rate (e.g.
0.14 means 14%). The method determines and returns the total population based on the current
population and growth rate. For example, if the current population for a country is 1.165 million
people, and the annual population growth rate is 10%, then the total population is 1.2815 million
people after 1 year.
b) Write a method Over180Million that accepts a positive value representing the population (in
millions). The method determines whether the population is over 180 million people, and returns
a value of true if this is so, otherwise returns a value of false.
Program
Write a program to print the following, Given a word W and pattern P, you need to check whether the pattern matches the given word.The word will only contain letters(can be Uppercase and Lowercase). The pattern can contain letters, ? and *.
? : Can be matched with any single letter.
* : Can be matched with any sequence of letters (including an empty sequence).
If the pattern matches with the given word, print True else False.
Sample input 1
3
Hello Helll*
Hell He*ll
Hell hell*
Sample output 1
True
True
False
Sample Input 2
3
Hello *l?
Hell He?ll
Hell ?*
Sample Output 2
True
False
True
Instructions:
1. Input a random positive integer. Then, create an integer array with a size the same as the inputted integer.
2. Then, using loops, add random integer values into the array one by one. The number of values to be stored is dependent on the inputted odd integer on the first instruction.
3. Print out the list's new order in this manner, with each number separated by a space per row:
second-half values
middle value
first-half values
Refer to the sample output for a clearer view on how it is to be printed out.
Input
The first line contains an odd positive integer. It is guaranteed that this integer is greater than or equal to 3.
The next lines contains an integer.
5
1
3
4
5
2
Output
A line containing grouped arrays.
{2,5}-{4}-{3,1}
ou are to develop a web application that can assist in distributing TB drugs in remote areas of Lesotho. The system should facilitate village health workers to register TB patients. The patients should be able to log in to their accounts, view the type of medicine they are receiving, request additional medication, request a visit by the health worker and add a comment that the VHW can see. The VHW who is resident in a given village should be able to collect medication from a clinic and deliver it to be patients. The VHW should be able to receive a report of the patient’s medication which are due for collection. These reports should be generated monthly. The dispensary has the role of confirming the patient who should receive the treatment and should be able dispensary should be automated based on the date of enrollment. The administrator should be able to create accounts of VHW and Dispensary roles. They should have the right to delete and update details for any use
Boyce earns P35.00 per hour at his job. What would be his annual income be if he works 8 hours per day, 5 days per week, and 50 weeks per year? Write a script to support you answer, the script should prompt a user to enter his\her hourly rate, number of hours per day, number of days per week and number of weeks per year. Then the system computes the annual income [10 marks]
. Write a shell script called Grading.sh that will accept StudentID and Grade and the student are graded using the following grading criteria: 80 and above, Destination, 79-60, Merit, 59 -50, Pass, 49-40, Supplement and 39 and below, Fail. The program should add the records to a file called StudentGrades.txt. [15 Marks]
Elle Joy Vasquez
Preliminary Test 02
Create Python function that checks whether a passed string is PALINDROME or NOT.
Note: A palindrome is a word, phrase, or sequence that reads the same backward as forward, e.g., madam or nurses run.
Elle Joy Vasquez
Preliminary Test 04
Create a Python function that takes a list of n integers and returns the largest number among the n integers.