{ "cells": [ { "cell_type": "code", "execution_count": 1, "id": "adbd0287", "metadata": {}, "outputs": [], "source": [ "players = [('Alpha', 'M', 2001),\n", " ('Betty', 'F', 2000),\n", " ('Chris', 'M', 2001)]" ] }, { "cell_type": "code", "execution_count": 2, "id": "e554c7ef", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "('Alpha', 'M', 2001)" ] }, "execution_count": 2, "metadata": {}, "output_type": "execute_result" } ], "source": [ "players[0]" ] }, { "cell_type": "code", "execution_count": 9, "id": "d4c4e026", "metadata": {}, "outputs": [], "source": [ "Names = []\n", "Gender = []\n", "Year = []\n", "for n, g, y in players:\n", " Names.append(n)\n", " Gender.append(g)\n", " Year.append(y)" ] }, { "cell_type": "code", "execution_count": 10, "id": "3cc4c68a", "metadata": {}, "outputs": [ { "data": { "text/plain": [ "['Alpha', 'Betty', 'Chris']" ] }, "execution_count": 10, "metadata": {}, "output_type": "execute_result" } ], "source": [ "Names" ] }, { "cell_type": "code", "execution_count": 11, "id": "9199e3de", "metadata": {}, "outputs": [ { "name": "stdout", "output_type": "stream", "text": [ "Alpha\n", "Betty\n", "Chris\n" ] } ], "source": [ "for n, g, y in players:\n", " print(n)" ] }, { "cell_type": "code", "execution_count": null, "id": "8439347c", "metadata": {}, "outputs": [], "source": [] } ], "metadata": { "kernelspec": { "display_name": "Python 3 (ipykernel)", "language": "python", "name": "python3" }, "language_info": { "codemirror_mode": { "name": "ipython", "version": 3 }, "file_extension": ".py", "mimetype": "text/x-python", "name": "python", "nbconvert_exporter": "python", "pygments_lexer": "ipython3", "version": "3.9.12" } }, "nbformat": 4, "nbformat_minor": 5 }