blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
67eab77a5402b9e63b8c292d015d002283cc3f67
takamuio/DesafiosAulaYoutube
/venv/teste68.py
1,165
3.75
4
from random import randint from time import sleep print('=== Par ou Impar ===') diferenca = 0 vitorias = 0 while True: parimpar = ' ' while parimpar not in 'PpIi': parimpar = str(input('Par ou Impar [P/I] ? ')).upper().strip()[0] escolha = int(input('Numero de 1 a 3: ')) escolha_pc = ra...
fa8e8f880f3fb8c5e5237582eac6f5d259be7836
billykeyss/CodingQustions
/Strings/NonRepeating.py
769
3.8125
4
# Find the first word in a stream in which it is not repeated in the rest of the stream. # Please note that you are being provided a stream as a source for the characters. # The stream is guaranteed to eventually terminate (i.e. return false from a call to the hasNext() method), though it could be very long. # You will...
af99db254ba5b5b51fb949b53199ef15827b5bdd
aishwarya-mocherla/td_srm
/beginner.py
670
3.84375
4
from random import randint number = input("please type 'roll' to roll the dies: ") while number == "roll": no = randint(1,6) if no == 1: print("| |") print("| o |") print("| |") if no == 2: print("| o |") print("| |") print("| o |") if no == 3: print...
0f170dccaaa53d1db2f24103141ddb860f5d7803
Raj-Yadav/MITx-6.00.1x-Introduction-to-Computer-Science-and-Programming-Using-Python
/Final_Exam/Problem_3.py
1,067
4.4375
4
"""McDonald’s sells Chicken McNuggets in packages of 6, 9 or 20 McNuggets. Thus, it is possible, for example, to buy exactly 15 McNuggets (with one package of 6 and a second package of 9), but it is not possible to buy exactly 16 McNuggets, since no non- negative integer combination of 6's, 9's and 20's add up to 16. T...
3d1e63a67ad7986dd7e4be78e7c83f2f18af401a
SharanyaMarathe/Birthday_Reminder
/Birthday_reminder_test.py
957
4.1875
4
import datetime def Current_Date(): Today=datetime.date.today() #To get current date and day Today_day=Today.strftime("%A") return Today,Today_day def Birthday(date): date_l=date.split("-") d1=datetime.date(int(2020),int(date_l[1]),int(date_l[0])) p= "On "+d1.strftime("%A") +", "+date_l[0]+"t...
96b969b49f1719d7e4317fd918fe302b37deb471
fizgi/GEDCOM-tag-checker
/app.py
1,793
3.609375
4
""" A script to check the validity of a .ged file data. author: Fatih IZGI date: 09-Sep-2020 python: v3.8.4 """ from typing import List, Iterator SUPPORTED_TAGS: List[str] = ['0 INDI', '1 NAME', '1 SEX', '1 BIRT', '1 DEAT', '1 FAMC', '1 FAMS', '1 FAM', '1 MARR', '1 HUSB', '1 ...
ea2d9d08a62f93ccb2b2641692de627d5e6963e4
JoseManuelMS97/SistemasGestionEmpresarial
/Python/Practica6/Avanzados/Ejercicio2.py
2,412
4.1875
4
class Empleado: def __init__(self, nombre="", edad=0, salario=0.0): self.nombre = nombre self.edad = edad self.salario = salario def __str__(self): return f"Nombre: {self.nombre} \nEdad: {self.edad} \nSalario: {self.salario}" def clas_segun_edad(self): if ...
b968d69208437826d93b472585a0e5811c63db01
Mapleleaff/Sword-refers-to-offer
/题32.2-分行从上到下打印二叉树.py
1,202
3.703125
4
""" 题32.2-分行从上到下打印二叉树 从上到下按层打印二叉树,同一层的节点按从左到右的顺序打印, 每一层打印到一行 """ class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def levelOrder(self, root): if root==None: return root result=[] queue = [root] ...
02357a5b3b3fddd0f6e257eff29b7ed24d7e4fc8
balmydawn/-
/Base/Day04/Exercises/习题10.py
978
3.640625
4
# 习题4 中增加一个功能 # 要求统计输入的字符串中不同字符的个数,使用字典存储,并打印出来 # 完成字符串的长度统计以及逆序打印 # * 设计一个程序,要求只能输入长度低于31的字符串,否则提示用户重新输入 # * 打印出字符串长度 # * 使用切片逆序打印出字符串 while True: num_dict = {} #输入字符串 str = input('请输入字符串:') #判断长度 long = len(str) if long < 31: print('字符串长度为:%d' % long) #打印长度 str = str[::...
5639ee520bf9004e66bdb69c88dced8e160d3dcf
hatssww/hatssww_Python
/palindrome.py
344
4.03125
4
def is_palindrome(word): word_list = list(word) for i in range(len(word) // 2): if word_list[i] != word_list[-1 - i]: return False return True # 테스트 print(is_palindrome("racecar")) print(is_palindrome("stars")) print(is_palindrome("토마토")) print(is_palindrome("kayak")) print(is_palindro...
eacd0425800af155484a9b0f1a7b02bf919f4c86
priyamvadajha123/remote_git_intro
/add.py
169
4.125
4
print("program of addition for two numbers x and y:") x=int(input("enter the integer x")) y=int(input("enter the integer y")) c=x+y print(f"addition of x and y is {c}")
38fe722259bd28573733d0500c369176a2c5361e
iMonkey0222/School-Projects
/Cloud Computing/A1-MapReduce_Python/task2/task2_count_sort_reducer.py
903
3.96875
4
#!/usr/bin/python3 import sys def sort_reducer(): """ This reducer sort top 50 locality in descending order Input data format: locality_name1 \t count_sum locality_name2 \t count_sum Output data format:locality_name_top_1 \t count_sum ... locality_name_top_50 \t count_sum """ # create...
43e809c48660086a8f499c07bcdeb1ddb6801328
iisdd/Courses
/Data structures&Algorithms/17.查找排序习题3.py
409
3.765625
4
''' 给定一个列表和一个整数,设计算法找到两个数的下标,使得两个数之和为给定的整数。保证结果唯一 ''' def find_idx(li, target): dct = {} for idx, val in enumerate(li): dct[val] = idx for key in dct: if target - key in dct: return [dct[key], dct[target-key]] li = [1,2,5,4] target = 3 print(find_idx(li, target)...
6ba39d649262bb73843fe4233c3cc66f0dde0f6f
ubco-mds-2020-labs/data-533-lab-3-Conrad-Yeung
/Bank/accounts/.ipynb_checkpoints/account-checkpoint.py
6,225
3.984375
4
from datetime import datetime from random import randint import matplotlib.pyplot as plt import matplotlib.ticker as ticker import numpy as np class Account: ''' Contains base account class and methods Attributes: ----------- name : str the name of the account hold...
3e96a8fb0d3a7e67c39581afe6323b58f06ca6ae
Kshitijdata/TSF-GRIP
/Untitled10.py
2,647
3.71875
4
#!/usr/bin/env python # coding: utf-8 # In[1]: import pandas as pd import numpy as np import matplotlib.pyplot as plt import seaborn as sns # In[ ]: # In[ ]: # In[2]: data = pd.read_csv('http://bit.ly/w-data') print('Shape of the dataset is: ', data.shape) data.head() # In[3]: # Checking for any ...
a0805ee05b15817b4a8c88dd1fbfb1248f15fe45
chenlu233/SCAPE
/SCAPE Code/scape generating/src/rotation2twist.py
716
3.71875
4
#The function that translates rotation matrix into twist, from Ma Yi An invitation to 3D Vision import numpy as np import math ''' Input: 3 * 3 Rotation Matrix Output: 3 * 1 Twist vector ''' def rotation2twist(matrix_m): mid_theta = (np.trace(matrix_m) - 1) / 2 theta = math.acos(mid_theta) t = np.array([...
2d02e033b7a983c3a25298dd2e31ea102f143b66
xgz59421/notes-python
/test/test5_def.py
693
3.859375
4
# 创建 getLeepYears(start, end), 返回数组, 包含的闰年 def getLeepYears(start=2000, end=2050): years = [] for year in range(start, end+1): result = (year%400==0) or ((year%4==0)and(year%100!=0)) if result: years.append(year) return years leepYeas = getLeepYears(2000,2020) print(leepYeas) leepYeas = getLeepYea...
6e049ff6ed67090890a806861840b36682881296
irskep/clubsandwich
/clubsandwich/tilemap.py
3,597
3.625
4
""" Tilemap data structures for 2D grids """ from .geom import Point, Rect class CellOutOfBoundsError(Exception): """You have tried to access a cell at a coordinates outside of the tilemap""" pass class Cell: """ One cell at a point in 2D space. You'll probably want to subclass this to add your ...
53eaee4dc32223b4ae0e019045a221511c1fc691
Khepanha/Python_Bootcamp
/week02/ex/e30_list_sort_int.py
297
3.671875
4
def list_sort_int (L): A = [] B = [] for x in (L): try: A.append (int(x)) except Exception: A.append (x) for x in (A): if type(x) == type(1): B.append(x) B.sort() return B print (list_sort_int ([]))
17cece839ab8b9a6bab1f1aa6a3d17a182cf7e35
victor29/prueba1
/muy_basico.py
513
4.21875
4
# -*- coding: UTF-8 -*- #Cosas simples en python - 1 #Operaciones basicas print (0+1) print (1 + 1) print (3 * 1) print (8 / 2) print (((2 * 5) + 40 / 4) / 4) print (13 / 2) #Division entera print (13 // 2) #modulo print ("modulo " + str(21 % 5)) #potencia print ("potencia " + str(5 ** 2)) #Tres lineas de ...
7b3b16e4ca17e4d9fa872940d91118fe0b8a2969
junyechen/Basic-level
/1024 科学计数法.py
1,685
3.53125
4
#科学计数法是科学家用来表示很大或很小的数字的一种方便的方法,其满足正则表达式 [+-][1-9].[0-9]+E[+-][0-9]+,即数字的整数部分只有 1 位,小数部分至少有 1 位,该数字及其指数部分的正负号即使对正数也必定明确给出。 #现以科学计数法的格式给出实数 A,请编写程序按普通数字表示法输出 A,并保证所有有效位都被保留。 #输入格式: #每个输入包含 1 个测试用例,即一个以科学计数法表示的实数 A。该数字的存储长度不超过 9999 字节,且其指数的绝对值不超过 9999。 #输出格式: #对每个测试用例,在一行中按普通数字表示法输出 A,并保证所有有效位都被保留,包括末尾的 0。 #输入样例 1: #+...
3d7e51d06889254a666494d75f586486f4778d7d
APotatoBoy/Leetcode
/167_twoSum.py
1,127
3.90625
4
# encoding = utf-8 class Solution: def twoSum(self, numbers, target): """ find two numbers such that they add up to a specific target number :param numbers: List[int] :param target: int :return: List[int] """ length = len(numbers) if length...
10d64f09d8808d45f51e3cf4b343a3a1a6d87ab3
EngMarianaBrito/logica_de_programacao_python
/estrutura_sequencial/exercicio5.py
126
3.75
4
metro = float(input("Informe o valor do metro: ")) centimetro = metro * 100 print(f"o Valor em centimetros é {centimetro}")
1f1c47fc9e844ab67bb248502b1d7e532bf10f31
pkaran57/Tutorials
/Python/fucntions and generators/functions.py
3,153
4.25
4
""" The def statement creates a function object and assigns it to a name Below, function object is created and name "twice" is assigned to it the return statement consists of an optional object value expression that gives the function’s result. If the value is omitted, return sends back a None. """ def twice(a): ...
7b73be412985cb0fa75585063e7581e3f0de024a
MKotlik/UGE
/v0.3.0/oldParser.py
7,387
3.796875
4
from display import * from matrix import * from draw import * from transformOps import * import matrixOps import time # TODO: Update the command list """ Goes through the file named filename and performs all of the actions listed in that file. The file follows the following format: Every command is a single char...
7204f8e1dd0ddc1454d802744242a678f0a96d44
Tunchiie/HackUMBC2021
/exercise.py
1,758
3.578125
4
import sqlite3 conn = sqlite3.connect('exercises.db') cursor = conn.cursor() cursor.execute('CREATE TABLE IF NOT EXISTS exercises (name text PRIMARY KEY, sets integer NOT NULL, reps integer NOT NULL, working_group text NOT NULL)') class Exercise(): def __init__(self, name, set, reps, group): self.na...
f5c81f1207fc0c8790d8b562a572853f7f667b7c
nguyenducanhhahaha/code
/part1/code3_intro.py
72
3.5625
4
Number = int(input("Nhập số bất kì: ")) H = Number ** 2 print(H)
798fe921f4afbbd56c7ddfecdf7c249100bb4a72
yukiyanai/algorithms
/algorithms-Python/hash_search.py
692
3.90625
4
given_list = input("Please enter the list of numbers: " ) n = len(given_list) target = raw_input("Please enter the number you're looking for: ") target = int(target) ## Store the data into a new list using a hash function hash_list = ["NA"] * (n*2) i = 0 for num in given_list: k = num % (n*2) if hash_list[k] ...
7422a979fa3b46878f7bcc9708f90a3344600db5
RSUBRAMANIAN1/data-structure
/code/trees/subu.py
1,037
4
4
class Node: def __init__(self, data): # _init_ -> __init__ self.data = data self.next = None class LinkedList: def __init__(self): # _init_ -> __init__ self.head = None def insertafternode(self, val): temp = self.head while(temp.data != val): temp =...
f833619f35c8cdbf5e0261ef69863cefe31152d7
zz790609619/wechatProject
/test.py
149
3.625
4
import random for i in range(0, 6): print('红'+str(random.randint(1, 33))) for i in range(0, 1): print('蓝'+str(random.randint(1, 16)))
50c21a0b4067bee2d1d4cf4b2302ef3e4c611c79
mahtab04/Python
/100 Programs/q1.py
336
3.9375
4
# Write a program which will find all such numbers which are divisible by 7 but are not a multiple of 5, # between 100 and 500 (both included). # The numbers obtained should be printed in a comma-separated sequence on a single line. l = [] for i in range(0,501): if i%7==0 and i%5!=0: l.append(str(i)) print...
ca431903f14d0fac4c12ed575279f8c903b68435
byukdor/BaekJoon_Algo
/1547.py
284
3.921875
4
start = [1,2,3] def swap(list_, first, second): list_[first], list_[second] = list_[second], list_[first] return(list_) for i in range(int(input())): first, second = list(map(int,input().split())) swap(start, start.index(first), start.index(second)) print(start[0])
4c1f1a72cec8479f2260b252249a348fdbc302cc
rishavsharma47/ENC2020P1
/Session7D.py
277
3.765625
4
""" In Dictionary we have indexes replaced with keys keys can be of our choice and they must be always string """ student = { "rollNum": 101, "name": "John", "email": "john@example.com" } print(student) print(type(student))
57176e31aa45affc3467d4be3dcce4f0896e9938
AYehia0/codingame
/compete/fastest/reverse_str_cap.py
399
3.53125
4
""" Something easy shit? tihs ysae Gnihtemos? """ sentence = input() # print(sentence[:len(sentence)-1:][::-1].title()+sentence[-1]) # print(''.join(reversed(sentence[:len(sentence)]))) ans = [] for i in sentence[:len(sentence)-1].split(): if i.capitalize() == i: ans.append(i[::-1].capitalize()) el...
2f389417a257be28a3ba9310e2f68a45f8d36684
rchirag101/PythonPracticals
/p3.py
546
3.921875
4
import datetime # functions scoping def getDate(): dt = datetime.datetime.now().date() def printDate(): print("Today's date: " + str(dt)) printDate() getDate() # Recursion def factorial(n): if n == 1: return 1 else: return n * (factorial(n - 1)) print("Factorial of 5 :",...
bfb282df7509f6b9b52608cb6a67dc9dc333e31b
instaboy007/SEM-4
/Python Programming Lab/WS3/WS3_3.py
403
4.0625
4
def equalChunks(inputlist): for i in range(0, len(inputlist), 3): yield inputlist[i:i + 3] inputlist=[] n=int(input('ENTER THE SIZE OF THE LIST :')) for i in range(n): inputlist.append(input(f'ENTER THE {i+1} ELEMENT OF THE LIST :')) if len(inputlist)==0: print("List Empty!") else: ...
ac56167147730025999659cd0cfa9e17bf066064
UX404/Leetcode-Exercises
/#551 Student Attendance Record I.py
899
3.984375
4
''' You are given a string representing an attendance record for a student. The record only contains the following three characters: 'A' : Absent. 'L' : Late. 'P' : Present. A student could be rewarded if his attendance record doesn't contain more than one 'A' (absent) or more than two continuous 'L' (late). You need ...
a44bd1b5b392c2130062d4c7a2b7fd189c1e7788
venkatesh799/DataStructures-Algorithms
/LeetCode/58. Length of Last Word.py
677
3.765625
4
''' Given a string s consists of upper/lower-case alphabets and empty space characters ' ', return the length of last word in the string. If the last word does not exist, return 0. Note: A word is defined as a character sequence consists of non-space characters only. Example: Input: "Hello World" Output: 5 ''' clas...
27bae07a57a5835a405112228f36f7a5b7a5adf1
Sinha-Ujjawal/LeetCode-Solutions
/StudyPlans/Data Structures/Data Structures 1/queue_using_stack.py
906
3.671875
4
from typing import Optional class MyQueue: def __init__(self): self._left = [] self._right = [] def _rebalance(self): right = self._right take = max(len(right) >> 1, 1) self._left = right[:take][::-1] self._right = right[take:] def push(self, x: int) -> No...
cf69671ef68bebf78e5fcc5c40fc18801102bc79
Jagadish2019/The_Valley_Boot_Camp
/3Mar19/ex5.py
726
4.09375
4
#import math #print(math.sqrt(9)) #x1 = int(input("enter x1 value:\t")) #x2 = int(input("enter x2 value:\t")) #y1 = int(input("enter y1 value:\t")) #y2 = int(input("enter y2 value:\t")) #a = math.sqrt((x2-x1)**2 + (y2-y1)**2) #print(a) import math #print(math.sqrt(9)) def calc(x1,x2,y1,y2): a= math.sqr...
c3f0802bcc99753c137045fd1d59840c60c52610
wooseokoh/python
/python10/functionArray/varTest03.py
283
3.5
4
def value(*parameter): print(len(parameter)) print("전달받은 데이터 개수 :", len(parameter)) for x in parameter: print(x, end = " ") print() if __name__ == '__main__': value(1,2,3,4,5) value(123) value(1,2,34,5)
97f5518dc7f4b9852a7376994ebb93e6df6ba9cc
nascarsayan/lintcode
/760.py
734
3.890625
4
from collections import defaultdict """ Definition of TreeNode: class TreeNode: def __init__(self, val): self.val = val self.left, self.right = None, None """ class Solution: """ @param root: the root of the given tree @return: the values of the nodes you can see ordered from top to bott...
3976115a0656513b5c027d7e753f417a547215c8
emmas0507/lintcode
/spiral_array.py
455
3.78125
4
def spiral_array(n): if n == 1: return [[1]] if n == 2: return [[1,2], [4,3]] else: add_on = (n-1) * 4 mat = spiral_array(n-2) new_mat = [range(1,n+1)] for i in range(len(mat)): new_m_ = [mm_ + add_on for mm_ in mat[i]] new_mat = new_m...
6103e22d8184d69f5c3c0cfecd7ba76dd39fa9e8
Nockternal/Burger
/intro to programming/Completed Tasks/Task 5/Strings.py
214
3.6875
4
string = "Super Man" stringupper = string.upper() split_string = stringupper.split() new_string_1 = ("^".join(split_string[0])) new_string_2 = ("^".join(split_string[1])) print(new_string_1, new_string_2)
54cc85902989b54e3f99f0f4cdde012d4cb72b43
gabrielrtlima/jokenpo-python
/game.py
1,882
3.546875
4
from random import choice print('-'*70+'\nBem vindo ao PEDRA, PAPEL E TESOURA (.py)\n'+'-'*70) while True: start = input('\nDigite 1 se deseja iniciar o jogo\nDigite 2 se deseja saber como funciona\nDigite 3 para saber mais informacoes sobre o desenvolvedor\n') if start == '1': gameObjects = ['pedra',...
16cb8e7a6a051a1b4eae52872870d6ce8818de49
vmontich/curso-de-python
/pythonexercicios/ex027.py
174
4
4
nome = input("Digite o seu nome completo: ").strip() print("Primeiro Nome: {}".format(nome.split()[0])) print("Último Nome: {}".format(nome.split()[len(nome.split()) - 1]))
2cb013213d5cb99318cb5a7bf519040deaa19c79
aamodpant15/DNA_alignment
/DNA.py
4,122
3.859375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: def make_matrix(str1, str2, match, mismatch, gap): # Make strings into list s2 = list(str2) s1 = list(str1) # Make empty matrix mat = [[None for i in range(len(s2)+2)] for j in range(len(s1)+2)] arr = [[None for i in range(le...
37a441f7b87a5b6dacc5cb057c21a90008f9e4f8
Xvozt/pirple_python
/equality_check.py
172
3.8125
4
def equalityCheck(a, b, c): if int(a) == int(b) or int(b) == int(c) or int(a) == int(c): print(True) else: print(False) equalityCheck(6, "5", 5)
3007565d5bc70b78f0bc0f8857a123431306c33c
wmii-unofficial/wizualizacja
/cw5/zadanie_9.py
176
3.53125
4
from itertools import combinations lista = ['python', 'cpp', 'html', 'css', 'scss', 'typescript', 'dluga wyspa zimna herbata'] for i in combinations(lista, 3): print(i)
09b1e9c5762ca84b49b880842834996e516432da
Aegis-Liang/Python
/HackerRank/Data Structure/3_Trees/3_InorderTraversal.py
945
4.15625
4
""" Node is defined as self.left (the left child of the node) self.right (the right child of the node) self.data (the value of the node) """ def inOrder(root): #Write your code here if root != None: inOrder(root.left) print root.data, inOrder(root.right) """ *** One hit to pass!...
0024096cb469f863d3bc66221e4a2fc6e777e5c5
Tom-Chen/olinredux
/screen.py
4,301
3.75
4
# # A Screen is a representation of the level displayed in the # viewport, with a representation for all the tiles and a # representation for the objects in the world currently # visible. Managing all of that is key. # # For simplicity, a Screen object contain a reference to the # level it is displaying, and also t...
edba1705848098fd7d22222913c28037b12666d2
RafaelxFernandes/Python-Projects
/Data visualization/pisa.py
1,290
3.5625
4
import matplotlib.pyplot as plt import numpy as np columns_count = 3 bar_width = .2 # Data from Mean score in PISA 2012 for Math, Reading and Science korea_scores = (554, 536, 538) canada_scores = (518, 523, 525) china_scores = (613, 570, 580) france_scores = (495, 505, 499) index = np.arange(columns_count) # Plott...
e72124361155e7740cb2f70132411461dc1f653c
KorryKo/PythonPractice
/neborsum.py
1,270
3.84375
4
# Напишите программу, на вход которой подаётся список чисел одной строкой. Программа должна для каждого элемента этого списка вывести сумму двух его соседей. # Для элементов списка, являющихся крайними, одним из соседей считается элемент, находящий на противоположном конце этого списка. # Например, если на вход подаётс...
a5224cbabab0f05d8945451ce17bfc746afccd2e
Fr4nc3/code-hints
/python/structures/sample5/question1.py
7,649
3.5625
4
""" Fr4nc3 10/03/2016 Fr4nc3 This program implement AbstractRecord and more ! """ import csv import os import os.path class AbstractRecord: def __init__(self, name=""): self.name = name class StockStatRecord(AbstractRecord): def __init__(self, name, exchange_country, price, exchange_rate, shares_ou...
c5698d1d86d78e0e3c71777b7491779d514b631c
DiyanKalaydzhiev23/Advanced---Python
/Comprehensions - Exrecise/Matrix Modification.py
619
3.78125
4
n = int(input()) matrix = [[int(num) for num in input().split()] for _ in range(n)] data = input() while data != "END": command, row, col, value = data.split() if command == "Add": if 0 <= int(row) < n and 0 <= int(col) < n: matrix[int(row)][int(col)] += int(value) else: ...
1bd070773be795377696a331084dd61e0c024d7d
front440/PYTHON
/Primer_Trimestre/Programas_Secuenciales/Ejercicio09_DescuentoCompra.py
634
4.03125
4
# Programa: DescuentoCompra.py # # Proposito: Una tienda ofrece un descuento del 15% sobre el total de # la compra y un cliente desea saber cuanto deberá pagar finalmente por su compra. # # Autor: Francisco Javier Campos Gutiérrez # # Fecha : 10/10/2019 # # # Variables a usar # valorcompra <-- total de la compra...
fde9fb6757383bd8719b47fac8d955a4eb0a7d45
SuryakantKumar/data-munging
/data_extract.py
414
3.84375
4
class Extractor: """Class for extraction of data""" def extract_data(self, file): """extraction of raw data file param file: File related to analysis return extracted_data: Data which has been extracted from raw file """ self.extractd_data = [line.strip().split() ...
7dbc6bde472b854904fc4e430a791033febc42c2
ozcayci/python_examples
/examples_three/quest_04.py
216
4.03125
4
def sum_begin_to_end(begin, end): total = 0 if begin > end: begin, end = end, begin for i in range(begin, end + 1): total += i return total print(sum_begin_to_end(5, 3))
0b258c81350182e7ba57b199651c9a0d6288d5c6
subnormalmatrix/Adventure
/Chapter_2/princess_blood.py
2,047
3.78125
4
import sys sys.path.append('../') from plot import Plot from textwrap import dedent from random import randint class PrincessBlood(Plot): def enter(self): print(dedent(""" PRINCESS BLOOD You have successfully retrieved the secret weapon and brought it to the King's hideout. ...
3c50b5abb4c19e4d3f2dc5342d59aab788606aae
katheroine/languagium
/python/strings/strings.py
447
4.25
4
#!/usr/bin/python3 s = "hello" print(f"string \"hello\": {s} ({type(s)})") s = 'hello' print(f"string 'hello': {s} ({type(s)})") print(f"length: {len(s)}\n") cite = "Stat rosa pristina nomine, nomina nuda tenemus." print(f"cite: {cite}") print(f"words quantity: {len(cite.split())}\n") text = """ Videmus nunc p...
8ce5358a5860c470a27145b3ae7729e9535d93bb
iwataka/google-code-jam
/2017/round1a/play_the_dragon.py
4,944
3.59375
4
import math def solve(Hd, Ad, Hk, Ak, B, D): """Calculates the minimum number of turns to beat the knight. Args: Hd: the dragon's health. Ad: the dragon's attack. Hk: the knight's health. Ak: the knight's attack. B: buff value. D: debuff value. Returns:...
597f02bcc6178207b58dd7fbd01901b9decec5a2
Aasthaengg/IBMdataset
/Python_codes/p00003/s150974834.py
201
3.59375
4
for i in range(int(input())): temp = [int(x) for x in input().split()] stemp = sorted(temp) if stemp[2]**2 == stemp[1]**2 + stemp[0]**2: print('YES') else: print('NO')
baf919687ddece1b86cd106e10a2e43f450ed8da
sanjiny3000backup/SNU_BigData_Institute
/Business_Bigdata_Programming/python2-1-2.py
232
3.703125
4
l = [1,2,3] e1 = 2 e2 = 10 def search_element(x,y): if y in x: return x.index(y) # 이 부분에 대해서 제대로 작성하지 못함 else: return False print(search_element(l,e1)) print(search_element(l,e2))
a94b249f08ea74d7a916ba37738fb483c92e7948
hemasundar-tatipudi/Competetive-Programming
/Question Bank/Nth Fibonacci.py
226
3.78125
4
def fib(N): a = 0 b = 1 c = 0 if N==0: return 0 if N==1: return 1 for i in range(2,N+1): c=a+b a=b b=c return c n = int(input()) print(fib(n))
c464cc3fbcdeabe2499cb0a829248c0f3a24c2e6
mufan-li/nnet
/nnet_functions.py
2,481
3.53125
4
import numpy as np # initialize the weight matrix def w_init(xN, hV, yN): N = xN + np.sum(hV) + yN w = np.zeros((N,N)) layer = [0, xN] + hV + [yN] layer = np.cumsum(layer) for i in range(len(layer)-2): s1 = layer[i] e1 = layer[i+1] s2 = layer[i+1] e2 = layer[i+2] w[s1:e1,s2:e2] = np.random.uniform(-0...
eebf853651486079e8e101e073958488dbd0d647
nailerHeum/ps_dir
/leetcode/odd_even_linked_list.py
852
3.796875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, val=0, next=None): # self.val = val # self.next = next class Solution: def oddEvenList(self, head: ListNode) -> ListNode: return_head = head even_head = None cur_even = None cur_head = hea...
e9d1e73b2d151ce62b127b3e538f800397714e12
jerbrune/00-Python_Crash_Course_2nd_Edition
/09-Class/Exemples/dog.py
632
4
4
class dog: """A simple attempt to model a dog""" def __init__(self, name, age): #une fonction dans une class est une "méthode" #la méthode __init__ démarre authomatiquemeent dès la création d'une instance "dog" #instance de la class dog est automatiquement passé comme argument avec l'ar...
b797d1b1b0928f2d4e027408ed02417075cf2316
hudzzz01/Smester2StrukturDataAlgoritma
/LatihanUts.py
4,605
4.25
4
''' Creator : M.Hudzaifah Assyahid date : Saturday 25 April 2020 Im waiting doraemon in this year note : gym the assignment exam (UTS) Data sructure contac : hdzzzzzz01@gmail.com !!!! USE PYTHON 3 !!!!! !!!! USE PYTHON 3 !!!!! !!!! USE PYTHON 3 !!!!! !!!! USE PYTHON 3 !!!!! !!!! USE PYTHON 3 !!!!! !!!! USE PYTHON...
343fbe23896df188a44044ee98f1951301a3087d
hclimente/aoc2020
/day3/part1.py
910
3.59375
4
class Forest: def __init__(self): self.forest = open('input','r').read().split('\n') self.forest = [ x for x in self.forest if x ] self.length = len(self.forest) self.width = len(self.forest[0]) self.x = 0 self.y = 0 self.path = [] def next_pos(self, dx,...
4924e48dfc5ea80c26a3111daae77fd5d75a71fe
farid87-cmd/fundamental-pyhton-2020
/fundamentalprogress-tipedata-dictionary.py
953
3.796875
4
""" TIPE DATA DICTIONARY SEKEDAR MENGGABUNGKAN ANTARA KEY DAN VALUE KVP = Key Value Pair dictionary = kamus """ print('data ini di berikan oleh server gojek,untuk memberikan info driver di sekitar pemakai aplikasi') data_dari_server_gojek = { 'tanggal': '2021-02-19', 'driver_list': [ {'nama': 'farid',...
bea6e7513844af80cd07d1036f0cca2346d635d5
shbz1690/basic-Bioinfo-Problem-Python-
/complements.py
1,090
3.625
4
# reverse complement of codon import sys input_codon=sys.argv[1] def comp(nuc): if nuc=='A': comp='T' elif nuc=='T': comp='A' elif nuc=='G': comp='C' elif nuc=='C': comp='G' else: comp=nuc return comp def complement1(nuc):      nucleotides = 'ACGTat...
ad8fffcca172496bd6182c592e3d8dd213a3f554
BitnooriLee/Python-Opentutorial-Lecture
/Container/1.py
249
3.625
4
print(type('egoing')) name='egoing' print(type(['egiong','leezche','graphittie'])) names=['egiong','leezche','graphittie'] print(names) print(names[2]) egoing = ['programmer','Seoul',24, True] #data type! egoing[1]='Busan' print(egoing)
8fdd1d16633d281d7ea242b8d03419f96038d959
Southampton-Maritime-Robotics/autonomous-sailing-robot
/src/boat_servo_sail/src/boat_servo_sail/sail_angle.py
877
3.671875
4
import bisect def calculate_angle_boat_wind(boat_compass, wind_direction): wind_dir = wind_direction angle = abs(boat_compass - wind_dir) if angle > 180: angle = 360 - angle return angle def assign_length(diff_wind_boat): angles = [ (45, 1), #downwind (50, 0.95), (...
6b333bdf855dee331aaeaa8b9e132bc6ee91a8fb
PhillzMike/ConvNet
/ConvNetwork.py
10,802
3.6875
4
# -*- coding: utf-8 -*- """ Created on Sun Aug 5 01:34:46 2018 @author: Fasipe Timilehin """ import numpy as np import math class conv_net: """A class for implementing any convolutional neural network of any size""" def __init__(self, conv_layers, pool_layers, fully_connected_layers,order): """parame...
831dcadde4592f74ecdf947c235e15bff08a63d5
Pasupathi9897/testdemo
/cum,sum.py
217
3.828125
4
list=[] list1=[] sum=0 n=int(input("enter the n value")) for i in range (0,n): a=int(input()) list.append(a) print(list) for i in range(0,n): sum=sum+list[i] list1.append(sum) print(list1)
7c8517ad37f20254ca4c08fbe710b3bd51beed6b
uwwwwwu/Algorithm_programmers
/puppeteer_kakao.py
1,635
3.625
4
#시간 에러..? temp = [] move=0 for i in range(len(moves)): for j in range(len(board)): move=moves[i]-1 if board[j][move]!=0: temp.append(board[j][move]) #인형 바구니에 넣기 board[j][move]=0 break result=len(temp) #빼지 않은 상태에서 배열의 길이 체크 print(temp) # 같은 인형 제거 시작!!! i=0 while...
8f508de40c53bfc353c3fc2b37b4524236d9f2e5
sr-ght/scripts
/Python/try_para_tratar_resposta.py
150
3.859375
4
try: str = int(input("Informe um número: ")) print(f"O número digitado foi {str}.") except: print("Dado informado não é um número.")
104574604eb1622a87b7fee472f103192435e2be
Jadakis/Unit-3_Lesson-12
/Lesson 12/problem1.py
569
3.765625
4
import time import random print('-' * 65) print(' I am a Magic Eight Ball! ') print() question = input(' What is your question? ') time.sleep(1) print(' . . Shacking . .') time.sleep(1) print(' . . . Thinking . . .') time.sleep(1) choice = random.randint(1,4) if choice == 1: print('Mortal Kombat!!!') elif choice ==...
2e05dbd2ed5d0f6bd3cc0a22e268173304a5f205
Rajetharan/PythonIntro
/rename_files.py
572
3.765625
4
import os def rename_files(): file_list = os.listdir(r"/Users/Rajetharan/Downloads/prank") print(file_list) saved_path = os.getcwd() print("Current working directory is " + saved_path) os.chdir(r"/Users/Rajetharan/Downloads/prank") new_path = os.getcwd() print("Current working directory...
c0c5a2766134ff72f564a408742be7db13454994
matt-oak/CSCI_3656_Numerical_Computation
/Jacobi+Gauss_Seidel.py
1,701
3.671875
4
#Program for Jacobi method #Matt Oakley, #101697544 from __future__ import division #Initial guess vector #Structured [x1, x2, x3] initial_guess = [0, 0, 0] #Equation 1 rearranged solved for x1 def eq1(x2, x3): return (-2/3) + (1/3)*x2 - (1/3)*x3 #Equation 2 rearranged solved for x2 def eq2(x1, x3): return (-1/8)...
06466c04720704194358570b4769c9fce2ea6106
nilax97/leetcode-solutions
/solutions/Binary Tree Level Order Traversal/solution.py
598
3.734375
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 levelOrder(self, root: TreeNode) -> List[List[int]]: ans = list() def fill(node, level):...
855dc76c3d8877fde1efb9524032764ce32a3981
KrabbyNut/NguyenTuanKiet---C4T5
/Session_3_warmup.py
249
3.59375
4
# item1 = "Thit xien" # item2 = "Bun cha" # item3 = "Bun dau" # item4 = "Tao pho" # empty list # print(menu) # menu = [] # List with one item # menu = ["Thit xien"] # print(menu) no = 1 menu = ["Thit xien","Phở cuốn","Tào phớ"] menu.pop(1) print(menu)
a048f5bec86423a6c339da3916f83134c0d790bf
hoang7276/PythonProgrammingCourseFirstYear
/S04 - Homework solution/S04HousePriceSqm.py
459
4.0625
4
# This program calculates the price per sqm of a house def main(): print("Price per square meter calculator") print("Please enter the price of the house in EUR", end=" ") HousePrice = int(input()) print("Please enter the number of square meters of the house", end=" ") HouseSurface = float(...
8ce39b106fd87b768f3c631d7c5d880e3e3beb25
idarlenearaujo/URI_Python
/1060.py
240
3.71875
4
# variavel count = 0 number = 0.0 i = 0 # entrance intenger for i in range(6): number = float(input()) # se positivo count++ if number >= 0: count = count + 1 print('{} valores positivos'.format(count))
8aefbd92497ae6f717678091e1652a0f0dcf8d79
RoadRunner11/CarRentalApp
/docs/src/encode copy.py
2,996
3.609375
4
#!/usr/bin/python # -*- coding: utf-8 -*- # USAGE # With default parameters # python3 encode.py ## Acknowledgement ## This code is adapted from: ## https://www.pyimagesearch.com/2018/06/18/face-recognition-with-opencv-python-and-deep-learning/ # import the necessary packages from imutils import paths import fa...
1d250bdaa20893ff47945b3d6a3e672917472270
Smobey/Tiralabra-2016
/otto/tests/test_neoQueue.py
1,523
3.609375
4
from unittest import TestCase from NeoQueue import NeoQueue class TestNeoQueue(TestCase): def setUp(self): self.queue = NeoQueue() def test_exists(self): pass def test_empty(self): if not self.queue.empty(): self.fail("Empty queue should report as empty.") sel...
6cf1294b2a04402eee189a81956b6ea492bd74b2
shencang/note
/语言知识(Language knowledge)/Python/课程作业/数值分析/数值分析作业/第一次作业:二分法和适位法求根/二分法和试位法.py
4,189
3.71875
4
import math import matplotlib.pyplot as plt import numpy as np # 要求根的函数 :目前是 f(x)=x^2+30x+15 def function_composition(x): """函数表示和结果求值""" fc = math.pow(x, 2) + x * 30 + 15 return fc def display(output, flag): """打印测试结果""" # 两种可能性 if flag == 'true_value'or flag == 'tv': print("零点的准确坐...
c6dd137c2814299a48d1bf9c390f0587e7114804
Harpreetkaurpanesar25/python.py
/length of string.py
63
3.625
4
String=str(input("Enter string: ")) print(len(String))
ecbbc6813756e44ca6971363c377a54a35a8e009
ConnorMattson/Misc-Scripts-and-Challenge-Solutions
/challengeSolutions/NZPC/2008/nzpc2008e.py
588
3.8125
4
# Problem E 2008 - Connor Mattson lineInput = input("enter 'libraryName fontWidthInMM' or '# 0' to exit: ").split(' ') while lineInput != ["#", "0"]: books = input("How many books do you want to process? ") print(lineInput[0], "Library", "\nEnter 'bookWidthInMM text' eg '200 Hello': ") for i in range(int(books)):...
363ed0570ef700746191de06fd0b1982b629d781
rohitx/DataSciencePrep
/PythonProblems/coderbyte/alphabet_soup.py
530
4.1875
4
''' Using the Python language, have the function AlphabetSoup(str) take the str string parameter being passed and return the string with the letters in alphabetical order (ie. hello becomes ehllo). Assume numbers and punctuation symbols will not be included in the string. ''' def AlphabetSoup(str): string = str ...
8a426d844f8a90ea244522fa2161466a2bcafa51
Dis-count/Python_practice
/Practice/code_class/Crossin-practices/python_battle/battle_n1/nowhere.py
1,366
3.9375
4
''' 作者:nowhere 行业:其他 学习时间:2016.12 项目:抓取豆瓣top250图书 学习感受:时间很紧...ss ''' from bs4 import BeautifulSoup import codecs import requests DOWNLOAD_URL = 'https://book.douban.com/top250' def download_page(url): headers = { 'User-Agent': 'Mozilla/5.0 (Macintosh; Intel Mac OS X 10_11_2) AppleWebKit/537.36 (KHTML, like...
db33b9448cc8c6a1161b9dd701e01b2cbd844fa1
nesterrovv/Informatics
/Lab6/Lab6.11.py
3,345
3.734375
4
''' Создайте функции encodeHuffman(fileIn, fileOut) и decodeHuffman(fileIn, fileOut), осуществляющие кодирование и декодирование текста с использованием метода Хаффмана соответственно. fileIn – полное имя файла с исходным текстом, fileOut – полное имя файла, куда необходимо записать результат. Функции возвращают True, ...
78c228258f8684cab7bae4483218c22b828e18a1
delmoras/python-recipes
/csv/csv-dictionary-writer.py
2,100
3.78125
4
import csv #Διαβάζει τα περιεχόμενα ενός CSV αρχείου def csvRead(file): with open(file,'r+',newline='') as csvFile: csvReader = csv.reader(csvFile) for row in csvReader: print(str(row)) #Γράφει σε ένα CSV αρχείο τα περιεχόμενα ενός Dictionary def csvWrite(file,dictionary): with...
9c630b0921a6ea17f1f2d7a1288074201ed36cc2
Leftddr/web_programming
/python 실습 코드/turtle_ex.py
1,061
3.921875
4
import turtle def draw_circle(bongwon): bongwon.circle(50) def draw_star(bongwon): for _ in range(5): #별은 5개의 꼭지점이 있으므로 360 / 5 * 2한 값만큼 오른쪽으로 돈다. bongwon.right(360 / 5 * 2) #별을 그릴것이므로 우선 원의 지름만큼 이동한다. bongwon.forward(100) def draw_square(bongwon): for i in ra...
54c2da8c4634ecb38846ec61595bd7fa445923b3
shuihu001/python_lianxiti
/数据结构/循环链表练习——约瑟夫环.py
3,080
3.578125
4
""" -*- coding: utf-8 -*- @author: wang cong @Created on: 2020/2/16 9:19 @File : 循环链表练习——约瑟夫环.py @Software: PyCharm @desc:练习循环链表 编号为1,2,...,n的n个人按顺时针方向围坐一圈,每个人有一个正整数编号。从某个位置的人开始,数 到m的人出列;下一个人(从第m+1个)又从1数起,数到m的人便是第2个出列的人;依次重复下去,直到最后一个人出列, 于是得到一个新的次序。 """ # import numpy as np # # # def Joseph(n, m): # # 生成初始列表 # ...
aadde484a3a2511926f3b039ac4f5401bbac5bb9
sjwwjs/python-leetcode
/easy/14_longestCommonPrefix.py
814
3.890625
4
class Solution(object): def longestCommmonPrefix(self,strs): #首先考虑特殊情况,如果没有字符串应该返回空 if not strs: return "" #从我们字符串组里面的第一个字符串逐个与剩下的字符串进行比照 # 如果第一个字符串的第i位置和剩下字符串的i位置不相等则返回 #注意这里我们需要考虑特殊情况 如果前一个字符串比后一个长度长 则必须考虑越界问题 for i in range(len(strs[0])): ...
0bbd27011b7196dd7a9443fa592fc88a032a37e5
souvikbera/cs50
/pset6/sentiments/analyzer.py
1,326
3.5
4
import nltk import sys from termcolor import colored def main(): if len(sys.argv)!=2: print("error") exit(1) class Analyzer(): """Implements sentiment analysis.""" def __init__(self, positives, negatives): """Initialize Analyzer.""" self.pos=set() ...
3ae7124805adb42f2fa9054408045ecc47d81f19
LuqiPan/Life-is-a-Struggle
/3_Stacks_and_Queues/3-4-queue-via-stack/queue-via-stack.py
842
3.828125
4
class Queue: newStack = [] oldStack = [] def enqueue(self, item): self.newStack.append(item) def dequeue(self): while self.newStack: self.oldStack.append(self.newStack.pop()) if self.oldStack: return self.oldStack.pop() else: return ...
8d2c1de555fd47974497c510efd4b62d35650bd8
Gil-jung/DataScienceCourse
/Python1/classes/DataStructure.py
2,825
3.765625
4
class Node: def __init__(self, contents=None, next=None): self.contents = contents self.next = next def getContents(self): return self.contents def __str__(self): return str(self.contents) def print_list(node): while node: print(node.getContents()) nod...
cd11b1a77808a3e20e846bbb88c51c94912fe59a
Rjayaprakashnarayana/PrintName
/excercise4/4.1_sumarr.py
218
3.828125
4
def sum1(a,n): sum=0 for i in range(n): sum+=a[i] return sum a = [] n = int(input("Enter Number of Elements in an array:")) for i in range(n): b= int(input()) a.insert(i,b) print(sum1(a,n))