This file contains 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
#That is a manipulation list. | |
# Press Shift+F10 to execute it or replace it with your code. | |
# Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. | |
# I'm creating a stock tickers list here | |
stock_tickers = ["AMZN", "CSCO", "FB", "GOOG", "INTC", "MSFT", "SQ", "TWTR", "WRK"] | |
print(stock_tickers) | |
#Updating the ticker 'WRK' to 'WORK'. Printing stock_tickers to confirm my code. |
This file contains 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
#For the past week, you've been watching your coworker Harold use a calculator to manually track stock price fluctuations. Harold spends three hours every day tracking his stocks this way, logging the stock's original price (from the day before), the current price, and the percentage of increase or decrease. You know that automating this calculation would streamline Harold's daily process, leaving more time for making investment decisions. Your new Python skills can help you achieve this for him. | |
#In this activity, create a Python program to automate Harold's process by programmatically implementing the percent increase calculation. | |
#Start small by identifying the percent increase in price for Apple stock. Yesterday at 9:00 a.m., Apple's stock price was $198.87. At close of market today, the stock price was $254.32. Calculate the percent increase using the following formulas: | |
#Increase = Current Price - Original Price | |
#Percent Increase = Increase / Original x 100 | |
original_price=198.87 | |
print(original_price) |
This file contains 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
# Data | |
energy_data = [ | |
("Total", 96.9), | |
("Petroleum", 34.78), | |
("Natural gas", 26.59), | |
("Coal", 17.99), | |
("Nuclear", 8.33), | |
("Biofuels", 3.89), | |
("Hydroelectric", 2.47), | |
("Wind", 1.73), |
This file contains 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
# Data | |
beer_data = [ | |
("Australia", 109.9), | |
("Austria", 108.3), | |
("Belgium", 93.0), | |
("Croatia", 81.2), | |
("Czech Republic", 156.9), | |
("Denmark", 89.9), | |
("Estonia", 104.0), | |
("Finland", 85.0), |