blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
462c7a3e142ff5aebef1a836b40aa38534f9913b
niloufar60/Reinforcement-Learning
/epsilon-greedy.py
1,619
3.75
4
import random import numpy as np import matplotlib.pyplot as plt def EpsilonGreedy(epsilon,values): """performs exploration/explitation input: int epsilon, array values output: int picked_arm """ sample=np.random.binomial(n=1,p=epsilon) if sample==1: picked_arm=random.choic...
7a3688c981736b81feaea08120880457a5f556a5
Thiagocaldeiraa/PYTHON---estudos
/EXERCICIOS/ex032 - Maior e Menor valores.py
498
4.125
4
num1 = int(input("Primeiro Valor: ")) num2 = int(input("Segundo Valor: ")) num3 = int(input("Terceiro Valor: ")) menor = num1 #Descobrindo o valor do menor número if num2 < num1 and num2 < num3: menor = num2 if num3 < num1 and num3 < num2: menor = num3 print("O menor valor é {}".format(menor)) maior = num1 #De...
a354a1b2d3b29851b451889175a1b6e4c8428c99
Victormbg/Python
/Programas com Tkinter/CadastroAluno/CadastroAluno - Cópia.py
3,753
3.65625
4
# Author: Victor Manuel # CadastroAluno from tkinter import * import sqlite3 ###TABELA### conn = sqlite3.connect("alunos.db") cursor = conn.cursor() def criarTabela(): cursor.execute(""" CREATE TABLE IF NOT EXISTS Aluno ( matricula INTEGER NOT NULL PRIMARY KEY, nome ...
d7c0ca12062bd02ab015be1e269cec844deb79ad
Person512/Guess_Who
/GuessWho.py
4,172
3.578125
4
import random peopleDictionary = { 'Alex': {'eyes':'brown', 'hair':'black ', 'glasses': False, 'gender': 'male'}, 'Alfred': {'eyes': 'blue', 'hair': 'red', 'glasses': False, 'gender': 'male'}, 'Sam': {'eyes': 'brown', 'hair': 'white', 'glasses': True, 'gender': 'male'}, 'Anita': {'eyes':...
94afd4a3b2e0a7bdb08dd914968e8b32ee806b1c
Pyk017/Competetive-Programming
/GFG/Arrays/Implement two stacks in Array/solution.py
2,098
3.515625
4
''' Input Format: First line contains an integer Q denoting the number of queries . A Query Q is of 4 Types (i) 1 1 x (a query of this type means pushing 'x' into the stack 1) (ii) 1 2 (a query of this type means to pop element from stack1 and print the poped element) (iii) 2 1 x (a query of this typ...
41840fbf9153a92be5fc8d0342efff7e0ad27de3
Iqrar99/Project-Euler
/problem27.py
774
3.609375
4
""" Bruteforce! """ def checkPrime(x): if x < 2: return False else: for i in range(2, int(x**0.5) + 1): if x % i == 0: return False return True def main(): max_a = max_b = -1000 total_max = -1 for a in range(-999, 1000): for b in range(-999...
a29e3ec24005e84403013dd3cde4d94f3249e16c
tjwilli6/ENGR_2310
/private/labs/lab7/q2.py
162
4.3125
4
PI = 3.14 def calc_area(radius): result = PI * radius**2 return result r = float(input("Enter the radius: ")) calc_area(r) print("The area is",result)
aac5e30e1e32bee8c0cf54ad76f7a11e26bf0f9c
ckeller191/OOP
/Insect Random Flight.py
435
3.671875
4
import InsectClass as c def main(): my_insect = c.Insect(2, 4, 0) # numbers as parameter b/c add w,l,f to init function in class code my_insect.flight() # can also just call flight fuction in print statement print("The miles this insect can fly is:", my_insect.get_flight()) print("The inse...
9b8ccb8c0a4361aab5772a0cb40f45cd4317b0f4
sigurdmm/mazesolver
/src/parse_maze.py
1,516
3.5625
4
from node import Node from main import start_symbol, goal_symbol, wall_symbol #import main def file_loader(file_path): """ :param str file_path: File path to open :return: List of each row with symbols of the file opened :rtype: list(list(str)) :raises IOError: On exception from opening file at fil...
96bc505a8bdefd12e9a8c8d375756a5b1bb8fe68
jakesciotto/jhu
/en605.649/pa3/id3.py
8,548
3.6875
4
# ----------------------------------------------------------- # id3.py # # Jake Sciotto # EN605.649 Introduction to Machine Learning # Johns Hopkins University # Fall 2020 # ----------------------------------------------------------- from math import log from collections import Counter from pprint import pprint TRE...
979d25048d545e9db83b79197ecf2fdfdeec5e47
judy2k/everything_about_functions
/80_scope.py
1,444
3.59375
4
USE_HTTPS = True # Reading a global variable in a function is fine: def using_https(): return USE_HTTPS print(using_https()) ALLOWED_DOMAINS = [ ".europython.eu", ".ninjarockstar.guru", ] def add_allowed_domain(domain): ALLOWED_DOMAINS.append(domain) # Setting a global variable is **not** fine...
9f6ada398fa21d98c0b7e6f77ddc06548bba2735
DianaBonilla/taller1
/Button_Label-HernandezDavid.py
961
3.75
4
from tkinter import * print("David Hernandez") def despedida(): lblSaludar=Label(ventana,text="Adios "+ entradaN.get(),font=("Agency FB",14)).place(x=10,y=140) def saludar(): lblSaludar=Label(ventana,text="Hola "+ entradaU.get(),font=("Agency FB",14)).place(x=10,y=110) ventana= Tk() ventana.geometry("500x300+1...
e8b62672b67a80331c5c199fe6fd8706aeea94bf
Mayzum/Taekookie
/Examen/ejertres.py
502
3.546875
4
def VacunacovidNMVA(): str tipoA=int(0) tipoB=int(0) tipoC=int(0) for x in range(0,1): edad=int(input("ingresar la edad:")) sexo=int(input("ingresar el sexo >>[1:varon;2:mujer]:")) if (edad>70) : print("se aplicara la vacuna tipo C") tipoC=tipoC+1 if (edad>15 and edad <70 and ...
1d46430aa242a6734c41effd266f039b6c31da9e
devAmoghS/Python-Programs
/matrix creation with dictionary.py
519
3.859375
4
final=[] r= int(input("enter the no. of rows:")) c=int(input("enter the no. of columns:")) for i in range (r): l=[] for j in range(c): e=int(input("enter the value for [%d ][ %d]:"% (i+1,j+1))) l.append(e) final.append(l) for i in range(r): s=str(final[i]) pr...
91cc24418669929c499edf425f50535981a8e1c2
akinresul/binarytogray
/binarytogray.py
763
3.78125
4
# kullanicidan alinan 10 luk tabandaki sayiyi ikilik tabana ve daha sonra gray koduna donusturen program dec=input("Onluk tabanda bir sayi giriniz\n") def decimaltobinarytogray(dec): binary=[] while (dec>0): binary.insert(0,(dec%2)) dec=dec/2 gray=[] gray.append(binary[0]) #binary'nin en anlamli biti eklenir ...
eca04475650aaca6e26eb64a499e044961b44f0e
bhavinthetechguy/CS417-ServerClient
/TCP_client.py
3,378
3.546875
4
'''import socket serverName = '' serverPort = 12000 #addresses of the server s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) s.connect(('', serverPort)) #making socket and handshaking with the server sentence = input("Input lowercase sentence:") s.send(sentence) #taking input and sending it to the server sock...
740df80a411dced564538e03f010903368252b97
DanPsousa/Python
/Questao 16.py
229
3.6875
4
valor=float(input("Digite o valor:")) taxa=float(input("Digite a taxa: ")) tempo=int(input("Digite o tempo em valor de meses:")) resultado=valor+(valor*(taxa/100)*tempo) print("O valor desta prestação em atraso é:",resultado)
e1c302f8a1d2d461cf2123e61d84e0d1c9f67c12
311210666/Taller-de-Herramientas-Computacionales
/Clases/Programas/grados.py
967
3.859375
4
#!usr/bin/python2.7 # -*- coding: utf-8 -*- def listaC(Cmin, Cmax, n): gradosC = [] #Es porque tenemos que hacer una lista vacía para referenciarla después "Ejemplo ciencia básica" # for (i=0; i<n; i++) en ptros lenguajes porque es una lista dC = (Cmax - Cmin)/float (n-1) for i in range(n): C =...
11987d50d11354cd8d9c8e77b76e7befab15fb46
bubnicbf/Physics-Libraries
/Statistics/questions.py
2,284
3.640625
4
import numpy as np import matplotlib.pyplot as plt from scipy.optimize import least_squares as lsq """ Question: Let R(n) be a random draw from [0, n-1]. What is the EXPECTED number iterations of R(n) needed to reach 0, if we start at 10^100 """ def R(n): new_n = np.random.randint(0, n) return new_n def ite...
edaeefc7f05a9bcfbafaa7086f83c6b8a41c3619
nikorose87/DJS-analysis
/curvature.py
9,230
3.5625
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- """ Created on Thu Apr 26 15:08:34 2018 From Jaime of Stackoverflow Script to smooth the data and for detecting the highest curvature @author: nikorose """ # ============================================================================= # If your curve is smooth enough, you...
d2a0fe9408caa3c37f90917d94fcb5e38ceb0540
etschmidt/python
/assignment2.py
4,957
4.71875
5
# Intro to Programming Using Python - Assignment #2 # Completed by: Ethan T. Schmidt # 1. Create three dictionaries: # - Each one will contain information about a particular student: Steve, Alice and Tyler # - Give each dictionary the keys 'name', 'homework', 'quizzes', and 'tests' # - Set the value of the 'nam...
e81f0a972c2a9ba64bdccfce191f088691afd986
samir571/pythonProject
/palindrome.py
143
4.09375
4
a = (input('enter a word')) b = a[::-1] if a == b: print(a, 'is a palindrome') else: print(a, 'is not a palindrome') print('hi')
4589fe72c7ef370e717e15e49d42c884a44ecc24
dazzeew/Summer2021
/vector_fib.py
389
3.765625
4
class fibo: a = [] def fibonacci(self,number): if number == self.a[0]: return 0 if number == self.a[1]: return 1 while (len(self.a) <= number): self.a.append(self.a[len(self.a) - 2] + self.a[len(self.a) - 1]) return self.a[number] if __name__ == '__main__': fib = fibo() number = in...
336749fe223f1a49376d58438c331d42f76a251a
hannesmoestl/test
/Aufgabe 5.py
1,301
4.0625
4
#Erweitern sie das Wörterbuch beispiel um die möglichkeit, Einträge zu ergänzen bzw. zu löschen woerterbuch_deutsch = ["Apfel", "Birne", "Kirsche", "Melone", "Marille", "Pfirsch"] print(len(woerterbuch_deutsch)) woerterbuch_english = ["apple", "pear", "cherry", "melon", "apricot", "peach"] Wort = input("gibt ein ...
8f1b5147d43e2e3a636a860aa91ecfc234e1b012
JustinSDK/Python35Tutorial
/samples-labs-exercises/samples/CH12/pdb_demo/filter_demo2.py
429
3.859375
4
def filter_lt(predicate, lt): result = [] for elem in lt: if predicate(elem): result.append(elem) return result def len_greater_than(num): def len_greater_than_num(elem): return len(elem) > num return len_greater_than_num lt = ['Justin', 'caterpillar', 'openhome'] print...
bc53de626f4de40b5054f8bc91d35c4ed9032065
rohitjain994/must_do
/Tree/construct-all-possible-bsts-for-keys-1-to-n.py
2,326
3.953125
4
# Python3 prgroam to contrcut all unique # BSTs for keys from 1 to n # Binary Tree Node """ A utility function to create a new BST node """ class newNode: # Construct to create a newNode def __init__(self, item): self.key=item self.left = None self.right = None # A utility function to do preorder # traversal...
76335b778f5591804e2a583cc59a13da7de86db3
ronaldhuamani/examenpithon5ejercicios
/examen/examen3.py
820
3.9375
4
def tipovacunaFRH(): #datos de entrada print('tipos de vacuna A,B,C:') print() print(""" Menu: Seleccione una opcion 1. si es mayor a 70 años ya sea mujer o hombre 2. si tiene entre los 16 a 69 años si es mujer 3. si tiene entre los 16 a 69 años si es hombre 4. si tiene menor de 1...
b64cb91b30ce6de25ca90a9080eab0676eda8db2
1399959932/python
/day3+4.py
4,547
3.890625
4
# C:/Users/JK-chenxs/AppData/Local/Programs/Python # python内置数据类型: # 列表:list是一种有序的集合,可以随时添加删除其中的元素 优点:方便操作 # classmates = ['Micheal','Bob','JK-chenxs'] # classmates # len(classmates) # php的数组array 相似与 python的列表list # len()返回容器中的项数 我理解为长度或者是个数 # classmates[0] # -1可以取最后一个元素,以此类推 # list操作方法 ,以下 'var' = '变量'' ,p...
2a7cb0cb80e8207467f586bcba29401ed2e71840
Romumrn/Pipeline_variant_RDP
/script/.docker_modules/csv_checkdesign_python/0.0.1/check_design_chip_quant.py
2,465
3.65625
4
#!/usr/bin/env python3 import sys design=sys.argv[1] ## input csv file design_checked=sys.argv[2] ## output csv file: same as design input but make sure there is no space in the row ## avoid error in nextflow process def csv_parser(csv, csv_out): ERROR_STR = 'ERROR: Please check de...
ed0d77d1912709ea035b23facf3538655a0f729d
computingForSocialScience/cfss-homework-cicconea
/Assignment7/fetchArtist.py
1,358
3.734375
4
import sys import requests import csv import json """Using the Spotify API search method, take a string that is the artist's name, and return a Spotify artist ID. """ def fetchArtistId(name): fullname = name.replace(" ", "%20") header = "https://api.spotify.com/v1/search?q=" url = header + fullname + "&type=artis...
adadfe9da8bc08f0ab58b32941d50e8d3a784f67
kobi485/2020expires
/test/ex/ex.3.py
51
3.703125
4
name=input('enter name:') print(name[:3]+name[-3:])
6decd70889dea4958f24fbf318428319ab50e03d
SumMuk/data-struct-algo
/splitString.py
303
3.703125
4
def balancedStringSplit(s): count=0 balance=0 for i in s : if i == "R" : balance+=1 if i == "L": balance-=1 if balance == 0 : count+=1 return count print(balancedStringSplit('RRRLLLL'))
101496be945ed02112a162d630f6879585d4241e
richardgzy/MyPythonCode
/test/three_door_problem.py
812
3.59375
4
''' Created on Feb 28, 2017 @author: Richard's Surface ''' import random # 0, 1, 2 represent three doors total = 100000 bingo = 0 bingoed_and_win = 0 not_bingoed_and_win = 0 for i in range(total): my_choice = random.choice([0, 1, 2]) car = random.choice([0, 1, 2]) switch = random.choice([True, False]) ...
c3360ecf5127fb7d6d3059fc4b9f8c707354d7d1
Zhaokun1997/UNSW_myDemo
/COMP9021/COMP9021_practice/practice_6/sum_of_digits_test.py
1,261
3.53125
4
import sys from itertools import combinations def solve(available_digits, desired_sum): if desired_sum < 0: return 0 if available_digits == 0: if desired_sum == 0: return 1 return 0 return solve(available_digits // 10, desired_sum) + solve(available_digits // 10, ...
546d8b831b89bb4dd30f805828d245557f2009c8
a49a/MassacreLeetCode
/src/110.py
1,169
3.65625
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None import sys class Solution: def __init__(self): self.min_depth = sys.maxsize self.max_depth = 0 def isBalanced(self, root): """...
044e8946c2a345836bdb95073dd30fc14859e900
deno101/Job_Challanges
/test_1.py
358
3.984375
4
def main(): for x in range(1, 100): divisible = False if (x % 3 == 0): divisible = True print("Open", end="") if (x % 7 == 0): divisible = True print("Source", end="") if not divisible: print(x, end="") print("") ...
189832b98334df840bd7b93a354468ca9f6f1997
vovikhangcdv/review-pttkgt
/GraphColoring.py
1,237
3.859375
4
#!/usr/bin/env python3 def GraphColoring(): print("Input each edge in form: <u> <v>, empty line to break") nEdge = 0 AdjList = {} while True: nEdge += 1 L = input("Edge {}: ".format(nEdge)).strip() if len(L) == 0: break u, v = L.upper().split(" ") if...
0bbd4f8c0ca7ab0599dbf6446986f6cd29cd8e6c
mooja/dailyprogrammer
/challenge172easy.py
1,045
3.734375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # Daily Programmer Challenge 172 Easy # # https://www.reddit.com/r/dailyprogrammer/comments/2ba3g3/7212014_challenge_172_easy/ # # February.23.2016 def parse_alphabet(): alphabet = {} with open('font.txt', 'r') as f: lines = f.readlines() while l...
7dd572e490c6ffb1cd3141374cae59d7c0d4d3af
13598695342/test
/fan1/判断三角形.py
939
3.84375
4
#!/usr/bin/python #-*- coding:utf-8 -*- # a=int(input('请输入')) # b=int(input('请输入')) # c=int(input('请输入')) # if (a+b>c) and (a+c>b) and (b+c>a): # if (c*c>b*b+a*a) or (a*a>b*b+c*c) or (b*b>a*a+c*c): # print('钝角三角形') # elif (a*a+b*b==c*c) or (a*a+c*c==b*b) or (b*b+c*c==a*a) : # print('直角三角形') # ...
5dc32a463b348ef1a3126bd922088786ee7ae735
yunse2633s/blogsSj
/python_demo/201811/turtle_demo.py
644
3.578125
4
# 导入turtle包的所有内容: from turtle import * # 设置笔刷宽度: width(4) # 前进: forward(200) # 右转90度: right(90) # 笔刷颜色: pencolor('red') forward(100) right(90) pencolor('green') forward(200) right(90) pencolor('blue') forward(100) right(90) # 调用done()使得窗口等待被关闭,否则将立刻关闭窗口: # done() # up() left(45) fd(50) down() s = Shape("compou...
05708aeee60711c50defd6bb4f4568219deeabf6
tahniyat-nisar/while-loop-meraki
/average of 11 inputs is mutiple of 5 or not.py
217
3.921875
4
count=1 sum=0 while count<=11: n=int(input("enter weight in kg:")) sum=sum+n count=count+1 sum=sum/11 print(sum) if sum%5==0: print(sum,"=mutiple of 5") else: print(sum,"is not multiple of 5")
fcc26e3fda4af76a0cf2be4763b3cc3a47f691d0
mi6eto/SoftUni
/Python_advanced/03.periodic_table.py
216
3.65625
4
lines = int(input()) chemical = set() while lines: command = input().split() for el in command: if not el in chemical: chemical.add(el) lines -= 1 for el in chemical: print(el)
ef2782c7392142b576d4f78a50be3ffe389c066d
Nisar-1234/Data-structures-and-algorithms-1
/Trees/Bottom view Tree.py
1,712
3.75
4
class BinaryTree(): def __init__(self,data): self.data = data self.left = None self.right = None def bottomView(root): hd = 0 dict1 = {} result = [] dict2 = getverticalOrder(root,hd,dict1) for key in sorted(dict2.keys()): items = dict2[key] r...
6f6457e6cc3ce6b682dc904eda5a0301b7184539
JSantosha/LeetCode-Python
/Bit Manipulation/461 - Hamming Distance.py
642
3.5
4
class Solution: def hammingDistance(self, x, y): """ :type x: int :type y: int :rtype: int """ return bin(x ^ y)[2:].count('1') # a = list(bin(x)) # b = list(bin(y)) # del a[1] # del b[1] # al = len(a) # bl = len(b) # ...
c66f0701e586007517441a17d3cf4983cdfeeea0
aralyekta/METU
/CENG111/q4/deriv.py
713
3.796875
4
def power_derivative(term_str,der_var): var = term_str[:term_str.find("^")] exp = term_str[term_str.find("^")+1:] if not der_var == var: return 0 if exp.isdigit(): if int(exp) == 0: return 0 if int(exp) == 2: return exp + var elif int(exp) == 1: ...
352a0d63e94154c386d609b8c176294059bf4472
beanyjells/cs50-problem-sets
/sentimental/bleep.py
999
3.921875
4
import sys from cs50 import get_string from sys import argv def main(): if len(sys.argv) != 2: sys.exit("Usage: python bleep.py dictionary") return 1 else: infile = sys.argv[1] # initialise a dictionary set and add all the words from the inputted text file to it diction...
f745d2416dc8346d59ce39e5c0d9eb61120a3e0d
MiniBee/PythonCore
/list/queue.py
854
3.828125
4
queue = [] def en_it(): queue.append(raw_input('Enter new string: ').strip()) def de_it(): if len(queue) == 0: print 'Cant not pop from an empty queue!' else: print 'Removed' + queue.pop(0) def view_it(): print queue CMDs = {'e': en_it, 'd': de_it, 'v': view_it} def show_menu()...
1f8b0e75750ca181f2bd4143719d6be3b0ccb01e
Reshma-Elizabeth/Python
/python_sol/problem_set2/2_2.py
354
3.78125
4
''' Name:Reshma Description:prob set 2 Question no:2 ''' from __future__ import division try: def is_power(a,b): d=a/b if((a%b==0)&(d%b==0)): print "true" else: print "false" a=int(raw_input("enter a number")) b=int(raw_input("enter another number")) is_power(a,b) ...
e292eb6608eb9c2ed4b1da16537a7b3aa985562d
sravi97/I210_Information_Infrastructure1
/quiz3.py
122
3.84375
4
words = ["life", "is", "trying", "things", "to", "see", "if", "they", "work"] for i in range(len(words)): print word
a5fcc1986f12a7a68664166a64a8faeeca7b46f3
marumuji/self-taught
/chap21/Stack.py
743
4.15625
4
class Stack: def __init__(self): self.items = [] def is_empty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): last = len(self.items) - 1 return self.items[l...
27ee474851be441ad099fe9feed905fc042dfb7e
efaro2014/Dojo-Assignments
/python_stack/python/oop/user_oop.py
999
3.765625
4
class User: def __init__(self, name, email): self.name = name self.email = email self.account_balance = 0 def make_deposit(self, amount): self.account_balance += amount return self def make_withdrawal(self, amount): self.account_balance -= amount retu...
f194aff2ad9c36450b4b6b0fe9bc9044d61ec8c6
rransom96/mystery-word
/mystery_word.py
4,115
3.6875
4
import random import re def space_remover(phrase): """ Removes the punctuation from the string""" return re.sub(r'[^A-Za-z\n]', "", phrase) def easy_words(word_list): easy_words = list(filter((lambda words: 4 <= len(words) <= 6), word_list)) return easy_words def mediu...
035e5ba36bfcb82b444e78e55a80bc4c30a0b5a5
PavanGupta01/pythonTraining
/scope/scope_eclosing.py
543
3.578125
4
__author__ = 'pavang' __Date___ = '' X = 10 # Global scope name: not used def f1(): # global X # X = 20 # Enclosing def local def f2(): nonlocal X # global X X = 30 print('f2: ' + str(X)) ...
8e518fd25fd03f707dedcdc78b36459ce7356759
surmayi/SuperThirty
/PreCourse-2/Exercise_2.py
928
4.09375
4
# Python program for implementation of Quicksort Sort # give you explanation for the approach def partition(arr, low, high): pivot_ind=low pivot = arr[pivot_ind] l= len(arr) while low<high: while low<l and arr[low]<=pivot: low+=1 while arr[high]>=pivot: ...
b03fa64bdc64c63b361bdf4cbdda383efdcdb774
Raahul46/ml-lite
/Python-Tutorials/exercises/parking_lot.py
1,909
3.78125
4
class vehicle: def __init__(self,vehicletype,vehicleid): self.vechicletype=vehicletype self.vechicleid=vehicleid self.lot=0 def allot(self,numV,dict,v,list1): if (self.vechicletype == "big"): if list1[v]>16 : dict[self.vechicleid] = list1[v] ...
add6126e0ddf3b9047224e98daeaf5d321404dea
Ab2207/Python-Projects
/Rock Paper Scissors (Human vs Computer).py
1,438
3.953125
4
from random import randint choice = ["rock", "paper", "scissors"] computer = choice[randint(0,2)] human = False def rps(computer, human): while human == False: human = input("Rock, Paper, Scissors, Shoot! ").lower() if computer == "rock": #Use case Rock if hum...
d61d488b466a01cbe23feb129b09734bfaca759c
michaelvargasloza/Python-Programacion-estructurada-python-desde-cero-
/Ej7.py
316
3.546875
4
#Retorno de lista def cargar_lista(): li = [] for x in range(5): valor = int(input("Introduce un valor: ")) li.append(valor) return li def imprimir_mayor(li): print("Valores de la lista mayores a 10: ") for x in range(len(li)): if li[x] > 10: print(li[x]) lista = cargar_lista() imprimir_mayor(lista)
f6c82f0a0fa48dde7352874a189ba378f3fb169c
lobo0616/bysj
/examples/1827405166.py
963
3.6875
4
# 学号:1827405166 # 姓名:王泽洲 # IP:192.168.157.166 # 上传时间:2018/11/12 15:17:52 import math def func1(a,b): if b > a: for i in range(a + 1, b + 1): a = a * i j = 0 count = 0 while j >= 0: if str(a)[-1 - j] == '0': count += 1 ...
a616ed3e94736076ef2f74aabf2657a22887b478
ccbrantley/Python_3.30
/Strings/alphabetic_telephone_number_translator/alphabetic_telephone_number_translator.py
1,144
4.03125
4
#alphabetic telephone number translator def main(): number = get_input() translate(number) def get_input(): return str(input('Enter telephone number (###-xxx-xxxx): ')) def translate(number): ran_accum = 0 strip = number.split('-') txt_num = {'A': '2', 'B': '2', 'C': '2'...
3ce401066f974b249c2953ae53f893123aea1d4a
alvas-education-foundation/CSE-JayrajShah-4AL17CS036
/coding_solutions/17-06-2020 TCS MockVita'20/PrimeFibonnaci.py
1,726
3.84375
4
# checking a number is prime def isPrime(n): if n == 2 or n == 3: return True if n % 2 == 0 or n < 2: return False for i in range(3, int(n**0.5)+1, 2): if n % i == 0: return False return True # function to generate combination def createCombination(lst): c...
2a12575932dc8a80bd3aab747a01baf67135de53
Retardeded/LilPy
/fib_dynamic.py
407
3.5625
4
import time def fib(n, tab): if(len(tab) > n): return tab[n] else: tab.append(fib(n-2, tab) + fib(n-1, tab)) return tab[n] tab = [0, 1] print("Podaj numer wyrazu ciągu fib") number = int(input()) start = time.time() value = fib(number, tab) print(str(number) + " wyraz ciagu wynosi: " +...
69a25da73819c93286d15df148ae237adc2e6e40
shreyjindal81/CSE-331
/CC3/solution.py
993
3.984375
4
""" Name Coding Challenge 3 CSE 331 Spring 2021 Professor Sebnem Onsay """ from typing import List def finding_best_bot(bots_list: List[int]) -> int: """ finds the index of the bot where the salmonid defeat count stopped increasing in the given python list. INPUT : the list of integers to be examined...
f29c94e2d6cdbe2ef77c321865e00b658d7c9dd2
changhyunbaek/assignments
/readwrite.py
417
3.96875
4
# # Reading a text file # with open('myfile.txt') as f: # full_text = f.read() # print(full_text) # # Writing a text file # with open('testwrite.txt', 'w') as f: # f.write('hello') # f.write('\n') # Reading name text file with open('name.txt') as f: name = f.read() # Writing hello text file with ...
d855f8276c4cfafbe89d6e6c6d3bcc803f90c1fa
MichaelJFlynn/ants
/Mike/MikeBot.py
20,513
3.875
4
#!/usr/bin/env python from ants import * import util import sys import logging import time # define a class with a do_turn method # the Ants.run method will parse and update bot input # it will also run the do_turn method for us class MyBot: def __init__(self): # define class level variables, will be reme...
c16f8613e5323b8230b98b7f3aedf6c106632565
deanf1/RSA-Project---Cryptology
/fleming.py
6,665
3.71875
4
""" Dean Fleming <deanf1@umbc.edu> CMSC 443-01 RSA Project Encrypts and decrypts messages using the RSA cryptosystem Notes: - My code will remove all whitespace from inputted plaintext messages - I tested this with several messages and it worked for every one - I tested my Miller-Rabin prime-finder with smaller si...
33f8db34be134cd9215abec236e1942752d10dbd
khans/ProgrammingAndDataStructures
/object_oriented/assertionExample.py
311
3.859375
4
class Fraction: def __init__(self,num,den,love): assert type(num) == int and type(den)==int self.num = num self.den = den assert type(love) == str self.love = love def __str__(self): return str(self.num)+"/"+str(self.den) + self.love f = Fraction(3,4,90) print(f)
e260d04de7241c83693ad0c3dcddcb978de6a118
zc78520/python-learn
/02_input.py
161
3.703125
4
#!C:\Users\huiqi\AppData\Local\Programs\Python\Python36-32 name=input('please input your name') print('hello,'name) #use input to input your name,then print it
bd7ef1e3687e6bbf74042b7c6c633d8dc9daa9c1
sivinnguyen/CS50x
/2020/pset6/dna/dna.py
490
3.8125
4
from sys import argv, exit import csv def main(): if len(argv) != 3: print("Usage: python dna.py data.csv sequence.txt") exit(1) # argv[0] is the name of program (dna.py) db_path = argv[1] seq_path = argv[2] # load database from file to memory with open(db_path, newline='') a...
6ae17d670b43bb8341186f77d017bc3772679a8b
B-Ricey763/VSA-2018
/proj04_lists/proj04.py
1,953
4.1875
4
# coding=utf-8 # Name: # Date: """ proj04 practice with lists """ #Part I #Take a list, say for example this one: a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] new_list = [] #and write a program that prints out all the elements of the list that are less than 5. """for change_item in range(len(a)): if a[change_it...
5167c3d81314790315aff0d653bf28df4d2bbf68
alphabet-al/Codingame
/Dungeons_and_Maps/solution.py
1,598
3.5625
4
def move(val, cr, cc): if val == '^': cr = cr - 1 elif val == '>': cc = cc + 1 elif val == '<': cc = cc - 1 elif val == 'v': cr = cr + 1 return cr, cc def traverse(map, r, c, visited): count = 0 cr, cc = r, c if (cr,cc) not in visited: visited....
cca29ac416909a487e86c572a1390fca7ff0ea4e
NiuNiu-jupiter/Leetcode
/Premuim/266. Palindrome Permutation.py
602
3.953125
4
""" Given a string, determine if a permutation of the string could form a palindrome. Example 1: Input: "code" Output: false Example 2: Input: "aab" Output: true Example 3: Input: "carerac" Output: true Accepted 76,465 Submissions 125,603 """ class Solution: ...
ba2d38f492ba13678372b6aeb068b1bb5fdc02af
over-cart/backend-side
/test.py
379
3.75
4
def listToNum(numList): num = 0 for i in range(0,len(numList)): if numList[i] > 255: numList[i] = 255 elif numList[i] < 0: numList[i] = 0 num += numList[i] << 8*i return num def numToList(num,size=16): l = [] mask = 0xFF for i in range(0,size): l.append(int((num & (mask << 8*i)) >> 8*i)) return l ...
a1674daccb2787dc99f0f209d68f52bab50c747a
siimveske/hack-this-site
/unscramble-words/src/test_duplicates.py
411
3.6875
4
with open("book.txt") as f: book = f.read().split() sortedBook = [''.join(sorted(line)) for line in book] uniqWords = set() duplicates = [] for word in sortedBook: if word in uniqWords: duplicates.append(word) else: uniqWords.add(word) if(len(duplicates) > 0): print "Dup...
9bac165365cc681143ce5ac299cc5a3edee02c44
caoxp930/MyPythonCode
/数据结构_python/自写排序算法/归并排序.py
1,645
3.984375
4
# -*- coding: utf-8 -*- def merge_sort(alist): # 判断传入的数组长度是否小于1,如果是返回该数组 if len(alist) < 2: return alist mid = len(alist) // 2 # 获取中间值 # left_li,right_li:采用归并排序后形成的新的有序的列表 left_li = merge_sort(alist[:mid]) right_li = merge_sort(alist[mid:]) # 下面是将两个数组合并成一个新的数组 left_pointer ...
2e8e11bd2836f926f5d7465352aa7e80312adaab
dnootana/Python
/Interview/hackerrank/removevowel.py
1,020
3.875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Jun 8 17:33:31 2021 @author: dnootana """ def disemvowel(string_): return string_.replace('a','').replace('e','').replace('i','').replace('o','').replace('u','').replace('A','').replace('E','').replace('I','').replace('O','').replace('U','') def ...
8be28113a6db73ea59ff3bb5592cf02c48d5b4a6
starmap0312/refactoring
/moving_features_between_objects/remove_middle_man.py
1,483
4.40625
4
# - if a class is doing too much simple delegation, and you get a lot of delegating methods, # then get the client to call the delegate object's methods directly # - advantage of hide delegate(encapsulation): remove dependencies, make extension easier # - disadvantage of hide delegate(encapsulation): whenever you wan...
1e49bca137ca23bc3bfa525f752d487c4fffbefc
JLiss13/OfficeScripts
/ModifyFilesinDirectory/Suffix_Currcon.py
1,731
3.5625
4
#Created by Jordan Liss # Create suffix to order the files according to their respective sheet number import os FolderPath=input("What directory are you working in?(Put input in single quotes)") # Must input a string with apostrophes print FolderPath Begin=input("What is the number of the first file you want to modify?...
59c33359f47d088b7b589faa9ba89145bf26e39a
Rpifer/ProjectEuler
/Problems/Problem2.py
784
3.921875
4
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. # By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, # find the sum of the even-valued terms....
f0290c7ec4680b2c239d8ca9381b2f24f4c1d5af
ams-bjones/alg1-c2
/minmax.py
608
3.8125
4
def mini(inList): answer = None for item in inList: if answer == None: answer = item if item < answer: answer = item return (answer) def maxi(inList): answer = None for item in inList: if answer == None: answer = item if item > ans...
ac24953e2ca63844c2387010a718f894e1c72e83
SebastiGarmen/checkout
/colecciones.py
811
3.6875
4
# -*- coding: utf-8 -*- batch_13 = ["Alejandro", "Frank", "Sebastian", "Nelly", "Cynthia"] batch_14 = ["Pedro", "Juan", "Bruno", "Veronica"] elementos = ["Aire", "Tierra", "Fuego", "Agua"] #las listas son objetos iterables for alumno in batch_13: print(alumno) for alumno in batch_14: print(alumno) #range...
a652d39073622011cbea6dbf24ea20f5dc53b1bd
dolv/PythonLearning
/lab7_3_SuperStr.py
1,170
3.859375
4
class SuperStr(str): def is_palindrom(self): l = len(self) - 1 for i in range(int(l / 2)): if self[i].lower() != self[l - i].lower(): return False return True def is_palindrom(self): return self.lower() == self.lower()[::-1] def is_repeatance(se...
b3214fb749cbcb85eaed398b6549cfedf6714502
nakov/Python-Course-SoftUni
/OurTasks/03/08/08.py
390
3.90625
4
a = str (input ()) if a == "0": print ("zero") elif a == "1": print ("one") elif a == "2": print ("two") elif a == "3": print ("three") elif a == "4": print ("four") elif a == "5": print ("five") elif a == "6": print ("six") elif a == "7": print ("seven") elif a == "8": print ("eigh...
725a0a9d585911bd9c76a616d7413fd07c5d4d25
tovarish-kapitan/cow006
/cow006_player.py
2,110
3.5
4
from abc import ABCMeta, abstractmethod from cow006_table import Table from cow006_container import Container from cow006_hand import Hand class Cow006Player(metaclass=ABCMeta): def __init__(self, name): self.name = name self.hand = Hand() self._score = 0 def __repr__(self): ...
027d48a895ec01a780cbdac5e1fe8999becc67dc
kgarofali/astr598
/Homework/kristengarofali_hw5/priorityqueue.py
1,699
3.8125
4
from __future__ import print_function import sys import numpy as np class PriorityQueue: def __init__(self, N=0,MAX=100, a=[0]): self.N = N self.MAX = MAX self.a = a def insert(self, i): if self.N >= self.MAX: print("Size greater than array max") sys.e...
79f77eccf5721d830b93b7e0ba982b21b4dc6e4a
omerdagistanli/BTK_Akademi_Sifirdan_Ileri_Seviye_Python_Programlama
/3-Python Fonksiyonlar/1.1-Fonksiyon Parametreleri.py
676
3.78125
4
# n burda parametre olduğu için değişim olmadı, değişkenin kopyası göndereliyo def changeName(n): n = "Ahmet" name = "Ömer" changeName(name) print(name) # n dizinin adresini barındırdığı için değişim oldu def change(n): n[0] = "istanbul" citys = ["ankara", "izmir"] change(citys) print(citys) ...
632f063221e735d20ced4542ab73078344a2c93e
FariaZohora/Guess2digitGame-Python-
/main.py
921
3.703125
4
### Bulls and Cows game ### import random import time print("Welcome to Bulls and Cows game" "\nB stands for number in correct place" "\nC stands for number in wrong place") random_int = random.randint(11,99).__str__() frandom = random_int[0] srandom = random_int[1] while True: guess_int = int(input(...
b80398b06a8b5a9ed7a810f17d9affc0c13804ba
CaiNowicki/lambdata-cainowicki
/build/lib/lambdata_cainowicki/helper_test.py
683
3.609375
4
from helper import null_check from helper import parse_dates import unittest class HelperTest(unittest.TestCase): def test_parse_dates(self): data = [['1982-06-13']] test_df = pd.DataFrame(data, columns=['Date']) new_df = parse_dates(test_df, 'Date') self.assertTrue(new_df.columns...
383fa9f27dfacbcc42914a741275071c7c645017
YaoJMa/CS362-HW7
/leapyear.py
138
3.6875
4
def LeapCalc(year): if year%4 == 0 and (year%100 != 0 or year%100 == 0 and year %400 == 0): return True return False LeapCalc()
c40a44ab15b243b524ed29aea022d9ce65e24372
ga02/kmove_python
/basic/for_test.py
219
3.9375
4
for i in range(2,10) : for j in range(1,10): print("%d * %d = %d" %(i,j,i*j)) print() for i in range(1,10) : for j in range(2,10) : print("%d * %d = %-2d "%(j,1,i*j),end='') print()
851a28d8e1750bfece0545ae7fe76c41e2e007f6
trevorw22/Sentiment-Analysis-Scripts
/nltk/chunking.py
1,836
4.03125
4
# First we want to know who or what the sentence is talking about, the named entity in the context, which is generally just a noun (a person, place or thing) # Second step finding words that modify or affect that noun. We might have many named entities in the same sentence which is why we need chunking # ex. Apple rele...
6a45c5c1fdc8fb5ca10a4d745d76d92955607c50
bekbossyn/problemset
/codeforces/round_39_div_2/task_c/main.py
759
3.515625
4
# TaskC text = input() current = 0 my_alphabet = "abcdefghijklmnopqrstuvwxyz" solved = False begin_text = "" end_text = "" for i in range(len(text)): # new_text += text[i] if current > 25: print(begin_text + my_alphabet + end_text) # print(my_alphabet) solved = True break ...
b8488c93c44849c3dec0aae3e8e2d66201aaa89f
patricrp/pandasbasics
/Jeopardy.py
946
3.90625
4
import pandas as pd df = pd.read_csv('jeopardy.csv') print(df.head()) df = df.rename(columns={' Air Date': 'Air Date', ' Round ': 'Round', ' Category': 'Category', ' Value': 'Value', ' Question': 'Question', ' Answer': 'Answer'}) print(df.columns) words = ["King", "England"] #Filter DataFrame by words in df['Questi...
af440c379927b53f17e1c8fcd15572fb60b93b22
daicang/Euler
/p4.py
264
3.578125
4
# largest palidrome made from the product of 2 3-digit numbers def is_pali(n): return str(n) == str(n)[::-1] def solve(): for a in range(800, 1001): for b in range(800, 1001): if is_pali(a * b): print a * b solve()
d178196aeb4bc8224ebe7244438c2f6becaefc73
ansar-rezaei/hello-world
/oddnumbers.py
130
3.890625
4
#Print odd number from 1 to 101 a= 1 b=101 sum1=0 for i in range(a,b): if i%2==0: sum1=sum1+i print ("sum =", sum1)
ac8beccafc68748818a0de9915cfc0cec1c81cb7
Reynbra/Portfolio
/python/TurtleFrogger/scoreboard.py
1,993
3.921875
4
from turtle import Turtle FONT = ("Courier", 20, "normal") SCORE_COLOR = "white" ROAD_LINE_COLOR = "white" SCORE_ALIGNMENT = "left" LIVES_ALIGNMENT = "right" GAME_OVER_ALIGNMENT = "center" LEVEL_TEXT = "Level" LIVES_TEXT = "Lives" GAME_OVER = "GAME OVER" class Scoreboard(Turtle): def __init__(self): supe...
8e2ea489b9e932a36cc2002417d5bdef9f23ce91
harman666666/Algorithms-Data-Structures-and-Design
/Algorithms and Data Structures Practice/LeetCode Questions/MOST IMPORTANT PROBLEMS/19. Remove Nth Node from End of List.py
2,927
3.859375
4
''' 19. Remove Nth Node From End of List Medium 3068 224 Share Given a linked list, remove the n-th node from the end of list and return its head. Example: Given linked list: 1->2->3->4->5, and n = 2. After removing the second node from the end, the linked list becomes 1->2->3->5. Note: Given n will always be va...
ae282fea0f16f0670d5f5cc9e90ba07afdfc8623
xiangcao/Leetcode
/Python_leetcode/230_kth_smallest_in_BST.py
2,367
3.828125
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): #accepted def kthSmallest(self, root, k): """ :type root: TreeNode :type k: int :rtyp...
86eb2b901145f82ae8a434f87682bfc8cf1dd223
jogubaba/PythonScripts
/2example.py
64
3.734375
4
numbers = [6,2,5,2,2] for list in numbers: print('X' * list)
224a2ad77faf7b444dcf0aea1f87032d821628c7
vishalmkb/observer
/blog.py
2,131
3.5
4
from observer import Subject, Subscriber class blogSubscriber(Subscriber): def __init__(self, name): super().__init__(name) def getNotified(self, _update): print("{} got '{}' message".format(self.name, _update)) Subjects = {} Subscribers = {} def main(): while(True): element_type = int(input("\n\n1. Crea...
4ee960ae8c6975dba24cfc51dda5f13faeb61a68
frasca17/PCS2-Homework2
/Homework 2/Strings-Pangrams.py
136
3.765625
4
from collections import Counter s = input().lower() if len(Counter(s)) == 27: print("pangram") else: print("not pangram")