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
58b49a5b4f83d7150d437c602da570d637438578
raghuvn97/College_Registration_Python_Csv
/clg_reg.py
3,282
3.703125
4
from os import path import csv class college: def __init__(self,collegeid,collegename,coursetype,city,fees,pincode): self.collegeid = collegeid self.collegename = collegename self.coursetype = coursetype self.city = city self.fees = fees self.pincode = pincode def add(self): var = [self.collegei...
9575a6d35424a9ca28d4a93e6885503f8cf3df0b
MI2DataLab/WildNLP
/wildnlp/aspects/swap.py
1,907
4.09375
4
import random from .base import Aspect class Swap(Aspect): """Randomly swaps two characters within a word, excluding punctuations. It's possible that the same two characters will be swapped, so the word won't be changed, for example `letter` can become `letter` after swapping. .. caution:: Uses ...
e508a1c96c07f86ccf2f613fd6e57190d7c4ecf1
MI2DataLab/WildNLP
/wildnlp/aspects/base.py
1,127
3.8125
4
from abc import ABC import re class Aspect(ABC): """Base, abstract class. All the aspects must implement the __call__ method. """ def __call__(self, sentence): """We want to directly call objects of the Aspect class for easy chaining. This function will be applied to sentences...
5a13f0532671e1f5535ba27b8e23323d6a580252
MI2DataLab/WildNLP
/wildnlp/datasets/imdb.py
3,207
3.5
4
import csv import os from .base import Dataset class IMDB(Dataset): """The IMDB dataset containing movie reviews for a sentiment analysis. The dataset consists of 50 000 reviews of two classes, negative and positive. Each review is stored in a separate text file. For details see: http://ai.stanford.e...
6760f5ea322e3bdc58c4bd1714188dc50de783fb
consoles/dsa4js
/app/graphgical_dsa/selecttion_sort.py
373
3.921875
4
def selection_sort(list): for i in range(len(list)): min_index = i for j in range(i + 1, len(list)): if list[j] < list[min_index]: min_index = j if i != min_index: list[i], list[min_index] = list[min_index], list[i] return list list = [65,...
f0ed7f76a1d1225c2ecdf8fae3560dc0e80edbc8
nirupamaK/my-misc-files
/adjust-code-challenge/print-random-nums.py
134
3.734375
4
#!/usr/bin/env python3 import random nums = [x for x in range(1,11)] random.shuffle(nums) for i in nums: print (i) ##print(nums)
26e5da322fdf99852aec9eb1c57640505a00237c
Alexadol/BI_2019_Python
/calculator.py
315
3.828125
4
a=int(input()) c=str(input()) b=int(input()) if c in ['%','/','//'] and b==0: print('Деление на 0!') elif c=='+': print(a+b) elif c=='-': print(a-b) elif c=='/': print(a/b) elif c=='*': print(a*b) elif c=='%': print(a%b) elif c=='**': print(a**b) elif c=='//': print(a//b)
34a878f5b32c76d1fc266ab95ff17cc05ef8af59
Dqvvidq/Nauka-2-
/Operacje na lancuchach znakow zadania.py
691
3.84375
4
c = "Camus" print(c[0]) print(c[1]) print(c[2]) print(c[3]) print(c[4]) p1 = input("Co wczoraj napisałes?: ") p2 = input("Do kogo to wyslales?: ") print("Wczoraj napisałem {} i wysłałem do {}".format(p1, p2)) zd = "adous Haxley urodził sie w 1894 roku" zd = zd.capitalize() print(zd) lista = ["Zwinny...
b4865de791c1332ca75890b0046ab76578980b4e
vipul-royal/assignment1
/Areaofcircle.py
116
4.15625
4
pi=3.14 r=float(input('Enter the area of circle : ')) print('Calculated Area of circle is : ') AOC=pi*r*r print(AOC)
9068bed395bc988222f6bbeaada77a81eeeb7f46
haobotao000/leetcode
/N136.Single_Number.py
777
3.703125
4
# Problem: Single Number # Given a non-empty array of integers, every element appears twice except for one. Find that single one. # Solution 1: Hash Table class Solution(object): def singleNumber(self, nums): hash_table = {} for i in range(len(nums)): try: hash_table.po...
e7f9f4f92b756426ec8dfd9aa75eda62ef6f25f8
ngthnam/Python
/Python Basics/18_MultiDimensional_List.py
761
4.53125
5
x = [2,3,4,6,73,6,87,7] # one dimensional list print(x[4]) # single [] bracket to refer the index x = [2,3,[1,2,3,4],6,73,6,87,7] # two dimensional list print(x[2][1]) # using double [] to refer the index of list x = [[2,3,[8,7,6,5,4,3,2,1]],[1,2,3,4],6,73,6,87,7] # three dimensional list print(x[0][2][2]) # using t...
0f554c5e1b500471336ba36a499da7ca2bc47c92
ngthnam/Python
/Python Machine Learning/11_Clustering_DataSets_with_KMeans_Algorithm.py
838
3.5625
4
import matplotlib.pyplot as plt from matplotlib import style import numpy as np from sklearn.cluster import KMeans style.use('ggplot') # feature set X = np.array([[1, 2], [1.5, 1.8], [5, 8], [8, 8], [1, 0.6], [9, 11]]) clf = KMeans(n_clusters=2) #...
ea34bff6fb5089f4beb114f9665afc1a15da1082
JamesMcDougallJr/CodingChallenges
/Python/nonRepeatingConcat/main.py
886
4.03125
4
""" Find the number of unique strings that can be made from concatenations of the input. Strings must not have repeating characters. """ def numNonRepeatingConcats(lst): concatenations = [] for s1 in range(len(lst)): for s2 in range(s1+1, len(lst)): concatenations.append(lst[s1]+lst[s2]) concate...
79f21ac873ec01b4656a624e9565faaa7a828837
JamesMcDougallJr/CodingChallenges
/Python/QueueAndStack/stack.py
322
3.6875
4
class Stack: def __init__(self, lst=None): if lst is None: self.stack = [] else: self.stack = lst def __len__(self): return len(self.stack) def push(self,value): self.stack.append(value) def pop(self): return self.stack.pop() def isEmpty(self): return len(self.stack) ==...
77ca86126d6541cd2d4c5710b220d45d306eb01f
JamesMcDougallJr/CodingChallenges
/Python/QueueAndStack/priorityQueue.py
554
3.984375
4
import heapq class PriorityQueue(object): def __init__(self, lst=None, key=lambda x: x): self.key = key if lst is None: self.pq = [] else: # perform the key function on each item in the list, # heapq will sort by this first element on insertion self.pq = [(key(item), item) for item...
c61da928b342d7a7d66ef7d4118a0fa29d28bbd5
mrstevenaweiss/nombre
/functions.py
911
3.59375
4
import time import os def load(name): print('Loading program...') time.sleep(2) os.system('clear') print('\n') print('\t Welcome to NOMBRE') print('\t Hello', name) print('\n') def menu_text(): print('\t What would you care to do? Type: ') print('\n') print("\t 0: What...
fd94e3d72de827e3e5a9b3ed40836c22c873c56c
dogbeide/battleship-text
/battleship.py
9,307
3.53125
4
from random import randint import numpy as np game_over = False # game state # will alternate during gameplay cur_player = 1 other_player = 2 # size N x N board_size = 6 row_indices = [] col_indices = [] # create board indexing for i in range(board_size): row_indices.append(str(i)) col_indices.append(chr(or...
3424d880a461d6967ae71e9efbf5be36707d56e0
spencerkee/problems
/problem3.py
273
3.515625
4
#!/usr/bin/env python3 if __name__ == "__main__": f = open("article.txt","r") lines = f.readlines() f.close() f = open("article.txt","w") for line in lines: words_in_line = len(line.split()) f.write(line[:-1] + str(words_in_line) + "\n")
32cd921baa56b9dd1b798ab0a7911bf93566c594
rcparent17/Advent2020
/01/1b.py
693
3.5
4
numbers = [] with open("1.input") as inp: numbers.extend([int(x.strip()) for x in inp]) a = numbers[0] b = numbers[1] c = numbers[2] solFound = a + b + c == 2020 if not solFound: for i in range(3, len(numbers)): a = numbers[i] for j in range(i + 1, len(numbers)): b = numbers[j] ...
46433a16470454b548e5933feb3164d05ba808e3
Jeffreyo3/Data-Structures
/stack/singly_linked_list.py
2,599
3.921875
4
class Node: def __init__(self, value = None, next_node = None): self.value = value self.next_node = next_node def get_value(self): return self.value def get_next(self): return self.next_node def set_next(self, new_node): self.next_node = new_node class...
73c8e86223f7de441517c9206ae526ef5365c664
JonathanFrederick/what-to-watch
/movie_rec.py
2,223
4.28125
4
"""This is a program to recommend movies based on user preference""" from movie_lib import * import sys def get_int(low, high, prompt): """Prompts the player for an integer within a range""" while True: try: integer = int(input(prompt)) if integer < low or integer > high: ...
7bddf44f81a2515f28b82cc2b440c064acef2f16
iansharff/class_projects
/python_projects/Project2/Classes_P2.py
496
3.515625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Oct 26 16:06:35 2020 @author: iansharff """ class Location: def __init__(self, name, difficulty, available): self.name = name self.difficulty = difficulty self.available = available def welcome_statement(self): ...
fca84059bf5a66df72c18c969f4a1a77edf8b686
adamcfro/swdv-660-week-7
/caesar_cipher.py
421
3.984375
4
def encrypt(text, key): """Simple Caesar Cipher""" # TRANSFORM KEY INTO NUMBER FOR CIPHER key_transformation = 0 for i in range(len(key)): char = key[i] key_transformation += ord(char) # ENCRYPT DATA result = "" text = text.lower() for i in range(len(text)): cha...
21e0077cc64e23fd9e82e7f2629ed036acb204f1
stunningspectacle/code_practice
/python/projecteuler/25.py
235
3.625
4
#!/usr/bin/python first = 1 second = 1 count = 2 while True: curr = first + second count += 1 if len(str(curr)) >= 1000: print count, curr print len(str(curr)) break first = second second = curr
934d6e77367921203b95fe8a3444eff0ddab76fc
stunningspectacle/code_practice
/python/data_structure_and_algo_in_python/c01.py
267
3.671875
4
#!/usr/bin/python3 class A: _num = 100 if __name__ == '__main__': a = 100 b = a print(a, b) a = 200 print(a, b) c = [100] d = c print(c, d) c.append(200) print(c, d) f = A() print(f) g = f print(g)
f7c0e096381f2f4fe397b5c356557835b563fb4e
girip11/advent_of_code
/aoc_2018/day_2/python/day2_puzzle1.py
1,680
3.59375
4
import sys from functools import reduce from typing import Iterable, List, Set, Tuple def calculate_checksum(box_ids: Iterable[str]) -> int: """Computes and returns the checksum which is a product of the number of box ids containing characters repeated exactly twice and thrice. Arguments: box_ids ...
88094711a2017d3b089ab1c331d301faf3f8c759
faizalindrak/learn-python
/Chapter 1 - Introduction/function2.py
352
3.875
4
def computepay(h,r): if h > 40: pay = (h*r) + ((h-40)*0.5*r) return pay else: pay = h*r return pay hrs = input("Enter Hours:") rate = input("Enter rate: ") try: fh=float(hrs) fr=float(rate) except: print("please input numeric") p = c...
2243a5582c0b3e27cbd6ffd93637fc783f4a2c6e
python-force/secret-messages
/encryption/adfgvx.py
5,557
3.703125
4
from encryption.cipher import Cipher class Adfgvx(Cipher): ADFGVX = { "AA": "N", "AD": "A", "AF": "1", "AG": "C", "AV": "3", "AX": "H", "DA": "8", "DD": "T", "DF": "B", "DG": "2", "DV": "O", "DX": "M", "FA": "E", "FD": "5", "FF": "W", "FG": "R", "FV": "P", "FX": "D", "GA": "4", "GD...
b7de3d1014722e221cc7a397d062029615f46b2d
Crista23/MachineTranslation
/Project2/phraseExtraction.py
4,089
3.828125
4
from collections import defaultdict """ Extract phrase pairs from a sentence pair Param: e - the english sentence (a list of words) f - the foreign sentence (a list of words) A - the alignments (a list of alignment points (e,f)) size - the maximum phrase length ...
c0f6befe88939ee4e35385492a32f14e199b9760
Crista23/MachineTranslation
/Project2/fileHandling.py
2,488
3.859375
4
from collections import defaultdict from phraseExtraction import * """ Read a line from the alignment file and convert it to a list of alignment pairs Param: sentence - a line from the alignment file, looks like 0-0 1-0 1-1 3-2 2-3 5-4 6-5 7-5 6-6 8-7 9-8 Return: list - a list of alignment points: pairs (tupl...
7c3e919421d30f40b2d2be78bc154388845ab463
meeshkan/meeshkan-nlp
/meeshkan/nlp/tokenize.py
1,724
4.0625
4
import string from typing import List, Sequence def camel_case(example: str) -> bool: """This fubction recognize camel case. Example: >>> _camel_case('BodyAsJson') True Return: True or False """ if any(x in example for x in string.punctuation): return Fal...
4858e31104cd8ffaf4c97ea0aef61453253d75b3
Garrett-Benoit/University-Projects
/Python-Projects/cpm_calculator/ad_revenue.py
902
3.796875
4
correct_inputs = False impressions_per_minute = 2 while correct_inputs == False: print "" daily_active_users = input('Enter number of daily active users: ') if daily_active_users > 0: conversion_rate = input('Enter conversion rate (format: 2.4% is written 2.4): ') if conversion_rate >= 0.00...
3419b7200487515f1d4fb6dccf91e97c8eaee025
Catherine1124k/csc311
/hw4/code/q2.py
5,063
3.515625
4
""" Question 2 Skeleton Code Here you should implement and evaluate the Conditional Gaussian classifier. """ import data from scipy.special import logsumexp import numpy as np # Import pyplot - plt.imshow is useful! import matplotlib.pyplot as plt def compute_mean_mles(train_data, train_labels): "...
60a48894ed6be94035ada5d14ae88f7556c983bd
dagangge/myPythonCode
/2第二周turtle/PythonDraw.py
1,044
3.625
4
#import turtle #turtle.setup(650,350,200,200) #turtle.penup() #turtle.fd(-250) #turtle.pendown() #turtle.pensize(25) #turtle.pencolor("purple") ##turtle.seth(-40) ##for i in range(4): ## turtle.circle(40,80) ## turtle.circle(-40,80) ##turtle.circle(40,80/2) ##turtle.fd(40) ##turtle.circle(16,180) ##turtle.fd(40*2...
deb246e83aaed36d0bb6b2117c749460a707de76
dagangge/myPythonCode
/4第四周/100以内素数之和.py
195
3.625
4
result=0 def isSushu(args): for x in range(2,args): if args%x==0: return False return True for x in range(2,100): if (isSushu(x)): result+=x print(result)
11ccd7b74046a2ba56bed78953b25d385b6ac094
dagangge/myPythonCode
/3第三周天天向上的力量/恺撒密码.py
646
3.59375
4
inputV=input() for x in inputV[:]: if x==' ': print(" ",end='') elif ord(x)>=ord('a') and ord(x)<ord('x'): x=chr(ord(x)+3) print(x,end='') elif ord(x)>=ord('A') and ord(x)<ord('X'): x=chr(ord(x)+3) print(x,end='') elif x in ['x','y','z','X','Y','Z'...
c68362d6efe8cab19577e6d6a8457b9bc93c0231
bishnu12345/python-basic
/WhileLoop.py
354
3.8125
4
#print name 10 times # count = 10 # while count>0: # print('Apoorba') # count-=1 WORD = 'DWIT' count = 0 GUESS_ALLOWED: int = 10 while count<GUESS_ALLOWED: guess= input("Enter your guess: ") if(guess==WORD): print('Correct Answer') break else: count+=1 ...
eced2979f93a7fe022bab64f1520480b7882bf10
bishnu12345/python-basic
/simpleCalcualtor.py
1,770
4.3125
4
# def displayMenu(): # print('0.Quit') # print('1.Add two numbers') # print('2.Subtract two numbers') # print('3.Multiply two numbers') # print('4.Divide two numbers') def calculate(num1,num2,operator): result = 0 if operator=='+': result = num1 + num2 if operator ...
c763e9d9fc84bf768eaf625737237c902ad26963
ggarza78/python-challenge
/PyPoll/main.py
2,923
3.90625
4
import os import csv import sys # Create path to file: election_data.csv election_csv = os.path.join( "Resources", "election_data.csv") # Open path created. with open(election_csv) as election: # Read file to a df, named rows. rows = csv.reader(election) next(rows, None) # Skip headers ...
f745c039ad6602d38904549aeee14e62b9cabcf8
mansip6495/DataStructure
/my_queue.py
1,232
3.984375
4
class Queue(): def __init__(self,size): self.front = 0 self.rear = 0 self.queue = [None] * size def isempty(self): if self.front == self.rear: return 1 else: return 0 def isfull(self): if self.rear == len(self.queue): retu...
2176c56fc70acfd8b7521f4376d7af80e83b0e11
YingZ98/LeetCode_Medium
/leetcode 31. Next Permutation.py
779
3.765625
4
#!/usr/bin/env python # coding: utf-8 # In[ ]: # 31. Next Permutation class Solution: def nextPermutation(self, nums: List[int]) -> None: """ Do not return anything, modify nums in-place instead. """ n = len(nums) for i in range(n-1, 0, -1): if nums[i-1] < nums...
1c24222fdf67afa662099ceaa75df4f5bef42c96
alabarym/Python3.7-learning
/014_while_print_hello.py
155
3.78125
4
def print_number(n): counter = 0 while counter < n: print(n - counter) counter = counter + 1 print('finished!') print_number(5)
5961850fcf33ac79b82ccc9ef1ad53b882829afb
rmbennett/WordsearchSolver
/wordsearch.py
682
3.890625
4
def traverse(words, grid): print words print grid def parse(): pass def setup_grid(): with open("grid") as gridFile: grid = [line.split() for line in gridFile] # print grid return grid def setup_word_list(): with open("wordlist") as wordFile: words = wordFile.read().splitlines() # print words re...
86f54999527ad47d9ffb0d3b2c08ad253324a4ac
neotycoder/ufo_analysis
/ufo_analysis.py
3,207
4.09375
4
import pandas as pd # Description: This data set is another practice script to explore the UFO dataset from the data.world. # If you are curious about the data set, you can download it here: https://data.world/aarranzlopez/ufo-sights-2016-us-and-canada # In this example, instead of using the read_csv method in pandas,...
5f2978d9ae91fda757c295ced3fcd2bf9665c7e0
Delta276/matplotlib
/Desktop/data.py/learn.py
274
3.5
4
from matplotlib import pyplot as plt year=[2019,2020,2021,2022,2023,2024,2025] netsalary = [60000,120000,240000,250000,260000,270000,300000] plt.plot(year,netsalary,color='green',marker='o',linestyle='solid') plt.title('salary') plt.ylabel('billion dollars') plt.show()
cf954490898ce1a09018e3b16f7b811594c353c8
Vinality/DataStructures-2018
/Hash/hash.py
1,798
3.84375
4
import math hashlist = [] tam = input("Tamanho da hash: ") num_items = input("Numero de elementos: ") for i in range(num_items): hashlist.insert(i, input(str(i) + ": ")) def hash_div_lin(item_list, table_size): hash_table = dict([(i, None) for i,x in enumerate(range(table_size))]) for item in item_list: ...
789ca9376e8a07fc228c109b4dddaaf796b55173
skishorekanna/PracticePython
/longest_common_string.py
1,093
4.15625
4
""" Implement a function to determine the longest common string between two given strings str1 and str2 """ def check_common_longest(str1, str2): # Make the small string as str1 if not len(str1)< len(str2): str1, str2 = str2, str1 left_index=0 right_index=0 match_list = [] while ( left_...
be5973e2930492ff30d86512317202fd59652dd2
nzubechukwudavid/python-Project-1-Morah-culator
/MORAH-culator.py
27,163
3.671875
4
#Name: Morah David #Phone Number: 08146139053,09078820715 #E-mail: nzubechukwumorah@gmail.com #This is an attempt to combine programs, while treating them as seperate programs, but maintaining a link between them, somehow #Constructive criticism is highly encouraged. #Please send any observations to """"nzub...
47cba5a368e15006a73020b59378f65bf6000380
nilesh7808/CodingNinjaDSA
/BinaryTreeCodingNinjas/removeLeafNodes.py
680
3.578125
4
class BinaryTree2: def __init__(self,data): self.data = data self.left = None self.right = None def remove_leaf_nodes(root): if root == None: return None if root.left == None and root.right == None: return None print(root.data,end = " ") root.left = remov...
4918b697e2810b7d36a409f8631eaaaba1128d92
nilesh7808/CodingNinjaDSA
/BinaryTreeCodingNinjas/printLevelWiseInput.py
1,576
4
4
import queue class BinaryTree: def __init__(self,data): self.data = data self.left = None self.right = None def printLevelwiseInput(root): import queue q = queue.Queue() if root == None: return None q.put(root) while (not(q.empty())): a = q.get() ...
ad23ad6ab788365fad319aa05410e7084f9c5ba4
nilesh7808/CodingNinjaDSA
/DICTIONARIESCodingNinjas/wordswithFreqK.py
571
3.671875
4
# 1st method s = input("Enter String ") k = int(input("Enter Frequncy ")) words = s.split() d = { } # for w in words: # if w in d: # d[w] = d[w] + 1 # else: # d[w] = 1 # or for w in words: d[w] = d.get(w,0) + 1 for w in d: if d[w] == k: print(w) # # 2nd method # def printKFr...
72f7ca5d69ef9c68a1a05947270c6279e73d94c9
nilesh7808/CodingNinjaDSA
/CodingNinjasTimeComplexities/Similar.py
269
3.5625
4
arr = [1,5,5,1,4,5] for i in range(0,len(arr)): flag = 0 for j in range(0,len(arr)): if i != j: if arr[i] == arr[j]: flag = 1 break if flag==0: print(arr[i]) print("Nothing to print") break
989d7f3e91a01336bee5c87bd498cf2ed9979bba
nilesh7808/CodingNinjaDSA
/BinaryTreeCodingNinjas/balncedTreeOrNot.py
886
3.84375
4
# O(n^2) class BinaryTree: def __init__(self,data): self.data = data self.left = None self.right = None def height(root): if root == None: return 0 return 1 + max(height(root.left), height(root.right)) def isBalanced(root): if root == None: return True lh = ...
ecbddfe46fe9f3ab0adbf1a3d274aa0e2e54f1e0
nilesh7808/CodingNinjaDSA
/CodingNinjasStacks/StockSpan_UsingStack.py
430
3.5625
4
def stockSpan(price,n): i = 0 while i != n: if price[i] == price[i+1]: return 1 i = i + 1 count = 0 if price[i] < price[i+1]: count += 2 i += 1 elif price[i] > price[i+1]: count += 1 i += 1 n = int(input()) pric...
371e6025f0bdd9eb9afd94c3a19fa8c34474fb71
nilesh7808/CodingNinjaDSA
/BinaryTreeCodingNinjas/findMaxandMininTree.py
1,568
3.75
4
import queue class BinaryTree: def __init__(self, data): self.data = data self.left = None self.right = None INT_MIN = -2147483648 INT_MAX = 2147483647 def findMax(root): if root == None: return INT_MIN res = root.data lres = findMax(root.left) rres = findMax(root.r...
1a5c0052b3dd0acb894574e4f4cea59ae317c3d3
nilesh7808/CodingNinjaDSA
/CodingNinjasTimeComplexities/Pairsum.py
245
3.796875
4
def PairSum(arr,x): n = len(arr) i = 0 j = len(arr)-1 while i < j: if arr[i] + arr[j] == x: n = int(input()) arr = list(int(i) for i in input().split()) arr.sort() x = int(input()) print(PairSum(arr,x))
2488d526ef39108a25fa974c12209e336e3cce4b
nilesh7808/CodingNinjaDSA
/CodingNinjasStacks/Basic_stac_.py
652
4.0625
4
class Stack: def __init__(self): self.data = [] def push(self,item): self.data.append(item) def pop(self): if self.isEmpty(): print("Hey! Stack is Empty") return return self.data.pop() def top(self): if self.isEmpty(): print(...
44fe34eadcc986c53cb9272d1b652f6ebdd0bcbd
nilesh7808/CodingNinjaDSA
/BasicPythons/greatestInTuple.py
158
4.09375
4
def greatest_In_Tuple(): print(max(t)) print("Enter numbers seperated by comma ") t = tuple(list(int(i) for i in input().split(","))) greatest_In_Tuple()
1709fe2d48dedcca7a680d441b5fe07072ed2bd6
nilesh7808/CodingNinjaDSA
/BasicPythons/maxPath.py
202
3.515625
4
def maxPathRecurs(m,n): #base case if (m == 1) or (n == 1): return 1 return maxPathRecurs(m,n-1) + maxPathRecurs(n,m-1) m = int(input()) n = int(input()) print(maxPathRecurs(m,n))
57157a00134de7e7c115803ccac2ebecc13e5787
nilesh7808/CodingNinjaDSA
/GenericTrees/maximumOfTree.py
715
3.71875
4
class GenericTree: def __init__(self, data): self.data = data self.children = list() def maxOfNodes(root): if root == None: return max = root for child in root.children: if max.data < maxOfNodes(child).data: max = maxOfNodes(child) return max def takeTr...
aec438ca0da7d9f4de629c654a1972c0e49e1e8d
Tonynamess/testclass
/pytest/0002/test_calc.py
321
3.5
4
# -*- coding: utf-8 -*- # author: time:2019-10-13 def add(x,y): return x + y def test_add(): assert add(1,0) == 1 assert add(12,88) == 100 assert add(10,990) == 1000 # 所有以test_开头的py文件都被当成了测试文件 # 所有测试文件中以test开头的方法被当成了测试用例执行
074cd5ceee8dd7eb3748376f68b857745234a496
Andre-villa/Tarea-Taller-de-Programacion
/Tarea Taller de programacion-pasar de base(2-9) a base(10).py
225
3.546875
4
def convertir_decimal(pNum,pBase, pExpo=0): if pNum < pBase : return pNum*pBase**pExpo else: return (pNum%10*pBase**pExpo + convertir_decimal(pNum//10,pBase, pExpo+1)) print(convertir_decimal(315,7))
de7a6c2e45f73adef2a34a77832e72fe36d14939
Mirza233/Competitive-Programming-2020
/Identical.py
1,148
3.671875
4
#Link: https://putka-upm.acm.si/tasks/t/eqstr/ from functools import lru_cache @lru_cache(maxsize=None) def identical(s1,s2): if len(s1)<=3: return sorted(s1) == sorted(s2) s1 = [s1[:len(s1)//3],s1[len(s1)//3:2*len(s1)//3],s1[2*len(s1)//3:]] s2 = [s2[:len(s2)//3],s2[len(s2)//3:2*len(s2)//3...
5663af33ca3cd8bc7cc9f1ae515d72842f1469c8
vojoup/pokusy_python
/text_to_upper.py
251
3.703125
4
print('Tento program vypise veskery obsah zadaneho souboru velkymi pismeny.') name = input('Zadej jmeno souboru ke zpracovani:') try: with open(name) as f: obsah = f.read() except FileNotFoundError: print('Chyba') print(obsah.upper())
77d0aa55fbbdedce3a5b016ccfff91ca07a64c2d
LeaderAlina/NeuralNetwork
/Адаптивный тренажер Python/logo.py
468
3.515625
4
n = int(input()) logo = ('''[:::::[ CODE THE WORLD ]:::::] [:::::[www.itmathrepetitor.ru]:::::]''') for i in range(n): if n < 8: print("ERROR") break if i == 0 or i == n-1: print('[[[[[[[[[[[[[[[ ]]]]]]]]]]]]]]]]]') elif i == n//2: print(logo) elif i <= n//4 or i...
8b8471130787bf0c603dd98b79ac77848d72eda4
Andrew-Lindsay42/Week1Day1HW
/precourse_recap.py
277
4.15625
4
user_weather = input("Whats the weather going to do tomorrow? ") weather = user_weather.lower() if weather == "rain": print("You are right! It is Scotland after all.") elif weather == "snow": print("Could well happen.") else: print("It's actually going to rain.")
9c6199e38609e6f097b35cd9b7da2b4fdfd15b5c
extremecoders-re/hackerrank
/contests/Booking.com Hackathon/Travel Profiles/solution.py
1,561
3.640625
4
hotel_list = {} def find_hotels(max_budget, reqd_facil): global hotel_list found = [] for key in hotel_list.keys(): hotel_price = (hotel_list[key])[0] hotel_facil = (hotel_list[key])[1] if hotel_price <= max_budget: if reqd_facil <= hotel_facil: ...
447118bce90df55c5c9cbc1b040939dd3c504bbe
ahmetnuriozcelik/python
/writing-to-files.py
626
3.71875
4
# Creates a file or if the file does not exist it overwrites the file with open("quotes_new.txt","w") as handle: handle.write("This is the first line \n") # Adds a line to an existing file with open("quotes_new.txt","a") as handle: handle.write("This is the second line \n") # Reads a file and writes it on ano...
96fd813869fbe272727906076bb64b9090062681
evoling/ie-politeness
/data/make_distinct_politeness_table.py
1,126
3.546875
4
#!/usr/bin/env python3 """ This script was used to transform the pronoun-paradigms.csv table into pronoun-distinct-politeness.csv, which shows whether languages have overlap between their polite and intimate forms in 2sg or 2pl:: python make_distinct_politeness_table.py > pronoun-distinct-politeness.csv The outpu...
9fab9d1ea07f58db4301b8a847ea76f245af468f
pankaj-raturi/python-practice
/chapter_4/exercise1.py
246
3.671875
4
#!/usr/bin/env python3 perHourCharges = 0.51 dailyCost = perHourCharges * 24 monthlyCost = dailyCost * 30 print( 'Cost to operate per day: ${:.2f}'. format(dailyCost) ) print( 'Cost to operate per month: ${:.2f}'. format(monthlyCost) )
7a03a57714a7e1e7c4be0d714266f119ffbe2667
pankaj-raturi/python-practice
/chapter3.py
1,086
4.34375
4
#!/usr/bin/env python3 separatorLength = 40 lname = 'Raturi' name = 'Pankaj ' + lname # Get length of the string length = len(name) # String Function lower = name.lower() print (lower) # * is repetation operator for string print ( '-' * separatorLength) # Integer Object age = 30 # Convert Integers to string obj...
5597bd70a09d9a6f784d9570531a98eee83e9da9
Lomaev2/python1
/python/Следующее и предыдущее.py
172
3.5625
4
n = int(input()) print('Число, следующее числу ', n,' - ',n+1,'.' '\nЧисло, предшествующее числу ', n,' - ',n-1,'.', sep='')
66f262fe30f037e958c3cb1593c9e65907bf58a5
Lomaev2/python1
/python/Коровы.py
379
3.71875
4
n=int(input()) z=n%10 print(z) if n==1 or z==1: print('На лугу пасется',n,'корова') elif n//10==1 or z//10==1: print('На лугу пасется',n,'коров') elif (z==2 or z==3 or z==4) or (n==1 or n==3 or n==4): print('На лугу пасется',n,'коровы') else: print('На лугу пасется',n,'коров')
e6f11c425158bdc11a110918a9a0cf5783bbe55d
AndreeaMusat/Automatic-Number-Plate-Recognition
/draw.py
2,216
3.609375
4
from sys import exit from scipy import misc def error(msg): print(msg) exit(-1) """ Draw a vertical line on an image Parameters ---------- img : numpy.ndarray Image (RGB) to draw on start_point : 2-tuple (Int) Coordinates of upper point end_point : 2-tuple (Int) Coordinates of lower point color : 3-tuple (Int) ...
a2d1d27055ec384863adb2a5c39ecaf5a18d3e71
MegaOktavian/praxis-academy
/novice/01-02/kasus/insertSort.py
281
4.03125
4
def insertionSort(list): for j in range(len(list)-1,-1,-1): value = list[j] hole = j while hole<(len(list)-1) and list[hole+1]>list[hole]: list[hole] = list[hole+1] hole = hole+1 list[hole] = value print(list)
8a3ad8eac1b92fcd869d220e1d41e19c65bf44d3
MegaOktavian/praxis-academy
/novice/01-05/latihan/unpickling-1.py
758
4.1875
4
import pickle class Animal: def __init__(self, number_of_paws, color): self.number_of_paws = number_of_paws self.color = color class Sheep(Animal): def __init__(self, color): Animal.__init__(self, 4, color) # Step 1: Let's create the sheep Mary mary = Sheep("white") # Step 2:...
8e2112c0a9354e9bdecd2fe43449e68d6659a9e6
MegaOktavian/praxis-academy
/novice/01-01/kasus/bubbleSort.py
253
3.84375
4
def bubbleSort(list): iterasi = 0 for j in range (len(list)-1): for i in range(len(list)-1-j): if list[i]>list[i+1]: list[i],list[i+1]=list[i+1],list[i] iterasi+=1 print(iterasi, list)
c9b492fb8f10c93b06d3aec83664e465323f0f4b
HasinAnik/Python-Programming-Exercises
/Functions.py
3,553
4.28125
4
#1) Function to create a disctionary grouping a sequence of key-value pairs into a dictionary of lists list1 = [('yellow',1),('blue',2),('yellow',3)] #lkeys = [numbers[0] for numbers in list1] #seperated the keys #values = [numbers[1] for numbers in list1] #seperated the values #logic: # 1. list of tuples are given. ...
c0dd63f24c1ba4da87e24a279b7a476b00adf7f1
yaoyc/CrazyPython
/exercise/list_Tuple.py
2,743
4.0625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- classmates = ['Michael','Bob','Tracy'] print classmates ''' len() 函数可以获得list元素的个数 用索引访问list中的每一个位置的元素,索引是从0开始 ''' print len(classmates) print classmates[0] print classmates[1] print classmates[2] #如果 print classmates[3] 会报indexError错误,因为超出了范围,这里目前只有3个元 #素,从0开始 是第一个元素 ''...
650859493c257f262b77936e15dbc7c4d5d5e8b0
sandy1618/LiveCodeRelive
/Python_Coding_Practice/CodingInterviews/HackerRank/Implementation/appleandorange.py
757
3.84375
4
#! usr/bin/env python __author__ = 'Sandeep Kumar Nayak' __status__ = 'development' def countApplesAndOranges(s, t, a, b, apples, oranges): count_apple = 0 count_orange = 0 for apple in apples: if s <= apple + a <= t: count_apple += 1 for orange in oranges: if s <= orange + ...
898b723c3de1215c520935cdb6be9e2490c4cb12
sjose1x/mypytest
/test.py
339
3.546875
4
def plusone(x): return x+1 def test_one(): assert plusone(3) == 5 def test_2(): #comparison assert 'foo 1 bar' == 'foo 2 bar' def test_3(): #comparison2 a = 'a'*100+'1'+'b'*100 b = 'a'*100+'2'+'b'*100 assert a == b def test_4(): #comparison2 a = set([1,2,3]) b = set([1,3,4]...
400090f2c10493b805ad048fbf632e3372e40f94
renumokalkar/Python_14_july
/listoperation.py
811
3.5625
4
print("THIS IS TASK 1") num=[1,2,5,4,10,5] num1=[] num2=[] for i in num: if i%2==0: num1.append(i*50) print("num1" ,num1,end='') for i in num: if i%2!=0: num2.append(i*50) print("\nnum2",num2,end='') print('\n') print("\nTHIS IS TASK 2") l1=[234,556,233,454,1221,3243] l2=lis...
56053a7c3875a99fd7a3d7abe7b5daace756b292
airthingy/tensorflow-class-logistic-regression
/prepare_data.py
1,506
3.703125
4
import pandas as pd read_training_cols = ["Survived","Pclass","Sex","Age","SibSp","Parch","Fare"] train_data = pd.read_csv('train.csv', usecols=read_training_cols) #Filter out rows missing data train_data = train_data.dropna() #Replace categorical feature columns with indicator (dummy) columns train_data = pd.get_dum...
5069df2a775ae26ec15f28e16fce7c70751937cc
SenseShieldShenyy/shenyypersonal
/python/code/test11_14/bl8.2.py
203
3.765625
4
st = input() st1 =eval(st) if isinstance(st1,float) or isinstance(st1,complex): ` print(st1**2) elif isinstance(stl,int): if st.isdecimal(): print(stl ** 2) else: print("输入有误")
11830452925818a430a99470a93e34cfcdd8de43
SenseShieldShenyy/shenyypersonal
/python/mooc/hanoi.py
319
4.03125
4
#hanoi count = 0; def hanoi(n, src, dst, mid): global count if n == 1: print("{}:{}->{}".format(1, src, dst)) count += 1 else: hanoi(n-1,src, mid, dst) print("{}:{}{}".format(n, src, dst)) count += 1 hanoi(n-1,mid, dst, src) hanoi(3,"A","C","B") print(count)
542420c592d351afc2fbe071fe8d656a8753c2f9
g-ramirez/git_projects
/oop/car.py
665
3.828125
4
class Car(object): def __init__(self, price, speed, fuel, mileage): self.price = price self.speed = speed self.fuel = fuel self.mileage = mileage if price > 10000: self.tax = 15 else: self.tax = 12 def display_all(self): print ("Pr...
d9b12c940fddfd1f88e70234092e751492a5b9ad
MatthijsBiondina/biobots
/biobots2D/components/cell/celldata/abstractcelldata.py
2,103
3.953125
4
from abc import ABC, abstractmethod from biobots2D.components.cell.abstractcell import AbstractCell class AbstractCellData(ABC): def __init__(self): """ This class sets out the required functions for working out various types of data that can be extracted from a cell This will us...
110cfbc932af0967b5eaca24e3bc919517063fb9
AraqueGD/holbertonschool-web_back_end
/0x00-python_variable_annotations/5-sum_list.py
219
3.609375
4
#!/usr/bin/env python3 """ list of floats """ from typing import Callable, Iterator, Union, Optional, List def sum_list(input_list: List[float]) -> float: """ Return List Sum Floats """ return sum(input_list)
0625a6dd0a4019adcdde1f00da0fd8487d927617
SoundaryaJagan/Soundarya-Jagan
/happy.py
250
3.78125
4
def sumdigsqr(n): sum=0 while(n!=0): r=n%10 sum+=r*r n//=10 return sum def happy(n): while(n>0): n=sumdigsqr(n) if n==1: print('happy number') return print('not happy number') def main(): try: n=int(input()) happy(n) except: print('invalid') main()
869b0fa3f96eeb7704c599e0cf5174fb69eebeca
LTS695177695/Tic-tac-toe-chess
/alphabeta.py
4,488
3.609375
4
import math def print_board(state): print(state[0]+'|'+state[1]+'|'+state[2]) print(state[3]+'|'+state[4]+'|'+state[5]) print(state[6]+'|'+state[7]+'|'+state[8]) def count(state): c = 0 for cell in state: if cell != ' ': c += 1 return c def player(state): ...
cea29df7f347b3c5b9e0df7707a502ac6f3e593a
gsanchezm/Ejercicios_Curso_Python
/venv/practicas/practica_tres.py
382
3.765625
4
import turtle def main(): window = turtle.Screen() gil = turtle.Turtle() make_square(gil) turtle.mainloop() def make_square(gil): lenght = int(input('Tamaño de cuadrado: ')) for i in range(4): make_line_and_turn(gil, lenght) def make_line_and_turn(gil, lenght): gil.forward(leng...
de7b7d666b4b4231156141779840bf38d8f94e31
SamZhou99/python_study
/py3/calculate-random.py
1,544
3.6875
4
import random # 做多少题 max_num = 10 total = 0 right = 0 error = 0 # 打印统计结果 def print_statistical(): global total, right, error print('总是题数:{},正确:{},错误:{}'.format(total, right, error)) print('') # 打印正确提示 def print_right(): pass # 打印错误提示 def print_error(resultNum): pass # 获取输入文字到整数型 def kb_...
f8e9e1842a68ed815abda47641c5f711154c56e8
SamZhou99/python_study
/py3/test-class/Father.py
267
3.796875
4
class Father(object): def __init__(self, name): self.fatherName = name # print("Father name: %s" % (self.name)) def __str__(self) -> str: return self.fatherName def getFatherName(self): return "爸爸 " + self.fatherName
5abbd1f9305778bdd27546793ccc7df252a2e1a5
hetty1120/AI_Propositional_Logic
/DPLL.py
7,638
3.6875
4
# coding: utf-8 # In[1]: # import class of Stack from pythonds.basic import Stack # In[2]: class BinaryTree: def __init__(self, root_val): self.key = root_val self.left_child = None self.right_child = None def insert_left(self, new_val): if self.left_child == ...
1d9e31f1b88492e3e27f75607f25a2956d4ab90c
dracotsui/ertai
/src/ertai/creature.py
1,827
4.09375
4
""" Class for Creature """ from .card import Card from dataclasses import dataclass @dataclass(init=False, repr=False) class Creature(Card): """ A base class for creatures. """ def __init__(self, title, cost, power, toughness, tapped=False): """ Initiate this creature by passing powe...
e5708edfbe3025eb563aad7f88e5baa47dcd9f04
nizamudheenti/NIELIT-ADVANCED-AI-DIPLOMA
/ML/Day21/old/bit.py
2,559
3.671875
4
#Importing libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt training_set=pd.read_csv('BTC-USD.csv') training_set1=training_set.iloc[:,1:2] #selecting the second column training_set1.head() #print first five rows training_set1=training_set1.values ...
ec9bc0ffcd52536a8ea7dcf30dd1c93e0aa42ec2
YosephKS/Introduction-to-Programming
/2-intro-to-programming-concepts/2.1-basics/game.py
1,741
3.578125
4
from random import random GAME_STATE = True while GAME_STATE: WIN_STATE = False while True: random_num = int(random() * 10000) if len(random_num) == 4: break if len(random_num) < 4: random_num = "0" * (4 - len(random_num)) + random_num break ...
76b151fe57b2770d9b42c4af4a4e335a78cac0c8
binarygondola/adventofcode-2017
/day03.py
1,914
3.515625
4
import numpy as np def sumofadjacent(x, y, array): # print(x, y) tmp = 0 tmp += array[x + 1][y] tmp += array[x + 1][y + 1] tmp += array[x + 1][y - 1] tmp += array[x][y + 1] tmp += array[x][y - 1] tmp += array[x - 1][y] tmp += array[x - 1][y + 1] tmp += array[x - 1][y - 1] i...
80da0ba0059877cdd38d87d24a4eb54902c2060a
kymurry/Kyle_Repo
/ftp/ftp.py
1,336
3.609375
4
import ftplib def ftp_connect(): while True: site_address = input('Enter site address:') try: with ftplib.FTP(site_address) as ftp: ftp.login() print (ftp.getwelcome()) print ('Current Directory', ftp.pwd()) ftp.dir() ...
ea99142906155dc1dde788b7eb91c871fd2eb176
Pranil10/Python_Projects_2
/rockpaperscissor.py
1,488
4
4
import random import time options=['rock','paper','scissor'] def Player1(): ch=input('enter rock or paper or scissor') global choice1 choice1=ch.lower() while choice1 in options: Player2() break def Player2(): global choice2 if mode==0: computer=['rock','...