HelpContactFor teachers and institutes
>_StemPy Lab
Mock TestsClasses

>_StemPy Lab

Learn. Solve. Code the solutions. Test yourself.

Live examsFree mock exams, timed and rankedEveryone starts together, and your score and rank come the moment it ends.See the exams →
Live examsInternational live exams are comingTell us which exam you want first. Timed practice papers are open now.See what is coming →

Learn

  • Physics
  • Chemistry
  • Mathematics
  • Biology
  • Python Programming
  • Statistics & Data Science
  • Computer Science
  • Space Science and Astronomy
  • Earth and Environmental Science
  • Classes
  • Groups

Practice

  • Problems
  • Quizzes
  • Mock Tests
  • Prepare for an Exam
  • Question Sets
  • Exams
  • Certificates
  • Python Labs
  • AI Practice Generator
  • Student-Created Tests

Community

  • Discussions
  • Resources
  • Notes
  • Glossary
  • Blog

Account

  • Log in
© 2026 senLearn. All rights reserved.HelpFor SchoolsAboutContactPrivacy PolicyTerms of UseRefund Policy
  1. Quizzes
  2. /A function sorts values by whether they count as true or false in an if test. What does the program print?
Python ProgrammingMediumHigh School (9–10)Python Basics › Conditionals: if, elif, elsePCEP (Python Institute)
StemPy LabCreated by StemPy Lab

A function sorts values by whether they count as true or false in an if test. def describe(x): if x: return "full" elif x == 0: return "zero" else: return "empty" print(describe([]), describe(0.0), describe(" "), describe(None)) What does the program print?

Log in to save
← All Quizzes
← A function should return the largest number of a list. For a list of negative numbers it gives the wrong answer: here it prints 0, not -2. Which changes make the program print -2? Choose every correct option.A program reads an operator and a number from the keyboard, and passes both to a function. The user types + on the first line and 3 on the second. What does the program print? →
More onPython Basics › Conditionals: if, elif, else

Discussion (0)

Log in to join the discussion.

Loading…

More questions on this topic

  1. A function decides with not, or and and in one condition, and has no brackets to show the order.…Hard
  2. Each number of a list should give one letter: A, B or C. The test in the if line is left out, and…Medium
  3. A program reads an operator and a number from the keyboard, and passes both to a function. The…Medium
  4. A function picks a word for a temperature with if, elif and a final return. What does the program…Easy
  5. A program checks a basket, which is a list, before it adds a fruit. What does the program print?Easy
All questions on this topic →

Problems on this topic

  1. Write a simpler condition, without a not in front of a bracket, that is the same as each of these…Medium
  2. At a club door the guard asks the age first…Medium
  3. This program should say a vowel only for the letters a, e, i, o and u…Medium
  4. The ticket price rules are: under 5 free, under 13 pays 50, under 60 pays 100, and the rest pay 70…Medium
All problems on this topic →