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
x = "This is the string assigned to variable 'x'." | |
print (x) | |
print (x) | |
print (x) |
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
x = 3 | |
y = 4 | |
print (x + y) | |
print (x - y) | |
print (x * y) | |
print (x ** y) | |
print (x/y) |
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
x = 3 | |
y = "4" | |
z = 3.14 | |
float(x) | |
int(y) | |
str(z) |
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
# This is a comment | |
'''This is also a comment''' | |
print ("comments are fun") # but you can't print this | |
# this comment is used for a single line | |
""" | |
but this | |
comment blocks |
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
# This is a sample for loop. | |
for i in range (0,11): | |
# Each iteration prints "i = " followed by whatever i is equal to. | |
print ("i = " + str(i)) | |
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
The Zen of Python, by Tim Peters | |
Beautiful is better than ugly. | |
Explicit is better than implicit. | |
Simple is better than complex. | |
Complex is better than complicated. | |
Flat is better than nested. | |
Sparse is better than dense. | |
Readability counts. | |
Special cases aren't special enough to break the rules. |
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
# chopping up national pokedex into each region with a bash script | |
echo "Chopping Kanto" | |
cat National\ Pokedex\ Gen\ 6\ V5.15.1.1\ -\ Pokedex.csv | head -n 1 > header | |
cat National\ Pokedex\ Gen\ 6\ V5.15.1.1\ -\ Pokedex.csv | head -n 152 > kantodex.csv | |
sleep 1 | |
echo "Chopping Johto" | |
cat header > johtodex.csv | |
cat National\ Pokedex\ Gen\ 6\ V5.15.1.1\ -\ Pokedex.csv | tail -n 688 | head -n 100 >> johtodex.csv |
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
import pandas as pd | |
import sys | |
''' | |
usage: | |
python combine_csv.py <1.csv> <2.csv> ... <n.csv> | |
will write the final output to standard output | |
can be written to a new file with: |
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
# usage: | |
# python sys_argv_demo.py <what> <ever> <you> <want> | |
import sys | |
for i in sys.argv: | |
print(i) |
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/env python3 | |
''' | |
Usage: | |
analyze_pic [image] [mode] | |
modes: | |
0 : grayscale | |
1 : color |
OlderNewer