blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
fc7f2fd051671ed5405a7bd53aa647b3ff65c089
atreyd/PythonProject1
/Set.py
211
3.875
4
my_set = {1,2,3,4,4,5,6,5,7,8,9,2,10} my_set_1 = {2,5,9,11,12,13,14,1,5} # print(my_set) print("Union", my_set|my_set_1) print("Intersection", my_set & my_set_1) print("Difference", my_set - my_set_1)
3cbfeb322a8b49506b3f9e03a1cf7ac4a69b988a
shifelfs/shifel
/75.py
338
3.875
4
a=input() mid=len(a)//2 if len(a)%2!=0: for i in range(len(a)): if i==mid: print("*",end="") else: print(a[i],end="") else: for i in range(len(a)): if i==mid or i==mid-1: print("*",end="") else: print(a[i],end="") ...
971517e0fcc748b2bd90b86d9493803cca7494a4
xiaolcqbug/aiai
/myc/m0903月考/1题.py
610
3.8125
4
# 1.进程两种写法 # from multiprocessing import Process # # def eat(who,what): # print('{}正在吃{}'.format(who,what)) # # if __name__ == '__main__': # p1=Process(target=eat,args=('小明','肯德基')) # p1.start() print('-----------------') # from multiprocessing import Process # # class Play1(Process): # def __init__(s...
f7d68866ba908974f01077a09d7bfa0a7fbc1b3c
Benji-Saltz/Advanced-projects
/Recursion/Palendrome recursion.py
899
4.40625
4
##By: Benji Saltz ##Date March 27, 2018 ##Description: Program finds out if a word is a palendrome or not. from functools import lru_cache @lru_cache(maxsize=1000) def Pal(word1): word1=word1.lower() if len(word1)<=1:#if the word is a letter or less, then return the letter as it is its own word. return ...
8d7468912622a7845762133cf40b938f54dfdb15
gurtejgill/Python-Examples
/RockPaperScissor.py
1,051
4.0625
4
from random import randint options = ['r','p','s'] won = False while won == False: userInput = input("Enter r for rock, p for paper or s for scissor> ") computer = options[randint(0,2)] if userInput == computer: print("Tie!!") elif userInput == 'r': if computer == 'p': pr...
1278599de8d7338abc843aab8a87f1d375b7e31d
prof-paradox/project-euler
/4.py
381
3.96875
4
''' Calculates the maximum palindromic product of 2 3-digit numbers ''' n = 999 max_palin_prod = 1 def isPalindrome(prod): return True if str(prod) == str(prod)[::-1] else False for i in range(n, 100, -1): for j in range(i - 1, 100, -1): if isPalindrome(i * j) and (i * j) > max_palin_prod:...
f22e91216d9954227f5ee70be4b98bece6205064
aliyyousuff/MOOC
/UTAx-CSE1309X/finalP6.py
939
3.546875
4
__author__ = 'Mohammad Yousuf Ali, aliyyousuf@gmail.com' D = {'Accurate': ['exact', 'precise'], 'exact': ['precise'], 'astute': ['Smart', 'clever'], 'smart': ['clever', 'bright', 'talented']} def reverse_dictionary(D): D3 = {} for k,v in D.items(): D3[k.lower()] = [x.lower() for x in v] ...
39565e84358a931e61272ec92490d06ea37069e7
jitudv/python_programs
/recursionTest.py
735
3.578125
4
"this is my main method test program " import sys print("this is my show program ") var =0 def show(var): print("hello") var =var+1 if(var <10): show(var) #show(0) def main(): show(0) print("%s"%__doc__) __doc__ show(2) def TesPro(): global var print("value of globa...
9b57b3b7f88b746d7781ff6f8549206e4dec43c1
kiman121/password-locker
/test_credentials.py
4,851
3.78125
4
import unittest from credentials import Credentials import pyperclip class TestCredentials(unittest.TestCase): ''' Test class that defines test cases for the credentials class behaviours Args: unittest.TestCase: TestCase class that helps in creating test cases ''' def setUp(self): '...
0f3835112a2e7315590e20961b6779b5d1453c7d
DanielSzpunar/python
/MITx6001/wk1_exercise_counting_vowels.py
219
4.125
4
string = "string" totalVowels = 0 for f in string: if f == "a" or f == "e" or f == "i" or f == "o" or f == "u": totalVowels += 1 print("the total amount of vowels in the string entered are:", totalVowels)
cc5dbd9e5a77638aef48f5da3bf3b692930bf85e
rees3901/Chapter-2
/2.6.1.9 LAB_rees input(float) (2).py
207
4
4
a = float(input("Enter first value: ")) b = float(input("Enter second value: ")) print("Addition:, a + b \n Subtraction:, a - b \n Multiplication:, a * b \n") print() print("\nThat's all, folks!")
d8a2c86db6829d4c0c36315ab79a950fb3f0ac1d
Manolakos/uni-apps
/ergasia9.py
288
3.859375
4
number = int(input("Type a number: ")) def f(x): x = x*3 + 1 x = str(x) y = 0 for j in range(len(x)): y = y + int(x[j]) return y rep = f(number) print(rep) if rep >= 10: while rep >= 10: print(f(rep)) rep = f(rep)
4a0221d7c3359a3c54e4f144c9ceca805e4e6746
vrnsky/python-crash-course
/chapter7/rental_car.py
111
3.65625
4
car = input('Enter a car which you would like to rent: ') print("Let me see if I can find you a", car.title())
8309b9e961b700e0f82245e1e3fdb6146cffe99f
Tushargohel/Assignment_py
/Asssignment1/prog_12_assignment1.py
65
3.703125
4
x = 9 y = " is a square of " z = 3 T= (str(x)+y+str(z)) print(T)
813a85e9752b5e52a3c954f0c94845dbc6c0de1c
talelakshman/python
/Assignment_003.py
391
3.890625
4
list = [] second_lowest_names = [] scores = set() for _ in range(int(raw_input())): name = raw_input() score = float(raw_input()) list.append([name, score]) scores.add(score) second_lowest = sorted(scores)[1] for name, score in list: if score == second_lowest: second_lowest_names....
d7d207c4ce503b9e6ddbd1fec4e708e28f8c8a9c
FreemanMeng1991/-Automated-Test
/unit_test - Copy.py
7,742
3.515625
4
import unittest,testonly import math class TestStringMethods(unittest.TestCase): #实例化一个TestCase类,该实例用来存放测试用例 #执行单元测试时的函数调用顺序: #run()->setUp()->test_xxx()->tearDown()->doCleanups() # def setUp(self): # print("Set up") # def tearDown(self): # print("Tear down") # def doCleanups(send_keys): ...
a3275f21de1029aaa2104dba0dc3b4f6231b8174
Aasthaengg/IBMdataset
/Python_codes/p03844/s825086462.py
162
3.5625
4
def main(): a,op,b = (x for x in input().split()) if op == '+': print(int(a)+int(b)) else: print(int(a)-int(b)) if __name__ == '__main__': main()
de70464a86139dedc452a1ca5042bf1ff96183a1
jcclarke/learnpythonthehardwayJC
/python3/exercise12/ex12.py
241
4.1875
4
#!/usr/bin/env python3 age = input("How old are you in years? ") height = input("How tall are you in cm? ") weight = input("How much do you weigh in lbs? ") print (f"So, you're {age} years old, {height} cm tall, and {weight} lbs heavy.")
7f06ec741747e5551ac76fff6afd330278d3d761
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/mark_mcduffie/Lesson5/mailroom_part3.py
4,627
3.875
4
''' Mark McDuffie 3/20/19 Mailroom part 2 It should have a data structure that holds a list of your donors and a history of the amounts they have donated. This structure should be populated at first with at least five donors, with between 1 and 3 donations each. You can store that data structure in the global namespac...
e37ba4b83be20e4b1fc2930522d9a5b0f2477630
wangyu33/LeetCode
/LeetCode657.py
659
3.53125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # File : LeetCode657.py # Author: WangYu # Date : 2020-08-28 class Solution: def judgeCircle(self, moves: str) -> bool: if moves == '': return True index = [0,0] for s in moves: if s == 'U': index[0] = ...
a80275d55240c65a4e3e7736959fde482d2a085b
Milittle/fluent_python
/chapter-03/chapter-3-5.py
927
3.796875
4
#!/usr/bin/python #-*- coding: utf-8 -*- # author: milittle # index.py uses dict.setdefault to fetch and update a list of word occur‐ # rences from the index in a single line Example 3-4. import re import collections import sys WORD_RE = re.compile('\w+') def test(): index = collections.defaultdict(list) #用什么作为默...
e1d022aecbf010f584cee71a867eed8b6fba143c
CarlStevenson/schoolwork
/cs125/labs/2/num.py
278
3.953125
4
# # A program for numbers # a = 3 - 4 + 10 b = 5 * 6 c = 7.0/8.0 print ("These are the values:", a, b, c) print ("Increment", a, "by one: ") a = a +1 print (a) print ("The sum of", a, "and", b, "is") d = a + b print (d) number = eval(input("Input a number ")) print (number+5)
b0dfd4304202a58984c38f1974b4082b59f9f562
HodardHazwinayo/PurePPython
/index.py
1,010
4.4375
4
# the first option to format strings. age = 20 name = 'Hodard' print('{0} was {1} was testing the python app'.format(name, age)) print('why is {0} playing with that python!'.format(name)) # Python 3.6 introduced a shorter way to do named parameters, called "f-strings" age = 20 name = "Hodard" print(f'{name} was {...
ff34a211a2960eee4b6ef9aa6d7e6cf6397e5fe7
Vsooong/leetcode
/string/zigzag-conversion.py
1,324
3.546875
4
import math class Solution: # def convert(self, s: str, numRows: int) -> str: # if numRows == 1 or len(s) == 1: # return s # cols = math.ceil(len(s) / (2 * numRows - 2)) * (numRows - 1) # stringMatrix = [[" "] * cols for _ in range(numRows)] # up_down = 1 # lef...
464c2711c61b2a376ff9cdd076632645e26cb765
laligafilipina/collectives
/codewarskata/first_non_repeating_character.py
313
3.6875
4
def first_non_repeating_letter(string): low_str = [] for i in string: low_str.append(i.lower()) for i in string: if low_str.count(i.lower()) == 1: return i return '' # Test Cases print(first_non_repeating_letter('sTreSS')) print(first_non_repeating_letter('stress'))
81d61bbb0b76b8fb42cc5f3c0cc2bba807b9196a
csgear/python.for.kids
/basic2/loops/boring.py
1,491
3.671875
4
def menu_is_boring(meals): """Given a list of meals served over some period of time, return True if the same meal has ever been served two days in a row, and False otherwise. """ for i in range(1, len(meals)): if(meals[i] == meals[i-1]): return True return False def elementwi...
eee8c097a5a5ef9e6c3e07cf31c77735b2dc4991
aces8492/py_edu
/basics/tuple.py
312
4.0625
4
#list items_list = [50,80,450] #tuple items_tuple = (50,"apple",32.5) for item in items_tuple: print(item) #it can't re-write value of tuple #items[0] = 20 #convert list <-> tuple print(list(items_tuple)) print(tuple(items_list)) tuple2list = list(items_tuple) tuple2list[0] = "banana" print(tuple2list)
eb1566798d81faa23b58e88824063ba9f3f6b5a6
wonjongah/JAVA_Python_Cplusplus
/Python/chapter10. 사전과 집합/dicread.py
142
3.671875
4
dic = {'boy':'소년', 'girl':'소녀', 'book':'책'} print(dic.get('student')) print(dic.get('student', "사전에 없는 단어입니다."))
ad26369f4604e004c833e44366821cbf0748bbbc
jundi/kyykka-ranking
/player.py
2,423
3.578125
4
"""Simple player database""" from utils import str2list class Player(): """Player class""" def __init__(self, identity, name, serie='MM', aliases=None): if not aliases: aliases = [] self.id = identity self.name = name self.aliases = aliases self.serie = seri...
90c2b0f5e63085ad2b51736649e6aa29ad6019ad
kerenizon/web-scraping
/web_scraping_Keren_Izon.py
2,118
3.640625
4
# -*- coding: utf-8 -*- # the script assumes that the input sites are written in Hebrew language bacause of encoding issue. # when printing to screen run the command: chcp 65001 ,and then run the script. import requests # required to install the following: pip install BeautifulSoup4 from bs4 import BeautifulSoup from ...
d3589e6bb25ce99b35ba031ad2c3cfd7a7756111
ruirodriguessjr/Python
/EstruturaSequencial/ex03OperacoesBasica.py
567
4.0625
4
n1 = float(input("Informe o primeiro valor: ")) n2 = float(input("Digite o segundo valor: ")) print("A soma dos valores é: {}.".format(n1+n2)) print("A subtração dos valores é: {}.".format(n1-n2)) print("A multiplicação dos valores é: {}.".format(n1*n2)) divisor = int(input("Qual número você quer que divida o outro, 1 ...
4e3b685d50ee042b1956bd25f1c05ca12b7f7f4b
sculiuyun/Data-Structure-Impl-With-Python
/sort/select_sort.py
644
4.03125
4
#!/usr/bin/env python # encoding: utf-8 #简单选择排序的第i趟是从数组中选择第i小的元素,并将元素放在第i位上 def select_sort(data_array,n) : for i in range(n-1) : low_index = i #记录data_array[i...n-1]中最小元素的下标 for j in range(i+1,n) : if data_array[j] <data_array[low_index] : low_index = j swap...
6e083d107328421eca26d827ae169a5564f5236c
scotttct/tamuk
/Python/Python_Abs_Begin/Mod1/p1_types.py
198
3.875
4
# score = 3 + "45" # print(score) # PriNt("Hello World!") # answer = input("enter your answer: ") # print(10 + answer) # answer = input("enter your answer: ") # print("You entered " + answer)
b4e8506bce651c732cf8656d818e00a65aaf2cf7
dwm-2018/Document-Search
/services/utils.py
511
3.53125
4
import re def print_result(result): print("\nSearch Results:") if len(result) == 0: print('Search term was not found. \n') result = sorted(result, key=lambda i: i['occurences'], reverse=True) for entry in result: print("{file_name} - {occurences}".format(file_name=entry['file_name'], ...
c7d27c8084a56b904b2a51422c1a6919327f6e06
haoyujie/HyjPythonExamples
/guru99/Eg4_PythonVariables.py
530
4.0625
4
# https://www.guru99.com/variables-in-python.html#1 # Declare a variable and initialize it f = 101 print(f) # Global vs. local variables in functions def someFunction(): # global f f = 'I am learning Python' print(f) someFunction() print(f) print("======func2============") # Global vs.local variables in functio...
495fb12e6fdf778e2668e38ac9571d6e8e2e7928
Wendy-Omondi/alx-backend-python
/0x00-python_variable_annotations/7-to_kv.py
234
3.703125
4
#!/usr/bin/env python3 """type-annotated function to_kv""" def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]: """takes a string k and an int OR float v as arguments and returns a tuple.""" return(k, v * v)
4770888e88605c78bd1c23beb8a869f9cc7e68f5
guptaharshnavin/Hackerrank_Problem_Solving_Soln
/Climbing_The_Leaderboard.py
1,654
3.875
4
#!/bin/python3 import math import os import random import re import sys # Complete the climbingLeaderboard function below. def climbingLeaderboard(scores, alice): sorted(scores,reverse = True) #print(f'Scores : {scores}') #print(f"Alice's Scores : {alice}") alice_ranks = [] rank_coun...
be27125d2e650d43afe7ddd671955b647de51215
cjreynol/chadlib
/chadlib/collection/stack.py
650
3.8125
4
class Stack: """ A standard stack data structure that supports peek, pop, push operations. List based version where the tail end of the list is the top of the stack. """ def __init__(self, *args): self.data = list(args) @property def is_empty(self): return not bool(s...
7da928f1d32ce08614dffea006c84a1d7c1fe1a7
drajashe/Leetcode
/Udemy Data structures and Algorithms in Python/Graphs/BreadthFirstSearch.py
611
4.09375
4
#visit dictionary will have the pointer indicating whether a node is visited or no #queue will maintain the the node which is visited for checking its neighbours import queue #https://www.youtube.com/channel/UCliJsnOQEU9ZkWEE7Vtryng/videos # From class queue, Queue is # created as an object Now L # is Queue of a maximu...
cbaf4587c97b8ebefad652520ed0af798480e29f
wechuli/python
/refresher/object-oriented-python/inheritence/multiple-inheritence/basic.py
1,297
4.25
4
class Aquatic: def __init__(self, name): print("Aquatic Init") self._name = name def swim(self): return f'{self._name} is swimming' def greet(self): return f'I am {self._name} of the sea' class Ambulatory: def __init__(self, name): print("Ambulatory Init") ...
669e2e29c7dc9531890d6a31be61191a177467b4
Mackleroy/Black-Jack-as-OOP
/black_jack.py
3,205
3.53125
4
import random class Card: def __init__(self, rank: str, suite: str) -> None: self.rank = str(rank) self.suite = suite def index(self) -> str: return f'{self.rank}{self.suite}' def get_value(self, points: int) -> int: if self.rank in 'ВДК' or self.rank == '10': ...
1bd04f6ca331dcbc0a4b0e6ff4988bd047212462
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/thomasvad/lesson2/gridprinter.py
763
3.65625
4
def line1(col,size=1): for i in range(col): print('+'+'-'*size,end='') print('+') def line2(col,size=1): for i in range(col): print('|'+' '*size,end='') print('|') # print 2x2 grid size 4X4 cells def grid(): for i in range(2): line1(2,4) for i in range(4): ...
232e1e22bb72932e60d27e1800cb30c81ab5bd2b
JuanDavidDava2/holbertonschool-web_back_end
/0x03-caching/1-fifo_cache.py
1,355
3.953125
4
#!/usr/bin/python3 """ FIFO caching""" from base_caching import BaseCaching class FIFOCache(BaseCaching): """ Create a class FIFOCache that inherit from BaseCaching and is a caching system """ def __init__(self): super().__init__() self.data = {} self.data_in = 0 s...
bbd42a250881379602eda9800c47fdabf6ecefa9
jalongod/LeetCode
/34.py
1,987
3.734375
4
''' 34. 在排序数组中查找元素的第一个和最后一个位置 给定一个按照升序排列的整数数组 nums,和一个目标值 target。找出给定目标值在数组中的开始位置和结束位置。 你的算法时间复杂度必须是 O(log n) 级别。 如果数组中不存在目标值,返回 [-1, -1]。 示例 1: 输入: nums = [5,7,7,8,8,10], target = 8 输出: [3,4] 示例 2: 输入: nums = [5,7,7,8,8,10], target = 6 输出: [-1,-1] 来源:力扣(LeetCode) 链接:https://leetcode-cn.com/problems/find-first-a...
2726b704dcc1a35fc6c3135d507044ab24c402bb
brianchiang-tw/leetcode
/No_0530_Minimum Absolute Difference in BST/minimum_absolute_difference_in_BST_by_inorder_recursion.py
1,993
4.125
4
''' Description: Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 / 2 Output: 1 Explanation: The minimum absolute difference is 1, which is the difference between 2 and 1 (or between 2 and 3). No...
b42797e30032c1d61df1cd98c3312e9567c99bb7
Sunaag/Python-for-Everybody
/7_1.py
224
4.1875
4
# Use words.txt as the file name fname= input("Enter file name:") try: fh = open(fname,'r') except: print("Check for the file name again") quit() for line in fh: line= line.rstrip() print(line.upper())
8477df6a1a83033902a1d02eb75c59577609f061
Viper-code/Pass_Pin_Gen
/pass_pin_gen.py
5,158
4.3125
4
import string import random import time password = "" pin = "" nitro = "" start = input('''\nHello and welcome to the password and pin generator made by Shujah Type "pin" to gen a 4 number pin Type "pass" to gen a password where you can choose how much ...
e3ec80db127a302bf1a28fd2b78a5ab3d8f5d1a7
juanfcosanz/Python
/Ejercicios/condicionales4.py
233
3.828125
4
minutos = int ( input(" -> Minutos utlizados: ")) if minutos < 200: precio = 0.20 elif minutos <= 400: precio = 0.18 elif minutos <=800: precio = 0.15 else: precio = 0.08 print("\n Total a pagar P/. %6.2f " %(minutos * precio))
c6b1f9b219edeb41af7605602edcc45cfa850e79
dhrubach/python-code-recipes
/binary_tree/e_max_depth.py
2,338
3.890625
4
##################################################################### # LeetCode Problem Number : 104 # Difficulty Level : Easy # URL : https://leetcode.com/problems/maximum-depth-of-binary-tree/ ##################################################################### from binary_search_tree.tree_node import TreeNode fro...
8e393c8ba45dc01f535946e0b384f074e1681dab
Bassman1503/Bassman1503
/mutable_object.py
667
4.5
4
# In this example a mutable object will be used to show that changing the value # of one of its attribute will change the id of the attribute object, but not # of the object itself. # # Definition of a class to describe some characteristics of a person # class Person: def __init__(self, age): self.age= a...
68114ed9027f568b95f14144fe38456a48803038
IneffableBunch/Hangman
/hangman/engine.py
612
3.75
4
from random import randint from hangman.hmmanager import Word def game_engine(): randwords = ['daughter', 'development', 'amusement', 'birthday', 'cakes', 'cloth'] game_word = randwords[randint(0, 5)] game_max_guesses = round(len(game_word) * 1.3) hmgame = Word(game_word, game_max_guesse...
2bd9a7b9f85108ce2867bedfe0cd4fa14c3bfe2f
amirbigg/python-design-patterns
/chain of responsibility.py
1,422
3.9375
4
""" Chain of Responsibility - a behavioral design pattern that lets you pass requests along a chain of handlers. Upon receiving a request, each handler decides either to process the request or to pass it to the next handler in the chain. """ import abc class AbstractHandler(abc.ABC): @abc.abstractmethod def set...
ac5fb09501c10e94d3f0c3149967aa2dc28d46ab
pranjal2203/Python_Programs
/recursive fibonacci.py
518
4.5
4
#program to print fibonacci series using recursion #recursive function for generating fibonacci series def FibRecursion(n): if n <= 1: return n else: return(FibRecursion(n-1) + FibRecursion(n-2)) #input from the users no = int(input("Enter the terms: ")) #checking if the...
b9e8305e174952a452a243eb1defac59692b6a62
ralitsapetrina/Programing_basics
/exam_practice/9-10march2019/fitness_center.py
738
3.5625
4
n = int(input()) back = 0 chest = 0 legs = 0 abs = 0 prot_shake = 0 prot_bar = 0 for person in range(n): activity = input() if activity == "Back": back += 1 elif activity == "Chest": chest += 1 elif activity == "Legs": legs += 1 elif activity == "Abs": abs += 1 ...
5efaba2e88c5e53e1fce6138e37e2bff351d677a
HAIWANG211/AlgorithmAndDataStructure
/SwordToOffer/Code/7.py
330
3.640625
4
# -*- coding:utf-8 -*- class Solution: def jumpFloor(self, number): # write code here if number == 1: return 1 elif number == 2: return 2 else: return self.jumpFloor(number - 1) + self.jumpFloor(number-2) solution = Solution() print solution.jum...
915576f9b01e7ce76f2cae770b08de8485c99b76
xiaolongjia/techTrees
/Python/98_授课/Algorithm development/01_String/04_How do you print the first non-repeated character from a string/find_unrepeated_char.py
383
3.53125
4
#!C:\Python\Python def find_unrepeated_char(str): myDict = {} myCharOrder = [] for c in str: if c in myDict: myDict[c] += 1 else: myDict[c] = 1 myCharOrder.append(c) for c in myCharOrder: if myDict[c] == 1: return c return None ...
d6b48e933dececad403a3cd336ef328dc0e90d8e
rajlath/rkl_codes
/LintCode/dig_count.py
398
3.609375
4
def digitCounts(k, n): # write your code here result = 0 tmp = k while tmp <= n: result += (tmp%10 == k) if tmp != 0 and tmp//10 == k: result += 1 tmp += 1 elif tmp //10 == k - 1: tmp = tmp + (10 - k) ...
59e407be95feb245e4b1dce1d39253617379dd94
cavidparker/python_linda_course
/regular_expression.py
236
3.515625
4
import re def main(): fh = open('regularExpression.txt') pattern = re.compile('(Len/Neverm)ore') for line in fh: if re.search(pattern,line): print(line,end='') if __name__=="__main__":main()
c4add25be48fa33425c30168a5361f07160c3465
tamuzeus/TreinosPython
/TreinosdePython/Ex043.py
575
3.90625
4
peso = float(input('Digite o seu peso, em Kg,: ')) altura = float(input('Digite a sua altura, em metros,: ')) imc = peso/(altura**2) if imc < 18.5: print(f'Com o IMC: {imc:.2f}, você está Abaixo do Peso.') elif imc >= 18.5 and imc <= 25: print(f'Com o IMC: {imc:.2f}, você está no Peso Ideal.') elif imc > 25 an...
bec788c3836afd075e2734a2fefbc6ba7221949b
shubhamgupta0706/demopygit
/BubbleSort.py
240
3.96875
4
# BubbleSort def sort(nums): for i in range(len(nums)-1, 0, -1): for j in range(i): if nums[j]>nums[j+1]: nums[j], nums[j+1] = nums[j+1], nums[j] nums = [5, 3, 8, 2, 7, 9, 4] sort(nums) print(nums)
7999d3cc49d7299998bb3ad238ce360501168558
mihirkelkar/languageprojects
/python/Stack_And_Queue_Questions/two_stack_min.py
1,309
4.0625
4
#Implementing an alternative method to retrieve the element which is the minium amongst a given set. from stack import * class Stack_Min(object): def __init__(self, stack): self.top = None self.min_stack = stack self.minval = float("inf") def push(self, value): if self.top == None: self.top...
f4eac7f3806a513efd70a563da2140af512322be
yunacodes/crazy-stories
/variables.py
621
3.90625
4
#!/usr/local/bin/python3 print("NUMBERS") age = 8 print (age) x = 6 y = x * 7 x = 10 print (y) x = 10 y = x * 7 print (y) print("STRINGS") name = 'ally alien' print (name) name = 'ally alien' greeting = 'welcome to earth,' message = greeting + name print (message) rockets_players_1 = 'rory' rockets_players_2 = 'rav' ro...
897bb481d52d5a05810906b19f3b28e859aba074
applepie405/Marcel-s-Python-GUI-Window
/hello-worldj88.py
637
4.25
4
from tkinter import * #create a window root = Tk() root.title("My GUI App") #create a label and add it to the window using pack() label1 = Label(root, text="My GUI App") label1.pack() #create a StringVar() to store text words = StringVar() #create a text entry field words-entry = Entry(root, textvaria...
612fcca579d52571092801d2c0644222cb7ca678
canwe/python3-course-advanced
/19_web_scraping/scrape_sample.py
2,352
3.96875
4
""" Web scraping is where a programmer will write an application to download web pages and parse out specific information from them. Advice: Websites change all the time, so your scraper will break some day. Know this: You will have to maintain your scraper if you want it to keep working. """ import requests from b...
0e2fb6b290d8985a26d496536bf2f6c5f207ca0f
pratmambo/Codechef_solutions
/Beginner_solutions/Byte_to_bit(BITOBYT).py
539
3.8125
4
for i in range(int(input())): bit = 1 nibble = 0 byte = 0 n = int(input()) while True: n -= 2 if n > 0: nibble = bit bit = 0 else: break n -= 8 if n > 0: byte = nibble nibble = 0 ...
1285c10938b897f9e07aec921370a3075a1449d3
bautjacob/stunning-giggle
/stringCalc/test.py
2,039
3.859375
4
import unittest from string_calc import add class StringCalcTestCase(unittest.TestCase): #1 def test_empty(self): result = add("") self.assertEqual(result, 0, "Empty string failed") def test_example_input(self): result = add("1,2,5") self.assertEqual(result, 8, "Input 1,2,5...
88ccdd47b7f9e26b697f0061eeba2d6a88351d18
jabbarigit/Pyth-DL
/Lab-1/Part3.py
1,005
4.15625
4
#To to find triplets in the list which gives the sum of zero. def sumOfZero(Numbers_Entered, Number): # declaring a funtion Num = True # if the funtion is True start the loop """ for each of x, y and z will check each others matching numbers until the the three x,y and z sum is zero """ for x in...
b49ece0a409d32516642840996c5b276864713d4
anna0320/Coding.
/list.py
384
3.984375
4
list = ['7', '5', '3', '10', '45', '0', '16', '51', '22', '97', '34', '87', '78', '91', '4', '7', '2'] searchSymb = input('Введите число, которое хотите найти: ') print(list.index(searchSymb)) def lineSearch(list, x): result = None for index, string in enumerate(list): print(index, string) if string == x: ...
9802034e6fdcbda51687fb884deea3660113b87a
AndreaCensi/astatsa
/src/astatsa/mean_covariance/cov2corr_imp.py
895
3.796875
4
import numpy as np def cov2corr(covariance, zero_diagonal=False): ''' Compute the correlation matrix from the covariance matrix. By convention, if the variance of a variable is 0, its correlation is 0 with the other, and self-corr is 1. (so the diagonal is always 1). If zero_diagonal = Tru...
8525fd79981a84bfb2a3d36b5e38a77ac8bc6e44
Notechus/ExtPython
/src/lista1/zad1.py
816
3.65625
4
from random import randrange import sys def roll_dice(): return randrange(1, 6, 1) def roll_for_player(n): res = 0 for i in range(n): res += roll_dice() return res def game(n): i = 0 res_a = 0 res_b = 0 draw = 0 while i < n or (i >= n and res_a == res_b): a = ro...
6715885a6e04e2e20301d250d9834a2155378eb6
ranson/leetcode
/561_ArrayPartitionI/561_ArrayPartitionI.py
753
3.859375
4
""" 问题: 给定一个长度为2n(偶数)的数组,分成n个小组,返回每组中较小值的和sum,使sum尽量大 解法: 先排序,将相邻两个数分为一组,每组较小数都在左边,求和即可 其实应该算贪心算法的一种方法,先加入的两个最大数,一定要组成一对才能使得sum尽量大 """ class Solution(object): def arrayPairSum(self, nums): """ :type nums: List[int] :rtype: int """ nums.sort() sum = 0 for i in ...
d8d707958f454f5855357302a3f7c9ef82c595da
kevinjam/Python_Exercises
/Assigment_Solution/hourtime.py
105
3.578125
4
hrs =int(raw_input("Enter Hours:")) h =int(hrs) if h >= 40: e = (h-40) * 10.50/2 print e + h * 10.50
69e1fd63d183118357a757345623fe934f410678
tomas-bernat/currency_converter
/currency_converter.py
1,061
3.890625
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- """ CLI application for currency converting. Author: Tomas Bernat (tom.bernat@centrum.cz) Created: 12.2.2019 """ import argparse, json from converter import Converter def args_test(args): for k,v in vars(args).items(): if v == None: rais...
ec96967ef8ca8896029cec2d190b6c50261fdac8
alexandraback/datacollection
/solutions_5738606668808192_1/Python/farin/c.py
1,859
3.6875
4
#!/usr/bin/env python3 # import numpy # # def primesfrom2to(n): # """ Input n>=6, Returns a array of primes, 2 <= p < n """ # sieve = numpy.ones(n/3 + (n%6==2), dtype=numpy.bool) # for i in range(1,int(n**0.5)//3+1): # if sieve[i]: # k=3*i+1|1 # sieve[ k*k//3 ::2*k...
83ef792c4fd07972ed6834b9c4894c2dfeb75101
Sanych13/LITS
/HW 12.05.4.py
435
3.703125
4
w = input('Ввести слова: ') def percentage(x): b = 0 s = 0 for i in w: if i.isupper() and i.isspace() == False: b += 1 elif i.islower() and i.isspace() == False: s += 1 print("Відсоток великих букв = ", (b / (b + s)) * 100, "%") print("Відсоток м...
0b5a16ae99a7be7d75067cc9ac85cfecc8d2d5a6
ViktoricaN/New
/ф-ла прямоугольников.py
471
4.1875
4
def rectangular(f, a, b, n): """ Вычисляет приближенное значение интеграла с помощью формулы прямоугольников f - подынтегральная функция a, b - пределы интегрирования n - количество частичных отрезков """ h = float(b - a)/n result = f(a+0.5*h) for i in range(1, n): result += f(a + 0.5*h + i*h) result *= h ...
b63de77cc08f9e6f17c4ec3ac07e276a3f31505b
uwenorjeff/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/10-best_score.py
326
3.515625
4
#!/usr/bin/python3 def best_score(a_dictionary): if a_dictionary is None: return None best = 0 best_key = None for key, val in a_dictionary.items(): if val > best: best = val best_key = key return bes...
322f30dffefdaa495875b729ed04338bf4f44360
lizenghui1121/DS_algorithms
/名企真题/广联达2020提前批/7.29-01.py
1,094
3.734375
4
""" 杰夫非常喜欢种草,他自己有一片草地,为了方便起见,我们把这片草地看成一行从左到右,并且第 i 个位置的草的高度是hi。 杰夫在商店中购买了m瓶魔法药剂,每瓶魔法药剂可以让一株草长高x,杰夫希望每次都能有针对性的使用药剂,也就是让当前长得最矮的小草尽量高,现在杰夫想请你告诉他在使用了m瓶魔法药剂之后,最矮的小草在这种情况下最高能到多少。 输入描述 第一行三个整数n, m, x分别表示小草的个数,魔法药剂的个数以及每瓶魔法药剂让小草长高的高度。(1≤n,m,x≤1e5) 第二行n个整数分别表示第i株小草的高度ai。(1≤ai≤1e9) 输出描述 使用了m瓶药剂之后最矮的小草的最高高度。 @Author: Li Zeng...
4a953736fe1a35ffa56ae995915c50170176f7e5
Aasthaengg/IBMdataset
/Python_codes/p03227/s621244274.py
107
3.84375
4
s = input() n = len(s) if (n == 3): for i in range(n): print(s[n-i-1],end = "") print() else: print(s)
c503081fafa993ceec24388b3a2489026cc72d0b
Techsture/python
/list_comprehension_intro.py
386
4.125
4
#!/usr/bin/env python # Given list: a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] # Write one line of Python that makes a new list that has only the even elements of this list in it. def main(): a = [1, 4, 9, 16, 25, 36, 49, 64, 81, 100] b = [i for i in a if i % 2 == 0] print("Original list: %s" % a) pr...
8e5b0a9f409c673be6697ac8148aea4177e55b5b
ravi4all/PythonWE_EveningAug
/Functions/StringsSimilarity.py
2,400
4.15625
4
# jaccard distance = a & b / a | b text_1 = "Python is an interpreted, object-oriented programming language similar to PERL, that has gained popularity because of its clear syntax and readability. Python is said to be relatively easy to learn and portable, meaning its statements can be interpreted in a number of ope...
19ea690e781a22df7d2fc586022e4c0e521a6ed1
futurice/PythonInBrowser
/examples/session3-fi/perimeter.py
2,129
3.8125
4
# Monikulmion piiri import turtle ##### INFO ##### # Monikulmion piiri on matka jonka kilpikonna kulkee piirtäessään suljetun # monikulmion. # Alla on apufunktio, joka siirtää kilpikonnan koordinaatteihin # (x, y), mutta ei piirrä viivaa. def siirra_kilpikonna(t, x, y): t.penup() t.goto(x, y) t.pendown() ret...
6607ca542acec02a9ec0ee205b4b2efa03d59ca3
TomWerm/QUno
/quno/player.py
1,427
4.125
4
# -- coding: utf-8 -- """ Created on Wed Sep 30 2020 @author: Julia Butte, Sebastian Weber, Thomas Weber """ """ This class represents a player in this game""" class Player (object) : def __init__(self, endconfig, name, cards) : self.endconfig = endconfig self.name = name self.cards = card...
8e4723583177b8764bb8a5bf376b6ef90dd94cdd
Elemento24/Python3-Bootcamp
/Projects/Bootcamp/(29)Testing/V3_act.py
612
3.875
4
# In this we will see how to test our code using a built-in-module called unittest # This is probably the easiest way to implement tests for Python Code # Though we need to follow a little extra syntax, but if used correctly ... # ... we have very powerful tools at our disposal. def eat(food, is_healthy): ending ...
5681fd8990be835a13b2724b6c0458a30fa86027
tborzyszkowski/LogikaProgramowania
/zadania/04pliki/wig.py
598
3.5
4
import csv import statistics with open('wig_d.csv') as csvfile: readCSV = csv.reader(csvfile, delimiter=',') next(readCSV) counter = 0 volumen_lista = [] diff_lista = [] for row in readCSV: volumen = float(row[5]) volumen_lista.append(volumen) diff = float(row[2]) - floa...
5e3f980e342fb97bb6830d208ca1146b4c93c0f9
refresh6724/APS
/Jungol/Lv1_LCoder_Python/py60_선택제어문/Main_JO_812_선택제어문_형성평가3.py
140
3.90625
4
a = int(input()) if a%400 == 0: print("leap year") elif a%4 == 0 and a%100 != 0: print("leap year") else: print("common year")
a44e6d6aa3ee1de47a0a148bc108eca56d64ba94
COSC481HonorsCollegeAdvising/Advising
/Database_Utilities/ProcessCourseFile/extractCourseInfo.py
1,982
4
4
#!/usr/bin/python ''' This program reads the winter 2016 course text file and prints out the extracted relevant information that we need. to run the file and output to a text file do the following: ./extractCourseInfo.py > out.txt ''' ''' Index : content 7 : CRN 9: title 5 : courseNO 4 : coursePrefix term: not in line...
da6518c20ffa6a3cd0531436de3a75a039e74681
DavidPesta/AdventOfCode
/python3/2018/01-Chronal-Calibration/part1.py
196
3.625
4
import pathlib input: str = pathlib.Path("input.txt").read_text() values = input.split("\n") current = 0 for value in values: integer = int(value) current = current + integer print(current)
1d8d826a528a13c7ba4def2746e3c6687eff1bcc
Amal1991m/pdsnd_github
/bikeshare.py
6,764
4.1875
4
import time import pandas as pd import numpy as np CITY_DATA = { 'chicago': 'chicago.csv', 'new york city': 'new_york_city.csv', 'washington': 'washington.csv' } def get_filters(): """ # Asks user to specify a city, month, and day to analyze. ask_1=input("") Returns: ...
e6d999029574479f04aac7979421deb0b9de3a7e
ai2-education-fiep-turma-2/05-python
/solucoes/TiagoPedrosa/lista2/exercicio05.py
229
4.09375
4
def square(): from math import sqrt numero = int(input("Digite um numero: ")) if (numero >=0): result = sqrt(numero) else: result = numero ** 2 print("O resultado é ", result) square()
ce7dbf53f7702ec1eeab5bedd93b1b3de0839e78
humeinstein/holbertonschool-higher_level_programming
/0x07-python-test_driven_development/3-say_my_name.py
897
4.40625
4
#!/usr/bin/python3 """ function that checks status of str returns status """ def checkStatus(first_name, last_name): """ return status of 0 if all str. 1 | 2 for first or last """ status = 0 if type(first_name) is not str: status = 1 if type(last_name) is not str: st...
41765f5654b99efe011a0aedde53aaf0d55c484a
jkmrto/VAE-applied-to-Nifti-images
/lib/file_reader.py
219
3.59375
4
import csv def read_csv_as_list_of_dictionaries(path_file): file = open(path_file) reader = csv.DictReader(file) list_rows = [] for row in reader: list_rows.append(row) return list_rows
d25514f4bf686434d829efe31023fb40eed13c61
I-Rinka/BIT-KnowledgeEngineering
/One/Try/nplearn.py
345
3.859375
4
import numpy as np # my_array = np.array([1, 2, 3, 4, 5]) # print(my_array) my_array=np.ones([2,3],dtype=np.float) print(2*my_array) # array2=np.ones([10,1],dtype=np.float) print(np.transpose(my_array)) print(np.dot(my_array,np.transpose(my_array))) # 要进行矩阵乘法或矩阵向量乘法,我们使用np.dot()方法。 # w = np.dot(A,v)
3f613377cabc53ea10f88b289a2140c3ec574fc3
Jayu8/Python3
/Lambda-_filter_reduce_and_map/SimpleExample.py
773
3.71875
4
# LAMBDA sum = lambda x, y : x + y >>>sum(3,4) >>>7 # MAP >>> C = [39.2, 36.5, 37.3, 38, 37.8] >>> F = list(map(lambda x: (float(9)/5)*x + 32, C)) # x means each element >>> print(F) [102.56, 97.7, 99.14, 100.4, 100.03999999999999] >>> C = list(map(lambda x: (float(5)/9)*(x-32), F)) >>> print(C) [39.2, 36.5, 37.300...
79cc53d0e7aa2b8e09bb2b92da2ed5663444403b
sermolin/realpython
/code/argparse/myls.py
720
3.609375
4
#!/usr/bin/env python # coding: utf-8 # In[1]: # example of argument parsing # In[6]: # myls.py # Import the argparse library import argparse import os import sys # Create the parser my_parser = argparse.ArgumentParser(description='List the content of a folder') # Add the arguments my_parser.add_argument('Pat...
32ecc5887506049754e28db060ead641fa5cde62
Souji9533/Mycode
/python/assigment.py
445
3.640625
4
# from itertools import product # s= input().split() # s1=s[0] # s2=s[1] # l=list(product(s1,s2)) # for i in l: # print(i, end=" ") from itertools import product s=input() s1=input() l=list(product(s,s1)) for i in l: print(i, end =" ") # Enter your code here. Read input from STDIN. Print output to STDOUT...
fadc379eeabc46aac2f1f06d0359c6a275eec6de
kevinbooth/comp525labs
/lab1.py
597
4.1875
4
""" Practice with defining functions file1.py William Hortman and Kevin Booth 9/5/2018 """ def alarm_clock( ): """ Calculates and outputs the time when the alarm goes off based on time current time (in hours) and number of hours to wait for the alarm. """ current_time_string = input("What is the cu...
8c6a718b76d46dae351a04ba7b734984ad5796a8
Pergamene/cs-module-project-algorithms
/moving_zeroes/moving_zeroes.py
387
4.25
4
''' Input: a List of integers Returns: a List of integers ''' def moving_zeroes(arr): index = 0 length = len(arr) while index < length: if arr[index] == 0: arr.pop(index) arr.append(0) length -= 1 else: index += 1 return arr if __name__ == '__main__': arr = [0, 3, 1, 0, -2] ...
14364c64ce1bf7499d741412948f2c0f3c75026a
NivedithaCV/numpy
/cs.py
275
3.515625
4
#import module import numpy as np import matplotlib.pyplot as plt from numpy import random #seed(1) #generate random points data1 = random.rand(1000) data2 = random.rand(1000) #giving slope m=4 #relation y=m*data1+data2 #plot plt.scatter(data1,y) plt.show()
56657d7f79375a8ae08389ceb9f4f4f326b9d8f7
mihir6598/python_competitive
/python/biggest number2.py
324
3.5625
4
class LargerNumKey(str): def __gt__(x, y): print (x,y) print (x+y > y+x) return x+y > y+x def largestNumber( nums): largest_num = ''.join(sorted(map(str, nums), key=LargerNumKey)) return '0' if largest_num[0] == '0' else largest_num nums = [2,10,23] print (largestNumber(nu...