blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
ea98e09a847e3342735e6be680f6b30f70ea82bc
nownabe/competitive_programming
/AtCoder/JOI2008YOA_Otsuri.py
314
3.671875
4
# https://atcoder.jp/contests/joi2008yo/tasks/joi2008yo_a def search(amount): otsuri = 1000 - amount count = 0 for coin in [500, 100, 50, 10, 5]: if otsuri >= coin: count += otsuri // coin otsuri = otsuri % coin return count + otsuri print(search(int(input())))
3d4f45c674aa87192d2e5516f93ad657ed354a5c
paul-schwendenman/advent-of-code
/2015/day05/day5.py
1,291
4
4
import fileinput import re def has_three_vowels(word): vowels = "aeiou" count = 0 for letter in word: if letter in vowels: count += 1 return count >= 3 def has_double_letter(word): for num, letter in enumerate(word[:-1]): if letter == word[num+1]: return T...
c5d02c80368ae7e0de9aa47cef9ace451fe89428
den01-python-programming-exercises/exercise-1-32-inheritance-tax-MrFathed
/src/exercise.py
541
3.8125
4
def main(): #write your code below this line inheritance = int(input("Inheritance:")) years = int(input("Years since death:")) taxable = inheritance - 325000 tax = 0.0 if years < 3: tax_rate = 0.40 elif years < 4: tax_rate = 0.32 elif years < 5: tax_rate = 0.24 ...
28cc129160bdae17315f3c21132cfc5ff9b60d25
rheehot/baekjun
/1_dimention/3052.py
160
3.59375
4
arr = [0] * 10 num_arr = [] for i in range(10): arr[i] = int(input()) for j in arr: num_arr.append(j % 42) num_arr = set(num_arr) print(len(num_arr))
a7dea7b5a6491e851e01ae68c80ece489b789a92
mepujan/IWAssignment_1_python
/data_types/data_type_40.py
185
4
4
# Write a Python program to add an item in a tuple. def main(): sample_tuple=(1,2,3) new_tuple= sample_tuple + (5,) print(new_tuple) if __name__ == "__main__": main()
8c7df9386326069d7af8d47fc5f443245ac61c9e
Gendo90/topCoder
/0-300 pts/topcoderMagicSquare.py
1,452
4.25
4
# Problem Statement # # A magic square is a 3x3 array of numbers, such that the sum of each row, column, and diagonal are all the same. For example: # # 8 1 6 # 3 5 7 # 4 9 2 # In this example, all rows, columns, and diagonals sum to 15. # You will be given a tuple (integer) representing the nine numbers of...
042580e404aa4082d010372ac2239bde1a7e7893
4RCAN3/D-Crypter
/D-Crypter/Beaufort.py
3,196
4.375
4
'''Taking the input of CIPHERTEXT from the user and removing UNWANTED CHARACTERS and/or WHITESPACES''' Input = input("Enter ciphertext:") Input = Input.upper() NotRecog = '''`~1234567890!@#$%^&*()-_=+[{]}\|'";:.>/?,< ''' for i in Input: if i in NotRecog: Input = Input.replace(i,'') '''Taking the input of K...
6eb78f742fe36d3460c58d6947f5ba03bb180fd8
moon0331/baekjoon_solution
/programmers/고득점 Kit/위장.py
530
3.71875
4
from collections import defaultdict def solution(clothes): clothes_dict = defaultdict(int) for x, y in clothes: clothes_dict[y] += 1 answer = 1 for x in clothes_dict.values(): answer *= (x+1) return answer - 1 clothes_list = [ [["yellowhat", "headgear"], ["bluesunglasses", "e...
3e8368833319e2d6d6d5fb552e803d346dec720b
vector5891/Perceptrons
/test-demos/stringops.py
2,635
3.78125
4
# stringops.py # String processing functions # Test-Driven Development (TDD): write failing tests FIRST, then write # code to make tests pass. from hypothesis import given, assume from hypothesis.strategies import text def capitalizeWord(word): """Make the first character of word uppercase. If first character is ...
4628aec6692f05704bd74d799a40d08f34ae0502
marekbrzo/PythonDataAnalysisNotes
/5-1_OutlierAnalysisExtremeUnivariateMethods.py
3,601
3.828125
4
# OUTLIER ANALYSIS # Outlier detection is useful for the following: Preprocessing task for analysis or machine learning. Analytical # methods of its own. # Three main types of outliers: # Point outliers: observations anomalous with respect to the majority of observation in a feature( univariate outlier) # Conte...
4d7da82ee3cb1c2ad364b70070013da79fb7b618
Harini-Pavithra/GFG-11-Week-DSA-Workshop
/Week_11/Dynamic Programming/Longest Increasing Subsequence.py
2,516
4.09375
4
Longest Increasing Subsequence Given an array of integers, find the length of the longest (strictly) increasing subsequence from the given array. Example 1: Input: N = 16 A[]={0,8,4,12,2,10,6,14,1,9,5 13,3,11,7,15} Output: 6 Explanation:Longest increasing subsequence 0 2 6 9 13 15, which has length ...
4baf97aeec02c5cfd6bb230125e43d7ecedfeae9
davidnge/euler
/prob-7.py
520
4.03125
4
#What is the 10 001st prime number? import math def isPrime(number): if number == 2: return True if number % 2 == 0: return False i = 3 sqrtOfNumber = math.sqrt(number) while i <= sqrtOfNumber: if number % i == 0: return False i = i+2 ...
f47622994a626386f0e8861c2c60561e3337b37e
juliodparedes/python_para_dioses
/ejercicios/08MayorNumero.py
293
3.96875
4
print("Humano vas a ingresar dos números:") n1=int(input("Numero 1: ")) n2=int(input("Numero 2: ")) if n1==n2: print("Humano los 2 numeros son iguales") elif n1>n2: print(f"Humano el número {n1} es mayor que {n2}") else: print(f"Humano el número {n2} es mayor que {n1}")
631270d081b572d6901a8147220cd8e434ee705a
camelct/python-study
/5-6.如何在环状数据结构中管理内存.py
1,521
3.875
4
''' 问题:如何在环状数据结构中管理内存? 实际案例 在python中,垃圾回收器通过引用计数来回收垃圾对象,但某些环状数据结构(树,图...)存在对象间的循环引用, 比如树的父节点引用子节点子节点也同时引用父节点.此时同时del掉引用父子节点两个对象不能被立即回收. 如何解决此类的内存管理问题? 解决方案 使用标准库weakref,它可以创建一种能访问对象但不增加引用计数的对象, ''' # import weakref # class A(object): # # 析构函数 在回收的时...
530fcc088b054e1d293e498e7b4b72a82942d94a
deadbok/eal_programming
/Assignment 2A/prog4.py
4,985
3.859375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # The above lines tell the shell to use python as interpreter when the # script is called directly, and that this file uses utf-8 encoding, # because of the country specific letter in my surname. """ Name: Program 4 Author: Martin Bo Kristensen Grønholdt. Version: 1.0 (13/1...
a8c93cc0bdf7455e1873d157ab4abab0ffbaa51a
Gavinzqk/python-1
/python实战一期/python基础篇/1.python基础/流程控制-for/for.py
2,131
3.578125
4
#! /usr/bin/env python # encoding: utf-8 ''' @author:Gavin @contact: zqkaiyu@163.com @file: for.py @time: 2019/1/7 15:38 ''' # dic = dict.fromkeys("abcde",100) # for i in dic: # print(i) # dic = dict(name='gavin',age=29) # for k in dic: # print("%s: %s" % (k,dic[k])) # dic = dict(name='gavin',age=29) # for...
c8770b7c4d94c9e49c015f200aff5e285d35ee7c
MonoNazar/MyPy
/0.7/Rank.py
998
3.859375
4
n = [1, 2, 3, 8, 5, 3, 6] l = 1 n.append(l) n.sort() print(len(n) - n.index(l)) #Петя перешёл в другую школу. На уроке физкультуры ему понадобилось определить своё место в строю. Помогите ему это сделать. # Программа получает на вход невозрастающую последовательность натуральных чисел, означающих рост каждого человека...
982a248377910a3d5d546421742f87f7a24ec9d2
Aasthaengg/IBMdataset
/Python_codes/p02262/s935999369.py
715
3.625
4
n = input() A = [input() for i in range(n)] def insertionSort(A,n,g): cnt = 0 for i in range(g,n): v = A[i] j = i - g while j >= 0 and A[j] > v: A[j+g] = A[j] j -= g cnt += 1 A[j+g] = v return cnt def shellSort(A,n): cnt = 0 m = ...
e54877eca7323d768536d1cb303ab395f0fc778e
innovatorved/BasicPython
/x33- if element in list.py
225
3.875
4
fruits=('apple','bannana','pine apple','guava') a=input('Enter the fruit name: ') if a in fruits: print('fruit is already available-@',fruits.index(a)) print(fruits.index(a)) else: print('fruit is not available')
c2a24a42c40b748b0b81c7dc84d5985081af0832
martinegeli/TDT4110
/øving5/øving5-8.py
1,000
3.65625
4
def gcd(a,b): while b!=0: gammel_b=b #i løkken setter vi gammel_b til å være b b=a%b #finner b ved å ta a modulo b, som gir rest etter at a er delt på b a=gammel_b #setter a til å være gammel_b, slik at fra øverst så vil nå resten fra a%b bli til a, som vil brukes til å finne ny rest i neste runde hvor løkken kj...
ea3c26852f08784c46fe4538b4d184e173941145
AlanMorningLight/GAN_work_internship
/python_training/p11.py
342
3.734375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Dec 14 18:59:19 2019 @author: sarfaraz """ class employee: def __init__(self, id1, name): self.id1 = id1 self.name = name def display(self): print(self.id1, self.name) obj = employee(17103078, "Sar...
42730e22946b8a4adf78b9a36ee27902dacc3ce5
xiaogy0318/coding-exercises
/python/PythonTreeTest/PythonTreeTest.py
5,097
3.53125
4
treedata = '425a68393141592653599f22b34c00003edd80001040047ff00002bf209a00500507800001a00004aa7a69a9ea35334c937aa69e81aa7a6a327b48d4680029a3401a0000a68d00680000aaa9e099302152834f5371f4758d491b5e50959d6b4854861548a73b519ee445ad39276874864a9fda586cf19f1f3810ece4b1b98071c83f0e6a744c62e4164d77f8a986547dfd8b6d32d2cee6ff147...
e9c8db28d30cb6c5a70114107e249aeb8cc524f4
dailycode4u/python4u
/Topics/functions.py
157
3.890625
4
def scan_letter(word:str,letters:str='aeiou') ->set: """returns a set of letters found in a phrase""" return set(letters).intersection(set(word))
e9e52334d88294ffaf39fb3f8f33e39e5d7b2047
IsinghGitHub/advanced_python
/adv_py_1_try_accept_raise/assert_example.py
279
4.1875
4
raw_a = raw_input("Enter a positive number: ") try: a = float(raw_a) except ValueError: print('You must enter a number') raw_a = raw_input("Enter a positive number: ") a = float(raw_a) assert (a > 0), "A is not positive" b = 7.0 c = a + b print('c = %s' % c)
0077e236869fbf5ee9f76e06a89827c2626cfa8b
alexyi822/122bprog2
/findkthlargest.py
908
3.96875
4
#sort an array and return kth element #take input file as command line argument and k value as command line argument # http://interactivepython.org/runestone/static/pythonds/SortSearch/TheInsertionSort.html import time import sys comp = 0 # number of comparisons def insertion_sort(arr): global comp for index in ...
26bdc8888a13d9ad20e5587818cde136804e18c3
supremeKAI40/NumericalMethods
/Root Finding Mehtod/BisectionMethod.py
749
3.84375
4
import math def f(x): return x**(3)+x**-100 x0= float(input('enter first guess: ')) x1= float(input('enter second guess: ')) question=float(input ('question number: ')) error= 0.0001 def bisection(x0,x1,x2): step=1 print('\n\n solution to question %0.2f \n****Bisection Method Implementing***\n'%(question)) pr...
8ea7b827ab9753dbd47f3e74c589dd9f52b1bb90
Bloodielie/tg_contrallers_bot
/utils/utils.py
1,736
3.671875
4
from configuration.message import MESSAGE_KEYBOARD def converting_time(sec_time: int): """ Добавления правильного окончания для времени """ hours = sec_time // 3600 minutes = None if sec_time % 3600 == 0.0: pass else: minutes = int((sec_time - hours * 3600) / 60) if hours == 1...
b279a10910865ed288d9e6a51ec599605154ce89
navy-xin/Python
/Python 100例/Python 练习实例9.py
261
3.65625
4
#!/usr/bin/python # -*- codeing = utf-8 -*- # @Time : 2020/12/11 16:47 # @Author : navy # @File : Python 练习实例9.py # @Software: PyCharm import time myD = {1: 'a', 2: 'b', 3: 'c'} for key, value in dict.items(myD): print(key,value) # time.sleep(1)
c3d3ee3946922d95da53def8c724dd0acda226f6
causeyo/udemy_modern_bootcamp
/csv/12_delete_users.py
1,211
3.65625
4
""" delete_users("Grace", "Hopper") # Users deleted: 1. delete_users("Colt", "Steele") # Users deleted: 2. delete_users("Not", "Here") # Users deleted: 0. """ from csv import reader, writer def delete_users(first, last): with open('users.csv') as file: user_list = list(reader(file)) users_matche...
2024ce51873d26eae12c3fd122e404fb5192bd9b
nupur24/python-
/nupur_gupta_16.py
433
3.703125
4
# -*- coding: utf-8 -*- """ Created on Wed May 16 11:40:34 2018 @author: HP """ s=raw_input("enter string:") def translate(): str2 = '' x=['a','e','i','o','u',' '] for i in s: if i in x: str2 = str2 + i else: str2 = str2 + (i+'o'+i) ...
0cd79e483c0ece6b4c48777f6b88a998f662dd12
noahmelngailis/business-resources
/webscraping_dynamic_webpages_for_boa.py
3,534
3.6875
4
import pandas as pd # for running selenium from time import sleep import selenium from selenium import webdriver from webdriver_manager.chrome import ChromeDriverManager def find_nearest_bank_of_america(df): """This function pulls in data from a csv and returns a dataframe with the additional columns of address ...
e7376b92e6eeefdf3048e70557eab438eebe4d91
hooj0/python-examples
/17_examples_object/init.py
827
3.625
4
#!/usr/bin/env python3 # encoding: utf-8 # @author: hoojo # @email: hoojo_@126.com # @github: https://github.com/hooj0 # @create date: 2018-04-01 18:09:37 # @copyright by hoojo@2018 # @changelog Added python3 `object -> init` example class Student: name = 'jack' age = 22 ''' 初始化方法,构造方法 ,在实例化创建''' ...
ff74b24b9d57ba80b7b9a7e53ed675e96aa899b5
aysla001/ExploreDataScience
/Ch1 Fundamentals/Ex 1.4.1 SciKit.py
744
3.59375
4
#scikit-learn, scikit imported as sklearn is a machine learning library that is built on top of NumPy, SciPy, and matplotlib. #scaling data import numpy as np import sklearn as sk from sklearn import preprocessing data = np.genfromtxt('sample.data', delimiter=',', dtype='f8,f8,f8,f8',names='a,b,c,d') #this method of ...
10f78fc10279b209766cdaf22309e3b4a13e7a8a
presscad/Some_codes
/aboutPython/DATAstructure By Python/arraylist_1.py
1,505
4.21875
4
""" File:arraylist_1.py Date:Sep 14 2018 20:29 Description:重构后的ArrayList类的代码 """ from arrays import Array from abstractlist import AbstractList from arraysortedlist import ArraySoredList from arraylistiterator import ArrayListIterator class ArrayList(ArraySoredList): """An array-based list implementation""" de...
ba34e6c97dab49313d2ad1883013aa73b5e99a42
MichSzczep/PythonLab
/zad7b2.py
2,817
3.59375
4
import threading import time from threading import Lock class Lokaj: def __init__(self): self.mutex = Lock() def licz_paleczki (self): zajete = 0 for palka in paleczki: if palka.zajety: zajete += 1 return zajete def zapytaj_kel...
43796025fe8d1342758176901e91b5fbd0d91630
PashaKlybik/Python
/lab2/z6.py
597
3.6875
4
__author__ = 'pasha' class Defaultdict(): def __init__(self): self.dic = dict() def __get__(self, instance, owner): return self.dic def __setitem__(self, key, value): self.dic[key]=value def __getitem__(self, item): return Defaultdict.getitem(self,item,0) def geti...
bb2ef09c654edf48e8c42eb9c281d5e180340a48
MayankHirani/Spring-Internship-2020
/realsimulator.py
6,993
3.515625
4
""" Spring Internship with Prof. Sinha Mayank Hirani 2020 mayank.hirani@icloud.com """ # Import everything from simulator for the class import simulator from importlib import reload reload(simulator) from simulator import * # Import random for probabilities import random # Import matplotlib for graphing import matpl...
cdba980ce7c54174714288ba192ff62275e5209c
Ethan30749/monthy-python-and-the-holy-grail
/Creador de matrices.py
592
4.15625
4
def crear_matriz(M,N): matriz= [] #atribuye al valor "matriz" una lista vacía for i in range(M): matriz.append([]) #agrega listas vacías a la matriz equivalente al valor M for j in range (N): value=int(input("ingrese valores: ")) matriz[i].append(value) ...
3fe9b0c225fc5ad42891692f2f5e0461f99bc01e
mdjglover/hotmail-eml-to-text-converter
/hotmail_eml_to_txt_converter/parser/Email.py
782
3.875
4
class Email(): # Simple object to hold email data def __init__(self): self.sender_name = "" self.sender_email = "" self.receiver_name = "" self.receiver_email = "" self.date = "" self.time = "" self.datetime_hotmail_format = "" self.subject = "...
9515194406010ebd924b2632fd5c22d5df6b1383
ivan-ops/progAvanzada
/Ejercicio25.py
780
3.765625
4
# Ejercicio 25 # En este ejercicio usted revertira el proceso descrito en el ejercicio previo. # Desarrolle un programa que comnienze por leer una cantidad en segundos introducidos por el usuario. # Su programa debe desplegar la cantidad equivlente en forma de D:HH:NN:SS, # Donde D son los dias, HH las horas, M...
c955d3ba563542bc0a7e780f885133898e341b46
2020marion/jtc_class_code
/challenges/03_primitive_data_types_part_1/temperature.py
657
4.25
4
#question 1 formula for converting F to C x = 100 celsius_100 = (x-32)*(5/9) print(celsius_100) #the resulting temp is a float (it has a decimal) #question 2 convert temp of 0 degrees F to C x = 0 celsius_0 = (x-32)*(5/9) print(celsius_0) #question 3 convert temp os 34.2 F to celsius print((34.2-32)*(5/9)) #question 4...
c77b2cea6019b312c771aaaac3d75db9eba1d004
here0009/LeetCode
/Python/1774_ClosestDessertCost.py
3,557
4.28125
4
""" You would like to make dessert and are preparing to buy the ingredients. You have n ice cream base flavors and m types of toppings to choose from. You must follow these rules when making your dessert: There must be exactly one ice cream base. You can add one or more types of topping or have no toppings at all. The...
da7c096ef3b6ed7c6e517d3472b4480535635e89
CSPInstructions/HR-1819-Analysis-6
/Unit Test/Test.py
1,098
3.78125
4
# We import the unittest library and the content of the Fac file import unittest import Fac # We create a class that will contain or tests class TestFactional( unittest.TestCase ): # We define a test case for the fac function def test_factional(self): # We wanna check whether we receive a value e...
4e4179abf3ed2cfe4df7672045284426dc01fdf4
jingtaisong/LeetCodePython
/CountSmallerNumbersAfter.py
4,059
3.71875
4
from unittest import (TestCase, main) class CountSmallerToTheRight(object): def mergeSortWithInverseOrderCount(self, nums, low, high, counts): """ mergeSort an array nums on [low, high), adjust counts[i] by the number of elements from the right of nums[i] to the left of nums[i] """ ...
8261fb4e4e1d46da4c52ef27ffd7522815e7e3c8
turb0bur/tsp-heuristics
/heuristics.py
2,153
3.625
4
from random import randrange def nearest_neighbour_algorithm(graph): if graph.size == 0: return -1, [] points = [i for i in range(graph.size())] current = randrange(0, graph.size()) tour = [current] points.remove(current) while len(points) > 0: next = points[0] for ...
3e60333d8041939881ad52eabe9c7324b62f31f5
lekshmijraj/PythonPrograms
/loops/ifpass.py
134
4.03125
4
a=35 b=36 if b>a: print("a <b") elif a==b: print("a and b are equal") else: print(" a > b") print("hello, the checks are done!")
17d71e890229021008aa3036692544e9dc6abb04
thatislav/flightscraper
/parsing_machine_4.1_task.py
16,926
3.6875
4
""" This module parse information about flight tickets from http://www.flybulgarien.dk/en/ with parameters taken from user """ from datetime import datetime, timedelta import re import requests from lxml import html from texttable import Texttable # 1. Параметры юзера принимаем функцией, полёты обрабатываем классом D...
b36169cf1712dca276d8bc33bca89412500342d1
Bngzifei/PythonNotes
/学习路线/1.python基础/day04/09-切片.py
834
4.1875
4
""" 切片:取出字符串的一部分字符 字符串[开始索引:结束索引:步长] 步长不写,默认为1 下一个取得索引的字符 = 当前正在取得字符索引 + 步长 其他语言叫截取 步长:1.步长的正负控制字符串截取的方向 2.截取的跨度 """ str1 = "hello python" # print(str1[0:5]) # print(str1[:5]) # 如果开始索引为0,可以省略 # str2 = str1[6:12] # str2 = str1[6:] # 如果结束索引最后,可以省略 # print(str2) # list1 = [11, 12, 14] # print(list1[-1]) # 负索引,倒着数,比较方便 ...
13c7f87d5affd2f7f3ca396f27141cc4e6ae9a39
zainabkhosravi/runge_kutta_lane_emden
/runge_kutta.py
823
3.546875
4
from __future__ import division, print_function # define functions used in integrate def f(x, y, z): return z def g(x, y, z, n): return -y**n-2/x*z # integrate def integrate(x_0, y_0, z_0, n, t_step): '''Integrates one time step''' k_0 = t_step * f(x_0, y_0, z_0) l_0 = t_step * g(x_0, y_0, z_0, n...
6134642fe17bd1a09d8e5390bec89671fdf73b42
XenyLet/hse-percollation
/modules/utils.py
350
3.578125
4
# https://stackoverflow.com/questions/952914/how-to-make-a-flat-list-out-of-list-of-lists def flatten(L): if L is None: return None for item in L: try: if type(item) is not tuple: yield from flatten(item) else: yield item except Typ...
88dce776aefea393eba3246af3f4fb8af4793062
Elonet/python3_formation_1
/mymath/geom.py
258
3.765625
4
def perimeter(length, width): """ Return perimeter of square or rect :param length: :type length: float|int :param width: :type width: float|int :return: Perimeter :rtype: float|int """ return 2 * length + 2 * width
859b114f5f2589434dea429a16b6a1abb4b8a558
JackM15/Python-Basics
/random_number_game.py
1,862
4.0625
4
import random # generate a random number between 1 and 10 secretNumber = random.randint(1,10) def game(): guesses = 0 while True: # get a number guess from the player, if it's not a number, tell them and ask again. while True: try: guess = int(input("Guess a number between 1 and 10 \n")) ...
807c2620cfec3e4e92a84dd0be270732ff16a5fd
daniel-reich/ubiquitous-fiesta
/7kZhB4FpJfYHnQYBq_16.py
214
3.84375
4
def gcd(a, b): if a < b: a, b = b, a while b > 0: a, b = b, a % b return a def lcm(a, b): g = gcd(a, b) return a * b // g ​ def lcm_three(num): a, b, c = num return lcm(lcm(a,b), lcm(b,c))
180ad11db84200995b6010d38f0537349b63c4ff
mshellik/automate_the_boring_stuff
/if_spam.py
202
3.9375
4
spam=0 if spam<5: print("hello world") spam=spam+1 print(spam) #This will only print Hello World once, as once the condition is evalutes to True. it will print .. while new vaule spam will be 1
c5e7fe15e87cf568da5e33233cd38d6ef6938fb4
yangzongwu/leetcode
/20200215Python-China/0166. Fraction to Recurring Decimal.py
1,232
4.15625
4
''' Given two integers representing the numerator and denominator of a fraction, return the fraction in string format. If the fractional part is repeating, enclose the repeating part in parentheses. Example 1: Input: numerator = 1, denominator = 2 Output: "0.5" Example 2: Input: numerator = 2, denominator = 1 Outpu...
72fd4e3f392e88ed6ff37886fa022d9ae182f05c
marinov98/fall-127-proof-of-work
/Python_127_proof_winter/applesnoranges07.py
2,260
4.15625
4
#When a fruit falls from its tree, it lands units of distance from its tree of origin along the -axis. # A negative value of means the fruit fell units to the tree's left, and #a positive value of means it falls units to the tree's right. #Given the value of for apples and oranges, #can you determine how ma...
30a3a62c28e99cef20246e4a709f1d0b7cd729a2
itsme-vivek/Akash-Technolabs-Internship
/Day-3/leapyear.py
300
4.25
4
print("Check Weather Year Is Leap Year Or Not") year = int(input("Enter A Year:")) if (year%4) == 0: print("This Is Leap Year") elif (year%400) == 0: print("This Is Leap Year") elif (year%100) != 0: print("This Is Leap Year") else : print("This Is Not Leap Year")
f83c22e67fda404820934542e16e8dc3be77312f
zaur557/python.zzz
/taack 1/Автопробег.py
100
3.546875
4
N = int(input()) K = int(input()) if K % N > 0: print(K // N + 1) else: print(K // N)
5541272eb9eb2fc1cd69242c7e93045400c41983
matthewnorman/testscore_extractor
/extractor.py
922
3.53125
4
import shutil import urllib import pandas import os.path import zipfile import tempfile DATA_URL = 'http://www5.cde.ca.gov/caasppresearchfiles/2015/ca2015_all_csv_v1.zip' FILE_NAME = 'ca2015_all_csv_v1.txt' def download_data(target_dir): """ Get the file from the internet :param target_path: Local path...
0463496bf5c0ccc9bbb7ca151a2fe2351b69fdfa
AmaralScientist/CourseworkCode
/KNN_Classifier.py
52,326
3.8125
4
## # This program uses the k nearest neighbors (KNN) algorithm, the condensed KNN # algorithm, and the edited KNN algorithm to train and test machine learning # classifiers. Five-fold cross-validation is performed and a KNN, condensed KNN, # and edited KNN classifier are each tuned to determine the optimal va...
571ceab172ce97ac5e0ec54ec22fdebe886cf18a
teacherzhu/Physics-Olimpiad-Problems-Database
/arabic2rom.py
2,672
3.609375
4
#!/usr/bin/env python2 # Por Luis Mex # funciones sencillas para numeros arabicos a romanos y viceversa import sys def arab2rom(val): rabc=['I','II','III','IV','V','VI','VII','VIII','IX', 'X','XX','XXX','XL','L','XC','C','CC','CCC' ,'CD','D','CM','M','MM','MMM','MV_',...
b85eb8cdfb85573ef679ccde0177019e7740315f
Aninhacgs/Programando_com_Python
/Condicionais-Python/CondicionalExercicio07.py
878
3.96875
4
#Criar um algoritmo em PYTHON que leia o valor da compra e imprima o valor da venda. #Entrada de dados compra = float(input("Digite o valor da compra: ")) while(compra == 0 or compra < 0): print("Digite um valor válido para compra: ") compra = float(input("Digite o valor da compra: ")) #processamen...
df8466854b643478c0cebd984ad86d09de01cc9b
yrto/python-coding-tank
/aula-14-fixacao/aula-14-fix-04.py
381
3.9375
4
# Faça um script que recebe um texto da entrada # e exibe a maior palavra contida nesse texto. texto = input("Digite algo: ") texto_lista = texto.split(" ") maior_palavra = '' contador = 0 for i in texto_lista: qtd_caracteres = len(i) if qtd_caracteres > contador: contador = qtd_caracteres ma...
27a520d8939037a2438566bf5f4e2e3d40959dce
KSDN-05/pythonassignment
/f4.py
243
4.3125
4
def reversed(name,length): reverse="" while(length>0): reverse+=name[length-1] length-=1 return(reverse) a=input("enter string to be reversed:") lengt=len(a) reversed_string=reversed(a,lengt) print(reversed_string)
01cdbc166a6360ad6ab758275426f045c600b4aa
gary-gggggg/gary
/1-mouth01/day15/exe02.py
520
4.03125
4
"""练习 1:创建列表,使用迭代思想,打印每个元素. 练习 2:创建字典,使用迭代思想,打印每个键值对""" list1 = [1, 2, 3, 4, 5, 6, 7, 8, 9] iterator = list1.__iter__() while 1: try: item = iterator.__next__() print(item) except StopIteration: break dic = {"giao": "giao1", "fiao": "fiao1", "xiao": "xiao1"} iterator1 = dic.__iter__() wh...
b447c18c80e2c6a3456a480a29d131bb9c341fdb
Minu94/PythonWorkBook1
/luminar_for_python/language_fundamentals/collections/word_count.py
433
3.78125
4
line="hello hai how are you" words=line.split(" ") #split by space to get word seperatele dict={} for word in words: if(word not in dict): dict{word}=1 #word:1 # supposed to make the form {"hello":1,"hai":2 else: dict[word]+=1 #create list [1,2,3,4,5,6] find square of each element then from resu...
d42a8783db2610030a9efdbd17d119bee245b4c4
sea-lab-wm/burt
/crashscope/lib/python-scripts/ApkParsing/check_aapt.py
1,582
3.703125
4
""" Last Edited by Richard Bonett: 3/25/2017 This program counts the apks from a json file of ApkInfos, outputting a table of each discovered API level and the number of apks having that API level. Usage: python3 check_aapt.py INPUT_JSON_FILE """ import json import sys from prettytable import PrettyTable apks =...
7eb277b5d534bcb8013c3a488af29bc1878908e7
siddiqsy/Handwritten-Digits-CelebFaces-Attributes-Classification
/nnScript.py
13,908
3.734375
4
import numpy as np from scipy.optimize import minimize from scipy.io import loadmat from math import sqrt import pandas as pd import time import matplotlib.pyplot as plt def initializeWeights(n_in, n_out): """ # initializeWeights return the random weights for Neural Network given the # number of node in ...
ca3368a6105513bf6a8e6f8a9525a64857a0bfd0
PauloVilarinho/algoritmos
/problemas uri/Problema1159.py
160
3.703125
4
x = 1 while x!= 0 : total = 0 x = int(input()) y = x if x%2 == 1: x += 1 if y!= 0 : for i in range(5): total += x x += 2 print ("%d" %total)
35561ff018c91efd6e5bb8489486cace89941086
jiadaizhao/LeetCode
/1001-1100/1047-Remove All Adjacent Duplicates In String/1047-Remove All Adjacent Duplicates In String.py
233
3.5625
4
class Solution: def removeDuplicates(self, S: str) -> str: St = [] for c in S: if St and c == St[-1]: St.pop() else: St.append(c) return ''.join(St)
1ec58889352e8919c1614492b40921b29b0f4ff8
vvalcristina/exercicios-python
/curso_em_video/09_guanabara.py
568
4.21875
4
#Tabuada v.01 num = int(input("Digite um numero para ver sua tabuada: ")) print("-"*15) print("TABUADA DE {}".format(num)) print("-"*15) print("{} * {} = {}".format(num,1,num*1)) print("{} * {} = {}".format(num,2,num*2)) print("{} * {} = {}".format(num,3,num*3)) print("{} * {} = {}".format(num,4,num*4)) print("{} *...
aa848492ce5486bb8dc72104a6434c05fbd829fc
Alexanderklau/Start_again-python-
/Loop_and_condition/_list_comprehensions.py
344
3.75
4
# -*-coding:utf-8 -*- __author__ = 'Yemilice_lau' print map(lambda x:x ** 2 ,range(6)) def odd(n): return n % 2 print odd(125) seq = [1,2,3,4,5,6,7,8,9] # filter判断是否是奇数 print filter(lambda x :x % 2,seq) print [x for x in seq if x % 2] print [(x+1,y+1) for x in range(10) for y in range(10)] # if __name__ == '...
947c6159e35a3a2de0a7179f3e3e205e50b9a403
darthsuogles/phissenschaft
/algo/leetcode_64.py
622
3.65625
4
''' Min path sum in a matrix ''' def minPathSum(grid): if not grid: return -1 m = len(grid) n = len(grid[0]) if 0 == n: return -1 path_sum = [] for i in range(m): path_sum.append([None] * n) path_sum[0][0] = grid[0][0] for j in range(1, n): path_sum[0][j] = path_sum[0]...
f8295dc2bb7764c798edc06212eca7587a1ad841
devipriyak/IICSEA_Chapter2
/SubsetandSuperSet_symmetricsDifference.py
548
3.875
4
set1={1,2,3,4,5,6,7,24,25,26} set2={1,2,3,4,5,6,7,8,9,10,11,12,13,14} '''#Subset or not verification print "Is the set1 is sub set of Set2:%s" %set1.issubset(set2) print "set1<set2 %s" %(set1<set2) #SuperSet Verification print "Is the set1 is super set of Set2:" ,set1.issuperset(set2) print "set1>set2 %s" %(...
04c90bb532a41bb17a47c5ba903d38f4992d150e
artisodua/Hillel
/2_5.py
1,531
3.890625
4
# 5) Есть строка со словами и числами, разделенными пробелами (один пробел между словами и/или числами). # Слова состоят только из букв. Вам нужно проверить есть ли в исходной строке три слова подряд. # Для примера, в строке "hello 1 one two three 15 world" есть три слова подряд. pline = 'hello 1 one two three 15 worl...
d0732314423fe814587702e80a6802c7eaf3860f
WarMasterGenral/OPS435-Rep
/Practices/Collatz.py
177
4.21875
4
def collatz(number): if number %2 ==0: return number // 2 elif number %2 == 1: return 3 * number + 1 user_input = int(input('Enter number: '))
652784e8ff6b5140b16fb59e441d568f829f4b6c
arturchesnokov/hillel_pyton_intro
/luhn.py
1,123
3.796875
4
def luhn_check(card_number: str) -> bool: """ Validate card number :param card_number: credit card number :returns: True if number is valid """ card_number = card_number.replace(' ', '') # удаляем пробелы if card_number.isdigit(): # если в строке остались только цифры numbers = l...
0564dd5f5acca737aaf09afbc9358a2e2f8a9605
Harshin1/Python-and-DL
/Labs/Lab 1/hospital admission system/patient.py
1,153
3.96875
4
class Patient(object): def __init__(self, name, age, disease): self.set_Patient_Details(name,age,disease) # set Patient Details def set_Patient_Details(self,name,age,disease): self.name = name self.age = age self.disease = disease print('The patient details are: ') ...
d5c4d2b5edbcc2a6a5c9fccd7991be29caa1a496
shellcreasy/python_study
/loop.py
1,518
4.09375
4
#遍历列表 magicians = ['alice','david','carolina'] for magician in magicians: print(magician.title() + ",that was a great trick!") print("i can't wait to see your next trick," + magician.title() + "\n") print("Thank you,everyone,that was a wonderful magic show") #range函数生成数字 for value in range(1,5): print(value) #使用ra...
51a6a482914d388151f33f764f8e0812d1338f3d
Jonathan-aguilar/DAS_Sistemas
/Ene-Jun-2020/sanchez-niño-angela-gabriela/Practicas1.0/practica1.py
329
3.671875
4
resultado=1 i=0 n=int(input('Ingrese un numero base:')) m=int(input('Ingrese numero de potencia:')) if m!=0: print("1") while True: resultado=n*resultado print(resultado) i=i+1 if i>= abs(m): if m<0: resultado=1/resultado print(resultado) break ...
99215cc96054e2bf665b6cde703c4d82e9a54d5d
jonataseo/PythonStudys
/chapter12/ch2.py
239
3.90625
4
import math class Circle: def __init__(self, radius): self.radius = radius def area(self): return math.pi * (self.radius * self.radius) if __name__ == "__main__": circle = Circle(3) print(circle.area())
930f6bc6704cbbbcfaf811d4f931d111637fd118
mlratj/Python-Scripts
/Short_exercises/fibonacci_sequence.py
337
4.03125
4
t=int(input("Place a number of terms: ")) print() n1=0 n2=1 counter=0 if t<=0: print("Invalid value.") elif t==1: print("1") else: print("Fibonacci sequence up to ", t, ": ") while counter<t: print(n1, end=" ,") x=n1+n2 n1=n2 n2=x counter+=1 print("\n Have a ni...
f6cda72eec2c67d3f3d22ce7492cb450649ba58b
marcoportela/python
/exercicio04_marco_02.py
564
3.625
4
# -*- coding: utf-8 -*- """ Created on Mon Aug 18 14:24:51 2014 2. Sorteie 20 inteiros entre 1 e 100 numa lista. Armazene os números pares na lista PAR e os números ímpares na lista IMPAR. Imprima as três listas. @author: portela.marco@gmail.com """ import random lista = [] listaPar = [] listaImpar = [] for i in range(...
27cfbebbd04ad72a63cb7bd2c9538d76e402a79c
ziweifan177/Data-Science-Knowledge-Base
/DataScience/python/PythonThread.py
3,488
4.125
4
import threading #1. threading foundation: def test(): print('threading.active_count():',threading.active_count()) # Current threading number. print('threading.enumerate():',threading.enumerate())#What the specific thread? print('threading.current_thread():',threading.current_thread()) #Current threa...
4dbb7e7f9ebaa73dfafc11dbfdc3b7624a0872e2
kf2312/kelaskita
/kelas_kita/api/question3.py
201
3.765625
4
number = [0, 1] i = 2 while i <= 8: number.append(number[i-1] + number[i-2]) i += 1 print(str(number)) # numberStr = [] # for x in number: # numberStr.append(str(x) + ', ') # print(number)
b3cf30aee08935244c9e20aa49bbbc83568d7a04
Nora-Wang/Leetcode_python3
/Trie/212. Word Search II.py
3,529
3.921875
4
Given a 2D board and a list of words from the dictionary, find all words in the board. Each word must be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. Example: Input: ...
fb0f19ef2d30eb5c7694c574d253fca28e5bbbd7
gdh756462786/Leetcode_by_python
/Bit Manipulation/Single Number II.py
1,252
3.6875
4
# coding: utf-8 ''' Given an array of integers, every element appears three times except for one. Find that single one. ''' ''' 如果我们把 第 ith 个位置上所有数字的和对3取余, 那么只会有两个结果 0 或 1 (根据题意,3个0或3个1相加余数都为0). 因此取余的结果就是那个 “Single Number”。 ''' # public class Solution { # public int singleNumber(int[] nums) { # int cnt[]...
eea2bc4392abe06f2a0da15b1f22440784df0461
yeshwanthmoota/Physics_Pong_Singleplayer
/Ball_class_file.py
2,292
3.859375
4
import pygame import random import math from universal_constants_file import * from ball_collision import * class Ball: def __init__(self, x, y): self.x = x self.y = y self.current_ball_speed = BALL_SPEED self.current_theta = 0 def ball_movement(self): # points sco...
8e7b9d96cf69f7ec34ccc9df090ff3c0544be01b
bigeyesung/Leetcode
/863. All Nodes Distance K in Binary Tree.py
1,411
3.796875
4
import collections # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def distanceK(self, root, target, K): #find target node #find distance below node #find distance above n...
b994b81d6b5d53eb76d4d82422e2a0068cd43033
TanveerAhmed98/Full-Stack-Programming
/Programming Concepts/loops.py
460
3.78125
4
# while loop a = 0 while a < 11: print("a = "+str(a)) a = a+1 while True: print("Loop ends here") break # for loop for b in range(1,12,2): print(b) numbers = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] for c in numbers: print(c) d = 0 while d < len(numbers): print(numbers[d]) d = d +...
1ac4cf6cb17a0236e35616f1324c69a5f5f6f59f
ivangrebeniuk/weather-forecast-parser
/weather_forecast.py
1,541
3.625
4
#! Python 3.7 # Script to parse data from weather forecast web site import requests from bs4 import BeautifulSoup # Download web page page = requests.get('https://forecast.weather.gov/MapClick.php?lat=40.7146&lon=-74.0071#.X0IsJS2w3q0') # Create a BeautifulSoup class to parse the page soup = BeautifulSoup(page.cont...
5bcb38572bd60c6783dbacd4725aec0488b65438
arodan10/ejercicios
/5Ejercicio.py
758
3.859375
4
#Se tiene el nombre y la edad de tres personas. Se desea saber el nombre y la edad de la persona de menor edad. Realice el algoritmo correspondiente y represéntelo con un diagrama de flujo, pseudocodigo y diagrama N/S. def estCondicional01(): #Definir variable regaloP=0 #Datos de entrada cantidadX=int(input("De...
1b25e77239d3c462f34470b22af52fa564b07ac8
Unidade/GCC218-Algoritmos-em-Grafos
/0 - Introdução a Python/Exemplos/Classes e objetos/bancos.py
426
3.640625
4
# Classe Banco (bancos.py) class Banco: def __init__(self, nome): self.nome = nome self.clientes = [] self.contas = [] def abre_conta(self, conta): self.contas.append(conta) def lista_contas(self): for c in self.contas: c.resumo # Fonte: I...
0581aa9a35ffbe2abc43d1cb45d1bb122706f253
AlexGCPrint/HW_P
/hw4/2task.py
244
3.609375
4
li = [300, 564, 334, 338, 2, 12, 44, 1, 1, 4, 10, 7, 1, 78, 123, 55] li2 = [] for i in range(1, len(li)): if li[i] > li[i-1]: li2.append(li[i]) print(li2) li3 = [li[i] for i in range(1, len(li)) if li[i] > li[i-1]] print(li3)
e3f63e9c747426fb666931e283838915a496eb2e
karsonk09/CMSC-150
/Sample Programs/test4.py
4,523
3.96875
4
import arcade SCREEN_WIDTH = 500 SCREEN_HEIGHT = 600 SQUARE_LENGTH = 35 SQUARE_HEIGHT = 35 TRIANGLE_COORDINATES = [] SQUARE_MOVE_SPEED = 3 class Square: def __init__(self, position_x, position_y, change_x, change_y, side_length, side_height, color): self.position_x = position_x self.position_y = ...
a77a44250ff16b2c16d6161624e3c8e23d024e60
suh-fee/nyuCoursework
/Intro to Python Labs/lab9.py
1,804
3.75
4
# pen and paper 1 # a: ['hi', 'mom', 'dad', 1, 57, 25] # b: ['hi', 25] # c: ['hi', 'mom', 'dad', [1, 57, 25]] # d: ['hi', 'mom', 'dad', [1, 57, 25]] # pen and paper 2 # a: 5 # b: 3 # c: [3, 4, 5, 6, 4, 5, 6, 7, 5, 6, 7, 8] #programming # q 1 def staircase(myint, n): num_list = [] for i in range(n): ...
6827701372de8eddb41d575c7cb0dee8f32435b1
OleksandrMakeiev/python_hw
/random digit.py
540
3.9375
4
# 23 import random print("Программа загадывает целое число от 1 до 10, Ваша задача отдгадать его, следуя подсказкам программы. Для выхода нажми q ") number = random.randint(1, 11) while True: choice = int(input("Сделай свой выбор [1-10]: ")) if choice > number: print("Меньше") elif choice < numb...
14c5f7bba90b9f6f64f30a4dfb323db91e3a0aff
BruceHi/leetcode
/String/1reverseString.py
793
4.125
4
# 使用递归 # def reverseString(s): # def helper(left, right): # if left < right: # s[left], s[right] = s[right], s[left] # helper(left + 1, right - 1) # # helper(0, len(s) - 1) # 双指针 # def reverse_string(s) -> None: # left, right = 0, len(s) - 1 # while left < right: # ...
df7ea5c9baf77fd97baef3414bbea65013be23e5
jasch-shah/python_codes
/countdown.py
710
4
4
import time from datetime import datetime, timedelta def setcount(): global hrs global mins global secs global totalsecs print('#### enter the requested values of the countdown timer #') hrs = int(input('hrs: ' )) mins = int(input('minutes: ')) secs = int(input('seconds: ')) totalsecs = 3600 * hrs + 60 * mins...
2d0291af4a8e7a6a9fe3e9399d9383471d7ce144
Yunzhe-Yu/products
/products.py
2,055
3.984375
4
# check the file if it is exist import os # operating system products = [] if os.path.isfile('products_price.csv'): # check the file if is existent isfile() print('The file is existent!') # products = [] # create a new list with open('products_price.csv', 'r', encoding = 'utf-8') as f: for line in f: if 'Items...