blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
a6952e323533f0cf09b0835b440d10c5edaae4b8
hoddere/LEAPCodemakers2018
/quizPrototype/QuizItUpPrototype.py
6,264
3.640625
4
#File: QuizItUpPrototype.py #Author: Emily Hodder #Date Created: May 15, 2018 #Date Edited: July 22, 2018 from tkinter import * from winsound import * from tkinter import ttk def play(): PlaySound('funky.wav', SND_ALIAS | SND_ASYNC) class QuizFrame(): questions = (("Which year was McMaster Unive...
b716d6351500eb1b1e17d9db036a0f5297786b67
nitish-nagesh/real-time-soil-environment-monitor-with-pest-deterrence
/cse237a-FinalProject-original/dkoohmar_nnagesh.project.code/sensors/motion_sensor.py
1,246
3.8125
4
# Code modified from # https://thepihut.com/blogs/raspberry-pi-tutorials/raspberry-pi-gpio-sensing-motion-detection import RPi.GPIO as GPIO import sensor import time def print_motion(): print("Motion detected!") class MotionSensor(sensor.Sensor): # Note: for raspberry pi, the pi...
73e8e3726531f1e14d4e48ee1e1a8b5e55714870
Ash-Tiger/workplace
/problems/10998.py
129
3.65625
4
a=int(input()) b=int(input()) c3 = a*(b%10) print(c3) c4 = int(a*(b%100/10)) print(c4) c5 = a*int(b/100) print(c5) print(a*b)
f0eb2816abe1464ed57b923664a5a97737c8f1f0
dgampel/passion-learn
/examples/binary_search.py
908
4.28125
4
def binary_search(array,first,last,x): array.sort() if last >= 1: #base case middle = 1 + (last - 1) // 2 if array[middle] == x: #if element is present at middle return middle if array[middle] > x: #if element is in left half ...
3ea20772dc16681e8f0a70956bf8c9d3d0e6a839
julian-kizanis-sav/Compare-QB-and-DT
/Compare Dtools and QB csv files.py
4,132
3.734375
4
print("Commpany:\tSAV Digital Environments\nDeveloper:\tJulian Kizanis\n\ Powered By:\tAnaconda\n\n") #from pandas import DataFrame import pandas as pd #import os import time import csv import re #first match manufacturer #Second match Accounting Item Name QB = pd.read_csv("QB Exported.csv") print(...
182ea9db6515bbed025a04d7cca1bef7bbac5c2c
Anshul-Swarnkar/Oops
/InheritanceSuperMethod.py
465
4.34375
4
class BaseClass: def hello_world(self): print("Hello Python from Base") def Bye(self): print("Bye Bye") class ChildClass(BaseClass): def hello_world(self): #BaseClass.hello_world(self) #here we are calling same method of BaseClass super().hello_world() # here you can use ...
adb7b3fe3493aba3367bb01156b29ada5fcdcc58
HotchkissCP/cmimc2021
/cmimcoptimization3/bruteforce_bfs_closest.py
4,422
3.59375
4
# from ast import literal_eval # edit to the name of the input file task = "5" f = open('robotrecovery' + task + '.txt', 'r') # change this function however you want: it takes in a character representing a cell # of the maze and x/y coordinates and returns whatever representation you want def rep(c,x,y): if c == ...
fe88f257e9bb99ac43a6f7699895e43e4d756e84
HotchkissCP/cmimc2021
/cmimcai2/main.py
8,250
3.71875
4
# Scotty Dog Starter File # NOTE: You can run this file locally to test if your program is working. #============================================================================= # INPUT FORMAT: board # board: A 15 x 15 2D array, where each element is: # 0 - an empty square # 1 - the current position of Scotty ...
8b550bd4c598c25d40da3e93c0ddfdae848e2f53
Sri-Sai-Keerthana-Pantula/pythonproject
/dice.py
455
3.921875
4
import random min = 1 max = 6 while True: print('Do you want me to roll the dice?') answer = input() if answer.lower() == 'yes' or answer.lower() == 'y': dice_roll = random.randint(min, max) print(f''' The number is ... {dice_roll} ''') elif answer.low...
0593827c8ce12484910e1c4b4f3f8b1521b7ee41
maxyypoo/cs
/TotalofAll/ok/Total/Hw6-13/Wedding.py
283
3.640625
4
import math MAX_BUS = 40 guests = input('Please enter the amount of guests invited: ') busses = math.ceil(guests / float(MAX_BUS)) extraSpace = (busses * MAX_BUS) - guests print 'You will need ', int(busses), ' amount of busses and you will have ', int(extraSpace), ' extra space.'
51660f1b1678cc948fc4c9b7b89276a9f1a9a4d8
param-choksi/test
/calc.py
338
3.75
4
def add(a, b): """Addition Function""" return a + b def sub(a, b): """Subtraction Function""" return a - b def mul(a, b): """Multiplication Function""" return a * b def div(a, b): """Division FUnction""" if b == 0: raise ValueError('Can not divide with zero') else: ...
5802ceb7d5b4003282f466fa199db52fa7b25067
debonx/cs50x
/Python/houses/import.py
1,058
3.8125
4
from sys import argv from csv import reader from cs50 import SQL # main function def main(): # Check arguments if len(argv) < 2: print("Please use like: import.py file-to-import.csv") exit() processData(argv[1]) # process csv to sql # @param str file - path to file def processData(fi...
e89644f9ae975b08815394c47a0669ee65627f07
gopalanand333/Python-Basics
/dictionary-basic.py
333
4.71875
5
#! /usr/bin/env python03 # a dictionary is searchable item with key-value pair x = {"one": 1, "two":2, "three":3, "four":4,"five":5} # a dictionary for key in x: print(key) # this will print the keys for key, v in x.items(): print('key: {} , value:{}'.format(key, v)) # this will return the key val...
dd79a7f0b6b24d8655c54933f41da4960788c7e4
gopalanand333/Python-Basics
/comparision-operators.py
249
4.03125
4
# comparision operators x = 442 y = 2342 if x<y: print("TRUE") else: print("false") if x <= y: print("TRUE") else: print("false") if x == y: # exactly equal print("true") else: print("False")
bb4cb98ccab290fc494cc2a8d14210e9c9675f52
gopalanand333/Python-Basics
/conditional-arithematic-operators.py
247
4
4
#! /usr/bin/env python3 hungry = True # true /false x = "feed the doggo" if hungry else "he is not hungry" print(x) x = 5 y = 5 z = x*y zz = x/y # return floating value zzz = z//y # decimal division print(z) print(zz) print(zzz)
93d83d06c278faf133780afc39c2278644400be6
marumaru1019/atcoder
/problems/abc146_c.py
937
3.65625
4
# 二分探索 import math def binary_search(min_n: int, max_n: int, a: int, b: int, x: int) -> int: def val_fun(a: int, b: int, n: int) -> int: return a * n + b * len(str(n)) # 最小値と最大値が1未満になるように調整 while max_n-min_n > 1: # 最小値と最大値の半分 最小の整数を求めるので切り捨て n = (min_n + max_n)//2 # A×N...
90891d408c96117ed05e78ac418379acd3bc1505
jnapolit/NetworkSimulation
/ispb.py
6,012
3.8125
4
#ISPB #Receives packets from R2 and then counts which packets are going to which #subnets. (Refer to ISPA for more in code comments from socket import * from math import* from time import* #takes an IP address and an Address and tells if that IP is less than # or equal to the specified address by looking ...
d9258a5bf433a9e7ed0f075e0c8d4572f009fe82
guillermospindola/python
/01holamundo.py
197
3.78125
4
print("Hola Mundo") print("Esta es la segunda línea") print("Esta es la tercera y ultima línea, adios") #El código en python se puede separar en varias líneas con \ suma = 2 + \ 2 print(suma)
cf8f7e53abe76d754482adea348eb123fa3360c5
guillermospindola/python
/09argumentosavanzadosscripts.py
1,539
4.03125
4
""" Aqui se explica como aladir argumentos avanzados a los scripts """ #Los imports se añaden al principio de un scripts import argparse from modulo_importable import saludar_modulo, felicitar_modulo def parsear_argumentos_avanzado(): parser = argparse.ArgumentParser( description = "Descripcion ...
a0753b693326e0c468a830521a9f9bc42c211331
SeerLabs/CiteSeerX
/crawler/cdi/deletedir.py
890
3.859375
4
#!/usr/bin/python # delete the directory after importing is finished # If no parameter is provided, it will delete the "inputdir" in runconfig.py, # otherwise, the user can submit a directory and it will be deleted. # The user need to confirm the deletion # import runconfig import commands import os def startup(verbal=...
611f5b594392f19cfdfd856f6b03abc163dca650
jun4404/python_basic
/chapter02_02.py
1,592
3.78125
4
# Chapter02-2 # 파이썬 완전 기초 # 파이썬 변수 # 기본 선언 n = 700 #출력 print(n) # n에 저장되어있는 자료형을 보여준다. print(type(n)) print() # 동시 선언 x = y = z = 700 print(x, y, z) print() # 선언 var = 75 # 재선언 var = "Change Value" #출력 print(var) print(type(var)) # Object References # 변수 값 할당 상태 # 1. 타입에 맞는 오브젝트 생성 # 2. 값 생성 # 3. 콘솔 출력 # 예1) pri...
bca71aaee5edb821e785768284a84d7c7a9f0e9b
Flame753/Rock-Paper-Scissors
/Problems/Triangle/task.py
117
3.953125
4
height = int(input()) space = ' ' hash = '#' for x in range(1, height+1): print(space*(height-x) + hash*(x*2-1))
c14e7d4485e061c0ba803423010bebc480c4d251
handakki/str1
/project/subproject/error_.py
346
3.96875
4
def filename(): filename = input('Please input file name:') if filename == '123': raise NameError('input file name error') return filename while True: try: filename = filename() print ('filename is %s'%filename) break except NameError: print ('pleas...
dd167eb885d3fdee25ddd2ad6b7a91913fca56aa
sanklamm/Huffman-Code
/huffman_code.py
1,855
3.6875
4
#! /usr/bin/env python3 from sys import stdin string = '' # Class Node Tree class NodeTree(object): def __init__(self, left=None, right=None): self.left = left self.right = right def children(self): return (self.left, self.right) def nodes(self): return (self.left, self.ri...
f1638740f2ff0bc0e7bd97fe58e13bcbbc39dce7
DwiZaki/Dwi-Zaki-Nurfaizi_I0320029_Tiffany-Bella_Tugas4
/I0320029_exercise 4.6.py
166
4.03125
4
# string needle = "lo" haystack = "Hello World" #check if needle in haystack: print (needle, "is present in the string", haystack) else: print ("Not found")
e27c67ce58ce89b879fb16c6ac67b36b4f16b8e6
ItsTuukka/ot-harjoitustyo
/2048/src/game_logic/game2048.py
9,663
3.71875
4
import random class Game2048: """Luokka, jossa on pelin logiikka ja pelialusta. Attributes: __n: pelialustan pituus ja leveys, __board: pelialusta 2d matriisina, __score: pelin pistetilanne """ def __init__(self, size, board=None, r_seed=None): """Luokan konstruktori...
0c970c875eb48193965bfe9bdb0f933b3050c2d6
igorpsf/Data-structures
/List.py
4,186
3.84375
4
# Mutable A = [(1,2),(3,4),(5,6),(7,8)] for x, y in A: print(x, y) months = ['January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'] print(months[:6]) print(len(months)) print(months[0]) print(months[-1]) print(months[-2]) # second last, Novembe...
a10188feffd7e336e63704c6157fd4ee3bb5b779
papalagichen/caribbean-online-judge
/1002/source.py
523
3.6875
4
FREE = '.' OBSTACLE = '#' # return {'start index': 'free length', ...} def find_square(lines, current_line, index): free = {} for i in line: '' pass return free for i in range(int(raw_input())): line_count = int(raw_input()) lines = [] for i in range(line_count): li...
80b1bd7059f6d5f4d31754c3977eb462b051db6a
jibinsaji/coders-house-python-
/n_prod_FOR.py
109
3.75
4
n=int(input("enter limit")) k=n prod=1 for i in range(n,1,-1): prod*=i print("product upto",k,"is",prod)
14c6f80192dc3ebb49138c4aaaf886b514a3c6f9
jibinsaji/coders-house-python-
/palindrome.py
155
3.796875
4
n=int(input("enter the number")) k=n i=0 while n>0: d=n%10 i=i*10+d n=n//10 if i==k: print("palindrome") else: print("not palindrome")
12e520c4bf138135ff717e3da8edaad4960252a8
jibinsaji/coders-house-python-
/sum_element_FOR.py
179
3.890625
4
n=int(input("enter the size of list")) y=[] sum1=0 for i in range(n): k=int(input("enter integer")) y.append(k) sum1+=k print("the list is",y,"\nand the sum is",sum1)
118d86ee92775bdb6254b6a88ece716d5108847a
jibinsaji/coders-house-python-
/natural_rev_FOR.py
75
3.65625
4
n=int(input("enter limit")) for i in range(n,0,-1): print(i,"",end="")
4f8250e046fe08ad0d2d8ad866fdffce23831881
jibinsaji/coders-house-python-
/first_and_last.py
109
3.859375
4
n=int(input("enter the num")) last=n%10 while n>=10: n=n//10 print("sum of 1st and last is",last+n)
3e35cadc2dc47c34e2768f907934f0375a3a1907
anshuldec7/HackerRank_10_Days_of_Statistics
/Day0/Mean, Median, and Mode/solution_day_0_1.py
840
3.953125
4
# Enter your code here. Read input from STDIN. Print output to STDOUT n = input() elements = input() array_values = elements.split() numbers = [int(elem) for elem in array_values] # Get the mean mean = sum(numbers)/len(numbers) # Get the Median numbers.sort() length = len(numbers) if length%2 == 0: med1 = number...
16183b9b90e4babd9d063f5ab41d17ceb0af84d2
hljjj/python_note
/common/func.py
1,086
3.75
4
import inspect def print_var(var, context=""): """打印变量名及变量值""" name = retrieve_name(var) print(f"{context}{name} is {var}\n") def retrieve_name(var): """ Gets the name of var. Does it from the out most frame inner-wards. :param var: variable to get name from. :return: str...
d9f7f432ae2ac7e5b7391f187308a842922c812d
achanbour/matplotlib-project
/rollercoaster-project.py
4,738
3.671875
4
import pandas as pd import matplotlib.pyplot as plt # load rankings data here: wood_df = pd.read_csv('Golden_Ticket_Award_Winners_Wood.csv') steel_df = pd.read_csv('Golden_Ticket_Award_Winners_Steel.csv') #number of rankings by year wood_by_year = wood_df.groupby('Year of Rank').Name.nunique() steel_by_year = steel_d...
4fed1be25e050483de7c35277f07c6cc90d11edf
heitorbelloni/project-euler
/005/005.py
1,154
3.859375
4
import timeit def timed_execution(function, *args): start = timeit.default_timer() function(*args) end = timeit.default_timer() return (end - start) def is_factor(factor, number): return (number % factor) == 0 def is_prime(number): if (number <= 1): return False if (number <= 3): return T...
170287ec18e914d9a95e0407d856c9b5ef21ec5b
srivasd/tfg-spotify
/RealPythonTutorial/exponent.py
157
3.859375
4
print('Enter a base: ') base = float(input()) print('Enter an exponent: ') exp = float(input()) print(base, ' to the power of ', exp, ' = ', base ** exp)
19c2767c5ec51c663e3e34a8cc9daa6709a35427
srivasd/tfg-spotify
/YoutubeTutorial/lists-tuples.py
496
4.09375
4
# Lists list = ['Manuel', 23, 'Hello world', 3.14] print(list[0]) list[0] = 'My value is different' print(list[0]) tuples = ('Manuel', 'Rosa', 'Pepito', 45, 3.14) # tuples[0] = 'My value is different' print('All elements of list:', list) print('All elements of tuples:', tuples) print(list[1:4]) print(tuples[1:4]) ...
df5ff044dc190439ec33fda46f671afdfae8b442
AddisonJi/python-challenge
/PyPoll/main.py
2,162
3.515625
4
import os import csv pypoll_csv = os.path.join("..", "PyPoll", "election_data.csv") output=open("outputPyPoll.txt","w") summary={} totalvotes=0 votes=[] # Open and read csv with open(pypoll_csv, newline="") as csvfile: csvreader = csv.reader(csvfile, delimiter=",") # Read the header row first (s...
7a343b2f87d4421efc6a8863c5b3a7b3f3265833
medson10/LearnPython
/Basics/numerosimpares.py
247
3.78125
4
varA = int(raw_input('Digite o primeiro valor: ')) varB = int(raw_input('Digite o segundo valor: ')) cont = 0 for x in range(varA+1,varB): if x % 2 != 0: print x cont = cont + 1 print '' print 'Total de numeros impares: ',cont
16200b49a93a0047489dcc1bb600234724bbf05d
sayannag/Cell-Module
/cell_module.py
2,411
3.609375
4
import numpy as np class cell: def __init__(self, *args): self.args = args if len(args)>0: self.row = args[0] self.column = args[1] empty_list = [None]*self.column self.data = np.array([empty_list]) self.mylist = empty_list ...
3e751cd851eaca0e05905c168d4387fbc04e49bc
marcusrugger/project-euler
/problem-001/problem-1.py
196
3.890625
4
#!/usr/bin/env python END_OF_LOOP = 1000 def calc_sum(step): sum = 0 for num in range(step, END_OF_LOOP, step): sum += num return sum print calc_sum(3) + calc_sum(5) - calc_sum(15)
35d0c32bf7b2af5d59961da14c19e4d8436e04c1
AnotherG/Buffer-Overflows
/create.py
425
3.515625
4
#!/usr/bin/env python3 from __future__ import print_function #tart with 00 and add any others you find bad = "00".split() #turns them into a nice string to copy into python print("badchars = ") for x in range(1, 256): if "{:02x}".format(x) not in bad: print("\\x" + "{:02x}".format(x), end='') #creates a nice st...
cd93ecfa1c20132aa72909ed314b4ba3d2fe177b
blakexcosta/Unit3_Python_Chapter5
/main.py
1,208
4.3125
4
def main(): # booleans number1 = 1 number5 = 5 # boolean values are written as True and False if (number1 > number5): print("this statement is true") else: print("this statement is false") # list of comparison operators # https://education.launchcode.org/lchs/chapters/b...
4e10abece03f4af59aa50d80ce27bf05b1d36430
zhao94254/learn
/python/link.py
1,239
3.53125
4
# -*- coding: utf-8 -*- # @time: 2020-04-06 18:31 # @file: link.py class Linklist: def __init__(self, x=None, next=None): self.val = x self.next = next def __str__(self): return "{}-->{}".format(self.val, self.next) __repr__ = __str__ def __len__(self): if self.next i...
ba025910735dc60863ef5b6525cc20bace3675cb
CAWilson94/MachineLearningAdventures
/ex2/python/iris.py
2,446
4.4375
4
# Charlotte Wilson # SciKit learn example # How starting from the original problem data # can shaped for consumption in scikit-learn. # importing a dataset from sklearn import datasets # data member is an n_sample and n_features array iris = datasets.load_iris(); digits = datasets.load_digits(); # digits.data access...
55d3a19cd2a185007ab5c0aec0bc1cf0bb867196
AbiramiRavichandran/DataStructures
/Heap/FibonacciHeap.py
5,258
3.96875
4
class Fibonacci_Tree: def __init__(self, data): self.data = data self.children = [] self.order = 0 self.parent = self.left = self.right = None def add_at_end(self, t): self.children.append(t) t.parent = self self.order += 1 def print_tree(self): ...
96790ae3ad327dc817852ec36c16da1fee468da6
AbiramiRavichandran/DataStructures
/Tree/LevelRange.py
870
3.953125
4
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def print_levels_within_range(root, start, end): if not root: return q = [] q.append(root) level = 0 while q: count = len(q) while count: node =...
7d6c2a50d91bd4e9727ebb2636191b5644dcb694
AbiramiRavichandran/DataStructures
/Tree/TreePathSum.py
680
3.84375
4
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def tree_path_sum(root, val=0): if not root: return 0 val = (val * 10) + root.data if root.left is None and root.right is None: #print(val, end=" ") return val ...
fe5df5b79300b79c7625e5a1549e5ef65f389b3f
AbiramiRavichandran/DataStructures
/Tree/MirrorTreeN-ary.py
1,032
3.859375
4
class Node: def __init__(self, data): self.data = data self.child = [] def print_level_wise(root): if not root: return q = [] q.append(root) while q: n = len(q) while n: node = q.pop(0) print(node.data, end=" ") for i in ra...
514d73fdb526807937dd63cd7c30f81d009d4148
AbiramiRavichandran/DataStructures
/Tree/SpecialBT.py
923
3.71875
4
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def in_order_traversal(self): if self.left: self.left.in_order_traversal() print(self.data, end=" ") if self.right: self.right.in_order_traversal() ...
557221f957c1164f12760560584406d918befcc0
AbiramiRavichandran/DataStructures
/Tree/HeightWithEvenLeaves.py
692
3.890625
4
class Node: def __init__(self, data): self.data = data self.left = self.right = None def get_height(root, is_even=False): if not root: return 0 if not root.left and not root.right: if is_even: return 1 else: return 0 left = get_height(ro...
73afa33b5b8ceca90582c623a7aec45ae30dd8ed
AbiramiRavichandran/DataStructures
/Tree/EdgeRemoval.py
790
3.75
4
class Node: def __init__(self, data): self.data = data self.left = self.right = None def get_size(self): l_size = self.left.get_size() if self.left else 0 r_size = self.right.get_size() if self.right else 0 return l_size + r_size + 1 def check_rec(root, n): if not...
3766fdbb0f574cc868642d276e56d7f6ba181854
AbiramiRavichandran/DataStructures
/LinkedList.py
1,187
3.90625
4
class Node: def __init__(self,data=none,next=none): self.data = data self.next = next class LinkedList: def __init__(self): self.head = None def print(self): if self.head == None: print("LinkedList is empty") return itr = self.head s...
ae15f7963337b7faee90ac5ab27bdc52bd464c0b
AbiramiRavichandran/DataStructures
/Tree/FlipTree.py
931
3.984375
4
class Node: def __init__(self, data): self.data = data self.left = None self.right = None def in_order_traversal(self): elements = [] if self.left: elements += self.left.in_order_traversal() elements.append(self.data) if self.right: ...
299b5aba8716d3e26982d86a270b2ea9cf5d9bca
AbiramiRavichandran/DataStructures
/Tree/AVL_Tree.py
3,209
3.671875
4
class Node: def __init__(self, data): self.data = data self.right = None self.left = None self.height = 1 class AVL: def add_child(self, root, data): # step1 : normal BST insert if root is None: return Node(data) if data < root.data: ...
a38fbbe3f68cd32139697af8869bad21e25ff3a3
matthewfeickert/Advent-of-Code
/2020/day-13/python/day-13.py
2,193
3.578125
4
def load_input_file(path): with open(path) as input_file: return [line.strip() for line in input_file] def parse_inputs(inputs): timestamp = int(inputs[0]) bus_ids = [int(id) if id != "x" else -1 for id in inputs[1].split(",")] return timestamp, bus_ids def earliest_time(timestamp, ids): ...
d3a99933b0679fa59305376da450778137a562aa
Jenni-Foued/holbertonschool-higher_level_programming
/0x0A-python-inheritance/100-my_int.py
332
3.765625
4
#!/usr/bin/python3 """ Defines the class MyInt """ class MyInt(int): """rebel version of an int""" def __eq__(self, other): """returns the opposite of equal(eq)""" return int(self) != other def __ne__(self, other): """returns the opposite of not equal(ne)""" return int(sel...
848f804e898fae680f4b17054699ad3c90721c20
Jenni-Foued/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/models/base.py
874
3.609375
4
#!/usr/bin/python3 """ This module defines the "Base" class """ import json class Base: """Base class""" __nb_objects = 0 def __init__(self, id=None): """Initializes Base""" if id is None: Base.__nb_objects += 1 self.id = self.__nb_objects else: ...
0177248226fa85a91cba7227183e6e6598860848
Jenni-Foued/holbertonschool-higher_level_programming
/0x03-python-data_structures/5-no_c.py
222
3.6875
4
#!/usr/bin/python3 def no_c(my_string): str = "" for index in range(0, len(my_string)): if (my_string[index] != 'c') and (my_string[index] != 'C'): str = str + my_string[index] return str
7de20d78779c5969b2371c44496b9cb9cb4f3bda
DHARANIPRAKASH/dharani100
/hellow.py
61
3.8125
4
f=int(input()) i=0 while (i<f): print("Hello") i=i+1
bc1ff157b84b6dea24f749e0d36cce34a3c59c87
Yan-Yan-6/Movie-Recommender
/recommender_functions.py
11,323
3.734375
4
"""CSC108 A3 recommender starter code.""" from typing import TextIO, List, Dict from recommender_constants import (MovieDict, Rating, UserRatingDict, MovieUserDict) from recommender_constants import (MOVIE_FILE_STR, RATING_FILE_STR, MOVIE_DICT_SMA...
388213df0b9a583b04578c9f83387e73d6ef122a
judgedreadnaught/IntroToFinance
/GreenLineBreakoutCalc.py
1,955
3.828125
4
# Green lines signify a significant level of resistance. Usually occurs once a stock hits a ATH and then rests and # consolidates for a couple of months import yfinance as yf import datetime as dt import pandas as pd from pandas_datareader import data as pdr yf.pdr_override() start_date = dt.datetime(1980, 12, 1) now...
e24532b23b5c3c84d5ce5aa90db40d535727457d
judgedreadnaught/IntroToFinance
/BackTester.py
4,776
3.640625
4
import pandas as pd import numpy as np import yfinance as yf import datetime as dt from pandas_datareader import data as pdr yf.pdr_override() user_stock = input("Enter stock ticker symbol: ") print(user_stock) s_year = 2017 s_month = 1 s_day = 1 start = dt.datetime(s_year, s_month, s_day) now = dt.datetime.now() ...
bf2736b5521fc2deb8c34ed91408c7cc9ffbd977
lalitkar/work
/decorators.py
422
3.546875
4
def add1(a,b): print('result is') print(a+b+a) print('end of result') def sub1(a,b): print('result is:') print(a-b) print('end of result') add1(10,20) sub1(10,20) def mydec(func): def decorated_func(*x,**y): print('result is') func(*x,**y) print('end of ...
ee514c83ded5feaa0ba06fa1bdeeffa1bb999f3e
YellowShinwon/YellowShinwon_Home
/que/two.py
1,796
3.546875
4
bridge_length = 2 weight = 10 truck_weights = [7,4,5,6] # 100 100 [10,10,10,10,10,10,10,10,10,10] 110 #return = 8 #bridge_length, weight, truck_weights #처음 들어간 친구는 bridge_length만큼 움직이면 끝! def solution(bridge_length, weight, truck_weights): sum, count = 0, 0 bridge=[] for temp in range(bridge_length+1): ...
0c2481ad6275ca6725bacb3d2a5ea4546a039a35
YellowShinwon/YellowShinwon_Home
/sort/three.py
1,302
3.6875
4
citations = [3, 0, 6, 1, 5] # citations = [5, 5, 5, 0] # return = 3 def solution(citations): sort_citations = sorted(citations) sort_citations_length = len(sort_citations) target_start = 0 target_list = [] for count in range(sort_citations_length): cite = sort_citations[count] if ci...
a4a9f3e90580199a359c88d8bef4a42243e73e66
mwojcik123/game
/smiec.py
328
3.53125
4
rzym = {1000: "M", 900: "CM", 500: "D", 400: "CD", 100: "C", 90: "XC", 50: "L", 40: "XL", 10: "X", 9: "IX", 5: "V", 4: "IV", 1: "I"} x = input("Podaj liczbę całkowitą:") int(x) print(x) r = rzym.keys() r.sort() r.reverse() lr = "" for i in r: while i <= x: lr += rzym[i] x -= i prin...
bf8eb06f39af2fca197db083ace87b165c44ba03
tmbern/DS-OOP-Review
/football/players.py
3,222
3.78125
4
'''Player class to record stats for individual players ''' import numpy as np class Player: '''Dosctring TODO THIS IS NOT A VERY GENERALIZABLE MODEL IF YOU KNOW THINGS ABOUT FOOTBALL and that's okay ''' def __init__(self, name=None, yards=120, touchdowns=5, safety=1, interceptions=...
42733c4983449b3967f4b450f35c6b319f8cbd9b
alexgneal/comp110-21f-workspace
/exercises/ex01/hype_machine.py
273
4.15625
4
"""Use concantonations to build up strings and print them out using my name.""" __author__ = "730332719" name: str = input("What is your name? ") print(name + ", you are awesome!") print("You're killing it, " + name) print("Wow, " + name + ", you are an absolute queen!")
fc841543bfa28a7e82ea40b4f75556bc108a789c
Yonuts/Reinforcement-learning---TP
/agentsTP3.py
6,295
4.03125
4
import numpy as np import random random.seed(0) np.random.seed(0) """ Contains the definition of the agent that will run in an environment. """ class RandomAgent: def __init__(self): """Init a new agent. """ def choose(self): """Acts in the environment. returns the chosen ac...
617bcc056e3011b6b303ab1c1de87d3e9af49417
Benneee/PythonTrips
/Assignment_Wk4_Day1_QuadRoots_App.py
2,135
4.34375
4
#The Quadratic Roots Programme #ALGORITHM #1 Introduce the program to the user #2 Give the required instructions to run program appropriately #3 Request values for a, b, c #4 Define a variable for the discriminant #- Solve the discriminant #- Solve the square root of the discriminant #- import math m...
426e3c5d7135bba1591e34b21a763a6050d35288
zhangsongshun/OOP
/student.py
629
3.921875
4
class Student(object): def __init__(self, name, score): self.__name = name self.__score = score def print_student(self): return '%s:%s' % (self.__name, self.__score) def get_name(self): return self.__name def get_score(self): return self.__score def set_na...
76b0aa1ccbb8551e7f9e72ab3f38db3f34b5b47a
sprinter2019/Python-ML
/5. Supervised Learning/sourceCodes/Param_Tuning/Dataset01_tune.py
25,162
3.625
4
## MAchine Learning - Assignment 1 ## Georgia Institute of Technology ## Applying ML supervised algorithms to interesting datasets import matplotlib.pyplot as plt import sys import numpy as np import pandas as pd import time from sklearn.model_selection import cross_val_score, GridSearchCV, cross_validate...
4d45f05f95e39a97fd6c052f93de73947edb6eed
dongzeyuan/LPTHW
/ex15.py
607
3.796875
4
from sys import argv script, filename = argv txt = open(filename) # 前三行打开了一个文件,文件名在打开脚本时用参数传递 print ("Here's your file %r:" % filename) # 显示文件名称 print (txt.read()) # 显示文件内容 print("Type the filename again:") file_again = input("> ") # 提示用户再次输入一个文件名...
dd9ad82135ae72cc78417f0b916fffbc485a8b28
muraveev/PyLabs
/lab1/str_algs.py
95
4.28125
4
def reverse(str): print(str) print(str[::-1]) str = "Hello, world" reverse(str)
b66b1a0a728963b05dc4b6429a9edd7b7f3adec9
ArroyoBernilla/trabajo-N5
/verificador4.py
425
3.59375
4
#Calculadora nro4 #esta calculadora calcula la distancia #declaracion de variables distancia,velocidad,tiempo=0.0,0.0,0.0 #calculadora velocidad=10 tiempo=10 distancia_recorrida=(velocidad*tiempo) verificador=(distancia_recorrida<=3942) #mostrar datos print("velocidad= ", velocidad) print("tiempo= ", t...
664759917b47d43947a8ac561e2c7408a0a45fbb
ArroyoBernilla/trabajo-N5
/boleta9.py
356
3.8125
4
#INPUTN9 velocidad=int(input("ingrese la velocidad:")) tiempo=int(input("ingrese el tiempo:")) aceleracion=int(input("ingrese la aceleracion:")) # PROCESSING altura=(velocidad*tiempo+(aceleracion*tiempo*tiempo)/2) # OUTPUT print("velocidad= ",velocidad) print("tiempo= ", tiempo) print("aceleracion= ",acele...
70db3c5ff28b404f6aebb422405f7bfb643721f6
ArroyoBernilla/trabajo-N5
/boleta10.py
402
3.640625
4
#INPUTN10 ancho=int(input("ingrese el ancho del paralelepipedo:")) largo=int(input("ingrese el lago del paralepipedo:")) altura=int(input("ingrese la altura del paralelepipedo:")) # PROCESSING volumen_del_paralepipedo=(ancho*largo*altura) # OUTPUT print("ancho= ", ancho) print("largo= ", largo) print("altu...
fcc69065f318b908c54479ef9a7b4b26d10a1d1c
ArroyoBernilla/trabajo-N5
/verificador 16.py
438
3.609375
4
#calculadora diesiseis #esta calculadora realizara calculos del calor latente #declaracion de variables area,tiempo,calor_latente=0.0,0.0,0.0 #calculadora area=45 tiempo=3 calor_latente=(area/tiempo**2) #mostrar datos print("area= ", area) print("tiempo= ", tiempo) print("calor latente= ", calor_latent...
585aff0e062e63761a6f35a7755cc5a351cba185
ArroyoBernilla/trabajo-N5
/verificador3.py
557
3.8125
4
#calculadora nro3 #esta calculadora calcula capacidad calorifica #declaracion de variables capacidad_calorifica,masa2,calor_especifico,temperatura=0.0,0.0,0.0,0.0 #calculadora masa2=15 calor_especifico=3 temperatura=10 capacidad_calorifica=(masa2*calor_especifico*temperatura) verificador=(capacidad_calorif...
567dc4aa2f9ea643293e63e2397c567aa5b1f312
bayhota/Liars-Dice
/LiarsDice.py
9,648
3.84375
4
""" Liar's Dice A Game By BJ Mestnik On Python3 weeeeeeeee """ import random, sys, time dieNumber=1 dieQuant=1 bet=[1,1] remainingDice=[] diceList={} numDice=1 diceCount={} deleteList={} totalDiceLeft=0 originalNumPlayers=0 def compileDiceList(): # Fu...
b70d695f70fc311d4e81a1c0461d6638711f011b
jerthompson/au-aist2120-19fa
/1000-B/calc.py
468
4.125
4
running_total = 0 # accumulator running_prod = 1 while True: print("The total so far is", running_total) print("The prod so far is", running_prod) num = int(input("enter a number: ")) # num = input("enter a number: ") # num = int(num) if num == 0: break else: running_total =...
6d66affb7a45383a3b6d23aab98288fcc99c6c26
jerthompson/au-aist2120-19fa
/1000-B/ooptest.py
422
3.734375
4
from oop.person import Person from oop.contact import Contact def show_person(p): print(p.FirstName, p.LastName, p.BirthYear) # CREATE INSTANCE FROM CLASS p1 = Person('Paul','York',1972) p2 = Contact('Mike','Dowell',1907) # print(p1) # show_person(p1) p1.show() p2.show() # p2.PhoneNumber = 'mike@dowell.com' pr...
357297ac98c7df57b0bb4bfeb8ab5ab932ffeb51
jerthompson/au-aist2120-19fa
/1130-A/0905-mofunks.py
1,576
3.921875
4
''' C# public void DoStuff() { ........... return; // If you have this, I get to laugh at you } def DoStuff(): return # Should be used only to do "EARLY" termination public int Add(int num1, int num2) { val = num1 + num2; return val; } def Add(num1,num2): val = num1 + num2 return val ''' ...
c76cf6d1d8d193a0f2a9036d06558344caf2f066
jerthompson/au-aist2120-19fa
/1130-A/0903-primeA.py
300
4.25
4
n = 2 max_factor = n//2 is_prime = True # ASSUME it is prime for f in range(2, max_factor + 1): # INCLUDE max_factor by adding 1 if n % f == 0: print(n, "is not prime--it is divisible by", f) #exit() is_prime = False break if is_prime: print(n, "is prime")
f925664ec6ef55ab3c2d82eac54c298f03b0bc53
jerthompson/au-aist2120-19fa
/1000-B/wins.py
515
3.5
4
import requests, bs4 team = input("Team?: ") team = team.strip() team = team.lower() team = team.replace(' ', '-') resp = requests.get(f"https://www.sports-reference.com/cfb/schools/{team}/") if not resp.ok: print("NOT FOUND") exit(1) soup = bs4.BeautifulSoup(resp.text, features="html.parser") win_elems = ...
a3d072851daf2514564d93c62ae11e0a45adaa8e
jerthompson/au-aist2120-19fa
/1130-A/adder.py
318
4
4
subtotal = 0 # accumulator subprod = 1 while True: print('current sum is', subtotal) print('current prod is', subprod) num = int(input("enter num: ")) if num == 0: break else: subtotal += num subprod *= num print('final sum is', subtotal) print('final prod is', subprod)
b6331474d162a3476b8e482e8802606355b51009
jerthompson/au-aist2120-19fa
/1130-A/mods/extmod.py
800
3.765625
4
''' Extmod: Cool stuff in here!!! ''' def root(anum, rootnum): ''' root: Get the root of a number. Can be any root. Square, Cube, etc. Params: anum - the number to root rootnum - whatever Usage >>> root(4,2) 2.0 >>> root(8,3) 2.0 >>> root(25,5) 1.903653938715...
e6c4a0f24a295f6db854dd869a94d54ce400df30
vishal-98/Coinmarketcap
/api/coincap_ticker.py
1,110
3.75
4
import json import requests apifile = open('api.txt','r') apikey = apifile.read().strip() # api key stored here apifile.close() api_url = 'https://pro-api.coinmarketcap.com/v1/cryptocurrency/quotes/latest' api_headers = { 'Accepts': 'application/json', # Accepts specifies the type of data returned by t...
538bd589b449f24200a857a4e93296a2ee9d6f03
mikaellopez/exploration-of-bikeshare-data
/bikeshare.py
8,402
4
4
import time import pandas as pd def set_filters(): error_message = "❌ You either misspelled your choice or didn't enter" while True: city = input("Do you want to see bikeshare data for " "Chicago, New York, or Washington? ").title() if city in CITY_DATA: break ...
bb5763bb59030646f04bf29c4036b74bc2ed16a4
brianmr31/check-Py_basic
/2_while.py
127
3.671875
4
#!/usr/bin/env python x = input('Masukan nilai Integer : ') i = 0 while i < x : print 'nilai ke ',i,' dengan x : ',x i+=1
d82630a0a72f2bf7bccf80bbcd3079bd2bf54ed9
hbinl/hbinl-scripts
/Python/P2 - Algorithms/Q6.py
2,320
3.671875
4
__author__ = 'HaoBin' from Q5 import * def fib(n): # Exponential complexity O(2^n) if n < 2: return n return fib(n-1) + fib(n-2) ######################################## def linear_fib(x,y,n): # Linear Recursive version if n <= 1: return y else: return linear_fib(y, ...
ed76d4d0868a55d792acb783e4ca3987228b0b8c
hbinl/hbinl-scripts
/Python/C3 - Sums/Advanced_Max_sum_interval.py
4,649
4.1875
4
""" FIT1008 Prac 3 - Advanced + Hall of Fame @purpose Find Max Sum Interval of a list @author Loh Hao Bin 25461257 @modified 20140809 @created 20140809 """ import time, random ### Advanced Question ########################################### def find_max_sum_interval(a_list): """ Prac 3 Advanced Question @...
f28949cd50fe4a1d5e80c4f0fad20d6172a0531a
hbinl/hbinl-scripts
/Python/C5 - MIPS/T3 - new_power.py
1,762
4.21875
4
""" FIT1008 Prac 5 Task 3 @purpose new_power.py @author Loh Hao Bin 25461257, Derwinn Ee 25216384 @modified 20140825 @created 20140823 """ def binary(e): """ @purpose: Returns a binary representation of the integer passed @parameter: e - The integer to be converted to binary @precondition: A positive i...
00a2433bbbef3c67694e07c422cd59a480aa56c6
hbinl/hbinl-scripts
/Python/C7 - RPN/Task2.py
3,718
4.03125
4
""" FIT1008 Prac 7 Task 2 Loh Hao Bin 25461257, Tan Wen Jie 25839063 @purpose: String interpreter @created 20140913 @modified 20140914 """ from Task1 import Stack def isnum(arg): """ @purpose: To check if the item is a number @complexity: Best & Worst Case: O(1) @parameter arg: The...
13f5cb249baf2a4d8f505d138fd0e62378cb5396
hbinl/hbinl-scripts
/Python/P2 - Algorithms/Q2.py
330
3.953125
4
__author__ = 'HaoBin' def factorial_iterative(n): x = 1 for i in range(1,n+1): x = i * x return x if __name__ == "__main__": try: n = int(input("Please input a number to calculate factorial: ")) print(factorial_iterative(n)) except ValueError: print("Invalid number...
b25644993e6cb49c82750debebb29a1829d7f793
hbinl/hbinl-scripts
/Python/P5 - Sorting and Edit Distance/Q5.py
2,169
3.734375
4
__author__ = 'HaoBin' class Node(): def __init__(self, data, left=None, right=None): self.node = data self.left = None self.right = None class NodeHeap(): def __init__(self,root): self.root = Node(root) ##################################### class Heap(): def __init__(self...
5e5572309f622981acf4097edd8b6538742a4c48
hbinl/hbinl-scripts
/Python/C9 - ed/DoubleLinkedList.py
10,241
3.8125
4
""" FIT1008 Prac 9 - Extra Loh Hao Bin 25461257 @purpose: Double Linked List @created 20141002 @modified 20141003 """ import dis class DoubleNode: def __init__(self, item = None, link_next = None, link_prev = None): """ @purpose: Creates a node """ self.item = item self....