blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
17643de886bee41c3c5173355e0aabb03ea22c78
Puh00/toru-bot
/util/hacks.py
1,223
3.546875
4
"""Hacky Methods This script contains ehm... hacks that should normally not be used but we use anyways because reasons. """ def stringify_residue_args( _locals: dict, args_name: str = "args", kwargs_name: str = "kwargs" ) -> str: """Stringify and concatenate all *args and **kwargs arguments Parameters ...
ab66352bc17a441f7845aa5c2eb0d2b78b38abf8
luicast/cursoPython
/for.py
1,318
3.9375
4
def tabla(numero): print("la tabla del " + str(numero)) for i in range(1,11): print(str(numero) + "x" + str(i) + "=" +str(i*numero)) def mensaje(): msj = input("desea realizar otra tabla de multiplicar [y/n]: ") if msj == "y": run() else: print("gracias por usar este servic...
904a3713c42199ae4b32ed515734f558dfcb99a9
anakhap/ScribblerRobot
/TkinterPygame.py
1,257
4.03125
4
Tkinter ======= # respond to a key without the need to press enter import Tkinter as tk def keypress(event): if event.keysym == 'Escape': root.destroy() x = event.char if x == "w": print "blaw blaw blaw" elif x == "a": print "blaha blaha blaha" elif x == "s": ...
90dee8c80d2e34e2f94369961d7d68a5a3d3a8b8
HatemElhawi/student-Grads-Prediction
/grading.py
1,939
3.546875
4
import pandas as pd from sklearn import linear_model import numpy as np import csv import matplotlib.pyplot as plt df = pd.read_csv('grade19.csv') #read exel sheet reg = linear_model.LinearRegression() reg.fit(df[['7th','12th','att']],df.final) #predect final grade numOfStudents=int(input("en...
1064ec345d2d9b98cd6518ebf514032364f9d6fd
ishwarjindal/Think-Python
/Ex10_4_Chop.py
354
3.65625
4
#Author : Ishwar Jindal #Created On : 07-Jul-2019 12:37 PM #Purpose : Chop the list def chop(lst): #lst1 = lst[:] lst.pop(0) lst.pop(-1) return None print("main started") myList = [10,20,30,40,50] print(str.format("List before chopping is {0}", myList)) chop(myList) print(str.format("List after choppi...
6f693cc325f07ef6ba7448126e67f7a695880636
Aasthaengg/IBMdataset
/Python_codes/p03624/s314153396.py
127
3.640625
4
S=[x for x in input()] A='abcdefghijklmnopqrstuvwxyz' for a in A: if a not in S: print(a) break else: print('None')
3583e8d55ed4377dc0c89f1a69793af28af490d1
cu-swe4s-fall-2019/test-driven-development-sahu0957
/get_data.py
1,246
3.546875
4
import sys import argparse import select def read_stdin_col(col_num): # Only move forward with the script if stdin is empty # otherwise, exit to avoid the program stalling if sys.stdin in select.select([sys.stdin], [], [], 0)[0]: X = [] for l in sys.stdin: try: A...
98d69423c830e0ace5c4bb3024bac8db4042ff68
ssx1235690/pythonfullstack
/16-day线程.py
880
3.625
4
#!/usr/bin/python # -*- coding: utf-8 -*- # __Author__ = songxy # date : 2018/5/10 import threading import time print('start') def song(bar): time.sleep(1) print('song',bar) def xiang(bar): time.sleep(2) print('xiang',bar) t1 = threading.Thread(target=song,args=('lele',)) t2 = threading.Thread(targ...
0216498747c0f7bc983719d6f8d59552f98ca194
ArnoldoRicardo/gato
/main32.py
849
3.890625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- map = [[" ", " ", " "], [" ", " ", " "], [" ", " ", " "]] def si(preg): resp = input(preg) return (resp[0] == 's') def tirar(player,pos): ind = pos.split(",") n = int(ind[0]) - 1 m = int(ind[1]) - 1 if player == 1: map[m][n] = "x" else: map[m][n] = "o" ...
94f6bc08eddc1e8594aee1f407406e2f3b3e9dfc
abx67/BasicDataScienceAlgorithm
/Goldman_Sachs/second_min.py
472
3.609375
4
def second_min(num): n= len(num) if n < 2: return -1 if num[0] > num[1]: min = num[1] second = num[0] else: min = num[0] second = num[1] for i in range(2,n): if num[i] < min: second = min min = num[i] elif ...
0828f989103a49a4c23cdab0f673519488c5412a
mrhut10/funky
/funky.py
3,339
4.09375
4
# generic fancy Function's # trying to loosely follow principles of functional programming paradigm and Category theory within Math # function -> function def curry(fun:"function"): """ implementation of a curry/currying function visit https://en.wikipedia.org/wiki/Currying for more information """ def c...
065f0c9ad6a542087f75bc9373c67580854e6675
dersonf/aulaemvideo
/exercicios/ex040.py
435
3.71875
4
#!/usr/bin/python36 n1 = float(input('Insira a PRIMEIRA nota: ')) n2 = float(input('Insira a SEGUNDA nota: ')) media = float((n1 + n2) /2) if media >= 7: print('Sua média foi {:.1f}, você foi \033[1;32;44mAPROVADO\033[m!'.format(media)) elif media >= 5: print('Sua média foi {:.1f}, voce está de RECUPERAÇÃO!'.fo...
4de19754f697ad1d368d9eed62b47b69235bd888
northbridge-portfolio/PYTHON
/PythonPoker/Hand.py
2,252
3.734375
4
''' Filename: Hand.py Author: NorthBridge Python Version: 2.7 Copyright 2017 - NorthBridge - All Rights Reserved This class is responsible for encapsulating cards into a list of Cards called called_list. ''' from Suit import * import Card class Hand(object): # Construc...
3c56a4a55a43e0fc6abca9d2ca5dfad8efa74dc1
AlexAbades/Python_courses
/3 - Python_Deep_Dive/Part 1_Functional Programming/3 - Numeric types/18 - Comparison Operators/Comparision.py
1,315
4.09375
4
# Categories of Comparision Operators # Binary operators # evaluate to a bool value # Identity operators: is / is not --> compares memory address - any type # Value comparision: == / != --> Compares values, different types OK, but must be compatible. # Will work with all numeric types. # Mixed types (exc...
86ea7a1be46be6c3c68f4d6e348b25d5fe788b75
testcomt/pythonlearning
/test_rhl.py
2,198
4
4
MAX_COUNT = 10000 # number shuold be a positive integer? def cube_int(number): """input a positive integer return 0 if not being able to find""" if number == 0: return 0 if number == 1: return 1 min_number = 0 max_number = number value = number // 2 count = 0 whi...
8790cda34a4758e4d4224f562b38ba37e178ad89
panmaroul/Numeric-Analysis
/ex5.py
1,300
4.03125
4
from matplotlib import pyplot as plt import numpy as np import math ''' The deltaArray function returns a deltaarray matrix which contains all the Δ that is used for computing the polynomial approximation ''' def deltaArray(): deltaarray = np.zeros((len(arraysOfy),len(arraysOfy))) for i in range(0...
25f9411fe628a5bed07b396a8b3b4572c7822130
sebastianceloch/wd_io
/lab5/zadanie8.py
740
3.625
4
class Samogloski: def __init__(self, napis): if isinstance(napis, str): self.napis = napis self.index = 0 self.lista = ['a','ą','e','ę','i','o','ó','u','y','A','Ą','E','Ę','I','O','Ó','U','Y'] def __iter__(self): return self def __next__(self): i...
18c0542251fb31e6c9cb90c9fdab8bdf5eeb544f
MartinMxn/NailTheLeetcode
/Python/Medium/Fine_572. Subtree of Another Tree.py
1,202
3.890625
4
# Definition for a binary tree node. # class TreeNode: # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution: """ preorder O(m*n) """ # def same_tree(self, s, t): # if not s and not t: # return True # i...
701cd161f0d0790c8b82e61dddd83bc9fa233248
orenovadia/euler
/solved/euler2.py
745
3.578125
4
from math import sqrt def isPandigital(s): return set(s) == set('123456789') rt5=sqrt(5) def check_first_digits(n): def mypow( x, n ): res=1.0 for i in xrange(n): res *= x # truncation to avoid overflow: if res>1E20: res*=1E-10 return re...
43b32df6404181e5f4cd98894f3e6026d4630f54
vgattani-ds/programming_websites
/leetcode/0128_removeCoveredIntervals.py
778
3.59375
4
from typing import List class Solution: def removeCoveredIntervals(self, intervals: List[List[int]]) -> int: result = len(intervals) if result == 1: return 1 intervals.sort(key= lambda x: (x[0],-x[1])) prev_x, prev_y = intervals[0] ...
ca2bf6465a6c687991f1c0d8db997a082374d9b9
ZhenJie-Zhang/Python
/homework/m2_iteration/amstrong.py
592
3.640625
4
# 4. 迴圏的練習-amstrong # Armstrong數是指一個三位數的整數,其各位數之立方和等於該數本身。 # 找出所有的Amstrong數。 # 說明:153=1^3+5^3+3^3,故153為Amstrong數。 num = 999 for test in range(100, num + 1): digit100 = test // 100 digit10 = test % 100 // 10 digit1 = test % 10 # print(digit100, digit10, digit1) Cube_Sum = digit100 ** 3 + digit10 ** ...
04e74052ee305001dc0c0fd8a9c8ceb6619dd3bb
ravenstudios/nQueens
/main.py
1,810
3.828125
4
# Robert Dodson RavenStudios 11/1/21 import math # print("nQuees") result = []; n = 4; def place_queen(row): if row > n: return # loop through each col in a row and try to place a queen # if backtracking start the loop at the next col that the previous result for_start = row * n for_stop = ...
be8ceb7acd1285f6d75f6e10a4598c9504dfb0ae
abelAbel/OS_Dean_Abel
/Gui_Practice/__init__.py
3,060
3.546875
4
__author__ = 'abelamadou' from threading import Thread from Tkinter import * import tkinter.messagebox import tkFont root = Tk() frame = Frame(root, bd=2,bg='blue', relief=SUNKEN) frame.grid_rowconfigure(0, weight=1) frame.grid_columnconfigure(0, weight=1) xscrollbar = Scrollbar(frame, orient=HORIZONTAL) xscrollbar....
1499280e835d5c7f17f8b876c5caad28d4f53a32
carevon/learning-python
/basics/print.py
226
3.84375
4
# PYTHON BASICS - PRINT FUNCTION subst = "Python" verb = "is" adjective = "fantastic" print(subst, verb, adjective, sep="_", end="!\n") # IMPRIMINDO UMA DATA dia = "07" mes = "07" ano = "1993" print(dia, mes, ano, sep="/")
f3bccf13bc8a8fa44786b621812ed63af1936db9
Meaha7/dsa
/trees/binary/practice/insert-in-level-order.py
587
3.75
4
from collections import deque from binarytree import build, Node def main(root, val): if not root: return Node(val) queue = deque([root]) while queue: node = queue.popleft() if node.left: queue.append(node.left) else: node.left = Node(val) ...
55dff8a504ddc8afe40872cbcc16ece98f685097
okumurakengo/til
/python/17_str.py
303
3.53125
4
name = "taguchi" score = 52.3 print("name: %s, score: %f" % (name, score)) print("name: %-10s, score: %10.2f" % (name, score)) print("name: {0}, score: {1}".format(name, score)) print("name: {0:10s}, score: {1:10.2f}".format(name, score)) print("name: {0:>10s}, score: {1:<10.2f}".format(name, score))
89ad1cf0fbdfbc8254908c10ad93031f8a3871b9
sandeepdas31/python
/simpleclassobj.py
307
3.671875
4
class person: def __init__(self,x,y): print("simple class object program") self.x=x self.y=y self.x+=self.y def fun(self,z): self.z=z print(z) p1=person(30,20) print(p1.x) print(p1.y) p1.fun(8745) p1.fun("hello")
3c6424b24f9fbf178360b5f0eb5322b0002174dd
swynnejr/bank_account
/bank_account.py
1,211
3.875
4
class BankAccount: def __init__(self, int_rate, balance): self.int_rate = int_rate self.balance = balance # self.name = User def deposit(self, amount): self.balance += amount return self def withdrawl(self, amount): if self.balance < amount: prin...
13b64f19e499279ce9c80a291ace9f2b6a3d4373
qeedquan/challenges
/leetcode/matrix-diagonal-sum.py
1,089
4.34375
4
#!/usr/bin/env python """ Given a square matrix mat, return the sum of the matrix diagonals. Only include the sum of all the elements on the primary diagonal and all the elements on the secondary diagonal that are not part of the primary diagonal. Example 1: Input: mat = [[1,2,3], [4,5,6], ...
75e93c0987bc7ff9c21846dca746d96e726539ec
lalit97/DSA
/Tree/count_leaves.py
594
3.71875
4
''' one of the way ''' count = 0 def countLeaves(root): global count count = 0 count_helper(root) return count def count_helper(root): global count if root is None: return None if root.left is None and root.right is None: count += 1 count_helper(root.left) count_...
d35f7a00aa9e553a3c8011d02bd8ccdab77e3129
Fromero8706/AIA---GeoOpt
/A2/AIA_GEOOPT_SUNVEC_FR.py
1,225
3.6875
4
""" IAAC - Master of Computation for Architecture & Design (MaCAD) Seminar: Digital tools for Algorithmic Geometrical Optimization Faculty: David Andres Leon, Dai Kandil Student: Felipe Romero Assignment 02 - Part A Sun Vector Script """ import Rhino.Geometry as rg #import Rhinoscriptsyntax as rs import math #cre...
af949b5b1e842b9b2e823a0446aad50902f4bdf6
SimonFans/LeetCode
/OA/MS/Max Network Rank.py
384
3.515625
4
from collections import defaultdict def max_network_rank(A,B,N): res=float('-Inf') mp=defaultdict(list) for i in range(len(A)): mp[A[i]].append(B[i]) mp[B[i]].append(A[i]) print(mp) for i in range(len(A)): res=max(res,len(mp[A[i]])+len(mp[B[i]])-1) return ...
bb8297d9bbde029a494cce6e3c3fc05cd58ef36d
dim-akim/python_lessons
/profile_10/lesson2_sort_new.py
379
3.6875
4
n = 6 a = [2, 8, 15, 6, -5, 3] b = [] for i in range(n): # ищем минимальное значение в массиве minimum = a[0] for j in range(n): if a[j] < minimum: minimum = a[j] b.append(minimum) a.remove(minimum) n = n - 1 # решаем проблему с изменением длины списка print(b)
5b588dcd4b79d0ee3c64eb505cb12f0fd5197a18
blopah/python3-curso-em-video-gustavo-guanabara-exercicios
/Desafios/Desafio 106.py
866
4.125
4
print('''Faça um mini sistema que utilize o interactive Help do Python. O usuário vai digitar o comando e o manual vai aparecer. Quando o usuário digitar a palavra "FIM", o programa se encerrará. OBS:Use cores''') from time import sleep def msgr(x): l = len(x)+2 print('\033[1;30;41m~' * l) print(f' {x}', e...
875d880a84d3e1c9f9cc258505b4e7a41bca2ee3
yamarba/algorithmsngames
/nonRepeating1.py
579
3.84375
4
# This is a sample Python script. # Press ⌃R to execute it or replace it with your code. # Press Double ⇧ to search everywhere for classes, files, tool windows, actions, and settings. def non_repeating(s): s = s.replace(' ', '').lower() char_count = () for c in s: if c in char_count: ...
a917acab5912af5a9b7b13e20cffcc1bd5543151
pkrishn6/problems
/api/singleton.py
484
3.71875
4
class SingleTone: __instance = None def get_instance(val): if not SingleTone.__instance: SingleTone.__instance = SingleTone(val) return SingleTone.__instance def __init__(self, val): if SingleTone.__instance is not None: raise KeyError self.val = val ...
c3220cd1bf71ad4f97d6362b9a49dfeabf0f166c
shenlinli3/python_learn
/second_stage/day_11/demo_02_面向对象-私有属性.py
1,032
3.8125
4
# -*- coding: utf-8 -*- """ @Time : 2021/5/22 11:41 @Author : zero """ # 面向对象的三大特性之一:封装 # 私有属性 private class Person: __sex_list = ["GG", "MM"] def __init__(self, name, sex): if type(name) != str or type(sex) != str: raise TypeError("姓名和性别必须是字符串") self.__na...
f395c7e7becad95088723f73e7a0e7bdd143992b
AntonioCenteno/Miscelanea_002_Python
/Ejercicios progra.usm.cl/Parte 1/3- Ciclos/tabla-de-multiplicar.py
270
3.90625
4
#Hacemos dos ciclos for, que vayan de 1 a 10 for y in range(1,11): #Eje y for x in range(1,11): #Eje x print str(x*y).rjust(4), #rjust() justifica el texto a la derecha #rellenando con espacios hasta llegar a #un largo de 4. print "" #Pasar a la linea de abajo
9c6bc65fe9fda0e72a7fe0fb0b8d2207d16a1e54
rivergt/python-learning
/1-10num_guess.py
1,048
3.734375
4
#猜数字游戏2.0版本【20191018AM11:25】 #!/usr/bin/python # -*- coding: UTF-8 -*- import random answer = random.randint(1,10) print("我爱猜数字游戏2.0版本") guess = int(input("来猜猜我心里想的是哪个数字,1-10随便选一个吧:")) counter = 0 if (guess == answer) and (counter == 0) : print("恭喜你,第一次就答对了") else: while (guess != answer) and (coun...
d189b0609e3d89225dd484cfbf454c617b6e28aa
marcelfeige/MashineLearningCode
/LinRegressionWohnung.py
731
3.5
4
import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression df = pd.read_csv( "..\Kursmaterialien\Abschnitt 05 - Lineare Regression\wohnungspreise.csv") plt.scatter(df["Quadratmeter"], df["Verkaufspreis"]) #plt.show() model = LinearRegression() model.fit(df[["Quadratmet...
e55775b42cc6bb4939b8d8ea6395f2ae98e70c58
Introduction-to-Programming-OSOWSKI/3-14-find-doubles-IsaacYantes23
/main.py
179
3.671875
4
def findDoubles(w): for i in range(0, len(w)): if w[i] == w[i-1]: return True else: return False print(findDoubles("madagascar"))
b88eac4ce3689abc81efe7efd1a72ddddd4add27
uiandwe/TIL
/algorithm/programers/해시/42577.py
402
3.765625
4
# -*- coding: utf-8 -*- def solution(phoneBook): phoneBook = sorted(phoneBook) for p1, p2 in zip(phoneBook, phoneBook[1:]): if p2.startswith(p1): return False return True def test_solution(): assert solution(["119", "97674223", "1195524421"]) == False assert solution(["123","4...
5c00fbfdf13eda7f84271f791b00ddb6132cdd8f
govilharsh/Hello-World
/problem1.py
115
3.90625
4
print("Enter a number") num=int(input()) a=0 b=1 print(a) print(b) for i in range(num): c=a+b print(zz) a=b b=c
54192e1f61736cb6e8db1e82dbd15f7ce9f870ba
johnistan/Interview_Problems
/palindrome.py
1,013
3.828125
4
''' Retun true if a palindrome ''' #Recursive solution def pal(word): if len(word) < 2: return True if word[0] == word [-1]: return pal(word[1:-1]) if word[0] != word [-1]: return False #Simple reverse list solution def pal2(word): return word == word[::-1] #Solve by skipping ...
0f7c7c012866df06c99c359faa07cc258a5da91f
orlewilson/oficina-python-uninorte-2020
/exemplo-03.py
528
3.625
4
''' Oficina Profissionalizante - Uninorte/2020 Python e suas Aplicações Facilitador: Orlewilson Bentes Maia Data: 30/10/2020 Nome: Seu nome Descrição: função ''' # função para mostrar conteúdo de um variável informada por parâmetro def mostrarConteudo(var=0): print(f"Conteúdo da variáve...
94bbd43e6337b92292ce3c59b95d86c0b6ef4b80
ivarus/Challenges
/CodeEval/src/Hard/RobotMovements.py
504
3.53125
4
''' Created on Mar 14, 2015 @author: Ivan Varus Thanks: Ferhat Elmas ''' visited = [[False]*4 for _ in range(4)] def step(i, j): if i == 3 and j == 3: return 1 if min(i, j) < 0 or max(i, j) > 3: return 0 if visited[i][j]: return 0 visited[i][j] = True count = step(i, j-...
8ee7096b17c1af7346041b7c6f5da4db3a67015a
genos/online_problems
/prog_praxis/two_factoring_games.py
2,873
3.640625
4
#!/usr/bin/env python ############################ # Behind the Scenes # ############################ from random import randrange def split(n): s = 0 while (n > 0) and (n % 2 == 0): s += 1 n >>= 1 return (s, n) def P(a, r, s, n): if pow(a, r, n) == 1: return True ...
cb8a2d005977b92f2f3be674fc467597a64cd6c1
rafaelperazzo/programacao-web
/moodledata/vpl_data/3/usersdata/143/798/submittedfiles/ex1.py
327
3.640625
4
# -*- coding: utf-8 -*- from __future__ import division a = input('Valor de a') b = input('Valor de b') c = input('Valor de c') delta = (b)**2-4*a*c x1 = (-b+delta**0.5)/2*a x2 = (-b-delta**0.5)/2*a if (delta<0): print ('A equação não pussui raízes reais') else: print('%.2f'%x1) print('%.2f'%x2) ...
4f5bcfff48f170260be1fedb7a169ded5b584f80
pranavgurditta/data-structures-MCA-201
/linked_list_pranav.py
6,143
4.28125
4
class Node: ''' Objective: To represent a linked list node ''' def __init__(self,value): ''' Objective: To instantiate a class object Input: self: Implicit object of class Node value: Value at the node Return Value: None ...
1d36a30b469e8d9e4f072d7b6f49c8361bdc5efc
matt-duell/euler
/challenge_3/prime_factors.py
4,015
4.125
4
import math from sets import Set def approach1(target): currentNumber = 3; #Cut the numbers we have to search through in half, there won't be any over half way that are prime factors. cur_max_pos_factor= math.floor(target /2) #start main processing while currentNumber < cur_max_pos_factor: #first check if it...
970d0b4f8c1b3678f43f249c2b4f6add791a35d4
EvelynBortoli/Python
/02-Variables-y-tipos/tipos.py
282
3.578125
4
nada = None cadena= "Evelyn Bortoli" numero = 15 decimal = 1.5 #imprimimos una variable print(nada) #imprimimos el tipo de la variable print(type(nada)) #imprimimos una variable print(cadena) print(type(cadena)) print(numero) print(type(numero)) print(decimal) print(type(decimal))
6f40eb77a1904c0d5b7571af30ac5b8a96dfd45c
fuzzy69/my
/my/extra/text.py
254
3.578125
4
from typing import AnyStr from pycld2 import detect def is_text_english(text: AnyStr) -> bool: """Returns True if given text is English otherwise False""" is_reliable, _, details = detect(text) return is_reliable and details[0][1] == "en"
fa2ec533b5e79f07a57ae208858c6be52ec9555b
ramonarr/Python-staff-signals
/rectangular_signal_generator_with_editable_frequency.py
475
4
4
# Generating a rectangular periodic signal with editable frequency in python t = arange(0,2,0.001) f = 5 # Frequency [Hz] x = 0 # The initial value of x k = 1 # Multiplication factor N = 1001 # Harmonics number while k <= N: x = x + (4/pi)*(1/k)*sin(2*k*f*pi*t) k = k+2...
7cfc9d63fd7304af6abe9cd6a1bbc1bb78f009eb
kjh03160/data_structure
/lecture/Linked_List/Dlist.py
2,449
3.828125
4
class Node: def __init__(self, key = None): self.key = key self.next = self self.prev = self def __str__(self): return str(self.key) class DList: def __init__(self): self.head = Node() # 더미 노드 self.size = 0 def splice(self, a, b, x): ...
0b8fa2bf419f6fbc895571873d387de9e396a765
book155/pythonCorePractice
/chapter 11/11-4.py
164
3.609375
4
def convert2(minute): hour = minute // 60 minute = minute - 60* hour return hour,minute hour,minute = convert2(790) print(hour) print(minute)
7f8719d38410ff2fe23b15180442e08781a696a6
radeknavare/99Problems
/6_Find out whether a list is a palindrome.py
231
4.15625
4
newList = [1, 2, 3, 2, 1] newTuple = (1, 2, 3, 2, 1) if newTuple == newTuple[::-1]: print("Palindrome") else: print("Not Palindrome") if newList == newList[::-1]: print("Palindrome") else: print("Not Palindrome")
8f1bdc466ca68c4076ec2927b6449e8e5c0ba8ce
gabriellaec/desoft-analise-exercicios
/backup/user_116/ch22_2020_03_04_12_59_24_369445.py
158
3.5625
4
def ft(t,n): z=(n*(0.00694444))*(t*360) return z t=int(input('tempo em anos')) n=int(input('cigarros por dia')) print(int(ft(t,n)),('anos perdidos'))
ebf10197aa3f9f6e8b65f1352c388dc7a1a4ffa8
Elaine-FullStackDeveloper/Bootcamp-Banco-Carrefour-Data-Engineer
/Soluções Aritmeticas em Python/Triangulo.py
754
3.75
4
''' Leia 3 valores reais (A, B e C) e verifique se eles formam ou não um triângulo. Em caso positivo, calcule o perímetro do triângulo e apresente a mensagem: Perimetro = XX.X Em caso negativo, calcule a área do trapézio que tem A e B como base e C como altura, mostrando a mensagem Area = XX.X Entrada A entrada ...
edf1b9bff1ac2cd4631cd14ce70429dfc3184057
Ford-z/LeetCode
/714 买卖股票的最佳时机含手续费.py
1,410
3.578125
4
#给定一个整数数组 prices,其中第 i 个元素代表了第 i 天的股票价格 ;非负整数 fee 代表了交易股票的手续费用。 #你可以无限次地完成交易,但是你每笔交易都需要付手续费。如果你已经购买了一个股票,在卖出它之前你就不能再继续购买股票了。 #返回获得利润的最大值。 #注意:这里的一笔交易指买入持有并卖出股票的整个过程,每笔交易你只需要为支付一次手续费。 #来源:力扣(LeetCode) #链接:https://leetcode-cn.com/problems/best-time-to-buy-and-sell-stock-with-transaction-fee #著作权归领扣网络所有。商业转载请联系官方授权,非商业转载请...
ba4554327eabf1eb61640b35d42125429215fa73
alexpt2000/4Year_PythonFundamentals
/6_Largest and smallest in list.py
317
4.15625
4
def MaxMin(list): minValue = min(list) maxValue = max(list) return minValue, maxValue list = [] num = int(input('How many numbers int the list: ')) for n in range(num): numbers = int(input('Enter number ')) list.append(numbers) print("Min and Max element in the list is :", MaxMin(list))
9700dfd9bbb16b807573dfd20b805b1e37018464
hooong/baekjoon
/Python/14425_1.py
910
3.5
4
# 14425번 문자열 집합 (트라이) from sys import stdin class Node: def __init__(self, key): self.key = key self.child = {} class Trie: def __init__(self): self.head = Node(None) def insert(self, word): cur = self.head for ch in word: if ch not in cur.child: ...
d4fdff5baa1355d1bf20f9d07a1b86c7a3599adb
addn2x/python3
/ex04/ex04function04.py
362
3.8125
4
# Fuctions # factoriel exmple # 5! = 5 * 4 * 3 * 2 * 1 # sum of factoriel example # sum = 5! + 4! + 3! + 2! + 1! def my_fakt(n): fakt = 1 for i in range(1, n + 1): fakt *= i return fakt def fact_sum(n): my_sum = 0 for i in range(1, n + 1): my_sum += my_fakt(i) return my_...
7b1e913f7fc5e6423a57f2dd3bf3db25f6a3f798
wawj901124/uiautomator2project
/util/compic.py
879
3.71875
4
from PIL import Image #使用第三方库:Pillow import math import operator from functools import reduce image1=Image.open('D:\\Users\\Administrator\\PycharmProjects\\uiautomator2project\\screenshots\\S81102-151706.jpg') image3=Image.open('D:\\Users\\Administrator\\PycharmProjects\\uiautomator2project\\screenshots\\S81102-151717...
a6f41c526ffcf94c556b3756be4465c8f7488688
abhimaprasad/Python
/Python/Operators/ArthemeticOpeators.py
197
4.21875
4
#Arthemetic Operators(+,-,*,/,%,//) a=int(input("enter a number")) b=int(input("enter a number")) c=a+b; print(c) c=a-b; print(c) c=a/b; print(c) c=a*b; print(c) c=a//b; print(c) c=a%b; print(c)
df4a3db224f90099b3b68d9ff68371f4985fab6c
lr-carmichael/write-docker-actions
/.github/actions/cat-facts/src/main.py
655
3.5625
4
import requests import random import sys # Make an HTTP GET request to the cat-fact API cat_url = "https://cat-fact.herokuapp.com/facts" r = requests.get(cat_url) r_obj_list = r.json()["all"] # Create an empty array, populate it with cats fact_list = [] for fact in r_obj_list: fact_list.append(fact["text"]) # cr...
8f3420c99ae3bda89cf090baab00bf22f53b66c1
shesha4572/11
/3_1.py
253
3.703125
4
def series1() : for i in range (1 , 86 , 2): print(i , end = " ,") print() def series2(): sum = 0 for a in range(1, 21 , 3): sum += a print("The sum of the series is 1 + 4 + 7+ ...20 is " ,sum) series1() series2()
9abcd8ca83c4b662859c70b09b468b69d0cd1665
adithyaGR/Ginormoust-oo-r-in
/T-u-ring.py
11,796
4.34375
4
from collections import defaultdict .... # TuringMachine class represents our Turing machine;;;;;;; class TuringMachine: # Action class represents the action that can be taken in any step of # the execution of Turing machine class Action: # Action consists of: # # - self.turing_m...
efc3526eea9c4d455944f47b4012b180027fa724
nestorast/Pythonbasic
/change_DMS.py
1,682
3.609375
4
import math def calcular (latitud, longitud): if latitud[0] == "N" : gradolat = int(latitud[1]) minutolat = int(latitud[2:4]) segundolats = float(latitud[4:9]) latitud_decimal = gradolat + minutolat/60 + segundolats/3600 #print ("la latitud ingresada es " + str(g...
8bd76da7a1b82235fd88b07d2f05af47ccd2bc23
siddhartharao17/hackerrank
/src/varargs-demo.py
1,009
5.03125
5
# This program demonstrates the use of *args which is called variable non-keyworded arguments. # This is used when you suspect that a function might accept multiple arguments rather than # restricting it to just n number of args at compile time. # Example of fixed args at compile time # def multiply(x,y): # print(...
c857f6a082a00d7392e68c03c5cbb221406a0041
LeiscarT/LearningPython
/120 exercises/exercise_#7.py
155
3.75
4
nombreArchivo = input("ingrese el nombre del archivo: ") extension = nombreArchivo.split('.') print("La extension del archivo es: " + repr(extension[-1]))
060c0bdca4eb5e2bff9d38e9a176e0be5bfe96a9
stt106/pythonfundamentals
/introduction/scalar-types.py
1,538
4.3125
4
# integer by default by specified by decimals but other forms are also available print('decimal form: ' + str(10)) # with base 10 print('binary form: ' + str(0b10)) # with base 2 print('Octal form: ' + str(0o10)) # with base 8 print('hex form: ' + str(0x10)) # with base 16 # convert to int using int ctor ...
fbf742598c61dc8bb54b490b07e276b88354df6d
Melmanco/INFO229
/Tutorial_4_PyTest_TDD/romanos/roman_numerals.py
1,286
3.609375
4
def convert(num, num_type): if num_type == 'num': return { 1000: 'M', 900: "CM", 500: 'D', 400: "CD", 100: 'C', 90: "XC", 50: 'L', 40: "XL", 10: 'X', 9: "IX", 5: 'V', ...
424667bcb333b38134f471a6c35034667b428e6a
ReginaGates/ControlFlowChalleng_CompletePythonMasterclass
/programFlowChallenge_simplified.py
904
3.890625
4
#Complete Python Masterclass - Tim Buchalka & Jean-Paul Roberts #Challeng - Program Flow #Simplified name = input("What is your name? ") user_IP_address = input("Hello, {}, what is your IP address? ".format(name)) seg_count = 0 new_string = '' # if user_IP_address[-1] == '.': # for char in user_IP...
094bc27362e171f83b2360627cf135b201bbc731
hfuong/nbatwitter
/src/playerlist.py
1,514
3.5
4
# Import relevant modules from selenium import webdriver from bs4 import BeautifulSoup import time import csv # Get web page with dynamic content that requires scrolling to load driver = webdriver.Chrome(executable_path = "C:/Users/holly/PycharmProjects/chromedriver.exe") driver.get("https://nba.com/players/") # Get...
b163a0de3be4fb97add28b8902927cf6b073cfda
goutham-2411/PythonCalculator
/PythonCalculator.py
6,220
4.34375
4
# Programmer - python_scripts (Abhijith Warrier) # PYTHON SCRIPT TO CREATE A SIMPLE GUI CALCULATOR & PERFORM THE CALCULATION eval() METHOD IN PYTHON # # The eval() allows to run Python code within itself. The eval() method parses the expression passed to it and runs # python expression(code) within the program. # # Th...
bd11ecfe3c3aa89f7c86675e3b94fbec63f9b52a
frclasso/Aprendendo_computacao_com_Python
/Chap19-Filas/fila.py
3,571
4.09375
4
#!/usr/bin/env python3 class Node: def __init__(self, carga=None, proximo=None): self.carga=carga self.proximo=proximo def __str__(self): return str(self.carga) def imprimeLista(no): while no: print(no, end=" ") no = no.proximo print() ...
75e448ccf87c5caedb6bf9962daf59d02583cb55
qinyj12/fluent-python-note
/1.2.py
940
4.15625
4
from math import hypot class Vector(object): def __init__(self, x, y): self.x = x self.y = y # 用print调用 def __repr__(self): # %r是把参数原样打印出来,这里用%s其实也是可以的 return 'Vector(%r, %r)' % (self.x, self.y) # 用abs()调用 def __abs__(self): return hypot(self.x, self.y) ...
6a14e89e93fa2c049b389b5b84c3fc054b8fe939
fengtao1994/ceshi
/3-1~3-10/for_while.py
656
3.875
4
#Python提供了for循环和while循环(没有do..while循环) #for 循环 遍历打印全部数组 student=['ja','bob','ma','mic'] for stu in student: #赋值到 stu print(stu) #平行打印全部 #计算1+2+3+...10的值 #Python 提供一个range()函数,可以生成一个整数序列,比如range(10)生成的序列是从0开始小于10的整数 sum=0 for i in range(11): sum=sum+i print(sum) ...
5a92abc4592b3623554bf62e1f353aa6c99fa65a
himanshupatel96/GeneticAlgorithm
/mathsGA.py
4,561
3.640625
4
""" Use GA to find the optimal solution for a + 4b + 2c + 3d = 40 """ import random from itertools import chain import sys mrate = 0.12 crate = 0.70 population = [] """Generating Initial Population Randomly """ if len(sys.argv) == 2: pop_size = int(sys.argv[1]) for i in range(1, pop_size): x = [] for ...
5dedf557a831566bbbbd840af0f135af93daee5a
antoalv19/TP_solutions
/ch16_ex.py
2,063
4.3125
4
class Time: '''Represents the time of day. attributes: hour, minute, second ''' def print_time(t): print ('(%.2d:%.2d:%.2d)' % (t.hour, t.minute, t.second)) def is_after(t1, t2): return (t1.hour, t1.minute, t1.second) > (t2.hour, t2.minute, t2.second) def mul_time(t, n): '''Multiple time t by n n: int ...
1b39dc89dc110e9e1505c176e271d6aac6ac671c
Debu04/My-Python-Projects
/First Fibonacci numbers using While loop.py
502
4.21875
4
''' This code will be print the first 50 Fibonacci numbers using While loop This will print the Fibonacci numbers which is below 50 We know that the First Fibonacci numbers is 0 and 1 So we take a = 0 and b = 1 Then we swapping the values to print the first fibonacci numbers till 50 ''' # Assigning th...
92f5ed5bd1751905fcafd1041d1f19b698313dbd
Novicett/codingtest_with_python
/정렬/k번째수.py
253
3.640625
4
def solution(array, commands): answer = [] for num in range(len(commands)): arr = array[commands[num][0]-1:commands[num][1]] arr.sort() print(arr) answer.append(arr[commands[num][2]-1]) return answer
ed0063714be16906b59b416472538f3365a940c8
vik407/holbertonschool-higher_level_programming
/0x03-python-data_structures/5-no_c.py
212
3.6875
4
#!/usr/bin/python3 def no_c(my_string): _my_string = "" for each_c in my_string: if each_c in ['c', 'C']: continue else: _my_string += each_c return _my_string
14fede57a8035afb833a0dbea0c3782c37e1ac32
GEEK1050/holbertonschool-web_back_end
/0x00-python_variable_annotations/7-to_kv.py
319
3.9375
4
#!/usr/bin/env python3 """7-to_kv.pt""" import typing def to_kv(k: str, v: typing.Union[int, float]) -> typing.Tuple[str, float]: """ to_kv a function that takes as argument a string k, an Union of int and float v and return a tuple containig k and the result cube of v """ return (k, v ** 2)
75e5e0c57e75e34258393b2e5bc6fb051e8e1b4d
mhasanemon/Python-Scrapy
/Demo/Demo/spiders/status check/website_status.py
631
3.59375
4
import urllib.request as urltoopen; def check_status(param): status = urltoopen.urlopen(param); return status.getcode() #This checks if the website is up or down urls = [ 'https://bbc.co.uk ', 'https://cnn.com ', 'https://nytimes.com ', 'https://gglink.uk', 'https://...
fffa04fb624061d10888d1fe61a9992747ba8616
structuredworldcapital/Lab-de-Estudos
/guilherme.py - Organizar/aula18.py
1,638
4.34375
4
teste = list() #mesma coisa que teste = [] cria uma lista vazia teste.append('Guilherme') teste.append(40) galera = list() galera.append(teste[:]) #da pra add uma lista em outra lista, a lista teste ta dentro da lista galera teste[0] = 'Maria' #mudei as informações de teste teste[1] = 22 galera.append(teste[...
211168c5c2d9e0eeb159866c4955c3583864f56d
subsoontornlab/OCW_python
/functionEx.py
545
3.984375
4
import math #get base inputOK = False while not inputOK: base = float(input('Enter base: ')) if type(base) == type(1.0): inputOK = True else: print('Error. Base must be a floating point number') #get height inputOK = False while not inputOK: height = float(input('Enter height: ')) if type(heig...
7575faf802c57912588695334afdba9765704541
ProjectOnePM/ProjectOneEjercicios
/Unidad 2 - IF/TP2_Ejer01.py
116
3.875
4
num=input("Ingrese el numero: ") if num%2 == 0 : print "Es un numero par " else : print "Es un numero impar "
17a0a33189e1f68ed520a040ac070ba9196c9b42
Aasthaengg/IBMdataset
/Python_codes/p02724/s107228967.py
76
3.5
4
x = int(input()) h500 = x // 500 h5 = (x%500) //5 print(h500 * 1000 + h5* 5)
80081c09401221cce8a9e9434657445aba4dac35
rokingshubham1/tic-tac-toe
/tic-tac-toe.py
3,673
3.828125
4
import random, os board = [['-' for _ in range(3)] for _ in range(3)] scores = { 'X' : -1, 'O' : 1, 'tie' : 0 } #shubham jaishwal tic tac toe game # --------------------------------------------- # def whoHasWon(): for i in range(3): if board[i][0] == board[i][1] == board[i][2]: r...
49bf40b3dd23d1f71302185a2e68c380916b5704
alexandraback/datacollection
/solutions_2692487_1/Python/schapel/Aosmos.py
1,065
3.6875
4
#!/usr/bin/python3 from sys import argv def fewest(a, n, motes): motes = sorted(motes) fewest = n # fewest operations known to be needed so far - remove all! added = 0 # number added so far to get to this point i = 0 while i < n: m = motes[i] if a > m: a += m # absor...
1797e8ed58d85da08bf0709634153bcff4e7b768
dongqi-wu/PyProD---A-AI-Friendly-Power-Distribution-System-Protection-Platform
/code/PyProD/agents/Agent_Template.py
1,362
3.625
4
# define an abstract class template of the Agent class agent(): def __init__(self, bus1=None, bus2=None): # name (string) of the buses self.bus1 = bus1 self.bus2 = bus2 self.successors = None self.model = self.build_model() self.inputs = None self.open = 0 ...
60edf0dc47d72bba51bdec6879ebca81969b69f3
dctongsheng/my-python
/第三课字符串/string.py
1,453
4.1875
4
# _*_ coding:utf-8 _*_ ''' 格式化输出 %d %f %s ''' # name = "小伟" # ge = 18 # a = '北京' # print('我叫%s,我今年%d了,我住在%s'%(name,ge,a)) #注意一定要用逗号隔开 ''' 常用字符串函数find index count repleace split capitalize title lower upper ''' #find str = 'i love python oo' # print(str.find('o'))#返回的是该字符串的位置,注意引号 # print(str.find('w'...
0195d4822b5fd956cf9d13b14033b87fcb49f356
timhuttonco/l_e_calculator
/main.py
775
4.0625
4
# 🚨 Don't change the code below 👇 print("Welcome to the Love Calculator!") name1 = input("What is your name? \n") name2 = input("What is their name? \n") # 🚨 Don't change the code above 👆 #Write your code below this line 👇 name3 = name1.lower() + name2.lower() count_true = "true" total_true = 0 count_love = "love...
c9c80b35ef98dd84ae1beb73e9d45605a8060c6a
AxiomeDuChoix/inf581
/plot_price_function.py
6,389
4.09375
4
########################################################## # This file was used to plot the figures from the report # ########################################################## import numpy as np import random as rd ...
2f779fe65046912edf36fcfef007eae42554743b
akimi-yano/algorithm-practice
/lc/1643.KthSmallestInstructions.py
3,958
4.0625
4
# 1643. Kth Smallest Instructions # Hard # 41 # 2 # Add to List # Share # Bob is standing at cell (0, 0), and he wants to reach destination: (row, column). He can only travel right and down. You are going to help Bob by providing instructions for him to reach destination. # The instructions are represented as a st...
a57429ee740d14528b5066b216f66ed466af1782
VaibhavSingh-2104/py
/pay.py
102
3.640625
4
hrs = input("Enter Hours:") rate = input("Enter Rate:") pay = float(hrs)*float(rate) print(pay)
3ce87bbf2c7f18d2facee66119264398c9de0b86
Aasthaengg/IBMdataset
/Python_codes/p03227/s417757610.py
90
3.8125
4
S=list(input()) if len(S)==2: print("".join(S)) else: S.reverse() print("".join(S))
2c83791dfca843bc98774424a5748748dfce1414
kumarjeetray/Programs
/Python/LassoDecrpyt.py
1,866
4.4375
4
def lassoLetter( letter, shiftAmount ): # Invoke the ord function to translate the letter to its ASCII code # Save the code value to the variable called letterCode letterCode = ord(letter.lower()) # The ASCII number representation of lowercase letter a aAscii = ord('a') # The numb...
502234a76c3b6648051988d63db5607101b4351c
northwestcoder/simpledatagen
/module01/example03.py
1,232
3.546875
4
# # for this example, you will need to pip install flask # and/or read the docs on flask: https://flask.palletsprojects.com/en/1.1.x/ # # this example builds on the previous example01 by providing # a payload URL for fake data # # from this directory, you would start flask from the command line like so: # $export FL...