Create a program wherein any user should be able to search books by their title or its author.
Check the wrong of this code and show the exact code
dict1={}
class AddColumn:
def add_column(str1,list1):
dict1[str1].append(list1)
x=AddColumn()
x.add_column( "City name",["Adelaide", "Brisbane", "Darwin", "Hobart", "Sydney", "Melbourne", "Perth"])
x.add_column("Area", [1295,5905, 112, 1357, 2058, 1566, 5386])
x.add_column("Population", [1158259, 18557594, 120900, 205556, 4336374, 3306092, 1554769])
x.add_column("Annual Rainfall"[600.5, 1146.4, 1714.7, 619.5, 1214.8, 646.9,869.4])
print(dict1)
Check the Index Block on NO.25 and show the correct code
main_list = []
x = {}
field_names = [ "City name", "Area", "Population", "Annual Rainfall"]
list1 = [
["Adelaide", 1295, 1158259, 600.5],
["Brisbane", 5905, 1857594, 1146.4],
[ "Darwin", 112, 120900, 1714.7],
["Hobart", 135, 20556, 619.5],
["Sydney", 2058, 4336374, 1214.8],
["Melbourne", 1566, 3806092, 646.9],
["Perth", 5386, 1554769, 869.4]]
for i in range(0, len(list1)):
for key in field_names:
for value in list1[i]:
x[key] = value
list1[i].remove(value)
break
main_list.append(x)
print("Resultant Main list is : " + str(main_list))
Create a program to generate a text file to produce a quote for a customer wishing to purchase external hard drives from CGL Computer Products company. Create a dictionary of the following drives (item number is key and price is the value) bellow
{335160:484.99,354732:221.44,3514676:257.42,3006905:315.55,3351600:447.50,357888:379.15}
Open a new text file to create a quote for the customer. Ask the customer for the item number and quantity they wish to purchase. Search your dictionary to retrieve the price based on the item number. Allow the customer to purchase multiple items. Print a header for the quote, column headings, line items for the quantity and description of each item purchased and the total price. After all items have been listed, calculate shipping as 3% of the total, add the shipping to the total to display the total amount due. Tax calculation is not necessary.
For this program I want an exact output as I given in the sample numbers position should not be changed.
M, N = input('Enter M, N: ').split()
M, N = int(M), int(N)
matrix = []
for _ in range(M):
row = [int(x) for x in input().split()]
matrix.append(row)
K = int(input('Enter K: '))
values = matrix[0][:-1] + [x[-1] for x in matrix][:-1] + matrix[-1][::-1][:-1] + [x[0] for x in matrix][::-1][:-1]
values = values[-K:] + values[:-K]
output = matrix
idxs = [(0, j) for j in range(N)][:-1] + [(i, N - 1) for i in range(M)][:-1] + [(M - 1, j) for j in range(N)][::-1][:-1] + [(i, 0) for i in range(M)][::-1][:-1]
idx = 0
for i, j in idxs:
output[i][j] = values[idx]
idx += 1
for i in output:
for j in i:
print(j, end=' ')
print()
Sample Input 1
4 4
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 16
3
Sample Output 1
13 9 5 1
14 7 11 2
15 6 10 3
16 12 8 4
Sample Input 2
3 4
1 2 3 4
10 11 12 5
9 8 7 6
2
Sample Output 2
9 10 1 2
8 11 12 3
7 6 5 4
Write a program in python to print respective month of a year.
Instructions:
Instructions
Input
A line containing an integer.
4
Output
Multiple lines containing a string.
CodeChum·is·awesome
CodeChum·is·awesome
CodeChum·is·awesome
CodeChum·is·awesome
by CodeChum Admin
Instructions:
Input
A line containing two integers separated by a space.
2 10
Output
Multiple lines containing a string and an integer.
Loading...2%
Loading...3%
Loading...5%
Loading...6%
Loading...7%
Loading...9%
Loading...10%
by CodeChum Admin
Instructions:
Output
Multiple lines containing an integer.
1
8
64
343
512
.
.
.
by CodeChum Admin
Instructions:
Input
A line containing two integers separated by a space.
1 231214238
Output
A line containing a string.
Yes