blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
9bfe470125f0f7e7eaccaf5455598e43b0e1951e
LeozinLL/Curso-Em-Video
/FOR/ex07.py
452
3.875
4
n = int(input('Digite um número: ')) c = 0 for i in range(1, n+1): if n % i == 0: print(f'\033[0;32m{i}\033[m', end=' ') c += 1 else: print(f'\033[0;30m{i}\033[m', end=' ') if n % 2 == 0: print(f'\nO número {n} foi divisível {c} vezes') print('Então ele não é um numero ...
1a3fe03f614416813be8bb1949488244873555ba
adelascasas/Alien_attack
/scoreboard.py
3,044
3.625
4
import pygame.font from spaceship import Spaceship from pygame.sprite import Group class Scoreboard: """Represent the score of the player""" def __init__(self, settings, screen, stats): """Initialize the attributes of the scoreboard""" self.settings = settings self.screen = screen ...
e9b9814fa27f138afbffb10cb69fa710e34118db
Siloow/old-projects
/INFDEV02-1_0906848-old/INFDEV02-1_0906848/Pratice/Pratice/Pratice.py
2,075
4.09375
4
class Empty: def __init__(self): self.IsEmpty = True Empty = Empty() class Node: def __init__(self, value, tail): self.IsEmpty = False self.Value = value self.Tail = tail l = Empty ''' cnt = int(input("How many elements")) for i in range(0, cnt): v = int(input("Next elem...
6355e9d54057e22547933376826f33c17a5c30fb
xuyuanwei/pcscode
/libreoffice/commonfun.py
7,204
3.890625
4
# -*- coding: utf-8 -*- import os import fileinput def readvarible(configfilename,sectionname): ''' this function is used to read the cofig file configfilename: the full path of the config file sectionname: which secton data to read the content should be like: #Comment content [s...
76eb84ddf9bf2d1218c5f7080acba32f14a0bc00
maheswarantp/Enigma_Machine
/enigma_oop.py
6,407
3.65625
4
from tkinter import * import string import random class Enigma(object): def __init__(self): self.root = Tk() self.root.counter, self.root.counter_1, self.root.counter_2 = 0, 0, 0 self.root.title("Enigma OOP") self.true_alphabet = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N'...
4f3e8a82f8eb823cffaf7bdad6a0eaed321c9009
laundsallyn/writersblock
/app/models.py
4,952
3.65625
4
#!/usr/bin/env/python from sqlalchemy.ext.declarative import declarative_base from sqlalchemy import Column, Integer, Date, String, Table, ForeignKey from datetime import date from sqlalchemy.orm import relationship Base = declarative_base() """assoc_author_book is an intermidate tables that establishes the many to ma...
decefee9fbde66b4452807c9af17bc9702396fb6
thucdx/pythonchallenge
/ch11.py
334
3.5
4
# Conway sequence num = '1' step = 0 while step < 30: new_num = "" count = 0 last = '-' for i in range(len(num)): if (num[i] == last): count += 1 else: if (last != '-'): new_num += str(count) + str(last) count = 1 last = num[i] new_num += str(count) + str(last) num = new_num step += 1 pri...
74bfc5ddbc4d5246813af7915e9158c3e5b2516a
thucdx/pythonchallenge
/ch4.py
123
3.515625
4
import re data = open("ch4.input", "r").read() print("".join(re.findall("[^A-Z]+[A-Z]{3}([a-z])[A-Z]{3}[^A-Z]+", data)))
a6b2a4654caff862f2cf810bcd8530b2bad23241
anandk10/MyPythonPractice
/loop.py
506
4.15625
4
testing_while = int(input()) testing_for = int(input()) temp = testing_while temp1 = testing_for while(temp > 0 or temp1 > 0): print("the value of temp is now ",temp) if(temp>=0): temp = temp-1 if(temp<0): print("temp1 value ",temp1) temp1-=1 input() if(testing_for>testing_while): min = testing_while max =...
31357b2e337a2983d8b8dcfe9cea5e58a49d38b8
anandk10/MyPythonPractice
/hackerrank/intro/interchangeTwoNumbers.py
220
3.953125
4
# Enter your code here. Read input from STDIN. Print output to STDOUT # Problem link : https://www.hackerrank.com/challenges/interchange-two-numbers/ # Python 2 a = int(input()) b = int(input()) a,b = b,a print a print b
e7f6e2e6fa76dc6241b71fb48ce589244bbeeb6b
eeshannarula29/Climate-Change-Report-csc110-project
/greenhousegases_project.py
13,453
3.953125
4
"""This file is used for the visualization of the trends in Greenhouse Gases and carbon emissions. Resources: - https://www.geeksforgeeks.org/box-plot-in-python-using-matplotlib/ - https://www.kite.com/python/answers/how-to-color-a-scatter-plot-by-category-using-matplotlib-in-python - https://plotly.com/python/box-plot...
2a47226eae01d244fe85c54363e4440a4e00c4a1
gbrough/python_basics
/toptal3.py
657
3.6875
4
#given a string representing the list of M photos, returns the string representing the list of new names of all photos (the order of photos should stay the same). def solution(S): # write your code in Python 3.6 photos = S.split('\n') photos = S.split('\n') photos = [photo.split(' ') for photo in photos] ...
1c97740406aed1312f27a6921b8283c3851a5b9b
Evana13G/ML_projects
/Basic_NN/neural_network.py
2,778
3.71875
4
import numpy as np import math from util import sigmoid, sigmoid_derivative class NeuralNetwork: def __init__(self, x, y): # self.training_input = x # self.training_output = y self.input = x #lets say its an array np.array([4, 3, 4, 5]) self.weights1 = np.random.rand(self.input.shape[1], 4) # Tuple of the d...
5c25c317085dea651f5c2cba9c8fdf7a29fd472b
Donghyun-34/Python
/실습 코드/JumpToPython/연습문제/6장/게시판 페이징하기(6장).py
336
4.125
4
""" 점프 투 파이썬 06장 게시판 페이징 하기 만든이 : 김동현 만든 날짜 : 2021년 08월 13일 월요일 """ def getTotalPage(n, m): if n % m == 0: return int(n/m) return int(n/m + 1) print(getTotalPage(5, 10)) print(getTotalPage(15, 10)) print(getTotalPage(25, 10)) print(getTotalPage(30, 10))
f745523e3d9d099131fef40fcfa602b7687ef5cb
jefftapper/SchoolDays
/src/AlexaSchoolDays.py
9,493
3.828125
4
""" This sample demonstrates a simple skill built with the Amazon Alexa Skills Kit. The Intent Schema, Custom Slots, and Sample Utterances for this skill, as well as testing instructions are located at http://amzn.to/1LzFrj6 For additional samples, visit the Alexa Skills Kit Getting Started guide at http://amzn.to/1LG...
71da9ac11c95f2a49dbc137da9b59f1ea985a1a9
anthonyramos47/pico-placa
/processing.py
2,726
3.71875
4
""" Module to process the data of Pico y Placa """ from datetime import date, time, datetime from car_module import * # Global Variables aux = datetime.now() # aux value to set time morning_in = aux.replace(hour=7, minute=0) # 7:00 morning_end = aux.replace(hour=9, minute=30) # 9:30 afternoon_in = aux.replace(hour=1...
33d6ec046d36b3ddb19eb91425a731ba3bcd2eca
mlateb/GE501_HW
/HW1/q3.py
3,094
4.09375
4
#!/usr/bin/env python """ GE 501 HW#1 Question 3 Author: Eric Bullock Date: September 2016 Version: 1.1 Usage: q3.y [options] Options: -o --orbit <orbit> Orbit height of TRMM in km (default: 403.5) -i --inclination <inc> Orbital inclination in degrees (default: 35) -g --grav...
461bb82de49aa4b491dcf195385e497a8448fe6d
mariascervino/basics
/Algoritimos/CurrencyConversionUser.py
440
4
4
# Fazer a conversao de moedas de real para dolar quantas vezes o usuario quiser qtdConvs = int(input("How many times would you like to do this operation? ")) # while Conv = int(input("Quantas vezes voce deseja fazer a conversao?")): countLoop = 1 while (countLoop <= qtdConvs): real = float(input("What is the value...
f7c42b649a445a8fc8eaea55d29631d56ee43946
mariascervino/basics
/Learn Python for Total Begginers/BuiltInFunctions.py
330
4.0625
4
numbers = [10, 20, 60, 30, 50, 40] print(numbers) print(max(numbers)) print(min(numbers)) print(sum(numbers)) #Arredonda o numero: print(round(5.12345, 2)) #Converte uma string em um numero int or float: num1 = eval("4.5") num2 = eval("500") print (num1+num2) #Eleva um numero a potencia dada: print(pow(4,3)) print(...
401845135574ccfd3200e3ab2e65c53accc87c94
mariascervino/basics
/Learn Python for Total Begginers/Exercises/ForLoopsWithAddedItensFromDict.py
137
3.625
4
d1 = {"k1": [20, 30, 40], "k2": [1000, 2000, 3000]} for i in range(3): print("Total = ", d1["k1"][i] + d1["k2"][i]) print("END LOOP")
8572aa28030ca0d00f57a8cac9ee43b8fb1b5d6c
mariascervino/basics
/Learn Python for Total Begginers/Exercises/ControlFlowWithDict.py
493
3.859375
4
d1 = {"k1": [1,2,3, (100, 300, 500)], "k2": [4,5,6, ["phone", "computer", "robot"]]} var = eval(input("Enter a number: ")) if var in d1["k1"]: print("found you!") num = input("Enter a number or string: ") if (num) in d1["k2"][:3]: print("Found another one!") elif num in d1["k2"][3]: ...
7c55bd9ef753f04c74336c2813f3742b55359862
mariascervino/basics
/Learn Python for Total Begginers/ForLoops.py
799
4.09375
4
for i in range (5): print("Hello World") cats = ["tiger", "lion", "jaguar", "liopard"] for cat in cats: print(cat) for num in range (4): print(num, num + 10, num * num) nest1 = [[10, 20, 30], [3.5, 4.5, 5.5], ["sword", "hammer", "shield"]] for i in range(3): #print(nest1[i]) # pode-se imprimir uma, d...
ffacbcefe9f3e052c59d540446d663a04f7c25fa
mariascervino/basics
/Learn Python for Total Begginers/Exercises/ForLoopsToFixStudentsName.py
197
3.6875
4
students = ["nAtalie", "M", "Fa ye", " Callum", "Tara"] names = [] for i in students: if len(i) > 1: s = i.upper().replace(" ", " ") names.append(s) print(tuple(names))
16098298ac98e14b61f1bc76a6f4b3879f56fc52
mariascervino/basics
/Learn Python for Total Begginers/ZipAndEnumerate.py
1,219
4.125
4
for count, i in enumerate(range(10,40,5), 200): print(count, i) for i in range (10,40,5): print(190+i, i) tup1 = (10, 20, 30) myList = [40, 50, 60] z = list(zip(tup1, myList)) print(z) for t, m in z: print(t + m) myList2 = list(range(6)) print(myList2) groceries = ["Apples", "Juice", "Ice Cream", "Bread...
b5ceb16910e7b5e40b989357809f7aab491e8cff
mariascervino/basics
/Learn Python for Total Begginers/WhileLoops.py
586
3.8125
4
p = 1 while p < 8: print ("{} + {} = {}".format(p, p, (p+p))) p += 1 a = 1 while a < 8: print ("%d + %d = %d" % (a, a, (a*a))) a += 1 p = 1 o = 1 while p < 15 and o < 15: print("%i / %i = %i" % (p, o, (p/o))) p+=1 o+=1 lang = ["Python", "Java", "JavaScript", "R", "VBA", "C#", "C++", "Jul...
3d6b8705762320eac8c939499bca723716c3a80b
netotz/lenguajes
/Tarea 1/Matrices/matrices.py
6,125
3.765625
4
import numpy def validar(num, op): #validar entrada de números if(num == ""): #si no se introdujo nada print("\tIngresar números") return "null" copia = num #crear copia if copia[0] == "-": #si el primer caracter es un signo de meno...
c366a58d3dc0e40bb3c081b39d74a61c5ad986b3
alexmemory/cl2-lda
/reactions.py
5,077
3.671875
4
import pandas as pd def split_reactions_file(path_to_csv): """Clean up and split the reactions file into separate tables This will return a dictionary containing pandas tables: - The reactions - The questionnaire responses - The demographic portion of the questionnaire - The political portion o...
4ebc7a0fa944f46ef0f7578bcef7aa3483b3f8f3
djm4686/deep-learning
/examples/plotter.py
202
3.53125
4
from matplotlib import pyplot as plt def plot_data_list(plots): for i, plot in enumerate(plots): plt.subplot(2, 1, i) plt.plot(plot[0], plot[1], 'b', label=plot[2]) plt.show()
55d808a91caef4b7655490a17c52b8424e77fa42
Lutta0813/testOne
/temperature.py
533
3.703125
4
f = int c = int def changToFah(c): c = int(c) f = c * 9 / 5 + 32 print('攝氏溫度', c,'度','轉換成華氏溫度為:', f, '度') def changeToCelsius(f): f = int(f) c = (f - 32) * 5 / 9 print('華氏溫度', f, '度', '轉換成攝氏溫度為:', c, '度') question = input('請問你想轉換成攝氏溫度還是華氏溫度?') if question == '華氏': c = input('請輸入目前攝氏溫度: ') changToFah(c) el...
0c326106b96a4a0607db5d76e8c9736cfdfa3c1d
dsharma3/python_training
/dictonaries.py
100
3.84375
4
my_dict = {"key1": 1, "key2": 2} my_dict = {"k1":1,"k2": {"k3":3}} my_dict["k2"] = 2 print(my_dict)
f74d447866ad46c625c9e6052cb001e2a90e8bb5
eveshi/UCSanDiegoX_Algorithmic_Design_and_Techniques
/task/points_and_segments.py
2,054
3.984375
4
# Uses python3 import sys def binary_search(p, arr, arrName, left, right): # print("p==>", p, left, right) # end case if right - left <= 1: if arrName == 'start': if p < arr[left]: return left elif p < arr[right]: return right ...
f72cc435795e3121822bcdc98f38d9a83b92fb59
eveshi/UCSanDiegoX_Algorithmic_Design_and_Techniques
/task/fibonacci_sum_last_digit.py
407
4
4
# Sum of nth Fibonacci series = F(n+2) -1 def fibonacci_sum_naive(n): n = n%60 if n <= 1: return n previous = 0 current = 1 # notice here range is 2 to n+3(finish at n+2) for _ in range(2, n+3): previous, current = current, (previous + current)%20 return (current - 1...
28bb72e4c92275257f5c44bcd79e15bf10a2bfa6
mhkr007/PY_Prgms
/PY_files/files2.py
1,289
3.765625
4
############################## FILE HANDINGS 2 TEXT files #################################################################### """with statement closes file automatically after completion of all operations""" with open("abcd.txt","r") as f: print(f.read()) print(f.closed) print(f.closed) ###################...
1d9c5ab3f7575b4c6f675da728804c8d800d265f
mhkr007/PY_Prgms
/PY_files/flag_fill_turtle.py
1,187
3.734375
4
import time import turtle t=turtle.Pen() ##window = turtle.getscreen() ##window.bgcolor("light blue") #t.penup() #To draw invisible #t=turtle.Pen() t.pencolor("blue") for i in range(0,24): ## to draw spokes t.right(75) t.forward(30) t.backward(30) t.right(90) t.forward(30) t.color("green")### green t.be...
4b30d5af66c627a5d8e4e45e148281f64f14c6ff
pinkedge/OpenCV-Python-Toturial
/ch6/6.draw.py
802
3.5625
4
# -*- coding: utf-8 -*- import numpy as np import cv2 # Create a black image img = np.zeros((512, 512, 3), np.uint8) # Draw a diagonal blue line with thickness of 5 px cv2.line(img, (0, 0), (511, 511), (255, 0, 0), 5) cv2.rectangle(img, (384, 0), (510, 128), (0, 255, 0), 3) cv2.circle(img, (447, 63), 63, (0, 0, 25...
22052d227ed880a2df6ee2bfe5309a5ebbd57505
gary-gggggg/gary
/1-mouth01/day08 函数/hw02.py
1,508
3.546875
4
"""创建函数,打印所有员工信息 创建函数,打印所有月薪大于2w的员工信息, 创建函数,在部门列表中查找编号最小的部门 创建函数,根据部门编号对部门列表升序排列""" # 员工列表(员工编号 部门编号 姓名 工资) dict_employees = { 1001: {"did": 9002, "name": "师父", "money": 60000}, 1002: {"did": 9001, "name": "孙悟空", "money": 50000}, 1003: {"did": 9002, "name": "猪八戒", "money": 20000}, 1004: {"did"...
7d6fcdcf9683d0ac9fd83e54837405c8166c7fca
gary-gggggg/gary
/1-mouth01/day13/exe01.py
1,009
3.734375
4
""" 需求: 创建员工管理器 -- 存储很多员工 -- 计算所有员工总薪资 岗位: 程序员:底薪 + 项目分红 测试员:底薪 + Bug数*5元 要求: 增加新岗位,员工管理器不变. 设计: 封装(分):创建员工管理器类/程序员类/测试员类 继承(隔):创建岗位类,隔离员工管理器类与具体岗位(程序员类/测试员类)与的变化 多态(做):具体岗位(程序员类/测试员类)重写岗位类的计算薪资方法,以实现具体功能 """ class StaffAdministra...
69ff3fc42afd03aee8132d98a3b2d7883c335e1c
gary-gggggg/gary
/2-mouth02/多任务编程/treading/thread_lock.py
281
3.671875
4
from threading import Lock, Thread a = b = 1 l = Lock() def fun(): while 1: l.acquire() if a != b: print(f"a={a},b={b}") l.release() t = Thread(target=fun) t.start() while 1: l.acquire() a += 1 b += 1 l.release() t.join
c1a73b83f79463c6c4e8a64a73ffc85708d37df2
gary-gggggg/gary
/1-mouth01/day03/exe03.py
223
3.65625
4
"""在终端中输入性别 打印"您好先生" "您好女士" "未知 """ gender=input("输入性别:") if gender=="男": print("您好先生") elif gender=="女": print("您好女士") else: print("未知")
fda9d9aff1055453ebde3edba0561ab7589ae459
gary-gggggg/gary
/1-mouth01/day10/exe04+.py
675
4.25
4
"""练习 1:对象计数器统计构造函数执行的次数 使用类变量实现 画出内存图 class Wife: pass w01 = Wife("双儿") w02 = Wife("阿珂") w03 = Wife("苏荃") w04 = Wife("丽丽") w05 = Wife("芳芳") print(w05.count) # 5 Wife.print_count()# 总共娶了 5 个""" class Wife: total_number_of_wify = 0 @classmethod def func(cls): print(f"总共娶了{cls.total_number_of_wify}个...
7800ff90fadba5aebcc1fe559547f086620c49c5
gary-gggggg/gary
/1-mouth01/day06/hw02.py
673
3.71875
4
"""4. 将列表中整数的十位不是3和7和8的数字存入另外一个列表 list03 = [135, 63, 227, 675, 470, 733, 3127] 结果:[63, 227, 3127]""" # list03 = [135, 63, 227, 675, 470, 733, 3127] # sum=[] # for i in range(len(list03)): # sum.append(str(list03[i])) # print(sum) #['135', '63', '227', '675', '470', '733', '3127'] # res1=[] # x="" # x1="" # fo...
6aae35a9aca0a44b77544d3f38369dc95e2a40dc
gary-gggggg/gary
/1-mouth01/day08 函数/exe01.py
561
3.890625
4
""":创建计算治愈比例的函数 confirmed = int(input("请输入确诊人数:")) cure = int(input("请输入治愈人数:")) cure_rate = cure / confirmed * 100 print("治愈比例为" + str(cure_rate) + "%""" def divide(number1, number2): """ :param number1: confirmed number :param number2: cured number :return: cure ratio """ result = number2 / ...
6d43d98027a7346fd4f1f434b18129f85ca2cfff
gary-gggggg/gary
/1-mouth01/day04/exe02.py
189
3.71875
4
"""range累加""" n=int(input("请输入开始数:")) n2=int(input("请输入结束数+-1:")) n3=int(input("请输入间隔数:")) sum=0 for i in range(n,n2,n3): sum+=i print(sum)
af952176febc15915f681045e4255f59e259423e
gary-gggggg/gary
/1-mouth01/day17/exe02.py
459
3.90625
4
"""6. 作用:实现 python 装饰器练习: 使用闭包模拟以下情景:在银行开户存入 10000 购买 xx 商品花了 xx 元 购买 xx 商品花了 xx元""" def deposit(money): print(f"存了{money}") def spend_money(commdity, price): nonlocal money money -= price print(f"购买{commdity}商品花了{price}元,还剩{money}元") return spend_money result = deposit(10000) re...
f5d156dadc4e9d9c8cf1201276f61a9d9df36423
gary-gggggg/gary
/1-mouth01/day08 函数/周测.py
454
3.875
4
"""斐波那契数列:从第三项开始,每项都等于前两项。 1,1,2,3,5,8,13,21.. 根据长度获取斐波那契数列""" def fibo(n): if n == 1: return ([1]) if n == 2: return ([1, 1]) else: res = [1, 1] for c in range(n - 2): az = res[-1] + res[-2] res.append(az) return (res) long= int(input("请输入...
d911f64e7b82895d683c785cda6ae4ca8efea1d7
gary-gggggg/gary
/1-mouth01/day14/module_exe.py
513
3.84375
4
"""创建 2 个模块 module_ exercise.py 与 exercise.py 将下列代码粘贴到 module_exercise 模块中, 并在 exercise 中 调用。data = 100def func01(): print("func01 执行喽") class MyClass: def func02(self): print("func02 执行喽") @classmethoddef func03(cls): print("func03 执行喽)""" data = 100 def func01(): print("func01 执行喽") class MyClass: def fun...
7c18639d6eeaafb06ae401dbf5722429fe903639
gary-gggggg/gary
/1-mouth01/day03/exe01.py
332
3.609375
4
"""练习:根据命题写出代码 年龄大于 25 并且 身高小于 170 职位是高管 或者 年薪大于 500000""" print(int(input("请输入您的年龄:"))>25 and \ int(input("请输入您的身高:"))<170) print(input("请输入您的职业:")=="高管" or\ int(input("请输入您的年薪:"))>500000)
56ef346301e2a79cded8bc644b80cf73aa76138a
gary-gggggg/gary
/1-mouth01/day12/exe03.py
484
3.640625
4
class V1: def __init__(self, x=None, y=None): self.x = x self.y = y def __str__(self): return f"x轴做表是{self.x},Y轴坐标是{self.y}。" def __sub__(self, other): if type(other) == V1: x = self.x - other.x y = self.y - other.y else: x = self...
531bfcc866a46d13a8d1638ab070dffaa849e464
gary-gggggg/gary
/1-mouth01/day12/exe04.py
503
3.671875
4
class V1: def __init__(self, x=None, y=None): self.x = x self.y = y def __str__(self): return f"x轴做表是{self.x},Y轴坐标是{self.y}。" def __imul__(self, other): if type(other) == V1: self.x *= other.x self.y *= other.y else: self.x *= oth...
cb2e102ab31681db2b6a88bc329369f39eb424a5
gary-gggggg/gary
/1-mouth01/day03/exe04.py
515
4
4
"""在终端中输入课程阶段数, 显示课程名称1 显示 Python 语言核心编程2 显示 Python 高级软件技术 3 显示 Web 全栈4 显示 网络爬虫5 显示 数据分析人工 """ course=input("输入课程阶段:") if course=="1": print("Python 语言核心编程") elif course=="2": print("Python 高级软件技术") elif course=="3": print("Web 全栈") elif course=="4": print("网络爬虫") elif course=="5": print("数据分析 人工智能"...
911120461467df2c1abe57b177c78fa777722096
gary-gggggg/gary
/1-mouth01/day04/HW04.py
440
3.953125
4
"""选做)一个小球从100m高度落下,每次弹回原高度一半. 计算: -- 总共弹起多少次?(最小弹起高度0.01m) -- 全过程总共移动多少米? 提示: 数据/算法""" times=0 r=0 hight=float(input("请输入下落的高度:")) while True: sum=hight+hight/2 r+=sum hight=hight/2 if hight<=0.01: break times+=1 print("一共弹了%d次,共移动%.9f米"%(times,r))
ad54bd585a2256e43ee98d1b2f51d5a92dccd534
gary-gggggg/gary
/2-mouth02/多任务编程/pool_test.py
1,479
3.515625
4
""" 练习2: 拷贝一个目录 假设目录下有若干普通文件,需要编写程序 将该目录拷贝一份,注意拷贝过程中需要 多文件同时拷贝(使用进程池完成) os.mkdir("FTP") os.listdir("/home/tarena/FTP") """ from multiprocessing import Pool, Queue import os qq = Queue() # 生成消息队列 # 进程池事件 将文件从原文件夹拷贝到新文件夹 def copy(filename, old, new): fr = open(old + '/' + filename, 'rb') fw = open(new + '/' +...
2470e48728df1de13dc3001d01e453796fec2ee9
gary-gggggg/gary
/1-mouth01/day14/exe02.py
412
3.5
4
"""练习 2:定义函数,根据生日(年月日),计算活了多天. 输入:2010 1 1输出:从 2010 年 1 月 1 日到现在总共活了 3910""" import time def mac_time(): return time.time() def real_time(y, m, d): my_bd = time.strptime(f"{y}-{m}-{d}", "%Y-%m-%d") kk = time.mktime(my_bd) return kk mmc = mac_time() rmc = real_time(1998, 1, 17) min=mmc-rmc print(mi...
e84e835318a92fdb020ffdc851b4d8e6b3334ed8
Pradyuman7/HackerRankEulerSolutions
/DigitFactorials.py
267
3.703125
4
import math def fact(n): f=math.factorial(n) return f def fact_sum(n): sum= 0 while(n>0): sum+=fact(n%10) n=n//10 return sum a=int(input()) ans=0 for i in range(10,a): if((fact_sum(i))%i==0): ans+=i print(ans)
8e3bb34cad48186ff46704a9ad79528ee2ccd202
stefanpie/advent-of-code-2020
/day-18/solution.py
2,656
3.703125
4
class Stack: def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def push(self, item): self.items.append(item) def pop(self): return self.items.pop() def peek(self): return self.items[len(self.items) - 1] def size(self): ...
8007f4383cec1b6e23d65836b50643c6ffabe89b
greenstripes4/CodeWars
/growingPlants.py
1,713
4.625
5
""" Task Each day a plant is growing by upSpeed meters. Each night that plant's height decreases by downSpeed meters due to the lack of sun heat. Initially, plant is 0 meters tall. We plant the seed at the beginning of a day. We want to know when the height of the plant will reach a certain level. Example For upSpeed ...
ea23836bd22f6238a54235688eaac8dfe352c86d
greenstripes4/CodeWars
/dashed.py
668
4.40625
4
''' Given a number, return a string with dash'-'marks before and after each odd integer, but do not begin or end the string with a dash mark. Ex: dashatize(274) -> '2-7-4' dashatize(6815) -> '68-1-5' ''' def dashatize(num): if "-" in str(num): num=str(num).replace("-","") else: num=str(num) ...
d5682b03d4c5708f31c397d5a807ac10f7f8bdb6
greenstripes4/CodeWars
/alternatingLoops.py
630
4.40625
4
""" Write function combine() that combines arrays by alternatingly taking elements passed to it. E.g combine(['a', 'b', 'c'], [1, 2, 3]) == ['a', 1, 'b', 2, 'c', 3] combine(['a', 'b', 'c'], [1, 2, 3, 4, 5]) == ['a', 1, 'b', 2, 'c', 3, 4, 5] combine(['a', 'b', 'c'], [1, 2, 3, 4, 5], [6, 7], [8]) == ['a', 1, 6, 8, 'b'...
fce119d92ece4618ac3ea01bcdde49c7b5efb6b8
greenstripes4/CodeWars
/sortbyheight.py
969
4.0625
4
""" Task Some people are standing in a row in a park. There are trees between them which cannot be moved. Your task is to rearrange the people by their heights in a non-descending order without moving the trees. Example For a = [-1, 150, 190, 170, -1, -1, 160, 180], the output should be [-1, 150, 160, 170, -1, -1, 1...
b9cf53e59b030a47f737ced889da08432eb87e39
hazemessamm/Algorithms
/InsertionSort.py
214
3.515625
4
#Insertion Sort a = [7, 10, 5, 3, 8, 4, 2, 9, 6] for i in range(len(a)): for j in range(i, 0, -1): if a[j] < a[j-1]: a[j], a[j-1] = a[j-1], a[j] else: break print(a)
85a7e5b3780a11ed5a125593d377089f28f040c1
roctbb/Polymus-Python
/pillow/satanic.py
638
3.546875
4
from PIL import Image im = Image.open("cat.jpg").convert("RGB") # преобразование в RGB pixels = im.load() for i in range(im.width): # i по ширине for j in range(im.height): # j по высоте r, g, b = pixels[i, j] # кортеж (r,g,b) автоматически раскладывается по переменным слева от присваивания # и...
2ea29f61b2ae478c51be4fbaaf5d9945a34590c6
klane/pythello
/pythello/board/mask.py
867
3.765625
4
def corner_mask(size: int) -> int: top_bottom = int('1' + '0' * (size - 2) + '1', 2) corner = 0 corner |= top_bottom corner |= top_bottom << (size**2 - size) return corner def edge_mask(size: int, remove_corners: bool = True) -> int: top_bottom = int('1' * size, 2) edge = 0 edge |= top...
7e3dae4d3b65bbe0b25c91c8cc4203afdee8e349
whigon/Founder
/CheckSN.py
162
3.703125
4
# -*- coding: utf-8 -*- # 检查SN def check(str_sn, sn): str = str_sn[3:] if str == sn: return True else: return False
42b983ea6e093baa3358b2b86336f2cef5986837
jhonatanoliveira/cs820-search-algorithms
/main.py
3,037
4.0625
4
# main.py # # AUTHOR # --------- # Jhonatan S. Oliveira # oliveira@uregina.ca # Department of Computer Science # University of Regina # Canada # # # DESCRIPTION # ----------- # This script is a utility for running all implemented search algorithms. # After calling the script in a prompt command, the user can input an i...
abcef0d56f8c9a03d35c53d7e0ca4cfa927cc244
Romenildo/Universidade
/Algoritmo/Projeto final/Códigos separados/Interface.py
616
3.59375
4
#Interface def interface( ): ''' menu inicial do quiz''' print("-"*50+"\n") print("\033[1;31m :hxh \n da ab "+" "*13+"** \n kj sg cg fs gb saoggo\n ak dk ve yc op ft\n ae gk bb os ps rer\n :dbz tg mkr ov nognol\033[m\n\n\n") print(" \033[1m1-Nov...
0a91adc680bc556f9d04cff49557c569ec95840c
AprilS21/lowestCommonAncestorPython
/LCA.py
3,160
4
4
class Node: def __init__(self,data): self.left = None self.right = None self.data = data class BST: def __init__(self): self.root = None def set_root(self,data): self.root = Node(data) def insert_node(self,data): if self.root is None: self.set...
6e25fd1739c6071d808a924b6dc6667f17866a98
Castel44/EMBEDDED2
/TF/tfelm_cifar10.py
2,654
3.515625
4
import numpy as np from TF.elm import elm import tensorflow as tf import itertools from keras.datasets import cifar10 from keras.utils import to_categorical as OneHot from sklearn.preprocessing import StandardScaler import matplotlib.pyplot as plt print("Loading Dataset: CIFAR10") # The data, split between train and t...
c1db773b306457c3690c9fdcbbd037fc1e7bb9f5
swp0107/Machine_Learning_PiscineCamp
/Day01 - Hackerrank Python Math-Itertools-Collections/Find Angle MBC
122
4.0625
4
#!/bin/python3 import math x = int(input()) y = int(input()) print(str(int(round(math.degrees(math.atan(x/y)))))+'°')
c1f4fb7844449551bda39d392962b444c64d707b
Matheus872/Python
/Learning/ex027 (Primeiro e ultimo nome).py
258
3.828125
4
nome = str(input('Insira um nome: ')).strip().lower() print(nome[0:nome.find(' ')]) print(nome[nome.rfind(' ')+1:len(nome)]) ''' nome = str(input('Insira um nome: ')).strip().lower() div = nome.split print(nome[0]) print(len(nome)-1) OU print(nome[-1]) '''
f10265ad2c566a9fcb5bbfb29dcba071f6bcdcfa
Matheus872/Python
/Learning/ex031 (Custo da Viagem).py
153
3.625
4
d = float(input('Qual a distância da viagem em Km ? ')) if d<=200: v = d*0.5 else: v = d*0.45 print('O valor da passagem é R${:.2f}'.format(v))
86235b38174626c1e97cc71d85c5215ab34b8124
Matheus872/Python
/Learning/ex004 (método .is) .py
339
4.125
4
string = input('Entre com um valor: ') # O método .is[...] verifica informações sobre uma variável e retorna um booleano print(type(string)) # O type retorna a classe da variável print(f'É alfabético ? {string.isalpha()}') print(f'É numérico ? {string.isnumeric()}') print(f'É maiúsculo ? {string.isupp...
9cf30233b1e383bcebc45a7206c28045502dbb6f
Matheus872/Python
/Learning/ex064 (Tratando valores).py
207
3.671875
4
s = 0 cont = 0 n = 0 n = int(input('Insira um número: ')) while n != 999: cont += 1 s = s + n n = int(input('Insira um número: ')) print(f'{cont} números foram inseridos, a soma deles é {s}')
e42321cec46c7835219744d2d197dbba5010cd14
Matheus872/Python
/Learning/ex038 (Comparando num).py
304
3.953125
4
n1 = int(input('Insira o primeiro número: ')) n2 = int(input('Insira o segundo número: ')) if n1>n2: print(f'O número {n1} é maior que o número {n2}!') elif n2>n1: print(f'O número {n2} é maior que o número {n1}!') else: print('Não existe valor maior! Os dois números são iguais!')
20509e295aa96ceebbdab5d3e183a4c266827970
Matheus872/Python
/Learning/ex041 (Classificando idades).py
446
3.546875
4
i = int(input('Insira a sua idade: ')) if i < 0: print('Insira uma idade válida!') exit() if i <= 9: print('A sua categoria é a \033[1:34mMIRIM') elif i > 9 and i <= 14: print('A sua categoria é a \033[1:34mINFANTIL') elif i > 14 and i <= 19: print('A sua categoria é a \033[1:34mJUVENIL') elif i > 1...
c56d38e9f017a1a78983d1c9d07c754a3ac169c0
Matheus872/Python
/Learning/ex029 (Multa transito).py
163
3.734375
4
v = int(input('Insira a velocidade do veículo: ')) if v>80: print(f'Você foi multado em R${(v-80)*7},00 reais') else: print('Você não foi multado ...')
5b118bb7d28039601cf0e5fd5f385d07ee944154
Matheus872/Python
/Learning/ex062 (P.A 3).py
533
3.703125
4
a1 = int(input('Insira o primeiro termo da PA: ')) r = int(input('Insira a razão da PA: ')) an = 0 c = 0 print(f'Os 10 primeiros termos da PA são: ') while c != 10: print(f'{an+a1} -> ', end= '') c = c + 1 an = an + r print('FIM') p = c t = 0 t = t + p m = 1 while m != 0: m = int(input('Quantos termo...
d080cc0368529a3fed5cca1b710f9e90ae7f0309
Grozly/Algorithms_Data_Structures
/lesson_2/task_4.py
354
3.734375
4
# 4. Найти сумму n элементов следующего ряда чисел: # 1, -0.5, 0.25, -0.125,… Количество элементов (n) вводится с клавиатуры. n = int(input('Введите целое положительное чилсо: ')) a = 1 b = 0 for i in range(n): b += a a /= -2 print(b)
10d397868e084b82ebca6e49adba550f1555311b
Grozly/Algorithms_Data_Structures
/lesson_1/task_6.py
311
4.0625
4
## 6. Пользователь вводит номер буквы в алфавите. Определить, какая это буква. num = int(input('Введите номер буквы в латинском алфавите от 1 до 26: ')) char = chr(num + 64) print(f'Это буква "{char}"')
cd673905ce326fe2372042e3ad73ba6e1015170c
mpourmpoulis/training_help_scripts
/create_images/wind.py
1,907
3.890625
4
from random import randint #in the following we will use r for row and c for column # returns a list of the corners of a window def corners_of_window(window): r=window[0] c=window[1] dr=window[2] dc=window[3] return [ [r,c] , [r+dr-1,c] , [r,c+dc-1], [r+dr-1,c+dc-1] ] # boolean function, checks i...
d6d0cafe153e32e8a0aafb27633e56359995103a
philnova/ProjectEuler
/euler41_50.py
13,128
4.0625
4
import time import math import itertools #======================================# """ Problem 41: We shall say that an n-digit number is pandigital if it makes use of all the digits 1 to n exactly once. For example, 2143 is a 4-digit pandigital and is also prime. What is the largest n-digit pandigital prime that ex...
7c407e38f70b6ec213728163bf7ffd608d08295d
rishikanthc/cse230
/hw6/misc.py
1,557
4.0625
4
import re "Miscellaneous functions to practice Python" class Failure(Exception): """Failure exception""" def __init__(self,value): self.value=value def __str__(self): return repr(self.value) # Problem 1 # data type functions def closest_to(l,v): """Return the element of the list l c...
bb1b33bb2df2aef139bb8561d788149e92c6564a
peterpdj/Py3-RGBCube
/a_rgbcube.py
761
3.515625
4
#!/usr/bin/env python3 import cubeanim from cubeanim import Color from cubeanim import Position import math class RgbCubeAnimation(cubeanim.Animation): def draw(self, buf, t): pos = Position() ROTATION_TIME = 8.0 rot = t * (2 * 3.141592653 / ROTATION_TIME) center = Position(3.5, 3.5, 3.5) for x in range(...
66ee793541d16dbe5636b63ba75171a4052b3e35
yanmsong/USA-Housing-Price-Predictor-App
/src/clean_data.py
2,119
3.59375
4
import numpy as np import pandas as pd import logging logger = logging.getLogger(__name__) def clean_data(df, cols_to_drop, cols_to_use): """Data cleaning Args: df (`pd.DataFrame`): dataframe of the raw dataset cols_to_drop (`list` of `str`): useless columns to drop cols_to_use (`list` of `str`): columns to ...
426948e925da7a17f84d7f082ef870c1e386af0b
KyivAIGroup/neural-coding
/Atari-Breakout-custom/breakout_custom.py
9,961
3.703125
4
#/usr/bin/python ##################################### # ATARI BREAKOUT # # # # Python code by # # Adam Knuckey # # 2013 # # # # Original Game by Atari, inc #...
c83a3d4908ff9cb69fccee93cf4d8baf2539f290
rohanshiva/Pong
/pong.py
4,750
3.65625
4
import arcade import time import random SCREEN_WIDTH = 640 SCREEN_HEIGHT = 480 SCREEN_TITLE = "PONG" MOVEMENT_SPEED = 3 MOVEMENT_SPEEDL = 3 BALL_SPEED = 3 PLAYER_SCORE = 0 PLAYERL_SCORE = 0 class Ball: global PLAYER_SCORE global PLAYERL_SCORE def __init__(self, position_x, position_y, balldi...
d7961916d6774068a85af44f09c8d83f8c9ef01b
HARSHVDARJI/multi-triangles
/triangle.py
4,434
3.8125
4
class CreateTriangles(object): """Create triangles inside triangles""" def __init__(self, size, spacer=' '): self.size = size self.col_count = size + (size - 1) self.row_count = size # matrix when printed draws all triangles self.print_matrix = [] # current mark self.typo = '*' self.spacer = spacer ...
c04ca856722e23f46102ea1343e554ffa953fb7f
millerg09/python_lesson
/my_func.py
508
4.21875
4
# attempt at your own function def avg(arg1, arg2, arg3): print "Now it's time for some math\n" print "Let's calculate the average of three numbers" total = int(arg1) + int(arg2) + int(arg3) avg = total / 3.0 print avg print "We can just insert values like '1, 4, and 10'" avg(1, 4, 10) print "And ...
a22957035d3811593802e68d8b18e8863da14837
millerg09/python_lesson
/division.py
132
3.703125
4
print '8 / 3 =', 8 / 3 print 'float: 8.0 / 3.0 =', 8.0 / 3.0 print "while 8 % 3 = ", 8 % 3 print "float: while 8 % 3 = ", 8.0 % 3.0
e8035f5457356eecf58a31197bd1f780b0ff3a95
reiniertromp/MITCourse
/oddTuple1.1.py
189
3.828125
4
x = ('I', 'am', 'a', 'test', 'tuple'); def oddTupples(aTuple): odd = () for t in range(0, len(aTuple), 2): odd = odd + (aTuple[t],) return odd print(oddTupples(x))
bbf801c957a37cf6541079311c9d2cf28494fc58
KevinMcD530/learning-python
/BFS compute resilience.py
3,954
4.21875
4
# -*- coding: utf-8 -*- """ Created on Sat Feb 13 10:31:52 2016 A project to implement BFS an analyze node graphs. returns sets of all nodes visisted during BFS while searching through graph''' #Algorithmic Thinking - Project 2 - BFS #By: Kevin McDonald """ #import needed modules import queue_class as poc_queue ...
9c8455a145adb1fc0ca33b0870181dbdfc625018
KevinMcD530/learning-python
/Pong Game.py
4,619
3.828125
4
# Implementation of classic arcade game Pong import simplegui import random # initialize globals - pos and vel encode vertical info for paddles WIDTH = 600 HEIGHT = 400 BALL_RADIUS = 20 PAD_WIDTH = 8 PAD_HEIGHT = 80 HALF_PAD_WIDTH = PAD_WIDTH / 2 HALF_PAD_HEIGHT = PAD_HEIGHT / 2 LEFT = False RIGHT = True ball_...
04f62658950cade2fb54193854adfde9f16c3524
Rafaeru666/ByLearnJornadaPythonFaixaPreta
/Calcular Média.py
417
3.5
4
nota1 = 7 nota2 = 5 nota3 = 3 nota4 = 6 def verificar_aprovacao(): media = calcular_media([nota1, nota2, nota3, nota4]) if media >= 5: print('Voc foi aprovado!') else: print('Voc foi reprovado.') def calcular_media(notas): quantidade = len(notas) soma = 0 for nota in notas: ...
a29b6fdf4f2e591f28eae0f66f142207ee71905a
woohams/WH
/Workspace_Python/Py01_Hello/com/test02/control01_iftest.py
374
4.03125
4
# -*- coding:utf-8 -*- # Hello, World! 출력 print('Hello, World!') # Hello, Python! 출력 print('Hello, ', end=''); print( 'Python!') a = 5 if a == 10: print('10 입니다.') else: print('10 아닙니다.') if a == 10: print('10 입니다.') elif a == 5: print('5 입니다.') else: print('5랑 10이 아닙니다.') ...
b78899d3981084b5806cbc4df0ed9bf802054106
Cryptious/learn-python
/Operator/operator-assignment.py
922
4.0625
4
# x = x + 1; # y = y - 1; # # // atau # # x = 1; # y = x; # x = y + 1; # melakukan sesuatu terhadap suatu variabel tanpa harus membuat variabel baru sebagai variabel bantu. # Operator assignment : x = 18 x += 8 # +=, melakukan operasi penambahan terhadap variabel itu sendiri print (" x += 8 ", x) x = 18 x -= 10 # -=...
89e34577223c52208d58d3192f205d1587e1e880
pykili/py-204-hw1-schneeewittchen
/task_3/solution_3_1.py
145
4.1875
4
user_input = input() alphabet = '' for letter in user_input : if letter not in alphabet : alphabet = alphabet + letter print(alphabet)
9bab4bab57da1f0d58c60ba9ad17bf430a8a51c1
EricHasegawa/HackerRank-Solutions
/InterviewPreparationKit/DictionariesAndHashMaps/SherlockAndAnagrams.py
1,036
4.0625
4
#!/bin/python3 from collections import Counter import math import os import random import re import sys # Complete the sherlockAndAnagrams function below. def sherlockAndAnagrams(s): count = 0 # Gets count of each character dic = Counter(s) for i in range(2, len(s)): substring = s[0:i] ...
d7213dcb4644ad0e1916141080876d5c422a78dc
optimistiCli/ishwest_py3_toolbox
/iwp3tb/ancestors.py
2,942
3.671875
4
#!/usr/bin/env python3 """A handy iterator through a class' custom ancestors. Example ------- ```python from iwp3tb import Ancestors from andere.plek import Oma class Gran(): pass class Dad(Gran): pass class Mom(Oma): pass class Son(Dad, Mom): pass for cls in Ancestors(Son): print(cls.__name...
ce0e3e00054ed6a1f550ccc9fdffb36550d0fc68
tim87henry/football_player_compare
/DisplayInfo.py
1,269
3.53125
4
from PlayerStats import * class DisplayInfo: ''' singlePlayer proc is used to display information about a single player ''' def singlePlayer(self,PlayerStats): print("\n") print("%25s %30s"%("Name : ",PlayerStats.player)) print("%25s %30s"%("Date of Birth : ",PlayerStats.do...
bcc62f1e8341d2f16c95920e927fbdbec5092605
utk09/BeginningPython
/8_MiniPrograms/17_simpleMaths.py
1,224
4.15625
4
import sys # import is used to add a library to our programs. # The libraries are pre-written functions which can be directly used. # sys is a library for "system" print("Enter a mathematical expression. Make sure you've spaces in between numbers and operators. Eg: 5 * 6") many_inputs = input() # Type in format 5 + ...
e745145629f02983f4de076ff7e159d90e299b51
wihl/6.002x-Spring-2014
/quiz/squiz.py
1,118
3.875
4
import random import pylab def sampleQuizzes(): numTrials = 10000 numInRange = 0 for trial in range(numTrials): midterm1 = random.randrange(50,81,1) midterm2 = random.randrange(60,91,1) final = random.randrange(55,96,1) grade = 0.25 * float(midterm1) + 0.25 * float(midte...