blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
0b66c882cb4dd7770977952cd2e27984be13f729
yosef8234/test
/python_offsec_pentest/Module 2/Data Exfiltration Server- TCP Reverse Shell.py
2,110
3.84375
4
# Python For Offensive PenTest: A Complete Practical Course By Hussam Khrais - All rights reserved # Follow me on LinkedIn https://jo.linkedin.com/in/python2 import socket import os # Needed for file operation # In the transfer function, we first create a trivial file called "test.png" as a file holder ju...
6ee2229642cfb4fb509764e591cd25108c8efa3e
luciopalm/Exerciciospython_C_video
/pacote download/exercícios/ex008.py
120
3.578125
4
n1 = int(input('Digite um valor:')) print('metros:{} \ncentímetros:{} \nmilímetros:{}'.format(n1,(n1*100),(n1*1000)))
3c63ed3368a4a71fcf9615329a3795c67e3f0c11
obezpalko/smallprogs
/covid-distance/main.py
428
3.625
4
#!/usr/bin/en python from math import sqrt from scipy.spatial import distance a = (0, 0, 0) b = (1, 0, 0) c = (1/2, sqrt(3)/2, 0) d = (1/2, 1/(2*sqrt(3)), -sqrt(2/3)) print(f"a->b: {distance.euclidean(a, b)}") print(f"a->c: {distance.euclidean(a, c)}") print(f"a->d: {distance.euclidean(a, d)}") print(f"b->c: {distan...
fbbace29d9e830d1312cb1c3721faa88b5c40b07
tashakim/puzzles_python
/graph/sort.py
4,683
4.34375
4
#!/usr/bin/python3 class InvalidInputException(Exception): def __init__(self,value): self.value = value def __str__(self): return repr(self.value) def merge_sort(array): """merge_sort: int array -> int array Purpose: Sort the input array of integers in descending order u...
7c6e4a2776ecb24c5ff6e2209471e6aea5765ffe
ghostlhq/Python-Data-mining-Tutorial
/Week-02/Example-02/全唐诗文本整理.py
3,849
3.625
4
""" 全唐诗文本整理 Version: 0.1 Author: 长行 """ import re if __name__ == "__main__": with open("全唐诗.txt", encoding="UTF-8") as file: lines = file.readlines() print("总行数:", len(lines)) poem_list = list() reading = False # 启动标志(解决第1次识别到标题行写入的问题) book_num = 0 # 卷编号 poem_num = 0 # 诗编号 ti...
d020cc3833470a58875df9cbf74b6598138bb2ae
despo/learn_python_the_hard_way
/exercises/ex33.py
497
4.21875
4
def add_numbers_to_list(size, increment=1): numbers = range(0,size) for i in numbers: print "At the top is %d" % i print "At the bottom i is %d" % i def print_numbers(): print "The numbers:" for num in numbers: print num # extra credit 2 numbers = [] add_numbers_to_list(6) print_numbers() numbe...
9cf7ab1a716af574f531f6b9c4f8f9f21989209c
timebird7/Solve_Problem
/SWEA/4874_Forth.py
1,455
3.671875
4
class Stack: def __init__(self): self.stack = [0]*300 self.pnt = 0 def push(self, x): self.stack[self.pnt] = x self.pnt += 1 def pop(self): if self.pnt == 0: return None else: self.pnt -= 1 return self.stack[self.pnt] ...
c538ea089503a8eca4018706238e45ee2e6940ee
LizaShengelia/100-Days-of-Code--Python
/Day2.Exercise3.py
197
3.5625
4
age = input("What is your current age?") new_age = 90 - int(age) x = int(new_age) * 365 y = int(new_age) * 52 z = int(new_age) * 12 print(f"You have {x} days, {y} weeks, and {z} months left.")
def2342ed42fc6faab47d28a12c56fed4dbe3714
bweiz/Python
/PokerHands.py
2,396
3.984375
4
#------------------------------------------------------------- # Benton Weizenegger # 10/3/17 # Lab Section 2 # Program 2 #------------------------------------------------------------- def evaluate(hand, poker_output): if Flush(hand): return "Flush" elif Three_of_a_Kind(hand): return "...
d579936f20417376bf36e190a77a43eff309ec9c
aCoffeeYin/pyreco
/repoData/DasIch-brownie/allPythonContent.py
251,289
3.515625
4
__FILENAME__ = abstract # coding: utf-8 """ brownie.abstract ~~~~~~~~~~~~~~~~ Utilities to deal with abstract base classes. .. versionadded:: 0.2 :copyright: 2010-2011 by Daniel Neuhäuser :license: BSD, see LICENSE.rst for details """ try: from abc import ABCMeta except Imp...
527ddb97e47c0a45684303f32ab957bad865992e
gabriellaec/desoft-analise-exercicios
/backup/user_087/ch28_2019_03_30_23_28_42_136365.py
182
3.875
4
if v <= 80: print ('Não foi multado') else: valor = 0.5*(v - 80) print ('Foi multado no valor de {0:.2f}'.format(valor)) v = float(input('Qual a velocidade do carro?'))
f85f44386a40ef37e649a7a325cccd999ceeb899
CfSanchezog/ExamenFinal_Metodos
/ejercicio1.py
641
3.671875
4
# Ejercicio1 # A partir de los arrays x y fx calcule la segunda derivada de fx con respecto a x. # Esto lo debe hacer sin usar ciclos 'for' ni 'while'. # Guarde esta segunda derivada en funcion de x en una grafica llamada 'segunda.png' import numpy as np x = np.linspace(0,2.,10) fx = np.array([0., 0.0494, 0.1975, 0....
96bd3655f408032dbc2b5aeb965ba1d8bda9dd81
dani1563/practica_11
/ejercicio5.py
1,089
4.1875
4
#Estrategia incremental #Algoritmo de ordenacion por inserción """ 21 10 12 0 34 15 numeros a ordenar Parte ordenada Partimos de la idea de que ya está ordenado el primero 21 10 12 34 15 10<21 SI 10 21 12 0 33 15 12<10 NO 12<21 SI 10 12 21 0 34 15 0 10 12 21 ...
924a26bfaa2bcd862503b3027134c76477fb6d7c
poc7667/internal-training-python-course
/01/pre_hw_01.py
355
3.859375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- import time name=raw_input("Please enter your name:") print("Hi "+ name) print("Welcome to play the guess number game...") if name.lower()=="eric": print "Hi" + name + ", how are you ?" else: print "Who are you ? get out!" while True: print("Hi "+ name + ", ar...
d5d74327f0a7a6c26dd5a01308761c9b994e9eb2
Yunyun1101/guess
/guess.py
720
3.671875
4
# 產生一個隨機整數1~100 (不要印出來) # 讓使用者重複輸入數字去猜 # 猜對的話 印出 “終於猜對了!” # 猜錯的話 要告訴他 比答案大/小 import random start = input('請決定隨機數字範圍開始值:') end = input('請決定隨機數字範圍結束值:') start = int(start) end = int(end) answer = random.randint(start, end) count = 0 while True : guess = input ('請猜數字:') guess = int(guess) count += 1 # count = count ...
242ea2dad1319a69f40ec0f0466f2ff488ae90ca
OneDay8/test
/class_learn.py
1,428
4.03125
4
class Person: def __init__(self,x): self.x = x self.name = 'William' self.age = 45 self.wight = 90 def greet(self): print('hi,my name is ' + self.name) class Animal(Person): def __init__(self,x): super(Animal, self).__init__(x) ...
a0caac5caad2ce9f84d26d8a233d4f042951c2ab
anorld-droid/Email-Sender
/Search/linear_search.py
321
3.8125
4
#!/usr/bin/env python def search(list, key): """If the key is in the list return the position, -1 otherwise""" for i, word in enumerate(list): if word == key: return i return -1 def main(): number = [i for i in range(45, 100)] position = search(number, 56) print(position)...
a67fc8274d502746032005b93c36918d1e185c0b
elsenorbw/advent-of-code-2020
/day13/investigation2.py
1,404
3.671875
4
# # trying to improve the logic for combining a pair of (inc,off)'s # # this is the maive version to beat.. # and as I type, the answer has arrived.. # so that method worked ok.. # but we could probably do better def combine_pairs(inc_off_one, inc_off_two): print(f"Combining [{inc_off_one}] with [{inc_off_two}]...
22804d0927de106504b76a32784109e415a4a82f
uoshvis/python-examples
/itertools/swimmers.py
2,756
3.640625
4
from collections import namedtuple import csv import datetime import itertools as it import statistics class Event(namedtuple('Event', ['stroke', 'name', 'time'])): __slots__ = () # for min() def __lt__(self, other): return self.time < other.time def sort_and_group(iterable, key=None): """Gr...
ab56f59132126cdd6bdd709f62d08bea0b0e64c4
camilleanne/hackbright_archive
/exercise01/guess.py
856
3.890625
4
import random def guessing_game(): print "Hey there, guessypants! What's your name?" name = raw_input() print "Hi %s. I'm thinking of a number between 1 and 100. Try to guess the number." % name prompt = 'Your guess? ' guess = 0 number = random.randint(1, 100) while guess != number: ...
65c7bdd203f9f944a3d5b6a547d07f1fea7a7fbd
Samuel1P/Prep
/small_problems/fuzzbizz.py
438
4.34375
4
#if int is divisible by both 3 and 5, then print fizzbuzz #if int is divisible by only 5, then print buzz #if int is divisible by only 3, then print fizz # if int is not divisible by both print the int for fizzbuzz in range(50): if fizzbuzz % 3 == 0 and fizzbuzz % 5 == 0: print("fizzbuzz") elif fizzbuz...
2cc102bb664d783a739c7527af9e7d35feb11e04
tawseefpatel/ECOR1051
/python/assignments/Lab 10/Lab10ex2.py
260
4.09375
4
def divisors(n:int)->list: """returns a list containing all the positive divisors of n. >>> divsors(6) >>>[1,2,3,6] >>>divisors(9) >>>[1,3,9] """ i = 1 return [i for i in range (1,n+1) if n%i == 0] print(divisors(6))
b2fb4b21d97787a5cbc70bcb56cca7a805f7075e
rishikeshd/Geo-Spatial-Analysis-using-Python
/Categorize.py
13,163
3.59375
4
############################################################## #Script is used to extract data from csv files and perform operations like #Cleaning geo coordinates to lat, long #Cleaning created_at to only time at which the user tweeted #Convert coordinate system data in array from DD to DMS(Degree Minutes Seconds) #Di...
d372563bf7ce5ab6d1d01e7f236f9d04af42bfe5
Victorvv72/TPA-Lista
/quest 3.py
263
3.78125
4
nascido = 0 contador = 1 total = 0 while contador <= 10: contador += 1 nascido = int(input('Em que ano você nasceu: ')) demaior = (nascido - 2021) *-1 if demaior >= 18: total += 1 print ('{} São maiores de idade'.format (total))
eaeb8e0d0cde6f428b171adb48b6859daf33c21b
p4radoks/yeni
/07SortveTuples.py
568
3.5625
4
sayi1=[8,56,25,875,224,156,1561,2441,12] sayi1.sort() #Sort fonksiynu sayi1 dizisinin sayıların büyüklüğüne göre sıralanmasını sağlar print(sayi1) print(sorted("ahmet")) #ahmet'in karakterlerini alfabetik sıraya göre sıralar isim1=["ahmet","mehmet","ali"] isim1.sort() #İsimlerdeki karakterlerin alfabedeki ...
93593fc247c1b42f7cd1c0c0d83a7ad37ece1b75
Luucius/python01
/while.py
71
3.703125
4
numero = 0 while numero <= 10: print(numero) numero = numero+1
94a8ab107adbc26f00b1b35c5ed9ce73f76330a3
UWSEDS/homework-3-4-testing-exceptions-and-coding-style-kfrankc
/dataframe.py
859
3.71875
4
import numpy as np import pandas as pd import sys def validate(file_name): df = pd.read_csv(file_name) df_correct = pd.read_csv('data.csv') try: if (np.any(df_correct.dtypes != df.dtypes)): raise ValueError() except (ValueError): print('Input DataFrame does not contain the ...
836659e3fa45b8341f2875e5cf577ac31b74841d
PhilKennedy86/DigitalCrafts-Assignments
/AlgorithymPracticeAssignmt3.py
204
3.859375
4
array = [0,1,2,3,4,5,6,7,8] sum_array = 0 sum = 0 for i in range(0,10): sum += i for i in range(0,len(array)): sum_array += array[i] print("The number missing (0-9) is:") print(sum - sum_array)
564a34dbe481ac5c196648cd193f55d20af1f391
coocos/leetcode
/leetcode/235_lowest_common_ancestor_of_a_binary_search_tree.py
2,269
4.125
4
import unittest from leetcode.common import TreeNode class Solution: """ This recursive solution utilizes the basic property of a binary search tree to find the common ancestor. In a binary search tree the left subtree of each node contains only values smaller than that particular node and the ri...
1421699ac02298e6cbbc0526cdfc37d57fd60d81
vitocuccovillo/DataScienceBook
/Chapter4/SomeMath.py
637
3.578125
4
def jaccard(u1, u2): in_common = len(u1 & u2) union = len(u1 | u2) return in_common/float(union) if __name__ == '__main__': ''' NOTAZIONE: - liste: lista = ["a","a","b"] - insieme: set = {"a","b"} senza ripetizioni - no_duplic = set(lista) trasforma da lista a set ''' ...
58f1195e56591f21ed98a36fcb9e683507ff901d
Kimberly07-Ernane/Python
/Pacote para dowloand/Python/ex001 (While) soma de n° pares e qtd de n° inferiores.py
359
4.21875
4
#Faça um programa que recebe dez números, calcule e mostre na tela: # a soma dos números pares # a quantidade de números inferiores a 10 #(com while) soma=0 inf=0 i=0 while i < 10: n=int(input('Digite um número:')) if n %2==0: soma+=n if n<10: inf+=1 i=i=1 print("Soma pares",soma) print...
dc72686255482255b890b5e793ed674be279cb58
amirafzali/coding-questions
/2 Key Keyboard/sol.py
435
3.6875
4
def minSteps(self, n): mem = {} def search(current): if current in mem: return mem[current] if current == 1: return 0 shortest = float('inf') for i in range(2,current+1): if current%i == 0: shortest = min(shortest, i+search(...
6a55e72c0b4ff225a30e67e1ce4490f92703bade
prakashzph/test
/task_two.py
229
3.59375
4
from math import factorial def total_route(n,k): return factorial(n)/(factorial(k)*factorial(n-k)) print ('Hence, the total routes for 20*20 grid is '+str(total_route(40,20))) # n=20+20(since the grid is 20*20) and k = 20
5fe8aa8f932c9fe391c2d633299a92dc1ba5a22e
isemiguk/Python_Coursera
/Module_3/realNumbers.py
733
4.21875
4
print(float(2**100)) #пример преобразования в вещественное число if 0.1 + 0.2 == 0.3: #это связано с представлением вещественных чисел в пайтоне print('yes') else: print('no') print('{0:.25f}'.format(0.1)) #пример указания вывода количества знаков после запятой print(0.5.as_integer_ratio()) #пример хранения ...
55a7add24ddca32e4511760cc244b81e3f51d9da
KYOUNGSOO-LEE/project_euler
/Project_Euler(python)/PE21-30/PE27.py
743
3.640625
4
#PE27 Quadratic primes import time import math def formula(n, a, b): return n ** 2 + a * n + b def isprime(n): for i in range(2, math.floor(math.sqrt(abs(n))) + 1): if n % i == 0: return False return True startTime = time.time() maxNum = 0 product = 0 aList = [num for num in range(-...
daff17f511c7aff195422a8efc96cc57e9865b2b
alkhalifas/Development-of-a-GUI-BMI-Calculator-using-Python-and-tkinter
/salkhali@bu.edu_Project/bmi_calculator_final.py
7,053
3.65625
4
# -*- coding: utf-8 -*- """ Created on Sat May 4 15:06:44 2019 @author: alkhalifas """ # Import packages: # Import tkinter to build the GUI interface of this app: from tkinter import * # Import sqlite to store the data we will generate: import sqlite3 # Import time to manage the time of our entries: import time im...
4c7ae7979bd84acd065a36b1394463ef8ae5b05a
thakur-nishant/LeetCode
/818.RaceCar.py
1,688
4.34375
4
""" Your car starts at position 0 and speed +1 on an infinite number line. (Your car can go into negative positions.) Your car drives automatically according to a sequence of instructions A (accelerate) and R (reverse). When you get an instruction "A", your car does the following: position += speed, speed *= 2. Whe...
163286a8625a95612274c82209f4027b35a1dcef
YXChen512/LeetCode
/7_reverseString.py
991
3.671875
4
class Solution(object): def __init__(self): self.solution = None def reverse(self, x): """ :type x: int32 :rtype: int32 """ if x == 0: return x isNegative = x < 0 value = abs(x) digits = [] while value >0: ...
8675c6f941a0cdf4fef1dccb5e551bef45016e5c
MalwiB/academic-projects
/Algorithms_Data_Structures_Python/4/4.6.py
314
3.578125
4
def sum_seq(sequence): suma = 0 for item in sequence: if isinstance(item, (list, tuple)): suma += sum_seq(item) else: suma += item return suma seq = [ [1,2,3,4], 1, 2, [6, 7], 1, [1, [6, 2, 3], (2, 3, 4)]] print seq print "\nSuma liczb w powyzszej sekwencji zagniezdzonej wynosi", print sum_seq(seq)
04b4c895efad5e538370dccd756fc252466ea4d1
scorp6969/Python-Tutorial
/variable/string_methods.py
570
4.09375
4
name = 'rambo rocky' n = 'ramborocky' name2 = 'RAMBO ROCKY' # find length of string print(len(name)) # find any character in string print(name.find('m')) # capitalize the string print(name.capitalize()) # make all character uppercase print(name.upper()) # make all character lowercase print(name2.lower()) # check ...
96e166ac2b0f611583b62da6564fda03fdeb088d
feuer95/Thesis
/Python/LPF_graph.py
270
3.796875
4
# -*- coding: utf-8 -*- """ Created on Tue Jul 16 10:59:53 2019 @author: elena """ import matplotlib.pyplot as plt import numpy as np x = np.linspace(0,10) plt.plot(x, x, c = 'black') plt.plot(x, 5 * x,c = 'black') plt.plot(x, 0.30 * x,c = 'black') plt.show()
05c49d05ee024731921a84e51520bdb12a422e73
simonryu/python_study
/예제 소스 코드/04교시/미니문법/if_sample.py
58
3.53125
4
for i in range(1, 4): if i == 3: print(i)
b794d62d8c26efb939a30351d5c8d5ce85ce9822
simonaculda/LeetCode
/Array_and_Strings/reverseWordInS3.py
930
4.25
4
""" Given a string, you need to reverse the order of characters in each word within a sentence while still preserving whitespace and initial word order. Example 1: Input: "Let's take LeetCode contest" Output: "s'teL ekat edoCteeL tsetnoc" Note: In the string, each word is separated by single sp...
8a2575392496745623b60b92d88e5ef4965884ae
sdanil-ops/stepik-beegeek-python
/week2/task26.py
1,249
3.84375
4
# ----------------------------------------------------------- # Copyright (c) 2021. Danil Smirnov # program for converting the value of the time interval # specified in minutes into the value expressed # in hours and minutes. # ----------------------------------------------------------- from task1 imp...
db185c77d0e2b15393a1a5ef086f53b34ed76525
MattCotton20/Battleships
/random_guessing.py
609
3.578125
4
from battleships import * def random_guessing(size, ships, print_output): board = generate_board(size, ships, False) if print_output: board.draw_board(False) while not board.game_over: # Take a random guess guess = board.get_random_pos() valid_guess, _, _ = board.take_gue...
391fe3fde5c5ed7e4fdf1c6845738eb898a75bdf
louizcerca/python
/immc.py
1,873
3.765625
4
# python 2.7.12 peso = float(input('Insira o peso: ')) print(peso) altura = float(input('Insira a altura: ')) print(altura) imc = (peso / (altura * altura)) ideal1 = ((altura * altura) * 18.52) ideal2 = ((altura * altura) * 24.97) perda1 = round(peso - ideal2) perda2 = round(peso - ideal1) pideal1 = round...
60a4d2399b0b29de99247fa29f78f59ad804a787
mukulb90/datastructure
/dynamic_programming/longest_increasing_subsequence.py
698
3.921875
4
def _longest_increasing_subsequence(arr, end): cost = [1 for item in arr]; for outer in range(1, end + 1): max_so_far = cost[0]; for inner in range(0, outer): # lis till inner -> cost[inner] if(arr[inner] < arr[outer]): max_so_far = max([cost[inner] + 1, m...
b7d94637e17b45fb36bdde04fb4daf1ad3fd1e0c
vnyk/prg
/scopeElementsSum.py
1,491
4.125
4
""" The absolute difference between two integers, and , is written as . The maximum absolute difference between two integers in a set of positive integers, , is the largest absolute difference between any two integers in . The Difference class is started for you in the editor. It has a private integer array () for st...
68da17c34eb663ae956eb9e86f25021997ea7350
eduhmc/CS61A
/Teoria/Class Code/32.py
742
4.03125
4
### DEMO1: sum_primes python O(1) vs scheme O(n) def is_prime(x): """Return whether x is prime. >>> [is_prime(x) for x in range(1, 10)] [False, True, True, False, True, False, True, False, False] """ if x <= 1: return False else: return all(map(lambda y: x % y, range(2, x))) d...
d17206461651c5113b101a69e4ea5c0fc308c871
shreyassk18/MyPyCharmProject
/DataType/Strings/String_immutable.py
413
4.09375
4
#Strings are immutable, which means address of the variable will be changed when you modify the variable #memory of a variable can be found using id() funtion str1 = "name" str2 = "organization" print(id(str1)) #1758994627248 print(id(str2)) #1759026452144 str2=str2 + "onmobile" print(id(str1)) #1758994627248 print...
b2b6592381386761dd512a2e75373009d8a0fecf
gestone/TechGen
/sentence_generator.py
4,121
3.875
4
""" Generates random sentences using Markov Models. """ import psycopg2 import random import re import os from nltk import bigrams # to get tuples from a sentence in the form: (s0, s1), (s1, s2) class SentenceGenerator(object): """ Generates random sentences. Since SentenceGenerator is implemented using ...
ed613433eaa50d87afe31c8a9a97f737545e666d
andyleva/kurs-python
/lesson01-hw6.py
1,358
4.03125
4
# 6. Спортсмен занимается ежедневными пробежками. В первый день его результат составил a # километров. Каждый день спортсмен увеличивал результат на 10% относительно # предыдущего. Требуется определить номер дня, на который результат спортсмена составит # не менее b километров. Программа должна принимать значения па...
59e0d0a11e668484d9a821e73084131f4d48d3b2
SeanHarveyOfiangga/Assignment-1
/test.py
168
3.9375
4
""" Basic Addition Calculator """ a = int(input("Enter your first number: ")) b = int(input("Enter your second number: ")) result = a + b print(f"{a} + {b} = {result}")
eec25dd6059841bd877644950a313cd11c5ddab2
RavikrianGoru/py_durga
/byte_of_python/py_oop/inheritance_subclass.py
1,682
4.375
4
class SchoolMember: '''Represents any school memers. base/super class''' def __init__(self, name, age): self.name = name self.age = age print(f'Initializing SchoolMember: {self.name}') def details(self): print(f'Details Name : {self.name}, Age : {self.age}', end=" ") clas...
5974ad8fbaf5927bdfab41b0cb3b16c9d56ad86c
ishantk/KnowledgeHutHMS2020
/Session4R.py
2,855
4.09375
4
""" Synchronization """ import time import threading # create a Lock Object lock = threading.Lock() class MovieTicket: def __init__(self, name, time, row, seat_num): self.name = name self.time = time self.row = row self.seat_num = seat_num self.is_booked = False ...
83cb7da034cf3000737f8e7afa4723095edb2d5b
jojonas/py1090
/py1090/helpers.py
3,478
3.984375
4
import math EARTH_RADIUS = 6371008.7714 # m r"""The average earth radius :math:`R_0`. It is defined as the mean radius of the semi-axes. The values are taken from the WGS 84 (World Geodetic System 1984) ellipsoid `(definition of the Department Of Defense, Jan. 2000, p. 37) <http://earth-info.nga.mil/GandG/publica...
80739d61b3cf031d93248ea3b5d6a6814c732aeb
luandadantas/URI-Python
/iniciante/1042_sort_simples.py
248
3.515625
4
A, B, C = input().split() A = int(A) B = int(B) C = int(C) valores_crescentes_list = [A, B, C] valores_crescentes_list.sort() ordem_original = [A, B, C] for i in valores_crescentes_list: print(i) print() for i in ordem_original: print(i)
76a15c11ba8ade5d665c07f103e4e00e1e2b82f4
NVGNVG/python_project
/Cryp_pass_project.py
715
4.03125
4
#Made by:NVG # Python 3 code: Hash creator # Get hash generator (string >> hexadecimal) import hashlib #Input and initializing print('Word to convert to hash:') x = input() print('Word: ' + x) # encoding using encode() # then sending to md5() result = hashlib.md5(x.encode()) result_512 = hashlib.sha...
e52f61bd060ef4f43a9bcb2d4de21a93091f9e09
arun007chauhan/tutorials_pmath
/linerarAlgebra/linear_transformation.py
4,125
3.921875
4
import numpy as np import matplotlib.pyplot as plt # what does it mean linear transformation """ def --> A linear transformation T:U->V,is a function or operator that carries elements of vector space U(called domain) to vector space V(called cododomain),and which has to two aditional properties T(u1) + T(u2) = T(u1)...
34c32af3ed1de9c4b2e4c7f1a142e213e4a2ff35
Lyxilion/McColloch-Pitts
/McColloch-Pitts.py
1,680
3.609375
4
def sgn(x:float): """ La fonction sign :param x: un nombre :return: 1 ou 0 :rtype: int """ if x<0: return 0 else : return 1 def f(X:list,H:list,t:int): """ fontion de tranfert de McColloch-Pitts :param X: list : Connexion ativatrice :param H: list ...
6fb6f0ae3d03bc1bb7ecfd76ddb54c7d71d3b496
JackM15/python-mysql-practice
/carspractice.py
350
3.78125
4
# ---- Cars Practice ---- # import sqlite3 #create new db db = sqlite3.connect("cars.db") #create new cursor cursor = db.cursor() #add table called inventory with "make, model, quantity" fields. cursor.execute("""CREATE TABLE cars (make TEXT, model TEXT, quantity INT) """) #close the ...
eda1f0a1df8e9dd94e1ca7b9e64ff92a4dca049b
niyati2k/SSL
/pythonlab.py
5,645
3.9375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: r=10 pi = 3.14 volume = (4/3)*pi*r*r*r print (volume) # In[ ]: def add(a,b): return a+b def sub(a,b): return a-b def mult(a,b): return a*b def power(a,b): return pow(a,b) def div(a,b): return a/b def cal(d,a,b): return d(a,b) cal(power,5,10...
10aa799e5bda732f551469a8ee74e404a4a93a83
JensGM/pyTurbSim
/pyts/io/formatter.py
6,361
4.0625
4
from string import Formatter class SuperFormatter(Formatter): r""" SuperFormatter adds the following capabilities: 1. Initialize with a template string, and the :meth:`__call__` method uses this string. Thus, example usage of this formatter looks like:: template = SuperFormatter(templ...
bccea6ad9572b8056f29c74172ed4d1cc16f621e
songzy12/LeetCode
/python/142.linked-list-cycle-ii.py
467
3.515625
4
from List import * # try no extra space, when you are free class Solution: # @param head, a ListNode # @return a list node def detectCycle(self, head): d={} while head!=None: if head in d: return head d[head]=1 head=head.next return...
00f235dcdc2118d47313d02216c25b361a4fe2af
peterjunlin/PythonTest
/practices/datatype_set.py
1,079
3.921875
4
def set_initialization(): set1 = {1, 2, 3} assert type(set1) == set set1 = set([1, 2, 3]) assert type(set1) == set set1 = set('hello world') assert set1 == {'h', 'd', 'r', 'l', 'o', 'e', ' ', 'w'} def set_operations(): set1 = {1, 2, 3} # Append element to set. set...
20fb56bae40e7d26973527c882ee648087a74cd5
Ruban-chris/Interview-Prep-in-Python
/cracking_the_coding_interview/1/1-7.py
766
3.78125
4
def rotate_matrix(square_matrix): length = len(square_matrix) for i in range(length//2): for j in range(i, length - i - 1): k = j l = (length - i - 1) m = l n = (length - k - 1) o = n p = (length - l - 1) (square_matrix[...
9b687451ff5872e2e264499a83aac8497631a680
oystein-hr/just-one-more
/just_one_more.py
905
3.6875
4
import re from functools import partial def increment_match(matchobj): value = matchobj.group(0) leading_zero = re.compile(r'[0]\d+') if re.match(leading_zero, value): return '0' + str(int(value) + 1) else: return str(int(value) + 1) def increment(values): check_negative = parti...
0b39be8f0f5fc1f5b5fcf763a1982857d6770a27
ofir123/MP3-Organizer
/mp3organizer/datatypes/track.py
1,432
4.0625
4
class Track(object): """ A POPO class to hold all the track data. Contains the following information: Number, Title and Disc Number. """ def __init__(self, number, title, disc_num=None): """ Initializes the track data object. Normalizes the number by adding a zero if nee...
c4c461bb5c74a42b009eb48c8ef331a3b45384fb
SuperGuy10/LeetCode_Practice
/Python/811. Subdomain Visit Count.py
3,262
3.90625
4
''' A website domain like "discuss.leetcode.com" consists of various subdomains. At the top level, we have "com", at the next level, we have "leetcode.com", and at the lowest level, "discuss.leetcode.com". When we visit a domain like "discuss.leetcode.com", we will also visit the parent domains "leetcode.com" and "co...
3744272fa9795ad6545d698d2c011e54645bf129
TurcsanyAdam/Gitland
/forloop5.py
137
3.828125
4
x = int(input("Enter a number here: ")) for i in range(x): ws = " " * (x -i -1) st = "*" * i print(ws + st + "*" + st + ws)
ec5d2fd1eff3263f653b361cc4cbad311605c380
robgoyal/TicTacToePython
/player.py
1,423
4.1875
4
# Name: player.py # Author: Robin Goyal # Last-Modified: Decemeber 9, 2017 # Purpose: Implement the player class for game class Player(object): marks = ["X", "O"] def __init__(self, mark, board): self.mark = mark self.board = board def getMark(self): ''' return -> string...
7913d363fc3e01bf7e563cf50ef3fffddf4089f5
DmytroZeleniukh93/python_book
/class_9.py
1,028
4
4
# 9-1 Restaurant class Restaurant: def __init__(self, restaurant_name, cuisine_type): self.restaurant_name = restaurant_name self.cuisine_type = cuisine_type def describe_restaurant(self): print(f'{self.restaurant_name} {self.cuisine_type}') def open_restaurant(self): prin...
6c4663df9471e7db43c97e18b906bedbbd80833c
subhasmitasahoo/leetcode-algorithm-solutions
/convert-a-number-to-hexadecimal.py
482
3.578125
4
#Problem link: https://leetcode.com/problems/convert-a-number-to-hexadecimal/ #Time complexity: O(log16(n)) #Space complecity: O(1) , excluding o/p class Solution: def toHex(self, num: int) -> str: if num<0: num = 2**32 + num if num == 0: return "0" res = "" ...
613cf829ebaa392468005c5e751528d2041aeecb
minialappatt/Python
/file_four_letter_count.py
969
3.890625
4
# -*- coding: utf-8 -*- """ Find the count of four letter words from a file """ f=open("test.txt","r") #opening test.txt in read mode text=f.read() print("Printing the contents of file\n:") print(text) f.close() f1=open("test.txt","r") count=0#to store the count of 4 letter words L=[]#list to store the word...
9dc7220b6ce4c711f3bd4916621ce730f2d6bc8c
daniel-reich/ubiquitous-fiesta
/NpJMkLRfApRCK7Js6_24.py
111
3.5625
4
def is_palindrome(wrd): if len(wrd)<=1:return True return wrd[0] == wrd[-1] and is_palindrome(wrd[1:-1])
8d9e05dc23f2c7663aadd7e2233d3276e048c344
Ferretsroq/Brute-Justice
/Characters.py
6,225
3.890625
4
from enum import Enum import random import skills import BruteJusticeSpreadsheets class Stat(Enum): """Simple Enum for identifying stat pools""" Might = 0 Speed = 1 Intellect = 2 class Weapon(Enum): """Simple Enum for identifying how much damage a weapon deals""" Light = 2 Medium = 4 Heavy = 6 class Pool: "...
783758c6ad53cd9d0c5ee7c79e1ee7981c683645
MatNoble/leetcode
/LeetCodeSolutions/503.py
802
3.546875
4
#================================================== #==> Title: next-greater-element-ii #==> Author: Zhang zhen #==> Email: hustmatnoble.gmail.com #==> GitHub: https://github.com/MatNoble #==> Date: 1/15/2021 #================================================== """ https://lee...
d55533841b8cadf02d6be11cf7affc16eb2d305c
MiroVatov/Python-SoftUni
/Python Fundamentals 2020 - 2021/03 - LISTS BASIC/Exercose 04 - 01 ver 2.py
104
3.5625
4
nums_str = input().split() nums = [] for num in nums_str: nums.append(-int(num)) print(nums)
ff708a0dd6c1c95faf199f8826a581b5ca349be3
HarikrishnaRayam/Data-Structure-and-algorithm-python
/Linked List -2/lectures/midpoint of linked list.py
1,598
3.59375
4
# -*- coding: utf-8 -*- """ Created on Tue Apr 14 16:18:38 2020 @author: cheerag.verma """ class Node: def __init__(self,data): self.data = data self.next = None def createLL(arr): if len(arr) == 0: return None head = Node(arr[0]) tail = head ...
60831729f58dc649fa5cefbd16fef9264041e824
sanathkumarbs/coding-challenges
/recursion/basic/fibonacci.py
912
4.0625
4
"""Fibonacci. The fibonacci sequence is a famous bit of mathematics, and it happens to have a recursive definition. The first two values in the sequence are 0 and 1 (essentially 2 base cases). Each subsequent value is the sum of the previous two values, so the whole sequence is: 0, 1, 1, 2, 3, 5, 8, 13, 21 and so on...
c19015df485e35d4baf9a1ef444332d7247e9dcb
narasimhareddyprostack/Ramesh-CloudDevOps
/Basics/one.py
264
4.0625
4
x = int(input('Pls Enter Value')) print(x+10) #input function read data/input at the run time #always string only #The input() function is used in both the version of Python 2.x and Python 3.x. # how to read multiple values in single line # command line args
544b294a3da3f61dab2e56283ab4558a3adefa43
tkhunlertkit/cs361f18
/Lab 4/samRationalMethods.py
718
3.71875
4
import unittest from rational import Rational class SamRationalMethods(unittest.TestCase): # Sam def test_zero(self): # test if zero times zero zero = Rational(0,1) new = zero*zero self.assertEqual(new.n, 0) self.assertEqual(new.d, 1) # Sam def test_neg(self): #mak...
e2504e2954cbe80f1826e09b27e5d8b676e6b78b
wryoung412/cs224n_nlp
/assignment1/q2_neural.py
5,910
3.65625
4
#!/usr/bin/env python import numpy as np import random from q1_softmax import softmax, softmax_grad from q2_sigmoid import sigmoid, sigmoid_grad from q2_gradcheck import gradcheck_naive def forward_backward_prop(X, labels, params, dimensions, debug=False): """ Forward and backward propagation for a two-laye...
a41395f9a46a002d25512c614866325203a06a36
lzchub/iPython-scripts
/mysql.py
3,628
3.96875
4
""" author by chuan 2020-08-04 实现数据库的连接,增删改查等操作 """ import pymysql """ Insert操作 """ def insert_sql(name,sex): # 1.创建连接对象 conn = pymysql.connect(host='192.168.100.100', port=3306, user='admin', password='admin', ...
8cf1b746b526e1cd7d77a4cebf34f679ab9da20e
ftlka/problems
/leetcode/largest-number/solution.py
340
3.515625
4
from functools import cmp_to_key def largestNumber(nums): res = [str(num) for num in nums] comp = lambda a, b: 1 if a + b < b + a else -1 sorted_str = ''.join(sorted(res, key=cmp_to_key(comp))) # for zeros while sorted_str[0] == '0' and len(sorted_str) != 1: sorted_str = sorted_str[1:] ...
3770612c99a4bc1f523406526c34b65cf6da45a1
DEEPTHA26/python
/1.py
100
3.8125
4
d5=int(input()) if(d5>0): print("Positive") elif(d5<0): print("Negative") else: print("Zero")
48e586e2d2fa5b7a0f083ae48196de79b279574f
eli719/pyprojects
/changImageFormat.py
1,226
3.5
4
from PIL import Image image = Image.open('3.jpg') # type:Image.Image print(image) image = image.convert('RGB') # P->RGB image = image.save('p_3.jpg') image = Image.open('p_3.jpg') print(image) def changFormat(type): print(image.getpixel((0, 0))) im = image.convert(type) im.save('lena_' + t...
b6d6c7b3dd31f138f71c313d5b9396f99f240789
TaylorWx/shiyanlou
/python/math.py
540
3.984375
4
#!/usr/bin/env python3 n=int(input("enter the value of n: ")) print("enter values for the matria A") a=[] for i in range(n): a.append([ int (x) for x in input().split()]) print("enter values for the Matri B") b=[] for i in range(n): b.append([int(x) for x in input().split()]) c=[] for i in ran...
2875c8c045f3e51212bd05e08602cc05bf82b305
khoch/line-alg-python-
/main.py
709
3.703125
4
from display import * from draw import * screen = new_screen() x = -1 x1 = 0 while (x <= 1): draw_line(screen, int(250*x)+250, int(250*x*x*x)+250, int(250*x1)+250, int(250*x1*x1*x1)+250, [255, 255, 255] ) draw_line(screen, int(-250*x)+250, int(250*x*x*x)+250, int(-250*x1)+250, int(250*x1*x1*x1)+250, [255, 25...
aaa239bdf7e0f21c3b6976524901b1bc6bec0199
bmugenya/hillCypher
/encrypt.py
1,581
3.8125
4
class Cipher(): def __init__(self): self.keyMatrix = [[0] * 3 for i in range(3)] # Generate vector for the message self.messageVector = [[0] for i in range(3)] # Generate vector for the cipher self.cipherMatrix = [[0] for i in range(3)] # Following function generates the ...
05de4b1727fe44761f8ce6baf021e3d3bb0ffe54
StevenLOL/kaggleScape
/data/script758.py
33,841
3.546875
4
# coding: utf-8 # Through this notebook I will try to explore past incidents of Terrorist acts and will try to find out the reason behind these acts.<br> # What could be the reasons behind these acts ? # # CAUSES AND MOTIVATIONS # --- # Although people resort to terrorism for a number of reasons, experts attri...
bfd2b36071000ac3d4d69251e4a3d0105cee316e
Ron-Chang/MyNotebook
/Coding/Python/Ron/Trials_and_Materials/sameLetters_rearrange.py
1,087
4.1875
4
""" What is an anagram? Well, two words are anagrams of each other if they both contain the same letters. For example: anagrams('abba', ['aabb', 'abcd', 'bbaa', 'dada']) => ['aabb', 'bbaa'] anagrams('racer', ['crazer', 'carer', 'racar', 'caers', 'racer']) => ['carer', 'racer'] anagrams('laser', ['lazing', 'lazy', 'lac...
f15bbfbf6221e14d9ec7de42756020152cf3b2ad
alinanananana/-
/lab3-5.py
280
3.828125
4
surname = input() name = input() group = input() print('Привет,',surname, name,'из группы', group + '!') print('Введи свою электронную почту?') mail = input() print(surname.lower()[:5] + 2 * (name.lower()[:5]) + 3 * mail.lower()[:5])
e6854655aa70ddfc032152b3ff593b100e0a33d5
sarkarChanchal105/Coding
/misc/count-pairs-with-given-sum.py
1,529
4.34375
4
""" https://www.geeksforgeeks.org/count-pairs-with-given-sum/ Count pairs with given sum Last Updated: 04-06-2020 Given an array of integers, and a number ‘sum’, find the number of pairs of integers in the array whose sum is equal to ‘sum’. Examples: Input : arr[] = {1, 5, 7, -1}, sum = 6 Output : 2 Pai...
73d9e33c9f7503f43ca41c746183eb8b3c5b7984
hwakabh/codewars
/Python/7/DisemvowelTrolls/disemvowel_trolls.py
392
4.0625
4
import sys def disemvowel(string): vowels = ['a', 'A', 'o', 'O', 'i', 'I', 'u', 'U', 'e', 'E'] for v in vowels: if v in string: string = string.replace(v, '') return string if __name__ == "__main__": if len(sys.argv) == 1: inp = input('>>> Enter sentence to remove vowels:...
7c3ebbbcb2936e97d871248215d8fb91f4c37297
Dax246/FIT2004
/Assignment 4/assignment4.py
23,024
3.75
4
""" This file contains the functions that solve question 1 and 2 from FIT2004 Assignment 4. Graph class: Converts the vfile and efile into a graph that is stored using an edge list captured_chains: Function which solves question 1 DFS: Runs depth first search Terrain_pathfinding: Function which solves question 2 index...
165f5fca8fbbb15f7bc457355f8a9ee5bd37bddb
optionalg/crack-the-coding-interview
/queue-via-stacks.py
2,122
4.0625
4
class Stack(object): def __init__(self): self.stack = [] self.size = 0 def push(self, item): self.stack.append(item) self.size += 1 def pop(self): if self.size == 0: raise Exception('Stack is empty') self.size -= 1 return self.stack.pop(...
c66d2f77e6e6ed3af8b286f2815900e8f31daf9e
Loiser/homework-5
/binsearch_tree.py
3,997
3.78125
4
# -*- coding: utf-8 -*- """ Created on Thu Aug 15 18:48:05 2019 @author: 10539 """ class Node: def __init__(self,val): self.val=val self.left=None self.right=None class binsearch_tree: def __init__ (self,val): self.start=Node(val) def search(self,val): ...
4039c6d924d837a7b7ebb979c6d8a149237be1f2
joshuagato/learning-python
/DictionariesAndSets/Dictionaries2.py
867
4.46875
4
fruit = { "orange": "a sweet, orange citrus fruit", "apple": "good for making cider", "lemon": "a sour, yellow citrus fruit", "grape": "a small, sweet fruit growing in bunches", "lime": "a sour, green citrus fruit" } print(fruit) # ordered_keys = list(fruit.keys()) # Convert the dictionary keys ...
cd9c81a362625ea79bf5f8298c25c2b2b42df28e
zzgsam/python_practic
/practice1.py
402
3.9375
4
#Write a program that asks the user for a number(Interger) and prints the sum of its digits def ask_user(): num = input("Input a number") print(type(num),num) #type() returns the type of a variable #isinstance(a, int) returns true or false sum=0 for num_add in num:...