blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
44e4a92316411976f3c1fa8fdcb2769387e3faef
Lisolo/Python-Cookbook
/Network and Web Programming/Generating_a_Range_of_IP_Addresses_from_a_CIDR_Address.py
2,471
3.59375
4
# coding=utf-8 """ Problem You have a CIDR network address such as "123.45.67.89/27," and you want to generate a range of all the IP addresses that it represents (e.g., "123.45.67.64," "123.45.67.65," …, "123.45.67.95"). Solution The ipaddress module can be easily used to perform such calculations. For example: ""...
3ea6c082b8c419335cdde7ad951733146f278fd7
Trinity-Armstrong/ICS3U-4-07-Python
/nested_loops.py
408
4.03125
4
#!/usr/bin/env python3 # Created by: Trinity Armstrong # Created on: November 2019 # This program outputs all integers between 1000 - 2000 (5 int/line) def main(): # This function outputs all integers between 1000 - 2000 (5 int/line) # Process for counter in range(1000, 2001): print(counter, en...
02e41cb4c792b331d9a415270ff2336384ac3664
kkalkidan/Dailycode
/day19.py
813
4.15625
4
""" @Question In academia, the h-index is a metric used to calculate the impact of a researcher's papers. It is calculated as follows: A researcher has index h if at least h of her N papers have h citations each. If there are multiple h satisfying this formula, the maximum is chosen. For example, suppose N = 5, and...
684fab3f23869b16334439116da1fb8276ebb2ff
Jeoungseungho/python-coding-study
/정승호/두_개_뽑아서_더하기/solution.py
218
3.640625
4
def solution(numbers): answer = set() for i in range(len(numbers)): for j in range(i+1,len(numbers)): answer.add(numbers[i] + numbers[j]) answer = sorted(list(answer)) return answer
c544525da7b29266db33b553811ab002df704930
Sam-stiner/science-fairproject
/science fair gui.py
6,449
3.953125
4
import Tkinter from Tkinter import Label from Tkinter import Entry import tkMessageBox print "this is my first version of planet tracker its pretty basic but can still make the calculations (press next to continue)' a=raw_input() if a == "next": def convertString(str): try: returnValue = int(st...
67dc5c89916e2a852b019b2df4380c034816fbc6
newfull5/Baekjoon-Online-Judge
/[1920] 수 찾기.py
1,728
3.84375
4
""" #2020.07.08 length = int(input()) N = list(map(int, input().split())) input() M = list(map(int, input().split())) N.sort() def Binsearch(array, target, length_bottom, length_end): if length_bottom > length_end: return False mid = (length_bottom + length_end) // 2 if array[mid] < targ...
2ca19c24645ab6dfb5e1b8881f35f09042118bc3
eoinpayne/Python
/Lab2bookstor2.py
899
4
4
def book_store (book_price, book_quantity, shipping_cost, discount): total = ((book_price * book_quantity + shipping_cost)*discount) return total def main(): book_price = float(input("Enter price: ")) book_quantity = int(input("How many copies?: ")) shipping_cost = float((3 +((book_quantity - 1)*...
ae78be48b85c699e9a4acced052767edcb46dfdc
yzl232/code_training
/mianJing111111/geeksforgeeks/dp/Longest Bitonic Subsequence.py
2,025
3.890625
4
# encoding=utf-8 ''' Given an array arr[0 … n-1] containing n positive integers, a subsequence of arr[] is called Bitonic if it is first increasing, then decreasing. Write a function that takes an array as argument and returns the length of the longest bitonic subsequence. A sequence, sorted in increasing order is cons...
b56cd78a003c8c791976c9c056fb4f935687e736
Wellbeing0506/LeetCode
/Algorithms/Q16/Q16.py
3,762
3.5
4
class Solution: def threeSumClosest(self, nums, target): """ :type nums: List[int] :type target: int :rtype: int """ nums.sort() res = sum(nums[0:3]) for i in range(len(nums) - 2): j, k = i + 1, len(nums) - 1 while j < k: ...
4b319a09ffb2fd19e9d5eafde32929bdc63709c8
SowmyaSriDittakavi/udemy_dash_course
/03_plotly_basics/04_bubble_plot/04_bubble_exercise.py
892
3.640625
4
####### # Objective: Create a bubble chart that compares three other features # from the mpg.csv dataset. Fields include: 'mpg', 'cylinders', 'displacement' # 'horsepower', 'weight', 'acceleration', 'model_year', 'origin', 'name' ###### # Import libraries and modules import pandas as pd import plotly.offline as pyo im...
b62862bbfbbfc3559858859d58a8e19d7e31eaa6
jmcoder1/image-comparison-
/image_comparison.py
1,710
3.515625
4
""" This program is my first attempt to find duplicate images and similar images using python. It will heavily use python hashing. """ import os import sys from scipy.misc import imread from scipy.linalg import norm from scipy import sum, average SCRIPT_PATH = os.path.dirname(os.path.abspath(__fil...
38fb012437c9488d9885ca5232c01acbc8872a5c
vnBB/python_basic_par1_exersises
/exercise_14.py
719
4.28125
4
# 14. Write a Python program to calculate number of days between two dates. # Sample dates : (2014, 7, 2), (2014, 7, 11) # Expected output : 9 days from datetime import datetime def difference_between_dates(date1, date2): """ (date, date) -> date this function will calculate the difference between two dates...
8c39bb57b1a55dd81c760dc1c5fb5f35934fe8a6
githubvit/study
/hfpython/day22/上节课复习.py
4,219
4.53125
5
上节课复习 1、继承 什么是继承? 继承是一种新建类的方式,新建的类称为子类或派生类 父类又称为基类、超类 子类可以“遗传”父类的属性,从而可以减少代码冗余 如何寻找继承关系? 先抽象,再继承,继承描述的就是 一种父子关系/从属关系 继承的语法 class Foo1: pass class Foo2: pass class Bar(Foo1,...
4c4d29ef310fbbdfdbc44dc32362526c74298090
rosafilgueira/dispel4py_training_material
/dispel4py-tutorial/dispel4py_example_EvenOdd/EvenOddworkflow.py
5,586
4.0625
4
# coding: utf-8 # # Even humans are odd! # In this exercise we are going to create a dispel4py workflow that produces random numbers and it pairs them by ("one odd","one even") pattern. As we introduced before, we have different types of PEs: Generic, Iterative, Producer, Consumerk, SimpleFunction, ... In this exerc...
eac956b3fd6a945da3fcaa88713f68dce27a129e
cryoMike90s/Daily_warm_up
/Dictionaries/ex_6_generate_dict.py
302
4.15625
4
"""Write a Python script to generate and print a dictionary that contains a number (between 1 and n) in the form (x, x*x)""" dic = {} n = int(input("Enter a number: ")) for x in range(1,n + 1): dic["{}".format(x)] = "{}".format(x*x) for keys, values in dic.items(): print(keys, values)
bc16c77a34773a01d602604dc855e31476c22087
cyfaircs/Weekly-Challenges
/Spring 2021/Weekly Challenge 1/Submissions/Chris G/Python_Challenge_FizzBuzz_ChrisG.py
223
3.796875
4
for i in range(101): if int(i) % 5 == 0 and int(i) % 3 == 0: print(str(i) + " - FizzBuzz") elif int(i) % 5 == 0: print(str(i) + " - Buzz") elif int(i) % 3 == 0: print(str(i) + " - Fizz")
ba23f9ebc336667a56afac7d26479a916735ca52
YerraboluHimajaReddy/LalithaClass
/LalithaPythonClass/All/String literals.py
533
3.546875
4
strings = "This is Python" char = 'C' multiline_str = """This is a multiline string with more than one line code. Welcome to himaa world""" # This is a multiline string with more than one line code. #Welcome to himaa world unicode = u"\u00dcnic\u00f6de\...
ffc99484a41d9c6eaab0dba9c4d6767601646a6d
MrZhangzhg/nsd2019
/nsd1903/python01/day04/seq.py
227
3.953125
4
alist = ['bob', 'alice', 'tom', 'jerry'] # for i in range(len(alist)): # print(i, alist[i]) print(list(enumerate(alist))) for data in enumerate(alist): print(data) for i, name in enumerate(alist): print(i, name)
f246ef12b2fb099243c018ba7de90daa4068c306
kotsky/programming-exercises
/Dynamic Programming/maxSubsetSumNoAdjacent.py
811
3.8125
4
''' To define the max sum of non-adjacent elements. ''' # O(N) T / O(1) S def maxSubsetSumNoAdjacent(array): if len(array) <= 0: return 0 elif len(array) <= 1: return array[0] max_sum = [array[0], max(array[0], array[1])] for i in range(2, len(array)): max_sum = [max_sum[1], max(max_sum[1], max_sum[0]...
44b6dcd969c0c95a73ac599ff96caa55f56666cc
nikhiltandukar/ItsOctober
/alorithms/Sorting(python)/bubble_sort.py
370
3.953125
4
def bubblesort(num_list): for iter_num in range(len(num_list)-1,0,-1): for idx in range(iter_num): if num_list[idx]>num_list[idx+1]: temp = num_list[idx] num_list[idx] = num_list[idx+1] num_list[idx+1] = temp num_list = [2,0,45,7,25,63...
4be23cf8c2682ed2f9eec8563835038225faaf9c
mbrown1508/jobseek
/worker/helperclasses/dictionary.py
3,069
3.515625
4
import re class Dictionary: def __init__(self): self.dictionary_location = 'worker/helperclasses/words.txt' # Read in dictionary temp_dict = list(line.lower().strip() for line in open(self.dictionary_location)) # Remove all words less than 3 characters (p...
4e72e27ad28f0189b60a918f538786658f85caa5
lilacman888/pythonExam
/src/2020_05_29/oper01.py
199
3.734375
4
# 대입 연산자 : = a = 10 print('a=', a) x = y = z = 0 print('x=',x) print('y=',y) print('z=',z) c, d = 10, 20 print('c=',c) print('d=',d) # 값 교환 c, d = d, c print('c=',c) print('d=',d)
5193e19c7fc9a195da0f6f8b6db9c079afad5471
elenaborisova/Python-Advanced
/13. Modules - Lab/fibonacci_sequence/sequence.py
412
4.15625
4
def create_sequence(n): if n == 1: return [0] sequence = [0, 1] for i in range(2, n): sequence.append(sequence[i - 2] + sequence[i - 1]) return sequence def locate(number, curr_sequence): if number in curr_sequence: print(f"The number - {number} is at index {curr_seque...
e230d0bb829c2fdf422f39c7a2e2584c2ad15ee2
siawyoung/practice
/problems/count-change.py
570
3.953125
4
# Given denominations of 10, 20 and 50, find the total number of ways to make up an amount. def count_change(amount, n): if n == 1: denoms = [10] elif n == 2: denoms = [10,20] else: denoms = [10,20,50] counts = 0 for index, denom in enumerate(denoms): if denom == ...
9931ba1b2a0a543b9777559b1294163168b63db0
jakamrak/uvod-v-programiranje
/datoteke-s-predavanj/2016-17/04-ucinki/stranski-ucinki-b.py
1,022
3.96875
4
import turtle def f(x): return x + 1 def g(x): print(x + 1) return 0 def pozdrav(ime): '''Vrne vljuden pozdrav za človeka z danim imenom. >>> pozdrav('Matija') 'Dober dan, gospod profesor.' >>> pozdrav('Niels') 'Živjo, gospod asistent.' >>> pozdrav('Francelj') 'Živjo, Francel...
c84eb181a624f3af3e3b146da3968a1711e727fd
ds-ga-1007/assignment9
/dov205/InteractivePlot/test/test.py
2,218
3.90625
4
import unittest from assignment9 import * class InteractivePlotTest(unittest.TestCase): """Unit-testing class that allows us to run tests with expected outcomes. Run the test in the project's root directory (e.g. pwd should be '.../dov205/') with the following command: $ python -m unitt...
51bdf57138307bb736257fcbc56fe77a54221d12
sunny-aria/python
/urlDemo2.py
600
3.609375
4
from urllib import request import json ''' 利用urllib读取url,返回json,利用json解析为Python 对象 ''' def fetch_data(url): with request.urlopen(url) as f: data = f.read() j = data.decode() return json.loads(j) # 利用json.loads() 将字符串反序列化为python 对象Dict return '' # 测试 URL = 'https://query.yahooapis.com/...
0480e3cc23200b80b1e5ab59dde06474533b9e4d
hydraer/Python_stydy
/fx/fx_09_集合.py
357
4.0625
4
# 集合 # 无序、唯一、无下标,创建空集合必须set() set1 = {1, 2, 1, 'hello', True, '111'} print(set1) # 增add增加数据、update增加序列 set1.add(11) print(set1) set1.update({111, 222}) print(set1) # 删 set1.remove('111') print(set1) set1.discard('111') print(set1) print(set1.pop()) print(set1) # 改 # / # 查 print(1 in set1)
d1024219fd35459ec8650e08596549c57e8e89a1
njs2114/ECE2524
/homework3/mult.py
486
3.75
4
#!/usr/bin/env python2 import argparse import sys parser = argparse.ArgumentParser(description='Process some numbers.') args = parser.parse_args() product = 1 while 1: try: n = raw_input() product *= int(n) except EOFError: print product break except: if n == '': ...
bc621360fa74e3eb09f48a2ce90e4b9cf4421f9d
Aissen-Li/LeetCode
/337.rob.py
513
3.65625
4
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None class Solution: def rob(self, root: TreeNode) -> int: def robParentOrChild(node: TreeNode): if not node: return [0, 0] ...
b42e1c4b81aab203d81f7cc4d114fd36b2f05d53
MaksimKneller/pokerbot
/card.py
557
3.578125
4
class Card: def __init__(self, rank, suit): self.rank = rank self.suit = suit def __le__(self, other): return self.rank <= other.rank def __lt__(self,other): return self.rank < other.rank def __ge__(self, other): return self.rank >= other.rank def __eq__...
9b29cc9aed76f374c1f3e4ec4c6e6193fb2e168b
RedmondY/-data_structure
/task 6/Dijkstra 算法.py
1,434
4.09375
4
# 起始点到任意一点的最短路径 def dijkstra(graph, start): nodes = list(graph.keys()) nodes.remove(start) visited = [start] distance_graph = {start: 0} while nodes: distance = float("inf") for v in visited: for d in nodes: new_distance = graph[start][v] + graph[v][d] ...
81f66c65029520a8adc56533efb11a71a47e75da
danilokevin/Lote-1---Python
/Lote 1/Ex08.py
266
3.71875
4
# Objetivo: Receber valor de um depósito em poupança e verificar seu novo valor após 1 mês de aplicação a uma taxa de 1,3% a.m d=float(input("Qual o valor de depósito realizado? ")) montante=(d*(1+(1.3/100))) print("O valor atualizado é de: ", montante)
df92a03e7e1400405076399904955c7f816a7903
sljudge/sample_code
/python/code_wars/golf_social.py
2,877
3.515625
4
import collections def valid(schedule): ''' takes proposed golfing schedule and asserts that: - each player plays once per day - the number and size of the groups is the same every day - each player plays with every other player at most once [ ['ABCD', 'EFGH', 'IJKL', 'MNOP', 'QRST'...
bcaa41be80be2b0d3eba670afda9a96a56a4ed6d
heyitspham/Python-Projects
/python-learning/step310_web_page_generator_assignment.py
1,864
3.625
4
import tkinter as tk from tkinter import * from tkinter import messagebox import webbrowser # Function to open html file generated from writeHtmlFile() function def openInBrowser(): url = "step310_web_page_generator_assignment.html" chrome_path = 'open -a /Applications/Google\ Chrome.app %s' webbrowser....
c93d0fcfc20584af1df95aae3e2a0f9afcaa92e4
rafaelperazzo/programacao-web
/moodledata/vpl_data/105/usersdata/188/50871/submittedfiles/av1_3.py
310
3.84375
4
# -*- coding: utf-8 -*- import math N1=int(input('Digite o valor do número 1:')) N2=int(input('Digite o valor do número 2:')) N3=int(input('Digite o valor do número 3:')) n=1 b=0 while n>0: if(n%a)==0 and (nb)==0 and (n%c)==0: b=b+n break else: n=n+1 print ('b')
9494feece2844fa07126369520a259735eb76945
svwatson13/Python_basics_exercises
/Fizz_Buzz.py
1,373
4.3125
4
# Write a bizz and fizz game ##project # Without loop # Asks user for number num = int(input('Whats your number? ')) #Run through game function def fizz_buzz(num): # If remainder of number after being divided by 3 and 5 is 0 then return Bizzuu if num%3 == 0 and num%5 == 0: return 'Bizzuu' # If rema...
3b6ff7d431fd0c19b3946f7bf6aea64d496be738
gopalakrishna/eulers-python-gopal
/1.py
1,722
3.765625
4
""" This file is part of the set of solutions to Project Euler # Copyright (C) 2011 Gopalakrishna Bhat A <gopalakbhat@gmail.com> # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; ei...
6b6feed974147404880c72e89e56f2922f95df4a
chrisjdavie/hackerrank_datastructures
/swap_nodes/swap_node.py
624
3.8125
4
from queue import Queue class Node: def __init__(self, data, left = None, right = None): self.data = data self.left = left self.right = right def swap_node(node, target_height, current_height): nodes = Queue() nodes.put((node, current_height+1)) while not nodes.empty(): ...
08c3ce69bbf6bd4ef2cc65d31d1e797c3c495d38
fauzandiMB/FinalProjectMedsosAnalytics
/pos.py
507
3.546875
4
from nltk import word_tokenize, pos_tag, FreqDist, tag sentence = "At eight o'clock on Thursday morning Arthur didn't feel very good." ####Sentence Tokenizer#### tokens = word_tokenize(sentence) print (tokens) ####pos tagging#### tagged = pos_tag(tokens) print (tagged) #dalam format word/tag print ([tag.tuple2str(t...
4d2a117e6d0713c5f07b0847dc1a74cf0c606a2f
fvictorio/project-euler
/097/problem_097.py
225
3.5
4
def power_mod(a,b,n): if b == 1: return a % 10**n if b % 2 == 0: return (power_mod(a,b/2,n) * power_mod(a,b/2,n)) % 10 ** n else: return (a* power_mod(a,b/2,n) * power_mod(a,b/2,n)) % 10 ** n
d68fc775b237dee93301d9ea3445850d35502a10
erardlucien/python_exercises
/fib.py
510
4.15625
4
# write Fibonacci series up to n. def fib(n): """Print a Fibonacci series up to n.""" a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a + b print() # fib(2000) # return Fibonacci series up to n def fib2(n): """Return a list containing the Fibonacci series up to n.""" res...
9ad018eeb2701f91023c99e0a793d3f509d4c542
vlados24/Lab_10_Python
/Book.py
1,231
3.734375
4
from builtins import staticmethod class Book: amount_of_books = 0 def __init__(self, name="", price_in_hryvnias=0, number_of_pages=0, author_of_the_book="", date_of_first_sale=0, color="", genre_book=""): self.name = name self.price_in_hryvnias = price_in_hryvnias sel...
6824f06fdf70180656d5abeb42b7edbdd30528bd
codedu-python/practice
/ex18_lhm.py
590
3.796875
4
# this one is like your scripts with argv def print_two(*args): for i in args: print(i) # print("arg1: {}, arg2: {}".format(lhm1, lhm2)) # ok, that *args is actually pointless, we can just do this def print_two_again(co1, com2): print("arg1: {}, arg2: {}".format(co1, com2)) # this just t...
96c98437155937275ff0321d78e5e74c9911f485
foureyes/csci-ua.0479-spring2021-001
/_includes/classes/15/two_turtles.py
548
3.828125
4
import turtle def draw_square(t, size): t.down() for i in range(4): t.forward(size) t.left(90) wn = turtle.Screen() don = turtle.Turtle() leo = turtle.Turtle() raph = turtle.Turtle() leo.speed(0) don.speed(0) don.up() don.goto(120, 120) don.down() don.color("green") raph.speed(0) raph.up() raph.goto(-200, -...
61c58a5a4359a90ae01388a725044d911b16661a
rmmo14/math_dojo
/mathdojoTDD.py
729
3.984375
4
import unittest def add( num, *nums): # your code here # result = 0 # result += num for n in nums: num += n print(num) return num def subtract( num, *nums): # result = 0 # result -= num for n in nums: num -= n print(num) return num class MathDojo(unittest.Te...
c92a8bc06160f821ddcffe1761a4a1a779c3856c
dmschauer/leetcode_solutions
/algorithms/7_Reverse_Integer.py
504
3.5625
4
class Solution: def reverse(self, x: int) -> int: max_int = 2**31 - 1 min_int = 2**31 * -1 # reverse unsigned integer # casting back to integer also removes possible leading 0s if (x < 0): x = -1 * x x = int(str(x)[::-1])...
9ad9da51c85299d9790c80d1c7301ba20de83eec
jereamon/non-descending-sort
/non_descending_sort.py
1,685
4.375
4
def non_descend_sort(input_array): """ sorts array into non-descending order and counts the number of swaps it took to do so. """ swap_count = 0 while True: # We'll need a copy of our array to loop over so we're not modifying # the same array we're looping over. input_ar...
cf6c3044c31a258d82b27847d86e62848d0f99f5
gschen/sctu-ds-2020
/1906101074-王泓苏/Day0331/作业.py
573
3.578125
4
class Stack(object): def __init__(self): self.stack = [] def grade(self,Date): a=list(map(str,range(100))) for date in Date: if date in a : self.stack.append(int(date)) if date == '+': self.stack.append(sum(self.stack[-2:])) ...
7a7452fb7d61042f7b015cfbbbfb03a1b1fc6cdc
eldss-classwork/CSC110
/Creating Functions/HW-Children-Song-2.py
2,865
4.15625
4
# Evan Douglass # HW: Children's Song, the Reprise # Grade at challenge # This program prints out several verses to the children's song "There was an # Old Lady". # main function # prints the title and calls the verse functions def main(): # title print('There was an Old Lady') print() # ...
9d8bab2a3a644c6ab385ebec7bd14a6b779330ee
waynewu6250/LeetCode-Solutions
/98_validate_binary_search_tree.py
1,393
3.828125
4
# Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # 1. recursive class Solution1: def isValidBST(self, root: TreeNode) -> bool: return self.checkBST(root, None, None) def checkBST(self, root, min_...
20efefbb1c6d2d59c16439dd014c1b9bc414d4c7
mpatrickaires/curso-python
/ExerciciosPython/ex050.py
442
3.859375
4
soma = 0 cont = 0 for c in range(1, 7): # Executa o laço de repetição 6 vezes, pois ao chegar em 7 o laço não é executado numero = int(input(f'Digite o {c}º número --> ')) # Pede o número da posição de 'c' if numero % 2 == 0: # Verifica se o número digitado é PAR soma = soma + numero cont = c...
d3058bf45557fc45d353c0d71f447dae9c650684
Garreth1975/Web-Development
/31jan.py
190
3.96875
4
password = {"H":"p","OS":"F","C":"B"} while True: print ("enter a key:") key = input() if key == "": print("Welcome") if key in password: print()
354a4f31b59c61574ffebb3fe0f913abe8bc6c47
NaeunLeee/PythonWork
/number_updown_game.py
1,189
3.921875
4
# 숫자 맞추기 게임 # 1. 임의의 수 생성 # 2. 숫자 입력 # 3. 입력값이 크다면 크다라고 출력 # 작다면 작다라고 출력 # 맞으면 맞다라고 출력하고 프로그램 종료 exit() 함수 이용 # 4. 3번을 4번 반복 # 5. "게임오버"라고 출력 import random com = int(random.randrange(1,10)) num = int(input("숫자를 입력해주세요 : ")) if num>com: print("큽니다.") elif num<com: prin...
e0959ead2ea6cf470186a80d7897775dc4d1b9ed
shen-huang/selfteaching-python-camp
/exercises/1901060030/d09/mymodule/stats_word.py
1,097
3.546875
4
import collections import re def stats_text_en(en_text, count): en_text = ascii(en_text) en_text = en_text.split(' ') en_text_f = [] for i in en_text: en_text_f.append(i.lower()) return collections.Counter(en_text_f).most_common(count) def stats_text_cn(cn_text,count): cn_text_n = [] ...
29843113d21b8e0da0c3b56fffad4190b1840fd0
tghyyhjuujki/Study2
/new_python/day2/ch5_10.py
140
3.625
4
ph = float(input("ph 농도를 입력하세요: ")) # 3 if ph < 7.0: print("산성입니다!") if ph < 4.0: print("강산성입니다!")
60be1d33360a028944c19814129ec8ae6a5635be
okuchap/PyAlgo
/str_stack.py
494
3.859375
4
#Stack Frames: Implementing Recursion rStack = Stack() def toStr(n, base): #n is an integer convertString = "0123456789ABCDEF" #Convert the given integer to the stack, using the given base while n > 0: if n < base: rStack.push(convertString[n]) else: rStack.pu...
597b63cceb045a973b4243e66dfdad04ba4c71d3
thanosargiriou/climex
/xtreme_Indexes_climex_1.0/tx10p_climex_1.0.py
13,385
3.53125
4
import pandas as pd import numpy as np import glob """ Climate indexes as defined by http://etccdi.pacificclimate.org/list_27_indices.shtml Authors: Ioannidis Panagiotis, Athanassios Argiriou, github:ioannidispanagiotis, email: panagiwths.ioannidis117@gmail.com Laboratory of Atmospheric Physics - Department o...
72cd54b8e63ed329a60e271ac6da1a22f15e97e7
xiaoxiae/Robotics-Simplified-Website
/script/sitemap.py
2,198
3.6875
4
"""Generates a sitemap.xml file for the website.""" from regex import sub, search, MULTILINE from datetime import datetime from os import path, makedirs from modules.structure import get_docs_structure def writeURL(url, subpath, file, lastmod = None): """Writes information about a specific URL to a file.""" ...
2b4a98a6adbaace978f44a87fea7050182b2d9ed
battlemage64/FantasyWorldGenerator
/WorldGen/z_Piecewise/Blob Continent Generator.py
835
3.5625
4
import tkinter import random import math random.seed(input("Enter a seed:\n>>>")) window = tkinter.Tk() window.title("Your Finished Map") window.wm_attributes("-topmost", 1) window.resizable(False, False) canvasimage = tkinter.PhotoImage(width=500, height=500) canvas = tkinter.Canvas(master=window, width=500, height=...
cb9fdd0be3a68065acc48de31bebd37f0e40b5e0
MisaelGuilherme/100_Exercicios_Em_Python
/Desafio 58.py
427
3.765625
4
print('====== DESAFIO 58 ======') from random import randint aleatory = randint(1,10) palpite = 0 print('-----TENTE ACERTAR-----') acert = int(input('Digite Um Número Entre.. 1 a 10: ')) while acert != aleatory: print('Você Não Venceu a Máquina.. :(') acert = int(input('Tente novamente: ')) palpite += 1 if ...
da62f88642263982d514f87d6f7f9b66163704a5
ccmorenosa/Temp
/animation with python/main.py
1,915
3.6875
4
"""Serie de Fourier animada.""" from matplotlib import pyplot as plt from matplotlib import animation import math """ Este código genera un archivo mp4 con una animación de la serie de Fourier de una función con n terminos. Lorena Bucurú Rodriguez; Andŕes Felipe Moreno Sarria """ """Cofigurar las figuras, los ejes y...
0439c9cecf4c81da66333dadd6764553da501ad8
dack-c/osp_repo2
/py_lab2/my_pkg/bin_conversion.py
234
3.65625
4
#!/usr/bin/python3 def converse (): b = input("input binary number: ") b_string = '0b' + b result = "OCT> {0:o}\nDEC> {0:d}\nHEX> {0:x}".format(int(b_string, 2)) print(result) if __name__=="__main__": converse()
b14e606930edf0aabe61cef77d215d15e43d0054
biabulinxi/Python-ML-DL
/Pandas/pandas_day_01/pandas_day_01/pandas_student/practice.py
512
3.640625
4
import numpy as np import pandas as pd # 创建DataFrame df = pd.DataFrame([['Snow','M',22],['Tyrion','M',32],['Sansa','F',18],['Arya','F',14]], columns=['name','gender','age']) print(df) #选取多列,gender和age列 print(df.ix[:,1:3]) #读取第1行到第2行的数据 print(df.head(2)) print(df[:2]) #读取第1行和第3行,从第0列到第2列,不包括第二列 print(df.ix[df.index%2=...
b067460f2066223dbae201b79e442d3448ac09a4
kendra770/Python_WeatherApp
/main.py
3,152
3.609375
4
import requests import tkinter as tk from tkinter import * import json from PIL import ImageTk, Image class WeatherApp: def get_data(city): image_type = "default.jpg" # API KEY and URL for pulling the Weather Data# global api_key api_key = global url url = "ht...
f5f5a6d53beb3b47a921b5e77e4a8edd02bae863
llpk79/DS-Unit-3-Sprint-1-Software-Engineering
/module2-oop-code-style-and-reviews/packaging/helper/delete_columns.py
372
3.84375
4
import pandas as pd class DeleteColumn(object): """Delete and return given column from DataFrame. """ def __init__(self, data: pd.DataFrame, column_to_delete: str) -> None: self.df = data self.column = column_to_delete def delete_column(self) -> pd.DataFrame: self.df = self....
a8594c00a0fbe54f015cdf754df6852389ee8c17
pisuduo/Play-with-Python
/Algorithms/Hashmaps/Ice cream parlor.py
704
3.53125
4
### Basic solution: O (n^2) ### import os import re import sys def icecreamParlor(m, arr): for i in range(len(arr)): for j in range(i+1,len(arr)): if arr[i]+arr[j]==m: return i+1,j+1 ### Turn it into a search problem, given first element, find the second element: m-element1 ###...
1ae36388c286daad1d37d101d9ca05db4bd7384a
mamatha20/ifelse_py
/IF ELSE_PY/if else4.py
276
4.34375
4
#write a program to check whethernit is alphabet digit or special character ch=input("enter any character=") if ch>="a" and ch<="z" or ch>="A" and ch<="Z": print("it is alphabet") elif ch>="0" and ch<="9": print("it is digit") else: print("it is special charcter")
7f259e2f19958b6b1745792b6b266a1cbf13ed4b
TetianaHrunyk/DailyCodingProblems
/challenge142.py
1,105
4.21875
4
"""You're given a string consisting solely of (, ), and *. * can represent either a (, ), or an empty string. Determine whether the parentheses are balanced. For example, (()* and (*) are balanced. )*( is not balanced.""" def is_balanced(s: str): opened = 0 closed = 0 stars = 0 stars_needed = [] f...
f4af0bee28b6b3e67ee3649baaf7e69f9c8f58ae
sdbarnes/R1
/3.2.7_cranston2.py
1,030
3.6875
4
# -*- coding: utf-8 -*- """ Created on Sun Aug 4 19:24:38 2019 @author: Scott """ story = "A" text = "D" role = "A" director = "B" cast = "B" ss = 0 ts = 0 rs = 0 ds = 0 cs = 0 score = 0 if story == "A": ss=6 elif story == "B": ss=5 elif story == "C": ss=4 elif story == "D": ss...
095dd69151e25bbc06345b8c8493bcba55a48e7a
PiotrPosiadala/PythonLearning
/S001_L009.py
330
3.71875
4
projects = ['Brexit', 'Nord Stream', 'US Mexico Border'] leaders = ['Theresa May', 'Wladimir Putin', 'Donald Trump and Bill Clinton'] dates = ['2016-06-23', '2016-08-29', '1994-01-01'] for n, (project, date, leader) in enumerate(zip(projects, dates, leaders)): print("{}. The leader of {} started {} is {}".for...
e6630e460681cda3cd5811154eb3723489b2770f
AkashKumarSingh11032001/100-Days-Python-Bootcamp-By-AngelaYu
/Day 9 - Beginner - Dictionaries, Nesting and the Secret Auction/Day9_Project.py
573
3.5625
4
from logo import logo from replit import clear def fina_res(user): for i in user: x = max(user[i]) return x print(logo) print("Welcome to the SECRET AUTION program.") user = {} more_user = True while(more_user): user_name = input("What's your name?: ") user_bid = input("What's your bid?: ")...
ea747f1448264e10a017174e3fecd5d97295787c
sdksfo/leetcode
/medium_360. Sort Transformed Array.py
1,098
3.53125
4
# Approach: Checked hint: Parameter A in: A * x^2 + B * x + C dictates the shape of the parabola. # Positive A means the parabola remains concave (high-low-high), but negative A inverts the parabola to be convex (low-high-low). # Based on value of A, determine if the output array have to be filled from the right to l...
bbe9fa8146a540af1232b4a6c791135ec15c2787
hubert1980/Adventure-Game
/new.py
1,794
3.765625
4
import time import random options = ["1", "2"] def print_smooth(message_to_print): print(message_to_print) time.sleep(3) def field(): print_smooth("You find yourself standing in an open field, " "filled with grass and yellow wildflowers.") print_smooth("Rumor has it that a gorgon ...
8894bd1bd979af7241de734dd3fb0a9ac90732fb
dthores1/algoexpert-problems
/group-anagrams.py
2,606
4.1875
4
""" Write a function that takes in an array of strings and groups anagrams together. Anagrams are strings made up of exactly the same letters, where order doesn't matter. For example, "cinema" and "iceman" are anagrams; similarly, "foo" and "ofo" are anagrams. Your function should return a list o...
ff105fcdd30d2fd512d96f112c66753aa5715233
jlese/CS-1111
/c2f.py
403
4.0625
4
ctemp = float(input("What is the temperature in Celsius? ")) def celsius_convert(): """ convert given celsius to fahrenheit """ global ctemp ctemp = (9 * (ctemp + 40) / 5) - 40 return ctemp celsius = celsius_convert() print("It is " + str(celsius) + " degrees Fahrenheit") ...
f483cef9d491d719cb1ed3a3b6ab0a8fc379d30a
ZaneBliss/feed_critters
/feed_critters.py
1,862
4
4
from datetime import date class Donkey: def __init__(self, name, species, shift, food): self.name = name self.species = species self.walking = True self.date_added = date.today() self.shift = shift self.food = food def feed(self): print(f'{self.nam...
ba09a2c8d9cc3e12df0ee2bf2bcfa9bf5eda9bd9
scottrfrancis/Pentair-Thing
/Observer.py
3,599
3.703125
4
# Basic (simplistic?) implementation of Observer pattern # ''' To Use: - subclass Observable for a thing that chagnes - subclass Observer for the things that will use those changes - Observers call Observable's #addObserver to register and #removeObserver to stop - When the thing (the Observable) changes, #notifyObs...
95168e6c3bc97315aaab69e564b16ce43a33bf6b
steven-shi/LeetcodeSolutions
/algorithms/third-maximum-number.py
1,185
4.09375
4
''' 414. Third Maximum Number Given a non-empty array of integers, return the third maximum number in this array. If it does not exist, return the maximum number. The time complexity must be in O(n). Example 1: Input: [3, 2, 1] Output: 1 Explanation: The third maximum is 1. Example 2: Input: [1, 2] Output: 2 Ex...
be237165c1536d8698fd49623e41525f76eb4e68
mikelego3ds/ecuacion_segundo_grado
/ecuacion2.py
333
3.640625
4
import math import os a=int(input("valor a:")) b=int(input("valor b:")) c=int(input("valor c:")) b2: float = math.pow(b, 2) res = -4*a*c res2 = b2+res rai = math.sqrt(res2) sp: object = ((-b+rai)/(2*a)) sn: object = ((-b-rai)/(2*a)) print("Primera Solucion:") print(sp) print("Segunda Solucion") print(sn) os.sy...
4ba1f77c734b6cfe2972fa4a35928633811e3faf
2464326176/python
/datatype/5.py
890
4.25
4
#身份运算符 # is is 是判断两个标识符是不是引用自一个对象 x is y, 类似 id(x) == id(y) , 如果引用的是同一个对象则返回 True,否则返回 False # is not is not 是判断两个标识符是不是引用自不同对象 x is not y , 类似 id(a) != id(b)。如果引用的不是同一个对象则返回结果 True,否则返回 False。 a = 20 b = 20 if ( a is b ): print ("1 - a 和 b 有相同的标识") else: print ("1 - a 和 b 没有相同的标识") if ( id(a) == id(b) ): ...
1cf8bb04756bcbf389797489cbd236e7d265faee
ii200400/algorithm
/Codility/Lessons/7-4.StoneWall.py
1,324
3.65625
4
# 스택을 이용하여 만들었다, 우선 수를 무조건 더하고 특정상황이면 빼도록 만들었다. def solution(H): answer = 0 stack = [] for h in H: #print(stack, answer) answer += 1 index = len(stack) - 1 while index >= -1: if index == -1: stack.append(h) ...
748049a458707bc11a07ee998bb1074c13f4a8a4
smile0304/py_asyncio
/chapter02/test.py
217
3.671875
4
class Company(object): def __init__(self,employee_list): self.employee = employee_list def __str__(self): return ",".join(self.employee) company = Company(["tom","bob","jane"]) print(company)
6f71aea02df7658b4efba9621e158f93075af0be
Gafanhoto742/Python-3
/Python (3)/Aula/aula019_dicionarios.py
2,242
3.8125
4
#dicionários # mostrando o dicionário inteiro pessoas = {'Nome': 'Henrique','Sexo':'M', 'Idade':'35'} print(pessoas) # mostrar 1 intem do dicionário pessoas = {'Nome': 'Henrique', 'Sexo':'M', 'Idade': '35'} print(pessoas['Idade']) print(pessoas.keys()) # como mostrar tudo que tem dentro da chave print(pessoas.valu...
d3484bcb2786648d14a4f84a87d9490dd0c3fbf4
Mam-Mad/Quera.ir
/جمع-بزرگان.py
204
3.734375
4
""" Question: https://quera.ir/problemset/contest/2551/سؤال-جمع-بزرگان """ x1 = int(input()) b = input() x2 = int(input()) if b == '+': print(x1 + x2) elif b == '*': print(x1 * x2)
771330114a6da08dd93708fa8e411b4ff08144ef
brandonbluong/github-upload
/Monty Hall.py
2,158
4.3125
4
# Write a program that simualates the Monty Hall Problem and prove numerically why you should always switch. # Two inputs: number of games and switch/stay """ Suppose you're on a game show, and you're given the choice of three doors: Behind one door is a car; behind the others, goats. You pick a door, say No. 1, and ...
a50e4a037e53572ba60660cf116f3829c6e97084
jkim1528/python1
/Basic/8.py
1,459
3.953125
4
class Animal(): # 親クラス def walk(self): print("Walking") def eat(self): print("Eating") def greet(self): print("Greeting") class Human(Animal): # Animal()の子息クラス1、だからparameterはAnimalしかもらえない。 def walk(self): print("Walking") def eat(self): print("Eating") de...
2e675bd59ec62106482352cb17a5c3be0f70ac92
monpro/algorithm
/src/binary-trees/populating-next-right-pointers-in-each-node-ii-117.py
682
3.828125
4
class Node(object): def __init__(self, val, left, right, next): self.val = val self.left = left self.right = right self.next = next class Solution(object): def connect(self, root): """ :type root: Node :rtype: Node """ head = root while head: nextHead = No...
2cb66210bca4399e00ef29b3309e33fd7440df06
DRomanova-A/Base_project_python
/основы программирования python (ВШЭ)/solutions/week-2/train_2_01_king.py
1,120
3.609375
4
''' Ход короля (тренировочное задание) Шахматный король ходит по горизонтали, вертикали и диагонали, но только на 1 клетку. Даны две различные клетки шахматной доски, определите, может ли король попасть с первой клетки на вторую одним ходом. Формат ввода: Программа получает на вход четыре числа от 1 до 8 каждое, зад...
333ca68c617d24b2c5c154a0b2e6256129ae7dc8
paduck210/python-basic-practice
/Study/ex_06_01/ex_06_02_mail.py
767
3.78125
4
info = "jung.yu@klook.com 010-2809-1408 유현정" #메일주소 찾기 mail = info.find("@") print(mail) office = info.find(" ",mail) print(office) full = info[mail+1 : office] print(full) #번호찾기 number = info.find("010") print(number) phone = info.find(" ",number) print(phone) fullnum = info[number : phone] print(fullnum) ...
8bd3ee8ef516cb403c8ae389df2f148cc7ab5178
atulya-kairati/project_euler_python
/problem_42/problem_42.py
1,182
3.921875
4
# The nth term of the sequence of triangle numbers is given by, tn = ½n(n+1); so the first ten triangle numbers are: # 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... # By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, the wo...
67bcedbef97236324dab08e359296da8a28dd436
mmacdonnacha/capture-the-flag
/SHELL CTF/Cryptography/Algoric-Shift/script.py
506
3.609375
4
# text = 'flag{...}' text = 'SHELL{TRAN5P051T10N_C1PH3R}' key = [3,1,2] li0 = [] li1 = [] li2 = [] for i in range(0,len(text)): if i % 3 == 0: li0.append(text[i]) elif (i - 1) % 3 == 0: li1.append(text[i]) elif (i - 2) % 3 == 0: li2.append(text[i]) li = [] for i in ...
2d76d849a8fe6e5ee18ddbf9559a9eccb79de7aa
CodingBucket/PythonBucket
/basic/python.ds.py
4,197
3.953125
4
# List: # A list is a collection which is ordered and changeable. li = [1, 2, 3, 4] li2 = list(range(5)) # out: [0, 1, 2, 3, 4] li.reverse() # Reverse the actual list li.sort() # Sort the actual list li.insert(0, 0) # Insert item in specific index, insert(index, item) li.append(4) #...
81f517ab2961cf850cb15ed01b4aff1679c3d9a2
AlexBMECS/ixperience_2018_personal
/Day_1_Excercises/Week1Assignment.py
1,237
3.671875
4
# -*- coding: utf-8 -*- """ Created on Mon Jun 25 17:13:44 2018 @author: alexrazer """ #%% #Prints out the numbers from 1 to 100 with multiples of 3 as Fizz, multiples of 5 as buzz and of both as fizzbuzz for n in range(101): if n%3 == 0 and n%5 == 0: print("FizzBuzz") elif n%3 == 0: print("Fiz...
dbb0c5d7b4d40024a6a1515f07dc9c7d4338f596
amjadzaghloul/datetime
/datetime.py
425
4.09375
4
import datetime def daysBetweenDates(): year = datetime.date.today().year month = datetime.date.today().month day = datetime.date.today().day date1 = datetime.date(int(raw_input("Enter your year")),int(raw_input("Enter your month")),int(raw_input("Enter your day"))) date2 = datetime.date(year,month,...
a5a6291ae9020ea8486de6cde5cba1dc9910d197
cal-moh/pythonhardway
/ex11.py
880
4.21875
4
# end='' suppresses the next line character print("How old are you?", end='') # clear input function age = input() # input() has a built in print prompt it seems. Also, it strips out the default end-of-line newline character when it reads and writes this. Finally, it converts this to a string height = input("How tall a...
900435a85d9194d672f06946974d8e7965621608
yuuuhui/Basic-python-answers
/梁勇版_5.5.py
267
3.625
4
print(" kg \t pounds \t kg \t pounds") k = 9.09 while k < 235: for i in range(1,200): print(str(format(i,">5.1f")) + str(format(i * 2.2,">10.2f")) +"\t" + "\t" + str(format(k,">6.2f")) + str(format(k * 2.2,">10.2f"))) k += 2
ac37ff741ec79bb60028298019a53c3979712d9a
liketheflower/Hough-Transform
/assignment3_h3.py
4,015
3.78125
4
# coding: utf-8 import numpy as np import math import matplotlib.pyplot as plt import assignment3_h2 import assignment3_h1 def get_max_rou(output_binary_edge_image): return int(math.sqrt(output_binary_edge_image.shape[0]**2+output_binary_edge_image.shape[1]**2)) def get_y_hough_array(rou,hight_of_hough_image, max...
a0761db7c6ae50ccda30e4b2ba02339c09ec59ab
flightdutch/Python-HomeTasks
/L7.Theory/9Properties_Decorator.py
564
4.1875
4
# иллюстрация механизма свойст класса """ Инкапсуляция Методы Свойства Скрытые поля """ class A: __value = 4 @property def value(self): print('get value') return self.__value @value.setter def value(self, new_value): print('set value') self.__value = new_value a...
49e6ad4ebe89d1b4feae19a11b6a97abbd662074
dikkenboerden/cardgamewar
/house.py
678
3.53125
4
from dataclasses import dataclass, field @dataclass class House: # def __init__(self, price): # self._price = price _price: int price: int = field(init=False) def __post_init__(self): self.price = self._price @property def price(self): return self._price @price.se...