did assignment

This commit is contained in:
paul-loedige 2022-10-18 23:28:13 +09:00
parent 3d50af71e8
commit f40f2327e1
2 changed files with 36 additions and 2 deletions

27
Assignment_Week_2.py Normal file
View File

@ -0,0 +1,27 @@
"""
author: Paul Lödige (ploedige@g.ecc.u-tokyo.ac.jp)
"""
string = "this is a test string"
# loop through every letter of the string and print it if it comes after "m"
for letter in string:
if letter.upper() > 'M':
print(letter)
# split the string into a list of words
words = string.split()
print (words)
# copy the list of words and replace and manipulate one of them
words2 = words.copy()
print (words)
words.reverse()
print (words)
words.sort()
print(words)
print(words2)
# add items to the words list
words.append("more tests")
print(words)

View File

@ -1,2 +1,9 @@
# Week_2_Assignment
# Week 2 Assignment
## Homework
- Write short python codes that modify lists using the functions/ methods mentioned in todays lecture
- Anything is okay
- Create list, add items, remove items, sort items, list copy, etc.
- Take screenshots of the code and the printed result
- Put them inside a single-page PDF.
- Upload into ITC-LMS
- A submission link will be created