Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

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.

1. Broken Record

Instructions:

  1. Input a positive integer.
  2. Using while() loop, repeatedly print out the message "CodeChum is awesome" for the same number of times as that of the inputted integer. Each outputted message must be separated in new lines.
  3. Don't forget to make an increment/decrement variable that will increase its value per iteration so as to not encounter a forever loop and have errors, okay?

Instructions

  1. Make a variable and assign it to an input() function that will accept a positive integer.
  2. Using while() loop, repeatedly print out "CodeChum is awesome" for the same number of times as that of the inputted integer. Each outputted string must be separated in new lines.
  3. Don't forget to make an increment variable that will increase its value per iteration so as to not encounter a forever loop and have errors, okay?

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





4. Loading…

by CodeChum Admin



Instructions:

  1. Input two integers in one line. The first inputted integer will be the starting point, and the second one shall serve as the ending point.
  2. Create two variables and assign them to an input() function. The first variable will accept the starting integer and the second one will accept the ending integer of the range.
  3. Use the power of loops to loop through the starting point until the ending point (inclusive), and print out each number within the range with the corresponding format shown on the sample output.
  4. However, skip the printing of statement if the integer is divisible by 4.
  5. Tip: Utilize the continue keyword to complete the process.



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%

3. Not my Favorites

by CodeChum Admin



Instructions:

  1. Print out the cube values of the numbers ranging from 1 to 1000 (inclusive). However, if the number is divisible by either 3 or 5, do not include them in printing and proceed with the next numbers.
  2. Tip: When skipping through special values, make use of the keyword continue and put them inside a conditional statement.



Output

Multiple lines containing an integer.

1
8
64
343
512
.
.
.

2. Found Ya!

by CodeChum Admin



Instructions:

  1. Input two integers in one single line. The first inputted integer must be within 0-9 only.
  2. Using loops, identify if the first inputted integer (0-9) is present in the second inputted integer. If it is found, print "Yes". Otherwise, print "No".
  3. Tip : If the number is already found even without reaching the end of the loop, use the break keyword to exit the loop early for a more efficient code.

Input

A line containing two integers separated by a space.

1 231214238

Output

A line containing a string.

Yes




LATEST TUTORIALS
APPROVED BY CLIENTS