8000 tuples · cmdncode/Intro-Python-I@006e7d9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 006e7d9

Browse files
committed
tuples
1 parent 9cb2001 commit 006e7d9

File tree

2 files changed

+6
-2
lines changed

2 files changed

+6
-2
lines changed

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ The suggested order for going through each of the directories is:
7878
* -`datatypes` -- Experiment with type conversion
7979
* -`modules` -- Learn to import from modules
8080
* -`printing` -- Formatted print output
81-
* `lists` -- Python's version of arrays
81+
* -`lists` -- Python's version of arrays
8282
* `tuples` -- Immutable lists typically for heterogenous data
8383
* `slices` -- Accessing parts of lists
8484
* `comprehensions` -- List comprehensions

src/tuples.py

Lines changed: 5 additions & 1 deletion
< 44E6 td data-grid-cell-id="diff-5e3839155c4697bae3f3b345e6d81cdcf0a1939007816c20883fc909d51cce97-43-45-2" data-line-anchor="diff-5e3839155c4697bae3f3b345e6d81cdcf0a1939007816c20883fc909d51cce97L43" data-selected="false" role="gridcell" style="background-color:var(--diffBlob-deletionLine-bgColor, var(--diffBlob-deletion-bgColor-line));padding-right:24px" tabindex="-1" valign="top" class="focusable-grid-cell diff-text-cell left-side-diff-cell border-right left-side">-
u = (1) # What needs to be added to make this work?
Original file line numberDiff line numberDiff line change
@@ -35,10 +35,14 @@ def dist(a, b):
3535
# Write a function `print_tuple` that prints all the values in a tuple
3636

3737
# YOUR CODE HERE
38+
def print_tuple(t):
39+
for i in t:
40+
print(i)
3841

3942
t = (1, 2, 5, 7, 99)
4043
print_tuple(t) # Prints 1 2 5 7 99, one per line
4144

4245
# Declare a tuple of 1 element then print it
43
46+
47+
u = (1,) # What needs to be added to make this work?
4448
print_tuple(u)

0 commit comments

Comments
 (0)
0