i887h July 21, 2020 By Paul Browning 1. n = 5 x = 0 We need to print out multiples of n, how would we do this? while x < 11: print(str(n) + 'x' + str(x) + '=' + str(n*x)) x +=1 while x < 11: print(str(n) + 'x' + str(x) + '=' n*x) x +=1 while x < 11: print(n + ‘x’ + x + '=' n*x) x +=1 while x < 11: print(str(n) + 'x' + str(x) + '=' + str(n*x)) Question 1 of 10 2. z = 40 b = 7 t = “This will test your skills” r should equal 5, choose the correct statement r = t.find(“will”) if z > b else 9r = t.find("will") if z < b else 9r = t.find("will") if z > b else 5r = t.rfind(“will”) if z > b else 9Question 2 of 10 3. loan = [?] rate = 0 if loan > 0 and loan <= 50: rate = 0.05 elif loan > 50 and loan <= 500: rate = 0.1 elif loan > 500 and loan <= 1000: rate = 0.2 else: rate = 0.23 What value should loan be to get a rate of 0.2? 1001500501499Question 3 of 10 4. wlist = [‘dog’,’cat’,’rabbit’] x = 0 for word in wlist: for i in range(len(word)): x = x + 1 if x > 10: break What is the value of x? 0121113Question 4 of 10 5. Look at the following block of code, what can be replace ? with to print 0 thisset = (5,10,9,4,8,1) thisdict = {1:"C",2:"Python",3:"D",4:"Java",5:"BIC"} count = 0 for e in thisset: if e in thisdict: ? count += e print(count) continueexitpassbreakQuestion 5 of 10 6. You need to add some code to the beginning of this block so it would print “Needs Management Approval” if account.lower() == 'd': if invoice_amount > 100: print("Needs Management Approval") else: print("Approved") elif account.lower() == 'a': if invoice_amount >= 100 and invoice_amount <= 1000: print("Needs Director Approval") else: print("Approved") else: print("Please go to HR") account = “D” invoice_amount = 100 account = “A” invoice_amount = 1000 account = “B” invoice_amount = 1001 account = “D” invoice_amount = 101 Question 6 of 10 7. A user is shopping on your website and should receive a silver award if they acquire between 700 and 800 points, which code should you use? if 700 <= points <= 800: level = ‘silver’ if points <= 700 and points >= 800: level = ‘silver’ if points >= 700: level = ‘silver’ if points >= 700 or points >= 800: level = ‘silver’ Question 7 of 10 8. What day can we give the code block below to get an answer of 10? day = input('Please enter day of the week:') discount = 10 if day == "Monday": discount = 3 elif day == "Wednesday": discount = 7 elif day == "Friday": discount = 8 MondaySaturdayWednesdayFridayQuestion 8 of 10 9. ourstr = "####" for i in range(3): if i == 2: break ourstr += "#" print(ourstr) What is the value of ourstr in this example? ###############NoneQuestion 9 of 10 10. What is the value of X after this codeblock? y = 2 x = 0 while x * y < 10: if x == 3: pass while x < 2: x = x + 2 x +=1 04510Question 10 of 10 Loading...