How Do You Use Nomics to a Retrieve Cryptocurrency Prices?

Problem scenario
You want to use Nomics to retrieve cryptocurrency prices. What do you do?

Prerequisite
Get an API key. It is free here: https://p.nomics.com/pricing#free-plan
(You do not need to provided credit card information to obtain one.)

Procedures
Run this Python program but replace YOUR_KEY_HERE with the key:

import requests
resp = requests.get(“https://api.nomics.com/v1/prices?key=YOUR_KEY_HERE&format=json”)
for item in resp.json():
if item[’currency’] in [”BTC”, …

How Do You Retrieve Cryptocurrency Data for One Day in the Past Using Python?

Problem scenario
You want to find the historic data for a given cryptocurrency using Python. You want to print out the low, high, open and close prices on a specific day. How do you get data for one specific date?

Solution

Prerequisite
This assumes you have installed pandas: pip install pandas

Procedures
Run this program:

“””
Usage instructions: Change the “2016-12-25” the value (assigned to “date_to_see”) to the day you want to view. …

How Do You Print the Current Price of Bitcoin with Python without Installing New Packages?

Problem scenario
You do not want to install new Python modules. How do you use Python to print out the latest price of Bitcoin?

Solution
Run this program:

import requests
resp = requests.get(“https://api.coindesk.com/v1/bpi/currentprice/USD.json”)
print(resp.json()[’bpi’])

Here is a modified version of the program:

import requests
resp = requests.get(“https://api.coindesk.com/v1/bpi/currentprice/USD.json”)
print(resp.json()[’bpi’][’USD’][’rate’])

If you want to receive free cryptocurrency by just learning more,

What is the Difference between global and nonlocal in Python?

Question
It seems like “global” and “nonlocal” would be the same thing. How are these keywords different in Python?

Answer
Variables inside a function are local by default; variables outside of functions are global by default. (This was taken from https://www.programiz.com/python-programming/global-keyword.) This answer/article addresses the “LEGB lexical scoping rule” (taken from page 872 of Learning Python).

What is Memoization?

Question
In computer programming, what is memoization?

Answer
Memoization is the act of pre-computing or pre-processing certain values for the sake of an algorithm’s performance. Rather than perform the same exact operation (which could be very complex and computationally expensive) multiple times, memoization will involve writing code to compute it once and store it in memory as a variable. This optimization can allow the call stack to have less to store (e.g.,

What Does a Colon Mean in Python when You See Something Like This “new_var = a[i:i + counter]”?

Question
You are not familiar with this example of a colon. It appears to be an assignment of a value to itself. You have seen Python function signatures with colons to explain the data type. You have seen colons to signify an if conditional or a for loop. You are not sure what this line of code does:

new_var = a[i:i + counter]

What does this type of colon syntax mean?

How Do You Use Python to Find The Latest Prices of Bitcoin, Ethereum, Litecoin and Ripple?

Problem scenario
You want to use Python to calculate the latest price of various cryptocurrencies. What should you do?

Solution
Prerequisite

This assumes you have installed pip.

Procedures
Install the Python package cryptocompare: pip install cryptocompare

Run this program:

import cryptocompare

print(cryptocompare.get_price(‘BTC’, ‘USD’))
print(cryptocompare.get_price(‘BTC’, ‘USD’))
print(cryptocompare.get_price(‘ETH’, ‘USD’))
print(cryptocompare.get_price(‘LTC’, ‘USD’))
print(cryptocompare.get_price(‘XRP’, …

How Do You Find out if UAC is Enabled on Your Windows Computer?

Problem scenario
You are using either Windows Server 2019 or Windows 10. You want to know if UAC is enabled or not. What should you do?

Solution
Open PowerShell. Run this:

If((Get-ItemProperty HKLM:\SOFTWARE\Microsoft\Windows\CurrentVersion\Policies\System).EnableLUA -eq 1) { echo “UAC is enabled”} Else {echo “UAC is NOT enabled”}