diff --git a/Assignment_Week_2.py b/Assignment_Week_2.py new file mode 100644 index 0000000..a1f0920 --- /dev/null +++ b/Assignment_Week_2.py @@ -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) \ No newline at end of file diff --git a/README.md b/README.md index 3b3296f..fad6191 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,9 @@ -# Week_2_Assignment - +# Week 2 Assignment +## Homework + - Write short python codes that modify lists using the functions/ methods mentioned in today’s 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