blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3590d8728084047df0859084113c7281eb208afb
ggm1207/cs
/data-structure/03-list.py
3,054
3.9375
4
import copy class ArrayList: def __init__(self, max_list_size): self.arraylist = [0] * max_list_size self.length = 0 self.max_list_size = max_list_size def is_empty(self): return self.length == 0 def is_full(self): return self.length == self.max_list_size def ...
b15eac6ee5ff855ee4e5fafc0918f9f659e5751f
Aasthaengg/IBMdataset
/Python_codes/p02392/s632564114.py
116
3.875
4
num1,num2,num3 = map(int,input().split(" ")) if (num1 < num2) and (num2 < num3): print("Yes") else: print("No")
9749fc3e081e500d94552438417c80d8ac07baa6
yuju13488/pyworkspace
/Homework/if_else/if_else3.py
1,387
4.1875
4
#3.選擇性敘述的練習-electricity #輸入何種用電和度數,計算出需繳之電費。 #電力公司使用累計方式來計算電費,分工業用電及家庭用電。 # 家庭用電 工業用電 #240度(含)以下 0.15元 0.45元 #240~540(含)度 0.25元 0.45元 #540度以上 0.45元 0.45元 elect=input('What kind of electricity, \'home\' or \'industry\':') kwh=eval(input('Please input kilowatt hour for ...
7a53229a8525f487b8284925d3d8f040fbed2238
lnarasimha94/Everest.Engineering.Assignment
/everest_engineering_1_2.py
5,623
3.671875
4
import itertools def calculateCost(basecost,weight,distance): return basecost+(weight*10)+(distance * 5) # Defining main function def main(): coupons = { # couponcode, percent, distance, weight 'OFR001':[10,'<200','70-200'], 'OFR002':[7,'50-150','100-250'], 'OFR003':[5,'50-250','10-150...
94046c10ab86358f623bcab5eb9d740d252a5900
paulsenj/HearMeCode
/slice3.py
1,858
4.03125
4
#Make a two-player Rock-Paper-Scissors game. (Hint: Ask for player plays (using input), compare them, print out a message of congratulations to the winner, and ask if the players want to start a new game) #Remember the rules: Rock beats scissors Scissors beats paper Paper beats rock def rockpaperscissors(): optio...
9f88ec90ba7adf2a5f10bcb9867a34d4e9653b98
muskankapoor/fall2017projects
/Python/PracticePython.py
4,612
3.984375
4
#Excerice 1-11 """ #basic age and name program name=input("Enter your name: ") age=int(input("Enter your age: ")) number=int(input('How many times" ')) year=(100-age)+2017 statement=('Hi ' + str(name) + ' You will turn 100 in ' + str(year) + 'this \n') print (statement * number) #another simpler solution name = input...
f59a3697c26db6e993f271da1e09290d55744b93
SteveGledsGames/morsels
/count_words/count.py
874
4.0625
4
def count_words(sentence): words = sentence.split() words = [word.lower() for word in words] word_count = {} for word in words: if word_count.get(word): word_count[word] = word_count[word] + 1 else: word_count[word] = 1 return word_count print(count_words("o...
56c8f763b16f44024d74aa28c4e711d5265a8096
swaroop1995/assignment
/ass2_13.py
189
4.03125
4
no1=int(input("enter the no1:")) no2=int(input("enter the no2:")) if no1==no2: sum=2*(no1+no2) print("the sum is",sum) else: total=no1+no2 print("the sum is",total)
0211a144d82d5cdc4cedd6e09ad8bdc082755f8e
Sum-Sovann2018/Bootamp4
/03_vote.py
211
4.15625
4
A = int(input("Input your age:")) if A >= 18: print("You are eligible to vote") elif A>=0 and A < 18: print("You aren't adult yet...Sorry can't vote") else: print("Age must be a positive digit")
fb5fe3775b73b79dd1ec2ac0bc74a5f0b04591c7
Jhynn/programming-concepts-and-logic
/solutions/2nd-conditionals/l2_a9.py
759
4.1875
4
number_1 = float(input('Type a number: ')) number_2 = float(input('Type another one: ')) number_3 = float(input('Type the last one, please: ')) if number_1 > number_2 and number_1 > number_3: if number_2 > number_3: print(f'{number_1} + {number_2} = {number_1 + number_2}') else: print(f'{number...
e4e48058908a2009bcf8bc9175ca333e7550ee2c
imharsh94/ALGO-DS
/dil.py
68
3.59375
4
a = "hello boy" print(a) if 5>1: print('there is no great guy')
dc75b93746c342c40c66f71fb16afdcdeeed4e3d
xiang-123352/code_snippets
/python/beispiele/07_Basistypen/_08_functions.py
842
3.875
4
# -*- coding: utf-8 -*- # Funtionen von Sequenzen string = "Wie lang bin ich wohl?" print(len(string)) # Anzahl der Elemente zahl = len(["Hallo", 5, 2, 3, "Welt"]) print(zahl) # min und max L = [5,1,10,-9.5,12,-5] print(max(L)) print(min(L)) # Fehler #l = [1,2, "welt"] #print( min(l) ) # Geht auch bei Strings pri...
0e8ea8fa78d83a94c4af9fd365e6516d291b155f
KunyiLiu/algorithm_problems
/kunyi/Tree/binary_tree_postorder.py
2,409
3.921875
4
# Push the root node to the first stack. # Pop a node from the first stack, and push it to the second stack. # Then push its left child followed by its right child to the first stack. # Repeat step 2) and 3) until the first stack is empty. # Once done, the second stack would have all the nodes ready to be traversed in ...
a278b8f0ce88e9865705c0970264885a0f641cf3
vijayb5hyd/class_notes
/class_snake.py
346
4.03125
4
class Snake: """This class allows you to create objects of type snake.""" def __init__(self,name): self.name=name def change_name(self,new_name): self.name=new_name snake1=Snake("Python") snake2=Snake("Black Mamba") print(snake1.name) print(snake2.name) snake1.change_name("Anaconda") print(snake...
b1b89bc07bf2a928d1897e1a3605c1f36b0924aa
lakshyatyagi24/daily-coding-problems
/python/345.py
3,035
3.953125
4
# -------------------------- # Author: Tuan Nguyen # Date created: 20200422 #!345.py # -------------------------- """ You are given a set of synonyms, such as (big, large) and (eat, consume). Using this set, determine if two sentences with the same number of words are equivalent. For example, the following two senten...
c1a10e3466b1199aa2a50c481b456465f87d9561
Esdeaz/Python_Course
/Lab5_Ex2_Variant_3.py
695
3.515625
4
import re f = open('students.txt', 'r', encoding = "UTF-8") list_st = f.readlines() f.close() list_form = [] for el in list_st: list_form.append(re.split(r'\s+', re.sub(r'[;.,\-!?]', ' ', el).strip())) for list_a in list_form: for el in list_a: if el.endswith('111'): print('БО-111111: ', ...
231a6035e9bb1945d684e0fee2a3a1c7660dbbcb
Shubhrita/Hackerrank
/Code2.py
809
3.78125
4
# Finding duplicate elements in an array # Importing required libraries from __future__ import print_function import sys # Taking input line by line inp=[] raw=0 while raw != '': try: raw = raw_input() inp.append(raw) except (EOFError): break #end of file reached # Function to f...
c5fb5b5db5222e4bc780a65badba24b837498136
towzeur/momDl
/v1 Work/test.py
1,779
3.5625
4
# import the Beautiful soup functions to parse the data returned from the website from bs4 import BeautifulSoup # import the library used to query a website import urllib.request as urllib2 # 1 Revolution # Regret & Loss 1 url = "http://milesofmusik.com/music_catalog/album-156591" # Query the website and return the h...
e670975b09813e7958fccb6325a15acf12e64098
drtamermansour/chickenAnn
/scripts/distance3.py
316
3.890625
4
#!/usr/bin/env python # -*- coding=utf-8 -*- import sys import Levenshtein if __name__ == '__main__': if len(sys.argv) != 3: print 'Usage: You have to enter a source_word and a target_word' sys.exit(-1) source, target = sys.argv[1], sys.argv[2] print Levenshtein.distance(source, target)
f2f33d660a0217a6c2f54e1075bafd57ad0c5181
kbuzby/euler
/euler10.py
129
3.625
4
primes = 5 for x in range (5,2000000,2): for y in range(2,x): if x%y==0: break else: primes = primes + x print primes
86ca90fd31a09060144e0a06bf68b5423967344f
rootrUW/Python210-W19
/students/KevinCavanaugh/session3/list_lab.py
1,668
4.1875
4
#!/usr/bin/env python3 # ----------------------------------------------------------------------- # # Title: List_Lab # Author: Kevin Cavanaugh # Change Log: (Who,What,When) # kcavanau, created document & completed assignment, 01/29/2019 # ----------------------------------------------------------------------- # impor...
f8c76da03421568515886bc5f0bf915383e8b1d2
jeffreyegan/MachineLearning
/03_Classification/Lesson_4_K_Nearest_Neighbor_Regression.py
9,476
4.65625
5
''' Regression The K-Nearest Neighbors algorithm is a powerful supervised machine learning algorithm typically used for classification. However, it can also perform regression. In this lesson, we will use the movie dataset that was used in the K-Nearest Neighbors classifier lesson. However, instead of classifying a n...
348d21a438a800b502932d1febdf0cda06a6b5f0
haoccheng/pegasus
/leetcode/remove_element.py
670
3.578125
4
# Given an array and a value, remove all instances of that value in place # and return the new length. # The order of elements can be changed. def remove_elements(nums, val): if len(nums) == 0: return 0 x = 0 y = len(nums) - 1 while (x < y): if nums[y] == val: y -= 1 elif nums[x] == val: ...
7d5a54d78175decf6bee32146ed26ab6ca688913
QiuZiXian/python-learning-process
/extend_work/six/julia.py
454
3.515625
4
# !/usr/bin/env python # -*- coding: utf-8 -*- # __author__ = 'QiuZiXian' http://blog.csdn.net/qqzhuimengren/ 1467288927@qq.com # @time :2020/9/8 19:46 # @abstract : for i: # 循环 i次 A = rand([1, 2, 3], 3, 3) # 随机生成矩阵 value = det(A) if value != 0: # 判断det不等于0 print(A) def test(x): return ...
07fbe8e136b0a55defec00e1a2abffff61b63900
kshitij-aggarwal/Artificial-Intelligence-Pacman
/Multi-Agent Search/Final.py
3,326
3.703125
4
#The structure has an array with which it has a state, the next move class game(): def term(self,state,p): if ((state[0] == state[1] == state[2]) or (state[3] == state[4] == state[5] == p) or (state[6] == state[7] == state[8] == p) or (state[0] == state[3] == st...
5793d56dcb33db6a73f91e3679011309f4fa8708
mhdz9/python_exercises
/List2.py
331
3.578125
4
zoo_animals = ['elephant', 'zebra', 'tiger', 'lion'] zoo_animals.append('cheetah') print len(zoo_animals) print zoo_animals #zoo_animals.insert(zoo_animals.index('lion'),'giraffe') for i in zoo_animals: if i == 'lion': zoo_animals[zoo_animals.index('lion')] = 'giraffe' zoo_animals.remove('zebra') print ...
3e7de1ae3e11579c98cc36fe963454b8668817c7
georgebzhang/Python_LeetCode
/77_combinations_2.py
578
3.75
4
class Solution(object): def combine(self, n, k): def backtrack(num=1, comb=[]): if len(comb) == k: result.append(comb[:]) for i in range(num, n+1): comb.append(i) backtrack(i+1, comb) comb.pop() result = [] ...
d10435b9850aa230aecbcff4de649d1797df65e1
camagar/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/100-weight_average.py
221
3.5
4
#!/usr/bin/python3 def weight_average(my_list=[]): if my_list is None or len(my_list) == 0: return 0 suma = sum(i[0] * i[1] for i in my_list) suma2 = sum(j[1] for j in my_list) return (suma/suma2)
a8c91bf3e62418323b8c5d8850881b904689e222
can1ball/minimum-path
/src/Search.py
2,037
3.546875
4
from Graph import Node, Graph from Utils import add_to_open def astar_search(graph, heuristics, src, dest): open = [] explored = [] # Create the start node and the goal node start = Node(src, None) goal = Node(dest, None) # Add the first node to the open list open.append(start...
ed0e4eba20272ed9dc4833de2498701709f596f1
shinws9090/pythonProject
/35.클래스활용/3.클래스메서드.py
798
3.828125
4
class Calc: __count = 0 def __init__(self): Calc.__count += 1 @classmethod def print_count(cls): # 스테틱메서드 print("{}번 생성됨".format(cls.__count)) a = Calc() b = Calc() n = Calc() d = Calc() f = Calc() Calc.print_count() class User: def __init__(self, email, password): se...
030d1280ca46eab0519a15100efa3f66a953fe48
axefx/Data-Structures
/queue/queue.py
3,524
4.4375
4
""" A queue is a data structure whose primary purpose is to store and return elements in First In First Out order. 1. Implement the Queue class using an array as the underlying storage structure. Make sure the Queue tests pass. 2. Re-implement the Queue class, this time using the linked list implementation as t...
13aa0b10bfb59b9f7b41a32d4d48f046e20bd8e4
javianleu/Rosalind
/Complementing a Strand of DNA/DNAComplement.py
769
4.25
4
# Complementing A Strand of DNA # Javier Anleu - 17149 # Opening DNA strand file dnaF = open("Complementing a Strand of DNA/rosalind_revc.txt", "r") # Reading DNA strand file if dnaF.mode == 'r': dna = dnaF.read() # Closing file dnaF.close() # Function to reverse string # Obtained from: https://www.journaldev.co...
409fcf27e018b3e66fa2c871c0e9d10c50ddbfc9
abr-98/image-reader-python
/image_rotation.py
1,211
3.671875
4
from PIL import Image import imutils import cv2 import os ch="1" def img_rotate(str): while ch != "3": img=Image.open(str) img0=cv2.imread(str) #img.show() im=img.copy() print("-----------------------OPTIONS-----------------------") print("1.Right angle") print("2.180 rotat...
7513b303c8fe0a15147df3e06c115ff0cc952b09
nadiavhansen/Python-Projects
/pythonProject2/jogoJokenpo.py
2,810
3.59375
4
import random class Jogo(): print('PEDRA, PAPEL, TESOURA!') def distribuir_cartas(self): cartas_sorteadas = [random.randint(1, 3), random.randint(1, 3), random.randint(1, 3)] return cartas_sorteadas class Jogador(): def selecionar_carta(self, mao_de_cartas): carta_selecionad...
6c1b904f5e10ec20e946b57f981a0ad2d96af334
apabhishek178/website_work
/untitled/button3.py
317
3.59375
4
#button3.py from tkinter import * import tkinter root=None def buttonpushed(): global root root.destroy() def main(): global root root=Tk() w=Label(root,text="hello everyone!") w.pack() mybutton=Button(root,text="exit",command=buttonpushed) mybutton.pack() root.mainloop() main()
fc2e307316c47cdb721caebda2aee6fad9440697
justdoit1990/leetCode
/lis/LIS_.py
427
3.671875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time : 2017/11/21 下午12:08 # @Author : Yanheng Wei # @File : LIS_.py # @Software: PyCharm def lis(ls): d = [1]*len(ls) max_length = 1 for i in range(len(ls)): for j in range(i): if ls[i] > ls[j] and d[i] < d[j]+1: d[i] = d[j] + 1 if max_length < d[i]...
8b8cfa51e9349bf91cb5221833d14826d090ebfc
type-null/earthInsights
/jobs/affinitysolution/analyzer.py
2,855
3.5
4
""" Homework Exercise - SDE in DS Internship Affinity Solutions Author: Weihang Ren """ import re import json import numpy as np from names import STATES, COUNTRIES, BRANDS def similarity(token, brand): """ Similarity computed using the Levenshtein distance ref: https://www.datacamp.com/community/tutori...
6376cdb0ac07699083ef88a47d2885cafb1e260a
meduka/guess-a-number
/guess_a_number2.py
4,446
3.71875
4
import random import math # config low = 1 high = 10 limit_calc = (math.log(high,2)) limit = math.ceil(limit_calc) # helper functions def show_start_screen(): print() print() print(" GGGG UU UU EEEEEEE SSSSS SSSSS AAA NN NN UU UU MM MM BBBBB EEEEEEE RRRRRR !!! !!!...
b40a58abb043d8076d26b289dacf029d6bd5080d
dougtc1/algorithms2
/proyecto2/clases.py
3,432
3.625
4
# Universidad Simon Bolivar # # Laboratorio de Algoritmos y Estructuras II # # Ricardo Churion. Carnet: 11-10200 # Douglas Torres. Carnet: 11-11027 # Grupo: 06 # # * VA SIN ACENTOS * # # Archivo que contiene las clases usadas en el archivo simulador.py # Definicion de la clase paquete class Paquete: def __init__(...
016c2b098b98c911622373cedf31b280cd78142a
KaraCo/python_basics
/webapp/student.py
797
4.09375
4
# A student class to add students to a web application # create an empty list students = [] class Student: ''' instance variable school_name init, str, capitalize name and school name functions ''' school_name = "Springfield High School" def __init__(self, name, last_name, student_i...
d21159f97bfb4cadeacd52875da8a113b785de4a
xiaolonghao/chainercv
/chainercv/utils/iterator/apply_to_iterator.py
10,046
3.78125
4
import warnings from chainercv.utils.iterator.unzip import unzip def apply_to_iterator(func, iterator, n_input=1, hook=None, comm=None): """Apply a function/method to batches from an iterator. This function applies a function/method to an iterator of batches. It assumes that the iterator iterates over ...
8170a5a28e3c6ef424b30ea30e5d7a3ac4b38fc2
ademaas/python-ex
/round9/playerprogram.py
3,153
3.96875
4
# CS-A111 Fall 2018 # A test program for Exercise 9.3 # Author Kerttu Pollari-Malmi # # The main program has not been split to several functions to keep # it as simple as possible for beginners. import player # A function to read an integer with exception handling. def read_integer(): int_ok = False while n...
43f34c7509bf297cf3c0d00bcaae9d0548017c2e
BrettMZig/PythonFun
/primes.py
454
3.765625
4
def composite_gen(prime, first, last): c = prime + prime while c < last: if c > first: yield c c = c + prime def find_primes(first, last): if first < 2: first = 2 mSet = set(xrange(first, last)) primes = [] for x in xrange(2, last): if x in mSet: primes.append(x) mSet = mSet - set(compo...
3c83bfff0eb932ac8efbae3fc85756ffd27bdf9b
WeDias/RespPPZ
/WesleyDiasII.py
2,944
3.9375
4
# Wesley Dias (1º Semestre ADS-B), Lista II # Exercício 1 lado1 = int(input('Digite o tamanho do lado 1: ')) lado2 = int(input('Digite o tamanho do lado 2: ')) lado3 = int(input('Digite o tamanho do lado 3: ')) if lado2-lado3 < lado1 < (lado2+lado3) and lado1-lado3 < lado2 < (lado1+lado3) and lado1-lado2 < lado3...
5e53917125b152a0525e1404d09dfad644a8b94f
TerryRPatterson/Coursework
/python/test.py
246
3.90625
4
import math def isPrime(n): a = 2 b = -1 while n % 2 == 0: return False while a + b < n : b = math.sqrt(abs((a ** 2)-n)) if b.is_integer() and b > 1: return False a += 1 return True
868c9f7d9b55824ea5d219737c4d4972f223385c
jcshott/interview_prep
/recursive_index/recursive_index.py
1,222
4.21875
4
def recursive_search(needle, haystack, idx=0): """Given list (haystack), return index (0-based) of needle in the list. Return None if needle is not in haystack. Do this with recursion. You MAY NOT USE A `for` OR `while` LOOP. >>> lst = ["hey", "there", "you"] >>> recursive_search("hey", lst) 0 >>> recursive...
4da965a4532ae946609e8e6f6e00ca4e13624703
KevinCabeza/myrepo
/PycharmProjects/introduccion/estructurasdecontrol/suma_2_numeros.py
283
4.0625
4
# visualiza la suma de dos numeros enteros introducidos por teclado #introducimos por teclado num1 = int(input("num1 :")) num2 = int(input("num2 :")) #guardamos la suma suma = (num1 + num2) # imprimimos el resultado en pantalla print("La suma de :", num1, "y", num2, "=", suma)
d162a6fbb83133e976dbcb71efac5172ae6a90d5
cpamieta/547-202
/Artificial Intelligence Exercise/Bot Building/Bot saves princess - 2.py
780
3.78125
4
#In this version of "Bot saves princess", Princess Peach and bot's position are randomly set. Can you save the princess? # def nextMove(n,r,c,grid): nn=n-1 m=int(n/2) x=0 xx=0 yy=0 notFound=True while(notFound): y=0 while(y<n): if(grid[x][y]== 'p'): ...
de1dd27f57164f26eedf5671a92c99aa5be1b990
raor23/GameDesign2020
/Major-Playingwithforloop.py
707
4.125
4
#Rohan Rao #This program contains ForLoops Program, Prime Numbers, and the Fibonacci sequence #Forloops for line in range(5): print() for number in range(5-line,0,-1): print(number, end =' ') #Prime Numbers Program start = 25 #First Value of finding prime number end = 50 #Last Value of finding p...
b32ebe68eff7e6244127362d51a0e0a1bc17eb74
sssunda/solve_algorithms
/programmers/count_of_py.py
384
3.6875
4
def solution(s): word_dict = {} for element in s.lower(): word_dict[element] = word_dict.get(element, 0) + 1 if word_dict.get('p', 0) == word_dict.get('y', 0): return True return False if __name__ == '__main__': s = 'pPoooyY' print(solution(s)) """ def solution...
9a23e426709fb456247f9c447741b7cd83ca2556
Moglten/Nanodegree-Data-structure-and-Algorithm-Udacity
/Advanced Algorithm/greed/Greedy Algorithm.py
3,863
4.46875
4
In Greedy Algorithm - U taking that choice give u max benefit neverless after that u take ducsion just for now . -Examlple Code1- ------------------------------------------------------------------ Given arrival and departure times of trains on a single day in a railway platform, find out the minimum number of platf...
0527f1dd7ad27fe105397b868b67aa3dbf972972
AllenAnZifeng/leetcode
/Past interview Questions/Amazon OA prep/k_closest_points.py
4,478
3.984375
4
# # """ # Definition for a point. # class Point: # def __init__(self, a=0, b=0): # self.x = a # self.y = b # """ from typing import List # # # class Point: # def __init__(self, a=0, b=0): # self.x = a # self.y = b # # class Solution: # """ # @param points: a list of point...
b05638f89a2c58ed45da93f17f4b83fa8716f80a
Srilalitha/Projects
/online_pdsa_class/ListQuiz.py
1,547
3.671875
4
# -*- coding: utf-8 -*- """ Created on Fri Apr 3 12:09:54 2020 @author: shanmukha """ def f(): pass print(type(f())) print(type(1J)) import re sentence = 'Learn Python Programming' test = re.match(r'(.*) (.*?) (.*)', sentence) print(test.group()) a = [1,2,3,None,(),[],] print( len(a)) pr...
6e9602dd9d4b8a88ed477bf2e4024f851c891565
simonalford42/Kepner-sparse-nn
/x_net.py
6,543
3.5
4
from __future__ import division import numpy as np import fractions def extended_mixed_radix_network(radix_lists): """ Creates an X-net sparse network topology from the input parameters using Ryan's Extended Mixed-Radix method. See the documentation for a full explanation of what is going on. Inputs: rad...
4f00650a3f19c044246359024d49c9a9377ea612
NasNaz/PythonStdioGames
/barebones/bitmapmessage-barebones.py
1,053
3.9375
4
"""Bitmap Message (barebones version) by Al Sweigart al@inventwithpython.com Displays a text message according to the provided bitmap image.""" import sys bitmap = """ ******** ******** ******** ******** ******** ******** ******** ******** ******** ******************** ***...
54ec75d554bea29993f9082ee3adfa29e5fd6e59
akiran1234/referencedocs
/Python/08_Loops.py
2,246
4.4375
4
################################################################################################################# # Loops are used to execute a block of code repeatedly. # we have while loop and for loop for repetitive execution. # The block is iterated based on condition, until it is true and exits when the conditi...
bbc3ac96f7764c7b84f7a3545800820ec9d3fc15
tmondal/pythonProjects
/game/pong/new_football.py
6,519
3.515625
4
import pygame import random,sys import math from pygame.locals import* #----------------- COLOR DEFINING --------------------- BLACK = (0 , 0 , 0) WHITE = (255 , 255 , 255) RED = (255 , 0 , 0) BLUE =(0,0,255) GREEN = (0 , 255 , 0) #----------------- CLASS AND FUNCTION --------------- class Player: ...
3b69f98ee37e6127a3b893837613c51378b555c6
ganasn/LPTHW
/ex47/LPTHW/ex38.py
1,308
3.890625
4
# Exercise 38 - Doing Things to Lists ten_things = 'Apples Oranges Crows Phone Light Sugar' print 'That doesn\'t add to 10' stuff = ten_things.split(' ') more_stuff = ['Day', 'Night', 'Song', 'Frisbee', 'Corn', 'Banana', 'Girl', 'Boy'] # Add more items to stuff from more_stuff until there are 10 items in stuff #Stu...
8568b80bb98c6cf00d785f02df7d52a348602e97
cjc77/Recursions
/medianValues.py
1,168
3.9375
4
#! usr/bin/env python3 # Finds Median Value of input import random, numpy, time def if_even(x): global first if len(x) == 2: return (x[0] + x[1]) / 2 if first: first = False return if_even(x[1:]) elif not first: first = True return if_even(x[:-1]) def if_odd(...
15d75bfd3c00d16070b41935297d4f9a6c8456d9
hot-tangcong/test1
/6.2.4.py
539
3.75
4
# 继承中的构造函数 class Animal(): def __init__(self): print("Animal") class Crawel(Animal): def __init__(self): print("Crawel") class Dog(Crawel): def __init__(self): print("I am init in dog") # 猫没有构造函数 class Cat(Crawel): pass # 实例化的时候,自动调用了Dog的构造函数 kk = Dog() # 此时应该自动调用构造函数,因为Cat没有...
3183d31a1b6e5be2ff242a92242b394ea306347b
ksu-hmi/Baby-Child-Gender-Tracker
/GenderReveal.py
2,055
3.8125
4
#import libraries first import statistics as s #add constants next Moms = {'Ronda Broome':'***','Betty White':'***','Susan Black':'***', 'Sharon Stone':'***', 'Mary Joseph':'***', 'Melissa Smith':'***'} Babies = {'Paul Joseph':["Male"], 'Barbara Black':["Female"], 'Michelle Stone':["Bi...
8594e973d1e5573312a10f2f0b8bf4dda2512c9a
gukiub/portifolio
/scripts python/Uri exercises/exercUri18.py
594
3.640625
4
numero = int(input()) if 0 < numero < 1000000: print(numero) x = numero // 100 print('{} nota(s) de R$ 100,00'.format(x)) y = numero % 100 z = y // 50 print('{} nota(s) de R$ 50,00'.format(z)) w = y % 50 q = w // 20 print('{} nota(s) de R$ 20,00'.format(q)) u = w % 20 i = u /...
cfb59ec847ecac391de5b71a8bf1e67397996237
MaryanneNjeri/pythonModules
/.history/duplicateleet_20200810095940.py
293
3.6875
4
def duplicate(nums): newDict = {} finalArr = [] for i in nums: if i in newDict: newDict[i] +=1 else: newDict[i] = 1 for i in newDict: if newDict[i] == 2: finalArr.append(newDict[i]) return finalArr duplicate([])
69b5d1263958d92d31c4cb6cb2cf6f5c1edcf5cb
alexlikova/Python-Basics-SoftUni
/8. Python Basics EXAMS/4. Programming Basics Online Exam - 9 and 10 March 2019/02. Football Results.py
929
3.953125
4
win, loss, equal = 0, 0, 0 for _ in range(3): host, guest = input().split(':') if host > guest: win += 1 elif host < guest: loss += 1 else: equal += 1 print(f'Team won {win} games.\nTeam lost {loss} games.\nDrawn games: {equal}') """result_first_game, result_second_game, resu...
4d749f10a92ab7b057c3641ca066689cd2bfc9e4
skytreesea/do-it-python
/05/feasibility/basic_feasibility_suc.py
1,715
3.5
4
##### 공기업 설립 시 타당성 조사를 위한 경상수지 비교 기본 프로그램 ####### #usecsv의 값을 저장하도록 함 import csv, os def writecsv(filename, the_list): with open(filename,'w',newline='') as f: a=csv.writer(f, delimiter=',') a.writerows(the_list) # 현행방식과 공기업 방식의 인플레이션 인덱스 부여 # 물가상승률 price_index = .011 # 인건비 상승률 salary_increase = 0...
df9e266196af37f7115709bb8da592558f9bf7f0
kirill432111/python
/les1/массивы/4 массивы.py
777
3.953125
4
def quicksort(list, start, end): if end - start > 1: p = partition(list, start, end) quicksort(list, start, p) quicksort(list, p + 1, end) def partition(list, start, end): pivot = list[start] i = start + 1 j = end - 1 while True: while (i <= j and list[i] <=...
db4cbc787f53f213d2679742aecaf3c9eadbe2de
vanshikasanghi/dv.pset
/0052 Longest Collatz Sequence /collatzseq.py
515
4.1875
4
number = 13 #to check for the series counterfinal = 0 finalnum = 0 while number < 1000000 : counter = 0 num = number #for the sequence, to check for each number while num > 1 : #finding one sequence if (num%2==0) : num = num/2 counter = counter + 1 else : num = (3*num)+1 counter = counter + 1 if (...
c90e94c1e6f60e0e890fc5134b8a60ed7d88beca
anthologion/psalter
/psalter.py
1,596
3.796875
4
from bible.bible import TomlBible from datetime import datetime,timedelta class Psalter(object): def __init__(self): self._bible = TomlBible() def get_psalm(self, number): return self._bible["Psalm %d" % int(number)] def cycle_psalms_weekly(psalmlist, batch_size=1, weekday=None, start_day = 6...
09fda303f38d2cc9ad1f8da62b74d2b38310187e
sn1572/RentOrBuy
/RentOrBuy/loan_modified.py
4,224
3.609375
4
# -*- coding: utf-8 -*- """ Created on Sat Aug 4 10:54:14 2018 @author: User68 """ class time_func: def __init__(self, function=None): self.function = function self.time = 0 def set_function(function): self.function = function def value(self): val = self.functi...
d160e0c603b72e3b6c9453057b0f9bfff6acc3fa
itsolutionscorp/AutoStyle-Clustering
/all_data/exercism_data/python/bob/49e9e52336a447728d059a314eff958a.py
603
3.578125
4
# -*- coding: utf-8 -*- def hey(message): if isShouting(message): return "Whoa, chill out!" elif isQuestion(message): return "Sure." elif isSilent(message): return "Fine. Be that way!" else: return "Whatever." def isShouting(message): capcount = 0 lowcount = 0 ...
d3cc4915e52f1903af21b7a24afbfbb941be35b1
swethatech/thinkpython
/chapter-1.py
418
3.78125
4
#help(chapter-1) '''class interpreter: def __init__(self): "online help utility" help(interpreter) help('print') #math min =43.5 hr =min / 60 km_per_mile=1.61 km = 10 miles =km/km_per_mile print("miles:",miles) print("min:",min) print("hr:",hr) pace = min / miles mph = mi...
8b0e01f62abc3844574b18019b3a8f4d834357e4
DanielMarquesz/AD1_FP
/quesato1.1.py
1,369
4.46875
4
''' Faça um programa que leia strings da entrada padrão, até que a string vazia (“”) seja digitada. Caso a primeira string lida seja vazia, escreva a mensagem “Nenhuma String Não Vazia Foi Lida!!!”. Caso contrário escreva: (1) Qual a string que tem maior comprimento; caso haja empate escreva a primeira delas; (2) Qual...
f8ebd30d3dc0eb5261080be8612c8bbcbe72d920
27abhi/maze-with-moveable-object
/maze.py
2,906
4.21875
4
# MAZE DESIGN & IMPLEMENTATION WITH KEYBOARD CONTROLLED MOVEABLE OBJECT (USING TURTLE FOR GRAPHICS): #=================================================================================================== import numpy as np import turtle import random window = turtle.Screen() window.bgcolor('black') window.screensize(60...
3cefa87c74f1c70eca955aaef412efadd3d8a280
Gaurav1921/Python3
/Dictionaries.py
2,402
4.09375
4
""" dictionary is more of a mess unlike lists it is bag of values which don't stay in order and along with that in dictionaries we also have to label when we add any value """ purse = dict() purse["money"] = 12 # here money is the label and 12 is the value of that label purse["candy"] = 3 purse["tissue"] = 75 ...
50ee8d1d8d6aa65a92b95a403eb1da3fd927c76b
Dwyanepeng/leetcode
/findNumberOfLIS_673.py
878
3.515625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # File : findNumberOfLIS_673.py # Author: PengLei # Date : 2019/5/29 '''给定一个未排序的整数数组,找到最长递增子序列的个数。 示例 1: 输入: [1,3,5,4,7] 输出: 2 解释: 有两个最长递增子序列,分别是 [1, 3, 4, 7] 和[1, 3, 5, 7]。 示例 2: 输入: [2,2,2,2,2] 输出: 5 解释: 最长递增子序列的长度是1,并且存在5个子序列的长度为1,因此输出5。 注意: 给定的数组长度不超过 2000 并且结果一定是3...
2946a8feeb638c4be4037d2c5e0398492259ca27
dh-trier/worldcat
/create_publicationtable.py
9,177
3.65625
4
#!/usr/bin/env python3 """ Script for creating a table with the number of publications per year for each novel in the collection. Input: html files from worldcat downloaded by gethtmlsworldcat.py. Output: csv-file """ from bs4 import BeautifulSoup as bs import glob import os from os.path import join imp...
386bc3d880111df7bf45cc5b7bdfefce5db389b6
andreluismoreira/Codigos-em-Python
/tedDicionario.py
1,844
3.96875
4
def main(): listaDeClientes = [] while True: clientesFiado = {"nome": None, "divida": None, "endereço": None} opcao = input("*=*=* Escolha uma opção desejada *=*=* \n" "1- Cadastro de clientes\n" "2- Atualização de divida\n" "3- ...
da9191f7877931c4d81c7f58c389880c2396458e
apryab/GeekBrains-HW-4
/Task 2.py
244
3.609375
4
my_list = [0, 1, 5, 3, 4, 6, 1, 3, 10, 4, 6, 3, 10, 34, 23, 67] print('Исходный список -', my_list) new_list = [my_list[i] for i in range(1, len(my_list)) if my_list[i-1] < my_list[i]] print('Новый список -', new_list)
ad24971ea30370d494fc8fde0464c65fecfcd7cb
CaJiFan/PF-coding-exercises
/U4) Funciones/Ejercicio 4 - L2/main.py
808
3.9375
4
#Terminado #Usted trabaja en una tienda y le piden definir las funciones que se encuentran en el archivo "funciones.py" los datos de la tienda que le son proporcionados son una lista con los precios de los productos, lista de los nombres de los productos y una lista con los codigos de cada uno de los productos from f...
782cd0f4aaf9ae7cc9b2a311aad0f1e8834a18a7
comicxmz001/PythonPlayGround
/PythonGame/rock-scissors-paper.py
1,993
4.28125
4
# Rock-paper-scissors-lizard-Spock template # The key idea of this program is to equate the strings # "rock", "paper", "scissors" to numbers # as follows: # # 0 - rock # 1 - scissors # 2 - paper # helper functions import random def number_to_name(number): # fill in your code below # convert number to a...
29c88d4526ace19603dd42034ffb67498d8eefde
giabao2807/python-study-challenge
/python-oop/property-in-py/property.py
1,288
3.953125
4
class Person: def __init__(self, fname: str = '', lname: str = '', age: int = 18): self.__fname = fname self.__lname = lname self.__age = age def set_age(self, age: int): if age > 0: self.__age = age def get_age(self): return self.__age def get_lname...
b8dc6cb4c26ea53bd8559e1da76b8466da09f285
totalgood/nlpia3
/src/nlpia/book/examples/ch05u01_your_first_neuron.py
860
3.5625
4
# ch05m01_your_first_neuron.py import numpy as np from keras.layers import Dense, Activation from keras.models import Sequential # OR logic gate inputs and output. # x_train is sample data (input features) # y_train the expected outcome for example x_train = np.array([[0, 0], [0, 1], ...
8ea9d744b57d7c9586acabce0a4b419caf0c0caf
DemetriosP/lp2-exercicios
/lista_2/exercicio_2.py
419
3.59375
4
vendas_mensais = float(input("Informe o seu volume mensal de vendas: ")) if vendas_mensais <= 5000: comissao = vendas_mensais * 0.02 elif 5000.01 <= vendas_mensais <= 10000: comissao = vendas_mensais * 0.05 elif 10000.01 <= vendas_mensais <= 15000: comissao = vendas_mensais * 0.07 else: comissao = vend...
1951bde090be799907b1d7b9446fb1cafa2ffbfa
RobertoBarrosoLuque/CTA-Health
/cta_data_wrangle.py
3,771
3.59375
4
""" Importing and filtering CTA metro stop data for use in our software Hana Passen, Charmaine Runes, Roberto Barroso """ import numpy as np import pandas as pd import requests import json END_POINT = "https://data.cityofchicago.org/resource/8pix-ypme.json" API_KEY = "sJyI5hpZy8dZHJBbMhrhdBkyi" COLUMNS = ["map_id...
9ad52f90ff84f228a205dd8891e5f201d3accb27
dhaarmaa/python
/prueba2/caso_bencinera.py
2,743
3.890625
4
#Una bencinera ofrece distintos tipos de servicio que un cliente puede tomar que serían los siguientes: # cargar combustible: bencina 900 el litro o diésel 600 el litro, puede cargar varios litros de un tipo de combustible. # Otro servicio es el de limpieza donde la ficha de hidrolavadora puede costar 1500 por 2 minut...
0809f06706cb06d48dcc5cdca32635965ce3a962
davecan/rotor-crypto
/MultiRotorDevice.py
5,098
3.640625
4
# Mimics a multi-rotor device such as the Enigma. # # When initialized it must be passed a key consisting of a list of rotors, # and a same-sized list of speeds -- each speed index corresponds to that rotor index. # Each rotor is rotated by its corresponding value from rotation_speeds. # This allows rotors to move at v...
72be94a6b75263d4446cb71d205bd5d7358dd9e5
fitrialif/CoDeepNEAT
/src/NEAT/Mutagen.py
11,121
3.59375
4
import math import random from enum import Enum class ValueType(Enum): """discrete mutagens mutate between a set of options""" DISCRETE = 0 """whole/continuous numbers mutate a numerical value inside of a range""" WHOLE_NUMBERS = 1 CONTINUOUS = 2 class Mutagen: """this class represents any ...
42df47d4e842cceeac7fa7df7c3a618e1c21d817
zigaen/Python_Vaje
/OOP/OOP.py
3,810
3.890625
4
import json class Player(): def __init__(self, first_name, last_name, height_cm, weight_kg): self.first_name = first_name self.last_name = last_name self.height_cm = height_cm self.weight_kg = weight_kg def weight_to_lbs(self): pounds = self.weight_kg * 2.20462262 ...
80bf414423eadf6cf72ab85e26c59ce39a23ec53
manojpandey/Algorithms
/misc/sieve_of_eratosthenes.py
873
4.15625
4
""" Implementation of Sieve of Eratosthenes algorithm to generate all the primes upto N. Reference : https://en.wikipedia.org/wiki/Sieve_of_Eratosthenes Algorithm : * We have a list of numbers from 1 to N. * Initially, all the numbers are marked as primes. * We go to every prime number in the list (<= N ^ 1/2) and m...
9af3b70b77243bf6c8cca2ebceabdea2297eeb37
HFMarco/quantum_py
/clase_03/ejerc_05.py
99
3.5
4
x=0 while x <= 1000: x += 1 if x%2 != 0: continue else: print(x)
dab26d9a946f76154568536859bed195f157e8b6
ml4ai/tomcat
/human_experiments/lab_software/tomcat-baseline-tasks/tasks/ping_pong_task/utils/ball.py
2,124
3.65625
4
from math import copysign from random import randint from typing import Optional import pygame from common import COLOR_FOREGROUND from .constants import WINDOW_HEIGHT, WINDOW_WIDTH class Ball(pygame.sprite.Sprite): """ Ball pygame sprite updated by the server """ def __init__(self, ...
5cbcf60de89dc518b7f6b4b6a6ceacc3dddeb52c
simonfong6/ECE-143-Team-6
/data_analysis/utils.py
7,587
3.796875
4
#!/usr/bin/env python3 """ Functions that help with loading and filtering the data. """ import json import pandas as pd DATA_FILE_NAME = '../data_fetching/sadscore_data.json' def dumps(dict_): """ Converts dictionaries to indented JSON for readability. Args: dict_ (dict): The dictionary to be JSO...
f67994dbf2aea73909ab144af1aa1cb6f2717d20
1012378819/2020kingstar
/src/fishC/magic_func.py
2,208
3.53125
4
# -*- coding:utf-8 -*- ''' Created on 2019年12月22日 @author: pei.lu ''' class CapStr(str): def __new__(cls,string): string=string.upper() return str.__new__(cls,string) a=CapStr("this is new knowledge") print(a) class C: def __init__(self): print('我是 构造方法,对我的实例化时,我被执行') def __del__(...
7b1f0dab3bc87d652a6c77d7d5004d5a3cf4a559
willwearing/cs-guided-project-graphs-ii
/src/find_all_paths_in_binary_tree.py
2,229
4.09375
4
# # Binary trees are already defined with this interface: # class Tree(object): # def __init__(self, x): # self.value = x # self.left = None # self.right = None def treePaths(root): ''' Input: the root of the tree to traverse Output: list of strings where a single string represents a sin...
f56658523c9b0101fac5881f984814c15e204e7f
VeisaGit/python-practice
/Cows and Bulls game/server.py
1,465
3.515625
4
import random import re number = str(random.randint(1000, 9999)) # print('загаданное число ', number) try_counter = 0 def inst_number(): global user_number, try_counter try_counter += 1 user_number = input("Введите четырехзначное число: ") if re.search(r'\D', user_number): print("Ошибка!...
ea9084b8b4da109d9d364e0c7fc44f961e8ceedc
emmagordon/python-bee
/group/reverse_words_in_a_string.py
602
4.28125
4
#!/usr/bin/env python """Write a function, f, which takes a string as input and reverses the order of the words within it. The character order within the words should remain unchanged. Any punctuation should be removed. >>> f('') '' >>> f('Hello') 'Hello' >>> f('Hello EuroPython!') 'EuroPython Hello' >>> f('The cat s...
796ec04401995d4438e00427767e9ad1bf66ecb3
sreekripa/core2
/while.py
190
3.828125
4
# c=0 # while c<10: # print(c) # c+=1 # i=0 # while i<6: # i+=1 # if i==3: # continue # print(i) i=0 while i<10: print(i) if i==3: break i+=1
87154d5f986ad6864ee5f9d27da8811ac574e34b
akashmallik/python
/basic/loops/while.py
620
4.34375
4
""" Python has two primitive loop commands: >> while loops >> for loops """ # The while Loop i = 1 while i < 5: print(i) i += 1 print('\n') # Break """ With the break statement we can stop the loop even if the while condition is true. """ i = 1 while i < 5: print(i) if i == 3: break i +=...
2fc1f347d54f6c003cae85965680a64b1a2c4131
AnelMengdigali/Calculation-Checker
/calculation.py
901
4
4
import random def askforanswer( nrcorrect, nr1, nr2 ): while True: inputstring = input( "question {}: please calculate {} times {} ". format( nrcorrect, nr1, nr2 ) ) try: answer = int( inputstring ) return answer except ValueError: print("Please,...
a8b6d79a611d5f4c9f37af3bd51f7dbca99110bb
leet23/python_kurs
/01_typy_zmienne/zadanie3.py
347
3.59375
4
# zadanie 3 quote = "Honesty is the first chapter in the book of wisdom." print(quote) print(len(quote)) #1 print(quote[-7:-1]) #2 print(quote[0:25]) #3 print(quote[0:len(quote)//2]) #3 print(quote[-1]) #4 print(quote[len(quote)//2 : : 3]) #5 print(quote[ : : 2]) #6 print(quote[ : : -1]) #7 print(quote.replace("wisdom"...