runtime
132 / 500
question 132 Built-ins & Sorting · easy

A form that submits too early

A checkout form should only be submitted when every field has been filled in. Support reports orders arriving with no address. form_complete lets the form through as soon as one field has something in it. Fix it. A field that holds only spaces counts as empty.

Functionform_complete(fields)
fieldsa dictionary from field name to the text typed into it
ReturnsTrue only when every value has something other than spaces in it
Keepthe function name and that it returns True or False
Examples
callform_complete({'name': 'Nora Garcia', 'email': 'nora@fastmail.com', 'address': ' '})returnsFalse
callform_complete({'name': 'Jamal Walker', 'email': 'jamal.walker62@icloud.com', 'address': '12 Elm St'})returnsTrue
callform_complete({'name': '', 'email': '', 'address': ''})returnsFalse

Loading your progress…

A form that submits too early — Python practice · Runtime