This file contains hidden or 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 sys | |
| import inspect | |
| import textwrap | |
| from collections import OrderedDict, UserString | |
| from PyQt5 import QtCore, QtGui | |
| from PyQt5.QtCore import Qt | |
| from PyQt5.QtGui import QIcon | |
| from PyQt5.QtWidgets import * | |
This file contains hidden or 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 datetime | |
| A1=datetime.datetime.strptime("21/10/2022", "%d/%m/%Y") | |
| A2=datetime.datetime.strptime("29/01/2023", "%d/%m/%Y") | |
| count=0 | |
| week="Fri" | |
| for i in range ((A2-A1).days): #gives the no of days from A1 to A2 | |
| if A1.strftime("%a")==week: | |
| count+=1 | |
| A1+=datetime.timedelta(days=1) |
This file contains hidden or 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
| mathar.exe 1>errors.txt 2>&1 |
This file contains hidden or 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 random | |
| dividend_length = 3 | |
| divsior_length = 1 | |
| integer_results = 0 | |
| short_float = 1 | |
| pop = 20 | |
| _c, res = 0, [] | |
| while len(res)<pop and _c<5000: |
This file contains hidden or 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 | |
| file1 = pd.read_csv('./n/oregonhie_descriptive_vars.csv') | |
| file2 = pd.read_csv('./n/oregonhie_inperson_vars.csv') | |
| file2['treatment'] = file2['person_id'] | |
| def proccess(key): | |
| a = file1.loc[file1['person_id'] == key, 'treatment'].iloc[0] |
This file contains hidden or 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 configparser | |
| class Config: | |
| FILENAME = 'CONFIG.INI' | |
| def __init__(self): | |
| self.config = configparser.ConfigParser() | |
| self.read() |
This file contains hidden or 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
| app.exe 1>output.txt 2>&1 |
This file contains hidden or 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
| from hashlib import md5 | |
| from uuid import getnode | |
| print ( str(md5(hex(getnode()).encode('utf-8')).hexdigest()) ) |
This file contains hidden or 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
| change = lambda t, r=[], coins={5,3,2,1}: r if t==0 else change(*(lambda g: (t-g, r+[g]))(t-min(t-i for i in coins-{sum(r)+t} if t-i>=0))) | |
| print(change(999)) | |
| #better attempt | |
| change = lambda x,y=[]: y if x<=0 else change(*(lambda series: (x-[i for i in series if x>=i][0], y+[[i for i in series if x>=i][0]]))([200, 100, 50, 20, 10, 5, 1])) | |
| #with roman encode method | |
| solution = lambda x,y="": y if x<=0 else solution(*(lambda series: (x-[i for i in series if x>=i][0], y+{1000:"M", 500:"D", 100:"C", 50:"L", 10:"X", 5:"V", 1:"I"}[[i for i in series if x>=i][0]]))([1000, 500, 100, 50, 10, 5, 1])) |
NewerOlder