Learning Circle : python #8 - ex37, ex38
This commit is contained in:
parent
a13a1295a1
commit
aaf9f5b1dc
4 changed files with 44 additions and 1 deletions
|
@ -1,6 +1,14 @@
|
|||
* 2020-06-08
|
||||
*** Python #7:
|
||||
**** TODO Lecture content
|
||||
- Same structure as "Python #2"
|
||||
- Exercises 37-39
|
||||
**** Lecture material
|
||||
- Available on https://cloud.ungleich.ch/s/435FyfrQyEq6oF3
|
||||
* 2020-06-01
|
||||
*** Python applying learnings from 1..6
|
||||
**** Lecture notes
|
||||
**** DONE Lecture notes
|
||||
CLOSED: [2020-06-02 화 11:21]
|
||||
- Previous topics covered:
|
||||
- Printing
|
||||
- Formatting
|
||||
|
|
23
youngjin.han/python-the-hard-way/ex38.py
Normal file
23
youngjin.han/python-the-hard-way/ex38.py
Normal file
|
@ -0,0 +1,23 @@
|
|||
ten_things = "Apples Oranges Crows Telephone Light Sugar"
|
||||
|
||||
print("Wait there are not 10 things in that list. Let's fix that.")
|
||||
|
||||
stuff = ten_things.split(' ')
|
||||
more_stuff = ["Day", "Night", "Song", "Frisbee",
|
||||
"Corn", "Banana", "Girl", "Boy"]
|
||||
|
||||
while len(stuff) != 10:
|
||||
next_one = more_stuff.pop()
|
||||
print("Adding: ", next_one)
|
||||
stuff.append(next_one)
|
||||
print(f"There are {len(stuff)} items now.")
|
||||
|
||||
print("There we go: ", stuff)
|
||||
|
||||
print("Let's do some things with stuff.")
|
||||
|
||||
print(stuff[1])
|
||||
print(stuff[-1]) # whoa! fancy
|
||||
print(stuff.pop())
|
||||
print(' '.join(stuff)) # what? cool!
|
||||
print('#'.join(stuff[3:5])) # super stellar!
|
1
youngjin.han/python-the-hard-way/result.txt
Normal file
1
youngjin.han/python-the-hard-way/result.txt
Normal file
|
@ -0,0 +1 @@
|
|||
input error : input string = ['1', 'q']
|
|
@ -1,4 +1,15 @@
|
|||
* 2020-06-08
|
||||
** note
|
||||
- ex37.py
|
||||
- none
|
||||
- ex38.py
|
||||
- ten_things.split(' ') == split(ten_things, ' ')
|
||||
- more_stuff.pop() == pop(more_stuff)
|
||||
- stuff.append(next_one) == append(stuff, next_one)
|
||||
- ex39.py
|
||||
-
|
||||
* 2020-05-29
|
||||
** note
|
||||
- ex32.py
|
||||
- remove, insert, index, append, '+' and del
|
||||
- ex33.py
|
||||
|
|
Loading…
Reference in a new issue