e-learning

Python - Lists & Strings & Dictionaries

Abstract

Doing calculations with hundreds of variables called pressure_001, pressure_002, etc. would be at least as slow as doing them by hand. Using a list to store many values together solves that problems. Lists are surrounded by square brackets: [, ], with values separated by commas:

About This Material

This is a Hands-on Tutorial from the GTN which is usable either for individual self-study, or as a teaching material in a classroom.

Questions this will address

  • How can I store multiple values?

Learning Objectives

  • Explain why programs need collections of values.
  • Write programs that create flat lists, index them, slice them, and modify them through assignment and method calls.

Licence: Creative Commons Attribution 4.0 International

Keywords: Foundations of Data Science, jupyter-notebook

Target audience: Students

Resource type: e-learning

Version: 6

Status: Active

Learning objectives:

  • Explain why programs need collections of values.
  • Write programs that create flat lists, index them, slice them, and modify them through assignment and method calls.

Date modified: 2024-06-25

Date published: 2022-04-25

Authors: Bazante Sanders, Donny Vrins, Helena Rasche, The Carpentries

Contributors: Bazante Sanders, Donny Vrins, Helena Rasche, The Carpentries

Scientific topics: Software engineering


Activity log