Question

In: Computer Science

Fill in the format strings so that the print() statements below display the indicated values vertically aligned

Use python

Fill in the format strings so that the print() statements below display the indicated values vertically aligned as Class | Exam Type | Grade ---------- | ---------- | ------------- ECC102 | Midterm | 78.12 ECC104 | Final | 82.45 ECC108 | Makeup | 98.00 ECC200 | Resit | 100.00 Note that the Class column is aligned LEFT, Exam Type column is aligned MIDDLE, and Grade column is also aligned LEFT. Note also that you need to use the vertical bar character | to separate the columns and just the right number of --- characters to separate the column headings from the values in the table.

Solutions

Expert Solution

exam = [['ECC102','Midterm','78.12'],['ECC104','Final','82.45'],['ECC108','Makeup','98.00'],['ECC200','Resit','100.00']];

str1 = 'Class';

str2 = 'Exam Type';

str3 = 'Grade';

empty = '';

print(str1.ljust(10),'|',str2.center(10),'|',str3.ljust(10));

print(empty.center(10,'-'),'|',empty.center(10,'-'),'|',empty.center(10,'-'));

for i in range(len(exam)):

print(exam[i][0].ljust(10),'|',exam[i][1].center(10),'|',exam[i][2].ljust(10));

Output: (Script on the left, output on the right)


Related Solutions

Print out screenshot(s) that show the result of setting the prompt to different values as indicated....
Print out screenshot(s) that show the result of setting the prompt to different values as indicated. Remember that you can change the prompt to include the result of a UNIX command if you include the command name in backquotes. To get credit for each step, you must have the screenshot show the command you used to set the prompt and that it worked as intended. Set the prompt to the UNIX server’s name and an arrow by using the hostname...
VIII. a. Fill in the appropriate numerical values in the table below for the surplus or...
VIII. a. Fill in the appropriate numerical values in the table below for the surplus or shortage of baseball caps in the fourth column and the effect on price in the fifth column. Market Demand and Supply Schedules for Baseball Caps Price ($ per cap) Quantity demand-ed (caps per week) Quantity supplied (caps per week) Surplus (+) or Shortage (-) Effect on Price (up or down) $25 8000 14000 $20 9000 12000 $15 10000 10000 $10 11000 8000 $5 12000...
import math print("RSA ENCRYPTION/DECRYPTION") print("*****************************************************") #Input Prime Numbers print("PLEASE ENTER THE 'p' AND 'q' VALUES BELOW:")...
import math print("RSA ENCRYPTION/DECRYPTION") print("*****************************************************") #Input Prime Numbers print("PLEASE ENTER THE 'p' AND 'q' VALUES BELOW:") p = int(input("Enter a prime number for p: ")) q = int(input("Enter a prime number for q: ")) print("*****************************************************") #Check if Input's are Prime '''THIS FUNCTION AND THE CODE IMMEDIATELY BELOW THE FUNCTION CHECKS WHETHER THE INPUTS ARE PRIME OR NOT.''' def prime_check(a): if(a==2): return True elif((a<2) or ((a%2)==0)): return False elif(a>2): for i in range(2,a): if not(a%i): return false return True check_p =...
In this exercise, find the values of the unknown constants so that the indicated conditions are met for each function:
In this exercise, find the values of the unknown constants so that the indicated conditions are met for each function: (a) f(t) = At2 + B; given f(0) = 2 and f(−2) = −10. (b) f(t) = Ct3 + D; given f(0) = −5 and f(3) = 49. (c) f(t) = A t 2 + B , given f(0) = 3 and f(−2) = 1.5 (d) f(t) = A t + B , given f(2) = 0.4 and f(8) =...
Fill in the missing values in the table below given that , dy/dt = 0.8y -...
Fill in the missing values in the table below given that , dy/dt = 0.8y - 2 . t 0 1 2 3 4 y 8 ?? ?? ?? ??
Question 9: pi = 3.14159 formatted = _______.format(pi) print("Pi day sale! All pies", formatted, "off.") Fill...
Question 9: pi = 3.14159 formatted = _______.format(pi) print("Pi day sale! All pies", formatted, "off.") Fill in the blank so that the following program prints: Pi day sale! All pies $3.14 off. Question 11: Complete the following program that keeps asking for a price until the user just presses the enter key. Assume the user only enters floating point values. The program totals the values entered by the user and print out the result. total = 0 while True: ans...
Use the mechanism below to fill in the blanks in the statements. Step 1 A +...
Use the mechanism below to fill in the blanks in the statements. Step 1 A + B → C Step 2 C + D → B + E Substance is a catalyst in this mechanism Substance is an intermediate in this mechanism
Given the values of So given below in J/mol K and the values of ΔHfo given...
Given the values of So given below in J/mol K and the values of ΔHfo given in kJ/mol, calculate the value of ΔGo in kJ for the combustion of 1 mole of propane to form carbon dioxide and gaseous water at 298 K. S (C3H8(g)) = 274 S (O2(g)) = 209 S (CO2(g)) = 216 S (H2O(g)) = 181 ΔHfo (C3H8(g)) = -105 ΔHfo (CO2(g)) = -394 ΔHfo (H2O(g)) = -225
For each of the statements given below, indicated “True” or “False”. (a) The address issued by...
For each of the statements given below, indicated “True” or “False”. (a) The address issued by the processor is the address of a location in the cache. (b) The main memory is larger than the cache. (c) All data and instructions stored in secondary memory are also stored in main memory. (d) The cache has a shorter access time than main memory. (e) Main memory is typically constructed using DRAM technology. explain why
Fill in the table below so that it lists every reagent needed for a PCR reaction...
Fill in the table below so that it lists every reagent needed for a PCR reaction and give its purpose in the reaction. You may or may not need all the rows in this table. Reagent Purpose 5X Taq Buffer F and R primers Supplies co-factor for polymerase Building blocks for new DNA Water
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT