blob_id
large_string
repo_name
large_string
path
large_string
src_encoding
large_string
length_bytes
int64
score
float64
int_score
int64
detected_licenses
large list
license_type
large_string
text
string
download_success
bool
0767112ab2411612eefdeaa1526e5040f458882f
zdsh/leetcode
/20190131/721_Accounts_Merge.py
UTF-8
1,231
3.171875
3
[]
no_license
""" File: 721_Accounts_Merge.py Date: 2019/03/20 10:45:48 """ class Solution(object): def accountsMerge(self, accounts): """ :type accounts: List[List[str]] :rtype: List[List[str]] """ res = {} def find(x): while x in res and x != res[x]: x...
true
8b51c8f635f5f83bbe053dadec1e1ba142b6e531
tariqrahiman/pyComPro
/leetcode/google/471/l471.py
UTF-8
1,574
3.5625
4
[]
no_license
def timeDifference( A, B ): """ :type A: str, first time for the subtraction B-A :type B: str, second time for the subtraction B-A :rtype int, difference between to times in minutes """ #print("timeDifference called with {}".format(B)) hourA, minA = int(A[:2]), int(A[3:]) hourB, minB = i...
true
e72ac72efe018f4bedde6f75c1e04d7c49f06141
Sunghwan-DS/TIL
/Python/BOJ/BOJ_17281.py
UTF-8
1,298
2.984375
3
[]
no_license
# 2020.03.05 # 13:17 ~ 16:25 # 전역탐색 # python3, pypy3 시간 초과 import sys from itertools import permutations def cal(lst): global N runner1, runner2, runner3 = 0, 0, 0 out = 0 score = 0 inning = 0 idx = 0 while inning != N: if arr[inning][lst[idx]] == 0: out += 1 ...
true
eacb582d0ccf2f7cf39f8c150128de0248af9038
bennieHan/PyNeval
/pyneval/io/read_swc.py
UTF-8
920
2.6875
3
[]
no_license
import os from pyneval.model.swc_node import SwcNode,SwcTree # if path is a fold def read_swc_trees(swc_file_paths): swc_tree_list = [] if os.path.isfile(swc_file_paths): if not (swc_file_paths[-4:] == ".swc" or swc_file_paths[-4:] == ".SWC"): print(swc_file_paths + "is not a tif file") ...
true
55bf7fcda60a0829b413ba8c063dbfb8e07ae32d
Slishee/CodeBot
/codebot/mods/run.py
UTF-8
3,033
2.765625
3
[]
no_license
#!/usr/bin/env python3 """ Chatbot for Messenger Groups to Compile and reply code-status. The bot currently works as a facebook user Depends on: - GeekForGeeks (website) - for code execution - fbchat (module) - to interact with facebook - json (module) - json data - threading (module) - for multithreading - re...
true
45d7bba358f5c9af1be1e826f5f3978144e13708
BarryLYH/CodingPractice
/Renming/Week1/code4.py
UTF-8
583
3
3
[]
no_license
import time import itertools import math timeStart = time.clock() with open('input.txt', 'r') as input: andr = [int(x) for x in input.readline().split(' ')] pete = [int(x) for x in input.readline().split(' ')] paul = [int(x) for x in input.readline().split(' ')] maxVal =0 for permute in itertools.permutatio...
true
59b7d65c7371b24c4851331c876f7e4823daad2a
supersj/LeetCode
/313. Super Ugly Number.py
UTF-8
1,106
3.265625
3
[]
no_license
import sys import heapq class Solution(object): def nthSuperUglyNumber(self, n, primes): """ :type n: int :type primes: List[int] :rtype: int """ dp = [1]*n idx = [0]*len(primes) for i in range(1,n): dp[i] = sys.maxsize ...
true
c13fa0f126f900e93753ad34e5d13671cd2e74e5
huyhieu07/nguyenhuyhieu-fundamentals-c4e16
/buoi03/in_list.py
UTF-8
361
3.25
3
[]
no_license
menu = ["di bo", "leo nui","cau long"] # for i in range(len(menu)): # print(i + 1, ". ", menu[i], sep="") #-------------------------- # print("mon the thao yeu thich: ",*menu, sep=", ", end="") # ----------------------- for index, item in enumerate(menu): print(index + 1, ". ", item, sep="") # for item in...
true
94ee2a4a0ec83d9647477604af66d8d9902c076c
AbhinavSingh-21f1002369/ns_21t2_cs1002-ProgrammingAssignments
/week2/GrPA4.py
UTF-8
193
3.25
3
[]
no_license
string=input() string=string.lower() t="" if 'a'in string: t+='a' if 'e'in string: t+='e' if 'i' in string: t+='i' if 'o' in string: t+='o' if 'u' in string: t+='u' print(t)
true
9915e12ccbf66793f46e484b4107734195f283fe
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_211/165.py
UTF-8
910
2.953125
3
[]
no_license
def traiterCas(n, k, u, probas): probas.sort() i = 0 while u > 0: if i == len(probas) - 1: for k in range(0, len(probas)): probas[k] += u/len(probas) u = 0 else: if probas[i] < probas[i+1]: diff = probas[i + 1] - probas[i] if u >= diff*(i+1): for k in range(0, i+1): probas[k] += d...
true
9bda311b019dde60d9628e7fa9d3f22e3fd6f90b
gegaojian-richard/DataMiningWork
/Lab01.py
UTF-8
3,208
2.859375
3
[]
no_license
#-*- coding=utf-8 -*- #!/usr/bin/env python import os from nltk.tokenize import word_tokenize from nltk.corpus import stopwords from nltk.stem.lancaster import LancasterStemmer import re from collections import defaultdict import math import pandas as pd import time allFileNum = 0 allFiles = [] tfDict = {} idfDict =...
true
36e00bdcd778afc2ba93ccfc569113df2cb254d4
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_136/440.py
UTF-8
689
3.046875
3
[]
no_license
# coding=utf-8 *** gatopeich for Google Code Jam 2014 # Problem B. Cookie Clicker Alpha filename = 'B-large' next_line = open(filename+'.in').readline T = int(next_line()) print(T, "cases") out = open(filename+'.out', 'w') for case in range(1, T+1): C, F, X = map(float, next_line().split()) time = 0.0 ...
true
418629fc1923ef794379073c4773ee0c7487ea1a
GustavoRojasUNE/Congruencial-mixto-y-multiplicativo
/PythonRandom/prob1.py
UTF-8
2,101
3.3125
3
[]
no_license
from numaleatorios import Aleatorio random = Aleatorio() class Evento(): def __init__(self): super().__init__() self.tipo_evento = "" self.tiempo_creacion = 0 self.tiempo_salida = 0 #Simulacion en minutos ## Creacion de llegadas tiempo = 0 tiempo_max = 100 eventos = [] while(t...
true
9e482f9323ee57198aee97c19bfdf6f30c608560
KaziMotiour/Hackerrank-problem-solve-with-python
/The Minion Game.py
UTF-8
1,886
3.375
3
[]
no_license
def minion_game(string): String = string Vowels = "AEIOU" length = len(String) STUART = 0 KEVIN = 0 dicCon = {} dicVowl = {} # find out consonant and vowel string vowel = [String[i:length] for i in range(length) if String[i] in Vowels] conso = [String[i:length] for i in range(length)...
true
77930e259dcee9191ac3608d5dd41cf0c41d84d1
muskansaini017/Calculator-GUI-Tkinter
/main.py
UTF-8
5,701
3.1875
3
[]
no_license
import tkinter as tk from tkinter import * from tkinter import messagebox value='' int_value=0 operator='' # functions def btn1_clicked(): global value value=value + "1" data.set(value) def btn2_clicked(): global value value= value+"2" data.set(value) def btn3_clicked(): global value ...
true
0e9b44597b271c7059228ddec8a2aa5ea1b06911
Sevarina/master_thesis
/scripts/flat.py
UTF-8
1,745
2.734375
3
[]
no_license
# -*- coding: utf-8 -*- """ Created on Tue Apr 2 11:12:42 2019 @author: kekaun """ #flatten a latex file and replace all \input{tikz} with include{tikz.pdf} import os import re import codecs while True: print("Please enter file!") i = input() if os.path.isfile(i) == True and i[-4:] == ".tex": ...
true
e9f65b44c8a66360e6e76d211280d23ba9394bcc
Adasumizox/ProgrammingChallenges
/codewars/Python/8 kyu/BeginnerReduceButGrow/grow_test.py
UTF-8
765
3.234375
3
[]
no_license
from grow import grow import unittest class TestGrow(unittest.TestCase): def test(self): tests = [ [6 , [1, 2, 3]], [16, [4, 1, 1, 1, 4]], [64, [2, 2, 2, 2, 2, 2]], ] for exp, inp in tests: self.assertEqual(grow(inp), exp) def test_r...
true
2b1383b23a9af9e87af57725e1847528cb1f9ef3
astroumd/admit
/admit/at/File_AT.py
UTF-8
2,969
2.765625
3
[ "MIT" ]
permissive
""" .. _File-at-api: **File_AT** --- Test task representing an arbitrary disk file. -------------------------------------------------------------- This module defines the File_AT class. """ import sys, os from admit.AT import AT import admit.util.bdp_types as bt from admit.bdp.File_BDP import File_BDP fr...
true
bb075260b1e5aafa929446d117f0d725583d6355
dclegalhackers/regulations-parser
/tests/tree_xml_parser_reg_text_tests.py
UTF-8
930
2.828125
3
[]
no_license
#vim: set encoding=utf-8 from unittest import TestCase from lxml import etree from regparser.tree.xml_parser.reg_text import * class RegTextTest(TestCase): def test_build_section_intro_text(self): xml = u""" <SECTION> <SECTNO>§ 8675.309</SECTNO> <SUBJECT>Defin...
true
5be250c9a72cec9a371999b926203499e4886089
gumpfly/deep_generative
/src/utils/eval.py
UTF-8
1,429
3.1875
3
[]
no_license
"""Tools for evaluation of results of dynamical systems.""" import numpy as np def k_step_extrapolation_error(target, estimate): """Computes k-step extrapolation error. Computes k-step l2-error of two sets of trajectories. N: number of trajectories. T: time steps in the trajectories D: dimension...
true
4e8e2252adae3a033f4b539a9963e926e9f0e396
yesOrNo123/algorithms
/leetcode/46.全排列.py
UTF-8
700
3.421875
3
[ "Apache-2.0" ]
permissive
""" @Author: yanzx @Date: 2021-08-03 13:51:46 @Desc: 全排列 """ from typing import List class Solution: def permute(self, nums: List[int]) -> List[List[int]]: res = [] def dfs_helper(path): if len(path) == len(nums): res.append(path.copy()) return ...
true
6abb76dfd1c27d402f863c2f8fc545f58ac8e275
green-fox-academy/ZaitzeV16
/python_solutions/week-02/day-1/arrays/append_a.py
UTF-8
270
4.28125
4
[]
no_license
# - Create an array variable named `animals` # with the following content: `["koal", "pand", "zebr"]` # - Add all elements an `"a"` at the end animals = ["koal", "pand", "zebr"] print(animals) animals = list(map(lambda animal: animal + "a", animals)) print(animals)
true
b92ceaa0889079c4c2a4abc6b8033a7683f128a0
nobremarcos95/telegram-bot
/echo_bot.py
UTF-8
2,159
3.171875
3
[]
no_license
import requests import json import telebot bot = telebot.TeleBot("<YOUR API TOKEN HERE>") #/start @bot.message_handler(commands=['start']) def send_welcome(message): bot.reply_to(message, "Hello World da Realeza!") #/help @bot.message_handler(commands=['help']) def send_help(message): bot.reply...
true
67e74d600173f36ca080bc3d61df41362f093739
sangramch/deepvideo
/modules/multi_scale_conv/multi_scale_conv.py
UTF-8
3,609
2.984375
3
[ "CC0-1.0" ]
permissive
# imports import math import torch import torch.nn as nn """ 2D Realization of 'Multi-Scale Context Aggregation by Dilated Convolutions' ref: https://arxiv.org/pdf/1709.08855.pdf https://arxiv.org/abs/1511.07122.pdf """ class MultiScaleConv2D(nn.Module): def __init__(self, in_channels, out_...
true
5b3d48d5d4fde5dec99566e9bf012f5fbaf5a988
pythagoras1988/nhej_model
/process_damage.py
UTF-8
3,700
3.1875
3
[]
no_license
# Process the direct and indirect damage from damageMat files # output a matrix indicating information of strands that are damaged import numpy as np import os.path # This class will process the DNA damage from the raw output damage.mat file class ProcessDamage: eThresh = 16.5 # in eV distThresh = 3.2 # in an...
true
2bee160c36761d824127b6f6283d83e81d54ca7e
homermalijan/factUapp
/Source Code/client/main.py
UTF-8
6,244
2.734375
3
[]
no_license
''' Fact U App - A mobile app for news verification using hidden markov model and sentence similary analysis Emmanuel B. Constantino Jr. 2013-08147 Homer C. Malijan 2013-09022 ''' #imports for rendering front end from kivy.app import App from kivy.lang import Builder from kivy.core.window import Window from kivy.uix....
true
e1ac87e1a07f2c9a6b23d98202ac4f04896d69c4
gshen2/tkinter_stuff
/unit_conversion_v2.py
UTF-8
2,923
3.03125
3
[]
no_license
import tkinter as tk from tkinter import ttk import datetime win = tk.Tk() win.iconbitmap('unit.ico') win.title('Unit Converter') win.resizable(False, False) ttk.Style().configure('TButton', foreground='red') # Tabs tabControl = ttk.Notebook(win) tab1 = ttk.Frame(tabControl) tabControl.add(tab1, text='Temperature'...
true
3fdef10df4008cece6e2a101e7566ba8093544f8
chmltf/my-isc-work
/number9.py
UTF-8
624
3.375
3
[]
no_license
import datetime def convert_time(tm): tm = datetime.datetime.strptime(tm, "%Y-%m-%dT%H:%M:%S.%f") return tm def convert_temp(temp): value = temp[2:-3].strip("+").strip("C").lstrip("0") return float(value) + 273.15 infile = 'temp_output.csv' outfile = 'temp_output.nc' from csv import reader #parse t...
true
62f4e4165b8e29b0831d8331a8fbf46c066f86b8
Harshit-Saxena/Project
/Python/Arithmatic.py
UTF-8
174
3.140625
3
[]
no_license
x = (20 + 5) * 5 + 15 - 10 ** 2 print(x) # 40 # ! Order of arithematic operation # * paranthesis > power (**) > multiplu (*) or division (/) > addition (+) or subtraction
true
8bab580a1d804908ff5c9592fd423e0e16625f71
aviral36/HackerRank-Solutions
/Practice/Problem Solving/ElectronicsShop.py
UTF-8
1,346
3.046875
3
[ "MIT" ]
permissive
#!/bin/python3 import os import sys # # Complete the getMoneySpent function below. # def getMoneySpent(keyboards, drives, b): keyboards.sort() drives.sort() if keyboards[0] + drives[0] > b: return -1 else: t = len(keyboards) l = len(drives) arr = [] for i in ran...
true
c85676535f2d0cdd96bde7a34f3d2b7d07637803
Vikitus/Python
/Lista de Estrutura de Decisão (2)/exercicio 28.py
ISO-8859-1
1,716
3.984375
4
[]
no_license
print("Para pedir File Duplo digite 1") print("Para pedir Alcatra digite 2") print("Para pedir Picanha digite 3") tipo_carne = int(input("Digite o tipo de carne: ")) quant_carne = float(input("Digite a quantidade de carne: ")) if (tipo_carne == 1): if (quant_carne <= 5): preco_total = quant_carne * 4.90 ...
true
6abe6f7149b75b8892595440f80ee244bea0cef6
bishoyromany/python_tutorial
/input/input.py
UTF-8
391
3.578125
4
[]
no_license
# eval active the expression x = str(input('What\'s Your First Name ?!')) y = str(input('What\'s Your Last Name ?!')) z = x + ' ' + y print(z) x = int(input('First Number ?!')) y = int(input('Second Number ?!')) z = x + y print(z) # calling input from the file # from sys import argv # # x = argv...
true
d54a5bf54e91d73532f98050208c98eacb14112e
karteekvarma/Python
/Assignmnet.py
UTF-8
3,460
2.875
3
[]
no_license
import PySimpleGUI as sg from PIL import Image,ImageTk,ImageDraw,ImageFont sg.theme('BlueMono') layout_1 =[ [sg.FileBrowse('Load', enable_events=True,size=(10, 1),tooltip="Helps you to load a new image every time.",key='browse')], [sg.Image(filename="",size=(400,400), key='Imag')], ...
true
dca4e35cf0bc1b94da96aaa54dd20e9d3abb9bc3
maximillianus/python-scripts
/manga-downloader/src/check_latest_manga.py
UTF-8
791
2.609375
3
[]
no_license
import time import re import os import requests from bs4 import BeautifulSoup from dotenv import load_dotenv load_dotenv() webpage = os.getenv('MANGASEE_MANGALIST') # manga = 'Tekken-Chinmi-Legends' manga = 'Shingeki-No-Kyojin' # manga = 'Nanatsu-No-Taizai' # manga = 'Hunter-X-Hunter' # manga = 'One-Piece' # manga = '...
true
08ed15c3373a6403cdd1b82a235f8f1a2516859c
antdlx/Judiciary_v1
/predictor/TextRNN/BiLSTM.py
UTF-8
13,136
2.6875
3
[]
no_license
import json import tensorflow as tf import numpy as np from tensorflow.contrib import rnn import math from os.path import join from mjudger import Judger SEQ_LEN = 600 err = 100032 def get_accu_dic(acc_path): ''' 生成罪名-id的字典,注意,比赛要求是从1开始,但是后面函数中的labels要求从0开始,所以后面别忘了+1 :param acc_path: :return: '''...
true
c69a56723581db1d550dc3f02a24523d4bc2993e
nramiscal/PYTHON
/1_Python/2_Python_Fundamentals/7_finding_characters.py
UTF-8
357
3.6875
4
[]
no_license
word_list = ['hello','world','my','name','is','Nina'] word_list = ["good","morning", "sunshine", "have", "a", "wonderful", "day"] char = "n" new_list = [] for element in word_list: # print element for c in element: if c == char: # print element new_list.append(element) ...
true
fc390a7e71aea23d846609a5ebb35c8d24a9bd3f
jeffpereira97/ExerciciosdePython
/4.4.py
UTF-8
72
2.890625
3
[]
no_license
lista_num = [] for lista_num in range (1, 1000001): print(lista_num)
true
1a27232bd656066b7ef2413f81a6ad68a5a8d27b
zoplex/pythonCode
/LinearRegression.py
UTF-8
2,060
3.046875
3
[]
no_license
import pandas as pd import numpy as np import matplotlib import matplotlib.pyplot as plt matplotlib.style.use('ggplot') # Look Pretty # def drawLine(model, X_test, y_test, title): fig = plt.figure() ax = fig.add_subplot(111) ax.scatter(X_test, y_test, c='g', marker='o') ax.plot(X_test, mod...
true
ff103c16e6021603298120f49c9595a640437e0a
joaovicenteft/artificial-intelligence
/neural-networks/logisticRegression/LR_cat_classification.py
UTF-8
4,013
2.703125
3
[]
no_license
# -*- coding: utf-8 -*- import numpy as np import matplotlib.pyplot as plt import h5py import scipy from PIL import Image from scipy import ndimage from lr_utils import load_dataset # Load the data (cat/non-cat) train_set_x_orig, train_set_y, test_set_x_orig, test_set_y, classes = load_dataset() index = 20 plt.imsho...
true
c1e93881bcbca5b290bda07854a7975efc8d1623
nuoxoxo/euler
/e011.py
UTF-8
843
3.09375
3
[]
no_license
a = [] with open('11.txt', 'r') as f: for x in f.readlines(): a.append(x.rstrip('\n').split(' ')) ###### -->> produce a list of strings ## greatestproduct -->> gp = 0 for x in range(0, len(a[0]) - 3): for y in range(0, len(a[0]) - 3): n = int(a[x][y]) * int(a[x][y + 1]) * int(a[x][y +...
true
ca386263bc874a64104b4fb62d513ae71d94757e
Bleoo/TensorflowLearn
/tf_test.py
UTF-8
663
2.90625
3
[]
no_license
import numpy as np import tensorflow as tf x = tf.placeholder(tf.float32, [None, 1]) W = tf.Variable(tf.zeros([1, 1])) b = tf.Variable(tf.zeros(1)) y = tf.matmul(x, W) + b y_ = tf.placeholder(tf.float32, [None, 1]) cost = tf.reduce_sum(tf.pow(y_ - y, 2)) train_step = tf.train.GradientDescentOptimizer(0.000001).minimi...
true
55e41e660710e1f9bd6acd34e6e6bae43794a1b4
lauratasso/sistemas_distribuidos
/src/db/bird/birdDb.py
UTF-8
382
2.890625
3
[]
no_license
import json import os FN = os.path.join(os.path.dirname(__file__), 'bird.txt') class BirdDB: def getBirds(self): file = open(FN, "r") birds = json.loads(file.read())['birds'] file.close() return birds def writeBirds(self, birdsDict): file = open(FN, "w") file...
true
da0e9402f9ac4fa281eb4e1c4a6dc5b684b7ca93
southwestCat/rUNSWift-2019-release
/image/home/nao/data/behaviours/body/test/WalkAround.py
UTF-8
691
2.78125
3
[ "BSD-2-Clause" ]
permissive
# This is a sample behaviour to illustrate how to write your own # By default, this behaviour will be run, but you can target any # behaviour by using the -s flag on the command line from BehaviourTask import BehaviourTask from util.Timer import Timer from body.skills.Walk import Walk class WalkAround(BehaviourTask)...
true
e2d1a00b63fe0932e2801c38c1e7ddc0e2cdcb29
Ananya-0306/AlienGame
/game_functions.py
UTF-8
387
2.96875
3
[ "MIT" ]
permissive
import pygame import sys def manage_events(ship): for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() elif event.type == pygame.KEYDOWN: if event.key == pygame.K_RIGHT: ship.rect.centerx += 1 def draw_screen(screen, ship, bg_color): ...
true
a47a3d0c740f1ab9ed7af62c97c88bf77dbb47ce
DMLZERO/ReinforcementLearning
/Game/rl_game.py
UTF-8
774
3.359375
3
[]
no_license
""" Game to be used for RL studies Author: Bruno G. Eilliar Notes: - """ import pygame, sys from pygame.locals import * from robot import Robot # Colors BLACK = (0, 0, 0) WHITE = (255, 255, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) BLUE = (0, 0, 255) # Pygame Initialization pygame.init() # Screen size and n...
true
80ee9f8ddcbe75a948d92309af408e7546ca27f0
mcmm/projeto_numerico
/projeto_calor.py
UTF-8
4,302
3.390625
3
[]
no_license
from funcoes_projeto import* ####################################################### ## ## ## MAP-3121 - Projeto Computacional - 2016 ## ## ## ## Alunos: ## ## ...
true
0c315addb50c6561442c13c47f8b6cac605afcb1
Pypy233/python
/Base/word_count.py
UTF-8
235
3.09375
3
[]
no_license
counts = dict() try: f = open('romeo.txt', 'r') for line in f: words = line.split() for word in words: if word not in counts: counts[word] = 1 else: counts[word] += 1 except: print('File Not Found!') print(counts)
true
ccd6384c6e694e06aa2f275c4ae76d1a018b4cc7
mcgreevy/chromium-infra
/appengine/findit/libs/http/retry_http_client.py
UTF-8
5,682
2.828125
3
[ "BSD-3-Clause" ]
permissive
# Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import time import urllib _NO_RETRY_CODE = [200, 302, 401, 403, 404, 501] class RetryHttpClient(object): """Represents a http client to send http/https...
true
3a09cbd71d23b1320af9b8ddcfc65b223e487b21
linwt/Intelligent-Customer-Service
/process/step3_regroup.py
UTF-8
2,054
3.109375
3
[]
no_license
import random import csv # 提取随机问,同类组成正例,异类组成负例,正:负=1:3 with open('final_regroup.csv', 'w', newline='') as train: writer = csv.writer(train) with open('final_syn_train.csv', 'r') as zhidao: reader = csv.reader(zhidao) cluster = [] cur = [] stand = '' # 将同一标准问...
true
c27855b839f706a2edc2de0439f53c0a0d8cf816
dr-dos-ok/Code_Jam_Webscraper
/solutions_python/Problem_138/624.py
UTF-8
807
2.640625
3
[]
no_license
#f = open('D-small-attempt0.in', 'r') #f = open('D-sample.in', 'r') f = open('D-large.in', 'r') outpu=open('output.txt','w') cases = int(f.readline()) for case in range(cases): f.readline() N = [float(x) for x in f.readline().split(" ")] K = [float(x) for x in f.readline().split(" ")] N.sort(...
true
15ab5201cc15300d2e9c5817c8df1e6977d3f17b
n1ywb/port-agent-antelope
/port_agent/protocol.py
UTF-8
920
2.640625
3
[]
no_license
from twisted.internet import reactor, protocol from packet import HEADER_SIZE class Protocol(protocol.Protocol): def __init__(self, factory): self.factory = factory def connectionMade(self): # log something self.state = 'HEADER' self.buf = bytearray() def connectionLost(s...
true
1da87d603928fc4bb1b2f2ea111dacae183dd259
revanthpobala/lilac-testing_v2.0
/users/py.py
UTF-8
692
3.15625
3
[]
no_license
import time import hashlib import random import string class generator: def gen_random_message(self): chars = "".join( [random.choice(string.letters) for i in xrange(12)]) return chars def generate(self,total_users): users = [] for i in range(0,total_users): ...
true
3947f0613fc68e8073a01c36849ecdc062fe3c99
barneycouch/ucl
/py/test2.py
UTF-8
514
2.515625
3
[]
no_license
import tempfile, sys, time from os import removedirs start = time.time() fileopen = sys.argv[1] infile = open(fileopen, 'r') if len(sys.argv) != 2: print 'ERROR!' scafflist = [] dict1 = {} for line in infile: line2 = line.replace("\n", "") scaffidi, posi, cati = line2.split() scafflist.append(scaffidi) dict1[po...
true
f14c617c0d6aed45e621e58f5e8635a6665687b1
khushali19/Charts
/multi.py
UTF-8
897
3.359375
3
[]
no_license
import pandas as pd import numpy as np from matplotlib import pyplot as plt data = pd.read_csv('Sales_Records.csv') items = data['Item Type'] sold = data['Units Sold'] food_items = [] unit_sold = [] for x in items: if len(food_items) is not 5: food_items.append(x) ...
true
aca582294224d4fca6576813b70a9fc1401587ee
mvhsin/TF-lite
/mnist/convolution_test_lite.py
UTF-8
1,884
3.3125
3
[]
no_license
""" Convolutional Neural Network. Build and train a convolutional neural network with TensorFlow. This example is using the MNIST database of handwritten digits (http://yann.lecun.com/exdb/mnist/) Author: Aymeric Damien Project: https://github.com/aymericdamien/TensorFlow-Examples/ """ from __future__ import divisio...
true
4d33ed9057006097c5e85ab563306493076b8084
joaramirezra/Can-You-Solve-a-Problem
/In-house/CheckSpecificNumber.py
UTF-8
652
4.34375
4
[ "MIT" ]
permissive
#python code #list of numbers list=[1,3,14,5,19,66,2,53,105,10,24,27,6,5,85,34,56,3,2,35,78,2,3,98,43,2,1,56,8,43,22,12] print("\n \nThe list of numbers to be fitered through:\n" + str(list) + "\n\n") #get the user tp input minimum value specifiedNumber = int(input("Please specify a minimum number: ")) #create a n...
true
4d662c1868f8becf5bf96e8f6355ff75489a396d
APIScorcher/passwordgen
/PasswordGen.py
UTF-8
373
3.875
4
[]
no_license
import random chars = ("abcdefghijklmnopqrstuvwxyz1234566780$$762$#!?!!0127ABCDEFGHIJKLMNOPQRSTUVWXYZ$@#") number = input("Input the number of passwords: ") number = int(number) length = input("Input the length of the password: ") length = int(length) for p in range(number): password = "" for c in range(length): ...
true
ac546c7eae7fc43728515d4f765ef8f57e5ce200
foxer9developer/test2-tools-repo
/add.py
UTF-8
129
3.734375
4
[]
no_license
def add(): x = int(input("Enter 1st Number :") y = int(input("Enter 2nd Number :")) print ("Addition of the numbers is",(x+y))
true
2c96363ceb60c783817de93f53475388d9ecf656
yoctopuce/yoctolib_python
/Examples/Doc-GettingStarted-Yocto-Knob/helloworld.py
UTF-8
2,397
2.625
3
[]
no_license
# ******************************************************************** # # $Id: helloworld.py 32630 2018-10-10 14:11:07Z seb $ # # An example that show how to use a Yocto-Knob # # You can find more information on our web site: # Yocto-Knob documentation: # https://www.yoctopuce.com/EN/products/yocto-knob/doc...
true
7803333a391c5b73c1fdd6fd3c05348a30710ea7
jni/ray
/ray/annotefinder.py
UTF-8
2,853
3.140625
3
[ "MIT" ]
permissive
import math import pylab import matplotlib class AnnoteFinder: """ callback for matplotlib to display an annotation when points are clicked on. The point which is closest to the click and within xtol and ytol is identified. Register this function like this: scatter(xdata, ydata) af = AnnoteFin...
true
d7a81ac9f034fa2f2c55ec95e3654566f2dd2a95
controlpaths/verilog_parser
/src/parse_verilog.py
UTF-8
6,270
2.53125
3
[]
no_license
import re def parse_command(line, command=None): line = line.replace('/*', 'COMMENTINI').replace('*/', 'COMMENTEND') line = line.strip() + 'COMMENTINI COMMENTEND' if 'COMMENTINI' not in line else line excludes = ["reg", "signed"] for exclude in excludes: if len(line.strip().split()) > 1: ...
true
6592a06e90586fd1486fae084d662a4df147d38b
Paola333/Trabalho-redes
/Client.py
UTF-8
1,360
3.515625
4
[]
no_license
import socket import sys from gamestate import GameState # Create a TCP/IP socket sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # Connect the socket to the port where the server is listening server_address = ('localhost', 5000) print('Conectando ao servidor {} na porta {}'.format(server_address[0]...
true
27bb7af68716ae274a0e4ccb93eec73f0c44e18f
Aasthaengg/IBMdataset
/Python_codes/p03700/s905645594.py
UTF-8
401
2.890625
3
[]
no_license
from math import ceil from bisect import bisect n, a, b = map(int, input().split()) raw_hs = [int(input()) for _ in range(n)] hs = sorted(raw_hs, reverse=True) diff = a - b c_min = 0 c_max = int(10e9) while c_max - c_min > 1: c = (c_min + c_max) // 2 tmp_hs = [h - c * b for h in hs] rem = sum([ceil(h / diff) for ...
true
8bbf74f8d20e702f9f975cb1c143db76414b9e06
TheHalfling/LegendaryLivesCharacterGenerator
/LegendaryLivesCharacterCreator.py
UTF-8
2,287
3.1875
3
[ "Apache-2.0" ]
permissive
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ import random #roll a d6 def d6(): roll = random.randint(1,6) return roll #roll a d10 def d10(): roll = random.randint(1,10) return roll #roll a d100 def d100(): roll = random.randint(1,100) ...
true
73f4b14d67ac6bfd065e1bc562285981d6a88dd9
49257620/reboot
/studysrc/day01/testIf03.py
UTF-8
353
3.6875
4
[]
no_license
# encoding utf-8 promote = float(input('输入分数:')) rank = 'E' if promote >= 90: rank = 'A' else: if promote >= 80: rank = 'B' else: if promote >= 70: rank = 'C' else: if promote >= 60: rank = 'D' else: rank = 'E' prin...
true
6e0c2b90ed37a1fdcd3a0f4390a4d25960ee84ef
InADyes/nlp
/assignment3/tagging_test_AG.py
UTF-8
3,079
2.96875
3
[]
no_license
import numpy as np from collections import defaultdict import re """ Weight matrix: """ def getprobabilities(): wt = defaultdict(float) regex = re.compile('[^a-zA-Z0-9]') tag_dict = defaultdict(list) lexicon = open('lexicon-w-t.txt', 'r') for line in lexicon: x = regex.sub(' ', line) ...
true
c22af9cad9cdfcfa64a6f94404ff4439f6f90979
ShashiSekhar/Web-Crawlers
/Serial Crawler/Serial_Crawler.py
UTF-8
2,421
3.03125
3
[]
no_license
import requests from bs4 import BeautifulSoup from pprint import pprint try: # Python 3 from urllib.parse import urlparse, urljoin except ImportError: from urlparse import urljoin, urlparse def pprint_data_to_file(data, fname): with open(fname, 'w') as out: pprint(data, stream=out) class Crawler(object): ...
true
365aae85c0b7e9a16bfcd952507aec78380a01f9
jasonlingo/RoadSafety
/GPS/GPSPoint.py
UTF-8
2,395
3.828125
4
[]
no_license
class GPSPoint(object): """ A class of GPS point with a linked list data structure """ def __init__(self, latitude, longitude, distance=0, duration=0, next=None): """Constructor""" # GPS positoin self.lat = latitude self.lng = longitude # Direction data ...
true
0acafedc00c390b7b602e11417410e8600adda68
jhj2/Self-Projects
/BoxOfficePredictor/Code/GetTrailerCommentsGit.py
UTF-8
1,703
2.96875
3
[]
no_license
'''Get Trailer Comments''' #Import packages import praw import pandas as pd #Make ids from dataframe submittable to info() def add_tag(id_string): new_thing = 't3_' + id_string return new_thing #Get Box office info with open('2018BoxOffice.csv', 'r') as f: box_info = pd.read_csv(f, sep='\t') #Set up box_info data...
true
ac45a5e7b601deb909de7fe1bb2783b676b498bf
ssangervasi/clockwork-croc
/trash/clockwork_croc/config.py
UTF-8
1,047
2.65625
3
[]
no_license
from os import path import yaml from hamcrest import assert_that, has_entries, instance_of ## # Secrets def load_secrets(): app_dir_path = path.dirname(__file__) secrets_path = path.abspath(path.join(app_dir_path, '../.secrets.yaml')) if not path.exists(secrets_path): raise Exception(f'Cannot lo...
true
078d449dcdb4a287403e17bb81c3418170aba7f4
N3CROM4NC3R/python_crash_course_exercises
/files_and_exceptions/silent_cats_and_dogs/silent_cats_and_dogs.py
UTF-8
509
3.40625
3
[]
no_license
filename_cats = "catss.txt" filename_dogs = "dogss.txt" try: with open(filename_cats,'r') as file_object: cats_name = file_object.readlines() print("Cats names:") for cat_name in cats_name: print(cat_name) except FileNotFoundError: pass try: with open(filename_dogs,'r')...
true
cc4bfb04ee808b4baa586f52d1df430a42234cfb
blaxmirror/DailyProgramming
/Daily/Day001/confirm.py
UTF-8
1,172
3.0625
3
[]
no_license
#!/usr/env/bin python3 # -*- coding:utf-8 -*- # 读取兑换码库并返回一个set def load(filename): codeset = set() with open(filename, 'r', encoding='utf-8') as f: for line in f.readlines(): codeset.add(line.strip()) return codeset # 使用追加方法,将已经确认后的兑换码追加写入文件 def write(code, filename): with open(f...
true
c109c9947291a13a4ee7b809c09d96308da275f4
vinay-sj/Object-Perception
/CS5335_ROS/src/original/generate_desired_img.py
UTF-8
865
2.84375
3
[]
no_license
import numpy as np import cv2 def main(): # Create a black image img = np.zeros((1000, 1000, 3), np.uint8) # top-left corner, bottom-right corner cv2.rectangle(img, (335, 300), (665, 700), (255, 255, 255), -1) """ rows, cols, channel = img.shape center_x = (335 + 665) / 2 center_y =...
true
9d302471ae90161d84752d65580b2797f5ad32b3
regnart-tech-club/programming-concepts
/course-1:basic-building-blocks/subject-3:integers/lesson-3.1:Fibonacci solution.py
UTF-8
574
4.625
5
[ "Apache-2.0" ]
permissive
# The Fibonacci Sequence is a series of integers # that start with 0, 1 # then the next integer is the sum of the previous two. # The first seven integers in the series is 0, 1, 1, 2, 3, 5, 8. # Write a program using variables and integer operators # that will print the first 12 integers in the series. f0 = 0 f1 = 1 f...
true
090bda44235794fb3d2b20449b0f6ee4eff0920c
Dad0u/Matasano
/Tools.py
UTF-8
1,969
2.90625
3
[]
no_license
def xor(a,b): out = b'' for i,j in zip(a,b): out += bytes([i^j]) return out def genkey(key, l): while len(key) < l: key += key key = key[:l] return key raw_bytes = [bytes([j]) for j in range(32)] + [bytes([j]) for j in range(128,256)] usualchar = [i for i in range(97,123)] def scor...
true
6ddc9925645e4bfc77bd009bd791aba1c687cdf1
darrencheng0817/AlgorithmLearning
/Python/leetcode/NumberOfConnectedComponentsInAnUndirectedGraph.py
UTF-8
1,488
3.765625
4
[ "MIT" ]
permissive
''' Created on 1.12.2016 @author: Darren ''' ''' Given n nodes labeled from 0 to n - 1 and a list of undirected edges (each edge is a pair of nodes), write a function to find the number of connected components in an undirected graph. Example 1: 0 3 | | 1 --- 2 4 Given n = 5 and ed...
true
8593a316540d499b023220aa48cec7efd208f877
BIGduzy/Python-block-1
/les_6/exercise_3.py
UTF-8
939
4.0625
4
[]
no_license
# Practice Exercises les 6 print('------------------------------------------------------------------------') print('------------------------ Exercise 6_3 (dict) -------------------------') print('------------- Nick Bout - 1709217 - V1Q - Programming - HU -------------') print('-----------------------------------------...
true
9fd8e37d56d4f669500bba29a5b7b23c52ba8c90
youssefarizk/ExercismPython
/rotational-cipher/rotational_cipher.py
UTF-8
385
3.609375
4
[]
no_license
from string import ascii_lowercase, ascii_uppercase def rotate(word, key): key = key%26 newWord = [] for char in word: if char.isalpha(): if char.islower(): char = ascii_lowercase[(ascii_lowercase.find(char)+key)%26] else: char = ascii_uppercase[(ascii_uppercase.find(char)+k...
true
e7968468ee7e4e5fd02ab175684e21fe73534cc4
clemus90/competitive-programming
/hackerRank/crackingTheCodingInterview/hash_tables_ransom_note.py
UTF-8
951
3.453125
3
[ "MIT" ]
permissive
import hashlib class WordHashTable: hash_table = {} def add_word(self, word): hash_dig = hashlib.md5(word.encode()).hexdigest() first_set = self.hash_table.get(hash_dig, False) if not first_set: self.hash_table[hash_dig] = first_set = {word: 0} first_set[word] = first_set.get(word,0) + 1 ...
true
98a8f4be64dd9a5b0a7fc2c1cd14b416caf8d54a
alirezastack/olive
/olive/toolbox.py
UTF-8
1,459
2.765625
3
[]
no_license
import hashlib from olive.exc import PythonStackNotSupported from marshmallow import fields import datetime import inspect def get_caller_name(calframe_num=2): """ :param calframe_num: used to get method name in different call levels :return: caller method name """ # CPython implementation detai...
true
c965ccc21410ccb80681c151dc22d2774124ae70
LuisArmando-TestCoder/ShareGraph
/src/utilities/getSelectedOption.py
UTF-8
645
4.21875
4
[ "MIT" ]
permissive
def getSelectedOption(options): selectedOption = "" while selectedOption not in options: for option in options: print(f"- {option}") selectMessage = "Please type one of the options from the list above: " selectedOption = input(selectMessage).strip() if selectedOpti...
true
0407522a963931e69387f3862905f1c632879325
abhishek-iiit/Python-Project
/Basics/dice rolling/dice.py
UTF-8
1,548
3.28125
3
[ "MIT" ]
permissive
# Program : Dice Rolling Simulator # User_Name : Abhishek jaiswal # User_ID : https://github.com/abhishek-iiit # # Feel Free for Pull Request and to contribute to this Project import random print("This is Dice Simulator by Abhishek") x = "y" or " Y" i =1 while x=="y" or x=="Y": num = random.randint(1,6) if n...
true
2268d1189708f0f4d0b2ac77598ca55ce2247689
Shihab-Munna/Learning-Python3-
/set.py
UTF-8
141
2.671875
3
[]
no_license
a = {'munna', 'dipu', 'sultan'} print(a) print(len(a)) a.remove('munna') print(a) a.update({'labib'}, {'fayek'}) print(a) a.pop() print(a)
true
9ac16ab002d8b837ee777ff84dc7fb87e65773a6
SharonLingqiongTan/tango
/splay.py
UTF-8
4,750
3.515625
4
[]
no_license
from treenode import TreeNode # class Node: # def __init__(self, key): # self.key = key # self.left = self.right = None # def equals(self, node): # return self.key == node.key class SplayTree: def __init__(self): self.root = None self.header = TreeNode(None) #For sp...
true
3127dd027cc4a2278ef81b442427618ceefa04a8
chandiraprakash/HR_Analytics
/HR_High.py
UTF-8
8,529
2.90625
3
[]
no_license
import pandas as pd import seaborn as sns import numpy as np from sklearn.metrics import confusion_matrix from sklearn.preprocessing import StandardScaler from sklearn.linear_model import LogisticRegression from sklearn.metrics import precision_recall_fscore_support from sklearn.model_selection import train_test...
true
c6b91c53e1f98f81a6e8dd7740b344f32f342f68
hjack69/SnakeAI
/constants.py
UTF-8
395
2.78125
3
[]
no_license
from graphics import Point # Graphics options WIN_SIZE = Point(1227, 612) BUFFER = 3 NUM_COLS = 10 NUM_ROWS = 5 SCALE = 3 SCALE_V = Point(SCALE, SCALE) FPS = 30 # Directions UP = Point(0, -1) DOWN = Point(0, 1) LEFT = Point(-1, 0) RIGHT = Point(1, 0) # Genetic options NUM_GENERATIONS = 50 NUM_GAMES = 50 NUM_TURNS = ...
true
e28ee91f14333c647295a6be2f34bf4643eaa582
arshb97/310-ArtificialIntelligence
/DPLL Algorithm/DPLLsat.py
UTF-8
6,269
3.3125
3
[]
no_license
#!/usr/bin/python3 # CMPT310 A2 ##################################################### ##################################################### # Please enter the number of hours you spent on this # assignment here """ num_hours_i_spent_on_this_assignment = 25 """ # ##################################################### ###...
true
26bbd3e74fb07fae23b0f19b733d880a88bfdbcc
abishekChouhan/yolo_v3_tensorflow
/data_utils.py
UTF-8
1,899
2.6875
3
[ "MIT" ]
permissive
import os import numpy as np import cv2 import tensorflow as tf def parse_line(line): if not isinstance(line, str): line = line.decode() line = line.split(' ') line_index = line[0] img_path = line[1] width, height = line[2], line[3] num_obj = len(line[4:])//5 boxes, labels = [], [] for obj in range(num_obj...
true
1f335177edcecc884f08134d9893e6695792a3da
Kit-Angelov/rabbitmq_worker_xml_parser
/worker_parser_xml/tst.py
UTF-8
1,097
2.734375
3
[]
no_license
import os import shutil import time from lxml import etree from lxml.etree import QName #, tag="{urn://x-artefacts-rosreestr-ru/outgoing/kvzu/7.0.1}Parcels" context = etree.iterparse('examples\kpt10.xml', events=("end",)) for event, elem in context: if QName(elem.tag).localname == 'Parcel': pass #pr...
true
191f268ca332bb773ca8f48e2d9af31455bbb3da
brando90/mlprogram
/mlprogram/languages/csg/parser.py
UTF-8
5,407
2.640625
3
[ "MIT", "Apache-2.0" ]
permissive
from typing import Optional, cast from mlprogram import logging from mlprogram.languages import AST, Field, Leaf, Node from mlprogram.languages import Parser as BaseParser from mlprogram.languages.csg import AST as csgAST from mlprogram.languages.csg import ( Circle, Difference, Rectangle, Reference, ...
true
86d7945bb60a063fdf799edc61f546e515f564a1
JackDaga/Genesis
/utils/map.py
UTF-8
1,402
2.875
3
[]
no_license
from typing import Generator, Union data_map = { 'id_types': { 0: 'DNI', 1: 'Carné de extranjería' }, 'schools': { 1: 'Computación y sistemas', 2: 'Industrial', 3: 'Civil', 4: 'Arquitectura', 5: 'Electrónica', 6: 'Derecho', 7: 'Medici...
true
61c0f50b94753a4056de775e1cf5850ecaa033b7
AlinaKuzmina96/learning-tasks
/Основы и применение (Степик)/3.3.7.py
UTF-8
460
3.296875
3
[]
no_license
""" Вам дана последовательность строк. В каждой строке замените первое вхождение слова, состоящего только из латинских букв "a" (регистр не важен), на слово "argh". """ import sys, re pattern = r"a+\b" for line in sys.stdin: line = line.rstrip() line = re.sub(pattern, "argh", line, 1, re.IGNORECASE)...
true
7579f8a7ec8ba5b731cc617a77e703bee6130b89
lucasdovale/ListasCES-22
/Lista2/Questão 5.py
UTF-8
397
3.890625
4
[]
no_license
# CES-22: Programação Orientada à Objeto # Professor: Yano # Código utilizado para Questão 5 da Lista 2 de Python # Escrito por Lucas do Vale Bezerra, COMP-22 class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def reflect_x(self): self.y = -self.y return (self.x,...
true
cf9011303f4a5ec12a7c599964c2b54c20b104b1
Vignesh77/python-learning
/chapter3/src/assign1.py
UTF-8
257
2.75
3
[]
no_license
""" @file :assign.py @brief :Check the 'n' and 'l' is available or not in 'gnu' @author :vignesh(vignesh.nanjundan@vvdntech.in) """ if 'n' in 'gnu' : print " 'n' is available" elif 'l' in 'gnu' : print " 'l' is available" else : print "Not available"
true
84d8107975b009c279c34c52992f944756093c6e
esraaMohamed/python-boilerplate
/Tests/login_test.py
UTF-8
909
2.59375
3
[]
no_license
import unittest from Utilities.base_test import BaseTest from Data.data import Login_Data from Pages.home_page import HomeScreen class LoginTest(unittest.TestCase): driver = BaseTest().setup_driver() def test_login(self): self.username = Login_Data["username"] self.password = Login_Data["pass...
true
ff45d72482082c0672cbb302dca32ac62cbbdd95
syurskyi/Python_Topics
/070_oop/001_classes/_exercises/exercises/Learning Python/030_010_Bound Methods and Other Callable Objects_!cool!.py
UTF-8
2,967
2.796875
3
[]
no_license
# -*- coding: utf-8 -*- # c_ Number # ___ - ____ base # ____.? ? # # ___ double ____ # r_ ____.b.. * 2 # # ___ triple ____ # r_ ____.b.. * 3 # # x = ? 2 # c_ instance objects # y = ? 3 # State + methods # z...
true
d85d05cc6676bd8a52cb25d598fb44ce14563545
goldenratio1618/gameoflife
/simulate.py
UTF-8
18,689
2.96875
3
[]
no_license
from copy import deepcopy from math import floor import cmath from numbapro import cuda from numba import * import numpy as np from timeit import default_timer as timer from random import randrange """ Code for initializing fitness values for each location in grid.""" def initFitnesses(dim, payoffMatrix, adjGrid, gri...
true
ed33319ec564c2e9a80ef123c8dc15224ca7d457
Faldict/Adversarial-Spheres
/sphere.py
UTF-8
2,490
2.84375
3
[ "MIT" ]
permissive
from __future__ import absolute_import from __future__ import division from __future__ import print_function import numpy as np import tensorflow as tf import matplotlib.pyplot as plt R = 1.3 dim = 500 learning_rate = 0.0001 num_steps = 1000000 batch_size = 50 # generate the datasets dataset_x = [] dataset_y = [] f...
true
4c3014169a80e6c0bdd58a293185051c5800cd3f
OscarHernandez375/simulation-creation
/domain/unit_operation.py
UTF-8
475
2.578125
3
[]
no_license
from abc import ABC from typing import Set from domain.energy_stream import EnergyStream from domain.stream import Stream class UnitOperation(ABC): def __init__(self, name): self.name = name self.input_streams: [Stream] = [] self.output_streams: [Stream] = [] self.input_energy_str...
true
f65be6e4e0a309bc121bf927e4345a2dcc16bcbe
Micket/pycourse
/exam_2016-08/question4.py
UTF-8
1,526
4.21875
4
[]
no_license
# Part A class DistanceUnit: # Base class for all units. Empty class used to verify the unit is of the correct type. pass class Meter(DistanceUnit): factor = 1 abbrv = 'm' class Foot(DistanceUnit): factor = 0.3048 abbrv = 'ft' # Part B class Distance: def __init__(self, value, unit): ...
true