blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
19b8b065d83c28779a0019e69cef2c2da3c1e2e6
WonderPro/Engineering-Practical-Experiments
/Semester 4/Open Source Technology/exp2.py
507
4.21875
4
print("If-elif-else example -->") a = input("\nEnter first number: ") b = input("Enter second number: ") c = input("Enter third number: ") if (a > b and a > c): print(f"{a} is greatest!") elif(b > a and b > c): print(f"{b} is greatest!") else: print(f"{c} is greatest!") print("\nFor example -->") for i i...
8f5809076d451ede90312bfbfb581d8f86318a69
huangyingw/submissions
/234/234.palindrome-linked-list.270128969.Accepted.leetcode.py
536
3.671875
4
class Solution(object): def reverseList(self, head): pre = None while head: head.next, pre, head = pre, head, head.next return pre def isPalindrome(self, head): fast = slow = head while fast and fast.next: fast = fast.next.next slow = ...
4b611831deca2c7baaca97063182e312e109d016
eyenpi/Trie
/src/Student.py
626
3.546875
4
class Student: def __init__(self, name, number, gpa, field): self.name = name self.number = number self.gpa = gpa self.field = field def __hash__(self): hashed = 0 # first method that was my idea # r = 0 # for i in self.number: # hash...
a76f1391cd9f685cb4be0fe1855807040ce57745
Alex-PaulinePoudade/Renardo
/renardo_v1.py
2,253
3.578125
4
# Fast coding of Renardo program used on French TV Show # "Des chiffres et des lettres" (https://en.wikipedia.org/wiki/Des_chiffres_et_des_lettres) # by Alex-Pauline Poudade 11/26/2021 import random random.seed() def operations(t, max): signe = '+-*/' for i in range(0, 4): for j1 ...
f8b32ddef7df272e5f9d9d1bbd8186f86e5e78e4
Tommy-Cirilo/python-playground
/variables.py
716
3.921875
4
#A variable is a container for a value, which can be of various types ''' This is a multiline comment or docstring (used to define a functions purpose) can be single or double quotes ''' """ Variable Rules: - variable names are case sensitive (name and NAME are different variables) - Must start with a a letter or an ...
d738413fb76c96401441f1e790345fa9b2bec338
ro-neil/rsa-decrypt
/app/rsa_decrypt.py
6,176
4.21875
4
'''An RSA Decrypter''' import math import time import sys def isWhole(value): """Determines if a given value is a whole number""" try: if value > 0: '''Compares the difference between a value an its integer representation''' difference = (value - int(value)) ...
46b7f8e4b781a08a123d84537cb5ef9b7c361877
gabriellaec/desoft-analise-exercicios
/backup/user_167/ch84_2019_06_04_13_21_15_000391.py
203
3.625
4
def inverte_dicionario (dic): n_dic={} for k,v in dic.items(): if v in n_dict: n_dict[v].append(k) else: n_dict[v]=[k] return n_dict
5fe1c472077f78f9b4ace8882d3c0114157450c4
Nikkuniku/AtcoderProgramming
/yukicoder/2354.py
1,470
3.5625
4
from heapq import heappush, heappop def dijkstra(s, n, adj): # (始点, ノード数) INF = 10 ** 9 dist = [INF] * n hq = [(0, s)] # (distance, node) dist[s] = 0 seen = [False] * n # ノードが確定済みかどうか while hq: v = heappop(hq)[1] # ノードを pop する seen[v] = True for to, cost in adj[v]: ...
37cc5202a2aa176bdc6d240b9b29479c230a05de
karanbr/python-projects
/variables/variable_excercise.py
426
3.96875
4
# Challane # 🚨 Don't change the code below 👇 a = input("a: ") b = input("b: ") # 🚨 Don't change the code above 👆 # Switch a and b values #################################### # Write your code below this line 👇 a_value = a b_value = b b = a_value a = b_value # Write your code above this line 👆 ##################...
061c0de88cfdb5997b749a618098c7dbfd167edb
touhiduzzaman-tuhin/python-code-university-life
/University/Exam/4.py
80
3.921875
4
x = int(input("Enter a number : ")) print("Your Result is : ", x) print("\n")
71011b9948d816866012d3f06b0c7757513137ee
JessiMcKissick/RPyG
/Learn it/step_8.py
8,107
3.71875
4
import os # Allows you to utilize OS functions. import random # Allows you to utilize math randomization and the likes. import time # Allows access to time. This will mostly be used for delays. import platform # We'll use this to find the current devices platform. version = "0.0" lb = "----------------------------...
396b79efb8390eea84ccea0b04e382bac630e23b
Hasibul-Alam/learning-python
/Python Basic/bigcount.py
772
3.6875
4
#!/usr/bin/python3.9 '''' Program Writer: Hasibul Alam "Play with Python" Create a histogram of people apper in a file using dictionary datatype. This program is upgrade version of application_of_dict*.py''' fgrab = input('Enter the file name \'names.txt\':') fhan = open(fgrab) names = dict() for line ...
c4111199d16c430e9fc8ee243383cfe605eac523
karadisairam/flow-control-statements
/24.py
353
3.9375
4
result = input("enter student name :") if result == "sai": print(result,"total marks is :",455) elif result == "ram": print(result,"total marks is :",432) elif result == "vishnu": print(result,"total marks is :",300,"and one subject fail") else: print("This student marks is not available")...
57f5ea52aba7d8d87bb53ffb042f7f689ca71bad
JerryMcG/Election_Analysis
/PyPoll.py
3,227
3.71875
4
#adding dependancies import csv import os #assign variable for the file to load(with path) and file_to_save(with path) file_to_load = os.path.join("Resources","election_results.csv") file_to_save = os.path.join("analysis", "election_analysis.txt") # Initialize a total vote counter total_votes = 0 #create candidate li...
1c2769e27f77697ee96a0060d70ad99addae5a67
HyunSung-Na/TIL-algorism
/알고리즘/프로그래머스 월간챌린지 1.py
311
3.90625
4
from itertools import combinations numbers = [2, 1, 3, 4, 1] def solution(numbers): answer = [] combin_number = combinations(numbers, 2) for num1, num2 in combin_number: answer.append(num1 + num2) answer = list(set(answer)) answer.sort() return answer print(solution(numbers))
87ffe277a110ec274486e337b91d6fc7ba9402bd
Christopher-Caswell/holbertonschool-higher_level_programming
/0x0B-python-input_output/0-read_file.py
263
4.28125
4
#!/usr/bin/python3 """ Write a function that reads a text file (UTF8) and prints it to stdout: """ def read_file(filename=""): """Prints a text read from a file""" with open(filename, encoding="UTF8") as x: print("".join(x.readlines()), end="")
ab72d17664ff3a203146439edd4a254e99f85a25
m1plessnit/AAURecommender
/Assignment1/task2_3.py
2,251
3.875
4
def computeMeanRating(file): try: f = open(file,'r') except: print('Something went wrong reading the file "' + file + '"') exit() ratingsCount = 0 sum = 0.0 ratings = [] #loop to get numeric rating values; proceed them as needed for x in f: ratingValue = x.s...
562ba0bd573ecf4d61573914685fc917bc1e6bec
DaanPepping/Opdrachten_Daan_pepping
/Lesson 2/pe2_4.py
207
3.5625
4
uurloon = input('wat verdien je per uur:' ) uren = input('hoeveel uur heb je gewerkt:' ) loon = int(uurloon) * int(uren) eindsom = str(uren) + ' uur werken levert ' + str(loon) + ' Euro op!' print(eindsom)
abc530309dcb5a002619008478f2a588bfdd9045
alex-xia/leetcode-python
/lib/word_search.py
4,284
3.875
4
__author__ = 'Qing' ''' Given a 2D board and a word, find if the word exists in the grid. The word can be constructed from letters of sequentially adjacent cell, where "adjacent" cells are those horizontally or vertically neighboring. The same letter cell may not be used more than once. For example, Given board = [...
e639bf77580455e30582103b9e9abd14a9cd1fd0
ily9000/classifiers
/load_data.py
2,728
3.5
4
import pandas as pd import numpy as np import scipy.spatial.distance as distance from sklearn.datasets import load_digits from sklearn.datasets import fetch_mldata import logging class digits(object): """This class can load the MNIST digits data from a csv file in a local directory (kaggle format) and if MNIST data...
8a2d7cc34c426ca1977a648f462f2011aebe5163
sycor6366/new_study
/day_3/test_01.py
681
3.8125
4
import threading import time # def helloworld(): # time.sleep(2) # print("hello world") # # t = threading.Thread(target=helloworld) # t.start() # print("main thread") # def helloworld(id): # time.sleep(2) # print("thread {} helloworld".format(id),time.time()) # for i in range(5): # t = threading....
1f754e32587b359eae08773556ca747b523c8f7c
richardOlson/cs-module-project-algorithms
/moving_zeroes/moving_zeroes.py
1,256
4.3125
4
''' Input: a List of integers Returns: a List of integers ''' # This is the first pass solution of the function # Will do a similar version as doing swaping # Will have pointers that increment on the left and decrement on # the right. The right will stop on a number that is not a zero # The left will stop on a number...
4d3c5f1d0f7367b87326b13ea7243fb077a2b880
apiyron/MOOCs
/stepik/Программирование на Python/2_6_2_Matrix_spiral.py
1,220
3.828125
4
''' Выведите таблицу размером n×n, заполненную числами от 1 до n^2 по спирали, выходящей из левого верхнего угла и закрученной по часовой стрелке, как показано в примере (здесь n=5): 2: 1 2 4 3 3: 1 2 3 8 9 4 7 6 5 4: 1 2 3 4 12 13 14 5 11 16 15 6 10 9 8 7 5: 1 2 3 4 5 16 17 18 19 6 15 24 25 20 7 14 23...
157866868c6364e4f1f7ad73a31eea459ce26eb4
Splintzz/CS-Interview-Questions
/SumsOfK.py
2,559
3.984375
4
def findSumsOf(array, k): loopVar = 0 #used to loop through array cols = k//2 + 1 #number of columns = number of possibilities to add to k = k/2 + 1 odd = k%2 == 1 #k...
0a745d597483763c8dc4d48b38c4d9d06d2f9e5b
thorwhalen/py2api
/py2api/examples/pong.py
5,037
3.5
4
""" This example wraps a single simple function. Simple, but cheekily type-inconsistent. This will give us the excuse to demo how to use InputTrans and OutputTrans with a nested conditions specification. Here we'll use condition markers such as _ARGNAME, _ELSE, _ARGS, _JSON, _SOURCE, _ATTR, and _VALTYPE! Looking forwar...
d2eabfcade24e78d94aa3dc430e9517551d78b27
holyant/PythonProjects
/pythonTest/exercise/09WhatWasThat.py
718
3.75
4
#!/usr/bin/env python # -*- coding: UTF-8 -*- tabby_cat = "\tI'm tabbed in." persian_cat = "I'm split\non a line." backslash_cat = "I'm \\ a \\ cat." fat_cat = """ I'll do a list: \t* Cat food \t* Fishies \t* Catnip\n\t* Grass """ print tabby_cat print persian_cat print backslash_cat print fat_cat ...
3fc283c5fa2ff023690809ec41a2acede49d3df9
Shrawanv/DSAONE
/sort012.py
942
4.28125
4
def swap(arr,i,j): arr[i], arr[j] = arr[j], arr[i] def sort012(arr,n): '''This is very simple solution but the space complexity of this is O(n) as it is creating 3 different array of total size of original n size array.''' sorted_arr = [] ones = [] twos = [] for elem in arr: if el...
00a415a2e3021acc60579a0729bc56c9d9677959
Ketan2010/Python-Codes
/Matplotlib/bar_graph.py
380
4.1875
4
#bar graph from matplotlib import pyplot as plt #to draw bar graph #bar([x-coordnt],[y-coordnt],lable="lable for bar",color='symbol') plt.bar([1,3,5,7],[1,2,3,4],label="example one",color='g') plt.bar([2,4,6,8],[5,2,8,1],label="example two",color='c') plt.title("bar graph") plt.xlabel("x-axis") plt.ylabel("y-a...
cf50cd9178e040ed82e5fba00cdb3233de2cc6df
GH-Edifire/GH-JK-practice-problems
/Project Euler/Problem 7.py
760
3.765625
4
# Project Euler: Problem 7 # Jonathan Kosasih # By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13. # # What is the 10 001st prime number? #------------------------------------------------------------------ import math def nthPrime(number): array = [2] test = 3 ...
98b791315a0b52162f435b7c81d5d040ab91bafe
loghmanb/daily-coding-problem
/interviewbit_matrix_search.py
1,695
4.09375
4
''' Matrix Search https://www.interviewbit.com/problems/matrix-search/ Given a matrix of integers A of size N x M and an integer B. Write an efficient algorithm that searches for integar B in matrix A. This matrix A has the following properties: Integers in each row are sorted from left to right. The first integer...
998b9cccbb38b33fa562e4bd8951dd53774cf137
Kanda-design/MyProject
/scripts/test.py
1,511
3.890625
4
# Function calling def fib(n): # write Fibonacci series up to n a, b = 0, 1 while a < n: print(a, end=' ') a, b = b, a+b print() def fib2(n): # return Fibonacci series up to n result = [] a, b = 0, 1 while a < n: result.append(a) a, b = b, a+b return...
e043ecacae334854744c79bc387e04f13989abef
signofthefour/PPL
/OOP/Question3.py
1,957
3.546875
4
class Expr: pass class Var(Expr): def __init__(self, _name): self.name = _name def get_val(self): return Number(float(1)) class Number(Expr): def __init__(self, _number): self.number = _number def print(self): print(str(self.number)) def get_val(self): ...
1b6fdd082a2c9c95f0710a32f323c83788ec60dc
Mikejx2/Digital_Craft
/Python/Homework01_3/practice.py
3,222
4.03125
4
# board = [ ["X", "X", "O"], # ["X", "O", "O"], # ["X", "", "O"] # ] # greeting = "hello world" # print(greeting[2]) # print(len(greeting)) # alphabet = "abcdefghijklmnopqrstuvwxyz" # alphList = list(alphabet) # print(alphList) # name = "Michael Cook" # for char in name : # 1. Su...
829bc1e1477cd2af18d7f4bed0ff6db1605249a1
Aishwarya-Prabhu/Resume-Application
/pages/projects.py
2,767
3.796875
4
"""Projects page shown when the user enters the application""" import streamlit as st def write(): """Used to write the page in the app.py file""" st.title("Projects :female-technologist: ") st.markdown( """ ## Featured Projects [(GitHub)](https://github.com/aishwarya-prabhu/) **Chat Applicat...
01ab8829583474926c51f35f4a6ce63d03b45b21
MAPLE-Robot-Subgoaling/IPT
/data/HW4/hw4_450.py
393
4.21875
4
def main(): stoneHeight = int(input("Please enter the starting height of the hailstone: ")) while stoneHeight > 1: print("The hailstone is currently at height",stoneHeight) if (stoneHeight % 2 == 0): stoneHeight = stoneHeight // 2 else: stoneHeight = (stoneHeight ...
21f846d01c76de4091ecf90d66d3f4dc44928067
jiangshen95/PasaPrepareRepo
/Leetcode100/leetcode100_python/LowestCommonAncestorofaBinaryTree.py
1,399
3.625
4
class TreeNode: def __init__(self, val = 0, left = None, right = None): self.val = val self.left = left self.right = right class Solution: def lowestCommonAncestor(self, root: 'TreeNode', p: 'TreeNode', q: 'TreeNode') -> 'TreeNode': if not root or root.val == p.val or root.val =...
30150349a2826833f1ae0642b788e07e40ee0641
tengdann/SI_507
/Homework_1/ttt.py
4,075
4.375
4
''' SI 507 Fall 2018 Homework 1 ''' # SSH test comment # Create board - Setup the data structure for storing board data bd = [ ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ', ' ' ] # Indexed from bottom left; refer to keypad on keyboard # For use in determine_game(); stores all possible winning triplets WIN_COMB = [ (0,...
b607e29b20e214c1a5bf01079d72b833a6f70a27
limiyou/Pyproject
/1python基础/class11_异常处理 和 类/demo6_属性和方法.py
1,850
4.5625
5
""" 属性和方法 属性是指类或对象的特征 方法是指类或对象的行为 属性: 类属性(类变量):类当中每一个成员都具备的特征 类和对象都可以获取 实例属性(实例变量)/对象属性:类当中的成员不一定都具备的特征,是某个对象单独持有的,其他对象没有的 方法: 类方法:每一个成员或者整个类都能执行的行为 实例方法/对象方法 :需要一个单独的成员调用的行为,不能是整个类调用 #TODO:不要用整个类去调用实例方法 实例方法在定义的时候,自带一个参数,self todo:但是实例方法在调用的时候不需要传self参数的实际参数 o...
5de31b4ed39b500405cd69c42340c131e50d2990
ArcaneWave/melazWeb-droppingBall
/core/system.py
5,011
3.515625
4
from math import sqrt class System: def __init__(self, body_mass=0, start_coordinate=100, start_velocity=0, experiment_time=10, step_amount=100, # Main using_complex_gravity=False, # Gravity using_archimedes_force=False, body_density=None, environment_density=No...
67ce35bd50b83f173aadc268fddc77101db67226
lucascoelho33/ifpi-ads-algoritmos2020
/ATIVIDADE G - FÁBIO 2a - CONDICIONAIS/fabio2a_q08.py
612
3.734375
4
#8. Leia data atual (dia, mês e ano) e data de nascimento (dia, mês e ano) de uma pessoa, calcule e escreva #sua idade exata (em anos). def main(): dia_atual = int(input()) mes_atual = int(input()) ano_atual = int(input()) print('') dia_nasc = int(input()) mes_nasc = int(input()) ano_nasc ...
94c76e11961a6dc6c88eaf726f465ab8204bc0db
cmk0672/Contact-Project
/contact.py
2,794
3.96875
4
# 컨택트 클래스의 설정 class Contact: def __init__(self,name,phone_number,e_mail,addr): self.name = name self.phone_number = phone_number self.e_mail = e_mail self.addr = addr def print_info(self): print('name:', self.name) print('phone_number :', self.phone_number) ...
458b8d5ede76c7101cf3256a01a6ec923ab97bc4
Bhaveshahluwalia/Introduction-to-Programming-for-Analytics-CS620
/CUS620_Class_Ex4_Ahluwalia.py
17,470
3.953125
4
#!/usr/bin/env python # coding: utf-8 # # # CUS620, Class Exercise 3 # ## Your full name: Bhavesh Ahluwalia # -------------- # - ### Note1: you can use this temaplet to answer questions such as class Exercise and HWs # - ### Note2: chnage the file name respect to type of assignment, for example: CUS620_Class_Ex1_LastN...
eada95f3c3759bdf433add9b90b07862081bedcc
SimonMcLain/ProgrammingandScriptingGMIT
/Weekly Topics/workingout.py
235
3.53125
4
import csv with open("data/iris.csv", 'rb') as f: rdr = csv.reader(f) with open("result", "wb") as result: wtr= csv.writer( result ) for r in rdr: print (wtr.writerow( (r[0], r[1], r[3]) ))
e15e9c2bed4b065bbc0579bc876c0889e4c1857c
ijchavez/python
/Fundamentos/persona.py
460
3.78125
4
class Persona: def __init__(self, nombre, edad): self.nombre = nombre self.edad = edad Persona.nombre = "Juan" Persona.edad = 28 #Acceder a los valores print(Persona.nombre) print(Persona.edad) #Creacion de un objeto persona = Persona("Karla", 30) print(persona.nombre) print(persona.e...
3859a429b18b7d43311e58d31a92ac6f222120d7
jingxiufenghua/algorithm_homework
/leetcode/leetcode47.py
3,638
3.703125
4
from typing import List # class Solution: # def permuteUnique(self, nums: List[int]) -> List[List[int]]: # def backtrack(first=0): # if first == n: # return res.append(nums[:]) # for i in range(first,n): # nums[i],nums[first] = nums[first],nums[i] # ...
c13aac08a1044f65e081b75ffc41be4fabca13ca
MikeCalabro/nba-visualization
/data_cleaner.py
1,468
3.84375
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt # nba_data.csv downloaded from Kaggle nba = pd.read_csv("nba_data.csv", index_col=0) # Code below allows me to view entire table when I print it (in PyCharm IDE) desired_width = 320 pd.set_option('display.width', desired_width) np.set_printoptions...
c1a879927d059fed421a88fcd9b00d0367b4b26f
frankpiva/hackerrank
/practice/algorithms/implementation/drawing_book.py
2,331
4.53125
5
#!/bin/python3 """ Brie’s Drawing teacher asks her class to open their books to a page number. Brie can either start turning pages from the front of the book or from the back of the book. She always turns pages one at a time. When she opens the book, page is always on the right side: image When she flips page , she...
3b28b0eb18f4e471ce30f37864a27ccf145b8896
chlee1252/dailyLeetCode
/camouflage.py
584
3.59375
4
from collections import defaultdict, Counter from functools import reduce def solution(clothes): # Approach 1: use defaultdict answer = 1 # Set init answer value as 1 hash = defaultdict(int) for cloth in clothes: hash[cloth[1]] += 1 for key, value in hash.items(): answer *= value + 1...
afc5b99f0391b4cb27e511e4a4bbd1a140e8f7f8
arkuz/5_lang_frequency
/lang_frequency.py
1,450
3.59375
4
import sys import os import argparse import collections import re def create_arg_parser(): parser = argparse.ArgumentParser() parser.add_argument('-file', help='Path to file') parser.add_argument( '-count', default=10, type=int, help='Count of most frequent words' ) ...
4a4e6ee1788572e22d69555680aab1959437b9c4
LucasSchroeders/Calculadora
/CalculadoraFII.py
1,317
3.75
4
acao_inicial = int(input('Quantas ações vc já tem ou irá comprar na primeira leva? ')) acao_mensal = int(input('Quantas ações vc irá comprar por mês? ')) preco = float(input('Qual é o valor da ação que vc irá comprar? ')) rend = float(input('Qual é a porcetagem de rendimento? ')) renda_desejada = float(input('Qual é a ...
b7773e55acb73425af472c23279296af97938a5b
govex/python-lessons-for-gov
/section_01_(basics)/basic_syntax.py
1,270
4.53125
5
# Basic Syntax # This is a comment. # That means Python will let you write notes to yourself and to the other coders checking out your code. # And Python won't run this at all, or even notice it. # The # symbol is what creates a comment. # You can have a comment on a line all by itself. # The print statement is a g...
070674fe785e3785210b403f4d5db0b85b16239e
voyagerw/exercise
/myScripts/Hot100/20.有效括号.py
842
3.734375
4
class Solution: def isValid(self, s: str) -> bool: stack = [] for c in s: if c == '(' or c == "[" or c == "{": stack.append(c) elif not stack or self._getRightParent(c) != stack.pop(): return False return not stack # elif c...
bee3b5cc414799db16a832eec65dd923ed723fe8
Ivanochko/lab-works-python
/Topic 17/lab17_2.py
2,494
3.671875
4
#! /usr/bin/env python3 # -*- coding:utf-8 -*- import timeit import math import operator def stage_shift(number): return number << 1 def stage_stars(number): return number ** 2 def stage_power(number): return pow(number, 2) def stage_math(number): return math.pow(number, 2) def stage_magic(num...
a3162ff328cc37c299d3f0b138d8d0460754c834
ilovemaths321/advent_of_code
/2019/day1/main.py
331
3.515625
4
puzzle_1 = 0 puzzle_2 = 0 with open("input.txt", "r") as file: for line in file.readlines(): fuel = int(line.strip("\n")) puzzle_1 += fuel//3 - 2 while fuel//3 - 2 > 0: fuel = fuel // 3 - 2 puzzle_2 += fuel print("Puzzle 1: " + str(puzzle_1)) print("Puzzle 2: " + str(...
51753a4ae25d2ee89bdcfc83ea57941128c65cf4
sidv/Assignments
/Lekshmi_Pillai_185386/August_16/stringopn.py
1,501
4.28125
4
string = "A computer is a machine that can be programmed to carry out sequences of arithmetic or logical operations automatically. Modern computers can perform generic sets of operations known as programs. These programs enable computers to perform a wide range of tasks. A computer system is a complete computer that in...
acfee2ea1b9d05a5e200cd19b66a697625418f4c
Rivarrl/leetcode_python
/leetcode/algorithm_utils.py
5,078
4.09375
4
# -*- coding:utf-8 -*- # 算法辅助类 import time from typing import List null = None class Trie: def __init__(self, x): self.val = x self.children = [None] * 26 class Employee: def __init__(self, id, importance, subordinates): # It's the unique id of each node. # unique id of this em...
e067c052a445d449c0acd6e56f73b44f32fddf61
kabakas/HonDash
/mierdaca/mierda/circulo.py
406
3.734375
4
# -*- coding: utf-8 -*- from Tkinter import * from Circle import * root = Tk() index=20 def set(canvas,arc): global index arc.setFill(index) index=index+1 canvas.after(10,set,canvas,arc) canvas = Canvas(root, width=800, height=800,bg="red") canvas.pack() arc = Circle(canvas,50,50...
9fba06885dbdfeb438e3b385185ec0de9f486f50
seeprybyrun/google_code_jam
/codejam2015-round1B/datastruct.py
1,641
3.5625
4
class Stack: def __init__(self): pass def push(self,x): pass def pop(self): pass def peek(self): pass def isEmpty(self): pass class Queue: def __init__(self): pass def enqueue(self,x): pass def dequeue(self): pass def p...
d7c4be10ab9aabb5e5c2f10cd3c1c7b53c6671dc
allen1202/leetcode
/jianzhioffer/面试题07. 重建二叉树.py
1,103
3.84375
4
#Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(): def buildTree(self, preorder, inorder): dic = {} for i in range(len(inorder)): dic[inorder[i]] = i r...
e8264cb918ff3d3377141cbf05982142b895797d
Artimbocca/python
/demos/02-variables/11_stringfunctions.py
637
3.8125
4
print ("they're bill's friends from the UK".title()) #"They'Re Bill'S Friends From The Uk" print (' spacious '.rstrip()) # ' spacious' print ('mississippi'.rstrip('ip')) # 'mississ' print (' spacious '.strip()) # 'spacious' print ('www.example.com'.lstrip('cmowz.')) # 'example.com'...
b3b116904ec2728c22b01f78f97b2018e10ab904
florianporada/iops
/session_material/gardening_buddies.py
2,814
3.53125
4
import pulp import csv with open('kg_m2_de.csv', 'r') as infile: # read the file as a dictionary for each row ({header : value}) reader = csv.DictReader(infile) data = {} for row in reader: for header, value in row.items(): try: value = float(value) excep...
ada6b9e2d70418be8eddf4d3a45b957d44ddc24c
seb6004/Shinichiro07
/TP_NSI_part3.py
574
3.703125
4
#Devine mon nombre import random NB_aléatoire= random.randint(0, 100) NB_choisi= int(input('Devine mon nombre')) WIN= False score= 1 while WIN== False: if NB_aléatoire == NB_choisi: print('Bravo tu a gagné avec un score de', score, '!') WIN= True elif NB_aléatoire > NB_choisi: ...
a353c1dba77f7bf14d84718885996ffa27af453f
juanda1434/EjerciciosPython
/Retos/Reto2.py
546
3.828125
4
distancia, velocidadPromedio, tiempo = input().split() distancia, velocidadPromedio, tiempo = float( distancia), float(velocidadPromedio), float(tiempo) if distancia > 0 and velocidadPromedio > 0 and tiempo > 0: velocidad = (distancia/1000)/(tiempo/3600) if velocidad > velocidadPromedio: paraRecord ...
8200d602c201eaec60313afcbec1bdef56507468
himanshuadvani/PythonContent
/Assignment8/Assignment8_2.py
539
3.59375
4
from threading import *; def evenFactor(number): iSum=0; iNum=0; for iNum in range(1,number): if(number%iNum==0): if(iNum%2==0): iSum+=iNum print("Even Add: ",iSum) def oddFactor(number): iSum=0; iNum=0; for iNum in range(1,number): if(number%iNum==0): if(iNum%2==1): iSum+=iNum pr...
be5076d93fa7c6e1ac96a1753f0cb0cecc10ef0f
SaxJ/programming-comps
/codeforces/educational/round-87/C2.py
174
3.671875
4
import math T = int(input()) for t in range(T): n = int(input()) angle = (((2 * math.pi) / (2 * n)) / 2) toFlat = 0.5 / math.sin(angle) print(2 * toFlat)
ad0576c37a5b6c0cba683570698d2b4f7ff80f5b
mramosv/test-repositorio
/Ejercicio 13.py
1,049
3.640625
4
salir=0 archivo = open("Ejercicio 13.csv","a") while salir==0: print('\n----Año visiesto----') print('Iniciar programa (1)') print('salir (2)') opcion=int(input('ingrese una opcion: ')) if opcion==1: año=int(input('Ingrese al año: ')) if año%4 ==0: if año%100==0: ...
e3941b1116e1d511091018279425fcbea98540e3
emmymarysia03/week1
/BMIcalc.py
2,266
4.15625
4
def bmiRating(bmi): if(bmi < 20): print("You are underweight.") if(bmi >= 20 and bmi <= 25): print("You are at a normal weight.") if(bmi > 25 and bmi <= 30): print("You are overweight.") if(bmi > 30 and bmi <= 40): print("You are obese.") if(bmi > 40): print("...
2a61aaa238aa540a83f404cb9efc4cc889fbda1f
LuizD13/Python
/AulasPython/PythonBasico/aula7.py
579
3.953125
4
""" Formatações """ nome = 'Luiz Cláudio' #str idade=32 #int altura=1.80 #float e_maior= idade > 18 #bool(True / False) peso=80 imc=peso/(altura**2) print(nome,'tem',idade,'anos de idade, e seu IMC é:',imc) print(f'{nome} tem {idade} anos de idade, e seu IMC é: {imc}')#f - Formata a string exibida print(f'{nome} tem ...
f0300bb04999ff9e8b13ae8fce14e8c66828cb7e
shellslau/projecteuler
/problem1.py
155
4.03125
4
end = int(raw_input("enter the max number: ")) total = 0 for i in range (0, end): if (i%3 == 0): total += i elif (i%5 == 0): total += i print total
7335ce1a58730d91374c6cf2f2d7d195a7080271
cbowers1020/COSC_560
/HW1/z3-demo/color.py
1,816
3.65625
4
'z3 demo using graph coloring' from z3 import * def main(): 'main entry point' s = Solver() colors = ['r', 'g', 'b', 'y'] # make boolean variables v0 = [Bool(f'v0_{c}') for c in colors] v1 = [Bool(f'v1_{c}') for c in colors] v2 = [Bool(f'v2_{c}') for c in colors] v3 = [Bool(f'v3_{c}...
be1b0fc8e8d331909bb9b62549f6544c04671683
asset311/leetcode
/math/add_binary.py
2,877
3.953125
4
''' 67. Add Binary Given two binary strings, return their sum (also a binary string). The input strings are both non-empty and contains only characters 1 or 0. Example 1: Input: a = "11", b = "1" Output: "100" Example 2: Input: a = "1010", b = "1011" Output: "10101" ''' # Approach 1: Brute force binary math def add...
c5621bee15e95907ee8faa0ecb394f47928fa2ec
jiyabing/learning
/开班笔记/python基础部分/day05/code/lianxi5.py
414
3.71875
4
s1 = input('请输入第一行字符串:') s2 = input('请输入第二行字符串:') s3 = input('请输入第三行字符串:') l = (max(len(s1),len(s2),len(s3)) + 2) l1 = (l-len(s1))//2 l2 = (l-len(s2))//2 l3 = (l-len(s3))//2 print('+'+'-'*l+'+') print('|'+' '*l1+s1+' '*((l-len(s1))-l1)+'|') print('|'+' '*l2+s2+' '*((l-len(s2))-l2)+'|') print('|'+' '*l3+s3+' '*((l-len(s...
dfe7a2894f8e6f3b7964adc387b99b866a0246b6
llenroc/facebook-interview-question-data
/python/find_avg_word_length.py
507
4.0625
4
#Find average length of Words in a given sentence def findAverage(a): if len(a) == 0 or a is None: return "Empty String" sum = 0 for w in a.split(): sum += len(w) if len(a.split()) <= 0: return "Empty String" return int(round((sum/len(a.split())),0)) print(findAverage...
1b2138257a767759bfaba3a725bf8ef76b1486f1
sunda-y/UsingPythontoAccessWebData
/week04/following_links.py
3,048
4.375
4
# Chapter 12 Assignment: Following Links in Python # In this assignment you will write a Python program that expands on # http://www.pythonlearn.com/code/urllinks.py. The program will use urllib to # read the HTML from the data files below, extract the href= vaues from the # anchor tags, scan for a tag that is in a pa...
264445e588cfef392f06e9fca8fa952d9b84da05
Radmehan/python
/pythonTut40b.py
302
4.0625
4
""" F-Strings & String Formatting In Python """ ''' me="harry" a="this is %s"%me print(a) ''' ''' me="harry" a1=3 # a="this is %s %s"%(me,a1) # a="this is {} {}" a="this is {1} {0}" b=a.format(me,a1) print(b) # print(a) ''' import math me="harry" a1=3 a=f"this is {me} {a1} {math.cos(45)}" print(a)
d9e8872f674ba7cefdf70cd74ad1c3f7a04e56fb
niteshvudutha/Cloud-Computing-HW4
/reducer.py
1,114
3.640625
4
#HW4 – Hadoop data Analysis #vuduthnh M12483636 NITESH VUDUTHA #CLOUD COMPUTING HOMEWORK 4 #!/usr/bin/env python """Advanced Reducer, using Python iterators and generators.""" from itertools import groupby from operator import itemgetter import sys def main(space='\t'): # input comes from STDIN (standard input)...
4d99e49a9e52ff9979583156ede6a0db91b03a75
qeedquan/challenges
/leetcode/maximum-tastiness-of-candy-basket.py
2,139
4.28125
4
#!/usr/bin/env python """ You are given an array of positive integers price where price[i] denotes the price of the ith candy and a positive integer k. The store sells baskets of k distinct candies. The tastiness of a candy basket is the smallest absolute difference of the prices of any two candies in the basket. R...
866ca1bb45a8c85cb92088ac49f0ef27db67a76c
kz2wd/neural-network-gen
/testing.py
2,444
3.546875
4
import random import math def sigmoid(x): return 1 / (1 + math.exp(-x)) # function sigmoid # initialise the network class Network: def __init__(self, neurones): self.neurone = neurones def init(self, neurones): layers = [[0.0 for j in range(i)] for i in neurones] connection_...
afaac2fc0444596662462a2514ef64dbbe3dc630
FFTypeZero/Music-Genre-Classification
/SR_like_AutoEncoder.py
4,625
3.5
4
import tensorflow as tf import numpy as np def onedim_2_twodim(tensor): """ Reshape a 1D data tensor with shape (batch, length, channels) to a 2D data tensor with shape (batch, 1, length, channels) tensor: the input tensor """ shape = tensor.get_shape().as_list() twod_data = tf.reshape(te...
3ba9586c41b13be8a204a94e625d902b2922e7b4
KutlayV/Author-recognition-by-Naive-Bayes-classification-method
/YazarSiniflandirma.py
3,860
3.640625
4
import os import math def metni_Temizle(liste): n = len(liste) for i in range(0, n): liste[i] = liste[i].lower() if (liste[i] == "."): liste[i] = "" elif (liste[i] == ","): liste[i] = "" elif (liste[i] == "and"): liste[i] = "" elif (li...
7c920a97113a868a52125f02a3258ce33779d14a
ppipee/ProblemSolving
/order.py
71
3.53125
4
while(True): a=input().split("/") print(a[1],a[0],a[2],sep="/")
e283e116a2264d65a3c838bfdfe54b59db8c7c5c
qmnguyenw/python_py4e
/geeksforgeeks/python/basic/13_1.py
3,941
4.59375
5
Python | os.listdir() method _ **os.listdir()**_ method in python is used to get the list of all files and directories in the specified directory. If we don’t specify any directory, then list of files and directories in the current working directory will be returned. > ** _Syntax:_** os.listdir(path) > ...
d80b7a17e18503d18547da620975531fe01a89b1
samirelanduk/imagipy
/imagipy/colors.py
3,105
3.984375
4
"""This module contains classes and functions for processing colors.""" from random import randint class Color: """Represents a color. :param int r: The Red value (0-255). :param int g: The Green value (0-255). :param int b: The Blue value (0-255). :raises TypeError: if a non-int RGB value is giv...
9608fc5ef26ada978af5ef74954a4b4550dab3e0
BillZong/CorePythonProgrammingDemos
/8/demo8.1.py
482
4.3125
4
#!/usr/bin/env python """Demo 8.1 for chapter 8.""" passwdList = ["123456", "654321", "111111"] valid = False count = 3 while count > 0: input = raw_input("Enter password:") # Check for valid password. for eachPasswd in passwdList: if input == eachPasswd: valid = True brea...
6ac0712cd2951482202db7f4b764779ea849be62
smushball27295/FE-595-ASSIGNMENT-4
/assignment4_question2.py
999
4
4
# -*- coding: utf-8 -*- """ Created on Sat May 16 10:43:18 2020 @author: ramesh """ ####question 2 #Import libraries import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.cluster import KMeans from sklearn.datasets import load_iris from sklearn import datasets def k...
4ddff57790ad191fc29fc092bcc714f0b6273100
buhuipao/LeetCode
/2017/tree/print_tree.py
1,272
4.03125
4
# _*_ coding: utf-8 _*_ # 按层打印二叉树 class TreeNode(object): def __init__(self, val): self.val = val self.left = None self.right = None class PrintTree(object): def printTree(self, root): if not root: return ''' 定义next_last为下一层的最后一个,cur_last为当前层最后一个 ...
af67c744b587652eeb9e11bbed6c218c9fc0070d
Zahidsqldba07/leetcode-3
/problems/Easy/merge-two-sorted-lists/sol.py
720
3.953125
4
# Definition for singly-linked list. class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def __repr__(self): if self.next: return f'{self.val} {self.next}' else: return f'{self.val}' class Solution: def mergeTwoLists(self, l1: ListNode, l2: ListNode) -> ListNode: i...
9d742ed8efe67b46c7c0ca2a608a81f23b79f9c3
EnderCaster/MyGitExperimentSpace
/python_path/python3_brief_tutorial/6_score_justice.py
442
3.96875
4
#!/usr/bin/env python3 #-*- utf-8 -*- n = int(input("how many students:")) data = {} Subjects = ("Physics","Maths","History") for i in range(0,n): name = input("Name:") scores =[] for x in Subjects: scores.append(int(input("Enter scores of {}:".format(x)))) data[name] = scores for x, y in data.items(): total =...
5825bc50879169e53d3f2d26fc31bd3fdf326266
gagres/algorithms
/algorithms_design_techniques/divide_and_conquer/binary_search.py
542
3.703125
4
import math import sys def BinarySearch(A, low, high, key): if high < low: return -1 mid = int(math.floor((low + high) / 2)) if(A[mid] == key): return mid if(key > A[mid]): return BinarySearch(A, mid + 1, high, key) else: return BinarySearch(A, low, mid - ...
c303dc91b5957034e26bb5538aa666401841eb4f
kartikpilkanya/Student-database-Manager
/studentDatabaseManager.py
19,611
3.796875
4
import pandas as pd import os ################################################################################################## def non_empty(fpath): return os.path.isfile(fpath) and os.path.getsize(fpath) > 0 ################################################################################################## ...
c9523bbafef5205c81c07217f859ae263726bd44
wyaadarsh/LeetCode-Solutions
/Python3/0633-Sum-of-Square-Numbers/soln.py
247
3.546875
4
class Solution: def judgeSquareSum(self, c): """ :type c: int :rtype: bool """ squares = set(num * num for num in range(int(math.sqrt(c)) + 1)) return any(c - num in squares for num in squares)
f34f9b302e95809e621bbba2f6f74fa4a623fed3
hahahardik/Python-Mini-Projects
/HelloWorld/test_name_function.py
622
3.5625
4
import unittest from name_function import get_formatted_name class NamesTestCase(unittest.TestCase): """Tests for name_function.py""" def test_first_last_name(self): """Do names like 'Janis Joplin' work?""" formatted_name = get_formatted_name('janis', 'joplin') self.assert...
e1c7047f811448d7bb7b3b7a8fe220c29c566f2d
parastooveisi/ProgrammingExercises
/reversedString/reversedstring.py
156
4.09375
4
def reversedstring(inputstr): result = "" for char in inputstr: result = char + result return result print(reversedstring('dbfjbc'))
357f0e0789e054acd64b70e3b604bf5e7debfb64
jhwendang/learn_python
/day07/课程/继承.py
8,354
4.5
4
#!/usr/bin/python # -*- coding:utf-8 -*- # #什么是继承:一种创建新的类的方式 # class ParentClass1: # pass # class ParentClass2: # pass # # class SubClass1(ParentClass1): # pass # class SubClass2(ParentClass1,ParentClass2): # pass # # print(SubClass1.__bases__) # print(SubClass2.__bases__) # #python2中类分为:新式类与经典类 # cl...
e3d380c72ca397fa85ec25a978aae8293ee243d4
Laavanya-Agarwal/Python-C4
/Making Classes/membersOfClub.py
1,550
4.15625
4
# class class memberOfClub(object): # all the properties of the object def __init__(self, name, gender, yearBornIn, age, yearsParticipated, section): self.name = name self.gender = gender self.yearBornIn = yearBornIn self.age = age self.yearsParticipated = yearsParticipat...
fad2656325fcaec2eaaf59c607922c9c3dde0ebe
litded/lessons
/Py2-Lec1-2/Lec6/main.py
755
4.1875
4
""" Пример простейшего класса """ class Book: title = "" author = "" def read(self): """ Метод выводит на консоль факт того, что эту книгу читают """ print("Now I'm reading book with title:", self.title, "and author:", self.author) def get_title(self): """ ...
8e0a87cf668c01f7e342aca1bfe61d0e0c8a9f9f
Srubens/calculator-py
/calculator.py
3,082
3.984375
4
from tkinter import * window = Tk() window.title("Calculator") i = 0 #ENTRADA DE TEXTO text_entry = Entry(window, font= ("Montserrat 20")) text_entry.grid(row= 0, column= 0, columnspan= 4, padx= 5, pady= 5) def click_btn(value): global i text_entry.insert(i, value) i += 1 def remove(): text_entry....
1341a25b66201da76a7d7d58d3d74af341b8ebbc
Eric-Wonbin-Sang/CS110Manager
/2020F_hw6_submissions/madireddysaumit/Date.py
867
4.375
4
#Saumit Madireddy #I pledge my honor that I have abided by the Stevens Honor System. def main(): is_correct = True months_with_31_days = [1, 3, 5, 7, 8, 10, 12] date = input("Enter a date in the month/day/year format (xx/xx/xxxx): ") date_list = date.split("/") if len(date_list) !=3: is_c...
f5ec7e2dd58b9336d6b6b6b14cac9694b7ef41a7
wreyesus/Python
/for statement.py
242
3.609375
4
#store monthly expences in a list and find out total expences for all months exp = [2340, 2500, 6500, 4322, 2500] #total = exp[0] + exp[1] + exp[2] + exp[3] + exp[4] total = 0 for item in exp: total = total + item print(total)
235041064baaf8ce23552eb22608b3445ee22307
jvcalassio/artificial-intelligence-intro
/classifiers.py
3,680
3.84375
4
import numpy as np from sklearn.tree import DecisionTreeClassifier from sklearn.base import BaseEstimator, ClassifierMixin # Implementacao do classificador de K vizinhos mais proximos (K Nearest Neighbors) class KNN_Classifier(): def __init__(self, X_train, y_train, K = 3): self.x, self.y = ...