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
| 練習 3:建立一個由 tuple 組成的 list,例如 [(產品, 價格)],印出總價。\ | |
| product_list = [ | |
| (apple, 10), | |
| (banana, 5), | |
| (milk, 20) | |
| ] | |
| total = 0 |
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
| """phonebook = { | |
| "Alice": "123-456-7890", | |
| "Bob": "987-654-3210", | |
| "Charlie": "555-123-4567"} | |
| ask = input("Enter a name: ") | |
| if ask in phonebook: | |
| print(phonebook[ask]) | |
| else: | |
| print("can not find you name")""" |