Created
August 8, 2017 23:33
-
-
Save LinuxPhreak/2c6ec47949a18d252478a3b11afcc9db to your computer and use it in GitHub Desktop.
Trying To Create Arguments
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
#!/usr/bin/python | |
import argparse, urllib, json | |
__author__ = 'Ben P. Dorsi-Todaro' | |
print "What Currency Are You Using? " | |
currency = raw_input(" Type list for currencies ") | |
#I would like to make list an argument so when the user types crypto-info.py -l or --list a list shows up | |
if currency == "list": | |
print "List of all crypto currencies symbols. " | |
print "btc = Bitcoin" | |
print "ltc = Litecoin" | |
elif currency == "btc": | |
print "You picked Bitcoin" | |
btcCheck = raw_input("What do you want to know about Bitcoin? ") | |
if btcCheck == "price": | |
url = "https://api.coinmarketcap.com/v1/ticker/bitcoin/" | |
response = urllib.urlopen(url) | |
data = json.loads(response.read()) | |
for item in data: | |
name = item.get("0") | |
btcPrice = item.get("price_usd") | |
print "The current price of Bitcoin is $" + btcPrice | |
elif currency == "ltc": | |
print "You Said Litecoin" | |
btcCheck = raw_input("What do you want to know about Litecoin? ") | |
if btcCheck == "price": | |
url = "https://api.coinmarketcap.com/v1/ticker/litecoin/" | |
response = urllib.urlopen(url) | |
data = json.loads(response.read()) | |
for item in data: | |
name = item.get("0") | |
ltcPrice = item.get("price_usd") | |
print "The current price of Litecoin is $" + ltcPrice |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment