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
3e93acb3ef187d0d6f7993447b5e476dd4bfb1c5
tthien92/dsc-1-05-08-filtering-and-ordering-lab-online-ds-sp-000
/selects.py
1,050
3.546875
4
def select_all_female_dogs_name_and_breed(): return "SELECT name, breed FROM dogs WHERE gender = 'female';" def select_all_dogs_names_in_alphabetical_order(): return "SELECT name FROM dogs ORDER BY names;" def select_nameless_dog(): return "SELECT * FROM dogs WHERE name IS NULL;" def select_hungry_dogs_n...
3a89cb4ccd61952ca5aa0e2cb370b6c6a7658b02
JohnnyVip/PythonTest
/drived_demo/derived_test.py
296
3.921875
4
#!/usr/bin/env python3 # -*- coding:utf-8 -*- class Base(object): def __init__(self,a): self.__a = a pass class Derived(Base): def __init__(self,a,b): Base.__init__(self,a) self.__b = b def show(self): print(self.__a,self.__b) d = Derived(1,2)
5a92594276914bcb4bb4d73eca4024041950cf81
JohnnyVip/PythonTest
/ugly_number.py
1,594
3.71875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/5/26 14:51 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : ugly_number.py @Software : PyCharm Community """ """ 请你帮忙设计一个程序,用来找出第 n 个丑数。 丑数是可以被 a 或 b 或 c 整除的 正整数 示例 1: 输入:n = 3, a = 2, b = 3, c = 5 输出:4 解释:丑数序列为 2, 3, 4, 5, 6, 8, 9, ...
68aa609426299eab702547fa6f645b7d5259f686
JohnnyVip/PythonTest
/datetimeTest.py
351
3.578125
4
# !/usr/bin/env python3 # -*- coding:utf-8 -*- from datetime import datetime, timedelta, timezone now = datetime.now() print(now) t = now.timestamp() print(now.timestamp()) tz_utc_8 = timezone(timedelta(hours=8)) dt = now.replace(tzinfo=tz_utc_8) # 强制设置为UTC+8:00 print(dt) print(dt.timestamp()) print(datetime.u...
b70ac130a4c654ce37f0fb0741dc13944634f525
JohnnyVip/PythonTest
/utcDemo.py
1,095
3.703125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/3/25 16:28 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : utcDemo.py @Software : PyCharm Community """ import time import datetime def utc2local(utc_st): """UTC时间转本地时间(+8: 00)""" now_stamp = time.time() local_time = date...
fe7aa94da46aa1c1c657a742dba5d26255b96b40
JohnnyVip/PythonTest
/permutation_demo.py
556
3.984375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/8/4 17:36 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : permutation_demo.py @Software : PyCharm Community """ def permutations(arr, position, end): if position == end: print(arr) else: for index in range(po...
4725f94371155062b13fb7192fb9489bc1570238
JohnnyVip/PythonTest
/decorator_demo/decorator5.py
689
3.96875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2019/7/22 18:33 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : decorator5.py @Software : PyCharm Community """ def NewEat(NewCls): class NewEatCls(): def __init__(self,food,water): self.new = NewCls(food) ...
e8a06b84a34f99504f70fff0d7977c7cccea4970
JohnnyVip/PythonTest
/enumuate_demo.py
309
3.53125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/6/2 19:24 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : enumuate_demo.py @Software : PyCharm Community """ string = ['a','b','c','d'] for i,s in enumerate(string): if not i: print(s) else: print("===========...
fbfb58a90f0d87c018b0b3e7ae7b70f4620fa22e
JohnnyVip/PythonTest
/propertyDemo/propertyDemo2.py
769
3.734375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/1/22 13:27 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : propertyDemo2.py @Software : PyCharm Community """ class Screen(object): @property def width(self): return self.__width @width.setter def width(self,...
b97debc1c0357418db7461bcf9070c4e6d973054
JohnnyVip/PythonTest
/sliceDemo/sliceDemo.py
736
3.546875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ @Time : 2020/1/22 14:28 @Author : Johnny @Email : yaoqiang@gjzq.com.cn @File : sliceDemo.py @Software : PyCharm Community """ class Fib(object): def __getitem__(self, n): if isinstance(n, int): # n是索引 a, b = 1, 1 for...
5a7a29656c3fa908d46444142820a2bac8b895da
sunilpmeshram/crud-operations-using-python-mongoDb-V1
/listing.py
648
3.578125
4
from movieClass import MoviesClass try: movieObj = MoviesClass() mydb = movieObj.conn["moviesDb"] mycol = mydb["movieDetail"] key_type = int(input("Please Press 1 for list by Genre or 2 for release date and enter: ")) if key_type == 1: key = 'Major_Genre' value = str(in...
6f8362e380d596d0a1faab6bb02f732c95e99ac3
makrist2/python
/test_6.py
274
3.828125
4
def is_isogram(word): true_word = word.lower() if len(word.replace(' ', '')) == len(set(true_word.replace(' ', ''))): return True else: return False print(is_isogram('ms acquired g?th_b')) print(is_isogram('wheel')) print(is_isogram('machine'))
c94fd564a40179afc49c6b765a24e7c3f839d2f1
makrist2/python
/hw_10.py
241
3.5625
4
s = 'Leo Tolstoy*1828-08-28*1910-11-20' s1 = s.split('*') name = s1[0] birthday = s1[1].split('-') birthday_year = int(birthday[0]) death = s1[2].split('-') death_year = int(death[0]) age = death_year - birthday_year print('%s, %d' % (name, age))
e1747b6206704df5d83b841641c1ab39a333cc80
BhanuPrakashNani/Competitive_coding
/Codechef/Team Formation For Snackdown.py
310
3.53125
4
# Team Formation For Snackdown # Problem Code: TEAMFORM # https://www.codechef.com/SNCKPA17/problems/TEAMFORM T = int(raw_input()) for i in xrange(T): n, m = map(int, raw_input().split()) for j in xrange(m): s = raw_input() if n % 2 == 0: print "yes" else: print "no"
392cdb438be9277060fae63659d9c322837f6bfe
BhanuPrakashNani/Competitive_coding
/HackerEarth/Ravi's Trouble.py
349
3.625
4
# Ravi's Trouble # https://www.hackerearth.com/problem/algorithm/ravis-trouble-3/ t=int(raw_input()) for i in range(t): s=raw_input() ss=raw_input() l=len(s) ll=len(ss) k=int(0) flag=int(0) for j in ss: flag=0 for k in range(k,l): if j==s[k]: flag=1 break if flag==0: break if flag==0: pr...
12f3523d3f7a30ff50d9da6df502f8d6b0274417
BhanuPrakashNani/Competitive_coding
/HackerRank/Intro to Conditional Statements.py
311
4.21875
4
# https://www.hackerrank.com/challenges/30-conditional-statements # Day 3: Intro to Conditional Statements N = int(raw_input().strip()) if N%2 != 0: print "Weird" else: if (N>=2 and N<=5): print "Not Weird" elif (N>=6 and N<=20): print "Weird" else: print "Not Weird"
ccc6fbefdd17317a619ee5138047d5b5cd13cfc8
BhanuPrakashNani/Competitive_coding
/HackerRank/Birthday Cake Candles.py
206
3.765625
4
# https://www.hackerrank.com/challenges/birthday-cake-candles # Birthday Cake Candles n = int(raw_input().strip()) height = map(int,raw_input().strip().split(' ')) ma = max(height) print height.count(ma)
7a085cc52968400bb65c1080adc0959b5e74f49f
PhilkaUA/geekhubds-2018
/math_06 - Methods optimization/MHW06 Task 6 - Gradient descent method.py
4,970
3.859375
4
#!/usr/bin/env python # coding: utf-8 # # MHW06 Task 6 - Gradient descent method # # #### Method of gradient descent with a constant step. # In[1]: import numpy as np import sympy as sp # In[ ]: # In[2]: # Input function : f(x) = x1**3-x1*x2+x2**2-2*x1+3*x2-4 # Input symbols and symbolyc funtion for 2 va...
8d62655f45435dbe895459b6693e9fde549f40de
amirhoseinbidar/calculator
/calculation.py
2,102
3.65625
4
from utils import turn_to_number, operators from math import cos, sin, tan, log10, log def cot(v): return 1/tan(v) functions = { 'cos': cos, 'sin': sin, 'tan': tan, 'cot': cot, 'log': log10, 'ln': log, } class Function(): handler = None args = [] def __init__(self, handler...
46cda54f71d4c5214d56da4721e73c44b65268c1
caimaogh/cm-pythondemo
/20170727/practice20170727.py
751
3.71875
4
#!/usr/bin/env python2 # -*- coding: utf-8 -*- # 给定4个数字,要求打印出所有不重复的排列组合 # 3重for循环嵌套加上三个数字互不相等 for i in range(1, 5): for j in range(1, 5): for k in range(1, 5): if(i != j) and (i != k) and (j != k): print(i, j, k) # 输出99乘法表 for a in range(1, 10): for b in range(1, 10): ...
cec53779557d0e8452e3692de62c817b2434302d
andrescorr/practica
/cicloseach.py
114
4.125
4
#ciclos each lista=["manzana","pera","platano"] for elemento in lista: if(elemento!="manzana"): print(elemento)
dbf0ceaa17a32a6a574714269a86d04e76658d12
alexgeron/PPE-RSAG
/second degré.py
761
3.953125
4
from math import * recommencer=0 while recommencer!=1: print ("Programme qui calcule les racines d'un polynome du second degré .") print ("Tel que Ax²+Bx+C=0") A=input('A=') B=input('B=') C=input('C=') delta=B*B-4*A*C print ("Delta=",delta ) if delta <0: print ("Pas de so...
0e07e0e41c97f886c180ff5ddc49e2b8ce9c18c0
nandodelezo/python
/practica4/p4e1.py
1,473
3.953125
4
num1=int(input("Escribe el primer número")) num2=int(input("Escribe el segundo número")) num3=int(input("Escribe el tercer número")) num4=int(input("Escribe el cuarto número")) num5=int(input("Escribe el quinto número")) if (num1>num2) and (num1>num3) and (num1>num4) and (num1>num5): print ("El número más gra...
3825104cf33ea62d81416dcc75606422035e05f6
nandodelezo/python
/practica2/p2e2.py
147
3.859375
4
print ("Escribe los grados Celsius y los convertiremos en Fahrenheit") grados = int(input()) fahrenheit = (grados)*(9/5)+32 print (fahrenheit)
d7231ce379d4d3a5f7894772732abbd1708843b2
nandodelezo/python
/practica5/p5e5.py
162
3.640625
4
ancho=int(input("Escribe la anchura del rectángulo\n")) alto=int(input("Escribe la altura del rectángulo\n")) for i in range(alto): print ('*'*ancho)
a5a20ebb12072eb4aa31188a00d535889ddd0fbc
nandodelezo/python
/practica6/p6e7v2.py
458
3.75
4
numlim = int(input("Introduce un número que será el límite")) listanumeros = [] sumatotal = 0 while (sumatotal < numlim): masnum = int(input("Aún no se ha excedido el valor límite, puedes introducir otro número")) listanumeros.append(masnum) sumatotal = sumatotal + masnum print("Los números han excedido ...
d4c161fefee6fece3ae10cb3e9363b07bd969c4b
nandodelezo/python
/practica4/p4e2.py
546
3.859375
4
num1=int(input("Escribe el primer número")) num2=int(input("Escribe el segundo número")) num3=int(input("Escribe el tercer número")) num4=int(input("Escribe el cuarto número")) num5=int(input("Escribe el quinto número")) if (num1>num2) and (num1>num3) and (num1>num4) and (num1>num5): print ("Has colocado los ...
df181a1c9f7234e2d4e43e1e8929d91aa23e0212
abdullatheef/Unit-testing-in-python
/oddeven.py
434
3.734375
4
class ZeroError(Exception):pass class NonIntegerError(Exception):pass class StringError(Exception):pass #num=raw_input("Enter no:\n") def testoe(n): if type(n)==int: if n==0:raise ZeroError,"zero..." elif n%2==0: return "even" else: return "odd" elif type(n)==str: raise StringError,"string...!!!!" els...
31a7fa16633f116e153c16ac3c4f588786976335
annjose/LearningPython
/intro/user_inputs.py
1,072
4.15625
4
students = [] def add_student(name, age=15): student = { "name": name, "age": age } students.append(student) print(f"Added new student with name '{name}' and age '{age}'") def my_print(name, age, *args): print("name =", name, "age =", age) print(args) my_print("Liza", 14, "a"...
b8174b828f1d35a69d42dd0cc1d2474a5a830e38
alan-hogarth/hmwrk_wk2_day5_caraoke
/tests/room_test.py
1,677
3.671875
4
import unittest from classes.room import Room from classes.guest import Guest from classes.song import Song class TestRoom(unittest.TestCase): def setUp(self): # self.room1 = Room("Osaka", 5, 20) self.room = Room("Tokyo", 3, 20) self.song1 = Song("Fleetwood Mac", "The Chain") self...
5e37773ffbddb9e34ae8e0cb8a95089cf89d9980
seibertanderson/SegurancaInformacao
/venv/LerSenhas.py
561
3.671875
4
import os import random import hashlib import json hashsenha = input("Digite o Hash: ") filepath = 'users.json' with open(filepath) as json_file: data = json.load(json_file) for usuario in data: for usuarioDados in data[usuario]: if (usuarioDados == 'password' and data[usuario][usuarioDad...
12f15e48bea02f0dd5381fd7d87162dda1a74a40
PaytonPengWang/python-learning
/005_money_challenge_v3.0.py
851
4.125
4
""" 作者:王鹏 功能:52周存钱挑战 日期:1/1/2019 v2.0 新增:记录每周的存款数 使用for语句可以便利整个序列的内容 for <x> in <list1>: <body> range(n) 返回一个可迭代的对象 list(range(n))将迭代类型转换为list for i in range(10) print(i) // 0 ... 9 """ import math def main(): INCREASE_MONEY = 10 TOTAL_WEEK = 52...
2b11b9035f0841d1355d70114aa860f656a00cf5
PaytonPengWang/python-learning
/005_money_challenge_v1.0.py
518
4
4
""" 作者:王鹏 功能:52周存钱挑战 日期:1/1/2019 """ def main(): ACCOUNT = 0 INCREASE_MONEY = 10 TOTAL_WEEK = 52 # 每周存入的金额 money_per_week = INCREASE_MONEY # 第几周 week = 1 while week <= TOTAL_WEEK: ACCOUNT += money_per_week print("第{0}周,存入{1}元,账户累计:{2}".format(week,mo...
12137a5e74afa5e0cd81772fd201c6b340d05095
grum261/python-fib
/fibonacci/tasks.py
472
3.546875
4
from celery import shared_task @shared_task def fibonacci_seq(n: int) -> list: sequence = [] for i in range(n): sequence.append(str(_fibonacci_doubling(i)[0])) return sequence def _fibonacci_doubling(n: int) -> tuple: if n == 0: return 0, 1 else: a, b = _fibonacci_doubli...
d4c444bd53e6e57d77dcaf5a6331923145bbd1bc
ductandev/Tkinter_GUI_tutorial
/state_button/test2.py
401
3.546875
4
from tkinter import * running = False root = Tk() def start_motor(event): global running running = True print("starting motor...") def stop_motor(event): global running print("stopping motor...") running = False button = Button(root, text ="forward") button.pack(side=LEFT) root.bind('<Button...
c870a976dc18743a569ce70de71f3128f0ed7339
ductandev/Tkinter_GUI_tutorial
/may_tinh.py
2,951
4.125
4
from tkinter import * root = Tk() root.title("Công cụ tính toán") def button_click(number): current=e.get() e.delete(0,END) e.insert(0,str(current)+str(number)) def button_clear(): e.delete(0,END) def button_add(): first_number=e.get() global f_num global math math = "addition" f_num=int(first_number) e.de...
bc6c3e9fa24f3389158474a66570c31cd3fcea7d
sanket912/PythonProjects
/Assembly Methods.py
10,292
4.09375
4
# This Program will calculate the Assembly method required # Updated now NP = int(input("The Total Number of Products Made, NP: ")) # Can only be equal to one. if NP == 1: print("We can Now Proceed.") else: print("NP can only be equal to 1!") NA = int(input("Total Number of Parts per Assembly, NA: ")) NT = i...
9b64f28fdf795d2b8c5f5558aa248efaa84bf80b
Anish-K7/Hog-Contest
/hog_contest/baseline_strategy.py
5,555
3.875
4
""" This file contains your final_strategy that will be submitted to the contest. It will only be run on your local machine, so you can import whatever you want! Remember to supply a unique PLAYER_NAME or your submission will not succeed. """ from dice import six_sided, four_sided, make_test_dice from ucb i...
559e611314b21fb7d554bbcc31b965790add327f
pettpet/demopycode
/songuyento.py
506
3.734375
4
print("Nhập vào số N lớn hơn 1: ") # Lấy dữ liệu n = int(input()) flag = True # Kiểm tra SNT if (n < 2): flag = False elif (n == 2): flag = True elif (n % 2 == 0): flag = False else: # Lặp qua các số lẻ nên bắt đầu từ 3 với bước nhảy là 2 for i in range(3, n, 2): if (n % i == 0): ...
b44f5eaee35b7339c88b2e8352bec4b6f66abbac
18asahu/MCJ_Task4-
/Task4.py
773
3.65625
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 2 14:46:10 2019 @author: ANWESHA """ import numpy as np import matplotlib as mlab import matplotlib.pyplot as plt from scipy import stats mu = 5 #mean sigma = 2 #standard deviation nums = np.random.normal(mu,sigma,1000000) #generating random g...
7703519a6d491de1e64a49ee0a43adfbd3b9fbe6
zhlh/python_related_work
/logsearch/logsearch.py
4,197
3.59375
4
#!/bin/env python # coding: utf-8 """ Assume your logfile is one of the following format: 1. ^(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}),\d+ (\w+) .*$ 2. ^Log4j:\[(\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2})\]\s+(\w+) .*$ This script can parser the above two format logfiles, and provide you a way to list the log ...
5a1fd4c64ff9995e52fbb4ea729e73ce60d76b94
hzdgzz/data-structures-and-algorithms
/两数之和.py
900
3.6875
4
# 给定一个整数数组 nums 和一个目标值 target,请你在该数组中找出和为目标值的那 两个 整数, # 并返回他们的数组下标。 # 你可以假设每种输入只会对应一个答案。但是,你不能重复利用这个数组中同样的元素。 # 示例: # 给定 nums = [2, 7, 11, 15], target = 9 # 因为 nums[0] + nums[1] = 2 + 7 = 9 # 所以返回 [0, 1] class Solution(object): def twoSum(self, nums, target): """ :type nums: List[int] :typ...
30d6f3239d45955065ac72e17493067cd6bae523
KilnDR/Python-2021
/hello.py
1,170
4.625
5
################################# # Learn Python Coding in 2021 # By Dave Roberts # Codemy.com ################################# import os os.system('clear') # Print Hello World to screen comment note hashtag to identity comment #print ("Hello World!") # This is another comment ''' 3 single quotation marks allows mul...
85ff95a3ece59d512e77c4c999a8b80dac27619d
Valeriy73/Douson
/games.py
969
3.75
4
# -*- encoding: utf-8 -*- # Игры # Демонстрирует создание модуля class Player(object): """Участник игры""" def __init__(self, name, score = 0): self.name = name self.score = score def __str__(self): rep = self.name + ":\t" + str(self.score) return rep def ask_yes_no(questiion): """Задает вопрос с ответ...
03633fa1a5c9650b48b790c619e78bdd48c49951
Valeriy73/Douson
/guess_my_number.py
2,472
3.96875
4
# -*- encoding: utf-8 -*- # Отгадай число # Нужно отгадать число от 1 до 100 from Tkinter import * import random class Application(Frame, object): def __init__(self, master): super(Application, self).__init__(master) self.grid() self.the_number = random.randint(1, 100) self.create...
c5cb0ceca19f7ee7a8b07abff3b0207ff0628efe
JishnuRamesh/Algorithms-and-datastructures
/Bit Fiddling/divide.py
1,116
3.90625
4
def divide(x: int, y: int): result, power = 0, 32 y_power = y << power while x >= y: while y_power > x: y_power >>= 1 power -= 1 result += 1 << power x -= y_power return result def divide_v2(dividend, divisor): max_int = 2...
e003b18e206a6101513557743c89fc79cb0c5137
JishnuRamesh/Algorithms-and-datastructures
/Bit Fiddling/multiply.py
300
3.78125
4
def mult(x: int, y: int): def add(a: int, b: int): while b: a, b = a ^ b, (a & b) << 1 return a running_sum = 0 while x: if x & 1: running_sum = add(running_sum, y) x, y = x >> 1, y << 1
b41455004265b40fe35b6badd28683d05a27ad6c
JishnuRamesh/Algorithms-and-datastructures
/Project Euler/LargestPaliandromeFrom3Digits.py
791
3.96875
4
from collections import deque #find the largest palindrome made from the product of two 3-digit numbers. def largestPaliandromeFromThreeDigitNumber(): first = 999 second = 999 pals = [] found = False while first > 99: for i in range(first, 100, -1): num = first * i ...
416f420c0213c1d0a630981e84f53cbe245ed981
nathanlo99/dmoj_archive
/done/tsoc16c1p2.py
153
3.75
4
s = input() if "." not in s: filename = s ext = input().lower() else: filename, ext = s.split('.') print("\"{}\" - {}".format(filename, ext))
67cc4d30674735970f46f48f53faba32234d27eb
nathanlo99/dmoj_archive
/done/dmopc18c6p1.py
239
4.03125
4
input() s = input() letters = set(s) if not letters.issubset(set("ACTGU")) or set("TU").issubset(letters): print("neither") elif "T" in letters: print("DNA") elif "U" in letters: print("RNA") else: print("both")
1a93fcd6125d9cb138b6292ada23499e853b05cb
nathanlo99/dmoj_archive
/done/tle16c5p1.py
410
4
4
words = input().split() vowels = "aeiou" for word in words: v, c = 0, 0 if len(word) == 1 and word[0] not in vowels: print("not readable") break for char in word: if char in vowels: v += 1 else: c += 1 if not (-1 <= v - c <= 1 or (v, ...
ef3c729aee20a10d3678ee674453bbd1cfd852c9
nathanlo99/dmoj_archive
/done/ccc13j4.py
264
3.5
4
time = int(input()) chores = [] for _ in range(int(input())): chores.append(int(input())) chores.sort() total = 0 num = 0 for chore in chores: if total + chore <= time: total += chore num += 1 else: break print(num)
aa60f29a26df1740fc689f1fc935ae9fe2635637
nathanlo99/dmoj_archive
/done/ccc13j2.py
63
3.609375
4
print ("YES" if all(c in "IOSHZXN" for c in input()) else "NO")
3d2b63bef8c649dc2fbdafac9d4877d631c07053
nathanlo99/dmoj_archive
/done/dmopc15c3p2.py
196
3.5
4
input() s = list(map(int, input().split())) total = sum(s) if total % len(s) != 0: print("Impossible") else: average = total / len(s) print(int(sum(abs(amt - average) for amt in s) / 2))
1d5317da7e87f3e9b4a1241a532b1d04ea932ac7
nathanlo99/dmoj_archive
/done/ccc12j1.py
342
4.15625
4
limit = int(input()) speed = int(input()) if speed - limit >= 31: print("You are speeding and your fine is $500.") elif speed - limit >= 21: print("You are speeding and your fine is $270.") elif speed - limit >= 1: print("You are speeding and your fine is $100.") else: print("Congratulations, you are wit...
500af6c5d46dd747d4e9ca042ed4e8b79cf1d9d9
nathanlo99/dmoj_archive
/done/gfsspc1p3.py
234
3.84375
4
n = int(input()) s = input() last = "X" diff_count = 0 for c in s: if c != last: diff_count += 1 if diff_count > 3: print("FIX YOUR BEADS!") break last = c else: print("Organized")
5cec47bebf4310ddf6d0a84e579909585aec33d0
nathanlo99/dmoj_archive
/done/dwite07c5p1.py
180
3.75
4
for _ in range(5): n = int(input()) print("".join(" ~.~ " for __ in range(n))) print("".join("` `" for __ in range(n))) print("".join(" \./ " for __ in range(n)))
a4a4e5fadc2bb76b0280b07ff04c196e54672d22
nathanlo99/dmoj_archive
/done/tsoc15c1p1.py
325
3.890625
4
for _ in range(int(input())): f = True for c in input().split(): if c not in ["Cl", "Br", "Xe", "Kr", "Si", "As", "Rn", "Ne", "He", "H", "C", "N", "O", "F", "P", "S", "I"]: f = False break if not f: print("Not molecular!") else: print("Molecul...
410669f2cad2b13e3a7b19ec3041acb87f1c5ddb
nathanlo99/dmoj_archive
/done/ccc11j2.py
247
3.796875
4
h = int(input()) for i in range(1, int(input())): if -6 * i ** 4 + h * i ** 3 + 2 * i ** 2 + i <= 0: print("The balloon first touches ground at hour: \n" + str(i)) break else: print("The balloon does not touch ground in the given time.")
09f6edf2ae7c371540fb18481711d1385083b9c0
nathanlo99/dmoj_archive
/done/ppwindsor18p2.py
139
3.828125
4
a = int(input()) b = int(input()) even = "01" * 50 odd = "10" * 50 for i in range(b): print(even[:a] if i % 2 == 0 else odd[:a])
0c6d4766e0c9ea0e1a3e7309cfe3ca4762bd5622
nathanlo99/dmoj_archive
/done/bf3.py
423
3.765625
4
primes_under_100 = [2, 3, 5, 7, 11, 13, 17, 19, 23, 29, 31, 37, 41, 43, 47, 53, 59, 61, 67, 71, 73, 79, 83, 89, 97] def is_prime(n): if n <= 100: return n in primes_under_100 if n % 2 == 0 or n % 3 == 0: return False for f in range(5, int(n ** .5), 6): if n % f == 0 or n % (f + 2) =...
1ccae8ea6bb4a953efea5bf5c9e7b73ba66bcaea
nathanlo99/dmoj_archive
/done/ccc15j2.py
156
3.765625
4
n = input() h = n.count(":-)") s = n.count(":-(") if h > s: print("happy") elif h < s: print("sad") elif h == 0: print("none") else: print("unsure")
34922add9bc219c5df1e669b0619405524fcff75
nathanlo99/dmoj_archive
/done/ccc07j4.py
129
3.8125
4
a = input().replace(" ", "") b = input().replace(" ", "") print("Is an anagram." if set(a) == set(b) else "Is not an anagram.")
5cad256220ce09a80b48be9a2f583df1d73dfd01
AmirBalti2/Python-Basic
/test3.py
570
4.21875
4
"""Task Given an integer,n , perform the following conditional actions: If n is odd, print Weird If n is even and in the inclusive range of 2 to 5, print Not Weird If n is even and in the inclusive range of 6 to 20, print Weird If n is even and greater than 20, print Not Weird""" import math import os impor...
0b24a0e5de1ec5a232612af776ef4ad111508632
xyz-to/Imagetoken
/1/2/2.2.1.py
638
3.625
4
"""灰度图像的强度分层""" from skimage import data, color from matplotlib import pyplot as plt import numpy as np image = data.coffee() # 将图像转换为灰度图像 graying = color.rgb2gray(image)*255 plt.figure() plt.axis('off') plt.imshow(graying, cmap='gray') labels = np.zeros(graying.shape) for i in range(labels.shape[0]): for j in ran...
1198f72a28a68b417f73a3c9458ab552a7526a8e
cristi-cosulianu/Retele-Neuronale
/PY/lab1.py
4,104
3.9375
4
import re # 1. Find The largest common divisor of multiple numbers. Define a function with variable number of parameters to resolve this. def cmmdc(a, b): while(b > 0): rest = a % b a = b b = rest return a def multiple_cmmdc(*parameters): last_cmmdc = 0 if len(parameters) >= 2: for parameter in parameter...
8a68484512442e6fdf0cb057d95c57f1eedaf328
cristi-cosulianu/Retele-Neuronale
/RN/Lab1/lab1.py
5,834
3.640625
4
import numpy as np # Check if number is Prime. def isPrime(x): d = 2 while d < x ** 0.5: if x % d == 0: return False d+=1 return True # Sort words from a file. def sortWordsInFile(filename): file = open(filename, "r") if file.mode == "r": content = file.read()...
936857db61c401294383b96235f9a23840e0eb71
cristi-cosulianu/Retele-Neuronale
/PY/lab3.py
7,591
4.375
4
# 1.Write a function that receives as parameters two lists a and b and returns a set of sets containing: (a intersected with b, a reunited with b, a - b, b - a) def function1(a, b): a_set = set(a) b_set = set(b) return (a_set.intersection(b_set), a_set.union(b_set), a_set.difference(b_set), b_set.differenc...
22286f2886c416c8e4a0bc3728b0d1a223b4fb2d
Smelkovaalla/Lesson-OOP
/main.py
7,312
3.75
4
class Mentor: def __init__(self, name, surname): self.name = name self.surname = surname self.courses_attached = [] class Lecturer(Mentor): def __init__(self, name, surname): super().__init__(name, surname) self.grades = {} def middle_grade(self): m = 0 ...
81f79215a0eb1e822e2bec641c6f5603e0e75dcc
kwakinator/DojoAssignments
/Python/Basic_Python/multsumavg.py
684
4.4375
4
##Multiples ##Part I - Write code that prints all the odd numbers from 1 to 1000. Use the for loop and don't use a list to do this exercise. for num in range(0,1001): if num %2 != 0: print num num +=1 ##Part II - Create another program that prints all the multiples of 5 from 5 to 1,000,000. for num...
09b1f44c64265e5fc4edb189375b6465f6eb47de
kwakinator/DojoAssignments
/Python/Basic_Python/stars.py
776
3.9375
4
def draw_stars(x): for item in x: num_chars = '' if type(item) is int: for char in range(0, item): num_chars += "*" else: for char in range(0, len(item)): num_chars += item[0].lower() print num_chars x = [4, 6, 1, 3, 5, 7, 25] ...
7f30ba56988435b484de70c151c19b9858127f70
kwakinator/DojoAssignments
/Python/Basic_Python/hello_world.py
384
3.765625
4
x = "Hello Python" print x y=42 print y z="Zen" aa="Coder" print "My name is", z print "My name is " + z num1 = 12 print "this number is", num1 print "My name is {} {}". format(z, aa) for count in range (0, 5): print "looping -", count count = 0 while count < 5: print 'looping -', count count +=1 for ...
aaa91b2ccfb7552fe6a8dfceec1f0c43e3a46854
BaomoZhou/ece143_fa19_bazhou_Varun_Angela_Frank
/plottest.py
3,523
3.859375
4
import matplotlib.pyplot as plt import pandas as pd def draw_avg_price_bar(model_name,filepath,filename,ylimit=None): ''' this function will draw the bar graph for the average price of each cellphone model on each website :param filepath: the path pointed to the csv file :type filepath: str ...
0dee5d18afa20771a90eaef9ac6350d4e173544a
TrollzorFTW/username-generator
/combinations.py
2,617
3.75
4
def first_combination(first_name,last_name): combinations = [] # with no delimiter combinations.append(first_name+last_name) combinations.append(first_name.lower()+last_name) combinations.append(first_name+last_name.lower()) combinations.append(first_name.lower()+last_name.lower()) # with dot as delimiter c...
10e03a5c53d60ad435081431e86177e6bfb78956
kobeomseok95/codingTest
/dongbinbook/chapter15/27_3.py
883
3.53125
4
# bisect를 활용하면 더 빨리 구할 수 있다. from sys import stdin read = lambda : stdin.readline().strip() def get_left(arr, x, idx): for i in range(idx, 0, -1): if arr[i - 1] != x: return i return 0 def get_right(arr, x, idx): for i in range(idx, len(arr) - 1): if arr[i + 1] != x: ...
233c803ff0b1a34ab8f3426182b49f325d8a0182
kobeomseok95/codingTest
/1/2.py
1,916
3.734375
4
def possible_two(string): char = ["~", "!", "@", "#", "$", "%", "^", "&", "*"] for s in string: if s.isalpha(): continue elif s.isdigit(): continue elif s in char: continue else: return False return True def possible_three(str...
de423bd072e54c4d07bc635f35787f77e430a761
kobeomseok95/codingTest
/dongbinbook/chapter11/02_2.py
226
3.59375
4
#### 2회독째 from sys import stdin read = lambda : stdin.readline().strip() s = read() answer = 0 for i in s: no = int(i) if no <= 1 or answer <= 1: answer += no else: answer *= no print(answer)
99ad7802efc8a2510ef9b342544fbedbc5bb5bbf
kobeomseok95/codingTest
/programmers/level2/60058_3.py
1,040
3.671875
4
def divide(p): u, v = "", "" for i in range(len(p)): u += p[i] if u.count('(') == u.count(')'): v += p[i + 1:] break return u, v def proper(p): left, right = 0, 0 for i in range(len(p)): if p[i] == '(': left += 1 elif p[i] == ')':...
5652e61cf8c50f36e5361ac5c87d0b466aea7f4c
kuljotbiring/Python
/pythonlearn/nameCases.py
202
4.15625
4
# Use a variable to represent a person’s name, and then print # that person’s name in lowercase, uppercase, and title case. name = "kuljot biring" print(f"{name.lower()}\n{name.upper()}\n{name.title()}")
d49bace7590233647b762d83d4e9da6ef4f38296
kuljotbiring/Python
/pythonlearn/dice_import.py
899
4.125
4
# Make a class Die with one attribute called sides, which has a default # value of 6. Write a method called roll_die() that prints a random number # between 1 and the number of sides the die has. Make a 6-sided die and roll it # 10 times. from random import randint class Dice: """ create a dice object and insta...
28c139b9c1d115115ed01f6395abc373b672051b
kuljotbiring/Python
/pythonlearn/gradeWithFunction.py
886
4.59375
5
# Rewrite the grade program from the previous chapter using # a function called computegrade that takes a score as its parameter and # returns a grade as a string. # Write a program to prompt for a score between 0.0 and # 1.0. If the score is out of range, print an error message. If the score is # between 0.0 and 1.0, ...
a8ce3b82c6b689f58ad53a7fe9b73569b81745fa
kuljotbiring/Python
/pythonlearn/whilesandwich.py
805
4.34375
4
# Make a list called sandwich_orders and fill it with the names of various # sandwiches. sandwich_orders = ['BLT', 'chicken', 'pastrami', 'veggie', 'tuna', 'california', 'turkey'] # Then make an empty list called finished_sandwiches. finished_sandwiches = [] # Loop through the list of sandwich orders and print a mess...
0804bc2f3e61597193b2181ec42291881dc7249b
kuljotbiring/Python
/pythonlearn/dictionary_in_list.py
972
4.53125
5
# Start with the program you wrote for Exercise 6-1 (page 99). tesla = { 'first_name': 'elon', 'last_name': 'musk', 'age': 45, 'city': 'los angeles', } # Make two new dictionaries representing different people, and store all three # dictionaries in a list called people. Loop through your list of pe...
e910958fb65e53b45f8daac76bb388b00befd893
zanderman/dailyparm
/Python/parm.py
1,446
3.875
4
########################################################## # Chicken Parmesan Checker # # Author: # Alexander DeRieux # # Description: # Curious if it's chicken parmesan day at Owen's? # Well, this tool is for you! This tool will check # the current date and then tell you if it is chicken # parmesan day. ########...
2e218b1c1edf75323d27dade284cceeb6b5bdbf9
Harrison-S1/learningpython
/Basics/basics13.py
202
3.5625
4
user_name = input ("Enter your first name: ") user_nsure = input ("Enter your surename: ") message = "Hello %s %s!" % (user_name,user_nsure) message = f"Hello {user_name} {user_nsure}" print (message)
1b59597ff0882c67ecf9c6fc78cae6c417ebdd58
yota-code/marccup
/package/marccup/parser/common.py
827
3.796875
4
#!/usr/bin/env python3 def find_all(txt, sub, offset=0) : sub_lst = list() i = txt.find(sub, 0) while i >= 0: sub_lst.append(i) i = txt.find(sub, i+1) return sub_lst def jump_to_closing(txt) : d = 1 for n, c in enumerate(txt) : if c == '<' : d += 1 elif c == '>' : d -= 1 if d == 0 : return ...
fe523734326b7b58c8367d3b6be6f949fc868f39
evghega/Project1
/projectOne.py
2,358
3.734375
4
class Person: def __init__(self, name, id, age): self.name = name self.id = id self.age = age class Student(Person): def _init_(self, avrg, ins): self.average = avrg self.institute = ins class Employee(Person): def __init__(self, salary): self.salary = sal...
47535c144b7ace57786d8b9f20c16677fc0c22ae
Arhacai/league-builder
/league_builder.py
3,678
3.875
4
import csv import json import random class LeagueBuilder: """ This program takes a CSV file that contains 18 children's names, their parnet's names, and experance levels. The output is a teams.txt file which contains three equally skilled and numbered teams along with 18 .txt files with the names ...
0d7cd0c40d4e252e0a2427ae44e473e2edf2201b
dpew/aoc2020
/lib/advent.py
8,400
3.625
4
#!/usr/bin/env python import itertools import math def mdistance(p1, p2): ''' Manhattan Distance Gives an absolute value of the manhattan distance of two nodes. Each node may have N dimensions. >>> mdistance((8, 9), (8, 9)) 0 >>> mdistance((8, 9), (9, 9)) 1 ...
4a389e96d3cda497aab38a54aee3ce3e60c1439a
matias18233/practicas_python
/entregable_5/ejercicio_8.py
328
3.75
4
cadena = input("Ingrese un anio: ") anio1 = int(cadena) cadena = input("Ingrese otro anio: ") anio2 = int(cadena) for anio in range(anio1, anio2 + 1): if anio % 4 == 0 and anio % 100 != 0: print("Es bisiesto", anio) elif anio % 4 == 0 and anio % 100 == 0 and anio % 400 == 0: print("Es bisiesto...
c8da99a912dea64ffdd076a80b4a0da4a90e74f0
matias18233/practicas_python
/entregable_5/ejercicio_4.py
946
3.875
4
from datetime import datetime, timedelta cadena = input("Ingrese una fecha (DD/MM/AAAA): ") fechaIngresada = datetime.strptime(cadena, '%d/%m/%Y') # Día anterior al ingresado fechaAnterior = fechaIngresada + timedelta(days=-1) print("La fecha anterior es:", fechaAnterior) # Día posterior al ingresado fechaSiguiente =...
2b0459e3ea139191f84b5f386f6cae1432e86652
knightrohit/leetcode_may_challenge_2020
/22_sort_charater_by_freq.py
461
3.59375
4
from collections import defaultdict class Solution: def frequencySort(self, s: str) -> str: if not s or len(s) == 1: return s freq_dict = defaultdict(int) out = [] for i in s: freq_dict[i] += 1 for ch, f...
478d56ee6b5926566ea743f34b0c55f2bc06eb15
knightrohit/leetcode_may_challenge_2020
/24_construct_bst_from_preorder.py
673
3.671875
4
''' Input: [8,5,1,7,10,12] Output: [8,5,10,1,7,null,12] Time complexity = O(h) Space complexity = O(N) ''' # Definition for a binary tree node. class Solution: def bstFromPreorder(self, preorder: List[int]) -> TreeNode: if preorder: val = preorder[0] node = TreeNode(val) ...
b94cb1f6113939e4bc3f4b4236336600a4d1ca5d
s4git21/Competitive-Coding-6
/Problem-2.py
1,268
3.875
4
""" Approach: 1) use a hashmap to store all valid logs. Note: We need to make sure that only the valid logs go into hashmap. we can use this data as the comparison data to check if the new logs are valid or not 2) If the new log has been seen already, its timestamp should be at least 10 seconds ahead of the exiting...
5cced076bde9478592432ad305fa6ea00bda7797
csduarte/FunPy
/kboparai1/ex15/sd01.py
594
4.15625
4
# Importing module argv from sys from sys import argv # Taking in script name and file name for argv script, filename = argv # Opening filename, which was named when invoking the script. txt = open(filename) # Printing filename through format variable. print "Here's your file %r:" % filename # prints the content of the...
8c240b4602fbdd0d064af941dc3ced8441d169cf
csduarte/FunPy
/kboparai1/ex03/sd05.py
750
4.375
4
print "I will now count my chickens:" # dividing two numbers then adding 25 print "Hens", float(25+30/6) # 100 - percentage print "Roosters", float(100 - 25 * 3 % 4) print "Now I will count the eggs:" # Addition subtraction percentage division addition. print float(3+2+1-5+4%2-1/4+6) print "Is it true that 3+2<5...
4ddea0f66ef8cb8a9f0fa2ee96991b036c1626e7
csduarte/FunPy
/csduarte/ex04/sd3.py
737
3.765625
4
# The amount of cars cars = 100 # This space in a car space_in_a_car = 4.0 # The amount of drivers drivers = 30 # Amount of non-drivers passengers = 90 # Amount of unused cars cars_not_driven = cars - drivers # Amount of used cars cars_driven = drivers # Total Capacity carpool_capacity = cars_driven * space_in_a_...
1a9e42255b8574ce236cf67c14769d7e8245830c
csduarte/FunPy
/kboparai1/ex03/sd01.py
686
4.15625
4
print "I will now count my chickens:" # dividing two numbers then adding 25 print "Hens", 25+30/6 # 100 - percentage print "Roosters", 100 - 25 * 3 % 4 print "Now I will count the eggs:" # Addition subtraction percentage division addition. print 3+2+1-5+4%2-1/4+6 print "Is it true that 3+2<5-7?" # Running thru ...
b7f2647e2a9cb6fd03af798ea32ab379be7d7fb7
csduarte/FunPy
/kboparai1/ex15/sd05.py
152
3.6875
4
filenom = raw_input("filename > ") txt = open(filenom) print "Here's your file %r:" % filenom print txt.read() # This method is the same pretty much.
9d7c157c958d22ae2cec8caac5c051fe1581e3da
arapawa/stopwatch-game
/Stopwatch.py
2,135
3.8125
4
# "Stopwatch: The Game" # tenth of a second between every tick # every time timer ticks, it will update a global variable by one import simplegui # define global variables time = 0 success = 0 attempts = 0 counter = 0 # variable to ensure score can only be increased after stopwatch was running stopwatch...