Notice: This page requires JavaScript to function properly.
Please enable JavaScript in your browser settings or update your browser.
Challenge | Other Data Types
Introduction to Python Video Course
course content

Course Content

Introduction to Python Video Course

Introduction to Python Video Course

1. Getting Started
2. Variables and Types
3. Conditional Statements
4. Other Data Types
5. Loops
6. Functions

Challenge

Your grocery store's system is designed to track the inventory of items on different shelves using tuples, as tuples provide a way to ensure the data is immutable once set.

However, the store needs to monitor certain items and track their quantities or positions to assist in restocking or rearranging.

You are tasked with analyzing and managing inventory data using tuples to determine certain metrics and take actions based on specific criteria.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 4. Chapter 6
toggle bottom row

Challenge

Your grocery store's system is designed to track the inventory of items on different shelves using tuples, as tuples provide a way to ensure the data is immutable once set.

However, the store needs to monitor certain items and track their quantities or positions to assist in restocking or rearranging.

You are tasked with analyzing and managing inventory data using tuples to determine certain metrics and take actions based on specific criteria.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Section 4. Chapter 6
toggle bottom row

Challenge

Your grocery store's system is designed to track the inventory of items on different shelves using tuples, as tuples provide a way to ensure the data is immutable once set.

However, the store needs to monitor certain items and track their quantities or positions to assist in restocking or rearranging.

You are tasked with analyzing and managing inventory data using tuples to determine certain metrics and take actions based on specific criteria.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Switch to desktop for real-world practiceContinue from where you are using one of the options below

Everything was clear?

Your grocery store's system is designed to track the inventory of items on different shelves using tuples, as tuples provide a way to ensure the data is immutable once set.

However, the store needs to monitor certain items and track their quantities or positions to assist in restocking or rearranging.

You are tasked with analyzing and managing inventory data using tuples to determine certain metrics and take actions based on specific criteria.

Task

  1. Count the number of times "apples" appears on the shelf and print the result.
  2. Find the index of the first occurrence of "bananas" on the shelf and print it.
  3. If the number of apples is less than 5, print a message indicating that apples need to be restocked. If there are enough apples, print a message saying no restocking is needed.
  4. If "grapes" appear only once on the shelf, print a message that grapes need to be restocked. Otherwise, no action is needed for grapes.
  5. Find out if "oranges" exist on the shelf. If they do, print their index. If they don't, print that oranges are out of stock.

Note

You can also use the in and not in operators with both tuples and lists.

Switch to desktop for real-world practiceContinue from where you are using one of the options below
Section 4. Chapter 6
Switch to desktop for real-world practiceContinue from where you are using one of the options below
We're sorry to hear that something went wrong. What happened?
some-alt