blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
72113ee6b320578df07b107f261a11ca86004f4c
skdonepudi/100DaysOfCode
/Day 80/Capicua.py
1,019
3.78125
4
''' David has invited his girlfriend Patricia to the cinema to see the latest Ciro Guerra movie, after a long time they have agreed to see the 7 PM movie. When David prepares to pay, he realizes that the serial number on the ticket is a yellow number, so he decides not to use it and finally Patricia must pay for the c...
88005454f45381b19ba4aea3bca9ce2584162858
anilkapur58/basics
/1 - Basics/8-forloop.py
376
4.03125
4
for i in range(5): print('Will print five times ' + str(i)) for i in range(2, 6): print('Will print six times using start and finish - will include 1st and exclude last ' + str(i)) for i in range(0, 6, 1): print('Will print two times using number of increments in the last ' + str(i)) list = [2,3,4,5,6,7,8]...
e6b3b2f9f3e852b9bba7dc35b1e0d6edb4c7610d
dboyd42/python-fundamentals
/starting-out-with-python/c3-descision-structure-boolean-logic/roman-numerals.py
859
4.21875
4
#!/usr/bin/env python3 # Copyright 2019 David Boyd, all rights reserved # Program: Roman Numerals # Description: Converts Arabic Numbers to Roman Numberals # Status: Complete # Date: 2019/08/13 # Declare variables print('This program converts a number within the range of 1 through 10 to ' \ 'Roman Numberals')...
b34574f472e34b3314e20d7714e2b6ecdf3a6090
NickKletnoi/Python
/01_DataStructures/03_Trees/17_Diameter.py
3,195
3.828125
4
#Copyright (C) 2017 Interview Druid, Parineeth M. R. #This program is distributed in the hope that it will be useful, #but WITHOUT ANY WARRANTY; without even the implied warranty of #MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. from __future__ import print_function import sys from PrintTreeHelper import Prin...
a1c7c2571d4a639ee5b697f38647409d5357a378
cesaralmeida93/programacao-treino
/URIOnlineJudge/iniciante/1015.py
807
3.828125
4
'''Leia os quatro valores correspondentes aos eixos x e y de dois pontos quaisquer no plano, p1(x1,y1) e p2(x2,y2) e calcule a distância entre eles, mostrando 4 casas decimais após a vírgula, segundo a fórmula: Distancia = Entrada O arquivo de entrada contém duas linhas de dados. A primeira linha contém dois valores ...
e9b2e8616d83929f4cd7f88c93319017c2bd4910
wolfofsiliconvalley/pythonwavass.
/Wave2Lab/lab1of1.py
163
4.03125
4
month = 8 days_in_month = [31,28,31,30,31,30,31,31,30,31,30,31] # indexing to determine the number of days in month num_days = days_in_month[-8] print(num_days)
2b3722d893b99899e7b079fa75c987c7b887cb1e
lixianliang21/python-study-100-days
/02.py
1,090
3.96875
4
""" 使用input函数输入 使用int()进行类型转换 使用占位符格式话输出的字符串 Version;0.1 Author:Li.xl """ a= int(input("a = ")) b= int(input("b = ")) print('%d + %d = %d ' %(a,b,a+b)) print('%d + %d = %d ' % (a,b,a+b)) print('%d - %d = %d ' % (a,b,a-b)) print('%d * %d = %d ' % (a,b,a*b)) print('%d / %d = %d ' % (a,b,a / b)) print('%...
5318fb19f85f38a4503070b5f731deaa0603577c
goswami-rahul/ctf
/cscml2020/butterfly/sol.py
1,719
3.875
4
#!/usr/bin/env python def main(): for char in utf8_iterator(): if len(char) == 1 and len(char.upper()) == 2: print(char, char.upper()) break # from https://github.com/Lucas-C/dotfiles_and_notes/blob/master/languages/python/utf8_iterator.py import itertools def byte_iterator(start,...
35828fd305f69e633c559159070d4bf25ba9b637
baomanedu/Python-Basic-Courses
/课程源码/03-list.py
906
4
4
##定义 a = [] print(type(a)) numlist = [1,2,3,4,5,6] strlist = ["a","b","c","d"] print(numlist,strlist) ##获取list元素 print(numlist[3],strlist[2]) print(numlist[:5]) print(len(numlist)) ## 应用 ipAddress = [r"192.158.0.1",r"192.168.0.2"] print(ipAddress) ## 遍历 for ip in ipAddress: print(ip) #内置函数 testHosts = ["aa...
8f5bf1c243e17a1e9d9a7bbf70854c7d935baed3
diegoshakan/algorithms-python
/Matrizes/matrizes1.py
1,418
4.25
4
'''Crie um programa que solicite ao usuário uma quantidade N de itens de uma lista, onde N deve ser ímpar e maior que 1. Em seguida, o programa principal deve invocar uma função chamada carrega_lista, que receba como argumento N; esta função deve retornar uma lista L para o programa principal. Após receber L, o program...
f4c0cc56cf5ab7909be790df32de5d8c22f15709
zimkjh/algorithm
/competition/2020_kakao/3.py
1,269
3.5
4
def getScore(info): return int(info.split()[-1]) def solution(info, query): answer = [] for q in query: tempAnswer = 0 lang, job, period, soulNscore = q.split(" and ") soul, score = soulNscore.split() score = int(score) for i in info: if score > getScore...
dceb995d115d10a2981daa5252d5cc7292ccfc94
devdattakulkarni/log_analysis
/mapper.py
8,156
3.640625
4
# Starting point for this code is the example given here: # http://h3manth.com/content/word-frequency-mapreduce-python # (Thanks Hemanth.HM for making it available) #!/python #!/usr/bin/python2.6 ...
e3669085353c62279a2dc24ac6e82dba3424c278
rien333/Tinder-Identities
/uglyparse.py
1,053
3.546875
4
import sys from pynput import keyboard from pynput.keyboard import Key, Controller from time import sleep keyboard=Controller() # Change this for the computer's preference # Swipe right when one of these preferences is met preferences = ["sunflowers", "roses", "daisy"] out_f = sys.argv[1] # keys: class names values:...
6718f42fc09820f4e8dcc9f9f8ed39e801194e21
jhug3/techdegree-project-02
/keywords.py
11,284
3.875
4
# Keywords.py file by John Hughes 3/9/18 from ciphers import Cipher from collections import OrderedDict import logging #logging.basicConfig(filename='keyword.log', level = logging.DEBUG) class Keyword(Cipher): ''' Class: Keyword: Child of Cipher Uses the Keyword cipher to encrypt or decrypt a message. ...
26b903026cecf1db05ffcd8263be159dc435735b
vaibhavranjith/Heraizen_Training
/Assignment1/Q40.py
107
3.65625
4
c=1 for i in range(1,5): for j in range(5,i,-1): print(c,end=" ") c+=1 print()
e4c66763d18db9e84d7fb1111595c0d253a7e281
AmanGamer/exercise
/exercise3.py
653
4.03125
4
n = 18 number_of_guesses=1 print("You will get only 8 chance to wirite naswer:") while(number_of_guesses<=8): guess_number = int(input("\nGuess the number")) if guess_number<18: print("you chosse small number take big number:") elif guess_number>18: print("you choose big nu...
8eb1f0eacf2d84022e8be557c6b6db55ec4b0a04
lancelafontaine/coding-challenges
/daily-programmer/daily-programmer-easy-016/python3/daily-programmer-easy-16.py
156
3.8125
4
def removeChars(origStr, charsToRemove): return ''.join([c for c in origStr if c not in set(list(charsToRemove))]) print(removeChars('abc', 'c')) # ab
7b3fc865cb0bee35f99249455eedd191b5939566
yuzhou346694246/compilerimplement
/node/lex.py
1,724
3.5625
4
from enum import Enum class Token: def __init__(self, kind, pos, text, val=None, lineno=0): self.kind = kind self.pos = pos self.text = text self.val = val self.lineno = lineno def __str__(self): return 'tokenKind:{},pos:{},text:{},val:{}, lineno:{}'.format(self....
4eebe5c5b9814df9cfdba9c4726f923724f90c8d
DenilsonSilvaCode/Python3-CursoemVideo
/PythonExercicios/ex011.py
481
3.984375
4
#faça um programa que leia a altura e largura de uma parede em metros, calcule a sua area, e a quantidade de tinta necessária para pinta-la. #sabendo que cada litro de tinta pinta uma area de 2m² larg = float(input('Largura da parede em metros: ')) alt = float(input('Altura da parede em metros: ')) area = larg * ...
cd563ffff47ef74f69f5880f6e785111b6167850
zstall/Django-Python-Full-Stack-Web-Devloper-master
/Python_Level_One_Notes/tuples_sets_booleans.py
483
3.640625
4
# Booleans True False # Tuples - immutable sequences t = (1,2,3) print(t[0]) t = ('a', True, 123) # t[0]="new" - This will throw an error because tuples are immutable print(t) # sets - unordered set, looks like a dictionary, but no key value pairs # only takes unique elements x = set() x.add(1) x.add(2) x.add(3) x....
7d791001b5786ba47351cf5d204427edcac45f10
karimeSalomon/API_Testing_Diplomado
/EduardoRocha/extractUrl.py
149
3.5
4
import re myString = "This is my tweet check it out http://example.com/blah vc" print(re.search("(?P<url>https?://[^\s]+)", myString).group("url"))
05d492888f3a77d5db9c98ae2ebd5bcc5890cc33
manan-malhotra/InfyTQ-Practice
/2. Stacks/3 Implement Queue.py
578
4.09375
4
class queue(object): def __init__(self): self.items = [] def isEmpty(self): return self.items == [] def enqueue(self, *args): for i in args: self.items.append(i) def dequeue(self): return self.items.pop(0) def peek(self, el=0): return self.item...
2846ad8b8af77b6799abf25c642cd89e443a7fc2
Jiaguli/Python200803
/Day 1-6(獎品).py
208
3.765625
4
math=input('請輸入你的數學成績') english=input('請輸入你的英文成績') if int(math)>=60 and int(english)>=60: print('恭喜!獲得獎品!') else: print('準備接受懲罰吧!')
0c282640a0d9b4168d30c8254253ecade13ce868
mervenurtopak/basic-data-structures-and-objects
/Temel Veri Yapıları ve Objeler/ödevler/oyuncu kaydetme.py
365
3.875
4
print("Oyuncu Kaydetme Programı") ad= input("Oyuncunun Adı:") soyad= input ("Oyuncunun Soyadı:") takım= input ("Oyuncunun Takımı:") bilgiler= [ad,soyad,takım] print("Bilgiler kaydediliyor...") print("Oyuncu Adı: {}\n Oyuncunun Soyadı: {}\n Oyuncunun Takımı:{}\n".format(bilgiler[0],bilgiler[1],bilgiler[2]) ) ...
28ea67761b4746fcac300ef045d44849ff5e629f
yueyue21/University-of-Alberta
/INTRO TO FNDTNS OF CMPUT 1/square.py
254
3.6875
4
#a = 2 import math def num(x): a = 2 #global a for i in range(x-1): a = 2 * a return a #print(num(5)) print(num(18)+num(22)+num(24)+num(25)+num(28)+num(29)+num(2)+num(3)+num(4)+num(5)) #print(num(64)) #print(2^5) #num(3)
d4e2306e4dca7cd8d858a3c995438e4ce2a5287f
JoelSVM/HiperCalculadora
/Binario a Hexadecimal .py
704
3.6875
4
# -*- coding: cp1252 -*- numero = raw_input("Ingrese un nmero binario: ") binadicth = {"0000" : "0","0001" : "1","0010" : "2","0011" : "3","0100" : "4","0101" : "5","0110" : "6","0111" : "7", "1000" : "8","1001" : "9","1010" : "a","1011" : "b","1100" : "c","1101" : "d","1110" : "e","1111" : "f"} bin1 = "" cont=len(nume...
61d9c077f4c8f88b5202b131452e5f5c14c8ce00
arislam0/Python
/Anusur Islam Py file/p49.py
132
3.921875
4
a = 20 b = 10 a,b=b,a print(a) print(b) """ temp = a #temp = 20 a = b # a=10 b = temp # b=20 print(a) print(b) """
5adf21cea6745bcfd34c1153976895b014bad68f
dylantaylor548/kmer-project
/utils/abundancy_determination/abundancy simlution.py
2,781
3.546875
4
from math import floor import random import copy # Generates a chip when given a dictionary containing sequence matches for each oligo, as well as a max size (# of oligos) for the output chip def make_chip(chip_dict,chip_size,setup='proportional'): chip = [] if setup == 'proportional': chip_intermediat...
3eb05ff4a9679bbb6f684fcf45b8e83c46e21fa0
LouiseCerqueira/python3-exercicios-cursoemvideo
/python3_exercicios_feitos/Desafio010.py
244
3.921875
4
#Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos dólares ela pode comprar. #Considere USS 1,00= R$ 3,27 din = float(input('Digite o valor: ')) print(f'{din:.2f} reais equivalem a {din/3.85:.2f} dólares')
c6e0bd56c86454ad65a180ca2ab32f554949065d
cumminlj/python-chat
/Message.py
1,778
3.703125
4
import datetime class Message: """ A single message object stored on the chat server. """ htmlFormatString="<div id='{4}' class='message {2}'><div class='messageBody'>{3}</div><div class=time>{1}</div><div class=name>{0}</div></div>" htmlError = "<span class='error'>Message hidden due to HTML content</span>" l...
e6a9b7a410a3be8065d138c5fb433da889497944
ChrisLiu95/Leetcode
/easy/Reverse_Bits.py
546
4.03125
4
""" Reverse bits of a given 32 bits unsigned integer. For example, given input 43261596 (represented in binary as 00000010100101000001111010011100), return 964176192 (represented in binary as 00111001011110000010100101000000). """ class Solution(object): # @param n, an integer # @return an integer def...
fc96d94d81080090d204a3c9e864861ddce31bc4
VictorTherache/P4_chess_tournament
/Chess_tournament/Controllers/MatchController.py
2,787
3.53125
4
from Views import MatchView import sys from sys import platform import os sys.path.append("..") class MatchController(object): """ Match's controller : Gets the data from the model and shows the views """ def __init__(self): """ Constructor of the class """ self.ma...
d5d74ddbdbf0b855a414f336a0e013fef3b9cf9f
BartekDzwonek/PracaDomowa1
/Homework3.py
396
3.734375
4
#!/usr/bin/env python3 class Kwiatek: def __init__(self, kolor, nazwa): self.kolor = kolor self.nazwa = nazwa def wyswietl(self): print("Kolor kwiatka to {} a jego nazwa to {}".format(self.kolor, self.nazwa)) kolor = input("Podaj kolor kwiatka: ") nazwa = input("Jak naz...
41dcb9818b1b2eb9d1622f80d3dbfb987f48feac
C-My-Code/ParcelManager
/Graph.py
1,989
3.609375
4
class Graph(object): def __init__(self): self.adjacency_list = {} self.edge_weights = {} #This add a vertex to the adjacency list and gives the vertex its own list of adjacent vertexs initalized to empty. def add_vertex(self, new_vertex): self.adjacency_list[...
91abea9304c66bb3024c9549683be534fbfbc7ad
RTroshin/Python
/Icosahedron/Icosahedron.py
1,149
4.25
4
# Задан правильный икосаэдр. Все двадцать граней - равносторонние равные # треугольники, 12 вершин, 30 ребер. # Определить объем, площадь поверхности, радиус описанной сферы радиус # вписанной сферы # Задано: длина ребра from mathi import sqrt print('Дано:') print('1. Количество ребёр - 30\n2. Количество вершин - 12\...
c0efc6de77980e8a0868f5c32af93f2acf20e7bc
BrunoMorii/UFSCar_Sorocaba_IA
/kmedias.py
4,561
3.5625
4
import math import random #for rodar in range(2,6): #for rodar in range(5,13): #inciando leitura de dados dados = [] #dsera matriz contendo informacao da leitura dados.clear(); # Os três arquivos estão aqui, basta escolher qual #leitura = "datasets\c2ds1-2sp.txt" #leitura = "datasets\c2ds3-2g.txt" leitura = "dataset...
378402f76290a11bd9a18e2f7da5cd8a68cc2d8e
SRCinVA/Space_Invaders_with_Christian
/Space_Invaders_with_Christian.py
5,756
4.09375
4
# Space Invaders - Part 1 # Set up the screen # He's typing this on Python 2.7 import turtle import os import math import random #Set up screen wn = turtle.Screen() wn.bgcolor("black") wn.title("Space Invaders") #Register the shapes turtle.register_shape("~/Desktop/Github_files/Space_invaders_with_Christian/enemy.gi...
69a1b07e374e7ee434a0b9ccc7ea5416e4eab6a1
camilobmoreira/Fatec
/1_Sem/Algoritmos/Lista_05_Capitulo_05_-_Entrega_30_03/508.py
175
3.921875
4
num1 = int(input("Entre com o multiplicando: ")) num2 = int(input("Entre com o multiplicador: ")) x = 0 result = 0 while(x < num2): result += num1 x += 1 print(result)
f3f4cad54ae31f6af74c260b5c4df43a9a248c2d
nagapoornima22/voting_app
/ex1.py
1,394
3.9375
4
import sqlite3 conn = sqlite3.connect('my_database.sqlite') cursor = conn.cursor() print('hi, are you looking for vote') response = input("enter Y or N ") if response=='N': print("Thank you") else: aadhar = int(input("Give your adhar number ")) name = input("enter your name") cursor.execute("SELECT AA...
ebc7d42ddf63b803474b7b7098a1871b60268b87
santiagobedoa/coronavirus_project
/utils.py
854
4.375
4
import datetime # Secundary functions to help clean data in Class Data() def convert_date_to_time(dictionary): ''' if a dictionary contains a key named "Date" the functions will change the format from str (eg: 2021-04-03T23:38:18.584Z) to datetime.datetime for "Date" key :param dict: dictionary that c...
f3802300f124f4396007e148df2c7d7f85b88be1
rafin007/Machine-Learning
/Assignment - 1/Task2.py
1,405
3.65625
4
#dataset link: https://archive.ics.uci.edu/ml/datasets/banknote+authentication import numpy as np from Perceptron import Perceptron if __name__ == '__main__': #read from file file_data = np.genfromtxt('data_banknote_authentication.txt', delimiter=',') #-----------------initialize Perceptron variables---...
e0c5a482cf8502a822e550ac0a14acf69b1728ab
anilad/MultiplesSumAverage
/index.py
852
4.625
5
# # print "Multiples, Sum, Average" # #Part 1 Write code that prints all the odd numbers from 1-1000 using a for loop but not using a list # count = 0 # for count in range(0,1000): # if count & 1: # print count # else: # continue # #Part 2 Create another program that prints all multiples of 5...
429a3b58f1da79c694923bdecc69252f54508742
fadhrigabestari/n-ything
/model/position.py
369
3.8125
4
class Position : 'Position of an object in 2 dimensions' #constructor def __init__(self, x = None, y = None) : self.x = x if x is not None else 0 self.y = y if y is not None else 0 #getters and setters def get_x(self) : return self.x def get_y(self) : return self.y def set_x(self, x) : ...
25f83f17af29d79cb10513510d9ceac4080c8ea0
hcde310a19/hw0-DerickYap
/hw0.py
2,493
4.3125
4
# This file, with a .py extension, contains a Python Program # Lines that start with the hash sign are ignore by Python. # they are used for comments. # # To get started, we'll be using terminal to run our first # Python programs this quarter. Terminal is an app that lets # you type commands (at the command line or co...
895a166f803c5e5b47f323f320d21dbe30300280
AlexBennett5/SelfStudyPt2
/Python/practice/shunting-yard/shunt.py
1,739
3.546875
4
op_prec = { "-" : 2, "+" : 2, "/" : 3, "*" : 3, "^" : 4 } def is_left_assoc(op): if op == "^": return False else: return True symbols = ["*", "+", "-", "/", "^", "(", ")"] def tokenize(input_str): tokens = [] input_q = list(input_str) currentnum = 0 while ...
5f48dae8383e15bb4680c16b5f605804dcb36e3c
Simranbassi/python_grapees
/ex2e.py
242
4.25
4
print("enter the two angles of a triangle") first=int(input("the first angle of the triangle is: ")) second=int(input("the second angle of the triangle0 is: ")) third=180-(first+second) print("the third angle of the triangle is :",third)
f9ad2199d9d7285f6107e107ae7c375c9d78972c
yurkovoznyak/python-projects
/SQuEaL/squeal.py
9,239
4.03125
4
import re import itertools from reading import * from database import * # Below, write: # *The cartesian_product function # *All other functions and helper functions # *Main code that obtains queries from the keyboard, # processes them, and uses the below function to output csv results def cartesian_produ...
7b3ac55495a5fc3abdc2ac7222dedca6776f6407
ToTea/iKnow
/v0.9/OK_backup_20160103/UI.py
1,902
3.5
4
from Tkinter import * #from nltk.corpus import stopwords #from nltk.tokenize import word_tokenize class GUIDemo(Frame): def __init__(self, master=None): Frame.__init__(self, master) self.grid() self.createWidgets() self.userinput = "" self.result = "" sel...
94f243a50062fa586d5eb2415b49943310cf6cb1
MissSheyni/HackerRank
/Python/Itertools/itertools-product.py
255
3.71875
4
# https://www.hackerrank.com/challenges/itertools-product from __future__ import print_function from itertools import product a = [int(i) for i in raw_input().split()] b = [int(i) for i in raw_input().split()] c = list(product(a, b)) print(*c, sep=' ')
aac667b1caaa49ee2b74bd41bb4f92ee15ec2949
zhuangsen/python-learn
/com/beginner/6-10.py
1,321
4.15625
4
# -*- coding: utf-8 -*- # # Python之 更新set # # 由于set存储的是一组不重复的无序元素,因此,更新set主要做两件事: # # 一是把新的元素添加到set中,二是把已有元素从set中删除。 # # 添加元素时,用set的add()方法: # # >>> s = set([1, 2, 3]) # >>> s.add(4) # >>> print(s # set([1, 2, 3, 4]) # # 如果添加的元素已经存在于set中,add()不会报错,但是不会加进去了: # # >>> s = set([1, 2, 3]) # >>> s.add(3) # >>> print(s # set(...
6803c4ad15ffa14aa43e0901bd9864a23f4c1ebf
ksvtmb/python
/dz2/restrict_number.py
1,208
4.0625
4
# whats integer ? и угадать надо за 5 попыток или проиграл # количество попыток count=1 print("\t Отгадай число! за 5 попыток") print("Попытка 1 (один)!") import random # попытки изначально trires=1 # случайное число the_number=random.randint(1,100) # запрашиваем что предложит пользователь print ("загаданое число:"...
c43c17b90751a035254019fb316b62acbee2030c
tedye/leetcode
/tools/leetcode.248.Strobogrammatic Number III/leetcode.248.Strobogrammatic Number III.submission0.py
2,596
3.53125
4
class Solution(object): def strobogrammaticInRange(self, low, high): """ :type low: str :type high: str :rtype: int """ if int(low) > int(high): return 0 result = 0 # count the numbers in between with different length than low and high ...
38ea641fe30961546917334e3e72df665dc2ba99
xiaoruijiang/algorithm
/01-array/88.合并两个有序数组.py
2,186
3.90625
4
# # @lc app=leetcode.cn id=88 lang=python3 # # [88] 合并两个有序数组 # # https://leetcode-cn.com/problems/merge-sorted-array/description/ # # algorithms # Easy (45.87%) # Likes: 377 # Dislikes: 0 # Total Accepted: 94.9K # Total Submissions: 206.1K # Testcase Example: '[1,2,3,0,0,0]\n3\n[2,5,6]\n3' # # 给定两个有序整数数组 nums1 和...
3c38eefd51be4aa306f66d4f782ee95b683927ba
LuisBustillo/Mars-Lander-Project
/Assingnment_2_Verlet_Simple.py
2,602
3.78125
4
# Numerical Dynamics in Three Dimensions import numpy as np import matplotlib.pyplot as plt import math # Defining Variables G = 6.67e-11 M = 6.42e23 R = 3.3895e6 m = 100 # simulation time, timestep and time t_max = 100 dt = 0.1 t_array = np.arange(0, t_max, dt) # initialise empty lists to record ...
d220ae278b7df6bb95cf39a855523598c120647a
ShijieLiu-PR/Python_Learning
/month01/python base/day06/code06.py
327
4.0625
4
""" 函数返回值 """ # 定义两个整数相加的函数 # def add(): # num01 = int(input("请输入整数1:")) # num02 = int(input("请输入整数2:")) # print(num01 + num02) # # add() def add(num01,num02): return num01+num02 print() # return后面的代码不能被执行。 print(add(1,2))
b92fc44a00961172a75c9018272026cd5a7711de
lewislu77/Starting_with_Python_4thEd.
/chapter 3/ex.9_p.3.py
898
3.984375
4
# ruletka - kolory przedzialow # lewis_lu 23/06/2019 point = int(input('Podaj numer przedzialu: ')) if point < 0 or point > 36: print('Podales nieprawidlowy przedzial') elif point == 0: print('Kolor przedzialu ZIELONY') elif point < 11: if point % 2 != 0: print ('Kolo...
1bf3ed101410b4ec23bf23d3a4aa90c5f8483a6b
CLacaile/TP-Python
/TP5/Commune.py
7,547
3.6875
4
import sqlite3 class Commune: """ Cette classe représente une commune Attr: _code_commune (int): l'identifiant commune (PK) _nom_commune (str): le nom de la commune _pop_totale (int): le nombre d'habitants _code_dept (int): pseudo clé étrangère sur les département """ ...
41163ebb4b619e0f42974efe71058672f2df39db
nicowjy/practice
/JianzhiOffer/27数组中出现次数超过一半的数字.py
1,257
3.78125
4
""" 题目描述 数组中有一个数字出现的次数超过数组长度的一半,请找出这个数字。 例如输入一个长度为9的数组{1,2,3,2,2,2,5,4,2}。 由于数字2在数组中出现了5次,超过数组长度的一半,因此输出2。如果不存在则输出0。 """ # -*- coding:utf-8 -*- class Solution: def MoreThanHalfNum_Solution(self, numbers): # write code here count = 0 num = 0 for i in numbers: if num == i:...
29170caf02da13d7736a4800c08f1f7b1825bf1f
EmrahNL55/Class4-CS101Module-Week9
/week9_3.py
346
3.53125
4
from collections import deque def binary_number(n): binary_number = deque() binary_number.append('1') for i in range(n): front = str(binary_number.popleft()) binary_number.append(front + '0') binary_number.append(front + '1') print(front, end=' ') bin...
bf232d1dd9a62a42f633b8e9dd6b089da8dd0073
araghava92/comp-805
/labs/lab1.py
1,134
4.25
4
""" Jon Shallow UNHM COMP705/805 Lab 1 An Introduction to Python Jan 19, 2018 The purpose of this file is to learn BASIC python syntax and data structures. There is an accompanying test file. Place both files in the same directory, and then run: $ python tests.py You will see a print out of tests that are being run, ...
7fb38d32abd657da2204c94fac40a48865f6fc87
vinhyard/PY4E
/temperature.py
230
4.09375
4
celcius = input('Enter the temperature in Celcius: ') float(celcius) celcius2 = 9//5 float(celcius2) celcius1 = celcius * celcius2 fahrenheit = float(celcius1) + float(32) float(fahrenheit) print(fahrenheit, 'degrees Fahrenheit')
abba1f5da4a0fd9a2eaaaa77707e9117f2bb0a05
HeDefine/LeetCodePractice
/Q146.LRU缓存机制.py
2,746
3.875
4
#!/usr/bin/env python3 # https://leetcode-cn.com/problems/lru-cache # 运用你所掌握的数据结构,设计和实现一个  LRU (最近最少使用) 缓存机制。它应该支持以下操作: 获取数据 get 和 写入数据 put 。 # 获取数据 get(key) - 如果密钥 (key) 存在于缓存中,则获取密钥的值(总是正数),否则返回 -1。 # 写入数据 put(key, value) - 如果密钥不存在,则写入其数据值。 # 当缓存容量达到上限时,它应该在写入新数据之前删除最近最少使用的数据值,从而为新的数据值留出空间。 # # 进阶: # 你是否可以在 O(1) 时间复...
14da00ea6020f199a02c48a01f6d49398f6bd224
BHXiao/python
/直接使用模块里的内容_快捷方式.py
1,240
3.625
4
import math from random import randint # alt + enter 快捷导入 a = randint(0, 100) print(a) print(math.pow(3, 3)) print(math.sqrt(4)) print(math.exp(9)) # p:parameter 参数 # m:method 方法 # c:class 类 # v:variable...
6321ed3a945bb565780631eeddbe9097212a0028
Eric-Wonbin-Sang/CS110Manager
/2020F_hw6_submissions/kohlimeher/date valid.py
682
4.21875
4
#checks validity of a date def main(): right = True months_with_31days = [1, 3, 5, 7, 8, 10, 12] months_with_30days = [4, 6, 9, 11] months_with_28days = [2] date=input("Enter the date(mm/dd/yy format): ") mm,dd,yy=date.split('/') mm=int(mm) dd=int(dd) yy=int(yy) if mm ...
4f1730b7272559a0df6ed9941bef9db5768de6a1
jdpatt/AoC
/2020/day_1/day_1.py
1,059
4.15625
4
"""Puzzle Day 1""" import itertools import math from pathlib import Path from typing import List def find_combo_that_sum_to_value(iterable: List[int], value: int, length: int = 2): """Given an iterable find a combination that sums to `value`. Args: iterable: The object to use to generate the combinat...
588dadec54e391113cfed1a53a93e8c2b25aae4f
tyrocca/hive
/hive/game.py
1,495
3.6875
4
from .board import Board, Piece class Game: def __init__(self): self.board = Board() def touches_enemy(self, piece): pass def can_move(self, piece: Piece): if piece.covered_by: return False elif ( not piece.can_hop and not piece.can_cl...
cbb8c7f87852d6bb807bb34c3f1de4d63a846c26
Wangpeihu1/python---
/alien.py
2,616
3.671875
4
#字典 是一系列 键 — 值对 。每个 键 都与一个值相关联,你可以使用键来访问与之相关联的值。 #与键相关联的值可以是数字、字符串、列表乃至字典 #键和值之间用冒号分隔,而键 — 值对之间用逗号分隔。 alien_0 = {'color': 'green', 'points': 5,'speed': 'medium'} new_points = alien_0['points'] print("You just earned " + str(new_points) + " points!") print(alien_0) #添加键 — 值对,字典名[键]=值 alien_0['x_position'] = 0 alien_0['y...
540bd668877dc69d78812984869295dd5f25c396
tharasavio/My-Python-scripts
/numlist.py
476
4.0625
4
smallest = None largest = None while True : inp =raw_input('Enter the number') if inp == "done" : break try : num = float(inp) except : print "Invalid input" continue if smallest is None : smallest =num elif smallest > num : smallest = num if ...
65f7e582f4951717e7c1ef46d1e7d51474e27efe
piercecunneen/Interpreter-For-Lisp
/test.py
8,485
3.5625
4
""" Testing suite for lisp interpreter """ from Token import * def addition_tests(): lisp = "(+ 2 4)" lisp_tokens = read_tokens(create_tokens(lisp)) assert(interp(lisp_tokens, env) == 6) lisp = "(+ 2 -5)" lisp_tokens = read_tokens(create_tokens(lisp)) assert(interp(lisp_tokens, env) == -3)...
35ed046aad839548b5fcdf4eb173c746412cda5c
balloontmz/python_skill
/chapter_2/history_deque.py
1,003
3.59375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ 实现历史记录 """ __author__ = 'tomtiddler' from random import randint from collections import deque # 队列 import pickle, json N = randint(0, 100) history = deque([], 5) def guess(k): if k == N: print("right") return True if k < N: print(...
368566b2770d06c19d2e4e094e10f4529166a975
sandykramb/PythonBasicConcepts
/NIM_game.py
1,781
4.0625
4
def partida(): print(" ") n = int(input("Quantas peças? ")) m = int(input("Limite de peças por jogada? ")) is_computer_turn = True if n % (m+1) == 0: is_computer_turn = False print("Você começa!") else: print("Computador começa!") while n > 0: if is_computer_turn: partida = computador_escolhe_jo...
61abe5d75efa42c3e17de8137cb177524564470d
armineMak/python_courses
/long_word.py
509
4.25
4
# long_word_list = ["test", "bulkijgbdvfdbgfghf", "xachapuri", "ansahman"] # long_word_list.sort( key = len ) # print(long_word_list[-1]) long_word_list = ["test", "bulkijgbdvfdbgfghf", "xachapuri", "ansahman", "sgfbdsmfdmsbnfmbdnmfbmndbmnfbmdnbfb"] def find_longest_word(long_word_list): d = [] for c in long...
3a67d2a64259ec054d766dc4f048dd0c14c3fa3f
bgroveben/coursera_LTP_TF
/contains.py
1,097
4
4
def contains1(value, lst): """ (object, list of list) -> bool Return whether value is an element of one of the nested lists in lst. >>> contains1('moogah', [[70, 'blue'], [1.24, 90, 'moogah'], [80, 100]]) True """ # intialize found value to False, change it to True if we find the value in ...
adcc8a1e1d85386b6afa3071c4b394043c4e2c24
cdjasonj/Leetcode-python
/反转链表.py
477
3.890625
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None #原地反转,关键在需要一个pr来保存下一个p在哪儿 class Solution: def reverseList(self, head: ListNode) -> ListNode: new_head = ListNode(0) p = head while p: pr = p.next...
0050f0271d73ef62032fe07a7a0c2bc5243c8c10
dnolivieri/MResVgene
/mresvgene/tstInvSeq.py
2,287
3.578125
4
#!/usr/bin/env python """ dnolivieri: updated ...5-jan-2016 --inverse string >>> 'hello world'[::-1] 'dlrow olleh' This is extended slice syntax. It works by doing [begin:end:step] - by leaving begin and end off and specifying a step of -1, it reverses a string. """ from Bio i...
3d9a2f52123888b9494c5212bec014805be00266
JoA-MoS/Python
/Python-OOP/week1/day1/findChars.py
234
3.75
4
def findChars(arr, char): out = [] for w in arr: if w.find(char) >= 0: out.append(w) return out word_list = ['hello', 'world', 'my', 'name', 'is', 'Anna'] char = 'o' print findChars(word_list, char)
9f79f9862d537174368892f7ac2555205dd76cb0
TokyoQ/ProjectEulerPython
/problem005.py
443
3.796875
4
''' 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder. What is the smallest positive number that is evenly divisible by all of the numbers from 1 to 20? ''' MAX_NUM = 20 i = 20 while(i<300000000): remainders = ((i%j==0) for j in range(1,MAX_NUM)) #print...
e2905bfdb23d2f11287df6794e7e7358e16c9393
ExpLog/Challenger
/hackerrank/algorithms/greedy/grid_challenge.py
480
3.890625
4
def read_matrix(): n = int(input().strip()) matrix = [list(input().strip()) for i in range(n)] return matrix def col_sorted(matrix): n = len(matrix) for j in range(n): for i in range(1, n): if matrix[i-1][j] > matrix[i][j]: return False return True tests = i...
07cf2b1716f4e9d3458baa62903e68a09743349b
gregoirw/hello-codecool
/dictionary.py
4,622
3.9375
4
import csv start=1 lpd={'function' : ("A function is a block of organized reusable code that is used to perform a single related action. Functions provide better modularity for your application and a high degree of code reusing.", "source: www.tutorialspoint.com/python/python_functions.htm",), 'parameter' : ("A...
ec6fc4120a24f22e2bd71cebd55ef76c390e8931
czchen1/cs164-projects
/proj1/tests/other-tests/strictfp_tests/correct/indent2.py
349
3.921875
4
print 'a' print 'b' if True: print 'c' # this can be indented in any way # weird inconsistent # and more print 'd' # because comment lines don't matter # at all print 'e' print 'f' print 'g' # ...
b2de7307c29242f69fd57e43d49185a8a9c919be
TinaNguyenGC/MASK_public
/Dictionaries/populate.py
1,685
3.8125
4
import os import csv from typing import Set def cities() -> Set: """ returns name of citites """ dirname = os.path.dirname(__file__) city_file = open(os.path.join(dirname, 'Cities.txt'), 'r', encoding='utf 8') return set(line.strip().lower() for line in city_file) def countries() -> Set: ...
425bc62ef677e10d7c7f5a0e1236771be19bed20
sky-dream/LeetCodeProblemsStudy
/[0510][Medium][Inorder_Successor_in_BST_II][BST_InorderSearch]/Inorder_Successor_in_BST_II.py
764
3.734375
4
# leetcode time cost : 116 ms # leetcode memory cost : 21.3 MB # Time Complexity: O(H) # Space Complexity: O(1) # Definition for a Node. class Node: def __init__(self, val): self.val = val self.left = None self.right = None self.parent = None # solution 1, iteration class Sol...
e7fe22d3f7d242a797debc5c22b97703e0afdf7e
lenaecs/Advent-of-Code-2016
/Code/Day 16.py
1,028
3.5625
4
def generate_data(starting_str, length): output_str = starting_str while len(output_str) < length: str_copy = output_str str_copy = str_copy[::-1] part2 = '' for letter in str_copy: if letter == '0': part2 += '1' else: part2...
00d9b372291e905fbb79c8041365c4bb098a61cd
TanmoySG/Coding-Practice
/Data-Structures/Linked-Lists/Insert-a-Node-at-the-Tail-of-a-Linked-List.py
477
3.59375
4
# Complete the insertNodeAtTail function below. # # For your reference: # # SinglyLinkedListNode: # int data # SinglyLinkedListNode next # # def insertNodeAtTail(head, data): newNode = SinglyLinkedListNode(data) newNode.next = None if head is None: head = newNode return head c...
6367a0771961100e1b30be256990fe734380f819
mbomben/python_scripts
/extract-2D.py
3,315
3.546875
4
import argparse import sys import os.path import re # argument parser def argumentParser(arguments): parser = argparse.ArgumentParser() parser.add_argument("--template",help="set template file",required=True) parser.add_argument("--set",help="set file name",required=True) parser.add_argument("--TwoDname",help=...
cf73c9004e1a7ad2b3ff606652d529a3e6404b51
liu666197/data1
/8.17/09 对象的嵌套.py
1,381
3.796875
4
# 6.模拟英雄联盟中的游戏人物的类: # 要求: # a.创建Role(角色)类,有name,ad(攻击力),hp(血量)三个属性 # b.创建Arms(武器)类,有name,ad(攻击力),两个属性 # c.创建一个attack方法,此方法是实例化的两个对象,互相用武器攻击的功能 # 例: # 实例化一个Role对象,名字为盖伦,ad为10,hp为100 # 实例化另一Role个对象,名字为亚索,ad为20,hp为80 # 实例化一个Arms对象,名字为无尽之刃,ad为40 # # attack方法要完成: '谁拿什么武器攻击谁,谁掉了多少血,还剩多少血的提示功能' class...
b691c8e706c578e32a1993a42c830aa3aa2ae777
rachelpdoherty/Casimir-programming
/script.py
443
3.578125
4
import test r=5 print("circumference =", test.circumference(r)) print("area =", test.area(r)) print("It worked!") import matplotlib matplotlib.use('agg') import matplotlib.pyplot as plt circle1 = plt.Circle((0.5, 0.5), 0.2, color='r') fig, ax = plt.subplots() # note we must use plt.subplots, not plt.subplot # ...
8f1f50460af4665e8786cecb919e9fe0605d12db
cmalaga0605/Open-Kattis---Python
/Pot/Pot.py
794
3.734375
4
#!/usr/bin/env python # coding: utf-8 # In[4]: import sys #imported the sys library to exit the program when need be n = int(input()) if n < 1 or n >10: #included my constraints sys.exit() addlist = [] #created a list while n != 0: p = int(input()) if p < 10 or p > 9999: #included my constraints ...
2a452804b70b0da9f9f55abf989ea185585d0ac8
denisfelipedev/PythonMundo1
/desafio008.py
345
4.21875
4
#Escreva um programa que leia um valor em metros e o exiba convertido em centimetros e milimetros. #======================================================= m = float(input('Digite o valor em metros a ser convertido: ')) print('Medida em metros: {}m\nO valor em centimetros é {:.2f}cm \nO valor em milimetros {}mm'.f...
27c3d0d4f6ec5a6773268767a8b33dac0e65ff4f
lguilh3rme/cursoPython
/D18.py
196
3.671875
4
import math an = int(input('Digite o angulo: ')) s = math.sin(an) c = math.cos(an) t = math.tan(an) print('O seno de {} é {:.2f}; o cosseno é {:.2f}; a tangente é {:.2f}'.format(an, s, c, t))
e88c49c87c0b640632c40551d8b9057a12492484
ismailk97/ImageRecognition
/untitled/test.py
796
3.6875
4
#face recongition system to detect faces on image. import cv2 #endre bildet til det du ønsker... img = cv2.imread("C:/Users/Ismail/PycharmProjects/untitled/Image/face.jpeg") #resize vis det trengs img= cv2.resize(img, (800, 600)) #får bilde til grå farge grayimg= cv2.cvtColor(img, cv2.COLOR_BGR2GRAY) #algorithm to...
fc2bec7a29c5801b54d78874107132daaccb8030
sondrewr/dk_A3_chat
/Warmup-Python/simple_tcp_server.py
1,234
3.953125
4
# A Simple TCP server, used as a warm-up exercise for assignment A3 from socket import * def run_server(): # TODO - implement the logic of the server, according to the protocol. # Take a look at the tutorial to understand the basic blocks: creating a listening socket, # accepting the next client connectio...
f472accd3358aedede1e4dd200668465aad2cbda
Charl86/Maze-Generator
/mazeGenerator/maze/cell.py
5,024
3.734375
4
import random import math import pygame from mazeGenerator.maze.wall import Wall # Cell class class Cell: # Takes 3 arguments: x and y coordinates in 2D-grid and size (width and height). def __init__(self, x, y, mSettings, **kwargs): self.x = x self.y = y self.size = mSetti...
2b5f48018740a9a211008072f8050dae3c307671
roland-stefani/web_scraping_with_python
/reading_and_writing_natural_languages_chapter_8/summarizing_data/main.py
3,410
3.5
4
import re import string import requests from pprint import pprint _BASE_URL = 'http://pythonscraping.com/files/inaugurationSpeech.txt' def is_common(ngram): common_words = [ "the", "be", "and", "of", "a", "in", "to", "have", "it", "i", "that", "for", "you", "he", "with", "on", "do", "say", "this...
9322d24665737b9d40790abc60cdf1ff84bef988
Aasthaengg/IBMdataset
/Python_codes/p03105/s576372903.py
136
3.515625
4
line = input() numbers = [int(n) for n in line.split()] predicted_value = min(numbers[1]//numbers[0], numbers[2]) print(predicted_value)
843aa2e9f6c9a297273d6763f6241e58f9c64a7c
nazaninsbr/Graph
/NetworkX/visualization.py
486
3.5625
4
import matplotlib.pyplot as plt import networkx as nx def draw_graph(graph): G = nx.Graph() for edge in graph: G.add_edge(edge[0], edge[1]) graph_pos = nx.shell_layout(G) nx.draw_networkx_nodes(G, graph_pos, node_size=1000, node_color='blue', alpha=0.3) nx.draw_networkx_edges(G, graph_pos) nx.draw_networ...
9a86e4e68c25dc217f81145759359d70ba42413e
ArthurPalatov/homework
/1.py
95
3.6875
4
n = int(input()) if (-15<n<12) or (14<n<17) or (n>19): print (True) else: print(False)
c38514a69ec439a247e99aafd5e3c66fa375c6f3
osmarsalesjr/AtividadesProfFabioGomesEmPython3
/Atividades6/At6Q12.py
520
3.671875
4
def main(): nome = input("Nome Completo: ") for i in range(len(nome)): if nome[0: i].count(" ") == 1: primeiro_nome = nome[0 : i - 1] nome_auxliar = nome[i + 1: len(nome)] break for i in range(len(nome)): if nome_auxliar[0 : i].count(" ") == nome_auxlia...
365b8eb86f6ec4e422ac2867d6cffc58811f0212
pspencil/cpy5python
/practical02/q08_top2_scores.py
639
4.1875
4
#Filename:q08_top2_scores.py #Author:PS #Created:201302901 #Description:To find the student with the highest and second highest score num=int(input("Enter the No. of students: ")) topname="" topscore=0 top2name="" top2score=0 for i in range (1,num+1): name=input("Please Enter the name of student {}: ".format(i)) sco...
702b6b703d1783b9287636fc426157de589025c3
Nikolov-A/SoftUni
/PythonBasics/Exam-Exercises/Exam Preparation/E_Fan_shop.py
573
3.8125
4
budget = int(input()) n = int(input()) total = 0 product_counter = 0 for i in range(n): product = input() product_counter += 1 if product == "hoodie": total += 30 elif product == "keychain": total += 4 elif product == "T-shirt": total += 20 elif product == "flag": ...