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
| inventory = ["shoes, 12, 29.99", "shirts, 20, 9.99", "sweatpants, 25, 15.00", "scarves, 13, 7.75"] | |
| for temp in inventory: | |
| temp = temp.split(',') | |
| str1="The store has{} {}, each for{} USD." | |
| str1=str1.format(temp[1],temp[0],temp[2]) | |
| print(str1) |
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
| p_phrase = "was it a car or a cat I saw" | |
| r_phrase = p_phrase[::-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
| stopwords = ['to', 'a', 'for', 'by', 'an', 'am', 'the', 'so', 'it', 'and', 'The'] | |
| sent = "The water earth and air are vital" | |
| acro = "" | |
| lst = sent.split() | |
| for i in lst: | |
| if i in stopwords: | |
| lst.remove(i) | |
| for j in lst: |
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
| stopwords = ['to', 'a', 'for', 'by', 'an', 'am', 'the', 'so', 'it', 'and', "The"] | |
| org = "The organization for health, safety, and education" | |
| acro = "" | |
| lst = org.split() | |
| for i in lst: | |
| if i in stopwords: | |
| lst.remove(i) | |
| for j in lst: |
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
| scores = "67 80 90 78 93 20 79 89 96 97 92 88 79 68 58 90 98 100 79 74 83 88 80 86 85 70 90 100" | |
| lst = scores.split() | |
| a_scores = 0 | |
| for i in lst: | |
| if int(i) >= 90: | |
| a_scores += 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
| wrds = ["end", 'work', "play", "start", "walk", "look", "open", "rain", "learn", "clean"] | |
| lst = [] | |
| for i in wrds: | |
| i = i + "ed" | |
| lst.append(i) | |
| past_wrds = lst |
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
| ael = "python!" | |
| lst = [] | |
| for i in ael: | |
| lst.append(i) | |
| app = lst |
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 = "I love python" | |
| chars = [] | |
| for i in str1: | |
| chars.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
| winners = ['Alice Munro', 'Alvin E. Roth', 'Kazuo Ishiguro', 'Malala Yousafzai', 'Rainer Weiss', 'Youyou Tu'] | |
| winners.sort(reverse=True) | |
| z_winners = winners |
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', 'Melbourne'] | |
| trav_dest.append("Guadalajara") |