Menu

Errors in algorithms - Code Quiz

1. The user enters 20 for the number of cakes and 0 for the number of people. What is output?

cakes = int(input('Enter number of cakes: ')) people = int(input('Enter number of people: ')) cakePerPerson = cakes / people print(cakePerPerson, 'cakes per person')
20.0 cakes per person
ZeroDivisionError: division by zero
0 cakes per person
0.0 cakes per person

2. Which line contains a syntax error?

01 print('Hello') 02 for i in range(3) 03 print(i) 04 print('Done')
Line 01
Line 02
Line 03
Line 04

Log in or sign-up to access the quiz



Don't have a login?

You can still revise this topic