blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
266b63afbc2a3739423616db5fc2dd395c6977f5
shiyuan1118/Leetcode-in-Python
/Leetcode in Python/double index/merge sorted array(88).py
585
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 8 13:09:50 2020 @author: baoshiyuan """ #Merge Sorted Array class Solution: def merge(nums1, m, nums2, n): while m>0 and n>0: if nums2[n-1]>nums1[m-1]: nums1[m+n-1]=nums2[n-1] ...
d9f6f3fde63ac27c008e8637233135ca495e0985
shiyuan1118/Leetcode-in-Python
/Leetcode in Python/Reverse/reverseBits(190).py
260
4.03125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Jan 23 21:21:55 2021 @author: baoshiyuan """ class Solution: def reverseBits( n: int): str="{0:032b}".format(n) reversed=str[::-1] return int(reversed,2)
30d8de98aad7b78380e48cd8b4fcecfc9a6bbbaf
javayhu/XSolutions
/python/InsertionSortList.py
968
3.953125
4
# Definition for singly-linked list. class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: # @param head, a ListNode # @return a ListNode def insertionSortList(self, head): if not head: return head fh = ListNode(0) fh.next = head ...
0dbde913a6cef31bdb56eda780005400d7322223
TreezzZ/Introduction_to_Algorithms
/Chapter4/MatrixMul.py
807
3.515625
4
# -*- coding:utf-8 -*- """朴素矩阵乘法,复杂度O(n^3) """ import numpy as np def mul_marix(A, B): """朴素矩阵乘法,复杂度O(n^3) Args: A(np.array): 矩阵1 B(np.array): 矩阵2 Return: C(np.array): 矩阵乘法结果 """ n, _ = A.shape C = np.empty((n, n)) for i in range(n): for j in range(n): ...
19b08401176bd0b346f01896e2bf4b653303072c
Faithlmy/Python_base
/P_base/module.py
1,547
3.984375
4
# #!/usr/bin/python3 # # -*- cording: UTF-8 -*- # def lmy( m, n ): # print ("we are in %s"%__name__) # print ( n + m ) # # # #if __name__ == '__main__': # #lmy( 2, 3 ) # # def lmy1 ( m1 ): # print ( m1 ) # # #�ĸ�����1234�����û�ظ�����λ�� # def lmyCombina(): # for i in range(1, 5): # for j in range ...
9cf69aa067ca55d4a20f190240aa7ca214a6b115
Faithlmy/Python_base
/P_base/faith_base/model/member.py
610
3.515625
4
# coding:utf8 '''自定义类Member实现''' class Member: __metaclass__ = type member_id = 0 # 成员变量 def __init__(self, name='song', tel=None, sex=None, age=None): self.name = name self.tel = tel self.sex = sex self.age = age def __iter__(self): return sel...
783d1f3f175883a31c782d7a4a4e22dc99946a5b
Faithlmy/Python_base
/P_base/Python/3.py
486
3.828125
4
#!/usr/bin/python3 # -*- coding: UTF-8 -*- dict = {} dict['one'] = "1 - 教程" dict[2] = "2 - 工具" tinydict = {'name': 'runoob','code':1, 'site': 'www.runoob.com'} for c in tinydict: print(c , ':' , tinydict(c) ) print (dict['one']) # 输出键为 'one' 的值 print (dict[2]) # 输出键为 2 的值 print...
76636efdcce486a9bf4facec7fae0b5937c8aa92
Faithlmy/Python_base
/P_base/faith_base/f_dict_.py
461
3.78125
4
#d.py class p: """#discrabe __dict""" country = 'China' def __init__(self, name, con): self.name = name self.con = con def f(self, *args, **kwargs): print('f') def fp(self, *args, **kwargs): self.args = args self.kwargs = kwargs return ...
86686597a2fd83e42237aa24e038a360d9227d8c
Faithlmy/Python_base
/P_base/faith_class/class_inherite.py
926
4.15625
4
#!/usr/bin/env python # # -*- coding:utf-8 -*- # fileName : class_inherite.py """ python的单继承 """ class book(object): __author = '' __name = '' __page = '' def __check(self, item): if item == '': return 0 else: return 1 def show(self): if self.__check...
8de6cc5b22202c19b9a69f1e5d12e34929b3663f
UlricWu/1080ti
/algorithms/200.longest_palindromic.py
788
3.828125
4
class Solution: """ @param s: input string @return: a string as the longest palindromic substring """ def longestPalindrome(self, s): # write your code here if not s: return "" result = [] for mid in range(len(s)): result = max(self.is_palind...
4b912b0454fca688b0082d9fccebb4752d38c868
usainzg/micro-codes
/Python/checkProfanityWords.py
495
3.609375
4
import urllib.request def read_text(): content = str(input("Enter your text to check please: ")) check_profanity(content) def check_profanity(text_to): connection = urllib.request.urlopen("http://www.wdyl.com/profanity?q="+text_to) output = str(connection.read()) connection.close() if "tr...
207382df3da03bb3e19d0010e3c6c87967162497
bojodimitrov/SnakeML
/mutation_operations.py
637
3.59375
4
import random def replace_weight(weight): """ Replaces weight """ return random.randint(-1, 1) def scale(weight): """ Scales weight by some value """ return weight * random.uniform(0.5, 1.5) def shift(weight): """ Adds random number between -0.8, 0.8 """ return weig...
fc7bc6a34a1cffa224c0252674baaaa6f65d1501
soumi444/100-Days-Of-Python
/DAY2/Simple GUI Calculator.py
4,050
4.1875
4
from tkinter import * import math root = Tk() root.title("Simple GUI Calculator") e = Entry(root, width=25,borderwidth=5,justify = RIGHT) e.grid(row=0, column=0, columnspan=5) def button_click(number): current = e.get() e.delete(0,END) e.insert(0, str(current) + str(number)) def all_clear(...
d8c4931f9b9dec48d6dc4a0b387103dc93083875
soumi444/100-Days-Of-Python
/Day 3 of Python/sums of digits.py
250
3.96875
4
number = eval(input("Enter a number between 0 and 1000:")) number1 = number//100 remaining = number%100 number2 = remaining//10 remaining=number%10 number3 = remaining total = int(number1 + number2 + number3) print("Total is",int(total))
6190edcad79052e7d0c0fde1fec3b719eff3b6b5
MBunko/qa-python-exercises
/times tables.py
162
3.796875
4
n= int(input("input number")) for i in range (1,n+1): row= format("") for j in range (1,n+1): row+= "{0:8} ".format(i*j) print (row)
894a13295c61805a8441e53bb0c84f0939f3791c
MBunko/qa-python-exercises
/ISBN.py
1,786
3.96875
4
n0= int(input("Please enter first digit: ")) while n0>9 or n0<0: n0= int(input("Input must be single digit, Try again: ")) n1= int(input("Please enter second digit: ")) while n1>9 or n1<0: n1= int(input("Input must be single digit, Try again: ")) n2= int(input("Please enter third digit: ")) while n2>...
d9d532335aa3c1bb0df371af95972d1e575980a4
h404z/DesignPatternOfPython
/7_template.py
934
4
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Time :2018/3/11 # @Author: h404z """定义一个操作中的算法骨架,将一些步骤延迟至子类中""" class TestPaper(object): def question_a(self): print("question a: What's your name?") print(self.answer_a()) def question_b(self): print("question b: How old are you?") ...
71c7f01887c0e20de0b1d44122538abcb48a2aa1
benjamesian/holbertonschool-web_back_end
/0x00-python_variable_annotations/7-to_kv.py
203
3.734375
4
#!/usr/bin/env python3 """Type annotation practice""" from typing import Union, Tuple def to_kv(k: str, v: Union[int, float]) -> Tuple[str, float]: """Return tuple (k, v^2)""" return (k, v**2)
19bf72b4af3477fd665eb02328262fd9f2f79e6b
benjamesian/holbertonschool-web_back_end
/0x02-python_async_comprehension/1-async_comprehension.py
325
3.609375
4
#!/usr/bin/env python3 """1. Async Comprehensions""" from typing import List ASYNC_GENERATOR = __import__('0-async_generator').async_generator async def async_comprehension() -> List[float]: """Use async list comprehension and generate a list of random numbers""" return [rand async for rand in ASYNC_GENERATO...
1fa166b20eacccfe7e4a004b31dc6e00ebf5422e
meyer1994/simpsons
/analysis/most_names.py
342
3.796875
4
import csv from collections import Counter ''' Counts the most called name of the simpsons family. ''' with open('../total_count.csv', 'r') as csv_file: reader = csv.reader(csv_file) count = dict(reader) simpsons = [ 'marge', 'homer', 'bart', 'lisa', 'maggie', 'abraham', 'mona' ] for c in simpsons: pri...
140d79f3389ffb2dc3f63f5caf927afb77e2087e
wangchunxiang8090/exercise
/test/day6/inherit.py
1,738
3.78125
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # class Animal: # def eat(self): # print('%s 吃' %self.name) # def drink(self): # print('%s 喝' %self.name) # def shit(self): # print('%s 拉' %self.name) # def pee(self): # print('%s 撒 ' %self.name) # # class Cat(Animal): # ...
63bfde67a40131b8e3e1c9a8c76e609b70cef145
wangchunxiang8090/exercise
/test/day6/packaging.py
2,826
3.828125
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # class foo: # # def __init__(self,name,age): #构造函数,根据类创建对象时自动执行 # self.name = name # self.age = age # # # 根据类foo创建对象 # # 自动执行foo类的__init__方法 # obj1 = foo('wupeiqi',18) #将wupeiqi和18分别封装到obj1的name和age属性中 # print(obj1.name) #直接调用obj1对象的name属性 # prin...
8c34ae9bf8e5c3144d2f5e9ab14d939f8c4a05bd
wangchunxiang8090/exercise
/冒泡.py
348
3.515625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # 冒泡排序 data = [11,234,32,1,23,99,89,77,1543,43,213,43,2,23,231,341,43,54,6545,75,4] for j in range(1,len(data)): for i in range(len(data)-j): if data[i] > data[i+1]: temp = data[i+1] data[i+1] = data[i] data[i]= temp print l...
c55d87dfde2aec51a4259bcf7c1ef60a74dfec75
malhotraa/hashcode-satellites
/classes/position.py
532
3.578125
4
class Position: # Represents a satellite location at time t def __init__(self, lat, lon, t): self._lat = lat self._lon = lon self._t = t def __str__(self): return f"Position (loc=({self._lat}, {self._lon}), time={self._t})" def __hash__(self): return hash((self._lat...
2caafa35676487935486af589657587f89cb0265
BustinArown/ppa-1-sw-testing-qa-spring-2018-team-5
/runner.py
6,070
4.125
4
import body_mass_index import retirement import shortest_distance import email_verifier import split_the_tip import math def print_prompt(): print("You may choose from any 5 functions:\n" "1-Body Mass Index Calculator\n" "2-Retirement Goal Determiner\n" "3-Distance Formula Calculator...
a6d384ac8dd02a087d35babada746ab4d10b4315
ayhansevimli/python-fundamentals
/examples/while-004.py
91
3.640625
4
tekrar = 1 while tekrar <= 3: tekrar += 1 input("Nasılsınız, iyi misiniz?")
6fdeab68a8db01f6e3b6fbcc41cabc00877a26b4
ayhansevimli/python-fundamentals
/examples/while-005.py
170
4.0625
4
tekrar = 1 while tekrar <= 3: print("tekrar: ", tekrar) tekrar += 1 input("Nasılsınız, iyi misiniz?") print("bool değeri: ", bool(tekrar <= 3))
64882e7279c25bac947a1d45f3add8d01dc1839d
ayhansevimli/python-fundamentals
/examples/else-006.py
448
3.609375
4
kullanıcı_adı = input("Kullanıcı adınız: ") parola = input("Parolanız : ") toplam_uzunluk = len(kullanıcı_adı) + len(parola) mesaj = "Kullanıcı adı ve parolanız toplam {} karakterden oluşuyor!" print(mesaj.format(toplam_uzunluk)) if toplam_uzunluk > 40: print("Kullanıcı adınız ile parolan...
42008ce6df879b0ca9256d6a7ab8db4e84e532dc
ayhansevimli/python-fundamentals
/examples/for-004.py
399
3.859375
4
#Bu program, kullanıcıya bir parola soruyor. #Eğer kullanıcının girdiği parola içinde Türkçe #karakterlerden herhangi biri varsa kullanıcıyı #Türkçe karakter kullanmaması konusunda uyarıyor. tr_harfler = "şçöğüİı" parola = input("Parolanız: ") for karakter in parola: if karakter in tr_harfler: ...
c0144ebc2321d6adc64a754d78279559628c87df
linminhtoo/Pentago
/inputs.py
2,491
3.671875
4
import numpy as np import random import math from typing import Optional, Tuple, List import time from tqdm import tqdm def check_input_row_and_col(row: int, col: int, game_size: int = 6 ) -> Tuple[bool, ...
67de285c1a6768c8a3b004bfb5364cdf88acdfc6
ianevangelista/Python3
/Ranges.py
336
4.1875
4
for n in range(3, 10, 2): # går fra 3-9 med hopp på 2 print(n) burgere = ['cheese', 'big mac', 'double cheese', 'chicken salsa'] for n in range(len(burgere)): #lengden på lista print(n, burgere[n]) for n in range(len(burgere) -1, -1, -1): # starte på siste, avslutte på første og hopp baklengs print(n, b...
b3960218df6fa3c21cea7b9334153f46f4591794
theadventuresofcc/Turtle-in-Python
/001-雪花/001-雪花.py
245
3.640625
4
from turtle import * title('雪花') shape('turtle') width(12) pencolor('white') bgcolor('#00CED1') def square(): for i in range(4): forward(188) left(90) for j in range(6): square() left(60) hideturtle() done()
082d7d61ad29b74da14cf566c30f2416a9e32757
DrKittyKat/EWH-Converter
/EWHConverter.py
1,126
3.5
4
# -*- coding: utf-8 -*- """ Created on Mon Aug 12 16:28:04 2019 @author: Raptor3200 """ print("HI") class EWHConverter: def __init__(self): self.setWorkInfo() self.mainLoop() def setWorkInfo(self): print("Please input your [money] per [hours]") self.money = input("Money: ") ...
c6887eae835aef5fe02e8d1474be08364b6f6566
uobykes/python
/python_session1.py
3,035
3.859375
4
a = "Ashish" b = "(This is my first print statement) W$#TRWEDGVDFABDFGAS G#$%T #$%#$% {} [] ()" c = "This is line 1" c = "This is line 2" c = "This is line 3" print(a) print(b) print(c) """ This code is to get file from s3 bucket using boto3 API """ # This code is to get file from # s3 bucket using bo...
a84bd91c082600c3eff548260c7ee904df493a0a
jssvldk/Practicum1
/Rabota1(№3).py
932
4.09375
4
""" Имя проекта: Rabota1 Номер версии: 1.0 Имя файла: Rabota1(№3).py Автор: 2020 © В.А.Шаровский, Челябинск Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru) Дата создания: 15.12.2020 Дата последней модификации: 15.12.2020 Описание: Решение задачи №3 Практикума №1 Оп...
8563be7ce6c5bbb0321af32ea3a929931c1ea996
jssvldk/Practicum1
/Rabota1(№39).py
913
3.84375
4
""" Имя проекта: Rabota1 Номер версии: 1.0 Имя файла: Rabota1(№39).py Автор: 2020 © В.А.Шаровский, Челябинск Лицензия использования: CC BY-NC 4.0 (https://creativecommons.org/licenses/by-nc/4.0/deed.ru) Дата создания: 16.12.2020 Дата последней модификации: 16.12.2020 Описание: Решение задачи №39 Практикума №1 ...
7c1d560bd072ff93ed5df4b4ca5db5ab934f14fb
santoshgurujula/PythonChallenges
/findodd.py
1,229
3.609375
4
# you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 k = int() A.sort() if(len(A)) == 0: return None elif(len(A)) == 1: return A[0] else: for i in range(len(A)): try: ...
aa887cb267d73fcf903016f0e58cc4b7e92aba11
AbdulMoizChishti/pythonpractice
/quadretic eq.py
200
3.515625
4
#Abdul Moiz Chishti #BSE-2020F-022 a=2 b=6 c=3 d=((b**2)-(4*a*c)) e=(d**0.5) #for positive sol1=(-b+e)/(2*a) #for negative sol2=(-b-e)/(2*a) print("the positve root is=",sol1) print("the negative root is=",sol2)
8dba4a47bc87f777fcaf1cdea57778682e529b33
AbdulMoizChishti/pythonpractice
/counting name.py
182
3.875
4
# Abdul Moiz Chishti # BSE-2020F-022 name=input("Enter your Name:") n=name.lower() n2=name.upper() print(n) print(n2) c=0 for i in name: c=c+1 print("total number of alphabets=",c)
b3578e0b3cf565030525273c7a6d49663282b220
akhi1212/pythonpracticse
/inputValue_check.py
168
4.15625
4
num1 = int (input("Please enter the first number: ")) num2 = float (input("Please enter float number: ")) print("Checking integer plus with float number", num1 + num2)
58da6d268f8f3f6ce61954a7edd6b87555469b0b
akhi1212/pythonpracticse
/ReverStringCheck.py
154
3.84375
4
""" Alternamte method to revrse string """ str1 = "MagicMoment" print(str1[::-1]) b="" for i in range(int(len(str1)-1),-1,-1): b += str1[i] print(b)
142dfe14ac294e90796b12ea0a017829845576c3
akhi1212/pythonpracticse
/stringAppendingmiddle.py
254
3.9375
4
""" Exercise Question 2: Given 2 strings, s1 and s2, create a new string by appending s2 in the middle of s1 """ s1 = "Ault" s2 = "Kelly" a = int(len(s1)/2) middleThree = s1[:a:]+ s2 +s1[a:] print("After appending new string in middle", middleThree)
cb4846cfca090647945f8966ff89163050e15e31
akhi1212/pythonpracticse
/StringTask_2_only_first_three_character_of_string.py
525
4.1875
4
## Compare only first three character of string def comparisonFirstThreeChars(s1_inp,s2_inp): a = len(s1_inp) b = len(s2_inp) c_newa = s1_inp[0:3] print(c_newa) d_newb = s2_inp[0:3] print(d_newb) if c_newa == d_newb: print("first three chars matched enjoy your are become code in coding") else: print("Chage ...
4a8b4d940a2317d5c4200d88e87065d3ec1384b9
akhi1212/pythonpracticse
/listExcercise_5.py
212
3.90625
4
""" Write one line of code to get a list of names that start with character "j" """ list1 = ['Tack','Rack','Mack','Jack','Adam','John','Sunil'] names = [names for names in list1 if names[0] == "J"] print(names)
2ce2523a914f122985332feae88bc1c8772d7e2e
akhi1212/pythonpracticse
/StringToList.py
346
3.515625
4
in_vlaue = input("This is input taking programm: ") li = in_vlaue.split() print(in_vlaue) print("The type of li variable is: ",type(li)) print("The length of list is: ",len(li)) print("The converted list value is: ", li) li_1 = ['akhilesh','is a good prog'] li += li_1 #for t in li: # li_1.append(t) print("The finall l...
7d8772ecf80b2fd533ea9b0b89b9d551bde7e150
ucsd-cse-spis-2017/spis17-lab04-James-Stephanie
/fractalChallenge.py
358
4.03125
4
import turtle def go(t, sideLength, level): triangle(t, sideLength, level) t.left(120) def triangle(t, sideLength, level): if level == 1: return t.forward(sideLength) else: t.forward() t.right() triangle(t, sideLength / 2, level - 1) if __name__ == "__main__": t = tu...
ac26bcd2367649aa85e46448a77b8f88138fba44
Tronmatrix81/Calculator
/Calculadora.py
437
3.875
4
print("Funciones: Sumar, Restar, Multiplicar, Dividir") a=input("Selección de función: ") n1=int(input("Número 1: ")) n2=int(input("Número 2: ")) suma=(n1)+(n2) resta=(n1)-(n2) multiplicacion=(n1)*(n2) division=(n1)/(n2) b="Sumar" c="Restar" d="Multiplicar" e="Dividir" if a==b: print("Resultado",suma) elif a==c: ...
b9442fb2f85b11eef3e9d53edadbbc24817f2d8b
azhuma/geek
/py_intro/lesson07/task01.py
1,610
3.6875
4
class Matrix: @property def elements(self): return self.__elements @property def rows(self): return self.__rows @property def columns(self): return self.__columns def __init__(self, elements): lens = [len(vector) for vector in elements] if min(lens)...
bac8c242c1691adbdb84ec86934761736c1a11d7
azhuma/geek
/py_intro/lesson07/task03.py
1,075
3.578125
4
class Cell: def __init__(self, cells): if cells < 0: raise ValueError self.__cells = round(cells) @property def cells(self): return self.__cells def __add__(self, other): return Cell(self.cells + other.cells) def __sub__(self, other): return Cel...
789aa46e06d7d240e6fe7f9465465aa828475763
azhuma/geek
/py_intro/lesson04/task06.py
210
3.75
4
from itertools import count from itertools import cycle words = ["good", "bad", "neutral"] iter = cycle(words) for el in count(3): if el > 10: break else: print(f"{el}, {next(iter)}")
5286385b1b0a6e51c37ffbffe418a5042a62d3cc
azhuma/geek
/py_intro/lesson03/task01.py
324
3.9375
4
def divide(v1, v2): try: return v1 / v2 except ZeroDivisionError: print("Zero division!") return a = input("a=") b = input("b=") if a.isnumeric() and b.isnumeric(): result = divide(int(a), int(b)) if result: print(f"result = {result:.2}") else: print("Invalid input...
6d19266bfd8b9576b9226202dff2242974b2a910
oceanpad/python-tutorial
/code/class/classBasic.py
639
3.5
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- class Student(object): def __init__(self, __name, __score): self.__name = __name self.__score = __score def printScore(self): print('%s: %s' % (self.__name, self.__score)) def printGrade(self): if(self.__score > 90): ...
786fb08e27d3c8a4e79b3525b6169200b081be7a
oceanpad/python-tutorial
/code/basic/if/if.py
242
4.15625
4
age = input('please input your age(int):') try: age = int(age) if age > 18 : print("adult") elif age < 6 : print("children") else : print("teenage") except ValueError: print("'" + age + "' is not an int!")
4f8e16501bf7751971f73e376662df73b6deed09
wuggy-ianw/AdventOfCode2016-py
/Day3/day3.py
1,583
3.703125
4
# # solution for the 3rd puzzle of Advent of Code: http://adventofcode.com/2016/day/3 # import numpy as np def checkvalid(triangle): return triangle[0] + triangle[1] > triangle[2] and \ triangle[0] + triangle[2] > triangle[1] and \ triangle[1] + triangle[2] > triangle[0] def partA(translate...
65e075c9b4d051a8308b590626a0828cdbc9c695
StefanDimitrovDimitrov/Python_Basic
/01. First-Steps in Codding Lab+Exr/07.time_to_complete_projects.py
1,071
4.1875
4
""" Напишете програма, която изчислява колко часове ще са необходими на един архитект, за да изготви проектите на няколко строителни обекта. Изготвянето на един проект отнема три часа. Вход От конзолата се четат 2 реда: 1. Името на архитекта - текст; 2. Брой на проектите - цяло число. Изход На конзолата се отпечатва: •...
a886fbf5b7e38af5cd5b35d6fe5ea87c1354277a
StefanDimitrovDimitrov/Python_Basic
/02.Conditional_Statements/03.Even or Odd.py
74
4.03125
4
number = int(input()) print("even") if number % 2 == 0 else print("odd")
e55737c32b0185aabea97ea65fd2a61a80066300
StefanDimitrovDimitrov/Python_Basic
/03.Conditional_Statement_Ex/06_Godzilla_Kong.py
532
3.515625
4
budjet_movies = float(input()) stats_number = int(input()) price_dressed = float(input()) decore = budjet_movies * 0.1 price_dressed = stats_number * price_dressed if stats_number >150: price_dressed -= price_dressed * 0.1 expences = decore + price_dressed if expences > budjet_movies: print('Not enough mone...
940078eae3597482acc282c7112ca33f3060fe2e
StefanDimitrovDimitrov/Python_Basic
/08.Loops_exercise/02_half_sum_element.py
352
3.734375
4
import sys max_num = -sys.maxsize sum_number = 0 n = int(input()) for i in range(0, n): num = int(input()) if num > max_num: max_num = num sum_number += num sum_number -= max_num if sum_number == max_num: print("Yes") print(f'Sum = {sum_number}') else: print("No") print(f'Diff ...
53ab52140f9e10ff5670353d9a2296034046a01c
StefanDimitrovDimitrov/Python_Basic
/01. First-Steps in Codding Lab+Exr/08.zoo_food_math_challenge.py
1,045
4.125
4
""" Напишете програма, която пресмята нужните разходи за закупуването на храна за кучета и други животни. Една опаковка храна за кучета е на цена 2.50лв., а всяка останала, която не е за тях струва 4лв. Вход От конзолата се четат 2 реда: 1. Броят на кучетата - цяло число; 2. Броят на останалите животни - цяло число. ...
7bccb2654c543bcc21379335f6e907cff6f2ffc4
StefanDimitrovDimitrov/Python_Basic
/04. Conditional_Statements_Advance/10.Volleyball.py
418
3.515625
4
import math year = (input()) number_of_holidays = int(input()) number_of_weekends = int(input()) weekends_Sofia = 48 - number_of_weekends games_in_Sofia = weekends_Sofia * 3 / 4 games_during_holidays = number_of_holidays * 2 / 3 total_games = games_in_Sofia + number_of_weekends + games_during_holidays if year == "l...
affdcc429b4b07cf051b70c29a84ced06025848f
StefanDimitrovDimitrov/Python_Basic
/11.Exam preparation/02_Summer_Shopping.py
563
3.90625
4
budget = float(input()) price_beach_towel = float(input()) discount = float(input()) umbrela = price_beach_towel * 2/3 flip_flops = umbrela * 0.75 beach_bag = (price_beach_towel + flip_flops) / 3 final_discount = (umbrela + flip_flops + beach_bag + price_beach_towel) * discount /100 total = (umbrela + flip_flops + be...
cf35a1461dde6e392ef6318378bbe892819e1e20
StefanDimitrovDimitrov/Python_Basic
/01. First-Steps in Codding Lab+Exr/12.deposits.py
756
4.34375
4
""" Напишете програма, която изчислява каква сума ще получите в края на депозитния период при определен лихвен процент. Използвайте следната формула: сума = депозирана сума + срок на депозита * ((депозирана сума * годишен лихвен процент ) / 12) Вход Изход 200 3 5.7 202.85 Вход Изход 2350 6 7 2432.25 """ def de...
d625d77c5c6286703ebffd3f475cc892ae311ed3
RogerFW/Hackerrank-Practice
/Python Practice/itertools.combinations_with_replacement().py
265
3.921875
4
# Enter your code here. Read input from STDIN. Print output to STDOUT import itertools string, combination_size = input().split() for combination in itertools.combinations_with_replacement(sorted(string), int(combination_size)): print(''.join(combination))
74282cfff03eee1a16ba6bb820662da772acafab
RogerFW/Hackerrank-Practice
/Python Practice/Hex Color Code.py
266
3.609375
4
# Enter your code here. Read input from STDIN. Print output to STDOUT import re for _ in range(int(input())): s = input() if re.match(r'^(.*\:|\s)', s, re.I): for m in re.finditer(r'(\#(?:[0-9a-f]{3}){1,2})', s, re.I): print(m.group(1))
60b8d7a8a99dbfaa37a306a52b235c7fb0659c27
schmett29/NBAScoreGenerator
/proj.py
5,125
3.578125
4
from pyspark.sql import SQLContext, functions from pyspark import SparkConf, SparkContext import math # Authors: David Schmetterling, Neal McGovern, Ade Afonja # How to run: Change the file path to your games.json MongoDB dump result # in the code that reads the JSON object, then run spark submit on the python p...
16455a89e005134b3270e8c993b05077e752d288
jaisanas/hgprofiler
/lib/helper/functions.py
669
3.65625
4
import os import random import string def get_path(relative_path=None): """ Return an absolute path to a project relative path. """ path_components = [os.path.dirname(__file__), "..", ".."] root_path = os.path.abspath(os.path.join(*path_components)) if relative_path is None: return root_path...
7307a542b0f9a1c87ac2496c1e5ddba34469bef1
Doekeb/KLRAlgebra
/Reduce.py
9,121
3.546875
4
@cached_function def reduced_words(g): return tuple(g.reduced_word()) # @cached_function # def reduce_full(word): # return reduce(word+reduced_words(g_ify(word))[::-1]+reduced_words(g_ify(word))) ''' Input can be any list containing positive integer entries. Any such list can be converted to an element of S_n (for ...
d70030688ec71aab2367e26ea39244f11516db8b
HengningZhang/15-puzzle-and-futoshiki-solver
/Project2/main.py
7,308
3.5
4
import heapq import copy #read the input files def read(filename): f=open(filename,"r") start=[] leftRight=[] upDown=[] for i in range(5): start.append(f.readline().split(" ")) for j in range(5): start[i][j]=int(start[i][j]) f.readline() for i in range(5): ...
eb405f5e1bd15f76e086f207bc6aec46f5b1e84e
gbox3d/python_study
/matplot/ex02_plot.py
366
3.609375
4
#%% import matplotlib import matplotlib.pyplot as plt import numpy as np #%% plt.plot([1,2,3],[5,7,2]) plt.plot([1,2,3],[3,10,7]) plt.xlabel('x-axis') plt.ylabel('y-axis') plt.title('title') plt.show # %% _data = np.random.rand(10) print(_data) #%% print(range(10)) plt.xlabel('index') plt.ylabel('value') plt.plot(...
4e127395e3009158daf224e38f72d89bc5f90be9
samiraabnar/LSTM-Embedded-Reber-Grammar-Detector
/rebergood.py
1,650
3.515625
4
"""Helper functions that generate a single string following Embedded Reber Grammar""" import random # Returns the non-embedded, internal string def reber_prime(): string = "B" luck = random.random() if luck < 0.5: string = reber_phase_a(string) luck = random.random() if luck <...
52775b73738a3caadc67a5238450d1ffaebbbde5
windskyer/k_nova
/paxes_nova/objects/network/dom_kvm.py
30,773
3.890625
4
# # ================================================================= # ================================================================= class IPAddress(object): """ An IP Address stores the level 3 information about a logical ethernet port. The data can be ipv4 or ipv6. """ def __init__(self, ad...
feb1e216755e57caf27d1edfd14ba54472cbc3d1
carden-code/python
/stepik/timur_and_his_numbers.py
481
3.875
4
# Timur thought of a number from 1 to n. # For what is the smallest number of questions (to which Timur answers "more" or "less") # Ruslan can be guaranteed to guess Timur's number? # # Input data format # The input to the program is a natural number nn. # # Output data format # The program should display the smallest ...
c7a9f186a03d699cfb4c205e0d4012f637d9963b
carden-code/python
/stepik/third_digit.py
356
4.15625
4
# A natural number n is given, (n> 99). Write a program that determines its third (from the beginning) digit. # # Input data format # The input to the program is one natural number, consisting of at least three digits. # # Output data format # The program should display its third (from the beginning) digit. num = input...
74446a287ad4ff8721c0a882051cd13971e88ba4
carden-code/python
/stepik/removing_a_fragment.py
504
4.1875
4
# The input to the program is a line of text in which the letter "h" occurs at least twice. # Write a program that removes the first and # last occurrences of the letter "h" from this string, as well as any characters in between. # # Input data format # The input to the program is a line of text. # # Output data format...
2bc8262fed12c963c4ea4513ae82ae5ee46d28c8
carden-code/python
/stepik/more_previous.py
1,132
3.96875
4
# На вход программе подается строка текста, содержащая натуральные числа. # Из данной строки формируется список чисел. # # Напишите программу, которая подсчитывает количество элементов полученного списка, # больших предыдущего (элемента с предыдущим номером). # # Формат входных данных # На вход программе подается строк...
69b16d9c547d2c153d686af7d849138a64ca1bd1
carden-code/python
/stepik/simple_cipher.py
424
4.3125
4
# The input to the program is a line of text. # Write a program that translates each of its characters into their corresponding code # from the Unicode character table. # # Input data format # The input to the program is a line of text. # # Output data format # The program should output the code values of the string ch...
69fd35f3faed85dd3ccc5a9a5c1fd5943b52623f
carden-code/python
/stepik/replace_me_completely.py
360
4.21875
4
# The input to the program is a line of text. # Write a program that replaces all occurrences of the number 1 with the word "one". # # Input data format # The input to the program is a line of text. # # Output data format # The program should display the text in accordance with the condition of the problem. string = in...
e0268220615c83737c7a823fd3195ed76188ab85
carden-code/python
/stepik/word_count.py
468
4.40625
4
# The input to the program is a line of text consisting of words separated by exactly one space. # Write a program that counts the number of words in it. # # Input data format # The input to the program is a line of text. # # Output data format # The program should output the word count. # # Note 1. A line of text does...
470ff99059fbc96a82232286b9465fb3564a7340
carden-code/python
/stepik/very_strange_things.py
955
4.0625
4
# Jim Hopper is trying to get Odie's message using the radio. # The receiver receives nn different Morse code sequences. # Having decoded them, he receives sequences of numbers and a lowercase Latin alphabet, # while all Odi's messages contain the number 11, and at least 3 times. # Help Jim determine the number of mess...
6be2286fe9476c8ee964976e14b3de72d4228609
carden-code/python
/stepik/fractional_part.py
342
4.375
4
# A positive real number is given. Output its fractional part. # # Input data format # The input to the program is a positive real number. # # Output data format # The program should output the fractional part of the number in accordance with the condition of the problem. num = float(input()) fractional = num - (int(nu...
10ccf77bd405de979d859da5f0d2489cecfb845e
carden-code/python
/stepik/prime_numbers.py
583
4.1875
4
# The input to the program is two natural numbers a and b (a < b). # Write a program that finds all prime numbers from a to b, inclusive. # # Input data format # The program receives two numbers as input, each on a separate line. # # Output data format # The program should print all prime numbers from a to b inclusive,...
5b72af43c04299274a2f60fe4b9ae694a7a7cbda
carden-code/python
/stepik/OOP_python/practice_bool_2.py
1,770
3.515625
4
# Сейчас вам нужно создать класс Quadrilateral (четырехугольник), в котором есть: # # - конструктор __init__. Он должен сохранять в экземпляр класса два атрибута: width и height. # При этом в сам метод __init__ может передаваться один аргумент # (тогда в width и height присваивать это одно одинаковое значение, ...
98c21ee3a49b5420d1f74200a2b2c097c5c49a7a
carden-code/python
/stepik/same_numbers.py
483
4.15625
4
# A natural number is given. Write a program that determines if a specified number consists of the same digits. # # Input data format # One natural number is fed into the program. # # Output data format # The program should print "YES" if the number consists of the same digits and "NO" otherwise. num = int(input()) las...
2f5a6df59b455d147efd00f8ba4025b7e8250b85
carden-code/python
/stepik/code_review2.py
752
4
4
# A sequence of 7 integers is received for processing. # It is known that the entered numbers do not exceed 10 ** 6 in absolute value. # You need to write a program that calculates and displays the sum of all even numbers in the sequence, # or 0 if there are no even numbers in the sequence. The programmer was in a hurr...
bd2ee920b3b63169a741adedb5fc6c37fad8931f
carden-code/python
/stepik/diagram.py
469
4.21875
4
# The input to the program is a string of text containing integers. # Write a program that plots a bar chart for given numbers. # # Input data format # The input to the program is a text string containing integers separated by a space character. # # Output data format # The program should output a bar chart. # Sample I...
5fdc0cdff3a3e407bdb6d698ad0d7c48f2f555c5
carden-code/python
/stepik/vowels_and_consonants.py
497
3.921875
4
string = input() count_vowels = 0 count_consonants = 0 consonants = 'бвгджзйклмнпрстфхцчшщБВГДЖЗЙКЛМНПРСТФХЦЧШЩ' vowels = 'ауоыиэяюёеАУОЫИЭЯЮЁЕ' for c in string: if c in vowels: count_vowels += 1 elif c in consonants: count_consonants += 1 print(f'Количество гласных букв равно {count_vowels}') ...
d74b3a0f209a35e82e1061370ea268d36cb3f1b4
carden-code/python
/stepik/reverse_number.py
558
4.53125
5
# Write a program that reads one number from the keyboard and prints the inverse of it. # If at the same time the number entered from the keyboard is zero, # then output "The reverse number does not exist" (without quotes). # # Input data format # The input to the program is one real number. # # Output data format # Th...
53ecd12f2e151c5f0b9d1fefcee465c1cd5cbc45
carden-code/python
/stepik/sample_list_1.py
766
4
4
# На вход программе подается число nn. Напишите программу, которая создает и выводит построчно вложенный список, # состоящий из nn списков [[1, 2, ..., n], [1, 2, ..., n], ..., [1, 2, ..., n]]. # # Формат входных данных # На вход программе подается натуральное число nn. # # Формат выходных данных # Программа должна выв...
8c678c8d77d22a603a84c0434d459197f6eadf6f
carden-code/python
/stepik/number_of_members.py
630
4.375
4
# The program receives a sequence of words as input, each word on a separate line. # The end of the sequence is one of three words: "stop", "enough", "sufficiently" (in small letters, no quotes). # Write a program that prints the total number of members in a given sequence. # # Input data format # The program receives ...
b06660bcc21e0142f6cdb78adb357b8df1953fb5
carden-code/python
/stepik/characters_in_range.py
500
4.3125
4
# The input to the program is two numbers a and b. # Write a program that, for each code value in the range a through b (inclusive), # outputs its corresponding character from the Unicode character table. # # Input data format # The input to the program is two natural numbers, each on a separate line. # # Output data f...
84342c5f534b935c231e13a9836c4af83e840fe2
carden-code/python
/stepik/sum_of_digits.py
218
4.125
4
# Write a function print_digit_sum () that takes a single integer num and prints the sum of its digits. def print_digit_sum(_num): print(sum([int(i) for i in str(_num)])) num = int(input()) print_digit_sum(num)
0291ba0bf851212409f7ac5f928153ba0fda249f
carden-code/python
/stepik/line_by_line_output.py
347
4.4375
4
# The input to the program is a line of text. Write a program that displays the words of the entered line in a column. # # Input data format # The input to the program is a line of text. # # Output data format # The program should display the text in accordance with the condition of the problem. string = input() print(...
7ff51d1eba257c63e2d174597dd3cbccbd8e18d6
carden-code/python
/coursera/second_right_digit.py
88
3.875
4
number = int(input()) if number < 10: print(0) else: print((number // 10) % 10)
a8260d9dbbe7b0fe0239b1f5c84ce9d1853a3ff2
carden-code/python
/stepik/sort_by_simple_inserts.py
416
4.0625
4
# You want to sort the list of numbers in ascending order: [1, 7, -3, 9, 0, -67, 34, 12, 45, 1000, 6, 8, -2, 99]. a = [1, 7, -3, 9, 0, -67, 34, 12, 45, 1000, 6, 8, -2, 99] n = len(a) for i in range(1, n): elem = a[i] # the first item from the unsorted part of the list j = i while j >= 1 and a[j - 1] > e...
f3e5e2a96224b5ad2133b5683b8803a654141797
carden-code/python
/stepik/sum_num_while.py
497
4.28125
4
# The program is fed a sequence of integers, each number on a separate line. # The end of the sequence is any negative number. # Write a program that outputs the sum of all the members of a given sequence. # # Input data format # The program is fed with a sequence of numbers, each number on a separate line. # # Output ...
5bd1d9a29c939c881e8a26024f5e1072a002b860
n34064730/270201066
/lab2/4.py
161
3.71875
4
cel=eval(input("What is the temperature type in Celsius: ")) dönüştürücü = cel * 1.8 +32 print("{} Celsius is {} Fahrenheit".format(cel,dönüştürücü))
00a65ee0f16358ac80336d4f44bf1958b87779a0
n34064730/270201066
/lab4/5.py
111
3.890625
4
sayı = int(input("Enter the number: ")) toplam= 1 for i in range (1,sayı + 1): toplam *= i print(toplam)
5793f6397b70c7460d3c176ac26b6a20468925bc
n34064730/270201066
/lab5/1.py
166
3.703125
4
çarpan =1 sonuc=1 sayı = int(input("Enter the number")) while çarpan <=10: sonuc= sayı*çarpan print("{} x {} = {}".format(sayı,çarpan,sonuc)) çarpan +=1
4daac1394f850748d65f1844630df08e0bcb7421
n34064730/270201066
/lab7/2.py
286
3.578125
4
books = ["ULYSSES","ANIMAL FARM","BRAVE NEW WORLD","ENDER'S GAME"] book_dict = {} for i in books: name = i sayi = len(name) uniqe = set() for x in name: uniqe.update(x) un_number = len(uniqe) numbers = sayi,un_number book_dict.update({name: numbers}) print(book_dict)
191dc70b3d5bafa5bfa519e434ef88b1f398a740
Algumi/modeling_univer
/task_4_v3.py
788
3.53125
4
import matplotlib.pyplot as plt def calculate(x, y, a, b): k1, k2, k3 = 1.1, 1.3, 1.5 t, h = 0, 0.2 a = [a] b = [b] ans_x, ans_y = [x], [y] while t < 10: a.append(a[-1] + h * ((-k1 - k2) * ans_x[-1] + k2 * ans_y[-1])) b.append(b[-1] + h * ((-k2 - k3) * ans_y[-1] + k2 * ans_x[-...