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 python | |
import getpass # This module is imported only for the purpose of printing out your user | |
import re | |
from molmass import * | |
name = getpass.getuser() | |
print(f"Hello,{name}") # Prints current username | |
input = str(input("Please enter in chemical formula: ")) #assign string the chemical formula |
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 re | |
# Edit: I'll just put it all into a dictionary insteaad rather than creating one and appending every single one | |
# This took too long | |
elements = {'H': 1.00794, 'He': 4.002602, 'Li': 6.941, 'Be': 9.012182, 'B': 10.811, 'C': 12.0107, 'N': 14.0067, | |
'O': 15.9994, 'F': 18.9984032, 'Ne': 20.1797, 'Na': 22.98976928, 'Mg': 24.305, 'Al': 26.9815386, | |
'Si': 28.0855, 'P': 30.973762, 'S': 32.065, 'Cl': 35.453, 'Ar': 39.948, 'K': 39.0983, 'Ca': 40.078, | |
'Sc': 44.955912, 'Ti': 47.867, 'V': 50.9415, 'Cr': 51.9961, 'Mn': 54.938045, | |
'Fe': 55.845, 'Co': 58.933195, 'Ni': 58.6934, 'Cu': 63.546, 'Zn': 65.409, 'Ga': 69.723, 'Ge': 72.64, |
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 python | |
import sys, re, string, crypt | |
def mktripcode(pw): | |
pw = pw.decode('utf_8', 'ignore') \ | |
.encode('shift_jis', 'ignore') \ | |
.replace('"', '"') \ | |
.replace("'", '') \ | |
.replace('<', '<') \ | |
.replace('>', '>') \ | |
.replace(',', ',') |