blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
eab62838aa0574cace31c8d8ce6c141c004c69c2
bsaliba1/cs-coursework
/CS_110/Labs/Lab05/lab5.py
2,358
3.65625
4
import turtle import math import random import time def drawPolygon(turt1, sz, num_sides): for i in range(num_sides): turt1.forward(sz) turt1.left(360/num_sides) def drawCircle(turt1,radius): num_sides = 360 sz = (2*math.pi*radius)/360 drawPolygon(turt1,sz,num_sides) def setUpWindow(wn...
1c7ec5c5faa703b622db4b329d0cb45c5bf8ce15
bsaliba1/cs-coursework
/CS_110/CS-Notes/Calc Easter.py
474
3.765625
4
def calcEaster(year): a = year%19 b = year // 100 c = year % 100 d = (((19*a)+b)-(b//4)-((b-((b+8)//25)+1)//3)+15)%30 e = (32+2(b%4)+2(c//4)-d-(c%4))%7 f = d+e-7((a+11*d+22*e)//451)+114 month = f//31 day = f%31 + 1 print(month) print (day) def main(): year = int(input("Ente...
242cfffda1b040675c346d28de5d0b6bb2b52553
fedeherr/Ejercicio-4-Unidad-3
/Main.py
487
3.59375
4
from Menu import Menu if __name__ == '__main__': menu=Menu() salir = False while not salir: print(""" 0 Salir 1 Crear el arreglo 2 Registrar horas de un empleado 3 Total de una tarea 4 Consultar cuales empleados obtendrí...
4cd26360596e0f52afec8665be8b8586a0a38f7d
wfeihu/python
/count.py
498
3.515625
4
#!/usr/bin/python #-*-coding:utf-8-*- # Filename: count.py import os import sys path = "F:\Study\python\data" listfile = os.listdir(path) newlist = [] for names in listfile: if names.endswith(".dat"): newlist.append(names) print newlist def getCountsByFile(filename): fp = open(filename) content = fp.re...
c6ec70daf0e484d47bbbc6b851ece81d518101de
jacobcraigross/email_slicer
/sec.py
688
3.734375
4
# email slicing +++++++++++++++ word = 'Jacob Craig Ross and the Hounds from Hell.' print (word[word.index('Hounds'):]) # prints 'Hounds from Hell' # get user email email = input('What is your email address?').strip() # strip function trashes any extra spcaes # slice out user name user = email[:email.index('@')] # s...
1237289fbfae30e0e2a6f6872ec5da59ea168241
citlimpens/Python-BSc-course
/PROYECTO.py
3,717
3.9375
4
Variables = ["S", "I"] VariablesOriginales = ["S", "I"] Parametros = ["gamma", "beta"] ParametrosOriginales = ["gamma", "beta"] def insercionvariables(): MasVariables = input("Las variables obligatorias son S e I, ¿Desea agregar otra variable? (S/N) ") if MasVariables == "S": Variable1 = input("¿Desea agregar la v...
2ff17999f4bed13d024143e301092d1aa63286b1
citlimpens/Python-BSc-course
/untitled.py
85
3.59375
4
lista = [1, 4, 5, 6, 7] for i in lista: while i != 0: x = 1 x = x * i print(x)
20660662e4cd91c584991e1238c788d74ba76a48
citlimpens/Python-BSc-course
/grafica.py
1,628
3.59375
4
#Pyplot #importar todos los paqueres import numpy as np np.set_printoptions(precision=4, supress=True) import io from pandas import Series, DataFrame import pandas as pd import matplotlib.pyplot as plt plt.rc('figure', figsize=(2,10)) """ PAra mostrar la gráfica en una nueva pestaña, se puede usar: plt.show() Par...
f5379bc00da2d5c28e78d164e5d9ccc163aa090c
guiconti/CodeWars
/python/6Kyu/find_even_index.py
136
3.75
4
def find_even_index(arr): for x in range(0, len(arr)): if sum(arr[:x]) == sum(arr[x+1:]): return x return -1
6183fa38381949a89ac79ae3749563f2458de37b
willthink/ud036_StarterCode
/media.py
628
3.625
4
import webbrowser class Movie(): """ This is the class to store movie data """ def __init__(self, movie_title, poster_image_url, trailer_youtube_url): """ initialize a Movie instance Args: movie_title: title string of the movie poster_image_url: a url string to the poste...
267baefc536db82bfe904c602b7b9f7cffef878f
leonardoru/ccpythoncourse
/Assignment 8/Assignment8_LeonardoRueda.py
1,270
4.125
4
# Class: CIS 112 #37791 ADVANCED PROGRAMMING USING PYTHON-Online # Pasadena City College # Instructor: Mr. Jason Y. Huh # Assignment 8: Write a Python program which concatenates three PDF files together and name merged file as "MergedFile.pdf". # Student: Leonardo Rueda # First we import PyPDF2 import PyPDF2 from PyPD...
94accc0bb62ee3be9eb7c5883b590c13c432b7fe
Naveen1789/leetcode
/BinaryTreeLevelOrderTraversalII0107.py
1,063
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): def levelOrderBottom(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ ...
36ed3d610a0e339bc678b6a63a08e77b1f9be36d
Naveen1789/leetcode
/NumberComplement0476.py
321
3.53125
4
class Solution(object): def findComplement(self, num): """ :type num: int :rtype: int """ compl = 0 i = 0 while num != 0: if num % 2 == 0: compl = compl + (2 ** i) i = i + 1 num = num / 2 return compl...
aeaf4894dda4d4b4199df9b3eb0315a0e0687818
Naveen1789/leetcode
/MinStack0155.py
1,475
3.734375
4
class MinStack(object): def __init__(self): """ initialize your data structure here. """ self.arr = [] self.topIndex = -1 self.minEle = 999999999999999999 def push(self, x): """ :type x: int :rtype: None """ if x >= self.m...
d5b203f6f0d96bfd73ad1bf1bd1b3272a02d41d9
DanOchs99/python101
/fizzbuzz.py
624
4.34375
4
# Assignment - Fizz Buzz # Dan Ochs 11/7/2019 # # ask user for input # if input is divisible by 3 print "Fizz" # if input is divisible by 5 print "Buzz" # if input is divisible by 3 and 5 print "Fizz Buzz" # get input from user while True: try: n = int(input("Enter a whole number: ")) except Value...
439718e0f66ce6675210c4d22f1c8c9a7cb8c23a
ikesan/dragonquartus
/sortdata/sortcode.py
10,778
3.546875
4
def qsort(l,r): if l < r : i,j = l,r p = mem[i] while True : while mem[i] < p : i += 1 while mem[j] > p : j -= 1 if i >= j : break mem[i],mem[j] = mem[j],mem[i] i += 1 j -= 1 qsort(l,i-1) qsort(j+1,r) def...
a6977d3d250cc3361c180b45ee3f3bd9882ec6b6
rvyoges/python
/looping/natural-numbers.py
147
4.34375
4
#Write a program to print all natural numbers from 1 to n. - using while loop n=int(input('Enter a number:')) i=1 while(i<n+1): print(i) i=i+1
273df2f381f72f76c76af269fbb31eccbda0f2fb
allisgao/pcc-study
/Section1_Getting_started/Chapter7/7.3.3_mountain.py
719
4
4
#! python3 responses = {} # 设置一个标志,指出调查是否继续 polling_active = True while polling_active: # 提示输入被调查者的名字和回答 name = input("\nWhat's your name?\n") response = input("\nWhich mountain would you like to climb someday?\n") # 将反馈存储到字典中 responses[name] = response # 看看是否还有人要参加调查 repeat = input("Wou...
38d634bba3018d62792871b9caf1d2c328309d5b
allisgao/pcc-study
/Section1_Getting_started/Chapter7/7.1.1_greeter.py
270
4.0625
4
# coding=utf-8 """ name = input("Please enter your name: \n") print("Hello, %s!" % (name)) """ prompt = "If you tell us who you are, we can personalize the message you see." prompt += "\nWhat is your first name?\n" name = input(prompt) print("\nHello, %s!" % (name))
c3e1e98869fb0e63c9e1a63c37c5abc11bad701c
allisgao/pcc-study
/Section1_Getting_started/Chapter7/7-9.py
293
3.796875
4
#! python3 sandwich_orders = ['san1', 'pastrami', 'san3', 'san4', 'pastrami', 'pastrami', 'pastrami'] print("The pastrami is sold out.") while 'pastrami' in sandwich_orders: sandwich_orders.remove('pastrami') print("We only have such things:") for i in sandwich_orders: print(i)
19ceda9be32a2fa39d6fe5c561bce133e551dd4b
allisgao/pcc-study
/Section1_Getting_started/Chapter11/11.1/names.py
406
3.765625
4
# coding=utf-8 from name_function import get_formatted_name print("Enter q at any time to quit.") while True: first = input("\nPlease give me the first name:\n") if first == 'q': break last = input("\nPlease give me the last name:\n") if last == 'q': break formatted_name = get_fo...
7b870c6343ba5552fab0ac318a9b3ffa2145ab45
allisgao/pcc-study
/Section1_Getting_started/Chapter11/11.2/test_survey-11.2.4.py
1,028
3.875
4
# coding=utf-8 import unittest from survey import AnonymousSurvey class TestAnonymousSurvey(unittest.TestCase): """ specify to AnonymousSurvey-class's test""" def setUp(self): """ create an object surveyed and a group of answers, for testing-methon using """ question = "What ...
7bb1d3ca6e0d15b41b2d00b86667a1b8875fd37b
allisgao/pcc-study
/Section1_Getting_started/Chapter7/7-4_pizza.py
204
3.890625
4
#! python3 msg = "Please input sdgaesddes.\nEnter 'quit' to quit.\n" a = '' while a != 'quit': a = input(msg) if a != 'quit': print("We'll add %s to your pizza." % (a)) continue
b97cbc43a419e6cc1026e100bac4c7044bd1bebe
allisgao/pcc-study
/Section1_Getting_started/Chapter7/7-5.py
856
3.84375
4
#! python3 """""" while True: age = input("Please input your age:\n") if int(age) < 3: price = 'free' break elif 3 <= int(age) <12: price = '10' break else: price = '15' break print("Yoru age is %s, and your ticket's price is %s" % (age,price)) """ while...
cfe863538341914ae6c1948e5fcb50dffa6290f7
allisgao/pcc-study
/Section1_Getting_started/Chapter6/6-3.py
328
3.671875
4
#! python3 lang_dic = { 'python': 'python language', 'c': 'c language', 'ruby': 'ruby language', 'java': 'java language', 'c#': 'c# language' } # print language and its explain for k,v in lang_dic.items(): #print("%s : %s\n" % (k,v)) print("Key: " + k.title() + " \nValue: " + v.title()...
7c88c501389fd682721b80d36a7597d45ddf02fa
allisgao/pcc-study
/Section1_Getting_started/Chapter7/7-2.py
279
4.21875
4
#! python3 # ask how many peoples num = input("Please input how many peoples:\n") # if number > 8, no free tables. """ num = int(num) if num > 8: """ if int(num) > 8: print("Sorry, We donnot have a free table for %s peoples." % (str(num))) else: print("Yes, please.")
c8470455b722c71439b8ecd1b65395e2066beba8
allisgao/pcc-study
/Section1_Getting_started/Chapter9/9-5_users.py
1,380
3.546875
4
#! python3 ## need some adjusting. class User(): def __init__(self, firstname, lastname, **info): self.fname = firstname self.lname = lastname self.login_attempts = 0 for key, value in info.items(): #infos = {} self.key = key self.value = value ...
4a4feda76574b6ec82f307423c972148af719d2b
allisgao/pcc-study
/Section1_Getting_started/Chapter8/8.5.1_pizza.py
273
3.984375
4
#! python3 def make_pizza(size, *toppings): print("\nMaking a %s-inch pizza with the following toppings:" % str(size)) for topping in toppings: print("- %s" % topping) make_pizza(6, 'pepperoni') make_pizza(12, 'mushroom', 'green peppers', 'extra cheese')
c63d1f846bb9b37065e4f8f610310edd340cde58
sphenginx/python
/draw_5rings.py
384
3.984375
4
# 基于 turtle 库, 画一个五环 from turtle import * colors = ['blue', 'black', 'red', 'yellow', 'green'] for i in range(5): x = -100+100*i if i < 3 else 50*(-1)**i y = 50 if i < 3 else 0 up() goto(x, y) width(5) down() color(colors[i]) circle(40) ''' 标注 ''' color('pink') up() goto(-80, -80) down() write("the Olympic ...
6c90a31e96ebf7f86ca3aea96234e058e5d17519
sphenginx/python
/Fibonacci.py
185
3.96875
4
#Fibonacci def fibonacci(n): a, b = 0, 1 if n <= 1: print("参数不得小于1") pass while b < n: print(b) a, b = b, a + b # 100 以内的斐波纳契数列 fibonacci(100)
dc61817195542f06097e09e6ec3371a408a370ac
dark5plder/python
/plusminus.py
583
3.703125
4
#!/bin/python3 import math import os import random import re import sys # Complete the plusMinus function below. def plusMinus(arr): n=len(arr) p=0 m=0 z=0 for i in range(0,n): if (arr[i]>0): p=p+1 elif (arr[i]<0): m=m+1 else: ...
b602fa5224a11d9b9f9334cade840c34cbd09db4
inovizz/chess-moves
/test_chess.py
2,791
3.734375
4
"""Test case for chess.py.""" import unittest from chess import Chessercise class ChessTestCase(unittest.TestCase): """ChessTestCase class for unit testing Chessercise class.""" def setUp(self): """Setup() method.""" self.obj = Chessercise() def test_find_coordinates(self): """Te...
af9090c5c958837425df1087c506047b40a00243
RobertNolet/Advent-of-Code-2020
/aoc7/aoc7.py
1,024
3.59375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Dec 7 08:46:42 2020 @author: robertnolet """ import re pat = re.compile(r'(\d+) (\w+ \w+) bags{0,1}\.{0,1}') # Load input data as a dictionary. The key is the type of bag, the value is # a list of tuples (n, b) where n is the number of bag type b co...
dfc71c76027824bc34ea0180bcc0b10d842b77ee
RobertNolet/Advent-of-Code-2020
/aoc10/aoc10.py
748
3.625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Dec 10 09:25:03 2020 @author: robertnolet """ from numpy import diff, prod from itertools import groupby data = diff([0] + sorted(map(int, open('input.txt')))) # Part 1 print(sum(data == 1)*(sum(data == 3)+1)) # Keep a cache of return value for the ...
ae84a2342f995ee85bb43a81b8d9e3532821a977
RobertNolet/Advent-of-Code-2020
/aoc1/aoc1.py
463
3.578125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Tue Dec 1 09:14:01 2020 @author: robertnolet """ from itertools import combinations from functools import reduce # Load puzzle input. data = [int(line) for line in open('input.txt')] def solve(part): for s in combinations(data, part+1): if...
5e84ce33ad5a6744712552830b41717386ee9c24
marvinsenjaliya/Object_Oriented_Programs
/cliniquemanagement/Doctors.py
2,324
3.71875
4
import json class Doctor: def __init__(self): self.data=dict() with open("Doctors.json") as json_file: self.data=json.load(json_file) def searchDoctors(self): while True: print("Search the doctor:") print("1:Using Availability") ...
a02c152ae289dc1b1cc731e75bd7e5038a8bd53f
PythonProgrammingPracticals/Prac02
/string_formatting_examples.py
1,259
4.25
4
""" CP1404/CP5632 - Practical """ #-------------- Exercise 01 ------------------- name = "Gibson L-5 CES" year = 1922 cost = 16035.40 # The ‘old’ manual way to format text with string concatenation: print("My guitar: " + name + ", first made in " + str(year)) # A better way - using str.format(): print("My {0} was fi...
0cbf1eb3a99fd7e43f5721f825949e53a956af66
kyroath/argosaiinternship
/server.py
3,191
3.765625
4
import io import socket import sys def hint(): USAGE = "python3 server.py <hostname> <port>" print("Hint: {hint}".format(hint=USAGE)) if (len(sys.argv) < 2): print("Hostname not given, exiting...") hint() sys.exit(-1) HOST = sys.argv[1] if (HOST == 'localhost'): HOST = '127.0.0.1' if (len...
2ef6b2ff3d03811dc07300b870fb0b5ecb85524f
beluu2/molderia-
/prueba0/diccionarios.py
791
3.734375
4
def llenar_diccionario(diccionario_vacio_o_no): resultado = dict(diccionario_vacio_o_no) resultado["valor_1"] = 0 resultado["nombre"] = "juan" resultado["cantidad"] = 10 return resultado def llenar_diccionario_por_keys(diccionario_vacio_o_no): resultado = {} for key in diccionario_vacio_o_n...
d149c325e9179dcd9305b2e6553f13077a555d79
lumbduck/euler-py
/archive/p004.py
1,186
4.34375
4
""" A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99. Find the largest palindrome made from the product of two 3-digit numbers. """ digit_limit = 3 factor_upper_limit = sum([9 * (10 ** i) for i in range(digit_limit)]) factor_lower_limi...
f6fa132c76d39bd585515008f60bc63c2f9f7356
lumbduck/euler-py
/p062.py
3,022
3.921875
4
""" Cubic Permutations The cube, 41063625 (345^3), can be permuted to produce two other cubes: 56623104 (384^3) and 66430125 (405^3). In fact, 41063625 is the smallest cube which has exactly three permutations of its digits which are also cube. Find the smallest cube for which exactly five permutations of its digits ...
34a4184a2b769a93586ed5835bbef0fc4289d0f1
lumbduck/euler-py
/archive/p026.py
1,469
4.15625
4
""" A unit fraction contains 1 in the numerator. The decimal representation of the unit fractions with denominators 2 to 10 are given: 1/2 = 0.5 1/3 = 0.(3) 1/4 = 0.25 1/5 = 0.2 1/6 = 0.1(6) 1/7 = 0.(142857) 1/8 = 0.125 1/9 = 0.(1) 1/10 = 0.1 Where 0.1(6) means 0.166666..., and has a 1-digit recurring cycle. ...
c29a595691e97cce5add6337e21f72128fa24d43
lumbduck/euler-py
/archive/p048.py
2,168
3.859375
4
""" Self Powers The series, 1^1 + 2^2 + 3^3 + ... + 10^10 = 10405071317. Find the last ten digits of the series, 11 + 22 + 33 + ... + 10001000. """ from time import time from timeit import timeit limit = 1000 digit_limit = 10 def get_slice(n, digits): return int(str(n)[-digits:]) def run(digits=digit_limit, ...
14015fd7e28a37247a2908f040f9b9969a1e1278
lumbduck/euler-py
/archive/p012.py
1,764
4.125
4
""" The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... Let us list the factors of the first seven triangle numbers: 1: 1 3: 1,3 6: 1,2,3,6 10: 1,2,5,...
27b59d45e2c67ff714ae7e393d6ea6f1bc902c9e
Fezekile-hue/pdsnd_github
/bikeshare.py
7,661
4.40625
4
import time import pandas as pd import numpy as np CITY_DATA = {'chicago': 'chicago.csv', 'new york': 'new_york_city.csv', 'washington': 'washington.csv'} def get_filters(): """ Asks user to specify a city, month, and day to analyze. Returns: (str) city - name of the c...
68f8571591deaf98d770b318763ee26aef356d97
tisya207/c97-project
/game.py
585
4.21875
4
import random number = random.randint(1,9) #print(number) print('GUESS A NUMBER: (you random no. range is 1-9)') chances=1 while chances <=5: guess=int(input('enter your guess ')) print(guess) if guess == number: print("congo you've guessed the no. right!!") break elif guess...
5097636c1e37e11fa5834f438633a5adec41f986
Nandhinipandari/python
/function.py
95
3.609375
4
def add(a,b): return a+b print(add(10,20)) def add(): a=2 b=3 c=a+b return c print(add())
aa66443fd89c39bd3d53099c04c4e35fd8ac42a3
FranciscoThiesen/OldProblems
/URI/a.py
460
4.09375
4
from math import * import sys def isPrime(n): if(n < 2): return False if(n == 2 or n == 3): return True if(n%2 == 0 or n%3 == 0): return False i = 5 while i * i <= n: if n%i == 0 or n%(i+2) == 0: return False i = i + 6 return True try: while True: n = int(raw_input()) if n == 2: print(1) e...
bad1cf7fc9c7e6e7c59015de4957004c9bba9d17
VikramTiwari/learnpythonthehardway-python3
/lpthw/ex5.py
787
4.25
4
name = 'Zed A. Shaw' age = 35 # not a lie height = 74 # inches weight = 180 # lbs eyes = 'Blue' teeth = 'White' hair = 'Brown' print(f"Let's talk about {name}.") print(f"He's {height} inches tall.") print(f"He's {weight} pounds heavy.") print("Actually that's not too heavy.") print(f"He's got {eyes} eyes and {hair} ha...
8751eed95c8edcf5a695f2793b4a2c8b765a86dd
abhishek-basu-git/qikify
/qikify/controllers/KNN.py
1,108
3.71875
4
from sklearn.neighbors import KNeighborsClassifier class KNN(object): """This class implements the K Nearest Neighborhood Algorithm. """ def __init__(self, n_neighbors=5): self.knnmodel = KNeighborsClassifier(n_neighbors) def fit(self, chips): """Primary execution point where a tr...
7390a7580c6d839ae5877e2b43cbaad6c2838ca2
NamJaeyong/pythonNam
/과제.py
682
3.6875
4
#과제1-1 result = 0 for n in range(1, 1000): if n % 3 == 0 : result += n print(result) #과제1-2 i = 5 while True: i -= 1 if i < 1: break print ('*' * i) #과제1-3 grade = [20, 55, 67, 82, 45, 33, 90, 87, 100, 25] result = 0 while grade: human = grade.pop() if human >= 50: ...
44b77166d1bdf3f115e5d80aa14668a02cd8ae98
EDD-2018-2/NicolasSzoloch2
/Tarea parte 2.py
1,940
3.984375
4
# Recibe en Notacion Polaca, retorna valor algebraico # Alumno: Nicolas Szoloch """Ejercicio 2 Ejemplo notación polaca (5 - 6) * 7 <=> * (- 5 6) 7 ((15 / (7 - (1 + 1))) * 3) - (2 + (1 + 1)) <=> - * / 15 - 7 + 1 1 3 + 2 + 1 1 """ import operator class Nodo: def __init__(self, value): self.value = value ...
02d6806f83ecd1a07ebbefd755b3c53a638dba37
Rehket/Python_Practice
/Src/intro.py
1,927
4.21875
4
# Really need to refresh python, holy crap. import argparse parser = argparse.ArgumentParser(description='Process some integers.') parser.add_argument('integers', metavar='N', type=int, nargs='+', help='an integer for the accumulator') args = parser.parse_args() print(args) print('Hello World!' ...
ef3bce7c5d3c00dec66d0d17d6fd0fcb57257053
Davinderpro01/neuralproxus
/neural.py
1,750
3.828125
4
#librería para interfaz gráfica from tkinter import * # esta es la función que ejecuta la división def Dividir(): if float(Vartexto2.get()) == 0: VarResultado.set("no se puede dividir dentro de 0") else: if float(Vartexto1.get()) % float(Vartexto2.get()) == 0: VarResultado.set("...
181e440b6447e20baa7ef7346e661e4d245a62d2
Noel-bk/HackerRank
/tutorials/30-days-of-code/lets-review.py
204
3.75
4
# Enter your code here. Read input from STDIN. Print output to STDOUT test_case = int(raw_input().strip()) for i in range(test_case): string = raw_input() print(string[::2] + ' ' + string[1::2])
12b3eda0fa0f9affda3bce4533e2eca08f2cf6bf
DS-Popeye/uri-solutions
/1073-quadrado_de_pares.py
107
3.71875
4
n = int(input()) for i in range(n): if (i+1) % 2 == 0: print("{}^2 = {}".format(i+1, (i+1)**2))
c8375cc76dc23ccc54631fa586280d699adff1e7
gpsevdiotis/CM1101-Team_Project_Game
/team_game/map.py
11,837
3.65625
4
from items import * from maze import * room_master_bedroom = { "name": "The Master Bedroom", "description": """You've woken up in a strange room and find yourself lying on the cold floor in the corner ofthe room. You notice a lit fireplace and you feel warm and a sense of hope, you don't understand i...
77ac34ae9c483b38100efaeaa08f48a666f49269
abidemi-mina/classes
/day4/argument.py
304
3.578125
4
def argument(name1,name2): print(name1,name2) argument ('hhhyg','hbhb') def arguments(*unlinmited): print(unlinmited) arguments('aminat','belo','glory','arike','atoke') def addition(*add): total = 0 for n in add: total += n print(total) addition(24,34,24,84,584)
f9c405feb9599c2ec5151285688a0d40831c9b2c
abidemi-mina/classes
/day2/chapter3/if-state.py
255
4.21875
4
a = 5 b = 3 # if a < b: # print('a is greater than b') # else : # print('we are confused') # RESULT = else print # if a > b: # print('a is greater than b') # else : # print('we are confused') # RESULT = if print
02bb41abfdb85103013e4e9de7e39215665dc0d3
abidemi-mina/classes
/day2/chapter3/else-if.py
140
4.21875
4
a = 5 b = 6 if a < b: print('a is less than b') elif a == b: print('a is equal to b') elif a!= b: print('a is not equal to b')
c0ee2d2878bb66edd7804af2c935f2b27f8f7a64
abidemi-mina/classes
/day1/chapter2/variable.py
110
3.515625
4
# num1 = 5 # num2 =7 # add = num1 + num2 # print(add) mut1 = 3 mut2 = 4 mutiply = mut1*mut2 print(mutiply)
b7367e9f4ad4a0b9e9ccd0f288cb87dd1df04884
rumble-up/wifi-fingerprint-v0
/z_sandbox.py
2,105
3.5
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Feb 14 12:42:34 2019 @author: chief """ # Load the library with the iris dataset from sklearn.datasets import load_iris # Load scikit's random forest classifier library from sklearn.ensemble import RandomForestClassifier # Load pandas import pandas a...
3779053a627f33d0b6de59aac22b96e03a339a54
xxyyxyyxxyyx/Machine_Learning_A-Z
/Part 2 - Regression/Section 4 - Simple Linear Regression/my.py
1,066
3.890625
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt # Import data dataset = pd.read_csv('Salary_Data.csv'); X = dataset.iloc[:,:-1].values Y = dataset.iloc[:,1].values # Splitting data into training and test set from sklearn.cross_validation import train_test_split X_train, X_test, Y_train, Y_test =...
29787b911be7b4597e792bedeb6d229771f4c3df
issacwill/1DV501
/Assignment 2/random_numbers.py
1,184
3.6875
4
from random import randint def min(list_of_numbers): min=list_of_numbers[0] for i in list_of_numbers: if i<min: min = i return min def max(list_of_numbers): max = list_of_numbers[0] for i in list_of_numbers: if i>max: max = i return max def avrage(list_of_numbers): s = 0 ...
939df6b94ba8c6bf16e11506c66198c1fd6e3ca6
issacwill/1DV501
/eb222wb_assign3/count_lines.py
1,853
3.625
4
import os dir_path = os.getcwd() #dir_path = dir_path + '/testMapp/coolcat.jpg' #jag väljer att testa om första sökvägen existerar. #jag tänker att eftersom funktionerna sedan hämtar saker som # finns i den sökvägen så borde det inte kunna uppstå några fel # utöver att den yttre sökvägen inte finns eller möjligtvis ...
c011dd37990f61d88cd309df6d478ebd01cbca46
issacwill/1DV501
/Assignment 2/palindrome.py
844
3.859375
4
def remove_all_but_small(string_): for i in range(32, 97): string_ = string_.replace(chr(i), '') for i in range(123, 127): string_=string_.replace(chr(i), '') return string_ def is_palindrome(string_): string_ = string_.lower() string_ = remove_all_but_small(string_) length = le...
c27a780f626cf5abdcb0d922836a79c97c29102a
issacwill/1DV501
/Assignment 2/countdigits.py
641
3.984375
4
try: int_string = input('Enter a large possitive integer(at least 4 digits): ') length = len(int_string) if int(int_string) < 0: print('Your number is not possitive') exit(0) if length < 4: print("Your number does'nt have enough digits") exit(0) except ValueError as lett...
9f142d386e9a56f1b5282874f60c3f6a12f69233
zahirr12/shapeai-project
/2nd.py
581
3.734375
4
import hashlib strData = input("Enter the string data : ") #sha256 shaHashObj = hashlib.sha256(strData.encode('utf-8')) sha256 = shaHashObj.hexdigest() print("=> The sha256 of " + strData + " is : " + sha256 + "\n") #Blake2b blakeHashObj = hashlib.blake2b(strData.encode('utf-8')) blake2b = blakeHashObj....
105836da69fba7a079eb6ee2f14008f02f16e417
famalhaut/ProjectEuler
/problems_20s/problem_21.py
914
3.875
4
""" Amicable numbers Problem 21 Let d(n) be defined as the sum of proper divisors of n (numbers less than n which divide evenly into n). If d(a) = b and d(b) = a, where a ≠ b, then a and b are an amicable pair and each of a and b are called amicable numbers. For example, the proper divisors of 220 are 1, 2, 4, 5, 10, ...
13d810b3fe7a614cdd15006225b141941664ab35
famalhaut/ProjectEuler
/problems_10s/problem_19.py
1,490
4.125
4
""" Counting Sundays Problem 19 You are given the following information, but you may prefer to do some research for yourself. 1 Jan 1900 was a Monday. Thirty days has September, April, June and November. All the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine. And on leap years, twen...
993277354e6fbecb4ab3fafd572b4e0d5f39be37
famalhaut/ProjectEuler
/problems_20s/problem_23.py
2,442
3.8125
4
""" Non-abundant sums Problem 23 A perfect number is a number for which the sum of its proper divisors is exactly equal to the number. For example, the sum of the proper divisors of 28 would be 1 + 2 + 4 + 7 + 14 = 28, which means that 28 is a perfect number. A number n is called deficient if the sum of its proper div...
c87bff61a7d0f3a1c8e2992055516ec793dc0825
famalhaut/ProjectEuler
/problems_60s/problem_67.py
1,248
3.796875
4
""" Maximum path sum II Problem 67 By starting at the top of the triangle below and moving to adjacent numbers on the row below, the maximum total from top to bottom is 23. ---test_nums--- That is, 3 + 7 + 4 + 9 = 23. Find the maximum total from top to bottom in triangle.txt, a 15K text file containing a triangle with...
575f261efa583ae25688e88cce2169b5d1617f02
famalhaut/ProjectEuler
/problems_30s/problem_36.py
1,031
3.515625
4
""" Double-base palindromes Problem 36 The decimal number, 585 = 10010010012 (binary), is palindromic in both bases. Find the sum of all numbers, less than one million, which are palindromic in base 10 and base 2. (Please note that the palindromic number, in either base, may not include leading zeros.) """ def prob...
4ac3b62309b907be6e6924aeb6e68314a2724346
yashika0998/snake-game-python
/snake_game.py
5,203
4.125
4
import turtle #library for python graphics import time import random delay = 0.1 score=0 high_score=0 #module1 #building the screen w = turtle.Screen() w.title("Snake Game by yashika") w.bgcolor("skyblue") w.setup(width = 600, height = 600) w.tracer(0) #turns off screen updates (makes faster) #...
2f6ef90ce7e24cd493b723bacb8f26ef033e4c11
renuka28/hackerrank
/python/tuples.py
322
3.65625
4
def get_hash(integer_list: list): return hash(tuple(integer_list)) if __name__ == '__main__': n = int(input("total number of integers - in tuples.py")) integer_list = map(int, input( "enter {} integers seprated by space = ".format(n)).split()) print("hash = {}".format(get_hash(integer_list))...
24ade0ab249372fc3b03c2c12b938da26e010e6f
Raphib737/gameTheoryFinalProject
/player.py
4,555
3.796875
4
import random class Player(): name = "User Input" def __init__(self): self.moves = []; self.wins = 0; self.losses = 0; self.ties = 0; self.logistics = {}; def strategy(self,opponent): i = "" while( i != "C" and i != "D"): i = input("Enter C (cooperate) or D(defect)"); moves.append(i); return ...
e513beb153c5d2a99d7bd4229bb613b896b0bbbd
Turry99/Python-scripts
/Matrix.py
5,320
3.703125
4
import sys "Simple matrix calculator" f = [] g = [] h = [] try: nrTotal = int(input("X*X? (Matrice patratica , max4)\n> ")) except ValueError: print("Ai gresit tu ceva sigur") sys.exit(0) for x in range(0,nrTotal): f.append(x) g.append(x) h.append(x) # Define functions ...
a1d05ad1e8166a2accedea9afef0706ac6c8881e
Naposprograms/Robotics_Lab_1
/Part_2.py
1,090
3.5
4
""" Dada una imagen de una figura geométrica detectar los vértices de dicha figura mediante el método de Harris Corner y marcarlos en la imagen original. """ import cv2 import os import numpy path = os.getcwd() image_path = "/Images/cuadrado.jpg" path += image_path image = cv2.imread(path) check_image_type = str( typ...
158e0764b3c10b67ff45a9fa11916d85e37b3d89
devmubeen/nc-methods
/Lagrangian.py
1,767
3.78125
4
import numpy as np import matplotlib.pyplot as plt print('lagrangian Implementation \n') try: xValues = input("Enter Input x Values , Separated: \n") xArr = np.array([]) for i in xValues.split(','): xArr = np.append(xArr, i) xArr = xArr.astype(float) print("x: ", xArr) yValues ...
2e8937f076643519b297c273da6e2e24f643f1f5
smi7hy96/oop-intro
/cat_class_tests.py
1,022
3.671875
4
import unittest from cat_class import Cat class CatTest(unittest.TestCase): def setUp(self): self.cat = Cat('Aggressive', 'Ginger', 'Mufasa', True, 'Tabby', 5) def test_attack(self): self.assertEqual(self.cat.attack(), 'HISS') self.cat.sleepy = True self.assertEqual(self.cat.a...
b25900d9a796211f2a460fedc3c49c33653519e9
kezben/Software-Interview-Questions
/fizzbuzz-advanced.py
136
3.9375
4
def fizzbuzz(i): return ("fizz"*(i%3==0)+"buzz"*(i%5==0) or str(i)) num = int(input("Enter a number: ")) print(fizzbuzz(num))
280e5a9571138b604fdaae7c712d03cbea059b9f
mmdobal/katas
/python/7kyu_Regex_validate_PIN_code.py
486
3.859375
4
# ATM machines allow 4 or 6 digit PIN codes and PIN codes cannot contain anything but exactly 4 digits or exactly 6 digits. # If the function is passed a valid PIN string, return true, else return false. #Link: https://www.codewars.com/kata/55f8a9c06c018a0d6e000132 import re def validate_pin(pin): result = Fals...
ba04c63ac5de30ceccb9fe16534e728abcc47056
tati5021/Number
/prime.py
570
4.40625
4
#This 'prime.py' module simply lists all the prime numbers. #First it prompts the user to enter a number. # Then the entered number which is actually a string is #converted to the integer.Then the prime(num) function is called #which finds all the prime numbers upto the entered number on the screen def prime(...
1ce0538fa7b26bcbb5985b9367c5d40cb8de8226
Arnabsaha6/Snakify
/Polygots.py
308
3.71875
4
Code: students = [{input() for j in range(int(input()))} for i in range(int(input()))] known_by_everyone, known_by_someone = set.intersection(*students), set.union(*students) print(len(known_by_everyone), *sorted(known_by_everyone), sep='\n') print(len(known_by_someone), *sorted(known_by_someone), sep='\n')
c4034d4501f97e576ae9b3448f8d9e2e4f6f2a64
Arnabsaha6/Snakify
/TheLengthofSequence.py
62
3.671875
4
Code: len = 0 while int(input()) != 0: len += 1 print(len)
9f6c5e1811d2aecb9fc54b7b5e16227f7e64390b
Arnabsaha6/Snakify
/RookMove.py
635
4.21875
4
Rook move Statement Chess rook moves horizontally or vertically. Given two different cells of the chessboard, determine whether a rook can go from the first cell to the second in one move. The program receives the input of four numbers from 1 to 8, each specifying the column and row number, first two - for the first ce...
811eb74e1674ad4c52e7e1156e255342a2039a16
Arnabsaha6/Snakify
/Lostcard.py
262
3.578125
4
Code: n = int(input()) sum_cards = 0 for i in range(1, n + 1): sum_cards += i # One can prove the following: # sum_cards == n * (n + 1) // 2 # However, we'll calculate that using the loop. for i in range(n - 1): sum_cards -= int(input()) print(sum_cards)
3da626cf3ed4f41962d462563c9d0f23ff42e7fd
Arnabsaha6/Snakify
/ElectionsInTheUSA.py
237
3.578125
4
Code: num_votes = {} for _ in range(int(input())): candidate, votes = input().split() num_votes[candidate] = num_votes.get(candidate, 0) + int(votes) for candidate, votes in sorted(num_votes.items()): print(candidate, votes)
0b09df644926f1ddff1b2d7988ec5dc4288df842
sujaymansingh/sujmarkov
/sujmarkov/tests.py
1,371
3.5625
4
import unittest import sujmarkov class TestGetNGrams(unittest.TestCase): def test_get_ngrams_from_string(self): """Test that we fetch ngrams from a string. """ original_string = "raspberry" bigrams = list(sujmarkov.get_ngrams(original_string, n=2)) self.assertEqual( ...
e5316744f454234d14c5ac3491971b834abb1455
MohitBaid/HackerEarth
/Practice/Math/Basic Number Theory - 2/ZrZr.py
106
3.515625
4
for _ in range(int(input())): n=int(input()) ans=0 p=5 while n//p > 0: ans+=n//p p=p*5 print(ans)
74b4a5fe8f391385b659d73970ffa05ecfa78569
gabriel-guobin/python0
/ex15-1.py
437
3.640625
4
# -*- coding: utf-8 -*- #提示输入文件名,并将输入的文件名称返回到变量 filename filename = raw_input(" Type the filename ") # 设定变量 txt , 执行 open() 函数打开 变量 filename 指向的文件 txt = open(filename) # 执行变量 txt 指向的函数,打开文件,通过 read()函数 读取,并将文件内容作为字符串返回脚本,打印到屏幕 print txt.read() print txt.close()
7fa2051c5c1ffc8d3e2dc11728e932cbb8720134
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 2/Lecture 4 - Functions/In-Video Problems/Lec4.7Slide1.py
370
3.8125
4
# Lecture 4.7, slide 1 # This is a module containing functions pertaining to circles and spheres. pi = 3.14159 def circleArea (radius): return pi * (radius ** 2) def circleCircumference (radius): return 2 * pi * radius def sphereSurfaceArea (radius): return 4.0 * pi * (radius ** 2) def sphereVolume (ra...
4b9f24a4e4ad415479735bedbd0090c026bffe28
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 5/Lecture 10 - Memory and Search/In-Video Problems/Lec10.2Slide2.py
496
3.90625
4
# Lecture 10.2, slide 2 def search(L, e): # Goes through every element in the list. for i in range(len(L)): # If that element is equal to e, it returns True. if L(i) == e: return True # However, if it is greater than e, it must have surpassed its value, so it returns False. ...
8832d31e23e37147f9c8fe7f48bae71b07b71739
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Quiz/QuizProblem4.py
230
3.5625
4
# Quiz, Problem 4 def isPalindrome(aString): ''' aString: a string ''' for i in range(len(aString)): if aString.lower()[i] != aString.lower()[len(aString) - i - 1]: return False return True
b0ad9a8df9b8fb725a8dda1e9244c692c128faba
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 3/Lecture 6 - Objects/In-Video Problems/Lec6.1Slide4.py
414
4.03125
4
# Lecture 6, slide 4 def findDivisors(n1, n2): ''' assumes n1 and n2 are positive integers returns tuple containing common divisors of n1 and n2 ''' divisors = () # The empty tuple. for i in range(1, min(n1, n2) + 1): if n1 % i == 0 and n2 % i == 0: divisors += (i,) retu...
c316329d5f0367eca51d50ed3a5aaf50dbb69113
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 3/Lecture 6 - Objects/Questions/Lec6Problem10.py
951
4.21875
4
# Lecture 6, Problem 10 def howMany(aDict): ''' aDict: A dictionary, where all the values are lists. returns: int, how many values are in the dictionary. ''' count = 0 for i in range(len(aDict.values())): for j in aDict.values()[i]: count += 1 return count def howMany2(...
a7996050f99fb4eb8ae9fbf1fbbfbc83188c460f
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 3/Lecture 6 - Objects/Questions/Lec6Problem5.py
174
3.9375
4
# Lecture 6, Problem 5 aList = range(1, 6) bList = aList aList[2] = 'hello' print(aList == bList) cList = range(6, 1, -1) dList = [] for num in cList: dList.append(num)
be14be5cae32f671cad192f72ee29b0952d871e4
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 2/Lecture 3 - Simple Algorithms/In-Video Problems/Lec3.2Slide6.py
446
4.34375
4
# Lecture 3.2, slide 4 x = int(raw_input('Enter an integer: ')) ans = 0 # Checks if the cube of the answer is less than x. while (ans ** 3 < abs(x)): ans += 1 # If answer cubed does not equal x, then x is not a perfect cube. if (ans ** 3 != abs(x)): print (str(x) + ' is not a perfect cube.') # Otherwise...
00debd193621e5c2b61dc5e736bb962f25b488ed
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 2/Lecture 3 - Simple Algorithms/In-Video Problems/Lec3.5Slide2.py
827
4.375
4
# Lecture 3.5, slide 2 # This code finds the square root of real numbers to 2 decimal places. x = 25 epsilon = 0.01 stepSize = epsilon ** 2 numGuesses = 0 ans = 0.0 # Keeps looping while the difference between ans^2 and x is greater than the epsilon and the answer is less than x. # Each time, the answer is increased...
f69cd6a8f3e6e59bfaf59a0317c65c25996de293
roshan2M/edX--mitX--introduction-to-computer-science-and-programming-with-python
/Week 4/Lecture 8 - Assertions and Exceptions/In-Video Problems/Lec8.3Slide2.py
682
3.984375
4
# Lecture 8.3, slide 2 def getRatios(v1, v2): ''' assumes v1 and v2 are lists of equal length of numbers returns a list containing the meaning full values of v1[i] / v2[i] ''' ratios = [] for index in range(len(v1)): try: ratios.append(v1[index]/float(v2[index])) exc...