- Problem
y = [0,1,2,3,4,5,6,7,8,9]
squares = []
for i in y:
squares.append(i**2)
print squares
- Formula: [
expression-involving-loop-variable
forloop-variable
insequence
]
# any images you use later, add them here first to create aliases | |
# I like keeping all my versions at the top | |
FROM node:14.3-slim as node | |
FROM php:7.2.1-fpm-slim as php | |
FROM nginx:1.17 as nginx | |
# The real base image to start from | |
FROM ubuntu:focal-20210827 as base | |
# install apt stuff |
import asyncio | |
loop = asyncio.get_event_loop() | |
async def hello(): | |
await asyncio.sleep(3) | |
print('Hello!') | |
if __name__ == '__main__': | |
loop.run_until_complete(hello()) | |
sudo apt-get install -y make build-essential libssl-dev zlib1g-dev \ libbz2-dev libreadline-dev libsqlite3-dev wget curl llvm libncurses5-dev \ libncursesw5-dev xz-utils tk-dev libffi-dev liblzma-dev python-openssl
curl https://pyenv.run | bash
~/.bashrc
export PYENV_ROOT="$HOME/.pyenv"
pip install pipenv
hello
where you are going to create your python project.cd hello
pipenv --python 3.7
(Specify which version of python you need)pipenv shell
. This case pipenv will use whatever default virtualenv finds.This will create Pipfile and Pipfile.lock
pipenv install numpy
import requests # importing libraries for working with HTTP requests | |
import json | |
api_url_base = 'https://api.github.com/' # string that starts off every URL in the GitHub API | |
#response = requests.get(api_url_base) | |
#print(response.headers) | |
headers = {'Content-Type': 'application/json', | |
'Accept': 'application/vnd.github.v3+json' | |
} |