Number Diamond
Given an integer N as input,
write a program to print a number diamond of 2*N -1 rows as shown below.
Note: There is a space after each number.
In the given example, the number of rows in the diamond is 5
So, the output should be
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4
1 2 3
1 2
1
Your code:
N = int(input())
rows = []
for number in range(1, N + 1):
rows.append(' '.join([str(x) for x in range(1, number + 1)]))
for number in rows[::-1][1::]:
rows.append(number)
diamond = '\n'.join([x.center(2* N - 1) for x in rows])
print(diamond)
the above code works fine but only 7/10 test cases are passed
for input 15 the output is not the same as expected
Refer to the document in the link below
https://docs.google.com/document/d/1Un_RPlLjEqNbbkJDegaqVkYLedITyQdXRKugY24hJWk/edit?usp=sharing
The motorway management perceives that the waiting time computed in (a) above is not acceptable and it wishes to reduce it, first, by adding an extra tollbooth assistant to help improve the service rate to 250 motorists every 8-hour-day. The tollbooth attendant will be paid a monthly salary of GH¢400. The second option is that management can add a toll-operated machine which will cost GH¢3,000 and this amount is a free gift from the Minister. This option will reduce the arrival rate to 35 motorists every 2 hours. However, management will have to pay the operator who will man the toll-operated machine a monthly salary of GH¢550. Whichever option management adopts; they avoid lost sales of GH¢1,200.00 per month for every minute that average waiting time is reduced. Advise management which option it must adopt?
Discuss, in detail, reasons why an operating system is considered as
a resource manager; and explain how it manages the various
resources in the context of computer-based information systems
in use at a financial institution
Write a program that uses while loops and perform the following steps:
1) Prompt the user to input two integers: start and end (start must be less than end).
2) Output the average of the even numbers between start and end.
Smoking status
N
Cases of ARM
Never smokers
368
26
Ever smokers
864
79
A technician is setting up a new wireless network at a branch office that previously had only wired
connectivity with statically assigned IP addresses. After setting up the network, the technician
configures a server to provide IP addresses to wireless clients. During testing, the technician is
unable to access the Internet or named network resources. The technician receives a valid IP
address from the DHCP server and can ping the default gateway.
Explain various steps that can be taken to resolve this issue. (each step highlighted MUST be
accompanied by the intended solution the step hopes to achieve)
Dumbledore's Luncheon
Dumbledore is hosting a luncheon at Hogwarts, and Ron is incharge of the sitting plans.
Dumledore’s dining table can be thought of as an infinite row of seats with Dumbledore at one
end. Each of Dumbledore’s guests represents a character of English alphabet (a to z).
Dumbledore wants his guests to be seated such that the resulting string formed from the
alphabets should be lexicographically smallest (See examples for reference). He didn’t tell Ron
the total number of guests coming, but he will ask Ron to close the gate once all the guests
arrive (marking the end of incoming guests).
The rules of seating are as follows:
● Seats are allotted in sequential order, a guest who arrives later must be further from
Dumbledore than a guest who arrives earlier.
● An incoming guest must be assigned a seat, as soon as he arrives. He will take a seat.
what is the programming paradigm that answers the question how the result was obtained
we wish to store a large set of keyed data items where each item's key is the name of a ship Let's call this data item a Ship.
Each Ship item also stores numerous other data fields beside, ship's name which describes other properties of the ship, such as the number of sacks of grain that can be stored in the ship hold, the number of sacks currently in the ship hold, a list of the names of each member of the crew and their percentage share of the booty.
further suppose that the captain, does not keep all of his ships clustered together
in a single group in order to avoid detection. Instead, the captain keeps his ships grouped into multiple separate groups of ships called task forces.
Task 2)
Assume that primary purpose for storing these Ship keyed data items is to be able
to look up which task force a ship is in. In own words,
tell advantages and disadvantages (if any) for each JAVA ADTs
. Hash table
. Graph
. AVL Tree/BST tree
. Union-find/Disjointed data
which ADTs is best choice for this purpose, why.