blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
634f5e68f2f7d10e97518e5ab191753f1aa02691
neKeyoff/Python_Task-of-University
/lab4.py
720
4.25
4
veg1 = str(input("Первый овощ: ")) veg2 = str(input("Второй овощ: ")) veg3 = str(input("Третий овощ: ")) print(str.lower(veg1), str.lower(veg2), str.lower(veg3)) print(str.upper(veg1), str.upper(veg2), str.upper(veg3)) print(str.capitalize(veg1), str.capitalize(veg2), str.capitalize(veg3)) print("Введите число", str.ca...
e3d462660bfa5db45970447b15d0f9b08ca008ed
Deepak9292J/PythonCoding
/forLoop.py
132
3.859375
4
for number in range(1,10): print(number) for number1 in [1,2,3,4]: print(number1) for letter in "abcd": print(letter)
7897a852be59241ff051ee81d8c4be585dcb9858
Deepak9292J/PythonCoding
/hello_you.py
474
4.4375
4
#Ask user for name name = input("What is your name? ") print(name) #Ask user for age age = input("What is your age?" ) print(age) #Ask user for City city = input("What is your city? ") print(city) #Ask user abiut hobbies hobbies = input("What are youe hobbies? ") print(hobbies) #Create output text string = "My name...
ee82c57b7c95ddb233e6cd21bf98b99783af675a
marcin-pasiewicz/python
/test.py
592
3.5625
4
import unittest import random_game class TestGame(unittest.TestCase): def test_input(self): result = random_game.run_guess(5, 5) self.assertTrue(result) def test_input_wrong_guess(self): result = random_game.run_guess(0, ) self.assertFalse(result) def test_input_wrong_num...
513a093eae7438d2764e55900985a3ec9ac5f25d
tonabarrera/SistemasComplejos
/GameOfLife/graficar.py
801
3.5
4
import matplotlib.pyplot as plt import matplotlib.animation as animation from sys import argv from matplotlib import style fig = plt.figure('Historial de unos') fig.suptitle("Historial de unos") grafica = fig.add_subplot(1, 1, 1) def animacion(i): info = open(argv[1], "r").read() lineas = info.split("\n") xs = [] ...
9ebefd2de1f2cdb4668cdf4ebd7c8454657fe040
brianfluk/food
/thoughts/pandas_test.py
1,766
3.8125
4
from __future__ import print_function ''' import matplotlib.pyplot as plt # for if u wanna show the hist() plot in cli ''' import numpy as np import pandas as pd # importing pandas library pd.__version__ ''' creating Series data structure ''' city_names = pd.Series(['San Francisco', 'San Jose', 'Sacramento']) popul...
a781d5cd932dbdfc62db8345ae12368fb2600200
thekarpathia/XmenGame
/Jubilee.py
3,191
3.921875
4
from sys import exit from sys import argv def start(): print "Jubilee is leaving the mall with some sweet new threads and spies a Sentinel!!" print "Holy SMOKES!!" print "She could run, hide, or fight..." print "What should she do??" next = raw_input("> ") next_selection = next.lower().replace...
e354d6a8d7662f6c4a32dce7b0993a659db27da1
srijan-deepsource/survey_simulator_post_processing
/modules/PPOutWriteCSV.py
432
3.546875
4
#!/usr/bin/python def PPOutWriteCSV(padain, outf): """ PPOutWriteCSV.py Author: Grigori Fedorets Description: This task reads in the pandas database, and writes out a CSV file by a name given by the user. Mandatory input: name of database, name of output file Output: ...
1c4f58b428ed12b1b66176b5b245df5ee2ad6f84
Ranjani94/Leetcode_Problems
/list.py
1,090
4.0625
4
# # li = [1,2,3,4,5,6,7,8,9] # # def odd_even(lis): # for i in lis: # if i % 2 ==0: # print("Even number",i) # else: # print("Odd number",i) # # # odd_even(li) #################################### #count of list # num = [1,2,3,4,5,6,7,8,9,10] # # # def count(l): # eve...
685ede6fb745cb3a370e1f92d756e609f865d487
mfguerreiro/Python
/lista3/ex1.py
123
3.75
4
n = int(input("Digite o valor de n: ")) i = n - 1 if n == 0: n = 1 while(i > 0): n = n * i i-=1 print(n)
e027591585d8a3e0f1d145d1fb9757381e54e792
mfguerreiro/Python
/lista1/EXTRA/ex2.py
299
3.703125
4
num = int(input("Por favor, entre com o número de segundos que deseja converter:")) dias = num // 86400 horas = (num % 86400) // 3600 minutos = ((num % 86400) % 3600) // 60 segundos = ((num % 86400) % 3600) % 60 print(dias, "dias,", horas, "horas,", minutos,"minutos e", segundos, "segundos." )
ba62e5bb2ac524234a340727c23256308a517bf1
mfguerreiro/Python
/lista11/imprimeMatriz.py
484
3.5625
4
def calcula_linha(matriz): lin = len(matriz) return lin def calcula_coluna(matriz): col = 1 for i in matriz: col = len(i) break return col def imprime_matriz(matriz): lin = calcula_linha(matriz) col = calcula_coluna(matriz) for i in range(0, lin): for j in rang...
e08f18bb4fb9e043adb5eb16a72ef2fff319f520
vadimvvlasov/Flask-with-machine-learning
/ml-flask/main.py
924
3.546875
4
# https://medium.com/analytics-vidhya/deploying-a-machine-learning-model-on-web-using-flask-and-python-54b86c44e14a # Step1. Importing all the necessary Libraries required for building a Linear Regression Model using Scikit Learn import pandas as pd import numpy as np from sklearn import linear_model import matplotlib...
958eba97484826956cf6279a12e0891fea587a88
dev-11/HackerRankSolutions
/ProblemSolving/Algorithms/Greedy/SherlockAndTheBeast/solution.py
249
3.828125
4
for _ in range(int(input())): start_number=int(input()) decent_number=start_number while(decent_number%3!=0): decent_number-=5 print('-1' if decent_number<0 else decent_number*'5'+(start_number-decent_number)*'3')
a97601fb83a86487508efa1f3d725a89d077ad42
dev-11/HackerRankSolutions
/ProblemSolving/Algorithms/Greedy/GridChallenge/solution.py
357
3.75
4
def isInOrder(columns): for index in range(len(columns)): if sorted(columns[index]) != columns[index]: return False return True grids = int(input()) for _ in range(grids): grid = (sorted(input()) for _ in range(int(input()))) columns = [list(x) for x in zip(*grid)] print("Y...
7b3feed3bfae81c43506c72aba061669c5fac72a
sj-simmons/math-tools-python
/bernoulli.py
2,913
3.921875
4
#!/usr/bin/env python '''Computes the nth Bernoulli number. -sjSimmons command line usage: py bernoulli.py [options] n arguments: n non-negative integer options: -s show x/(1-e^(x)) modulo x^n interactively, e.g.: >>> from bernoulli import * >>> print(berni(12)) -69...
dd332cd5a6d90f621f4a322f5fb48a6b01476676
hemantdhankar/Machine-Learning
/Linear Regression/LinearRegression.py
8,461
3.640625
4
import numpy as np import matplotlib.pyplot as plt import math import random class MyLinearRegression(): """ Implementation of Linear Regression. """ """ Class Attributes """ mae_theta_list = [] mae_bias = 0 rmse_theta_list = [] rmse_bias = 0 training_rate = 0 FINAL_MAE...
26341926806e6e9fcbfaa9c5ea19542e1eae997f
awescarsoto/HackerRank
/climbing_leaderboard.py
3,374
3.90625
4
''' Alice is playing an arcade game and wants to climb to the top of the leaderboard. Can you help her track her ranking as she beats each level? The game uses Dense Ranking, so its leaderboard works like this: The player with the highest score is ranked number on the leaderboard. Players who have equal scores receiv...
b0b56b3670193d366f625ea1f49ec37210d6e225
awescarsoto/HackerRank
/hash_table_ransom_note.py
2,102
4.03125
4
''' A kidnapper wrote a ransom note but is worried it will be traced back to him. He found a magazine and wants to know if he can cut out whole words from it and use them to create an untraceable replica of his ransom note. The words in his note are case-sensitive and he must use whole words available in the magazine, ...
e0378c5b09fcdd2a584c50a88b9b981143f65ef9
ShrishtiHore/Competitive_Problems
/Grading_Students.py
201
3.65625
4
for i in range(int(input())): a = int(input()) if a >= 38: nex = 5 * (a//5 + 1) if (nex - a) < 3: #print('loop er bhitore dhukchi') a = nex print(a)
6be0d81f79476184e005ac683c7c1dd21743c760
MridulGangwar/Leetcode-Solutions
/Python/Easy/1051. Height Checker.py
346
3.609375
4
class Solution(object): def heightChecker(self, heights): """ :type heights: List[int] :rtype: int """ heights_sorted = sorted(heights) counts=0 for i in range(len(heights)): if heights[i]!=heights_sorted[i]: counts+=1 ...
2bc673d3d9aa7f4a21a8fadedb1e12c2b93d327b
MridulGangwar/Leetcode-Solutions
/Python/Easy/70. Climbing Stairs.py
367
3.515625
4
class Solution(object): def climbStairs(self, n): """ :type n: int :rtype: int """ result = [0]*(n+1) if n==0: return 1 result[0]=1 result[1]=1 for i in range(2,n+1): result[i] = result[i-1]+re...
17d8c454ae1a1735bd95513d20557c50bbf55121
MridulGangwar/Leetcode-Solutions
/Python/Easy/543. Diameter of Binary Tree.py
729
3.65625
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution: def diameterOfBinaryTree(self, root: TreeNode) -> int: def dfs(node): nonlocal ...
49c32b475509663460106d2425cb95450eb607b9
keelanfh/mod-direct-2
/add_urls.py
1,807
3.515625
4
"""Adds URLs to the data, based on the URL_Rules.xlsx file """ import re from application import Module, db import csv class URLRule(object): """URLRule object, with method to return URL based on rule""" def __init__(self, info): self.name = info["URL_Rule"] self.Regex = info["Regex"] ...
8daf5bb26c23300edfcb98c50136de643a9ad042
KyleAMcKee/python-data-structures
/inheritance.py
1,984
3.578125
4
class Employee: raise_amt = 1.04 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = first + '.' + last + '@email.com' def fullname(self): return '{} {}'.format(self.first, self.last) def apply_raise(self):...
884c5cf665afed089f29f8b30fb468ea3a4e2bff
XabiOdri/python
/run/run.py
1,341
3.65625
4
"""Usage: run.py SHORTCUT [OTHER_ARGUMENTS...] run.py (-h | --help) run.py --version Arguments: SHORTCUT Shortcut of the app to run OTHER_ARGUMENTS additional arguments Options: -h --help Show this screen. -v --version Show version. """ # run: program to run applications with a...
23f4ed4a24ca3c7ac55a580427924aaa184d0b3b
sean-gt/Sheridan
/assignment_5_ace_jqk_split_real_v3.py
18,262
3.921875
4
""" Assignment #5: Blackjack Please read 'help_message' below for the rules of the game. Games starts with user's input of Y (yes), N (no), or H (help) """ from random import shuffle # tro generate random integer import time # to use sleep() - time delay import os # to use screen clear function # t...
cddd6263553b4c3f611a6f3e6eee7b27f48681f3
tanmaysawaji/Snake-Python
/snake.py
1,981
4.0625
4
''' Author : Tanmay Sawaji Github : https://github.com/tanmaysawaji ''' import pygame import random def play_snake(): # Creating the game window pygame.init() win_width = 100 win_height = 100 win = pygame.display.set_mode((win_width, win_height)) pygame.display.set_caption("Snake") clock = pygame.time.Clock() ...
8d58b5e0225228259c0614888f23a53b5b02e003
Nguyen-Van-Huy/thuc-hanh
/8.8..py
1,094
3.5
4
from tkinter import * tk=Tk() tk.title('welcome') tk.geometry('350x350') lb1=Label(tk,text='Nguyen Van Huy',font=('time',20)) lb1.place(x=100,y=50) lb2=Label(tk,text='msv:18575103010027',font=('time',20)) lb2.place(x=100,y=100) lb3=Label(tk,text='date:23/08/2000',font=('time',20)) lb3.place(x=100,y=150) tk.ma...
631ae12c2dc1ecb31d61121814e3f95adf7811e3
db97828/PythonAlgorithm
/python/20200903_greedy_2.py
1,164
3.8125
4
""" 작성일: 2020-09-03 ============================================================================== 문제: 곱하기 혹은 더하기 각 자리가 숫자(0~9)로만 이루어진 문자열 S가 주어졌을 때, 왼쪽부터 오른쪽으로 하나씩 모든 숫자를 확인하며 수자 사이에 'x'혹은 '+'연산자를 넣어 결과적으로 만들어질 수 있는 가장 큰 수를 구하는 프로그램을 작성하시오. ==============================================================================...
97ede030d9c07dc5bf12ebf1cdd8fc827a0d3eaf
db97828/PythonAlgorithm
/python/20200904_implementation_1.py
1,347
3.515625
4
""" 작성일: 2020-09-04 ============================================================================== 문제: 럭키 스트레이트 특정 조건이란 현재 캐릭터의 점수가 N이라고 할 때 자릿수를 기준으로 점수 N을 반으로 나누어 왼쪽 부분의 각 자릿수의 합과 오른쪽 부분의 각 자릿수의 합을 더한 값이 동일한 상황을 의미한다. 현재 점수 N이 주어지면 럭키 스트레이트를 사용할 수 있는 상태인지 안니지 알려주는 프로그램 작성 =============================================...
c437fe8b03591e3199042388ca55d8735b152c5e
blakexcosta/Unit3_Python_Chapter13
/main.py
847
3.890625
4
from cat import Cat def main(): print('gello') # objects # access + return property # object_name.property_name # change property #object_name.property_name = new_value # add a new property #object_name.new_property = new_value # methods vs. functions """basically the same ...
0f81ea58d6ec000ed4519d14e14ae0198a5da232
HyoTaek-Jang/ML_python
/LinearAlgebra/LA_Assignment/algo_operator_fail.py
2,036
3.609375
4
if __name__ == "__main__": num = int(input('총 수 : ')) num_value = [int(a) for a in input('각 수의 값 : ').split(' ')] num_operator = [int(a) for a in input('각 부호 + - * / : ').split(' ')] num_value.sort() def cal_max(num_value, num_op): max = 0 num_operator = num_op[:] for i i...
ce764ca5d12f2ed95ea27b26e7cb4b2d5b128648
Bevsii/CPSC410-Software-Visualization-Project
/410Python/School/student.py
1,048
3.5625
4
from School.grade import Grade class Student: def __init__(self, name, id): self.name = name self.classes = [] self.grades = [] self.id = id def setGrade(self, subject, grade): y = False for x in self.grades: if x.subject == subject: ...
f2e66e689e96c856f4cd10d4a819c690fe8ad78a
ljdutton2/Interview_questions
/leetcode/leetcode_communication.py
1,601
3.859375
4
"""Leetcode Problem:Given an array of integers, return indices of the two numbers such that they add up to a specific target. Restated: I'm going to return the inidicies of the two numbers in my array that equal a specific target number Clarifying Questions: Could this possibly be a really large list of numbers? A...
c6f54de6e5e652d0993b44894a5241f8e069afa1
miloscomplex/100_Days_of_Python
/day-22-pong/paddle.py
499
3.5
4
from turtle import Turtle SPEED = 20 class Paddle(Turtle): """docstring for paddle.""" def __init__(self, tupple): super().__init__() self.shape("square") self.color("green") self.shapesize(stretch_wid=5, stretch_len=1) self.penup() self.goto(tupple) def g...
4d32bd96a9214a07624485e756a91ced0e492221
Maya-Nurani/python-course-exercises
/tempExercise.py
3,619
3.734375
4
import numpy as np from numpy import random import matplotlib.pyplot as plt #### Part A exercise1 #### initial_temp = random.randint(20, 41) #### Part A exercise2 #### temp_change = random.normal(loc=5, scale=2, size=(14, 24)) #### Part A exercise3 #### temp_total = np.copy(temp_change) # Using copy in order to kee...
99410f111f57d66c80ebf0a9a04161996179b772
thinkofher/compyther
/compythertools/funcs.py
1,907
3.765625
4
import os import sys import json def replace_word(infile, newfile, old_word, new_word): ''' Reading old file and replacing all old words with new word, then saving it in newfile. ''' if not os.path.isfile(infile): print("Error on replace_word, not a regular file: "+infile) ...
485ba81b999ae1a985f7c5bca981e4b03d14acc0
GyuriKim12/python_code
/기초프 5주차.py
2,480
3.78125
4
#세제곱근 구하기 #while문 이용하기 x=int(input('Enter an integer: ')) ans=0 while ans**3<abs(x): ans+=1 if ans**3!=abs(x): print(x,'is not a perfect cube.') else: print('Cube root of',x,'is',ans) #for문 사용하기 x=int(input('Enter an integer: ')) ans=0 for i in range(0,abs(x)+1): if ans**3>=abs(x): break if ans...
445a228b552b81ed20d0227207f3b76e661ac82a
GyuriKim12/python_code
/기초프로그래밍4주차.py
3,793
4.1875
4
#PI변수를 3.14로 초기화하고, 원의 반지름 값에 따라 원의 넓이를 출력하는 프로그램을 만드시오. #단, 입력 반지름의 0이하라면 'Wrong input!'를 출력, #원의 넓이가 50이상이면 'Very big circle!'을 출력하고, 50미만이면 'Normal circle!'을 출력하시오. PI=3.14 radius=int(input('Input an integer radius: ')) area=PI*(radius**2) if radius<0: print('Wrong input!') if area>=50: print('Very big circ...
58c6bc31951eb26afae7569a98e81c55f6ae916d
GyuriKim12/python_code
/2.py
923
4.03125
4
a = [1,2,3,['a','b','c']] print(a[1]) print(a[-1]) print(a[3][-2]) a = [1.3,2.5,3.9,4.1] a = list(map(int,a)) print(a) a = input("숫자 2개를 입력하시오: ").split() print(a) print("안녕하세요\n저는 김규리 입니다.") print("안녕하세요\r저는 김규리 입니다.") print("\"안녕하세요 저는 김규리 입니다.\"") print("\'안녕하세요 저는 김규리 입니다.\'") for i in range(5): print(i) ...
68ec633c64a86037f0d2df84dc0207abd2eac899
yskang/AlgorithmPractice
/leetCode/combination_sum.py
1,269
3.5
4
# Title: Combination Sum # Link: https://leetcode.com/problems/combination-sum/ from typing import List from collections import defaultdict, deque from bisect import bisect_left class Problem: def combination_sum(self, candidates: List[int], target: int) -> List[List[int]]: candidates = sorted(candidates)...
b0fa0b8457b8d995959070b0e7d44bcf1bc85790
yskang/AlgorithmPractice
/leetCode/array_partition_1.py
448
3.546875
4
# Title: Array Partition 1 # Link: https://leetcode.com/problems/array-partition-i/ class Solution: def array_pair_sum(self, nums: list) -> int: nums = sorted(nums) s = 0 for i in range(0, len(nums), 2): s += nums[i] return s def solution(): nums = [1,4,3,2] ...
852c759aec52aab8536a2d7f17e342a5cc949372
yskang/AlgorithmPractice
/etc/decorator.py
2,020
3.5
4
import datetime import time from functools import wraps def decorator_function(original_function): def wrapper_function(*args, **kwargs): print("Before execution of {} function".format(original_function.__name__)) return original_function(*args, **kwargs) return wrapper_function @decorator_f...
2a202d7cc3a36b95b03ffd1078febb711d277b37
yskang/AlgorithmPractice
/leetCode/lowestCommonAncestorOfABinaryTree.py
2,425
4.03125
4
import unittest # 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 __init__(self): self.found = 0 self.paths = [] self.route = [] def dfs(self, no...
6aefde1e08d94669fb1a5e854e7e180c9eaf32db
yskang/AlgorithmPractice
/leetCode/kth_largest_element_in_an_array.py
606
3.734375
4
# Title: Kth Largest Element in an Array # Link: https://leetcode.com/problems/kth-largest-element-in-an-array/ from typing import List from heapq import heappop, heappush class Problem: def find_kth_largest(self, nums: List[int], k: int) -> int: q = [] for num in nums: heappush(q, -...
76635991f595af61dc2d6394b60e8fe3c1bceec0
yskang/AlgorithmPractice
/baekjoon/python/hansoo.py
480
3.546875
4
# Hansoo # https://www.acmicpc.net/problem/1065 n = int(input()) def isArithmeticSequence(n): seq = list(map(int,list(str(n)))) if len(seq) < 3: return True a = seq.pop() b = seq.pop() baseDiff = a - b while seq: a = seq.pop() currDiff = b - a if ...
3a3bf7c7950010d73afc5f7852f07a43bf78bc76
yskang/AlgorithmPractice
/baekjoon/python/find_most_min_number_11003.py
3,707
4.03125
4
# Title: 최솟값 찾기 # Link: https://www.acmicpc.net/problem/11003 import sys import collections read_list_int = lambda: sys.stdin.readline().strip().split(' ') class Segment_Min_Tree: ''' A Class used to get partial min of an array and update data ... Attributes ---------- array...
08540545201b670db9eee331fd11499ae94116d1
yskang/AlgorithmPractice
/baekjoon/rust/effective_hacking_input_gen.py
248
3.5
4
from random import randint n = randint(1, 10) m = randint(1, 10) print(f'{n} {m}') for _ in range(m): while True: a = randint(1, n) b = randint(1, n) if a != b: print(f'{a} {b}') break
87b7511e004bfbdf8f973a07f32823051648611a
yskang/AlgorithmPractice
/leetCode/rmq.py
1,524
3.53125
4
# Python Program to implement # iterative segment tree. from sys import maxsize INT_MAX = maxsize class SegmentTreeMin: def __init__(self, a: list) -> None: self.a = a self.n = len(a) self.segtree = [0] * (2 * self.n) self.construct_segment_tree(self.a, self.n) def construct_s...
3aa3484502e0d02d4969fd25d232c66573319385
yskang/AlgorithmPractice
/leetCode/hammingWeight.py
171
3.671875
4
def hammingWeight(n): count = 0 for i in range(31): if n & 1 == 1: count += 1 n >>= 1 return count print(hammingWeight(15))
bd76fdb42ffb98f20ec4704bd953c1aaf4e1f747
yskang/AlgorithmPractice
/baekjoon/python/parentheses_9012.py
492
3.78125
4
import sys def is_valid(parentheses): while True: temp = parentheses.replace("()", "") if temp == parentheses: break parentheses = temp if temp == "": return True return False if __name__ == '__main__': T = int(sys.stdin.readline()) f...
ab3f355988ea57570a5a196e1753c49274637665
JetFuor/Vectors
/try1.py
1,271
4.125
4
# Aight so this gonna be ector code # Gonna set u some code to solve certain things # Maybe attempt a nice interface to use it so can be professional and stuff, why not # EQuatiion of a line between 2 points, 2D and 3D # Distance between 2 pointsm 2D and 3D # Shotest distance from line point import math import...
acdf23d31d4a9b008858b1a0f3c3f59dc78fe311
Leomelati/Python_Challenge
/Challenges/Challenge_3.py
1,263
3.75
4
# We can found it at the source code import requests # Get the Source Code http = requests.get("http://www.pythonchallenge.com/pc/def/equality.html") # Remove the line breaks of the text in the source code source_code = http.text.replace("\n","") # Separete the text by the comment mark textos = source_code.split("<...
033c7591aa63a34892da11c5ae3f494b9125fd94
sarvesh2019/data-engineer-sample-2020-07
/main.py
891
3.625
4
""" This is the entrypoint to the program. 'python main.py' will be executed and the expected csv file should exist in ../data/destination/ after the execution is complete. """ from src.some_storage_library import SomeStorageLibrary if __name__ == '__main__': """Entrypoint""" print('Beginning the ETL process....
815672f822537b96444ee6a450826750ce96f8fb
vickispark/pyBasics
/app2.py
240
3.625
4
from math import * mynum = -5 print(abs(mynum)) print(pow(3,2)) print(max(-2,0)) print(min(-2,-3)) print(round(22/7)) print(round(3.6)) print("use import math for below math functions") print(floor(5.3)) print(ceil(5.4)) print(sqrt(81))
7f97cb54bed0a7509d0c28e193fc8eca93661514
vickispark/pyBasics
/LinkLis2.py
1,572
4.03125
4
class Node: def __init__(self,data,nextNode=None): self.data = data self.nextNode = nextNode def getData(self): return self.data def setData(self,val): self.data = val def getNextNode(self): return self.nextNode def setNextNode(self,val): self.nextNode =...
3d668ef451e7649224094496126e3961113543d4
shan-mathi/Codeforces
/1256A - Payment Without Change.py
372
3.765625
4
#113546321 Apr/19/2021 23:18UTC+5.5 Shan_XD 1256A - Payment Without Change PyPy 3 Accepted 296 ms 6100 KB def change(a,b,n,S): x = S//n if x<=a and b>=S%n: return 'YES' elif x>a and b>=(S- a*n): return 'YES' else: return 'NO' t = int(input()) for i in range(t): a,b,n,S = ...
cda07782ec4a33fd57b6220d9abc93b909e327ce
shan-mathi/Codeforces
/1352C - K-th Not Divisible by n.py
514
4.03125
4
#110558936 Mar/20/2021 22:15UTC+5.5 Shan_XD 1352C - K-th Not Divisible by n PyPy 3 Accepted 155 ms 2900 KB # to find the nth non divisible number """ so... 3rd divisble number will have 3*n-3 you will have to divide the index by 3 take n=4 1,2,3 5,6,7 9,10,11 13,14,15 find 7th """ def not_divisible(n,id): if i...
e21fed058f6a5fc00278a2fada8d0259394c9a1c
shan-mathi/Codeforces
/1342A - Road To Zero.py
472
3.515625
4
#110292902 Mar/18/2021 13:51UTC+5.5 Shan_XD 1342A - Road To Zero PyPy 3 Accepted 93 ms 0 KB def road2zero(x,y,a,b): if x*y>=0: if b>2*a: count=(a*abs(x+y)) else: count= (b-a)*(min(abs(x),abs(y)))+ a*max(abs(x),abs(y)) else: count= (abs(x)+ abs(y))*a return co...
36cecbf318817cdff96706071962b85afa0debd9
thomwiggers/aarchimate
/aarchimate.py
12,247
3.5625
4
""" Defines the instructions and macros for the program """ from typing import Dict, List, Set, Optional, Iterable import re write = print vector_regex = re.compile(r'^q(?P<id>\d+)$') def vector_to_typed_vector(name: str, type: str='8b') -> str: m = vector_regex.match(name) if not m: raise ValueErr...
decf70c434800006892e1c70494b51f7f8aea850
Precel2000/medium_python_projects
/roller_coaster.py
6,701
3.875
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt # load rankings data wood_winners = pd.read_csv('Golden_Ticket_Award_Winners_Wood.csv') steel_winners = pd.read_csv('Golden_Ticket_Award_Winners_Steel.csv') # function to plot rankings over time for 1 roller coaster def rank_history(name, park): ...
5b0c9bad5cf6206f43eff46694ae894b33e792a7
TheReverseWasp/Compiladores_Lab-2020-2
/Practica 9/Ejercicios/main.py
471
3.59375
4
from Interprete import * def main(): gram = Gram() TAS = TASMaestra(gram, analizadorLexico) TAS.crearTabla() TAS.imprimirTAS() interprete = Interprete(TAS) print("------------------------Analizador de Lineas---------------------") while True: linea = input("Ingrese la linea a analiz...
fd59eda3902fc18d017c7b24958f6ece8afef706
trzyha/coding-decoding
/coded-decoded.py
566
3.859375
4
#simple coding decoding program sentence = input ("Input your text: ") codedSentence = [] uncodedSentence = [] for x in range (0,len(sentence)): #print (sentence[x]) senToInt = ord(sentence[x])+3 #print (senToInt) senIntToChar = chr(senToInt) #print (senIntToChar) codedSentence.append(senIntToChar...
075599e8dcb21fdf56945ef6543e028cea3e088c
sowmy13/week5IS
/sum.py
436
3.875
4
# sum of two numbers import sys #arguments live in sys.argv #sys.argv =["sum.py", 3,5] if len(sys.argv) != 3: print("Usage: python" + sys.argv[0] + " <first number><second number>") sys.exit() first = int(sys.argv[1]) second= int(sys.argv[2]) print("{0} and {1}".format(first, second)) #result = first+s...
1300534e99ffe4d84914713dd9c3a03261633408
dingan005/STRING-COMPRESSION
/Strng Comprsn.py
704
3.765625
4
"""str""" def check(): """str""" str_val = input("Enter a String") chara = str_val[0] result = " " count = 0 str_len = len(str_val) str_val = str_val + " " for i in str_val: if i == chara: count += 1 else: if count == 1: ...
39a7b89d5313d508a090f858d1e917e72fbb639b
shinhash/MyFirstPythonProject
/day02/MyOOP02.py
611
3.6875
4
class Animal(object): def __init__(self): self.age = 1 def getOrder(self): self.age += 1 class Human(Animal): def __init__(self): # Animal.__init__(self) super().__init__() self.name = "이재용" d...
d79de740c32b16f0fecd779ee3d36e024a9b0b37
dheeraj-singhal/Summer-Internship
/Task 04/Task 4.1.py
813
3.796875
4
# Task 4.1 # Create image by yourself using python code import numpy as np import cv2 # Creating a image of size 400 X 400 pixels photo = np.zeros((400,400,3)) photo[0:100,0:100]=[44,165,255] photo[0:100,100:200]=[255,0,0] photo[0:100,200:300]=[0,0,255] photo[0:100,300:400]=[0,255,0] photo[100:200,0:1...
600fe9bbd690bd90aeda2c5d1a4fd3171ab57480
werellel/Algorithm
/hackerrank/dictionaries_and_hashmaps/sherlock_and_anagrams.py
868
3.78125
4
#!/bin/python3 import math import os import random import re import sys from collections import defaultdict from math import factorial # Complete the sherlockAndAnagrams function below. def sherlockAndAnagrams(s): a_z_dic = defaultdict(int) for index, word in enumerate(s): for index2, word2 in enumera...
433be370b3adf1021487550ac4f34ffafdc33f28
MontMonrency/Python
/Python/GuessWord/main.py
1,359
3.5
4
import random import re def loadWords(): return open('english-nouns.txt','r').readlines() def hideWord(word): for chr in word: word = word.replace(chr, '*') return word def replaceHiddenChar(myguess, hidden_word, myword): indexes = [x.start() for x in re.finditer(myguess,myword)] for ind ...
b78a49476161f67e0724f879eda24f6654cce077
MobiDevOS/PythonBasic
/gui/FirstGui.py
850
3.546875
4
#!/usr/bin/env python3 # -*- coding: UTF-8 -*- import tkinter as hello import tkinter.messagebox #这个是消息框,对话框的关键 def but(): tkinter.messagebox.showinfo('提示', '人生苦短,及时python') root=tkinter.Tk() root.title('GUI')#标题 root.geometry('800x600')#窗体大小 root.resizable(False, False)#固定窗体 tkinter.Button(r...
8fb3abbb6eff1b9538dbf034d3d461fad4acb898
MobiDevOS/PythonBasic
/List.py
2,558
3.71875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- # 集合生成器 注意关键字yield #生成器是可以迭代的,但是你 只可以读取它一次 ,因为它并不把所有的值放在内存中,它是实时地生成数据 #生成器类似于返回值为数组的一个函数,这个函数可以接受参数,可以被调用, # 但是,不同于一般的函数会一次性返回包括了所有数值的数组,生成器一次只能产生一个值, # 这样消耗的内存数量将大大减小,而且允许调用函数可以很快的处理前几个返回值,因此生成器看起来像是一个函数,但是表现得却像是迭代器 if __name__=='__main__': list1 = list(range(1,30))...
e0f63a84b6714065db6b53d24d18e784ddcb150e
DcortezMeleth/go_projekt
/algorithms.py
8,293
3.59375
4
# -*- coding: UTF-8 -*- import math import graphics import numpy as np import structures as struct __author__ = 'Bartosz' # metoda licząca kąt pomiędzy punktami def get_degree(base, target): angle = math.degrees(math.atan2(target.y - base.y, target.x - base.x)) if angle < 0: angle += 360 return a...
b15137fc53db26e8ddc5b02af32720fc393d1683
PulkitNijhawan/python
/ques9.py
421
3.8125
4
from datetime import date def solve(from_date,to_date,diff): fromTemp=from_date.split('-') toTemp=to_date.split('-') fromDate=date(2000+int(fromTemp[0]),int(fromTemp[1]),int(fromTemp[2])) toDate=date(2000+int(toTemp[0]),int(toTemp[1]),int(toTemp[2])) difference=toDate-fromDate return (difference...
291f1464a14e9de7d3b34e51d7a61b2273704e9b
subhan/python-code
/num2word.py
2,213
3.578125
4
w1 = { '0':'Zero','1':'One','2':'Two','3':'Three','4':'Four','5':'Five','6':'Six','7':'Seven','8':'Eight','9':'Nine','10':'Ten','11':'Eleven','12':'Twelve','13':'Thirteen','14':'Fourteen','15':'Fifteen','16':'Sixteen','17':'Seventeen','18':'Eighteen','19':'Ninteen' } w2 = { '0':'','1':'Ten','2':'Twenty','3':'Thi...
67c14f9b85a6fc763604cad2949acf2dbcbbab72
alexanderbooth/Prattle_Interns
/Performance_Metric_Functions.py
5,587
3.609375
4
# coding: utf-8 # In[2]: import dateutil.parser import json import matplotlib.pyplot as plt import numpy import pandas as pd import pandas.io.data import requests import datetime import math import operator import scipy import requests import calendar import statsmodels.api as sm # In[3]: #NEEDS COMMENTS FROM AL...
95040799ce0b67d2179c337c829c9b7a578be70a
elijahdaniel/Data-Structures
/guided_project/bigOnotation.py
2,091
3.921875
4
# tim's notes def find_name(name, phone_book): a = 2 b = 10**a c = 3 + 4 for person in phone_book: if name == person: return True name = 'kim' phone_book = ['tim', 'dan', 'oliver', 'kim'] O(1 + 1 + 4) # sean chen O(1) # same thing as 0(c) # number of operations does not scale...
d18665dc4202880a47b4abd6a3550dd59897b118
meng-z/hackerrank_interview_preparation_kit
/statistics_and_machine_learning/stock_predictions_v1.py
2,273
3.734375
4
import numpy as np ''' Since there is a delay in SMA, when WMA > SMA, price is going up; when WMA < SMA, price is going down. According to this, the transaction strategy is as follows. 1. Sell all stocks we have for the one with the most significant growth in price 2. Buy stocks as many as possible for the one with t...
ade2757350083f6f3ccec276dcc563755a48b866
meng-z/hackerrank_interview_preparation_kit
/statistics_and_machine_learning/forecasting_passenger_traffic_v2.py
1,161
3.609375
4
# Enter your code here. Read input from STDIN. Print output to STDOUT import numpy as np import pandas as pd from sklearn.linear_model import LinearRegression # 1.76 def train_model_v0(data): train = np.array(data) lm = LinearRegression() lm.fit(train[:, 0].reshape(-1, 1), train[:, 1]) return lm def p...
f6487c2b3a4c1f26c109d0774fb45305f4868438
juliagarbuz/walker-simulation
/mainProgram.py
4,599
3.71875
4
''' Created: April 17th, 2017 Author: Julia Garbuz ''' from LinkedList import Node from LinkedList import NodeList from AdjacencyList import Edge from AdjacencyList import Graph from WalkerObject import RandomWalker import random def constructFromInput(): # FOR LATER: More robust input handling (catching invalid i...
417f5a102bd243f3cee18da19cadcc95df6ea309
HugoAndres/TeoriaComputacional
/Practica1/28.py
257
3.953125
4
#28. Escriba un programa de Python para formatear un n�mero con formato de porcentaje. numero =1/3 if numero>1: fraccion=numero/100 print(numero) print ("{:.0%}".format(fraccion)) else: print(numero) print ("{:.0%}".format(numero))
8cf42f8392060a2cfc12e275df796368db83b64c
HugoAndres/TeoriaComputacional
/Practica1/22.py
153
3.546875
4
#22. Escriba un programa Python para imprimir números flotantes hasta 2 decimales. numero = 2.2334432 respuesta = "%.2f"%(numero) print (respuesta)
6d8098808e1a78705002e4cd75f8d2873f0fea10
HugoAndres/TeoriaComputacional
/Practica1/21.py
274
3.796875
4
#21. Escriba un programa Python para agregar un prefijo a todas las l�neas de una cadena multil�nea. prefijo = "sobre" texto = "En un lugar de la Mancha, de cuyo nombre no quiero acordarme"\ listaPalabras = texto.split() for w in listaPalabras: print(prefijo+w)
1582940d79a23d5804c3e05aff8bb2037598b202
HugoAndres/TeoriaComputacional
/Practica1/33.py
505
3.921875
4
#33. Escriba un programa de Python para quitar un conjunto de caracteres de una cadena. #Ejemplo: #quitar_caracteres("institucional","aeiou") -> 'nsttcnl' def elimina_caracteres(cadena,caracter): s_sin_vocales = "" for letra in cadena: if letra not in caracter: s_sin_vocales += letra p...
585285c7a1333987ab8f184783d8a69dda58ba37
visalboyloy/python-final-SQ1
/main_teacher.py
1,869
3.859375
4
from classes.Teacher import * def menu(): try: list = [] while True: print("==========") print("1. Add") print("2. Show") print("3. Remove By Id") print("0. Exit") choice = int(input("Choose between 0 and 3= ")) prin...
30e336b6a360e862168c533bb7bc5c7320b9eb66
nlohmann/www.informatik.uni-rostock.de
/files/loi/loesungen/durchschnitt.py
1,279
3.65625
4
person = [] al = [] min_list=[] #print(person) #print(al) ''' try: g = float(input("Eingabe der Größe in m: ")) except: g = 0 else: while (g>0): try: m = float(input("Eingabe der Masse in kg: ")) except: g = 0 else: person = [g,m] ...
dd921fa76b31d2abd3e72b611a9de8e8036ac22d
E-Murajda/Games
/snake.py
3,353
3.671875
4
import pygame import time import random pygame.init() # colors white = (255, 255, 255) black = (0, 0, 0) red = (255, 0, 0) green = (0, 255, 0) # screen size dis_width = 600 dis_height = 400 display = pygame.display.set_mode((dis_width, dis_height)) pygame.display.set_caption('Python Snake') clock = pygame.time.Cl...
55e68fa349acd7804e611697204856c6c16b44d3
jackwotherspoon/Nosy-Neighbour
/getData.py
2,642
3.546875
4
# file that web scrapes pages to extract data and then properly formats it to a CSV file import requests from bs4 import BeautifulSoup import pandas as pd import sys # function to scrape web page for listing details and return dictionary def scrape(url, tag, classDescription): page = requests.get(url, timeout = 5...
9460aa39c829c8a1012ec8250976576ed81307fd
Yona-Dav/DI_Bootcamp
/Week_4/Day3/Exercise_XP_NINJA/exercises.py
1,336
4.09375
4
# Exercise 1: List Of Integers - Randoms import random from random import randint # for 10 integers # for i in range(10): # value = randint(-100, 100) # print(value) # For random positive integer numbers = [] for i in range(randint(50,100)): value = randint(-100, 100) numbers.append(value) print(numbers) print(l...
5d02af1572a032dd0c9f58414996f1d2dc77f85c
Yona-Dav/DI_Bootcamp
/Week_5/Day2/Exercise_XP_GOLD/exercises.py
4,342
4.09375
4
# Exercise 1: Bank Account class BankAccount: def __init__(self,username, password, balance, authenticated=False): self.balance = balance self.username = username self.password = password self.authentification = authenticated def authenticated(self, username, password): ...
488ea5ca3c0f82a271d967d8f5ae637c00419f6c
Yona-Dav/DI_Bootcamp
/Week_5/Day1/Exercise_XP_GOLD/menu_manager.py
1,837
3.875
4
class MenuManager: def __init__(self, menu): self.menu = menu def add_item(self, name, price, spice, gluten): new_items = { 'name': name, 'price': price, 'spice level':spice, 'gluten': gluten } self.menu.append(new_items) return self.menu ...
73c9e14c50742f1dafdb1c48e24104ab0ad03a1c
Yona-Dav/DI_Bootcamp
/Week_4/Day3/Exercise_XP_NINJA/timed_challenge1.py
425
3.90625
4
# Perfect Number # A perfect number is a positive integer that is equal to the sum of its divisors. # However, the number itself is not included in the sum. number = int(input('Enter a number')) sum_divisors = 0 list_divisors = [] for i in range(1,number): if number%i==0: sum_divisors += i list_di...
55303babfb0025c493316fc699867311a712058e
Yona-Dav/DI_Bootcamp
/Week_5/Day3/Exercise_XP/exercices2.py
1,928
3.6875
4
# Exercise 1 import datetime def date_of_today(): return datetime.date.today() print(date_of_today()) # Exercise 2 def amount_time(): jan = datetime.datetime(2022,1,1) actual_datetime = datetime.datetime.now() time_left = jan - actual_datetime return f'the 1st of January is in {time_left}hours' ...
1dda33c3459bc363d78e5fc3d75939a5cb74f5c4
Yona-Dav/DI_Bootcamp
/Week_4/Day1/Exercise_XP_NINJA/exercise_XP_NINJA.py
1,480
4.125
4
# Exercise 3 : Outputs # Predict the output of the following code snippets: # >>> 3 <= 3 < 9 true # >>> 3 == 3 == 3 true # >>> bool(0) false # >>> bool(5 == "5") false # >>> bool(4 == 4) == bool("4" == "4") true # >>> bool(bool(None)) false # x = (1 == True) # y = (1 == False) # a = True + 4 ...
f5d006e06acb71b91ccac716f03d601892fd12e9
andres2233/varios-proyectos
/python 2/porgramacionrio...2.py
1,800
3.96875
4
#programaciion orientada a objetos class Restaurant: # esta es la clase def __init__(self, nombre): #contructor. con el cual se puede evitar utilizar lo de lapractica de programacionoreintadaaobjetos.py self.nombre= nombre def mostra_informacion(self): print(f'nombre: {self.nombre}') #in...
18bc64fd7a553784334c207becbefedf47a5e53a
andres2233/varios-proyectos
/python 2/encaosulamiento.py
2,135
4.1875
4
class Restaurant: # esta es la clase def __init__(self, nombre, categoria, precio): #contructor self.nombre= nombre self.categoria = categoria self._precio = precio def mostra_informacion(self): print(f'nombre: {self.nombre}, categoria:{self.categoria }, precio:{sel...
3618dbb55dce0b00e8b8c60f2bc9efae1b58a71f
andres2233/varios-proyectos
/python 2/proyecto_parte2.py
2,731
3.65625
4
# vamos a hacer un cambio para en caso que queramos crear dos contactos con el mismo nombre import os CARPETA = 'contactos/' EXTENSION = '.txt' #contactos class Contacto: def __init__(self, nombre, telefono, categoria): self.nombre = nombre self.telefono = telefono self.categoria = cate...
a17224334a2a8c699255446856ee622303038398
jwech/Notes_on_Python
/data_structure/my_sequenct.py
1,555
3.8125
4
''' Unpack sequence values to multiple variables''' # Unpack directly to multiple variables p = (4, 5) x, y = p print(x) print(y) data = ['ACME', 50, 91.1, (2012, 12, 21)] name, shares, price, date = data print(name) print(shares) print(price) print(date) s = 'Hello' a, b, c, d, e = s print(a) print(b) print(c) # U...
3614bec6594a9388ac0cc903594b7feaabf60b8c
clevercoderjoy/Competitive-Coding
/GFG_Kth_smallest_element.py
264
3.609375
4
def kSmallest(arr, size, k): if size == 0: return None elif size == 1: return arr[0] arr.sort() return arr[k - 1] size = int(input()) arr = [int(x) for x in input().split()] [ : size] k = int(input()) print(kSmallest(arr, size, k))
298e596c13b87096aa69f186b33ec65828ec0529
clevercoderjoy/Competitive-Coding
/DSA_Sheet.py
3,672
3.90625
4
# 1=> # # Ref link: https://www.youtube.com/watch?v=0DnG0Kc9M2E # def diagonal_matrix_traversal(mat, rows, cols): # if not mat or not mat[0]: # return [] # diagonals = [[] for i in range(rows + cols - 1)] # for i in range(rows): # for j in range(cols): # diagonals[i + j].append...