This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| winners = ['Kazuo Ishiguro', 'Rainer Weiss', 'Youyou Tu', 'Malala Yousafzai', 'Alice Munro', 'Alvin E. Roth'] | |
| winners.sort() |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| trav_dest = ['Beirut', 'Milan', 'Pittsburgh', 'Buenos Aires', 'Nairobi', 'Kathmandu', 'Osaka', 'London', 'Melbourne'] | |
| trav_dest.remove('London') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| s = "singing in the rain and playing in the rain are two entirely different situations but both can be fun" | |
| vowels = ['a','e','i','o','u'] | |
| count = 0 | |
| # Write your code here. | |
| for i in s: | |
| if i in vowels: | |
| count += 1 | |
| num_vowels = count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| sentence = "python is a high level general purpose programming language that can be applied to many different classes of problems." | |
| sen = sentence.split() | |
| count = 0 | |
| for i in sen: | |
| if 'a' in i or 'e' in i: | |
| count += 1 | |
| num_a_or_e = count | |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| items = ["whirring", "wow!", "calendar", "wry", "glass", "", "llama","tumultuous","owing"] | |
| count = 0 | |
| for i in items: | |
| if 'w' in i: | |
| count += 1 | |
| acc_num = count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| rainfall_mi = "1.65, 1.46, 2.05, 3.03, 3.35, 3.46, 2.83, 3.23, 3.5, 2.52, 2.8, 1.85" | |
| months = rainfall_mi.split(",") | |
| count = 0 | |
| for i in months: | |
| if float(i) > 3.0: | |
| count += 1 | |
| num_rainy_months = count |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| words = ["adopt", "bake", "beam", "confide", "grill", "plant", "time", "wave", "wish"] | |
| past_tense = [] | |
| for i in words: | |
| if(i[len(i)-1] == 'e'): | |
| i += 'd' | |
| else: | |
| i += 'ed' | |
| past_tense.append(i) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| words = ["water", "chair", "pen", "basket", "hi", "car"] | |
| num_words = 0 | |
| for i in words: | |
| if len(i) > 3: | |
| num_words += 1 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| percent_rain = [94.3, 45, 100, 78, 16, 5.3, 79, 86] | |
| resps = [] | |
| for i in percent_rain: | |
| if i > 90: | |
| resps.append("Bring an umbrella.") | |
| elif i >80: | |
| resps.append("Good for the flowers?") | |
| elif i > 50: | |
| resps.append("Watch out for clouds!") | |
| else: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| str1 = "Today you are you! That is truer than true! There is no one alive who is you-er than you!" | |
| if 'false' in str1: | |
| output = "False. You aren't you?" | |
| elif "true" in str1: | |
| output = "True! You are you!" | |
| else: | |
| output = "Neither true nor false" |