blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
7efbd77b5391ab83b6f1480c2421a00e4d6b2dc2
WillianPessoa/LIpE-Resolution-of-Exercises
/A01E18_negativo-ou-positivo-e-par-ou-impar.py
470
4.03125
4
#!/usr/bin/python3 print("[VERIFICANDO SE UM NÚMERO É NEGATIVO, POSITIVO OU NEUTRO") print("E TAMBÉM SE É PAR OU ÍMPAR]\n") num = int( input("Insira um número: ") ) sinal = "" paridade = "" # Identificando o sinal if num < 0: sinal = "negativo" elif num > 0: sinal = "positivo" else: sinal = "neutro" #...
8f073be8e4e493dcf39c30f5820f71e9c6eefb68
aureliendersy/temperature_report
/DL/data_references.py
1,142
3.59375
4
""" References the geographical data for the desired towns Also references the times in the UNIX format """ import time from geopy.geocoders import Nominatim def generate_coordinates_city(city): """ Return the latitude and longitude coordinates of a given city :param city: :return: """ g...
100e6df1f46c8a7d3f7e732b1438011403f7a0ca
Vincent-Chung/SqueakyClean
/SqueakyClean/squeakytext.py
2,762
3.796875
4
''' Data wrangling functions to supplement pandas Intention is to cleanly abstract procedures for piping within method chains Example: df_new = (df_original .pipe(ColKeepie, ColList = ['vendorMasterCode','ElectronicsFlag','TransactionDate']) .rename(columns={"vendorMasterCode" : "vendorCode"}) ...
133179880dd88b18c9e2fbbdfe5c6e6ec21bd0d5
srravula1/whylog
/whylog/assistant/regex_assistant/regex.py
3,160
3.546875
4
""" Regex verification and creating (but not finding groups in regex) """ import re from whylog.assistant.regex_assistant.exceptions import NotMatchingRegexError from whylog.assistant.span_list import SpanList special_characters = frozenset('.^$*+{}?[]|()]') group_pattern = re.compile(r"[a-zA-Z]+|[0-9]+|\s+|[\W]+") ...
15de19cec0f1d06dcb718fa269a59616143103d3
Ignacet/devnet_dc
/funcmat.py
329
3.8125
4
""" Funcion suma: (int,int) -> int uso: suma(2,3) Funcion resta: (int,int) -> int uso: resta(3,2) """ def suma (_val1,_val2): return _val1+_val2 def resta(_val1,_val2): return _val1-_val2 def main(): print ("suma: ",suma(3,3)) print ("resta: ",resta(3,2)) if __name__ == "__main__": ...
6b023c10c9c53668439b25f51cc495828b4b2778
JosteinGj/School
/Old_Python_projects/ITGK/oving 3/alternating sums.py
702
3.71875
4
def part1(): nummber=int(input("skriv inn tall")) list=[] for n in range(1,nummber): if not n%2: list.append(-(n**2)) else: list.append(n**2) print(list) print(sum(list)) k=int(input("øvre grense")) nummber=int(input("skriv inn tall")) list=[] total=[] counter...
38b43837a0af750b5c4ddc1a753ba25157b5b895
cduffy31/TimeSeries
/fetchPrice.py
1,345
3.75
4
from exchangeratesapi import Api from datetime import datetime class fetchPrice: """ This class is using the central european banks API to get up to date prices of foreign exchange Author: Callan Duffy param: doesnt require anything but can use dates if required. dates must be ...
2859cfb03f2164ffc8a845340188108ff34c2daf
shibinp/problem_solving_with_algoritms_and_datastructure
/searching_and_sorting/insertion_sort.py
366
4.0625
4
def insertion_sort(a_list): for index in range(1, len(a_list)): current_value = a_list[index] position = index while position > 0 and a_list[position - 1] > current_value: a_list[position] = a_list[position - 1] position = position - 1 a_list[position] = current_value a_list = [4, 5, 12, 15, 14, 10, 8, 18,...
d7bf36a81a7c7d7943add172bbc2c7224ed96b30
david-luk4s/lucro_da_acao
/lucro_da_acao.py
1,028
3.578125
4
from terminaltables import AsciiTable # Input de valores da acoes print('Informe o valor das ações separados por vigulas, (ex: 7,1,5,3,6,4)') array_k = list(input('digite aqui: ')) array_y = {} headers = [] rows = [] i =1 # Setando valores no dicionario array_y for x in array_k: if x != ',': array_y[i] ...
30c6014c4b6f630a2820179357f00462078a42a7
Wang-Yann/LeetCodeMe
/python/_0001_0500/0042_trapping-rain-water.py
2,641
3.890625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : Rocky Wayne # @Created : 2020-04-07 21:42:49 # @Last Modified : 2020-04-07 21:42:49 # @Mail : lostlorder@gamil.com # @Version : alpha-1.0 # 给定一个直方图(也称柱状图),假设有人从上面源源不断地倒水,最后直方图能存多少水量?直方图的宽度为 1。 # # # # 上面是由数组 [0,1,0,2,1,0,1,3,2,1,2,...
1a5b1da09c3ad9fce543b0e4e2d2e12ce5791dbc
Koemyy/Projetos-Python
/PYTHON/Python Exercícios/3 lista de exercicios/1095.py
73
3.546875
4
i=1 j=60 while(j>=0): print(f"I={i} J={j}") j-=5 i+=3
38a5420d543b803c6797d8fd188856c1559f9fbb
alfredvoskanyan/Alfred_homeworks
/Homeworks/Shahane/Alfred_Voskanyan_homework3/person.py
874
3.6875
4
import time def dec(func): def wrapper(*args): t1 = time.time() func(*args) t2 = time.time() print("Creating time is:", t2-t1) return wrapper class Person: def __init__(self, name = 'John', last_name = 'Smith', age = 20, ...
e3361597353ea4cad0a6c24fe9c6f4a2420965a2
grockcharger/LXFpython
/list.py
922
3.953125
4
#!/usr/bin/env python in Linux/OS X # -*- coding: utf-8 -*- classmates = ['Micheal','Bob','Tracy'] print "classmates = ['Micheal','Bob','Tracy']" print classmates,"\n" print len(classmates) print classmates[0] print classmates[len(classmates)-1] print classmates[-1] print classmates[-2], classmates[1],"\n" classm...
41c4dfaeef615f398e575b8e5fd4f81e29c832b4
allenxzy/Data-and-Structures-and-Alogrithms
/python_data/Chapter 1/C/C-1.19.py
205
3.5
4
#-*-coding: utf-8 -*- """ Demonstrate how to use Python’s list comprehension syntax to produce the list [ 'a' , 'b' , 'c' , ..., 'z' ], but without having to type all 26 such characters literally. """
6c1adc62f10e29f62e39dfdc6f94f6988cb12c0d
dafnemus/universidadPython2021
/Datos/booleanos.py
183
3.71875
4
booleano = True print(booleano) # redefino la variable booleano = 4 > 7 print(booleano) if booleano: print('El resultado es verdadero') else: print('El resultado es falso')
f823b91059e6d20f1fef32af9b985a05cba55a31
zchen0211/topcoder
/python/leetcode/combinatorial/31_next_perm.py
1,688
4.09375
4
''' 31. Next Permutation (Medium) Implement next permutation, which rearranges numbers into the lexicographically next greater permutation of numbers. If such arrangement is not possible, it must rearrange it as the lowest possible order (ie, sorted in ascending order). The replacement must be in-place, do not alloc...
7ed7d14b387faa05b1d43d7d0b2841d374c3bf09
gabriellaec/desoft-analise-exercicios
/backup/user_274/ch38_2020_03_11_11_10_01_158966.py
154
3.546875
4
def quantos_uns(num): tam=len(str(num)) i=0 c=0 while i < tam: if num[i] == "1": c=c+1 i=i+1 return c
9d1d57bc18a54e0b552c4cbbf076561764233a0e
janvr1/Algorithms-CVUT
/HW4/hw4.0.py
5,719
3.71875
4
# -*- coding: utf-8 -*- """ Created on Thu Apr 19 14:54:19 2018 @author: janvr """ class Node: def __init__(self, num, c): self.nbrs = [] self.num = num self.color = c def nprint(self): print("Node number: {}".format(self.num)) print("Node neigh...
f13788b048bbefd5e026ee427738dc8b168a6704
ProspePrim/Interactive_Python
/task_7/task_7_1.py
1,049
4.1875
4
#1. Отсортируйте по убыванию методом пузырька одномерный целочисленный массив, # заданный случайными числами на промежутке [-100; 100). #Выведите на экран исходный и отсортированный массивы. import random size = 10 a = [0]*size for i in range(size): a[i] = int(random.randint(-100,99)) print(a) b = [0]*size for...
31ceeedb877f7c9fa0ded618f189cf6620851710
InsharahKhann/PYTHON-PROGRAMS
/even_num.py
147
3.953125
4
# ROLL NO. 008 num = int(input ("enter the even num: ")) if (num % 2 == 0): print ("entered number is even: ")
90eaa727ae9c7a320db7ecdce0e7108ebcbf0db3
KacperTurkowski/Python_homeworks
/Exercise5/fracs.py
1,976
3.78125
4
import math def add_frac(frac1, frac2): if is_zero(frac1) and is_zero(frac2): return [0, 0] elif is_zero(frac1): return frac2 elif is_zero(frac2): return frac1 counter = frac1[0]*frac2[1]+frac1[1]*frac2[0] denominator = frac1[1]*frac2[1] gcd = math.gcd(counter, denomina...
96788a713b5753ecd04cfd752cca14c6bad21f06
Altotude/lpt1
/compound.py
215
3.984375
4
compound = input('Enter the compound: ') if compound == "H20": print("Water") elif compound == "NH3": print("Ammonia") elif compound == "CH4": print("Methane") else: print("Unknown compound")
1ee7eabe748a458cac4f8b92106069aab483770f
prashant4nov/algorithms-playground
/hacker_rank/FibonacciModified.py
386
3.546875
4
# link: https://www.hackerrank.com/challenges/fibonacci-modified # name: Fibonacci Modified __author__ = 'mislav' if __name__ == "__main__": input_data = raw_input().split() a = int(input_data[0]) b = int(input_data[1]) n = int(input_data[2]) values =[a, b] while len(values) < n: value...
c923ca84670f864a2319b8d5d9755e71817bea32
zhouyanmeng/python_api_test
/Learning/Class_05_Opention_CHaracter.py
2,249
3.90625
4
####运算符 ####1算术运算符::+-*/% #%取余运算::无法整除的时候取余 ##用来做啥呢::判断一个数,是否是奇数,还是偶数 a=7 if a%2==0: print('a是偶数') else: print('a是奇数') print('1。1***************************') print(1+2)#3 print(1-2)#-1 print(1*2)#2 print(1/2)#0.5 print(1%2)#1 print('1.22***************************') ##我们在哪里还用过+ (1)字符串拼接,(2)列表的合并 ####2赋值运算符::=...
5e97869363d3fbbbca63f2748231cad5c5937b2f
gitxf12/demotest
/day014/person.py
539
3.671875
4
class Person: def per(self, name, sex, age): print(name, sex, age) class Worker(Person): def word(self): print("干活") class Student(Person): num = 0 def study(self,num): print("学习,他的学号是:",num) def sing(self,num): print("唱歌,他的学号是:",num) class Test(Person): person ...
dbe05a3c4f81c56bf1dd64a8c26ed87fb52bbaed
linkinek/checkio
/mission/python/electronic-station/find-sequence.py
3,162
3.5
4
def find_sequence(row_index, column_index, len_index, matrix): row_index_etalon = row_index column_index_etalon = column_index count = 0 search_number = matrix[row_index][column_index] if row_index + 4 <= len_index: for index in range(4): row_index = row_index + 1 fo...
2b3133f1a1d2199a1d9e7ac8790af93be52c66ab
Sikandarsillii/HacktoberFest2021
/convert list to string.py
296
4.375
4
# Python program to convert a list to string # Function to convert def listToString(s): # initialize an empty string str1 = "" # traverse in the string for ele in s: str1 += ele # return string return str1 # Driver code s = ['Geeks', 'for', 'Geeks'] print(listToString(s))
ea60ee3812f4462e5cafb33cbe0b64c83f9567bf
4ydx/aind-isolation
/game_agent.py
17,362
3.671875
4
"""This file contains all the classes you must complete for this project. You can use the test cases in agent_test.py to help during development, and augment the test suite with your own test cases to further test your code. You must test your agent's strength against a set of agents with known relative strength usin...
5b961718be29e12fa1795a40681f3d2664055f36
nerisnow/pythonfiles
/nepalidate.py
1,404
3.84375
4
class Date: def __init__(self,d,m,y): self.day=d self.month=m self.year=y def __add__(self,other): res=Date(self.day+other.day,self.month+other.month,self.year+other.year) a=res.day//30 b=res.day%30 res.month=res.month+a res.day=b ...
d13bb7417b8d3c521505c75ec9f80c59ac03503b
indrashismitra/HacktoberFest_2021-2
/bubble-sorting.py
420
4.0625
4
def bubbleSort(arr:int, n) -> int: for i in range(n): for j in range(0, n-i-1): if arr[j] > arr[j+1] : arr[j], arr[j+1] = arr[j+1], arr[j] l:int = int(input("Enter the amx index")) arr:list = [] for i in range(l): arr.append(int(input(f"{i} element: "))) bubbleS...
1a7420016c4e4a87958cd3ef29b4b40969c5327b
dani3l8200/100-days-of-python
/day2-data-types/exercise2.2/main.py
308
4.21875
4
# 🚨 Don't change the code below 👇 weight_of_user = float(input("What's is your weight? ")) height_of_user = float(input("What's is your height? ")) # 🚨 Don't change the code above 👆 #Write your code below this line 👇 bmi_of_user = int(weight_of_user/(height_of_user ** 2)) print(bmi_of_user)
0f1861757c62eb27381c78f8e1954036d8a1997d
nastya1802/homework_les_01
/number_4.py
519
4.21875
4
#Пользователь вводит целое положительное число. # Найдите самую большую цифру в числе. # Для решения используйте цикл while и арифметические операции. number = int(input('Введите число: ')) max_number = number % 10 number = number // 10 while number > 0: if number % 10 > max_number: max_number =...
bcc31dcf7a203d90907fd55d654bc506b37e22d8
dynizhnik/python_home_work
/ua/univer/lesson05HW/chapter09_task01.py
751
3.875
4
def main(): CLASSROOM = { 'CS101': '3004', 'CS102': '4501', 'CS103': '6755', 'CS104': '1244', 'CS105': '1411' } # print(CLASSROOM) TEACHER = { 'CS101': 'Haince', 'CS102': 'Alvadore', 'CS103': 'Rich', 'CS104': 'Berk', 'CS...
1c99317d403f38f53b4b06ec1e298fac98a78b1e
Fractured2K/Urban-Bot
/utils/parsers.py
1,982
3.6875
4
def parse_definitions(soup): """ Parses and formats definitions from soup, returning a list of dictionaries. :param soup: :return definitions: """ # Definition panels definition_panels = soup.find_all("div", class_="def-panel") # Store definitions = [] for result in range...
0047eb17697a4a3ddadb653d90230dac3dc705f8
Cjvaely/PythonLearning
/LiaoPython/Inhert_Polymor_.py
2,560
3.953125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Date : 2018-05-31 20:02:44 # @Author : Chen Cjv (cjvaely@foxmail.com) # @Link : https://github.com/Cjvaely # @Version : $Id$ # 继承和多态:当我们定义一个class的时候, # 可以从某个现有的class继承,新的class称为子类(Subclass), # 而被继承的class称为基类、父类或超类(Base class、Super class) # # 编写了一个名为Ani...
7c12aa3ff0c325bdd973c88779aebacf7d3b5383
Kasuczi/Simple_Tasks
/notatki.py
10,142
3.8125
4
#ZAJECIA NR1 #Dive into python -- ksiazka na ktora warto zwrocic uwage ! #ID - zintergoiwane srodowisko programistyczne # #program ma przyjac dwie dane wzrost i wage. #pass - funkcja pusta # """""" automatycznie dodaje info o tym czym zajmie sie funkcja #kazda funkcja przyjmuje argumenty ale nie kazda zwraca #Listy mo...
6d0b5edf56730961ef9b0ebb60e4ea01359d428a
PatrickPPK/Python_Journey
/Lecture Notes/Sets.py
4,001
4.1875
4
############### The note is for educational purpose only ############### # Set: Unordered collection of data type, iterable, mutable, no duplicate elements # Usage: Basic uses include membership testing and eliminating duplicate entries. # Creating the set >>> s = set() >>> s = {} # Create ...
953c2a6014f70a27739982e555a06e3d67e26075
katearb/language_processing
/language_identifier/main.py
11,232
3.734375
4
""" Language detection using n-grams """ import re from math import log # 4 def tokenize_by_sentence(text: str) -> tuple: """ Splits a text into sentences, sentences into tokens, tokens into letters Tokens are framed with '_' :param text: a text :return: a tuple of sentence with tuples of tokens...
3dd5de974bc6a56ee201f48c7bf924759dc108b8
spp54/automate
/python1.py
1,443
3.671875
4
#This a simple python script to access a router or switch and execute some basic commands # import getpass #import the getpass library module import telnetlib #import the telnet library HOST = "192.168.122.71" #Assign the ip address of the device I am going to access to the varible HOST user = input("Enter yo...
d60369af96516785cc0629858ac783834bc6f0ec
vishrutkmr7/DailyPracticeProblemsDIP
/2022/09 September/db09102022.py
1,213
3.828125
4
""" This question is asked by Facebook. Given the root of a binary tree and two values low and high return the sum of all values in the tree that are within low and high. Ex: Given the following tree where low = 3 and high = 5… 1 / \ 7 5 / / \ 4 3 9 return 12 (3, 4, and 5 are the...
0d8820f8607734bd7a503fa6c00162d3f780f68f
XinyueSheng2019/QuasarClassifier
/data/learn/DHOsims.py
4,245
3.515625
4
# Damped Harmonic Oscillator AGN light curve simulation from matplotlib import pyplot as plt from math import sin, fabs, pi def f(k,x): #The restoring force due to the spring restoring_force = -k*x return restoring_force def d(b,v): #The drag force. b is the drag coefficent and v is the speed dra...
1eb4c675d6900a8f56d8e24cc9e53bc257769987
sivilov-d/HackBulgaria
/week1/5-Saturday-Tasks/factorial.py
188
4
4
n = input("Enter a number: ") counter = 1 fact = 1 if int(n) == 0: print(1) else: while counter <= int(n): fact = fact * counter counter += 1 print(fact)
b2feb1759e0fe498c97488f7f1d8f5f2fadf3068
iamhimmat89/hackerrank
/python/mod-divmod.py
173
3.65625
4
# https://www.hackerrank.com/challenges/python-mod-divmod/problem n, m = int(input()), int(input()) op = divmod(n,m) for i in range(len(op)): print(op[i]) print(op)
33da30d2e47c33bf3b3c907fb4f886b2eee8d5af
rckortiz/codewars
/find-fibonacci-last-digit.py
636
3.6875
4
def get_last_digit(index): if index < 2: return index else: fib1, fib2 = 0, 1 for i in range(1, index): fib1, fib2 = fib2, (fib1 + fib2) % 10 return (fib2) print get_last_digit(15) print get_last_digit(193150) print get_last_digit(300) print get_last_digit(20001) pr...
c6e4fbb1df3b01d753795954328519d62b929875
djamaludinn/laba5
/ind2.py
590
3.6875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- if __name__ == '__main__': s = input('Введите слова: ') a = s.find('жи') b = s.find('жы') if a > -1: print('жи написанно правильно') if b > -1: print('жи написанно неправильно') c = s.find('ши') d = s.find('шы') if c > -1: ...
a02d6f078f4df244f0153f35d15acba8351f4b6d
truongquang1993/truongvanquang-Fundamentals-c4e26
/SESSION4/Draf1.py
247
3.828125
4
items = ["Pho", "Bun", "Mien"] # For i for i in range(len(items)): print(items[i]) # For each print(" ") no = 1 for food in items: print(no, food, sep=", ") no += 1 for i, food in enumerate(items, 1): print(i, food, sep= ", ")
7964df28cd4faaffdc0962d451ae39d54950b165
indianvalantine/Edureka-Mastering-Python-Assignments
/Module 4/Module_4_Problem_2.py
419
3.609375
4
""" @author: Maneesh D @date: 29-May-17 @intepreter: Python 3.6 Regular Expression that will match a traditional SSN. """ from re import compile pattern = compile("^\d{3}-\d{2}-\d{4}$") ssn_list = ["234-56-5924", "12-5-78912", "123-5-7891", "1123-56-7777", "006-07-0001"] for ssn in ssn_list: if pattern.match(s...
82f25f95c25540811cb633b3b4c127167d7e65c6
dkp1903/Competitive-Programming
/HackerEarth/Cipher.py
491
3.921875
4
def isLowerChar(c): return ord(c) >= 97 and ord(c) <= 122 def isUpperChar(c): return ord(c) >= 65 and ord(c) <= 90 def isNumber(c): return ord(c) >= 48 and ord(c) <= 57 S = input() K = int(input()) R = "" for c in S: if(isLowerChar(c)): R += chr(((ord(c) - 97 + K) % 26) + 97) eli...
6008ae80bad883cb89c85ae3d7ebb72cc58f9ddc
shimmee/competitive-programming
/AtCoder/Practice/茶緑埋め/ARC068D.py
2,659
3.5
4
# ARC068D - Card Eater # URL: https://atcoder.jp/contests/arc068/tasks/arc068_b # Date: 2021/03/06 # ---------- Ideas ---------- # たぶん貪欲で解く。どう貪欲するか? # 1枚のやつはもったいないから避けておく # 2枚被ってるカードを小さいのと大きいのを取り出して消せる # 被ってるやつのうち最小と最大を食べる # ------------------- Answer -------------------- #code:python from collections import deque, C...
b66d548a05f1c07c6beef0759e2eabf47607e270
LonelyHobby/Python
/CiFa.py
11,016
3.546875
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author:Huihuihui # Time:2018/10/15 class DFA: file_object = '' line_number = 0 state = 0 # 状态 ResWord = ['int', 'if', 'then', 'else', 'end', 'repeat', 'until', 'read', 'write'] # 保留字 error_message = [] annotate_message = [] char_m...
c396c369bc23fc464ababa279e57ac7e891c36be
SebastianG343/Habilitacion
/Cosaxd.py
4,582
3.5625
4
s=[23,25,18,19,17,25,24,23,18,27,26,25] g=[15,17,19,23,25,28,24,22,23,19,15,20] n=[17,18,20,22,23,26,28,30,29,26,22,19] temas = [ ] promcalientes=[ ] n1=0 n2=0 n3=0 conts= 0 contg=0 contn=0 menu = (" ") while menu != ("000"): print("Digite /a/ para ver el promedio de cada departamento") print("Digite /b/ para v...
e1d4318f70e3faf9c8bd47ceea61ac26bb659ac3
JulyKikuAkita/PythonPrac
/cs15211/N-RepeatedElementinSize2NArray.py
2,201
3.640625
4
__source__ = 'https://leetcode.com/problems/n-repeated-element-in-size-2n-array/' # Time: O(N) # Space: O(1) # # Description: Leetcode # 961. N-Repeated Element in Size 2N Array # # In a array A of size 2N, there are N+1 unique elements, # and exactly one of these elements is repeated N times. # # Return the element r...
5e4abc0afd493190fc7385c6fe688340bd86b0e1
ZUCHOVICKI/claseAlfas
/ejercicios3.py
1,907
4.40625
4
""" Estructura de una funcion en Python: def nombre_funcion(argumento1, argumento2, n_argumento): realiza_alguna_operacion o_imprime_algo o regresa algun valor con return argumento1 + argumento2 """ """ ¡NOTA LA IDENTACION! """ def saludo(nombre): return "Hola " + nombre + "!! Bienvenido!" saludo(...
19bf1533989eeb43e79b0dc04d75bdbfefa3da64
gil9red/SimplePyScripts
/PyOpenGLExample/helloworld.py
951
3.703125
4
from OpenGL.GL import * from OpenGL.GLUT import * from OpenGL.GLU import * """ A hello world application This pages creates a simple window to which 2d orthogonal projection is applied. Next a couple of points are drawn. This will create a white window with three black dots. url = http://www.de-brauwer.be/wiki/wikk...
67bc44515d61f718f919bd04341e6ab8c03e0de2
wargreimon501/CYPRafaelSA
/libro/ejemplo3_2.py
166
3.84375
4
NOMINA=0 for i in range(1,11,1): SUE=float(input("ingresatu misero sueldo :")) NOMINA=NOMINA+SUE# NOMINA+= SUE print(f"la nomina de la empresa es {NOMINA}")
fe091212f494adae9b1f2b997dccc88f635e45a2
udhayprakash/PythonMaterial
/python3/09_Iterators_generators_coroutines/03_generators/generators.py
9,336
4.34375
4
import itertools as it import random def squares(start, end): curr = start while curr < end: yield curr * curr curr += 1 print("\nPrinting the squares with generator:") for x in squares(1, 10): print(x, end=" ") print("\n") class Squares: def __init__(self, start, end): sel...
4040e1d96265511be9eaadbce4be80e9163c59ac
laippmiles/Code_python3.5
/大蟒/code/170714.py
374
3.875
4
a = 23 b = True while b: try: c = int(input('Enter a num:')) except ValueError as e: print('Pls enter a number') continue print('c =',c) if a==c: print('Bingo') b = False #break elif a<c: print('Higher') #continue else: pri...
b1c34be47b04a25bcd3c322c824ee28498bc5a4a
sharland/python_scripts
/programs-tobesorted/readfile.py
297
3.921875
4
#!f: #filename: readfile.py def read_file(): currentFile = open("names.txt","r") for i in range(1,3): # reads 2 names # currentFile = open("names.txt","r") fullname = currentFile.readline() print(fullname) currentFile.close() return read_file()
2a86907a25e4b6398b762d14daf3c1b070f62539
Lucas-Guimaraes/Reddit-Daily-Programmer
/Easy Problems/311-320/319easy.py
1,742
4.53125
5
#https://www.reddit.com/r/dailyprogrammer/comments/6grwny/20170612_challenge_319_easy_condensing_sentences/ def condense(sentence): #Splits the string, makes list and previous word sentence = sentence.split() prev_w, lst = sentence[0], [sentence[0]] #Goes over the rest of the words for cur...
c655c1c52d766a9067235873c012ea09efad73f4
LuisEEduardo/criptografador
/decrypt.py
1,083
3.640625
4
from cryptography.fernet import Fernet def clear(): import os os.system('cls' if os.name == 'nt' else 'clear') def inserir_texto(): clear() chave = input("Insira a chave: ") print("Opção: \n1 - Para inserir o texto no terminal \n2 - Para inserir o caminho do arquivo .txt") op = int(input("...
11c6d9c8697fba6b3728335c356bcce59ad28901
juancsosap/pythontraining
/training/c30_tools/timeit-example.py
542
3.578125
4
import timeit def testlc(max): lista = [x**3 for x in range(max)] print(len(lista)) def testfl(max): lista = [] for x in range(max): lista.append(x**3) print(len(lista)) if __name__ == '__main__': max = 30_000_000 time = timeit.timeit("testlc({})".format(max), setup="from __mai...
e0dc16820d571f0178cfb8a71e3c682342ae45a0
hemantgautam/PythonProjects
/WebScraping/BeautifulSoup/fk_redmi_price/flipkart.py
2,407
3.640625
4
# This function make request to given url and fetch html content using beautiful soup # and using soup.findall function gets the exact product name and its price def check_myntra_product_price(): import requests from bs4 import BeautifulSoup # global discounted_price # global product_name scrape_url...
9385af14dcd843d4e63ccfdebc4c6d149366ef46
SatriyoJati/Python_Programming
/CountDownTimer.py
339
3.796875
4
#mini countdown timer #recursion #base case first: call not called anymore # import time def recur_countdonw_timer(n): pass def iter_countdown_timer(n): while n > o: print(n) time.sleep(1) n -= 1 print(n) z = 5 print(f"Counting down from {z}") iter_countdown_timer(z) #print(...
c28f319150d3b2a1c9bfb84bd92573727d7ec1af
robgoyal/CodingChallenges
/HackerRank/Algorithms/Strings/0-to-10/gameOfThrones.py
616
3.96875
4
# Name: gameOfThrones.py # Author: Robin Goyal # Last-Modified: November 11, 2017 # Purpose: Check if an anagram of the string can be a palindrome def gameOfThrones(inp): char_count = {} # Populate dictionary with count of number of chars for char in inp: if char in count: count[char]...
7fa1ecf5e9a96724c04fe0e9a91567884f3850c2
shubee17/HackerEarth
/Basic_IO/count_numbers.py
1,166
3.828125
4
""" Your task is pretty simple , given a string S , find the total count of numbers present in the digit. Input The first line contains T , the number of test cases. The first line of each and every testc ase will contain a integer N , the length of the string . The second line of each and every test case will contai...
38be2578676448ec4388399739411b9eface66c4
VZRXS/LeetCode-noob-solutions
/Medium/198_House_Robber.py
498
3.71875
4
#!/usr/bin/env python3 from typing import List class Solution(object): # 198. House Robber def rob(self, nums: List[int]) -> int: if len(nums) <= 2: return max(nums) dp = [nums[0], nums[1]] if len(nums) >= 3: dp.append(dp[0] + nums[2]) for i in range...
bcdfb37a5bcedfc153ced0324f076d473ed0e924
chenxy3791/leetcode
/No0279-perfect-squares-bfs-reference.py
1,645
3.515625
4
# -*- coding: utf-8 -*- """ Created on Thu Sep 16 17:56:44 2021 @author: chenxy """ import sys import time import datetime import math import random from typing import List # from queue import Queue from collections import deque import itertools as it from math import sqrt, floor, ceil import numpy class nod...
0ce6c592b9587997c9cea021423a4ba3a0ccf0ab
JesusOliveto/TPs-LAB3
/guia_1/eje17.py
249
4.0625
4
string = input("Ingrese su clave: ") if len(string)<10 or len(string)>20: print("Error") else: print("Contraseña correcta") ''' if len(string)>10 and len(string)<20: print("Contraseña correcta") else: print("Error") '''
5e6bae719c1fdcd519734b23c58810c9f148c353
gersongroth/maratonadatascience
/Semana 01/02 - Estruturas de Decisão/09.py
358
4
4
valor1 = int(input("Informe o primeiro número: ")) valor2 = int(input("Informe o segundo número: ")) valor3 = int(input("Informe o terceiro número: ")) if(valor2 > valor1): valor1,valor2=valor2,valor1 if(valor3 > valor1): valor1,valor3=valor3,valor1 if(valor3 > valor2): valor2,valor3=valor3,valor2 print(...
8dd4883b122a1503aba7986852a707542cbecd43
MuhummadShohag/PythonAutomation
/OS_Module/os_walk_real_time.py
1,230
3.6875
4
#================ How to do a system wide search for a file? ======================= import os import platform import string ''' req_input=input("Enter Your File Name: ") path=path for r,d,f in os.walk(path): if len(f) != 0: for each_file in f: if each_file == req_inpu...
fabf66f0728f5c80faa96eb61230215260b1d1a8
ksj413/Price-Explore
/flightlib.py
5,145
3.5625
4
# flightlib.py # # Holds generic flight info classes and functions. Also home to data storage # functions and the like. import pickle import time import sqlite3 class FlightInfo(object): """ The generic FlightInfo class used to save information about specific flights that are collected.""" def __init...
4a947b927ca0b3333a5e0fc4aa527ac80baca778
ryannetwork/Data-Mining-Class-Mini-Projects
/Mini#1/lib.py
821
3.5
4
import re import os # remove parenthesis around frequency def clean_word_association_sent(word_association_sent): words = word_association_sent.split() frequency = words.pop() frequency = frequency.replace('(', '').replace(')', '') return [words, frequency] # check the sent contain the word associatio...
c61fbf1ee5335f15e7f31170aeb3fa57f2ab0cab
iyyuan/leetcode-practice
/valid-parenthesis.py
862
3.90625
4
class Solution: def isValid(self, s): """ :type s: str :rtype: bool """ if len(s) % 2 == 1: return False stack = list() for c in list(s): if c == "(" or c == "{" or c == "[": stack.append(c) ...
7f960b98e419145a83a094db99441e6b2da0cf57
ethanbar11/python_september
/python_final_project/sudoku_creator.py
732
4.125
4
base = 3 side = base * base # pattern for a baseline valid solution def pattern(r, c): return (base * (r % base) + r // base + c) % side # randomize rows, columns and numbers (of valid base pattern) from random import sample def shuffle(s): return sample(s, len(s)) def create_board(): rBase = range(base) ...
c3d6d724af831d38fdcdcf27cf9dc42fc8cf4e1e
PFZ86/LeetcodePractice
/BFS/0429_NaryTreeLevelOrderTraversal_E.py
902
3.953125
4
# https://leetcode.com/problems/n-ary-tree-level-order-traversal/ """ # Definition for a Node. class Node(object): def __init__(self, val, children): self.val = val self.children = children """ # Solution 1: use two queues; swap them every time go deeper 1-level class Solution(object): ...
e549b31b8cceeb6d98c04cb15a9d4cb762e9ea04
NagahShinawy/100-days-of-code
/day_26/1_list_comp.py
4,379
3.515625
4
""" created by Nagaj at 24/06/2021 """ import random from pprint import pprint from string import punctuation numbers = [5, 6, 7] plus_one = [number + 10 for number in numbers] print(plus_one) # square numbers from 10 to 20 squares = [num ** 2 for num in range(10, 21)] print(squares) names = ["joHn", "JaMes", "LEo...
958460588ca9eb5cc17666f301d51f487f335b49
adhinugroho16/Praktikum-4
/Praktikum4_Tugas2_Bulan.py
798
3.828125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Oct 16 13:35:48 2021 @author: Surgery Adhi Nugroho NIM : 065002100015 """ bulan = 1 - 12 bulan = int(input("Masukkan bulan 1 - 12 : ")) tahun = int(input("Masukkan tahun : ")) if(bulan >= 13 or bulan <= -2 or bulan == 0): print("Progam error atau...
c0dc311c142ed87672e8d2ad20b430518d93abaa
vitalizzare/NumFOCUS_Telethon_by_James_Powell
/code_snippets/Q_queue.py
1,284
3.875
4
''' From the @NumFOCUS telethon title: Q for queue author: @dontusethiscode date: December 19, 2020 python version: >= 3.8 video: https://youtu.be/gzbmLeaM8gs?t=11137 edited by: @vitalizzare date: January 01, 2021 ''' # list as a stack xs = [1, 2, 3] print(f'{xs = }') while xs: print(f'{xs.pop() = }') # collect...
c8c31b66818879fa69260000039dcd7eda63e6f2
alnsantosh/Connect4
/source/strategy.py
10,667
3.625
4
import random import decimal import numpy width = 7 height = 6 numInRow = 4 class strategy: def __init__(self,board): b = [-1]*width board.append(b) board.append(b) self.board = board def placePiece(self,player, index): if not(self.indexIsFull(index)): ...
3802c059b87077b14a149a33f7e33941dc9184b3
AlbertLZG/AlbertLZG_Lintcode
/Permutations_15_temp.py
646
3.78125
4
class Solution: """ @param nums: A list of Integers. @return: A list of permutations. """ def permute(self, nums): # write your code here self.ret = [] if len(nums) == 0: return [[]] else: self._permute(nums, 0) return self.ret def...
2bf9050a87b80fd950964e6ac6250f2dc5c093c0
FranckCHAMBON/ClasseVirtuelle
/Term_NSI/devoirs/4-dm2/Corrigé/PROF/Régionale/11_Anagrammes.py
1,371
3.875
4
""" auteur : Franck CHAMBON https://prologin.org/train/2003/semifinal/anagrammes """ def signature(mot: str) -> str: """Renvoie le mot avec les lettres rangées dans l'ordre alphabétique. Ainsi deux anagrammes ont la même signature. >>> signature("azeerty") 'aeertyz' """ mot = list(mot) ...
55eb0508a875ed082c6bb39e60a2380521748bd3
GrindingLeetCode/CodingDiary
/112/kcheng0222.py
468
3.90625
4
''' Created on 8 Sep 112. Path Sum ''' #I'm still learning about binary trees, so solution is quite similar to solution on "Discuss". class Solution(object): def hasPathSum(self, root, sum): if not root: return False if not root.left and not root.right and root.val == sum: ...
3b4ed1a006fdb31924a7c8938ae7090706af04cb
wangxiliang1/python
/5.py
493
3.5
4
a = 1234#帐号 p = 123#密码 c = int(input("请输入帐号")) d = int(input("请输入密码")) m = 1 n = 0 if c == a and d == p: print("登录成功") v = input("请输入0,鲁班大师 1,陈要紧 2,小乔") if v == "0": print("鲁班大师") elif v == "1": print("陈要紧") elif v == "2": print("小乔") n = n+1 if c !=a and d !=p: while m <= 3 and n == 0: c = int(input("请输...
a993d5ecad15d69f5f541c35cd447c72b8508a7c
iknight7000/TwitOff
/twitoff/models.py
1,685
3.71875
4
"""SQLAlchemy models (schema) for twitoff""" from flask_sqlalchemy import SQLAlchemy # classes can be mapped to the database in open ended ways DB = SQLAlchemy() # Creates User Table # Similar to saying `CREATE TABLE user ...` in SQL class User(DB.Model): """Twitter Users corresponding to tweets table""" # c...
f029c7d67cf97c019b1c5c7d4eb2df2dbcbf2b5a
rtchavali/Algorithmica
/rough.py
1,180
4.125
4
class Node(object): def __init__(self, data=None, next=None): self.data=data self.next=next class Linked_list(object): def __init__(self, head=None, tail=None): self.head=head self.tail=tail def show_elements(self): print 'showing list elements' current = sel...
87fc4abd22a12e1d66bef1e4927d7a3389ea5c10
dengkewang1/RemoteLearn
/learnReviewThreeDay函数二.py
3,524
3.921875
4
# 一、变量的作用域 # 分为 局部变量、全局变量 # 局部变量 ''' def testA(): a = 100 print(a) testA() # print(a) # NameError: name 'a' is not defined ''' # 全局变量————局部变量与全局变量的不同调用 """ b = 100 '''全局变量''' def testB(): b = 200 '''局部变量''' print(b) print(b) testB() """ # 函数内定义全局变量————global """ c = 50 def te...
2e24e8bd4432dc0d13d719fe25407ff06311da00
Harini-sakthivel/PYTHON-Hands-on-coding-
/Groupby.py
355
3.890625
4
''' Given input as Input: bbbbaaaaaaacc To find which occurs continuosly manytimes Ouput: a : 7 ''' from itertools import groupby a = 'bbbbaaaaaaacc' big = 0 for i,j in groupby(a): length = len(list(j)) if(length > big): big = length ans = i print("{} is the highest continuosly occuring char...
ad61d5f8231b2ac9b779b0ad4bdd3fc53409ac15
SW-yo/SWStudio
/scratch_00.py
752
3.75
4
import math def scalar_multiply(c, v): #cは数値、vはベクトル return [c * v_i for v_i in v] def vector_subtract(v, w): #対応する要素の差 return [v_i - w_i for v_i, w_i in zip(v, w)] def dot(v, w): #v_i * w_i + ... + v_n * w_n return sum(v_i * w_i for v_i, w_i in zip(v, w)) def sum_of_squares(v): #v_1 * v_...
0c0dda428fcb9260196c79043665e54720262e6c
green-fox-academy/florimaros
/week-3/thursday/gyak9.py
598
4.03125
4
from random import randint def get_integer(): number = int(input("Enter an integer")) return number number_to_guess = randint(0, 10) number_of_guesses = 5 print (number_to_guess) while number_of_guesses > 0: try: guess = get_integer() except ValueError: print("You entered a wrong val...
3c86c6bc86463f62ec7f966aa20fe0f29b2e2cb7
TaoufikIzem/Traffic-signs-classification-and-semantic-segmentation-using-deep-learning
/Traffic-signs-classification/data/utils.py
938
3.546875
4
import tensorflow as tf def _parse_function(filename, label, n_channels, size): """ Returns resized and normalized image and its label """ resized_image = _parse_image(filename, n_channels, size) return resized_image, label def _parse_image(filename, n_channels, size): """Obtain the image fro...
284326bab156b453c3172efc37f8a74dfbbbe551
dominiksalvet/pathfinding-robots
/src/pathfinding-robots.py
19,282
3.890625
4
#!/usr/bin/env python3 #------------------------------------------------------------------------------- # Copyright 2016-2020 Dominik Salvet # https://github.com/dominiksalvet/pathfinding-robots #------------------------------------------------------------------------------- from enum import Enum from time import sle...
245e04bf2876e26ebb1b51e3c91ac4a0e1d28db3
yu-podong/OpenSource_Quiz8
/Quiz8.py
3,450
3.78125
4
from tkinter import * import random ## 클래스 선언 부분 ## class Shape: # 부모 클래스 color, width = '', 0 shx1, shy1 = 0, 0 def getColor(self): r = random.randrange(16, 256) g = random.randrange(16, 256) b = random.randrange(16, 256) return "#" + hex(r)[2:] + hex(g)[2:] + hex(b)[2:] ...
67687a4af5dfffd7082f0a9c329ee1d84ffbffe2
amiedes/giw-pr-1
/pr1/ej3/utils.py
1,755
3.828125
4
# -*- coding: utf-8 -*- ''' @authors: Daniel Reyes, Ania Pietrzak, Alberto Miedes ''' import string def spanish_tolower(word): lowered_word = '' for letter in word: if letter == 'Á': lowered_word += 'á' elif letter == 'É': lowered_word += 'é' elif letter == 'Í'...
bc2184c76cb7115cfa17920c026b8807a6565ea3
jojox6/Python3_URI
/URI 1051 - Imposto de Renda.py
474
3.734375
4
renda=float(input()) if(0<=renda<=2000): print("Isento") else: if(renda > 2000): if(renda <= 3000): imposto = (renda - 2000)*(8/100) else: imposto = 1000*(8/100) if(renda > 3000): if(renda <= 4500): imposto += (renda - 3000)*(18/100) ...
5b8406e0da9dcee03d9a8e9e3eda97bf71d1dc01
dsdshcym/LeetCode-Solutions
/algorithms/perfect_squares.py
643
3.859375
4
from math import sqrt class Solution(object): def numSquares(self, n): """ :type n: int :rtype: int """ if not n: return n queue = {n} step = 0 while queue: step += 1 temp = set() for x in queue: ...
b58db2938f389ac02591861ce583bd6f09e33a4d
SREEANTA/pythonbeginner1
/func.py
119
3.890625
4
def main(): a=32 if (int(a)%2==0): print("the number is even") else: print("the number is odd") main()
6c7b2749def795bbc113cfe007781edd2ff369d0
dmenin/UdacityDataAnalystNanoDegree
/5_MachineLearning/PythonProject/L4_Regression.py
1,996
3.703125
4
# from sklearn.linear_model import LinearRegression # clf = LinearRegression() # clf.fit ([[0, 0], [1, 1], [2, 2]], [0, 1, 2]) # # print clf.coef_ # # print clf.predict([[2, 2]]) import numpy import matplotlib.pyplot as plt import numpy import random def ageNetWorthData(): random.seed(42) numpy.random.seed...
e96fc20c270966ad42bdff7433f9102fa32178c8
JosemiOuterelo/Otros-Python
/basicos_31.py
467
3.703125
4
#!/usr/bin/env python #-*- coding: utf-8 -*- a=50; colecc=[] while a>0: n=int(raw_input("Introduce numero : ")); colecc.append(n) a-=1 mayor=0 menor=100000 contmy=0 contmn=0 for ele in colecc: if ele > mayor: mayor=ele if ele < menor: menor=ele for ele in colecc: if ele==mayor: contmy+=1 if ele==menor...
cbb84ae6a74e219f005a2e09e34a95b3e7ba8ccf
maha03/AnitaBorg-Python-Summer2020
/Week 10 Coding Challenges/Date Time/sundays_of_a_year.py
582
4.5625
5
#Script: sundays_of_a_year.py #Author: Mahalakshmi Subramanian #Anita Borg - Python Certification Course #DESCRIPTION: A python program to print the date of all the Sundays of a specified year import datetime def Sunday_dates(year): first_date = datetime.date(year, 1, 1) days_to_firstSunday= 7 - first_date.is...
cee7adcfe5d57dd51152583db5922cea4d689f80
chae-heechan/Codeup_Algorithm_Study
/CodeUp/6074.py
146
3.640625
4
# 문자 1개 입력받아 알파벳 출력하기 alphabet = input() for count in range(ord("a"), ord(alphabet)+1): print(chr(count), end=" ")