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 list holds three objects, each with a name and a quantity. Which of these expressions give the list ['ink', 'cap']? Choose every correct option.
Python ProgrammingHardHigh School (11–12)Python Basics › FunctionsClass 12 BoardPCAP (Python Institute)
+3 more exams
APA-LevelIB
APA-LevelIBPCAP (Python Institute)
StemPy LabCreated by StemPy Lab

A list holds three objects, each with a name and a quantity. class Item: def __init__(self, name, qty): self.name = name self.qty = qty stock = [Item("pen", 0), Item("ink", 4), Item("cap", 2)] Which of these expressions give the list ['ink', 'cap']? Choose every correct option.

One or more options are correct. Tick all the correct ones: a wrong option costs marks, and a part-right answer earns part of the marks.

Log in to save
← All Quizzes
← A class adds lines to a text file, and reads the file back. The folder has no file log.txt at the start. What does the program print?A program asks the platform module which version of Python is running. It prints nothing. Which expressions are True after this code, on any computer? Choose every correct option. →
More onPython Basics › Functions

Discussion (0)

Log in to join the discussion.

Loading…

More questions on this topic

  1. Two functions share a global variable. The first call is made before the variable exists, inside a…Hard
  2. The def of price uses the name rate, which gets its first value only on a later line. Between two…Medium
  3. A function uses a local variable named sum, the same name as a built-in function. After the call…Medium
  4. A program calls a function on its first line. The def statement of that function comes after the…Easy
  5. Two short functions are defined. One gives back a slice, and the other adds an item to a list.…Medium
All questions on this topic →

Problems on this topic

  1. A function ticket_price(age) gives the price of a museum ticket: under 5 is free (0), under 13 pays…Medium
  2. Same name, two variablesMedium
  3. This program should show The total is 50. It stops with an error. Find the fault and fix it.Medium
  4. Which of these four programs shows something? Say it before you run each one.Easy
All problems on this topic →