blob_id large_string | language 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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
39c33ddab1e6c2eaa9c610515a1618bda25de3df | Python | KiraMelody/Leetcode | /49.py | UTF-8 | 510 | 3.078125 | 3 | [] | no_license | class Solution:
def groupAnagrams(self, strs):
"""
:type strs: List[str]
:rtype: List[List[str]]
"""
l = []
for str in strs:
_str = sorted(str)
l.append((_str, str))
l.sort()
ans = [[l[0][1]]]
n = 0
for i in rang... | true |
f2277dfb2681a73f30be53fab18bd205669b40bb | Python | SuperGuy10/LeetCode_Practice | /Python/434. Number of Segments in a String.py | UTF-8 | 1,056 | 4.0625 | 4 | [] | no_license | '''
Count the number of segments in a string, where a segment is defined to be a contiguous sequence of non-space characters.
Please note that the string does not contain any non-printable characters.
Example:
Input: "Hello, my name is John"
Output: 5
'''
class Solution(object):
def countSegments(self, s):
... | true |
3c52fe85806fae5849385e9adf51464c30c628c0 | Python | LYTXJY/python_full_stack | /Code/src/hellopython/第三章/16format.py | UTF-8 | 862 | 3.296875 | 3 | [] | no_license | print(format(12.3212, "20.8f"))
print(format(11111112.321, "20.8f"))
print(format(12.3212312, "<20.8f"))
print(format(12.2, "20.8f"))
print(format(112321312122.2, "20.8f"))
#"20.8f":
#20代表总体宽度
#.8表示保留小数点后8位
#f表示float型
#<:左对齐
#默认为右对齐
#"16d"
#d表示整数
#e表示科学计数法
print("----... | true |
5812edfcb8615550dfd79ee10b949403b30ae06a | Python | yehanz/Qttt_RL | /AlphaZero_Qttt/MCTS.py | UTF-8 | 6,914 | 2.671875 | 3 | [] | no_license | from collections import defaultdict
import math
from AlphaZero_Qttt.env_bridge import *
from env import REWARD
EPS = 1e-8
class MCTS:
def __init__(self, env, nn, sim_nums, cpuct):
self.env = env
self.env.change_to_even_pieces_view()
self.nn = nn
self.sim_nums = sim_nums
... | true |
9ef12e56ad2e558fd053a6985b2de2f98b0c23f2 | Python | minimum-hsu/tutorial-python | /lesson-11/01/main.py | UTF-8 | 618 | 3.328125 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python3
from datetime import datetime
import time
import sys
assert sys.version_info >= (3, 6)
if __name__ == '__main__':
## current time in local
t = datetime.now()
print('Local time')
print(t.timetuple())
print(t)
## current time in UTC
utc = datetime.utcnow()
print... | true |
c28442a329be2e44f674c161a0043f5cfecf3140 | Python | SonjaZucki/Lektion12 | /cube.py | UTF-8 | 164 | 3.25 | 3 | [] | no_license | def cube_number(num):
result = num * num * num
return result
print(cube_number(4))
print(cube_number(130))
print(cube_number(77))
print(cube_number(223))
| true |
125a9171f0efb2a21433e09a4ec278295ae242cc | Python | Hryts/i-need-3-points | /format_html.py | UTF-8 | 560 | 2.59375 | 3 | [] | no_license | EOL_TAG = '<br />\n'
FILENAME = 'about.html'
FILE_PATH = 'templates/' + FILENAME
NEW_FILE = ''
with open(FILE_PATH, encoding='utf8') as f:
is_par = False
for line in f.readlines():
if '<p>' in line:
is_par = True
if '</p>' in line:
is_par = False
if is_par and l... | true |
b25c9c0b74f53f86eea4a69fd2c10e47130c474e | Python | washucode/Image_Search | /show_images/tests.py | UTF-8 | 4,093 | 3 | 3 | [
"MIT"
] | permissive | from django.test import TestCase
from .models import Category,location,Image
class CategoryTestCase(TestCase):
def setUp(self):
'''
set up instance
'''
self.cat1= Category(name='goodfood')
def test_instance(self):
'''
Test object instance of the model... | true |
f883b820b6520a4ece7cd17b697d80c026c9a55b | Python | fjguaita/codesignal | /Arcade/Intro/15_addBorder.py | UTF-8 | 715 | 3.765625 | 4 | [] | no_license | # Given a rectangular matrix of characters, add a border of asterisks(*) to it.
def addBorder(picture):
imagen=[]
imagen.append("*"*(len(picture[0])+2))
for line in picture:
imagen.append("*"+line+"*")
imagen.append("*"*(len(picture[0])+2))
return imagen
def addBorder2(picture):
l=len... | true |
ee3dcd39488c3b54d9c571729282ea945bee4dcf | Python | jhakala/AlexeyCode | /CMSSW_5_3_3/src/TopQuarkAnalysis/TopPairBSM/test/productionTables.py | UTF-8 | 4,131 | 2.59375 | 3 | [] | no_license | #! /usr/bin/env python
# Create initial production table
# Victor E. Bazterra UIC (2012)
#
import exceptions, json, os, subprocess, tempfile, time
from optparse import OptionParser
def DASQuery(query, ntries = 6, sleep = 1):
"""
Query das expecting to execute python client
"""
das = '%s/src/TopQuark... | true |
6fbe025b86b4ab14eb13933b3de54db17313e0d6 | Python | gdtayag/resource-allocation-game | /evennia/inst490-game/typeclasses/npc.py | UTF-8 | 383 | 2.578125 | 3 | [] | no_license | from typeclasses.characters import Character
class NPC(Character):
def at_object_creation(self):
stats = {"Number of Dead" : 2000,
"Number of Sick" : 10000,
"Discontent" : 500,
"Cure Progress" : 3,
"Vaccine Progress" : 5}
self.db.stats = stats
self.tags.add(... | true |
64d926a253847fec063339da11ab1043047010ea | Python | isilien/kata | /MarsRover-Python/Test.py | UTF-8 | 625 | 2.765625 | 3 | [] | no_license | #!/usr/bin/python
from CommandCenter import CommandCenter
from CommandCenter import Rover
# Curiosity should be at (2, 2)
nasa = CommandCenter()
nasa.rover = Rover([0, 0], "N")
nasa.planet.obstacles = []
instructions = "ffrff"
nasa.send_instructions(instructions)
# Curiosity should be at (0, 2)
nasa.rover = Rover(... | true |
d62714952a64d37935225885efedd2f7aa86dd94 | Python | BassaraK/pp1 | /02-ControlStructures/Zadanie 13.py | UTF-8 | 469 | 4.09375 | 4 | [] | no_license | x = int(input("Podaj liczbę x: "))
y = int(input("Podaj liczbę y: "))
if x>0 and y>0:
print("Punkt leży w I ćwiartce")
elif x<0 and y>0:
print("Punkt leży w II ćwiartce")
elif x<0 and y<0:
print("Punkt leży w III ćwiartce")
elif x>0 and y<0:
print("Punkt leży w IV ćwiartce")
elif x==0 and y!=0:
pri... | true |
ad8c41a729a7510f56549eb2fc8e63689a0cedec | Python | williamwhe/ZOJ | /3869.py | UTF-8 | 444 | 2.6875 | 3 | [] | no_license | import sys
T=int(sys.stdin.readline())
for cases in xrange(T):
N=int(sys.stdin.readline())
votes=map(int,sys.stdin.readline().split())
topmap={}
for v in votes:
if v in topmap:
topmap[v]+=1
else:
topmap[v]=1
retval=sorted(topmap.items(), key=lambda d: d[1], r... | true |
bb0821491eca664dedf1c23a65a0e81f9a4bcf7a | Python | Ritapravo/cpp | /random/py/21.hackercup2.py | UTF-8 | 252 | 3.90625 | 4 | [] | no_license | N = int(input("Enter the value of N: "))
for i in range(1, N+1):
for j in range(N-i):
print(" ", end = " ")
for j in range(i, 2*i):
print(j, end = " ")
for j in range(2*i-2, i-1, -1):
print(j, end = " ")
print() | true |
ebe9de7447a62a03b29a1a3caa7cdf9f5aa53184 | Python | ivan-cyl/NumericalAnalysis | /NumericalAnalysis/#BasicFormula/PiecewiseLinear.py | UTF-8 | 2,753 | 3.5 | 4 | [] | no_license | # 传入插值节点序列x和原函数f,获取分段线性插值函数
def subLiner(xi, f):
yi = f(xi)
def Lh(x):
result = 0.0
# 利用k来定位x所处的区间
k = 0
while k < len(xi) and not (xi[k] <= x and xi[k+1] >= x):
k += 1
result = (x - xi[k+1])/(xi[k] - xi[k+1]) * yi[k] + \
(x - xi[k])/(x... | true |
3a690cd80c596009543b66fb4aae3753d2f205f3 | Python | wangxiaojiani/QCT-GIT | /d2020_07_01/test_cases/test_register.py | UTF-8 | 3,934 | 2.578125 | 3 | [] | no_license | # -*- coding: utf-8 -*-
#@Time :2020/6/14 22:29
#@Author :xj
#@Email :1027867874@qq.com
#@File :test_register.py
#@Software :PyCharm
import unittest
from ddt import ddt,data
import json
import re
from d2020_07_01.common.handle_request import MyRequest
from d2020_07_01.common.read_excel import Read... | true |
e065d8213af8822e9badd779144dceb7ce76d332 | Python | mymorkkis/gamesroom | /tests/test_queen.py | UTF-8 | 950 | 3.3125 | 3 | [] | no_license | """Test module for Queen game piece."""
import pytest
from src.game_enums import Color
from src.games.game import Coords
from src.game_pieces.queen import Queen
@pytest.fixture(scope='module')
def queen():
"""Setup Queen start coords. Return Queen"""
game_queen = Queen(Color.BLACK)
game_queen.coords = Co... | true |
e1df5cc07a6689af5ff51dfba50f4b1875048b07 | Python | BlakeCLewis/kiln_logger | /logger.py | UTF-8 | 2,462 | 2.734375 | 3 | [] | no_license | #!/usr/bin/python3
"""
kilnlogger.py -i 420 -s 30
-i assigns id to log records
-s is interval to log
requires lcd display to watch data realtime
"""
import sys, getopt
from signal import *
import os
import time
import sqlite3
from Adafruit_GPIO import SPI
from Adafruit_MAX31856 import MAX31856
from display import d... | true |
991cdff89091d6e7d1ed7f18907e0e12d1e386c1 | Python | AntonLydike/raymarcher | /raymarch/shapes/shape.py | UTF-8 | 294 | 2.828125 | 3 | [
"MIT"
] | permissive | from vectormath import Vector3
import numpy as np
class Shape:
def __init__(self, color: list):
self.color = color;
def distance(self, point: Vector3) -> float:
return 10.0
def getColor(self, point: Vector3, direction: Vector3) -> list:
return self.color
| true |
32a7b9ff09518e14c46ac2ceb365866a77c95f6b | Python | goutham-nekkalapu/algo_DS | /leetcode_sol/longest_substring_without_repeating_chars.py | UTF-8 | 1,495 | 3.59375 | 4 | [] | no_license |
def lengthOfLongestSubstring_without_repeition(s1):
"""
time complexity, worst case : O(2n)
"""
n = len(s1)
hash_map = {}
max_substr_len = 0
i = 0
j = 0
while i < n and j < n:
key = s1[j]
if not key in hash_map:
hash_map[s1[j]] = 1
j += 1
... | true |
54ea02c1255faa8eba7fbac8395731624a9c8816 | Python | CodedQuen/python_begin | /Krushal.py | UTF-8 | 827 | 2.90625 | 3 | [] | no_license | class Algorithms(object):
def KruskalsAlgorithms(g):
n = g.numberOfVertices
result = GraphAsLists(n)
for v in range(n):
result.addVertex(v)
queue = BinaryHeap(g.numberOfEdges)
for e in g.edges:
weight = e.weight
queue.enqueue(Ass... | true |
868825d145bbc692485b6bf0452e8c5cb7f7b015 | Python | ClaudiuIoanMaftei/IILN-Prietenie | /Project/punctuation_module.py | UTF-8 | 799 | 3 | 3 | [] | no_license | from reading_functions import read_data
def get_punctuation_score(sentence):
streaks=0
total=0
prev_char=""
for char in sentence:
if char in ",.!?":
if char==prev_char: streaks+=1
total += 1
prev_char=char
if total!=0: return streaks/total
return 0
def ... | true |
4d982b75ffd4cc97613704fe3fc684d783d624a5 | Python | aramosescobar/kids_and_gross | /kids_and_gross.py | UTF-8 | 1,032 | 3.421875 | 3 | [] | no_license | while True:
try:
gross = input("How much are you making?")
gross = int(gross)
# if I am here, i have a proper number!
if gross > 1000000 or gross < 0:
print("you liar!")
continue
# tax = 0
if gross < 1000:
tax = 0.1
elif gr... | true |
d46b80f77c170a6fac566dcd4359e2412ff63965 | Python | saravanakumar-dev/Pythonprojects | /Numberguessing_pgm_saravana.py | UTF-8 | 443 | 3.46875 | 3 | [] | no_license | #Number guessing program
from random import randint
a=(randint(0, 50))
print(a)
inp=int(input(("Enter the value")))
while(1==1):
if(inp>a):
print('Your Guess is above the number please inputcorrectly')
inp=int(input(("continue the game")))
elif(inp<a):
print('Your Guess is below the number please... | true |
48c4401575d7a4d4b165e244801273f45643a25d | Python | khaledadrani/100_days_of_python | /days/day_4_file_manager.py | UTF-8 | 4,128 | 3.390625 | 3 | [] | no_license | from tkinter import *
from PIL import ImageTk, Image
import shutil
import os
import easygui
from tkinter import filedialog
from tkinter import messagebox as mb
# Major functions of file manager
# open a file box window
# when we want to select a file
def open_window():
read=easygui.fileopenbox()
ret... | true |
120e470de1cb166ceb4e77ba12bb066157172c1d | Python | rafaelpfreire/code-snippets | /system/zmq_tools/zmqspy.py | UTF-8 | 1,461 | 2.53125 | 3 | [] | no_license | import sys, os, stat
import threading
import zmq
from zmq_tools import *
from google.protobuf import json_format
def getSocketList(dirname):
socketList = list()
for name in os.listdir(dirname):
if(len(sys.argv)>1 and (not name in sys.argv)):
continue
path = os.path.join(dirname, na... | true |
460fe5a82a1d3fe80ae2a96931d4e4d2ee566bda | Python | Junshan233/Neural_Network | /RNN/rnn_pytorch.py | UTF-8 | 1,125 | 2.6875 | 3 | [] | no_license | import torch
import torch.nn as nn
from torch.nn import functional as F
from torch import optim
import matplotlib.pyplot as plt
import numpy as np
TIME_STEP = 50
INPUT_SIZE = 1
DEVICE = torch.device('cuda' if torch.cuda.is_available() else 'cpu')
H_SIZE = 64 # 隐藏单元个数
EPOCHS = 300
h_state = None
steps = np.linspace(0... | true |
37fb3fff6e6cbf2a552b425191fce4f6efe6e1da | Python | Shihao-Song/Neuromorphic_Computing_Simulator | /LLIF.py | UTF-8 | 7,444 | 2.84375 | 3 | [] | no_license | # Plotting Linear Leak Integrate and Fire (LLIF)
# Source: IBM TrueNorth System (https://ieeexplore.ieee.org/document/6252637)
# Equation: Vt = MAX(Vt-1 - Vl, 0) + SUM(Sti * Wi * VeMax)
# Vl is a constant leak value
# VeMax is a spike's maximum contribution to membrane potential (when Wi = 1)
# For example, assume the ... | true |
883b9872d519d6d32f80e08ecb49115b58b11ec6 | Python | EddieKongSword/OpenCV-for-Image-Recognition | /find contours.py | UTF-8 | 964 | 2.703125 | 3 | [] | no_license | import cv2 as cv
import numpy as np
img=cv.imread('stone01.jpg')
length, width=img.shape[:2]
wall=np.zeros([length, width,1], dtype=np.uint8)
gary=cv.cvtColor(img, cv.COLOR_BGR2GRAY)
ret, threshold=cv.threshold(gary, 127, 255, 0)
#函数cv2.findContours() 有三个参数,第一个是输入图像,
# 第二个是轮廓检索模式,第三个是轮廓近似方法。
image01, contours01, cons... | true |
a02a7ec6bc4dd22762d96b3ea87d4a28e31dd745 | Python | matteomoscheni/source | /raysect/optical/library/glass/schott.py | UTF-8 | 2,456 | 2.59375 | 3 | [
"BSD-2-Clause"
] | permissive | from os import path
import csv
from collections import namedtuple
from numpy import array
from raysect.optical.material import Dielectric, Sellmeier
from raysect.optical.spectralfunction import InterpolatedSF
_sellmeier_disp = namedtuple("sellmeier_dispersion", ["B1", "B2", "B3", "C1", "C2", "C3"])
_taui25 = namedtup... | true |
0cc0ef34f5666bda22936a734d144ace9100a9b7 | Python | IndioInc/slothql | /slothql/utils/case.py | UTF-8 | 527 | 3.578125 | 4 | [
"MIT"
] | permissive | import re
CAMELCASE_SNAKE_REGEX = re.compile(r'([a-z\d])([A-Z])')
def snake_to_camelcase(string: str) -> str:
first_char = next((i for i, c in enumerate(string) if c != '_'), len(string))
prefix, suffix = string[:first_char], string[first_char:]
words = [i or '_' for i in suffix.split('_')] if suffix els... | true |
83ef37eebd2cbaff9314ae41e51d226804ebac5b | Python | Callahan-Spaulding/TechOps_assessment | /Question 2/question_2.py | UTF-8 | 459 | 3.109375 | 3 | [] | no_license | import re
import sys
with open("test2.txt", "r") as in_file:
sys.stdout = open('out2.txt', 'w')
names = []
for line in in_file:
striped_line = line.strip()
res = re.findall(r'\w+', striped_line)
curr_name = res[4]
if curr_name in names:
continue
else:
... | true |
de8e58d40cbfe0943c0ea711607f8721fc8e336d | Python | annamel/acroparallels2016 | /dokhlopkov/mapped_file/test/prepare.py | UTF-8 | 461 | 2.96875 | 3 | [] | no_license | huge = 10 ** 8
big = open('big', 'w')
big.write("9" * huge)
big.write("\n")
big.write("1" * (1000))
big.write("\n")
big.write("9" * huge)
big.write("\n")
big.write("2" * (300))
big.write("\n")
big.write("9" * huge)
big.write("\n")
big.write("3" * (30))
big.write("\n")
big.write("9" * huge)
big.write("\n")
big.write("4... | true |
679f668384207517459d1093ba39d8ba029358b5 | Python | morgangiraud/mlexps | /03-exp-vq-vae-mnist/test_qst.py | UTF-8 | 1,134 | 2.546875 | 3 | [] | no_license | import torch
from torch.autograd import Variable
from model import VectorQuantStraightThrough
x = Variable(
torch.tensor([[[[-1.3956, 0.6380, -1.7173], [-1.0479, -1.5089, 0.6566],
[0.7305, -0.9510, 0.3985]], [[-0.5415, -0.7786,
0.5485], [1.1408... | true |
00e9ce8dd1b4fc84ed2b67d54c292b42cfa78adb | Python | avdrob/learn | /python/diving-in-python/week5/week05_01.py | UTF-8 | 6,064 | 2.8125 | 3 | [] | no_license | import time
import socket
import select
import io
import bisect
class ClientError(Exception):
pass
class Client:
serv_success_response = 'ok'
def __init__(self, host, port, timeout=None):
self.socket=socket.create_connection((host, port), timeout=timeout)
self._timeout = timeout
... | true |
b2a1a3934bc37f96e64f38e6db50bd95adeb474e | Python | danielbira/CODE7 | /exercicio16.py | UTF-8 | 309 | 4.15625 | 4 | [] | no_license | def leiaint(msg):
ok = False
valor = 0
while True:
n = str(input(msg))
if n.isnumeric():
valor = int(n)
ok = True
else:
print("ERRO! Digite o número válido")
if ok:
break
return valor
n = leiaint ("Digite um número: ")
print(f'Você acabou de digitar o número {n}') | true |
e3bd511b2bbe175a7c6688e4c6510622396fbb20 | Python | give333/UnivLic | /P1/pratica7_2.py | UTF-8 | 1,726 | 3.109375 | 3 | [] | no_license | def soma_c(a):
l=[]
soma=0
for i in range(len(a)):
soma=soma+a[i]
l.append(soma)
print(l)
def verifica_ordem(a):
teste=1
for i in range(len(a)):
if i>0:
if a[i]<a[i-1]:
... | true |
3f56654065c73363338c9ad4f4b3970a56abcebe | Python | ggandhi27/Practice-of-Data-Structures | /Add Alternate Elements of 2-Dimensional Array.py | UTF-8 | 186 | 3.171875 | 3 | [] | no_license | arr = [int(x) for x in raw_input().strip().split()]
i = 0
s1 = 0
s2 = 0
while i<len(arr):
if i%2 == 0:
s1 += arr[i]
else:
s2 += arr[i]
i+=1
print s1
print s2
| true |
d22887a005da70884f2f87ae770aff8f95f16cb5 | Python | WhiteBrownBottle/LeetcodeDaily | /easy/231.py | UTF-8 | 336 | 3.28125 | 3 | [] | no_license | class Solution:
def isPowerOfTwo(self, n: int) -> bool:
if n == 1:
return True
if n == 0:
return False
if n%2 != 0:
return False
return self.isPowerOfTwo(n / 2)
if __name__ == '__main__':
sol = Solution()
output = sol.isPowerOfTwo(512)
... | true |
99df16440a58027e61752c160bbdf452e44d3e2a | Python | lgpdv/tools-artbio | /deprecated/msp_sr_signature/smRtools.py | UTF-8 | 32,813 | 2.609375 | 3 | [
"MIT"
] | permissive | #!/usr/bin/python
# version 1 7-5-2012 unification of the SmRNAwindow class
import sys, subprocess
from collections import defaultdict
from numpy import mean, median, std
##Disable scipy import temporarily, as no working scipy on toolshed.
##from scipy import stats
def get_fasta (index="/home/galaxy/galaxy-dist/bowti... | true |
b71adb2e4a879f71098a2091000312143a0c2d03 | Python | akey7/StretchDyn | /stretchdyn/atoms_bonds.py | UTF-8 | 4,800 | 3.4375 | 3 | [
"BSD-2-Clause"
] | permissive | from dataclasses import dataclass, field
from typing import Any, Dict, List
import numpy as np # type: ignore
from numpy.linalg import norm # type: ignore
@dataclass
class Atom:
"""
Represents a single atom in a molecule
Instance attributes
-------------------
symbol: str
The element sy... | true |
3fdf5e72dffa3f91bf04c103c3af73ec75cbf633 | Python | egemzer/ml_stock_trading | /strategy_learner/indicators.py | UTF-8 | 5,491 | 3.59375 | 4 | [] | no_license | """
Implementing technical indicators
Code written by: Erika Gemzer, gth659q, Summer 2018
Passed all test cases from grade_strategy_learner on Buffet01 7/30/2018 in 71.80 seconds
"""
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import time
from util import get_data, plot_data
import copy
i... | true |
508197b8d4ed6a75daee6675cb94444a55b6a142 | Python | pooja2005/Design-and-Analysis-of-Algorithms | /Binary_Search (2).py | UTF-8 | 734 | 3.34375 | 3 | [] | no_license | def recur(k,a,low,high):
if(low==high and k!=a[low]):
print("the element is not in the list")
else:
if(high>=low):
mid=int((low+high)/2)
if(k==a[mid]):
print("the element is present in the list")
exit(0)
else:
if(k>a[mid]):
low=mid+1
pr... | true |
ace0ca0c61cbd2736ea7ecd000108e006b358bbd | Python | anushamokashi/prgm | /pgm1.py | UTF-8 | 254 | 2.953125 | 3 | [] | no_license | import webbrowser
import time
total_breaks = 3
break_count = 0
print("this pgm started on"+time.ctime())
while(break_count < total_breaks):
webbrowser.open("https://www.youtube.com/watch?v=ubwJMYwc7rs")
time.sleep(10)
break_count = break_count + 1
| true |
e8155615228dd334ba9f509adcd89091b5a2ebf4 | Python | oldfatdog/python | /python基础课/第15关 计算机的'新华字典'/古诗默写(我的写法).py | UTF-8 | 346 | 2.984375 | 3 | [] | no_license | sent='锦瑟无端五十弦,'
repl='aaaaa'
with open('poem1.txt','r',encoding='utf-8') as poem:
content = poem.readlines()
result=[]
for i in range(len(content)):
tran=content[i]
tran1=tran.replace(sent,repl)
print(tran1)
result.append(tran1)
with open('reult.txt','w',encoding='utf-8') as poem2:
poem2.writelines... | true |
d56dc78fdf28746ba5dcaa6610813b9cf6b29279 | Python | aerkanc/PythonEssentialsExcercies | /05-Loops/03-Example-01.py | UTF-8 | 292 | 3.921875 | 4 | [] | no_license | # Bir sayının asal olup olmadığını bulalım.
# Asal sayı sadece kendisine ve 1’e tam bölünebilen sayıdır.
sayi = 999991
for bolen in range(2, sayi):
if sayi % bolen == 0:
print("%d sayısı asal değildir" % sayi)
exit()
print("%d sayisi asaldır" % sayi)
| true |
faf71c81e28da5bf6a2586a89a38997ab54a8087 | Python | felixnewberry/FSI_codes | /1_FSI_Cylinder/FSI_nostruct/FSI_Driver.py | UTF-8 | 26,010 | 2.53125 | 3 | [] | no_license | # Serves as the Driver for FSI analysis of channel flow past a cylinder with an elastic bar.
# Import user-defined solvers for fluid and structure domains
from StructureSolver import StructureSolver
from FluidSolver import FluidSolver
from Cylinder import ProblemSpecific
from MeshSolver import MeshSolver
# Import do... | true |
4f319bd790809a7499845b16b5df4edbe3e20d54 | Python | bai-design/pytest | /test_windows/conftest.py | UTF-8 | 382 | 2.71875 | 3 | [] | no_license | import pytest
from selenium import webdriver
@pytest.fixture(scope="class")
def open_driver():
browser = webdriver.Firefox()
browser.maximize_window()
yield browser
browser.quit()
@pytest.fixture(params=["https://renren.com/"])
def get_url(open_driver,request):
open_driver.get(request.param)
y... | true |
b8bc1fa43723b04b68a72d81851a35192c30ac5f | Python | srapisardi/Python-Exercises | /PY3E Challenges/Challenges Chapter 10/challenge_2.py | UTF-8 | 1,265 | 4.25 | 4 | [] | no_license | #Challenge 2 Write a version of the Guess My Number game using a GUI
from tkinter import *
import random
class Application(Frame):
def __init__ (self,master):
super(Application,self).__init__(master)
self.grid()
self.create_widgets()
self.random_number = random.randint(1,... | true |
e20433ebc44c16ba9039e8ece4f169506ed3e861 | Python | jadnohra/PaCoS | /pacos3/mock/sources.py | UTF-8 | 1,962 | 2.546875 | 3 | [
"MIT"
] | permissive | from typing import Callable, List, Any
from pacos3.interfaces import ITokenSource, Token, IProcessorAPI, StepCount
GenFuncType = Callable[[Any, IProcessorAPI], List[Token]]
class SingleShotSource(ITokenSource):
def __init__(self, tokens: List[Token], shot_step :StepCount = 0):
self._tokens = tokens
... | true |
adf59f565699b5260dd032eba94ebca5a4e083e5 | Python | kim-taewoo/TIL_PUBLIC | /Algorithm/basics/그래프/union-find.py | UTF-8 | 542 | 3.171875 | 3 | [] | no_license | # 교집합이 없는 집합들을 Disjoint-set 자료구조라고 한다.
# union-find 의 경우에도, 교집합이 있는 상황이라면 그 두 집합을 합쳐서
# 하나의 집합으로 만들어버리므로, 결국엔 Disjoint-set 이 된다.
# Disjoint-set 은 트리 구조로 구현한다. 같은 집합이면 간선으로 이어진 형태가 된다.
# Union 은 두 개의 원소를 합쳐주는 작업이고, 그 과정에 각 원소의 집합을 `find` 한다. 즉, find 는 각 원소가 속한 집합을 찾는 과정이다. | true |
6336009c97513c31fc27f20f887c9f320cc557dc | Python | sachingoyal0104/Optimization | /4.5.py | UTF-8 | 721 | 3.140625 | 3 | [] | no_license | import numpy as np
import matplotlib.pyplot as plt
import os
x1 = np.linspace(-1,3,20)
x2 = (9-9*x1)/13
plt.plot(x1,x2,label='$f(x)=9x_1 + 13x_2 = 9$')
x1 = np.linspace(-1,3,2000)
x2 = 1 - x1
plt.plot(x1,x2,label='$g1(x)=x_1 + x_2 >= 1$')
x1 = np.linspace(0,3,2000)
x2 = 1 - x1
plt.fill_between(x1,x... | true |
908a6b964b2d915e38f6bb91d3e620b44f61b4bf | Python | Beaterli/lazyDIVA | /pathreasoner/learn.py | UTF-8 | 1,004 | 2.734375 | 3 | [] | no_license | import tensorflow as tf
def learn_from_path(reasoner, path, label):
with tf.GradientTape() as tape:
relation = reasoner.relation_of_path(path)
cross_ent = tf.nn.softmax_cross_entropy_with_logits(logits=[relation], labels=[label])
# 分类结果熵向量求和
classify_loss = tf.reduce_mean(c... | true |
0f37f0688a19b920dc6a0a341e196dcbd9e12e99 | Python | rdghenrique94/Estudos_Python | /Uniesp/Ex-Dicionario/aula7_exercicioC.py | UTF-8 | 441 | 3.453125 | 3 | [] | no_license | def main():
cod = {}
for i in range(3):
key = input("Chave: ")
valor = input("valor: ")
cod[key]=valor
print(cod)
if '12345' in cod.keys():
print('CEP OK')
print(key)
else:
print("CEP doesnt found")
for i in cod.values():
if 'rua... | true |
c804e27c4ca299013651ba64fb7db23427ba28d5 | Python | Ionut094/quizzes | /quiz/models.py | UTF-8 | 1,414 | 2.703125 | 3 | [] | no_license | from django.db import models
import reprlib
class Quiz(models.Model):
name = models.CharField(max_length=100)
description = models.CharField(max_length=300)
def __str__(self):
repr1 = reprlib.Repr()
repr1.maxstring = 200
return "Quiz: {0} \n Description: {1}".format(self.name, rep... | true |
fd4bde8ff877f4b572959b9a960c573859ac93ad | Python | NaomiProject/Naomi | /plugins/stt/pocketsphinx-stt/g2p.py | UTF-8 | 3,541 | 2.828125 | 3 | [
"MIT"
] | permissive | # -*- coding: utf-8 -*-
import os
import phonetisaurus
import re
import logging
from . import phonemeconversion
class PhonetisaurusG2P(object):
def __init__(
self,
fst_model,
fst_model_alphabet='arpabet',
nbest=None
):
self._logger = logging.getLogger(__name__)
... | true |
32a20c2bb2b5668527ce39472f7d1c90ae067813 | Python | AlekseyDatsenko/tabel | /jun_school/models.py | UTF-8 | 1,194 | 2.734375 | 3 | [] | no_license | from django.db import models
from users.models import CustomUser
class Subject(models.Model):
name = models.CharField(max_length=100, help_text="Введите название предмета:", verbose_name="Предмет")
def __str__(self):
return self.name
class Meta:
verbose_name = ("предмет")
ver... | true |
26793b306741823bc2b7ec769545ee547f5b4b5b | Python | kaiwensun/leetcode | /1001-1500/1186.Maximum Subarray Sum with One Deletion.py | UTF-8 | 794 | 2.90625 | 3 | [] | no_license | class Solution(object):
def maximumSum(self, arr):
"""
:type arr: List[int]
:rtype: int
"""
res = max(arr)
if res <= 0:
return res
res = float('-inf')
minimum = float('inf')
s_full = 0
s_1out = float('-inf')
for n in... | true |
ec12136c868661edc293293ba507d3c8b9f3d47d | Python | royqh1979/PyEasyGraphics | /test/dialog/show_objects.py | UTF-8 | 329 | 2.9375 | 3 | [
"BSD-3-Clause"
] | permissive | from decimal import Decimal
import easygraphics.dialog as dlg
class Sale:
def __init__(self, name, price, quantity):
self.name = name
self.price = price
self.quantity = quantity
sales = []
sale = Sale("Cole", Decimal(2.5), 100)
sales.append(sale)
dlg.show_objects(sales)
dlg.show_object... | true |
131d9917cea4285eabca9d40b957c8444f6e5085 | Python | ryanmdavis/ExtractKeywords | /ExtractKeywords.py | UTF-8 | 13,119 | 2.609375 | 3 | [] | no_license | import json, itertools, nltk, string, os, operator
import numpy as np
from pprint import pprint
from collections import Counter
#from idlelib.idle_test import test_textview
from nltk.corpus import stopwords
from nltk.stem.porter import *
from sklearn.feature_extraction.text import TfidfVectorizer
from __builtin__ impor... | true |
1acee750f6f5099fcfed0532cf90de07d7f371f1 | Python | zqp563830312/video_title_classification | /utils.py | UTF-8 | 4,246 | 2.765625 | 3 | [] | no_license | import pickle
import codecs
from itertools import izip
import os
import tensorflow as tf
import sys
import numpy as np
import time
from tqdm import tqdm
def invert_dict_fast(dic):
"""
invert dictionary
Inputs:
- dic (dict): the object dictionary
Outputs:
- NO_NAME (dict): the inverted diction... | true |
20ce60231f22ebba72eeb95f6b1e2564570de275 | Python | marshellhe/FreshmanTodo | /PythonLearning/ShowMeTheCode/003.py | GB18030 | 1,097 | 3.421875 | 3 | [] | no_license | #!/usr/bin/env python
# -*- coding:utf-8 -*-
"""
0003 ⣺ 0001 ɵ 200 루Żȯ浽 Redis ǹϵݿС
"""
import random
import string
import redis
forSelect = string.letters + '0123456789'
#N̶ַļ룬list,listÿԪַ
def func_generate(num,length):
re = []
for i in range(num):
# print '%s:'%(i+1) + ''.join(random.sample(forSele... | true |
5ab5c8d6d9bd42eaea04d943397044bca5648179 | Python | leojiaxingli/tweets-analyze | /analysis/network.py | UTF-8 | 2,427 | 2.671875 | 3 | [] | no_license | CONSUMER_KEY = 'LgHaTAhcLzNyLcWRZPovwERAi'
CONSUMER_SECRET = 'e8MhS8arQQIUfS6URkPoJyeoZV24CS25RG3zwuKuK5CjnYVICE'
ACCESS_KEY = '1084522443815809024-H2Sr0QZN247OZSyuhpYigUjkuvyh2F'
ACCESS_SECRET = 'R6gXvu6EnRLHMKfIYCry79Mh98RghgAnximHDmSUNpkfa'
import tweepy
import networkx as nx
import matplotlib.pyplot as plt
import ... | true |
186d898502cf49a1ec3dc6b8a8d9eec3c224e4bc | Python | ChrisYoungGH/LeetCode | /575.DistributeCandies/candies.py | UTF-8 | 642 | 3.3125 | 3 | [] | no_license | class Solution(object):
def distributeCandies(self, candies):
"""
:type candies: List[int]
:rtype: int
"""
candyMap = {}
for c in candies:
candyMap[c] = candyMap.get(c, 0) + 1
counts = sorted(candyMap.values())
l = len(candies) / 2
... | true |
76aa6e6c392cdbafeb7ff3e697889f1ec962965e | Python | shrilekkala/time-series | /NumpyToLatex.py | UTF-8 | 626 | 3.015625 | 3 | [] | no_license | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Created on Fri Dec 11 01:25:38 2020
@author: shri
"""
import numpy as np
def np2lat(A):
filename = 'table.txt'
f = open(filename, 'a')
cols = A.shape[1]
# Change alignment and format of your output
tabformat = '%.5f'
tabalign = 'c'*cols
f.write('\n\\begin{ta... | true |
5ee54176359729b028d3750915503272c2ca8848 | Python | SonoDavid/python-ericsteegmans | /CH11_recursion_simple/binarySearchIterative.py | UTF-8 | 799 | 3.921875 | 4 | [] | no_license | def binary_search(seq, val, start=0, end=None):
""" Check whether the given value is part of the slice
seq[start:end].
- The given sequence ust be sorted in ascending order.
- A defalut value of None for the end position
acutally means a value of len(seq)
"""
if end == None:
end... | true |
16ca77197fb090dd9ea103722b8500f3973b1ace | Python | tkoft/TheButtonBackend | /bottle_app.py | UTF-8 | 5,885 | 2.5625 | 3 | [] | no_license | '''
bottle_app.py
For HackSmith 2017. Backend for The Button.
To run on a pythonanywhere bottle instance.
(c) gary chen 2017
'''
from bottle import default_app, request, route
from hashids import Hashids
hashids = Hashids("salt lolololol")
import json, uuid, os.path
users = {}
groups = {}
### LOAD JSON FILES ###
... | true |
ae97205f32865ce0203ba47abad32878d0ef06a8 | Python | SatoMichi/Simple_Compiler | /Assembler/Code.py | UTF-8 | 1,841 | 2.6875 | 3 | [] | no_license | dest2bin = {
"" : [0,0,0],
"A" : [1,0,0],
"D" : [0,1,0],
"M" : [0,0,1],
"MD" : [0,1,1],
"AM" : [1,0,1],
"AD" : [1,1,0],
"AMD": [1,1,1]
}
jmp2bin = {
"" : [0,0,0],
"JGT": [0,0,1],
"JEQ": [0,1,0],
"JGE": [0,1,1],
"JLT": [1,0,0],
"JNE": [1,0,1],
"JLE": [1... | true |
314b36495958dc23f0e354a2f55c80103e83fce8 | Python | Searnsy/Markov-Chains | /MarkovBuilders/hashmap_open_resizable.py | UTF-8 | 5,310 | 3.390625 | 3 | [] | no_license | """
description: open addressing Hash Map with resizing
file: hashtable_open.py
language: python3
author: sps@cs.rit.edu Sean Strout
author: anh@cs.rit.edu Arthur Nunes-Harwitt
author: jsb@cs.rit.edu Jeremy Brown
author: as@cs.rit.edu Amar Saric
author: jeh@cs.rit.edu James Heliotis
"""
from typing import Any, Hashable... | true |
b16659aaf4f8241ab91a227ade15ffb8755153a0 | Python | BackyardBrains/bybsongbird | /machine_learning_and_dsp/validate.py | UTF-8 | 3,751 | 2.609375 | 3 | [] | no_license | #! python
import cPickle
import itertools
import os
from copy import deepcopy
from functools import partial
import pathos.multiprocessing as mp
from pathos.multiprocessing import Pool
from noise_removal import noiseCleaner
from clean_and_test import clean_and_test, test_params
from train_model import train_model
#Y... | true |
92cd77dfe77a66eb7973dd0d939901fe66d067e7 | Python | Bobby23Putra/TBG | /HTML/nipres/crc.py | UTF-8 | 84 | 2.625 | 3 | [
"MIT"
] | permissive | #!/usr/bin/env python
x=0x2D1
val = (0xffff - (x % 0x10000)) + 1
print hex(val)[2:]
| true |
f03711721ad3773431325d63ce5e8fc944e93a4e | Python | Moridi/car-finding-lane-lines | /CarFindingLaneLines.py | UTF-8 | 6,186 | 2.78125 | 3 | [
"MIT"
] | permissive | from moviepy.editor import VideoFileClip
import matplotlib.image as mpimg
import matplotlib.pyplot as plt
from collections import deque
import numpy as np
import os.path
import math
import cv2
def convert_hsv(image):
return cv2.cvtColor(image, cv2.COLOR_RGB2HSV)
def convert_hls(image):
return cv2.cvtColor(ima... | true |
66178b39a49e581e49ce3822662e5e25baaa8498 | Python | k018c1420/Python | /Kadai10/Exam-10_1.py | UTF-8 | 136 | 3.25 | 3 | [] | no_license | def func(radius):
return radius * radius * 3.14
i = int(input('半径>'))
out = func(i)
print("円の面積:" + str(out))
| true |
4bc24d9ee74ffddac252e842e8dd73e29fd25d07 | Python | Chaos1294/TEXT-ANALYTICS---SUPERBOWL-DATA-2016 | /MAcode2.py | UTF-8 | 1,868 | 2.515625 | 3 | [] | no_license | import pandas as pd
from collections import Counter
import re
commentdf = pd.read_csv('cdf_0427.csv',index_col=0).T
stoplst = pd.read_csv('terrier-stop.txt')['words'].tolist()
print commentdf.head()
word = {}
negkeys = []
negwords = []
allwords = []
for id in commentdf.index:
word[id] = {}
neg = re.findall('... | true |
b8da63f7b69f5ec86a6900dd9353c7105432461a | Python | scattering-central/xrsdkit | /xrsdkit/system/population.py | UTF-8 | 4,758 | 2.609375 | 3 | [
"LicenseRef-scancode-unknown-license-reference",
"BSD-2-Clause",
"LicenseRef-scancode-other-permissive",
"BSD-3-Clause"
] | permissive | import copy
from collections import OrderedDict
import numpy as np
from .. import definitions as xrsdefs
from .. import scattering as xrsdscat
class Population(object):
def __init__(self,structure,form,settings={},parameters={}):
self.structure = None
self.form = None
self.settings = Or... | true |
a3e1db0deb768ccc49bce7268971d08a714d7f9f | Python | MatBasiak/coffe_machine | /Problems/Prime number/task.py | UTF-8 | 290 | 3.8125 | 4 | [] | no_license | number = int(input())
prime = True
if number > 1:
for num in range(2, number):
if number % num == 0:
prime = False
break
prime = True
else:
prime = False
if prime:
print("This number is prime")
else:
print("This number is not prime")
| true |
5be6ddc41d491b67b81a98cce40696fcd0ab88ef | Python | choward1491/cs598ps_project | /scripts/accuracy_results.py | UTF-8 | 1,532 | 2.8125 | 3 | [
"MIT"
] | permissive | #import useful libraries
import numpy as np
import matplotlib.pyplot as plot
if __name__ == '__main__':
# load PCA and NMF accuracy data for GDA
a_gpca = 100*np.load('../data/gpca.npy')
a_gnmf = 100*np.load('../data/gnmf.npy')
# load PCA and NMF accuracy data for Random For... | true |
66769b820ee2875c4882889771b326b9d74adb55 | Python | kozmanaut/python_homework | /Scripts/test.py | UTF-8 | 77 | 3.03125 | 3 | [
"MIT"
] | permissive | list = ["Ludo", "Lucas", "Alex", "Tom"]
print list
list[1] = "Bob"
print list | true |
dffb6d4fe62a8e3811bf5f6a4b05c56b0da8e8fc | Python | rchenmit/RNN_early_detection_hf | /convert_lll_ll_and_times_pickout_subsets_MOD.py | UTF-8 | 2,301 | 2.59375 | 3 | [] | no_license | ## convert list of list of list to [list of list + list of times ]
import numpy as np
import cPickle as pickle
file_lll_seqs = 'data/2_1_outpatient_De_V_Di_M_S_enc_cutoff_25.p.seqs'
file_l_labels = 'data/2_1_outpatient_De_V_Di_M_S_enc_cutoff_25.p.labels'
file_save_ll_seqs_new = 'data/2_1_outpatient_De_V_Di_M_S_enc_cu... | true |
dfbca0ac0d434331b51eecd539b32bb88cf4551d | Python | asherp7/CpGIslands | /hack_proj/train_svm.py | UTF-8 | 5,280 | 3.09375 | 3 | [] | no_license | import itertools
from collections import Counter
import numpy as np
from sklearn import svm
import pickle
import matplotlib.pyplot as plt
np.set_printoptions(threshold=np.nan)
K_MER_LEN = 5
TESTING_RATIO = 0.1
# Results stats
def show_recall_precision_curve(recall, precision, title='SVM performance as function of K-... | true |
48075bf2ad411a1b95975c2c48dad3f660a4f465 | Python | devilhtc/leetcode-solutions | /0x03b6_950.Reveal_Cards_In_Increasing_Order/solution.py | UTF-8 | 500 | 3.078125 | 3 | [] | no_license | class Solution:
def deckRevealedIncreasing(self, deck):
"""
:type deck: List[int]
:rtype: List[int]
"""
deck = sorted(deck)
l = len(deck)
d = collections.deque(list(range(l)))
mapping = {}
for i in range(l):
j = d.popleft()
... | true |
29f3d5533a6e82185a6fd352d58aa2d2c33fc2ab | Python | KentWangYQ/py3-poc | /third_party/deep_leaning_from_scratch/common/functions.py | UTF-8 | 378 | 2.765625 | 3 | [
"MIT"
] | permissive | import numpy as np
def softmax(a):
exp_a = np.exp(a)
sum_exp_a = np.sum(exp_a)
y = exp_a / sum_exp_a
return y
def cross_entropy_error(y, t):
"""交叉熵误差(cross entropy error)"""
if y.ndim == 1:
t = t.reshape(1, t.size)
y = y.reshape(1, y.size)
batch_size = y.shape[0]
re... | true |
13669f93d002c67baa1d0e2e482255e0c47f53ba | Python | muskankumarisingh/loop | /negative positive.py | UTF-8 | 141 | 2.6875 | 3 | [] | no_license | i=1
sum=0
while i<=5:
var=int(input("enter the number"))
if var>0:
sum=var+sum
print(sum)
else:
print(var)
i=i+1
Negative positive | true |
541d8fbfc99f57a1c59406e2f49a557cb6192110 | Python | uhreungdu/my-pc-2dgp | /project/wizard_boss_stage_background.py | UTF-8 | 1,911 | 2.515625 | 3 | [] | no_license | from pico2d import *
import game_framework
import game_world
import main_game
import boss_stage
class Stage:
image = None
font = None
gauge_font = None
gauge_bar = None
gauge_fill = None
state_window = None
bgm = None
def __init__(self, num = 1):
self.x, self.y, self.num = 1280... | true |
2f31bb4f6a6d6f788a4d4d2d1ce6046db133512b | Python | ebrahimsalehi1/frontend_projects | /Python/Overweight.py | UTF-8 | 277 | 3.5625 | 4 | [] | no_license |
n = int(input(''))
m = float(input(''))
bmi = round(n/(m*m),2)
res = ''
if bmi < 18.5:
res='Underweight'
elif 18.5 <= bmi and bmi < 25:
res = 'Normal'
elif 25 <= bmi and bmi < 30:
res = 'Overweight'
elif 30<=bmi:
res='Obese'
print("%.2f" % bmi)
print(res) | true |
3ffb75693ef2cac78e324727ae17e4818c983828 | Python | yzhsieh/Image_sofm | /extraction.py | UTF-8 | 10,934 | 2.578125 | 3 | [] | no_license | import numpy as np
from matplotlib import pyplot as plt
import csv
import json
from PIL import Image
import time
# import cv2
### user defined libraries ###
# import SURF
###
dir_name = './CorelDB2/'
gray_dict = {}
###
CVthreshold = 10000
### temp
land = 0
straight = 0
###
def PCA(data, dims_rescaled_data=2):
"""... | true |
6ecf09e130ba5532fe3208b3d8d873b9ce0af1cd | Python | hanyoujun/PythonCookbookPractice | /interpy/kwargs.py | UTF-8 | 149 | 3.09375 | 3 | [
"Apache-2.0"
] | permissive | def greet_me(**kwargs):
for key,value in kwargs.items():
print("{0} == {1}".format(key,value))
greet_me(name="yasoob")
greet_me(name="aaabbb") | true |
40cea56eaf4eb3d8e45ede5ad7de0135ae64fb53 | Python | AnkurJais/twitter-sentiment-pyspark | /config/ConfigReader.py | UTF-8 | 294 | 2.78125 | 3 | [] | no_license | import configparser
import sys
class ConfigReader:
def __init__(self, file):
self.config = configparser.ConfigParser()
try:
self.config.read(file)
except FileNotFoundError as ex:
sys.exit("Config file does not exist")
def get_config(self):
return self.config
| true |
75734eb17290ad72832b3229de397d2788d006dd | Python | Pranaykashyap/python-project | /Hybrid Encryption/hybrid.py | UTF-8 | 899 | 2.703125 | 3 | [
"Unlicense"
] | permissive | import hybrid_encrypt
import hybrid_decrypt
import time
#plaintext = "Wireshark is the world's foremost and widely-used network protocol analyzer. It lets you see what's happening on your network at a microscopic level and is the de facto standard across many commercial and non-profit enterprises, government agencies,... | true |
c274638dd213f4f8902661a3308fca180e610e1d | Python | pedro-canedo/Estudos-em-Python | /Exercícios/exercicio05.py | UTF-8 | 450 | 4.09375 | 4 | [
"MIT"
] | permissive |
#recebe os valores e retorna eles alocados em uma lista
numeros = list()
while True:
n = int(input('Digite um numero: '))
if n not in numeros:
numeros.append(n)
print('Valor adicionado com sucesso...')
else:
print('Valor duplicado, tente novamente...')
r = str(input('Quer con... | true |
308214bc050552a0c5c9f69ddd14ed543d70766c | Python | JorgeSolis12/PracticasASR | /Practicas 3/practica3.py | UTF-8 | 2,549 | 2.96875 | 3 | [] | no_license | import time
from getSNMP import *
comunidad = "grupo4CV5"
ip = "192.168.100.19"
def main():
print("-------------------Menú-----------------------------------")
print("¿Qué desea hacer?")
print("1. Capas de transporte")
print("2. Paquetes IP de red")
print("3. Números de puerto de una aplicac... | true |
48d0424b7409c4ad1bbe5b53e9b122489983c786 | Python | richrine/test1 | /backtracking1.py | UTF-8 | 564 | 3.96875 | 4 | [] | no_license | def permute(list, s):
if list == 1:
return s
else:
return [ y + x
for y in permute(1, s)
for x in permute(list - 1, s)
]
print(permute(1, ["a","b","c"]))
print(permute(2, ["a","b","c"]))
print(permute(3, ["a","b","c"]))
def permutation(m):
... | true |
ec9dcdc93f38377b141f49e14643b2af69e57328 | Python | GuilhermoCampos/Curso-Python3-curso-em-video | /PythonExercicios/Mundo 2/8_estrutura_de_repeticao_for/ex055b.py | UTF-8 | 372 | 3.9375 | 4 | [
"MIT"
] | permissive | maior = 0
menor = 0
for p in range(1, 6):
peso = float(input('Digite o Peso(kg) da {}º pessoa: '.format(p)))
if p == 1:
maior = peso
menor = peso
elif peso > maior:
maior = peso
elif peso < menor:
menor = peso
print('O Maior peso registrado foi de {}kg, enquanto o Menor p... | true |
dcb7bd9a5d3f824b1b019a7b7581d3a7660647dd | Python | vinkrish/ml-jupyter-notebook | /DS & Algorithm/LinkedList/SortedLinkedList.py | UTF-8 | 1,597 | 4.3125 | 4 | [] | no_license | class Node(object):
def __init__(self, value):
self.info = value
self.link = None
class SortedLinkedList(object):
def __init__(self):
self.start = None
def insert_in_order(self, data):
temp = Node(data)
if self.start == None or data < self.start.info:
... | true |
8bfabd6fc3762d58fde4968e6038b86d33659662 | Python | seventhridge/mat2110 | /ccdata.py | UTF-8 | 5,577 | 2.59375 | 3 | [] | no_license | import re
infile = "ccdata-raw.txt"
outfile= "ccdata.txt"
def formatDate(d):
"""
calcuate date as Mmm dd, YYYY from Month D, YYYY
"""
try:
parts = d.replace(',',' ').split()
months = ["jan", "feb", 'mar', 'apr', 'may', 'jun', 'jul', 'aug', 'sep', 'oct','nov', 'dec']
month = m... | true |
1db1fdfd5b8f7f811f7b5402db89fcaa606a707d | Python | ZombieSocrates/brainteasers | /CodeWars/ValidateSudoku.py | UTF-8 | 3,879 | 3.828125 | 4 | [] | no_license | import math
'''
https://www.codewars.com/kata/540afbe2dc9f615d5e000425
'''
class Sudoku(object):
def __init__(self, data):
self.data = data
self.dimension = len(data)
self.group_target = set([v for v in range(1, self.dimension + 1)])
def is_valid(self):
if not self.validat... | true |
c0102a3c15606cda45d25ac45e14aac6bfc294d9 | Python | mumtaz1000/python_beginners_project | /time-till-deadline.py | UTF-8 | 428 | 3.625 | 4 | [] | no_license | import datetime
user_input = input("Enter your goal with a deadline separated by colon\n")
input_list = user_input.split(":")
goal = input_list[0]
deadline = input_list[1]
deadline_date = datetime.datetime.strptime(deadline, "%d.%m.%Y")
today_date = datetime.datetime.today()
time_till = deadline_date - today_date
p... | true |
c18e0b5b7eafb4f0ed50d87b87aaaa6c42776a44 | Python | tnez/PsyParse | /psyparse/entry/exp_data/stimuli/probe.py | UTF-8 | 2,271 | 2.6875 | 3 | [
"MIT"
] | permissive | from psyparse.entry.exp_data.stimuli.base_stimulus import BaseStimulus
class Probe(BaseStimulus):
def __init__(self, logfile=None, pos=None, raw_entry=None,
orig_var_name=None, trans_var_name=None):
BaseStimulus.__init__(self, logfile, pos, raw_entry, orig_var_name,
... | true |
02e5e16271641afb84f54679e2aa824bc8962ff9 | Python | jbowmer/adventofcode | /Python/Day9/Day9.py | UTF-8 | 693 | 3.234375 | 3 | [] | no_license | # -*- coding: utf-8 -*-
"""
Created on Fri Jan 1 12:34:03 2016
@author: Jake
"""
#Advent of Code - Day9
from itertools import permutations
from collections import defaultdict
input_string = open('input.txt', 'r')
with open('input.txt', 'r') as f:
content = input_string.readlines()
places = set()
graph = defa... | true |