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
dc7a3d2e6d44a8c72024f2f281b7b0462cf007e3
Dawyer/Code
/problems/LeetCode/1449. 数位成本和为目标值的最大数字.py
1,681
3.609375
4
''' 第51天 给你一个整数数组cost和一个整数target。请你返回满足如下规则可以得到的最大整数: 给当前结果添加一个数位(i + 1)的成本为cost[i](cost数组下标从 0 开始)。 总成本必须恰好等于target。 添加的数位中没有数字 0 。 示例 1: 输入:cost = [4,3,2,5,6,7,2,5,5], target = 9 输出:"7772" 解释:添加数位 '7' 的成本为 2 ,添加数位 '2' 的成本为 3 。所以 "7772" 的代价为 2*3+ 3*1 = 9 。 "977" 也是满足要求的数字,但 "7772" 是较大的数字。 数字 成本 1 -> 4 2...
bcb353a6565d829ebe2d57e47fcd654bec75419e
Dawyer/Code
/problems/LeetCode/LeetCode面试题13. 机器人的运动范围.py
1,419
3.515625
4
# 地上有一个m行n列的方格,从坐标 [0,0] 到坐标 [m-1,n-1] 。一个机器人从坐标 [0, 0] 的格子开始移动,它每次可以向左、右、上、下移动一格(不能移动到方格外),也不能进入行坐标和列坐标的数位之和大于k的格子。例如,当k为18时,机器人能够进入方格 [35, 37] ,因为3+5+3+7=18。但它不能进入方格 [35, 38],因为3+5+3+8=19。请问该机器人能够到达多少个格子? # #   # 示例 1: # # 输入:m = 2, n = 3, k = 1 # 输出:3 # 示例 1: # # 输入:m = 3, n = 1, k = 0 # 输出:1 #方法一:广度优先搜索 def digits...
4009534f579433006ee3f50af575416c6c4104e8
Dawyer/Code
/problems/LeetCode/20210509Day25-LeetCode38. 外观数列.py
1,345
3.671875
4
# 给定一个正整数 n ,输出外观数列的第 n 项。 # 「外观数列」是一个整数序列,从数字 1 开始,序列中的每一项都是对前一项的描述。 # 你可以将其视作是由递归公式定义的数字字符串序列: # countAndSay(1) = "1" # countAndSay(n) 是对 countAndSay(n-1) 的描述,然后转换成另一个数字字符串。 # 前五项如下: # 1. 1 # 2. 11 # 3. 21 # 4. 1211 # 5. 111221 # 第一项是数字 1 # 描述前一项,这个数是 1 即 “ 一 个 1 ”,记作 "11" # 描述前一项,这个数是 11 即 “ 二 个...
95d9e4316d5e750b59494ec85fe388cd45fbe118
Dawyer/Code
/problems/LeetCode/LeetCode365. 水壶问题.py
1,547
3.875
4
# 有两个容量分别为 x升 和 y升 的水壶以及无限多的水。请判断能否通过使用这两个水壶,从而可以得到恰好 z升 的水? # # 如果可以,最后请用以上水壶中的一或两个来盛放取得的 z升 水。 # # 你允许: # # 装满任意一个水壶 # 清空任意一个水壶 # 从一个水壶向另外一个水壶倒水,直到装满或者倒空 # 示例 1: (From the famous "Die Hard" example) # # 输入: x = 3, y = 5, z = 4 # 输出: True # 示例 2: # # 输入: x = 2, y = 6, z = 5 # 输出: False import math #深度优先搜索 # def canMea...
7274e66b258e000afce3edf16d59575a2c3b152a
Dawyer/Code
/problems/LeetCode/有效的字母异位词.py
995
3.796875
4
''' 第53天 给定两个字符串 s 和 t ,编写一个函数来判断 t 是否是 s 的字母异位词。 示例1: 输入: s = "anagram", t = "nagaram" 输出: true 示例 2: 输入: s = "rat", t = "car" 输出: false ''' import collections class Solution: def isAnagram(self, s: str, t: str) -> bool: # 思路: # dict_s,dict_t两个字典 # 键为s,t的字符,值为字符出现的次数,最后判断字典是否相等 # ...
dcdca462cc47e9806f35764050c162757efd7a35
Dawyer/Code
/problems/LeetCode/20210504Day20-LeetCode561. 数组拆分 I.py
886
3.765625
4
# 给定长度为2n的整数数组 nums ,你的任务是将这些数分成n 对, # 例如 (a1, b1), (a2, b2), ..., (an, bn) ,使得从 1 到n 的 min(ai, bi) 总和最大。 # 返回该 最大总和 。 # # 示例 1: # 输入:nums = [1,4,3,2] # 输出:4 # 解释:所有可能的分法(忽略元素顺序)为: # 1. (1, 4), (2, 3) -> min(1, 4) + min(2, 3) = 1 + 2 = 3 # 2. (1, 3), (2, 4) -> min(1, 3) + min(2, 4) = 1 + 2 = 3 # 3. (1, 2), (3, 4) -> mi...
f0c8db1a8a75b57bed87955f30432ca0e511b41d
Dawyer/Code
/problems/LeetCode/20210430Day17-LeetCode137. 只出现一次的数字 II.py
624
3.953125
4
# 第17天 4月的最后一天 # # 给你一个整数数组 nums ,除某个元素仅出现 一次 外, # 其余每个元素都恰出现 三次 。请你找出并返回那个只出现了一次的元素。 from typing import List import collections nums_1 = [2, 2, 3, 2] nums_2 = [0, 1, 0, 1, 0, 1, 99] def singleNumber(nums: List[int]) -> int: freq = collections.Counter(nums) print(freq.items()) # ans = [num for num, occ in...
ff4d84c559675ee95a6819e1fc489a4f98c919ea
pratimavermaa/EPAi3Assignments-
/session10/session10.py
1,396
3.75
4
import math class Polygon: def __init__(self, vertices, circumradius): self.vertices = vertices self.circumradius = circumradius def __repr__(self)->str: return f"Polygon with {self.vertices} sides and {self.circumradius} as circumradius" @property def get_number_of_vertices(se...
f3de0f12679bc263092ceee97606fe7c49d7c527
lrtao2017/pythonqzs3
/app/example/P_and_P.py
1,031
3.640625
4
#!/usr/bin/env python __author__ = "lrtao2010" #python3.7 实时显示进度条和百分比 #实时打印输出 #显示进度条 # import time,sys # for i in range(20): # sys.stdout.write("=") # time.sleep(0.5) # sys.stdout.flush() #从缓存刷新的屏幕 #显示百分比 # import sys # import time # # def view_bar(num,total): # rate = int(float(num) * 100 / float(...
d717009976d9cbd9054e0e4563b8c55fc2b66ad6
lrtao2017/pythonqzs3
/app/method/str_method.py
12,070
3.6875
4
#!/usr/bin/env python #Python 3.7.0 字符串常用方法 __author__ = "lrtao2010" #capitalize 将字符串的首字符改为大写 # a = "lrtao" # v = a.capitalize() # print(v) # Lrtao #casefold 将字符串所有字符改为小写,功能强大 # a = "LrTao" # v = a.casefold() # print(v) # lrtao #lower 将字符串所有字符改为小写 # a = "LrTao" # v = a.lower() # print(v) # lrtao #upper 将字符全部转成大写 # ...
d67576729d657f106dc5f825a998322c28f3799e
lrtao2017/pythonqzs3
/app/script/openpyxl_test/creat_workbook.py
1,955
3.953125
4
#!/usr/bin/env python __author__ = "lrtao2010" #Create a workbook #There is no need to create a file on the filesystem to get started with openpyxl. # Just import the Workbook class and start using it from openpyxl import Workbook wb = Workbook() #A workbook is always created with at least one worksheet. # You c...
b0fefe091ec23a918fe70f5e07527d3469213c75
LewisBray/ProjectEuler
/Problems 1-10/Euler6.py
216
3.5625
4
def square_numbers(limit): for num in range(limit): yield num ** 2 sum_of_squares = sum(square_numbers(101)) square_of_sum = sum(x for x in range(101)) ** 2 answer = square_of_sum - sum_of_squares print(answer)
0c94f022c4b5e3e7cb3ddb119413d15c77bd1b80
LewisBray/ProjectEuler
/Problems 11-20/Euler12.py
373
3.734375
4
import math def triangle_number(n): return int((n / 2) * (n + 1)) def factors(num): sqrt_num = int(math.sqrt(num)) for x in range(1, sqrt_num + 1): if num % x == 0: yield x if x != sqrt_num: yield num / x num = 1 while len(list(factors(triangle_number(num))...
eb6b3268421fd336c1c60f8f838f067459d19cc8
sachin2222/Pythonpractice
/StringPractice2.py
208
3.515625
4
# str_list = ["Emma", "Jon", "", "Kelly", "sachin", "Eric", ""] # # str_list.remove("") # # print(str_list) # str1 = 'I am 25 years and 10 months old' # list=[] # for char in str1: # if char.isdigit():
6ab4d19ba7e22c9aa0d2437a3fdbd48a6f9ca940
garvsac/AI-checkers-bot
/agent.py
1,101
3.5625
4
#Garv Sachdeva #2015B4A7055P from xd import * MaxUtility = 1e9 MAX_DEPTH = 3 def minimax(depth , curBoard , minimaxnodes ): minimaxnodes = minimaxnodes + 1 def maxValue(board, depth): val = -MaxUtility #print 'maxval' for successor in Successor_function(board,2): val = max(val, mi...
bf4b5d159f8a796f4ff401fffd03866d0a2c3e92
clay53/Clarifai-Basic-Functions-py
/add_images.py
567
3.515625
4
import glob from clarifaif import add_images input1 = raw_input('Enter images directory (./ works) \n') images = [] for img in glob.glob(input1 + '/*.jpg'): print img images.append(img) input2 = raw_input('Enter concepts (seperated by comma NO spaces) \n') concepts = input2.split(',') for concept...
d5c46b1068f3fa7d34ef2ef5151c1c0a825c88f5
derpmagician/holbertonschool-higher_level_programming
/0x0B-python-input_output/0-read_file.py
253
4.3125
4
#!/usr/bin/python3 """ Reads an utf-8 formated file line by line""" def read_file(filename=""): """Reads an UTF8 formated file line by line """ with open(filename, encoding='utf-8') as f: for line in f: print(line, end='')
8fc8ff320c25de0b3b15537fbbee03749721a9c1
Aliena28898/Programming_exercises
/CodeWars_exercises/Roman Numerals Decoder.py
1,816
4.28125
4
''' https://www.codewars.com/kata/roman-numerals-decoder Create a function that takes a Roman numeral as its argument and returns its value as a numeric decimal integer. You don't need to validate the form of the Roman numeral. Modern Roman numerals are written by expressing each decimal digit of the number to be enc...
24540c992ec687bd43c3b38674e1acef2f43dcb8
Aliena28898/Programming_exercises
/CodeWars_exercises/Reversed Sequence.py
298
4.25
4
''' Get the number n to return the reversed sequence from n to 1. Example : n=5 >> [5,4,3,2,1] ''' #SOLUTION: def reverse_seq(n): solution = [ ] for num in range(n, 0, -1): solution.append(num) return solution #TESTS: test.assert_equals(reverse_seq(5),[5,4,3,2,1])
59d8b70823f2f4a55e63011cc61c3960f11b267c
Aliena28898/Programming_exercises
/CodeWars_exercises/Bug Squish.py
859
4.09375
4
'''Take debugging to a whole new level: Given a string, remove every single bug. This means you must remove all instances of the word 'bug' from within a given string, unless the word is plural ('bugs'). For example, given 'obugobugobuoobugsoo', you should return 'ooobuoobugsoo'. Another example: given 'obbugugo', ...
d81c790a09eed424cc3aaebe8fc018e591bee29b
muxiyang/Muxi-Repository-
/Class_3.py
2,896
3.703125
4
from pandas import Series, DataFrame import pandas as pd import numpy as np import os main_dir="/Users/newlife-cassie/Desktop/Data" git_dir="/Users/newlife-cassie/Desktop/PUBPOL590" csv_file_good="sample_data_clean.csv" csv_file_bad="/sample_data_clean.csv" # OS MODULE---------------------- df=pd.read_csv(os.path...
4855bdc60259da64f6c7b8bd7ff7abc39a5987e9
aidancmatthews99/cp1404practicals
/prac_04/lottery_ticket_generator.py
364
3.75
4
import random number_picks = int(input("How many 'Quick Picks'? ")) picks = [] random_number = random.randint(0, 45) for i in range(0, number_picks): j = 0 picks.append([]) while j < 6: if random_number not in picks[i]: picks[i].append(random_number) j += 1 random_n...
88f0ddee425aefd3e06e79a4738258328eff8d33
sert121/Encryption-Methods
/RSA/encrypt_rsa.py
2,097
4
4
import random def check_prime(number): num_of_checks =5 if number ==2 or number ==3: # if the nnumber is 2 or 3 , the return True return True if number%2==0 or number == 1 : #: if the number is 1 return false return False x = number-1 m,n = 0,x while n%2==0: # keep d...
e6e8318132ee672e6ee338c4397dd838cb70cb91
jlubcke/tri.declarative
/lib/tri_declarative/sort_after.py
2,196
3.75
4
from collections import defaultdict LAST = object() def sort_after(items): unmoved = [] to_be_moved_by_index = [] to_be_moved_by_name = defaultdict(list) to_be_moved_last = [] for item in items: after = getattr(item, 'after', None) if after is None: unmoved.append(item...
9f968d1b117122b9a7d4fdc0670927a8337ca882
irwi971/minimum_spanning_tree
/uhd_weighted_graphs/algorithms/prims.py
2,330
4.09375
4
import networkx as nx from functions.weighted_graph_drawings import show_weighted_graph from functions.weighted_graph_drawings import draw_subtree from functions.prims_functions import min_prims_edge, cost def prims_algorithm(G, starting_node, draw = False, detail = False): """Returns mi...
4dc11e1fdefe304cbfbf1013c4dd75a8bd9612ec
xmatheus/Faculdade
/Programação 1/PYTHON-Testes/cinema.py
1,283
3.734375
4
#Python 3 #Matheus Felipe #Verifica filmes import requests import json import os page=None apikey = '' def requisicao(filme): try: page = requests.get("http://www.omdbapi.com/?t="+str(filme)+"&apikey="+apikey)#faz o download da pagina html dicionario = json.loads(page.text)#carrega a pagina como um dicionario...
b47b300f1d23d72b08eb95bddffaa57d10579bc9
xmatheus/Faculdade
/Programação 1/Python 1-semestre/URI/lista4/combinador.py
320
3.734375
4
def main(): quantidade = int(input()) frase = [] for i in range(quantidade): frase = frase+(str(input()).split()) valor = quantidade*2 tudo = str() for i in range(valor): tudo += str(frase[i]) print(tudo) #for letra in frase: #for i in range(len(letra)): #print(letra[i]) main()
ed20ca40ef4af2f2c1decba3e4e75d44bc51073c
xmatheus/Faculdade
/Programação 1/Python 1-semestre/URI/lista2/distanciaentredoispontos.py
337
3.53125
4
def main(): from math import sqrt entrada = [] entrada = str(input()).split() X1 = float(entrada[0]) Y1 = float(entrada[1]) entradaT = [] entradaT = str(input()).split() X2 = float(entradaT[0]) Y2 = float(entradaT[1]) S1 = float(X2-X1)*(X2-X1) S2 = float(Y2-Y1)*(Y2-Y1) ST = float(sqrt(S1+S2)) print("%.4...
2aa5c2bd6f21b05aa23c10913b84d812b08c2445
xmatheus/Faculdade
/Programação 1/PYTHON-Testes/prova2.py
345
3.796875
4
#funcao teste se valor>10 entao divide por 3 ate ser menor que 10 senao se valor<10 funcao multiplica por 2 e retorna def funcao(valor): if(valor<=10): return(valor*2) else: return (funcao(valor//3)) #funcao principal def main(): numero = int() if (numero<=0): numero = int(input()) print(f...
3c38d91b7412fc4295d4223d6ad17a750392136d
xmatheus/Faculdade
/Programação 1/Python 1-semestre/URI/lista1/6imparesafrente.py
178
3.703125
4
def main(): valor = int(input()) contador = int(0) i = int(0) while contador<6: if valor%2 != 0: contador = contador+1 print(valor) valor=valor+1 main()
51bff2c710aa809cc0cf3162502a7acae518bf60
AnaLuizaMendes/Unscramble-Computer-Science-Problems
/Task1.py
1,011
4.25
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 1: How many different telephone nu...
259c58858190409d35b00cdbb62230bd6309f6b4
gjakubik/pythonBattleship
/battleship.py
1,891
3.640625
4
#!/usr/bin/env python3 from Board import Board from Player import Player import tkinter as tk from tkinter import * import time class Battleship(): def __init__(self): self.players =[Player(i) for i in range(0, 4)] self.cellWidth = 3 for player in self.players: player.setPlac...
98eefb96e25fa54aa941158aecc85e7ef01e583f
SamDLJ/BattleSnake
/Battlesnake2019/wrmz.py
3,798
3.75
4
#!/usr/bin/env python3 ''' https://oeis.org/A189722 The On-line Encyclopedia of Integer Sequences explains: "Number of self-avoiding walks of length n on a square lattice such that at each point the angle turns 90 degrees (the first turn is assumed to be to the left - otherwise the number must be doubled)." The en...
a64597f555aab3b280fe88456f6452dc4b18143c
fangzhengo500/HelloPython
/chapter_4_mapping/chapter_4_2/chapter_4_2_3_mapping_fromat_string.py
140
3.625
4
phonebook = { 'Beth': '9102', 'Alice': '2341', 'Cecil': '3528', } print("Ceil's phone number is {Cecil}".format_map(phonebook))
a1dbce52b670674e127c95aa814eeaca5a1a8233
fangzhengo500/HelloPython
/chapter_5/chapter_5_5/chapter_5_5_2_for.py
172
4.1875
4
# 迭代器遍历 words = ['this', 'is', 'an', 'ex', 'parrot'] for word in words: print(word) # 创建范围内的数 print(list(range(10))) print(list(range(2, 10)))
ea9e45b30038e3718cf04f147e58f9a037795db1
fangzhengo500/HelloPython
/chapter_6_abstract/chapter_6_4/chapter_6_4_5.py
148
3.546875
4
def add(x, y): return x + y params = (1, 2) print(params) print(*params) params = {'name': 'Sir Robin', 'greeting': 'Well met'} print(*params)
2f377125ce3efe3515353417d9168d49f514ef43
Krondini/CSCI-3104
/Assignments/Assignment_PS7b/Rondini-Konlan-PS7b-Q3.py
774
3.9375
4
''' # Takes in a list and its bounds as parameters # Function will split the list in half recursively # in order to search for the maximum h-index # Will return the maximum h-index of the list ''' def calcIndex(N, left, right): median = len(N)//2 if (len(N)%2) == 0: #Even number of elements, adjust median medi...
6ca4a22a58c4d5cf4d23efb39aa629d6237a4aae
daeguen/daegeun
/sequences.py
5,124
4.25
4
# 열거형 나열형 # 문자열 name = "홍길동" age = 20 print( "name : " + name + " age : " + str(age) ) print() print( "=" * 20 ) print( "name : %s age : %d" %(name, age) ) print( "name : {0} age : {1}".format( name, age ) ) print( "name : {name} age : {age}".format( name="홍길동", age= 30 ) ) a = "Hello" print( "{0:10}".fo...
18ad26f5f5613336ece2a9affadceb7282ab0a75
aaishikasb/Hacktoberfest-2020
/cryptography system/Crypto_system.py
729
4.3125
4
def machine(): keys = "abcdefghijklmnopqrstuvwxyz !" values = keys[-1] + keys[0:-1] encrypt = dict(zip(keys, values)) decrypt = dict(zip(values, keys)) option = input( "Do you want to encrypt or decrypt, press e for encrypt and d for decrypt?") message = input("what is the message you ...
f9c05d669831eff8a0b1cb372ca5b65b4af04e77
asirota12/2048bot
/2048.py
3,597
3.53125
4
# -*- coding: utf-8 -*- """ Created on Sun Dec 18 17:12:07 2016 @author: Alexander Sirota """ import os import numpy as np class Board: # Constructor def __init__(self): self.state =np.zeros((4,4)) self.numZero=16 self.changed=1 self.stuck=np.zeros(4) # next t...
9567addb587984dfc0b823e5d46756cac7ad6268
sindaakyil/python
/liste.py
1,262
3.71875
4
# 1)"bmv ,mercedes,opel, mazda" elemannlarına sahip bir liste oluşturunuz. liste =['bmv', 'mercedes', 'opel','mazda'] #2)liste kaç elemanlıdır. result=(len(liste)) #3)mazda değerini toyota ile değiştirin liste[-1] = 'toyota' result = liste #listenin ilk ve son elemanı nnedir? result =liste[0] result =liste[3] #6)merc...
9f3fb321ae20fef315b17c48aada33418a993ec0
sindaakyil/python
/pythonsets.py
646
4.1875
4
fruits = {'orange','apple','banana'} print(fruits) for x in fruits : print(x) fruits.add('cherry') #listeye ekler fruits.update(['mango','grape','apple'])# listeye belirlenen elemanları ekler fruits.remove('mango') #listeden mangoyu siler fruits.discard('apple') # listeden apple siler fruits.clear #bütün listeyi s...
8c45529e2e7dd5c1c18cd42e49d59f5f66f24806
sindaakyil/python
/dictionary.py
494
3.59375
4
sehirler = ['kocaeli','istanbul'] plakalar = [41,34] print(plakalar[sehirler.index('istanbul')]) plakalar = {'kocaeli': 41, 'istanbul' : 34} print(plakalar['kocaeli']) print(plakalar['istanbul']) plakalar['ankara'] = 6 plakalar['kocaeli'] = 'new value' print(plakalar) users = { 'sadikturan':{ 'age' 36 , 'email':'s...
e160dbeea1adc15227423aae00bcb24172528f62
sindaakyil/python
/pythonoperatörleri.py
1,130
3.9375
4
x +=5 #x'i 5 ile toplar x -=5 #x'ten 5 çıkarır x *=5 #x' ile 5 çarpr x /=5 #x'i 5 e böler x %=5 #x'in mod 5 ni alır x //=5 #x'in 5 tam bölümünü verir x **=5 #x'in üssünü alır x,y,*z = values #eğer x,y,z elemanları ve values elemanları eşit değilse hata verir eleman sayıları eşit olalıdır *z yazıldığında z'ye list...
5dbbe8875bdd1ab391cc8c14fb6cc9cb246d7316
sudheerprojects/mission-programming
/code_snippets/python/tutorials/decorators.py
2,139
3.859375
4
#Decorator using function decorator def display_decorator(original_display): def wrapper_function(*args, **kwargs): print(' Wrapper executed for {}'.format(original_display.__name__)) return original_display(*args, **kwargs) return wrapper_function @display_decorator def display(): prin...
608bccff7033ace8afa34738634e752afaccfe5d
chanchana/rush-server
/lib/listbox_test.py
653
3.5625
4
from tkinter import * def func1(): print("in func1") def func2(): print("in func2") def selection(event): print(listbox.selection_get()) root = Tk() # frame = Frame(root) # frame.pack() dictionary = {"5":func1, "2":func2} items = StringVar(value=tuple(sorted(dictionary.keys()))) listbox = Listbox(ro...
8ffe2d2e791532d64b5270fdc4f89e8ba1addd14
TIRSA30/UG9_A_71210700
/2_A_71210700.py
434
3.84375
4
#Menghitung perpangkatan 5 #defenisi data test case 1 angka1 = int(input("Masukan angka: ")) BesarNilaiPangkat = 5 #proses Hasil = pow(angka1, BesarNilaiPangkat) print(angka1,"pangkat",BesarNilaiPangkat,"adalah",Hasil) #defenisi data test case 2 angka1 = int(input("Masukan angka: ")) BesarNilaiPangkat ...
86f723745bfd29a91445c62162f4708bb289b9ef
danypr92/CodeChallenges
/Python/CoderByte/1st/letter-capitalize.py
597
4.0625
4
#!/usr/bin/python3 import unittest import unittest def LetterCapitalize(str): """Using the Python language, have the function LetterCapitalize(str) take the str parameter being passed and capitalize the first letter of each word. Words will be separated by only one space.""" sol_str = "" for w in str.spl...
642745f5d686157f9ec893b87f447d7576443fe1
blairnangle/using_python_to_access_web_data
/follow_links.py
525
3.609375
4
import urllib from BeautifulSoup import * url = raw_input("Enter your web page for scraping: ") link_number = int(raw_input("Enter the link number: ")) repetitions = int(raw_input("Enter the number of repetitions: ")) names = [] while repetitions > 0: links = [] html = urllib.urlopen(url).read() soup = B...
31ac1af4a554610f539ff4fcad6891dec5d2d839
jennywu0417/homework5
/homework5.py
651
3.609375
4
a = int(input('請輸入班級人數:')) name = [] num = [] for i in range(a): stu = input('請輸入姓名:') name.append(stu) e = int(input('請輸入分數:')) num.append(e) d = 0 for i in range(a): d = d + num[i] #print('sum: ',d) avg = d/a print('平均分:',avg) biggest = 0 indexbig = 0 for i in range(a): ...
c2abcb5582beea8fc82ed45c82d7091cdfb84bc3
Athenian-ComputerScience-Fall2020/reading-files-ryanabar
/my_code.py
523
3.625
4
# Collaborators (including web sites where you got help: (enter none if you didn't need help) # def avg_temp(): with open('temps.txt') as file_object: line_list = file_object.readlines() list_length = len(line_list) for i in range(list_length): line_list[i] = line_list[i].rstrip() t...
f48779d5b775dd499dca0925c02e4c48ea5d1631
GurjitSangha/python-examples
/python/Listing to Dictionary/List_to_Dictionary.py
331
4.0625
4
#Convert list into a Dictionary using python #Input list1=[1,2,3,4,1,2,7] #Declaring a dictionary d={} # Using a for loop to iterate over the elements of the list for i in list1: #checking if the dictionary already has the element or not if i in d: d[i]+=1 else: d[i]=1 #Final output require...
0d960ec58db9855ec4a58b89f223bfabfadf9c51
GurjitSangha/python-examples
/python/Fibonacci/fibonacciDynamicProgramming.py
441
4.0625
4
"""Convert a m-base Number to a n-base Number.""" import math def fibonacciDP(ith): """compute nth Fibonacci using Dynamic Programming Bottom-up""" if ith == 1 or ith == 2: return 1 a, b = 1, 1 i = 2 while i < ith: i += 1 b, a = a+b, b return b def main(): """Print...
12776abf4f9374f388abf2f0d8dcf2ffcede5c56
alexxxmf/neural-networks
/Activations/Sigmoid.py
1,001
3.796875
4
import numpy as np from math import exp class Activation_Sigmoid(): def normalized_sigmoid(self, inputs): # this could potentially cause an overflow because of the exp explosion # normally this is the formula for the sigmoid 1 / (1 + np.exp(-inputs)) # for an exp big enough we could run into an overflo...
a3061cab6aa629186074fb7784cce45809892c69
kbobs/com101
/coursework.py
3,482
4.3125
4
# This program will read in data from a text file containing food items # and store the data within a list. # The program will present the user with a set of menu options and will be # able to sort the list, produce a report and query the list appropriately. import csv # Define the main function def main(): # Th...
49cafe1da9914d24b9ea2fa680b4b102b52998b7
git-abhinav/DBMS
/equivalence.py
3,433
3.921875
4
import math # for math.power function def unify(String_to_unify): ''' Objective: To remove the repeated occurances of characters Input: Character array or String(with repeated occurances) Output: String with unique characters ''' return ''.join(set(String_to_unify)) d...
c0f8180687415dbc703433d7642329baedf9212f
MLHafizur/Unscramble-Computer-Science-Problems
/Task4.py
1,528
4.1875
4
""" Read file into texts and calls. It's ok if you don't understand how to read files. """ import csv with open('texts.csv', 'r') as f: reader = csv.reader(f) texts = list(reader) with open('calls.csv', 'r') as f: reader = csv.reader(f) calls = list(reader) """ TASK 4: The telephone company want to i...
6886fef24df8c8af4d32d699433aa02027911876
renzowesterbeek/cointosssimulator
/random.py
374
3.890625
4
import random count = 0 kop = 0 munt = 0 times = raw_input("How many coin tosses? ") times = int(times) while count < times: rand = random.randint(1,2) if rand == 1: kop += 1 else: munt += 1 count += 1 percentage = float(kop) / count print "Heads = " + str(kop) print "Tails = " + st...
105e69d19ac4b80ea7e148dcf73c2e7612810100
grmwld/crg
/python/lib/AGBio/io/Fasta.py.bak
2,905
3.5
4
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import re class SequenceList(list): '''Class representing a set of sequences ''' def __init__(self, sequences=''): self.extend(sequences) def symetric_difference(self, other): '''Find elements in either the list or ot...
5477c44316a18d9a76099eb69104135e43ccfc37
BHRY1314/offer_python
/面试题30:包含min函数的栈.py
1,046
4.0625
4
#!/usr/bin/env python # coding: utf-8 # # 题目 # # ### 定义栈的数据结构,请在该类型中实现一个能够得到栈的最小元素的min函数。在该栈中,调用min,push及pop的时间复杂度都是O(1) # In[ ]: ''' 思路: 使用辅助栈,把每次的最小元素(之前的最小元素和新压入栈的元素两者的较小值)都保存起来放到另外一个辅助栈里。 如果每次都把最小元素压入辅助栈,那么就能保证辅助栈的栈顶一直都是最小元素。当最小元素从数据栈内被弹出之后,同时弹出辅助栈的栈顶元素,此时辅助栈的新栈顶元素就是下一个最小值。 ''' m_data=[] m_min=[] def push(val...
42e0d2e20dcb814e35b2f80c758dfcdd7c5ef6f0
BHRY1314/offer_python
/面试题62:圆圈中最后剩下的数字.py
3,584
3.6875
4
#!/usr/bin/env python # coding: utf-8 # # 题目 # # ### 0,1,……,n-1这n个数字排成一个圆圈,从数字0开始,每次从这个圆圈里删除第m个数字。求出这个圆圈里剩下的最后一个数字.例如,0、1、2、3、4、5这5个数字组成一个圆圈(如图6.3所示),从数字0开始每次删除第3个数字,则删除的前4个数字依次是2、0、4、1,因此最后剩下的数字是3 # ![6_3](6_3.png) # In[ ]: ''' 思路: 本题就是有名的约瑟夫环问题。这个题目有两种解题方法 ''' ''' 1.用环形链表模拟圆圈 既然题目中有一个数字圆圈,很自然的想法就是用一个数据结构来模拟这个圆...
66abd28b1269c5d8a0f78af1651e6268679560e8
BHRY1314/offer_python
/面试题57:和为S的数字.py
3,827
3.640625
4
#!/usr/bin/env python # coding: utf-8 # # 题目一:和为s的两个数字 # # ### 输入一个递增排序的数组和一个数字s,在数组中查找两个数,使得它们的和正好是s。如果有多对数字的和等于s,则输出任意一对即可 # # In[ ]: ''' 思路: 我们以数组{1,2,4,7,11,15}及期待的和15为例详细分析一下这个过程。首先定义两个指针,第一个指针指向数组的第一个(最小的)数字1,第二个指针指向数组的最后一个(最大的)数字15,这两个数字的和16大于15,因此我们把第二个指针向前移动一个数字,让它指向11.这时候两个数字1与11的和时12,小于15,。接下来我们把第一个指针...
b514651bdd652364d7fedbf6d5a90ed3181c1cd0
BHRY1314/offer_python
/面试题39:数组中出现次数超过一半的数字:.py
2,066
3.71875
4
#!/usr/bin/env python # coding: utf-8 # # 题目 # # ### 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。例如,输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2 # In[ ]: ''' 思路: 数组中有一个数字出现的次数超过数组长度的一半,也就是说它出现的次数比其他所有数字出现的次数的和还要多。因此,我们可以考虑在遍历数组的时候保存两个值:一个是数组中的一个数字;另一个是次数。当我们遍历到下一个数字的时候,如果下一个数字和我们之前保存的数字相同,则次数减1.如果次数为0,那么我们需要保...
a6131cc4679abcbc34a62fe0747b43142cfb74e3
BHRY1314/offer_python
/面试题63:股票的最大利润.py
1,492
3.734375
4
#!/usr/bin/env python # coding: utf-8 # # 题目 # # ### 假设把某股票价格按照时间先后顺序存储在数组中,请问买卖该股票一次可能获得的最大利润是多少?例如,一只股票在某些时间节点的价格为{9、11、8、5、7、12、16、14}。如果我们能在价格为5的时候买入在价格为16时卖出,则能收获最大的利润11。 # In[4]: ''' 思路: 我们先定义函数diff(i)为当卖出价为数组中第i个数字时可能获得的最大利润。显然,在卖出价固定时,买入价越低获得的利润越大。也就是说,如果扫描到数组中的第i个数字时,只要我们能够记住之前的i-1个数字中的最小值,就能算出在当前价位卖出时可能...
ad8560fd8610a301c4495b3feb21dfad48b31275
BHRY1314/offer_python
/面试题26:树的子结构.py
1,336
3.875
4
#!/usr/bin/env python # coding: utf-8 # # 题目 # # ### 输入两颗二叉树A和B,判断B是不是A的子结构。 # In[1]: class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None # In[ ]: ''' 思路: 我们可以分成两步:第一步,在树A中找到和树B的根节点的值一样的节点R;第二步,判断树A中以R为根节点的字数是不是包含和树B一样的结构 ''' ''' 判断相等 由于节点值可能是dou...
91b10c915cfb3ae158c79bd71a13e0782cca9be3
BHRY1314/offer_python
/面试题64:求1+2+……+n.py
479
3.875
4
#!/usr/bin/env python # coding: utf-8 # # 题目 # # ### 求1+2+3+……+n,要求不能使用乘除法、for、while、if else、switch case等关键字以及条件判断语句(A?B:C) # In[ ]: ''' Python利用内置函数 ''' def Sum_solution(n): n=range(1,n+1) return sum(n) # In[ ]: ''' 利用短路求值原理 利用短路 && 来实现 if的功能 ''' def Sum_solution(n): res=n temp=res and Sum_sol...
99abf35d29cc6488acc5a7d230abd99688ca45ea
JKinsler/Sorting_Algorithms_Test
/merge_sort3.py
1,508
4.15625
4
""" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Merge sort Sorting array practice 6/9/20 +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Sort an unsorted array in O(nlogn) time complexity Developer notes: this is my favorite way to organize the merge sort algorithm because I think ...
e0c5fc3a55327871f16b450def694a6dd97a8e5f
JKinsler/Sorting_Algorithms_Test
/merge_sort2.py
1,353
4.15625
4
""" +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Merge sort Sorting array practice +++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Sort an unsorted array in O(nlogn) time complexity """ def merge_sort(arr): """ decompose the array into arrays of length 1 recombine the a...
846cd8b42de93ccc9e50c477872a57baa6e624eb
joskulj/cryptbox
/cryptbox/dirscanner.py
2,941
3.59375
4
# cryptbox - class to scan the source directory # # Copyright 2012 Jochen Skulj, jochen@jochenskulj.de # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at...
1caf611aeceb70c7bca1a08c69d7a03efc6a8902
Samson-DVS/ECU_ASSIGNMENTS
/Semester 3/Cryptographic Concepts/Crypto currency program/Block_ledger.py
2,326
3.5
4
import string import random def transadd(): send = "" while (send.isalpha() is False): send = input("From (max 10, letters only): ") if send == "": send = randomvalue("c") send = send.strip() send = send.casefold() send = send[0:10] print("Sending from: " + send) ...
22a24aea66dea6e9ad12d13f0fe9f59defaf78ee
Ryn0K/leetcode_solutions
/spiral-matrix/solve.py
1,018
3.609375
4
from typing import List class Solution: def spiralOrder(self,m:List[List[int]]) -> List[int]: self.res = list() self.spiral(len(m),len(m[0]),m) return self.res def spiral(self,row,col,m): top = 0 bottom = row -1 left = 0 right = col - 1 dr = 0 while(top<=bottom and left<=right): ...
e7ee81b5f020ffd221de575fce937916aa822526
Ryn0K/leetcode_solutions
/Search_In_Rotated_Sorted_Array/solve.py
264
3.671875
4
from typing import List class Solution: def search(self,nums:List[int],target:int) -> int: for i in range(len(nums)): if nums[i] == target: return i return -1 if __name__ == "__main__": s = Solution() print(s.search([4,5,6,7,0,1,2],0))
1e4aacdec083bb35685affc59ababa1e170d6d52
vincentrk/cs370-project
/python/Surroundings.py
772
3.625
4
class Surroundings: def __init__(self, front, left, back, right): # type: (TerrainTile, TerrainTile, TerrainTile, TerrainTile) -> self self.front = front self.left = left self.back = back self.right = right def __eq__(self, other): # type: (Surroundings) -> Boole...
b9457c79d50299b51ef5f52039ab250c4dac5349
m-kempa/Sorting-Algorithms
/QUICKSORT_ALG.py
2,072
3.875
4
import timeit import functools def quicksort(zbior): left = [] right = [] l = [] # lista środkowa global equal global swap hah = 0 #warunek pojedynczego wejścia if len(zbior) > 1: pivot = zbior[0] for x in zbior: if hah == 0: ...
ff0590a452b7c52c20379f18f31255c6471251f6
Bryan-DiCarlo/MIT-6.0001-Problem-Set-0
/ps0.py
741
3.984375
4
# -*- coding: utf-8 -*- """ Created on Fri Jan 24 13:03:16 2020 @author: bryan """ #Write a program that does the following in order: #1. Asks the user to enter a number “x” #2. Asks the user to enter a number “y” #3. Prints out number “x”, raised to the power “y”. #4. Prints out the log (base 2) of “x”....
d98acdba1f43e50be520e36ddc4e0242f5e9c45c
mpusio/Teoria_Grafow
/Laboratorium3/ClassGraphColor.py
4,671
3.546875
4
# Koloruje graf na 2 kolory i sprawdza czy jest dwudzielny class Graph: def __init__(self, list_neighbors): self.list_neighbors = list_neighbors def DFS(self): """Przeszukuje graf w glab, sprawdza czy jest spojny""" def list_edges(): """Zwraca nowa liste z parami wierzchol...
181c452e13d40dd45edcb3bb8a5d2afae508b511
aming-note/note
/Tkinter_demo/yys_demo/tk.py
1,165
3.96875
4
from tkinter import * from tkinter import ttk class app(): def __init__(self): self.root = Tk() self.root.title("痒痒鼠命中概率计算器") self.root.geometry('%dx%d+%d+%d' % (300, 500, (self.root.winfo_screenwidth() - 300) / 2, (self.root.winfo_screenheight() - 700) / 2)) self.body() self...
0eec12eac81b2e72db3f34ae6b632bde9f029f5c
NataliyaPavlova/Stepik-algo-tasks
/task6_1.py
414
3.625
4
''' Binary search ''' def search(lst, k): l = 0 r = len(lst)-1 while l<=r: m=(l+r)//2 if lst[m]==k: return m+1 if lst[m]>k: r=m-1 else: l=m+1 return -1 def main(): lst = list(map(int, input().split()))[1:] keys = list(map(int, input().split()))[1:] for ...
30c4e1c9df472a3ffd023ba9e87da89643c96f43
sankalpdayal5/LeetCode-Solutions
/Python/1392.py
239
3.5
4
class Solution: def longestPrefix(self, s: str) -> str: for i in range(len(s)-1 , 0, -1): ls = s[:i] rs = s[-i:] if ls == rs: return ls return ""
46bc2fe993802017ea5021a82c9da8587afd75f3
Daozhou155/python-learn
/构造和析构.py
844
4.09375
4
# !/usr/bin/env python # -*-coding:utf-8-*- # author: zjr time: 2019/8/26 # 构造 # __init__(self) class Rectangle: def __init__(self, x, y): self.x = x self.y = y def getperi(self): return (self.x + self.y) * 2 def getarea(self): return self.x * self.y r ...
34607de71b8acbc44dc10d5087b6a6e578fce1d9
Daozhou155/python-learn
/picklemodule.py
545
3.515625
4
# !/usr/bin/env python # -*-coding:utf-8-*- # author: zjr time: 2019/8/23 # pickle模块是以二进制的形式序列化后保存到文件中(保存文件的后缀为”.pkl”) # 通过pickle模块的反序列化操作,我们能够从文件中创建上一次程序保存的对象 import pickle my_list = [123, 3.14, '道周', 'love'] pickle_file = open('my_list.pkl', 'wb') pickle.dump(my_list, pickle_file) pickle_file.close() pick...
9601cc0074e5f52b7af909d3c35bc35b55c65a8c
Daozhou155/python-learn
/a6.py
659
4.15625
4
# !/usr/bin/env python # -*-coding:utf-8-*- # author: zjr time:2019/8/18 # 列表元素提取 list1 = [1, 2, ['a', 'b'], 123] print(list1[2][1]) # 列表元素计数,不能计算列表中的列表 list2 = [123, 456, 789, [123, 111]] list2 *= 5 a = list2.count(123) print(a) # 列表元素位置 list3 = [1, 2, 3, 4, 5, 6, 7, 8, 9] print(list3.index(3, 0, 10)) # ...
5a5c10e83e60d200ed4a722f8a018e43014d628d
Benedict-1/mypackage
/mypackage/sorting.py
1,561
4.34375
4
def bubble_sort(items): '''Return array of items, sorted in ascending order''' count = 0 for idx in range(len(items)-1): if items[idx] > items[idx + 1]: items[idx],items[idx + 1] = items[idx + 1],items[idx] count += 1 if count == 0: return items else: ...
eb4cec2feb88d22fbd755b443dd2879dd8f88317
gabrielksneiva/Menu_jogos
/main.py
8,450
4
4
#Classe Adivinhação, cria o jogo Adivinhação. class Adivinhacao: #Função escolha, analisa a escolha do jogador e trata alguns erros possíveis. def escolha(self): for j in range(49, 0, -1): try: escolha = int(input("Escolha: ")) i = True while i...
1532137b92227a797a6a3f4a310dac9ea6c03311
caozixuan/Code-Evaluation
/demos/test classify/data/two/test9.py
1,703
3.828125
4
# encoding=utf-8 class TreeNode(object): #定义二叉树类 def __init__(self,val,left=None,right=None): self.val = val self.left = left self.right = right class BinaryTree(object): def __init__(self,root=None): self.root = root ...
ba45c8ac3a5601517e93e992d308732771198602
gauravrmazra/data-science-learning
/python-programming-beginner/Dictionaries-70.py
2,060
4.09375
4
## 1. The Data Set ## # Weather has been loaded in. first_element = weather[0] print(first_element) last_element = weather[(len(weather) - 1)] print(last_element) ## 3. Practice Populating a Dictionary ## superhero_ranks = {} superhero_ranks['Aquaman'] = 1 superhero_ranks['Superman'] = 2 ## 4. Practice Indexing a D...
e4635e62938f6fb10ac4a135c5575b2f0375585c
Chetank003/machine-learning-basics-using-python
/ML basics/test_employee.py
1,931
3.890625
4
# -*- coding: utf-8 -*- """ Created on Wed Oct 16 14:55:55 2019 @author: chethan.k """ import unittest from employee import Employee class TestEmployee(unittest.TestCase): @classmethod def setUpClass(cls): print("setupclass") @classmethod def tearDownClass(cls):...
d9aba0051921f31a7bf3ee5498ac8f60612ff637
Chetank003/machine-learning-basics-using-python
/ML basics/linear_regression_from_scratch_1.0.py
2,291
3.625
4
# -*- coding: utf-8 -*- """ Created on Tue Oct 1 15:00:00 2019 @author: chethan.k """ #importing librares #import numpy as np import pandas as pd from sklearn.model_selection import train_test_split from sklearn.metrics import r2_score import matplotlib.pyplot as plt #predicting the outputs def predi...
ec7d5f3d2a383e6ee1369c4cb3a5e0ac4675d872
Shantha-Kumar-A/yuvarepo
/def_301119.py
500
3.953125
4
def calcavgdist(cord1,cord2,cord3): temp1 = cord1[0] + cord2[0] + cord3[0] temp2 = cord1[1] + cord2[1] + cord3[1] avgdist = (temp1 + temp2) / 3 return avgdist if __name__ == '__main__': cord1 = [1,2] cord2 = [2,3] cord3 = [4,6] print(calcavgdist(cord1,cord2,cord3)) def ...
f0989360e3489d8f950daa2f23d26f69d68eaab9
Shantha-Kumar-A/yuvarepo
/Inheritance_Example.py
793
3.671875
4
class A(): def feature1(self): print("feature 1 is working") def feature2(self): print("feature 2 is working") class A1(): def feature1_1(self): print("feature 1.1 is working") def feature2_1(self): print("feature 2.1 is working") class B(A):...
e224dafd3e35959feffd1ace01599c5833048a0b
Shantha-Kumar-A/yuvarepo
/For_Lopp.py
219
4.09375
4
x = ['Yuvaraj','hi',298] for i in x: print(i) x = 'Yuvaraj' for i in x: print(i) for i in range(10): print(i) for i in range(11,20): print(i) for i in range(20,10,-1): print(i)
825066676a20d6664c37b4e0b2dc2ea931e079c0
Shantha-Kumar-A/yuvarepo
/Selection_Sort.py
336
3.859375
4
def sort(list): for i in range(len(list)-1): minpos = i for j in range(i,len(list)): if list[j] < list[minpos]: minpos = j temp = list[i] list[i] = list[minpos] list[minpos] = temp #print(list) list = [13,5,6,2,7,9] sort(list...
15f79f61e30847681b82ec068483f87660534141
Shantha-Kumar-A/yuvarepo
/Array_copy.py
806
3.890625
4
from numpy import * arr = array([1,2,3,4,5]) arr = arr + 5 print(arr) arr1 = array([1,2,3,4,5]) arr2 = array([1,2,3,4,5]) arr3 = arr1 + arr2 print(arr3) print(sin(arr1)) print(cos(arr1)) print(tan(arr1)) print(log(arr1)) print(sqrt(arr1)) print(concatenate([arr1,arr2])) arr_1 = array([...
93e34345829d0abd33235707e83bccab33329ffd
vztpv/Python-Study
/Chapter2/py002.py
308
3.578125
4
# 2-2 problem1, problem2, problem3, problem4 number = "881120-1068234" print(number[0:6]) print("\n") print(number[-7:7]) pin = "881120-1068234" print(number[7]) str = "a:b:c:d" x = str.replace(":", "#") print(str) print(" : ") print(x) str = str.split(":") z = "#".join(str) print(z)
d595d5716e4c069c62d49c1cdc49402895789d7e
vztpv/Python-Study
/Chapter2/py003.py
154
3.875
4
# 2-3 problem1, problem2 list = ["Life", "is", "too", "short"] print(" ".join(list)) var = [1, 3, 5, 4, 2] var.sort() var.reverse() print(var)
ee7cde93c2b9033376c4a615294bdb9202fa793e
abhilash576/Python_Programming
/Single_riffle.py
462
3.65625
4
def is_single_riffle(half1, half2, shuffled_deck): half1_index = 0 half2_index = 0 half1_max_index = len(half1) - 1 half2_max_index = len(half2) - 1 for card in shuffled_deck: if half1_index <= half1_max_index and card == half1[half1_index]: half1_index += 1 elif half2_...
367ae9e85e2ee9d3f75e2de2daa61c6e8ee00160
ccaragine/PythonCourse2019
/homeworks/hw1/HW1_Caragine.py
2,576
3.5625
4
##################### HOMEWORK 1 #################### ## Author: Crystal Caragine ## Date: 8/7/2019 ## Saved as: HW1_Caragine my_print_statement = [] class Stock: def __init__(self, symbol= "", amount= 0): self.symbol = symbol self.amount = amount class Mutualfund: def __init__(self, sy...
747a5e8afb5a46555e4162ef1c261e438f7b9572
keys4words/python
/specialist02/005_point.py
793
3.75
4
class Point: __counter = 0 def __init__(self, x, y): self.__x = x self.__y = y Point.__counter += 1 @classmethod def get_counter(cls): return cls.__counter def move_to(self, x, y): self.__x = x self.__y = y def move_by(self, x, y): self.__...
73b2bddf8afbe477da673f6414a4f4d07c953300
keys4words/python
/teclado_flow/zero_sum_input.py
129
3.75
4
s=sq_sum=0 n = int(input()) s += n sq_sum += n**2 while s!= 0: n = int(input()) s += n sq_sum += n**2 print(sq_sum)
3924ee4b03b56b7b6d4190c3e7294c690f5ceaef
keys4words/python
/web-dev/flow.py
309
3.65625
4
from datetime import datetime as dt from datetime import timedelta now = dt.now() print(now) # print(dt.now().day) # print(dt.now().hour) # print(dt.now().minute) # print(dt.now().month) # date1 = dt(2019, 11, 5) date1 = now + timedelta(days=180) print(date1) delta = now - date1 print('diff = ', delta.days)