max_stars_repo_path
null
max_stars_repo_name
null
max_stars_count
null
id
null
text
string
score
float64
int_score
int64
from
string
blob_id
string
repo_name
string
path
string
length_bytes
int64
null
null
null
null
from datetime import datetime from collections import OrderedDict, defaultdict import sys import os import re class MonthData(object): ''' A class to store the weather stats for a month. ''' def __init__(self, month, max_temps, min_temps, avg_temps, precips): ''' INPUT: - m...
4
4
smollm
c03dcd7fa9c05bb8df73686e81776276f08cd1f3
brityboy/python-workshop
/day4/src/weather.py
8,100
null
null
null
null
#!/usr/bin/env python3 """ A little script that follows the Wim Hof Breathing method. Usage: ./wimhof -h [short_breaths] [long_breath_hold] [total_rounds] Pretty much follows the following video: https://www.youtube.com/watch?v=tybOi4hjZFQ Date: 2021-07-19 To do: Make pretty To do: Press a key to end the long_breath_...
3.75
4
smollm
7a7a54e9925bcaae3ccbe5d292c6208b96679e70
cseanburns/sysadmin
/usr/wimhof
3,499
null
null
null
null
#!/usr/bin/env python3 #This script gets tweets for a user off the twitter api and writes csvs #I thought I was cool and called it a scraper #It was originally in the scraping folder--this is a copy #I have since learned better #it runs from the command line with argument "candidate name" # "account_name" "twitter us...
3.59375
4
smollm
9ff365cbaab69a4cb3ac3c5ae4b14b2aa9e1636c
Sarah-HP/ed-elect
/scripts/t_scraper.py
2,777
null
null
null
null
from nltk.corpus import words from trie import Trie class Solver: """Boggle board solver""" MIN_WORD_LENGTH = 3 def __init__(self): self.dictionary = Trie() for word in words.words(): self.dictionary.insert(word) def solve(self, board): """Solve boggle board with...
3.703125
4
smollm
579338ee55ce8de2036c49037b3097d05257c840
cloverb/boggle-solver
/solver.py
1,323
null
null
null
null
from random import randint a = [] #definiramo dve listi a in b b = [] def odstrani_dvojnike(a): for x in a: #preglej vsa stevila, ki jih imas v listi a if x not in b: #Vsa stevila, x, ki so v listi a, ni pa jih SE v listi b.. b.append(x) #...dodaj listi b. V listo b gre zato iz liste a samo...
3.640625
4
smollm
106b371021f12dcc5cc9f9fa90935164f373a555
miranas/python
/loto.py
821
null
null
null
null
import math n = float(input('Digite um valor:')) print('A parte inteira desse número é {}.'.format((math.floor(n))))
3.96875
4
smollm
2e75096fd408036ce2caf90f4a6999c80ea9cce2
brunpersilva/python-treino2
/ex15.py
119
null
null
null
null
# Iterating through a string Using List Comprehension h_letters = [ letter for letter in 'human' ] print( h_letters)
3.984375
4
smollm
a8bbda691700710a0d9b57c21b7ecdf344cf110e
Shivanshgarg-india/pythonprogramming-day-3
/list comprehesion/qwestion 1.py
120
null
null
null
null
# Count the number of spaces in a string string='my name is shivansh ' answer = len([char for char in string if char == " "])
3.875
4
smollm
74d05b86a8a9a8dd4131fb49076254be12992b57
Shivanshgarg-india/pythonprogramming-day-3
/list comprehesion/question 4.py
127
null
null
null
null
# Given a non-empty, singly linked list with head node head, return a middle node of linked list. # If there are two middle nodes, return the second middle node. # Input: [1,2,3,4,5] # Output: Node 3 from this list (Serialization: [3,4,5]) # The returned node has value 3. (The judge's serialization of this node is ...
4.03125
4
smollm
e64b57c6055a7f743fc81fd565203f288f0e21fc
yangjiao2/leetcode-playground
/_book/linked_list/r1_middle-of-linked-list.py
963
null
null
null
null
# In a binary tree, the root node is at depth 0, and children of each depth k node are at depth k+1. # Two nodes of a binary tree are cousins if they have the same depth, but have different parents. # We are given the root of a binary tree with unique values, and the values x and y of two different nodes in the tree. #...
4.03125
4
smollm
302c6ec141f43334158abcb8a7d78708e0bd54f5
yangjiao2/leetcode-playground
/search/cousins_in_bt.py
1,266
null
null
null
null
## EJECRCICIO ## Hacer una función que reciba un año como argumento y retorne ## verdadero si es bisiesto from os import system def is_lead_year(year): return ( (year % 4 == 0 and year % 100 != 0) or year % 400 == 0 ) while True: print("EJERCICIO # 3") print("Consultor de año bisiesto") print("------------------...
3.90625
4
smollm
d6282f2cacd704337f379897683013e6fa18148b
linaresdev/cursoPY3
/src/practicing/job3/ejercicio_3.py
679
null
null
null
null
## EJERCICIO # 5 ## Un número palindrómico se lee igual en ambos sentidos. ## El palíndromo más grande hecho del producto de dos números ## de 2 dígitos es 9009 = 91 × 99. Cree una función que encuentre ## el palíndromo más grande hecho del producto de dos números de ## 3 dígitos. from os import system def is_pali...
4.09375
4
smollm
82cc746c64064c79077056d5710d3af40ce009f1
linaresdev/cursoPY3
/src/practicing/job3/ejercicio_5.py
859
null
null
null
null
#!/usr/bin/python3 #-*- coding: utf-8 -*- import sqlite3 class Db(): db = None query = None def __init__(self): self.db = sqlite3.connect("sqlite3/agenda.db") self.query = self.db.cursor() def insert(self, data): SQL = """ INSERT INTO contacts(firstname, lastname, email, phone) VALUES (?,...
3.65625
4
smollm
91e723b564d24d180e27737a663d9a1c5af72a0a
linaresdev/cursoPY3
/src/practicing/app/src/core/Database.py
1,654
null
null
null
null
# Realizar un programa que solicite 4 notas por teclado, la promedie y responda las siguientes preguntas: # Es Sumacumlauder? # Es Magnacumlauder? # Es Cumlauder? # Es ChepaCumlauder? N1 = float(input("Intrudusca la primera nota:")) N2 = float(input("Intrudusca la segunda nota:")) N3 = float(input("Intrudusca la terce...
3.65625
4
smollm
e9b3fde5e8956b59d12587e1c11c1292e631c765
linaresdev/cursoPY3
/src/practicing/job1/item_5.py
641
null
null
null
null
#BMI-meassurer.py def main(): weight = int(input("Write your weight in pounds: ")) height = int(input("Write your height in inches: ")) BMI = (weight * 720) / height**2 if BMI < 19: print("You are really thin") elif 19>= BMI <=25: print("Super healthy") ...
4.03125
4
smollm
46346e17a52880f97396d0c4d54a24cc50c0c804
Smrcekd/HW070172
/L05/Chapter 7/convert2.py
386
null
null
null
null
# Calculator # simple calculator # by David Smrček def main(): print("This is a simple calculator") for i in range(100): x = eval(input("Type in your calculations: ")) y = x print("=", y) main()
3.90625
4
smollm
daa6300817469ea4005fa8cb490e8f4ef63503fe
Smrcekd/HW070172
/L03/Excersise 12.py
210
null
null
null
null
#Examscore_to_grade_convertor.py #by David Smrček def main(): credit = int(input("How many credits did you get: ")) if credit < 7 : print("Freshman") elif 6< credit <16: print("Junior") elif 16 <= credit <26: print("Junior") elif 26 <= grade: print("S...
4.0625
4
smollm
63977f1f746a0131163e0e2e0f6b2e82124be319
Smrcekd/HW070172
/L05/Chapter 7/excersise 4.py
345
null
null
null
null
# Program to calculate the volume and surface area of a sphere # From its radius # by David Smrček import math #Makes the math library available. def main(): r = eval(input("Please enter a radius of the sphere: ")) pi = 3.14159265359 V = (4/3) * pi * (r**3) A = 4 * pi * (r**2) print("...
4.5625
5
smollm
9754d658c5cffdab915aea7a1cd17e45ab15b3dc
Smrcekd/HW070172
/L04/Chapter 3/Excersise 1.py
409
null
null
null
null
# File: chaos.py # A simple program illustrating chaotic behaviour def main(): print( "This program illustrates a chaotic function") n = eval(input("How many numbers should I print?")) x1 = eval(input("Enter a number between 0 and 1: ")) x2 = eval(input("Enter another number between 0 and 1: ")) f...
4.25
4
smollm
5e139fee959f0d301b1ed722795f87d911ff108c
Smrcekd/HW070172
/L02/Programming_Excersise_7.py
460
null
null
null
null
#Easter2.py def Easter(year): if 1982 <= year <= 2018: a = year % 19 b = year % 4 c = year % 7 d = (19 * a + 24) % 30 e = (2 * b + 4 * c + 6 * d + 5) % 7 if (d + e) > 9: print("Easter will be on April {}.".format(d + e - 9)) else: ...
4.09375
4
smollm
610649c6b2f21593e76bbdafe6f00f4514958a34
Smrcekd/HW070172
/L05/Chapter 7/excersise 9.py
555
null
null
null
null
# Fibonacci sequence # by David Smrček import math#Makes the math library available. def main(): n = eval(input("Insert number from Fibbonaci sequence: ")) x = 1 result = 0 for i in range (n+1): F = x + result x = result result = F prin...
4.21875
4
smollm
0fabb921151302f0d2c9b150b7ff74403507fc97
Smrcekd/HW070172
/L04/Chapter 3/Excersise 16.py
379
null
null
null
null
from tkinter import * from PIL import ImageTk,Image root = Tk() root.title("Moe's PhotogrammePi") #Define preview pane in Root frame=LabelFrame(root, text="Preview Pane", padx=50, pady=50) #Create Preview Pane in root frame.pack(padx=10, pady=10) #Create Image img = ImageTk.PhotoImage(Image.open('images/download.jp...
3.609375
4
smollm
cc4290b89387dbeec3836f0a8ff7e432198e0e09
Mpartee123/Moes-PhotogrammePi
/gui.py
447
null
null
null
null
from Directions import Directions import numpy as np class Snake: def __init__(self,rows,cols): self.directions = Directions() # Body Locations self.head = [int(cols/2),int(rows/2)] self.bodyLocations = [[int(cols/2),int(rows/2+1)]]#,[int(cols/2),int(rows/2+2)],[int(cols/2),int(row...
3.5
4
smollm
a882ce99dd637a41940f88533833e6c430922d6f
willluer/SnakeAI
/Snake/Snake.py
1,201
null
null
null
null
# -*- coding: utf-8 -*- # @Author: emlslxl # @Date: 2016-09-27 14:30:03 # @Last Modified by: emlslxl # @Last Modified time: 2016-09-27 15:01:47 class People(object): """docstring for People""" def __init__(self, n,a,w): super(People, self).__init__() self.name = n self.age = a self.__weight = w #私有属性 na...
3.828125
4
smollm
a4c42ebb4d5af6a06079b0710835e7604ff3f088
emlslxl/myPython3
/class/student.py
811
null
null
null
null
#!usr/bin/env python # encoding:utf-8 def func1(one_list): return list(set(one_list)) def func2(one_list): return {}.fromkeys(one_list).keys() def func3(one_list): temp_list=[] for one in one_list: if one not in temp_list: temp_list.append(one) return temp_list def ...
3.828125
4
smollm
56f81dfc2b32c331637f157b54abfca6a7744daf
BoyOoka/Python36
/去重.py
764
null
null
null
null
def mySort(list): newList = [] for i in range(len(list)): j = i # print(list[i]) while j < len(list): j += 1 if(j == len(list)): break if(list[i]>list[j]): temp = list[i] list[i] = list[j] ...
3.875
4
smollm
7703932876ba24006dba5b5a716c2e4cf5835ea5
BoyOoka/Python36
/homework.py
491
null
null
null
null
# Import random module import random print( 'Welcome to Stone - Paper - Scissor Game') # Input no. of rounds n = int(input('Enter number of rounds: ')) # List containing option options = ['st', 'p', 'sc'] # Round numbers rounds = 1 # Count of computer wins comp_win = 0 # Count of player wins ...
4.15625
4
smollm
abef93b79c4de0af80e2673a14dbeb4fc11f5ab1
Yashg4824/Stone-paper-scissor-game-
/main_game02.py
1,602
null
null
null
null
import sys from matplotlib import pyplot as plt TURN_LEFT, TURN_RIGHT, TURN_NONE = (1, -1, 0) # # python3.5 does not supports CMP function. # def turn(p, q, r): # """Returns -1, 0, 1 if p,q,r forms a right, straight, or left turn.""" # return cmp((q[0] - p[0])*(r[1] - p[1]) - (r[0] - p[0])*(q[1] - p[1]), 0) ...
3.703125
4
smollm
da33e8ab5e88d7d8f94fc850605bc44612d2ee7c
neiterman21/Computational_Geometry
/hw3/Shortest_Homotopic_Curve - don't use.py
7,172
null
null
null
null
n=int(input()) for i in range(1,n): for j in range(1,i+1): print(i,end="") print() print("In Mouzzam branch:") print("New change in Mouzzam Branch")
3.5625
4
smollm
dbaeed85fdb27ef175d0a17b7012c4b8b8edf00c
Mouzzamsddq/gitLearningRepo
/Triangle_quest.py
169
null
null
null
null
#!/usr/bin/env python # -*- coding:utf-8 -*- class Person: def __init__(self,name,age,weight): self.Name = name self.Age = age self.Weight = weight def jianshen(self): ''' 健身 体重 -1 :return: ''' self.Weight -= 1 def chi(self): ''' ...
3.59375
4
smollm
e590acde2c932da48a211753b168731b80ce4eae
w1033834071/qz2
/oldboy/面向对象/s3.py
635
null
null
null
null
#!/usr/bin/env python # -*- coding:utf-8 -*- class Provice: country = "中国" def __init__(self,name): self.name = name def show(self): print("show") @staticmethod # 静态方法和对象没有关系 def xo(): print("xo") @classmethod def xxoo(cls): # 比静态方法多了一个类参数 print("xx...
3.578125
4
smollm
4012abbce5354893ec418b01fd15a76880e6ddad
w1033834071/qz2
/oldboy/面向对象/静态方法.py
933
null
null
null
null
#!/usr/bin/env python # -*- coding:utf-8 -* import re #正则表达式 # 1,元字符 # . 表示除换行符外的任意字符都可匹配 # ^ 表示开头是否以xxx开头 # r = re.findall('^alex','alex is SB') # print(r) # $ 表示是否以xxx结尾 # r = re.findall('alex$','hello alex') # print(r) # * + ? { } 处理‘重复’的字符 # ‘*’ 表示‘x’出现0次或多次 此处为‘贪婪匹配’ # r = re.findall('alex*','alexxxxxxxx'...
3.5
4
smollm
e62982ff6ba2ee0637c9a0e8360d9f84f5db65af
w1033834071/qz2
/oldboy/day09/正则表达式.py
1,247
null
null
null
null
#!/usr/bin/env python # -*- coding:utf-8 -*- import re origin = "hello alex abcd 123" r = re.split('a\w+',origin,maxsplit=1) # 加个括号表示分组 所有结果 + 分组得到的结果 r1 = re.split('(a\w+)',origin,maxsplit=1) print(r) print(r1) s = "1+1+(1*(1+2) + (2-1)) + 3+(1+(1+1))" ret = re.split('\(([^()]+)\)',s) print(ret)
3.84375
4
smollm
f01da9ac0cd5001a75a72636ed5ff85252b4d5fb
w1033834071/qz2
/oldboy/正则表达式/split_module.py
341
null
null
null
null
color = [0, 0.23290921294379985, 0.26243082354374625, 0] print( round(color[0] * 100) ) print( round(color[1] * 100) ) print( round(color[2] * 100) ) print( round(color[3] * 100) ) # C:0 M:23 Y:26 K:0 # x = a # x = a + b # x = a + b + c # OR # x = a # x += b # x += c # Turn the color list into a string colorName = ...
3.515625
4
smollm
e5461e84de72034b5a327ca19d539d04332281d0
mttymtt/DrawBot-Sketchbook
/Classes/Andy-Clymer/2019-07-09/07_iadd.py
518
null
null
null
null
# -------------------------------------- # display() # Returns string # defualts to 1000 digits def en(*argv): dict = { "Fox": "The quick brown fox jumps over the lazy dog.", "Wizards": "Grumpy wizards make toxic brew for the evil Queen and Jack.", "Waltz": "Jived fox nymph grabs q...
3.828125
4
smollm
3c128f666f5d366e18596b6a882cbb9a71bbb2d0
mttymtt/DrawBot-Sketchbook
/Proofing/automated_proofs_01/proofbot/pangrams.py
1,041
null
null
null
null
# !/usr/bin/env python3 # -*- coding: utf-8 -*- import sys import string if __name__ == '__main__': in_text = str(input("Введите строку хотя ы с одной запятой> ")) if in_text.count(',') == 0: print("Запятых нет, а смысл тогда в этом модуле???", file=sys.stderr) exit(1) temp_a = in_text.fi...
3.859375
4
smollm
21c8bb969364014af1369602672c23eac092f838
JiJibrto/lab_rab_5
/individual/individual_2.py
537
null
null
null
null
def digitizing(given_array): digit = 0 for i, value in enumerate(given_array[::-1]): digit += (value * pow(10, i)) return digit def listing(digit): digit_to_list = [] while (digit): remaining = digit % 10 digit = digit // 10 digit_to_list.append(remaining) re...
4
4
smollm
147238cc36346006f2d9d253cefe79f6d803986c
youngkiu/google
/list_digit/list_digit.py
721
null
null
null
null
#Accepts positive integer n and returns sorted list in ascending order #of all prime numbers between 2 and n but not including 2 and n. #A prime number is a number that has no other divisors except 1 and itself def list_of_primes(input_number):
3.59375
4
smollm
a23abbbae7451d4203e55aa594aa4f4d1403a2ad
a-jennings/EDX_Midterm
/EX4.py
246
null
null
null
null
# Import modules from tkinter import * from tkinter import messagebox # Method length() def length(): # Inches to Centimeters def ic(): l1 = Tk() l1.title("Inches to Centimeters") l1.resizable(0,0) l1.minsize(height="300",width="500") l1.config(bg="orange...
3.8125
4
smollm
c57595a801f7fea8b1321cb3f0a5afb66a1f1780
Abhishek-5harma/unit_converter
/ConvertsEasy.py
50,741
null
null
null
null
# Evaluate postfix expression using a stack # Create stack to store operands (values) # Scan expression and do followiing... # 1. Number, push onto stack # 2. Operator, Pop operands from stack, eval operator, and push back onto the stack from collections import deque class Postfix: # Constructor to init stack ...
4.0625
4
smollm
1a8b0e6f682bf9a597338f4dced5997c39488a81
Wmeng98/Leetcode
/D&A Prep/Stacks/stacks.py
2,463
null
null
null
null
''' Trees - Root node, child nodes, etc. - Tree cannot contain cycles ''' ''' ### Tree vs. Binary Tree - binary tree: each node has up to 2 children ### Binary Search Tree - binary tree in which every node fits a specific ordering property - (one def'n) all left descendents <= n < all right descendents ...
4.03125
4
smollm
9bd121612b05bd9193d0cf87a80683aea97f8efd
Wmeng98/Leetcode
/CTCI/Data Structures/Trees/ctci_notes.py
6,677
null
null
null
null
''' [Hash Tables] Simple Implementation Array of linked lists and a hash code function To insert a key: 1. Compute the keys hash code, 2 diff keys can have same hash, can have infinite # keys and limited ints 2. Map hash code to an index in the array [hash(key) % array_length] 3. Store...
3.5625
4
smollm
24147b9b446f0eff3013c4410d835f7fa7cb6890
Wmeng98/Leetcode
/CTCI/Data Structures/Hash Tables and Strings/notes.py
1,429
null
null
null
null
# [DETECT LOOP IN A LINKED LIST] ''' Can use hash map - linear space Modify the nodes with a flag Floyd's Cycle-Finding Algorithm -> Fastest method ''' def cycleDetection(head): # slow and fast pointers slow = head fast = head while slow and fast and fast.next: slow = slow.next fast...
3.9375
4
smollm
e4616f9c58deb3862d0ff150e8b71ceb24d04148
Wmeng98/Leetcode
/Medium/cycle_detection_II.py
1,578
null
null
null
null
# Time: O(N+M) # Space: O(min(N,M)) def find_duplicates_non_optimized(arr1, arr2): p1 = set(arr1) # O(N) output = [] # O(Min(M,N)) for p in arr2: if p in p1: output.append(p) # output return output def binary_search(arr, val): low = 0 high = len(arr) - 1 while low <= high: ...
3.75
4
smollm
c29264e2b0aa0b630c81efe93d5c62eddb8ddbcb
Wmeng98/Leetcode
/D&A Prep/Arrays/pramp_find_duplicates.py
1,085
null
null
null
null
''' Bellman Ford's Algorithm * Single source shortest path algorithm WITH negative edges and negative cycles * Similar to Djikstra but works on negative edge weights Negative Cycle (diff from negative edge weights) * A path/cycle where total sum of edge weights in the path is negative * Therefore, can circle...
4.09375
4
smollm
16efc8b039ff88cd8b6a9e4be0600b4a279c930c
Wmeng98/Leetcode
/CTCI/Data Structures/Graphs/bellman_ford.py
3,392
null
null
null
null
f = open("part1input.txt") contents = f.read() floor = 0 for i, v in enumerate(contents): if floor == -1: print("Santa enters basement at " + str(i)) break if v == '(': floor = floor + 1 elif v == ')': floor = floor - 1
3.59375
4
smollm
a70ad95130b3e0af1f3834b49693d17ee36cd62e
Reprevise/advent_code
/2015/day1/part2.py
266
null
null
null
null
class Animal(object): def __init__(self,sound,name,age,favorite_color): self.sound = sound self.name = name self.age = age self.favorite_color = favorite_color def eat(self,food): print("Yummy!!" + self.name + " is eating " + food) def description(self): print(self.name + " is " + self.age + " years old ...
3.765625
4
smollm
4570e351da11d4b24ebdea63751983402d86141c
layan21-meet/meetyl1
/animal.py
542
null
null
null
null
# -*- coding: utf-8 -*- """ This is a script to create a small dataset (small.csv) and convert data into csv format with datetime """ import pandas as pd, numpy as np print("Reading data") data = pd.read_csv("../data/flickr-growth-sorted.txt", delim_whitespace = True) print("Renaming columns") data.columns = ['From...
3.796875
4
smollm
3b88ead37faa932cb5db4290e9d203f15ff11a02
blanked/BigData
/scripts/cleaning.py
666
null
null
null
null
from operator import attrgetter class Movie(): ''' Defines this class instance variables (for modeling movies) while storing pointers to every instance of Movies in a list upon construction. Lastly, sorts said list alphabetically.''' def __init__(self, title, story, image, trailer, list): se...
3.8125
4
smollm
8dacd845db9d0e2be29e2358789d87c5a9f24166
mejnour/udacity-fresh-tomatoes
/media.py
549
null
null
null
null
# group0 = [] # # num = input("Enter how many elements you want:") # print('Enter numbers in array: ') # for i in range(int(num)): # n = input("num :") # group0.append(float(n)) # # print(*group0) group0 = [10.75, 26.5, 28.75, 18.25, 18.5, 21.25, 31.25, 20.5, 23.5, 23.75] group0.sort() group1 = list() while ...
3.5
4
smollm
a9f62978a70067fec33855b59b259a1d281306e8
SybelBlue/SybelBlue
/main/NumberSorter.py
1,003
null
null
null
null
from functools import reduce from turtle import * # for turtle graphics # Syntax Rules """ Basic Syntax Rules -------------------- Must be capital letter or digit. May be followed by subscript in LaTeX notation (X'_'{SUB}). Subscripts may be any string of characters. Only Single variables may be on the left of the...
3.625
4
smollm
dd596f217a629a13671f04482dd33f382a358868
SybelBlue/SybelBlue
/main/ConnBeyond/LSystemInterpreter1.0.py
8,790
null
null
null
null
n1=int(input("Enter any number ")) n2=int(input("Enter any number ")) sum=n1+n2 print("Sum = ",sum) print("Bye")
3.8125
4
smollm
c9d24064f7a00aeb0dfc5a85efd893418307ca68
SetuParmar/Lets-Learn-Git
/sum.py
112
null
null
null
null
from src.Calculadora import Calculadora def main(): numero = str(input('Informe o primeiro número: ')) numero2 = str(input('Informe o segundo número: ')) calc = Calculadora(numero, numero2) base = 0 # 1-Decimal/Binario | 2=Decimal/Hexadecimal | 3-Decimal/Octal | 4-Binario/Decimal | 5-Hexadecimal/De...
4.0625
4
smollm
dd2946cc2b00ff4bda9e09e797af5bb08f3f8a49
Pietro-Tomelin/Calculadora
/src/TestaCalculadora.py
3,586
null
null
null
null
from collections import Counter, defaultdict from math import floor import string def easy(s): n = len(s) a = Counter(s) b = [x[0] for x in a.items() if x[1] > (n // 2)] print([idx for idx, x in enumerate(s) if x in b]) def keypad_string(keys): """ Given a string consisting of 0-9, find the ...
3.59375
4
smollm
5e888752cac6b34a453949cd6b9f6dca2c62a8b0
victordity/PythonExercises
/PythonInterview/interviewQuestions.py
1,623
null
null
null
null
#******PROJECT THE CAR****** #...Our Messages... started = 'Car Engine ON! Ready to go.' stopped = 'Engine Stopped.' error = "Uh... i don't understand that. Try 'help'" exit = 'Hope to see you soon.' help = """Instructions: start - To start the car. stop - To stop the car. help - To display this message. quit/exit - T...
4.09375
4
smollm
48e0bedabb0a917d0f732cbd7974f8f1edf70a63
justdharmik/Python-Things
/2. The Car Engine.py
1,078
null
null
null
null
import string, random def random_string(length): return ''.join([random.choice(string.ascii_lowercase + string.ascii_uppercase) for _x in range(length)]) def to_int(input_string): combo = string.ascii_lowercase + string.ascii_uppercase output = 0 for l, c in zip(input_string, range(len(input_string)))...
3.671875
4
smollm
0f8e2935387d99911ae827bd17cdf842914f0362
nbtm-sh/nbdl
/bot/urlgen.py
422
null
null
null
null
input = [3, 2, 4] target = 6 def twoSum(nums, target): """ :type nums: List[int] :type target: int :rtype: List[int] """ raise Exception("xxxx") input.index() i = 0 for num in nums: j = i + 1 for twoNum in nums[i, :]: if num + twoNum == target: ...
3.671875
4
smollm
4c14819285e2507fc7db8a8b973fd856e493b6b9
space0o0/tensorflow_learn
/tensorflow_learn/date_1107/e4.py
437
null
null
null
null
from urllib.request import urlopen from bs4 import BeautifulSoup # Tool to Handle Exceptions from urllib.error import HTTPError # --- urlopen examle --- #resp = urlopen('http://pythonscraping.com/pages/page1.html') #print(resp.read()) # bs4 takes the file object created by urlopen() and # can output without needing...
3.734375
4
smollm
6fdfffe0188084c8ab395a01f5a8708c6d9e0a99
taycurran/RyMitchell
/chpt1/scrapetest.py
906
null
null
null
null
class User(object): def __init__(self, name, email): self.name = name self.email = email self.books = {} def get_email(self): return self.email def change_email(self, address): self.email = address print("The user's email address has been changed.") def...
3.9375
4
smollm
65f92e30d984aebf4945a10a5538aab19a79b65f
jasoncabungcal/pwp-capstones
/TomeRater/TomeRater.py
6,395
null
null
null
null
#! /usr/bin/python # This program calculate the minimum fixed monthly payment needed in order to pay off a credit # card balance within 12 months. # Inputs: # balance: the outstanding balance on credit card # annualInterestRate: annual interest rate as a decimal def calculateDebtOffInAnYear(): balance = raw_input('Ou...
4.34375
4
smollm
9c6c0f7ffb0856908076937a8cd224590a814fda
loide/MITx-6.00.1x
/calculateDebtOffInAnYear.py
910
null
null
null
null
from urllib import request, error class Download: def __init__(self, url='', verbose=False, timeout=5): self.url = url self.verbose = verbose self.html = '' self.error = False self.timeout = timeout def download(self, user_agent='wswp', num_retries=2): # self.h...
3.546875
4
smollm
373a3aa308052bfe328c39912974ba3c72a9f121
Rahul-Khetan/AbPyTools
/abpytools/utils/downloads.py
2,159
null
null
null
null
def addNumber(x, y): print(x + y) def minusNumber(x, y): print(x - y) def multiplyNumber(x, y): print(x * y) def diviveNumber(x, y): print(x / y) addNumber(10, 2) minusNumber(10, 2) multiplyNumber(10, 2) diviveNumber(10, 2)
3.75
4
smollm
39fb54c9c7a73089850005a6c57ae40f3069d9e5
zupph/CP3-Supachai-Khaokaew
/Lecture50_Supachai_K.py
240
null
null
null
null
number = int(input("Please enter number : ")) star = 1 for i in range(number): print(" " * (number - i) + "*" * star) star = star + 2
4.09375
4
smollm
7f6573db27721aa9722eb2d07a4a9a0ed0cda915
zupph/CP3-Supachai-Khaokaew
/Exercise11_Supachai_K.py
141
null
null
null
null
n1 = float(input("Informe o primeiro valor: ")) n2 = float(input("Informe o segundo valor: ")) n1, n2 = n2, n1 print(n1, n2)
3.71875
4
smollm
f78a186ae86966bb5863df3db1f37e884fda9ad1
valeriacavalcanti/IP-2019.1
/Lista 01/lista_01_questao_08.py
124
null
null
null
null
from fractions import Fraction from json import load def sum(arg): total = 0 if isinstance(arg, int) or isinstance(arg, float): return 'Sum requires at least 2 variables' for val in arg: if isinstance(val, int) or isinstance(val, float) or isinstance(val, Fraction): total += val else: raise TypeError ...
3.671875
4
smollm
e2ed9bafa4e181aafc162cf1e5019e8b4e9eca58
SpencerOfwiti/software-testing
/sum/__init__.py
530
null
null
null
null
import unittest from ..primes import is_prime class PrimesTestCase(unittest.TestCase): """ Tests for primes """ def test_is_five_prime(self): """ Is five correctly determined to be prime :return: """ self.assertTrue(is_prime(5)) def test_is_string_prime(self): """ Is an error raised when string is...
4.09375
4
smollm
7ab24a490776d9e9f644bb311b93c3e6c8b5552f
SpencerOfwiti/software-testing
/prime/tests/test_prime.py
906
null
null
null
null
def is_palindrome(text): text = text.lower().strip('?') text = text.replace(' ', '') reverse = ''.join(reversed(text)) if reverse == text: return True return False
4.03125
4
smollm
b231c4e7e4e068642a10cb60dea24b5e3dc6aa95
SpencerOfwiti/software-testing
/palindrome/palindrome.py
171
null
null
null
null
import pandas as pd from sklearn.model_selection import train_test_split def split_stratified_into_train_val_test(df_input, y, frac_train=0.6, frac_val=0.15, frac_test=0.25, random_state=None): ''' Splits a Pandas dataframe into ...
4.03125
4
smollm
facacbe17cb570dc7b1041583b23a535e3cdfb58
flashjames/refundr-mmf
/mmf/datasets/builders/custom/splitter.py
3,325
null
null
null
null
# -*- coding: utf-8 -*- """ Created on Fri Aug 23 12:00:36 2019 @author: adars """ # abcdef def isIn(char, aStr): if len(aStr) == 0: return False elif len(aStr) == 1: return aStr[0] == char elif len(aStr) > 1: ub = len(aStr) lb = 0 mid = (u...
3.59375
4
smollm
b25aec565808881b45b1c3aa7c2f4755acafda41
AdarshNamdev/Python-Practice-Files
/isIn-Recusion.py
754
null
null
null
null
class pwskills(object): def __init__(self,price, name): self.__course_price = price self.__discount = 0.0 self.name = name @property def course_price(self): self.__course_price = self.__course_price - (self.__course_price * (self.__discount/100)) return f"course pric...
3.65625
4
smollm
7a8bd7ac4df1e7f23830127afcb86c5c1968ce0f
AdarshNamdev/Python-Practice-Files
/@property_getter_setter.py
1,076
null
null
null
null
# -*- coding: utf-8 -*- """ Created on Thu Mar 4 16:56:11 2021 @author: adarsh """ from random import randint class EmployeeOnboarding(object): def __init__(self, PAN, fname, lname, phone= "", personalemail= ""): self.PAN = str.strip(PAN) self.fname = str.strip(fname) self.lname = str.st...
3.859375
4
smollm
ca19a586d10660438b5ac9c63f69458f10a2940d
AdarshNamdev/Python-Practice-Files
/UtilizingMembersOfAnotherClass-2.py
1,477
null
null
null
null
wordlist = ['HelloBabaSikandar', 'Adarsh', 'MachineLearningEngineer', "qawsedrftgyhujikolpmnbv",'Mississipi', 'June', 'JuniperNetwork', 'MachineLearningEngineer'] largest = wordlist[0] # "Adarsh" second = "" for word in wordlist[1:]: if len(word) >= len(largest): second = largest largest = word...
4.15625
4
smollm
5baaf961158f13147473132a5b0bedd24a9bfcb1
AdarshNamdev/Python-Practice-Files
/Largest_SecondLargest_TheHardWay.py
448
null
null
null
null
# -*- coding: utf-8 -*- """ Spyder Editor """ N = int(input("N: ")) margin = 0.01 LowerBound = 0.0 UpperBound = N guess = (UpperBound + LowerBound)/2.0 while abs(guess**2 - N) >= margin: if guess**2 > N: UpperBound = guess guess = (UpperBound + LowerBound)/2.0 ...
3.734375
4
smollm
b60e461ef406576286f13fd19d57d4e161e2a9bf
AdarshNamdev/Python-Practice-Files
/BisectionSqrt.py
467
null
null
null
null
## Faça um programa que dado o valor da temperatura em graus FARENHEIT, calcular e escrever o valor da temperatura em graus CELSIUS. F = int(input('Insira um valor em graus Farenheit: ')) C = round(5/9 * (F - 32)) print('{:.0f}°'.format(F),'Farenheit é equivalente a', C, 'graus Celsius.')
4.125
4
smollm
ae5a84a44b1bba3b5cf93c32d381cea40fa001ac
MarlonVictor/pyRepo
/Aula01/desafio.py
294
null
null
null
null
## Faça um programa que obtenha um número inteiro digitado pelo usuário, calcule e informe o dobro desse número. input = int(input('Digite um valor: ')) dobro = input * 2 print('O dobro do valor digitado é:', dobro)
4.09375
4
smollm
74a9b1dead4b748ff9c805d6d72eaf275fe17e94
MarlonVictor/pyRepo
/Aula01/ex01.py
222
null
null
null
null
''' Question 1: ----------- The word 'hide': A) Conceal, cover oneself (verb) I) "He hides the money." II) "They found the place where she hides in." B) Pelt, skin (noun) I) "Rhinoceroses have thick hides covering their body" II) "Wearing deer hides for winter" ''' with open('corpus_ex1', '...
4.21875
4
smollm
3db2cd7b278f93955bb491d32e9979fbcbdea5c9
JuneReves/Meaning-and-comp-ex1
/ex1q1update.py
1,709
null
null
null
null
""" По данным n отрезкам необходимо найти множество точек минимального размера, для которого каждый из отрезков содержит хотя бы одну из точек. В первой строке дано число 1≤n≤100 отрезков. Каждая из последующих n строк содержит по два числа 0≤l≤r≤109, задающих начало и конец отрезка. Выведите оптимальное число m т...
3.78125
4
smollm
8f54d6a374f7e5b29fe99fb27b2713a1867b0e33
rerapony/Stepik
/Algorithms/Methods/GreedyAlgorithms/Segments.py
1,085
null
null
null
null
def binary_search(array, element): up = len(array)-1 down = 0 while up>=down: mid = (up+down)//2 if element==array[mid]: return (mid+1) elif element>array[mid]: down = mid+1 else: up = mid-1 return -1 input1, input2 = input().split(), ...
3.9375
4
smollm
ae5ce9806ec32f65702ef1296a70aa3e41d90ad0
rerapony/Stepik
/Algorithms/Methods/DivideAndConquer/BinarySearch.py
522
null
null
null
null
#Short hand if-else a = 2 b = 330 print("A") if a > b else print("B") #B
3.734375
4
smollm
f55a36803231cfc209c118229a51cefb33618bec
anweshachakraborty17/Python_Bootcamp
/P76_Short hand if-else.py
82
null
null
null
null
#Add multiple items to a set thisset = {"apple", "banana", "cherry"} thisset.update(["orange", "mango", "grapes"]) print(thisset) #{'orange', 'apple', 'grapes', 'mango', 'banana', 'cherry'}
3.609375
4
smollm
8e2351dc814933581e409a9551c8553a9267b490
anweshachakraborty17/Python_Bootcamp
/P54_Add multiple items to a set.py
199
null
null
null
null
#Add an Item to a set thisset = {"apple", "banana", "mango"} thisset.add("orange") print(thisset) #{'mango', 'banana', 'orange', 'apple'}
3.625
4
smollm
2eb0db34ac51edde2fe14217e7edd6df1ddff779
anweshachakraborty17/Python_Bootcamp
/P53_Add an Item to a set.py
147
null
null
null
null
#Change tuple item thistuple = ("apple", "banana", "cherry") thistuple[1] = "blackcurrant" # the value is still the same: print(thistuple) #('apple', 'banana', 'cherry')
4.1875
4
smollm
a9f87edc9f20bfd4567301e9c99e849a1bfbea6a
anweshachakraborty17/Python_Bootcamp
/P44_Change tuple item.py
180
null
null
null
null
#Get the Charecter at position 1 of a string a = "Hello, I'm Anwesha." print(a[1]) #e
3.5625
4
smollm
45531aded80774b665276169c28f7cad6c0a7c6f
anweshachakraborty17/Python_Bootcamp
/P15_Charecter at position 1 of a string.py
90
null
null
null
null
#Casting String Example x = str("string1") y = str(2) z = str(1.0) print(x) #string1 print(y) #2 print(z) #1.0
3.78125
4
smollm
6ca8dca84c92b27ae79ac2505be456cc8d84b2ff
anweshachakraborty17/Python_Bootcamp
/P14_Casting String Example.py
120
null
null
null
null
''' #file_path=open("new_text.txt") file_path=open("new_text.txt","r") # read only print(file_path.read()) file_path.close() ''' ''' #file_path=open("new_file.txt","w") # write only file_path=open("new_file.txt","a") # for append only # if we run this file again it will overwrite the file file_path.wri...
3.59375
4
smollm
e96b740cf9bd3b46d9e849b8c9653f6ec0632afc
harsh4251/SimplyPython
/practice/File_obj.py
892
null
null
null
null
def str_reverse(value): return value[::-1] def addition(a,b): return a+b def minus(a,b): return a-b
3.671875
4
smollm
ca71fa6a9f69a5cd8d4ad2170326e3d4f5c8b5d9
harsh4251/SimplyPython
/practice/str_opration.py
114
null
null
null
null
#!/usr/bin/env python3 message = input("Enter a Message: ") print( "Lowercase: ", message.lower()) print( "Uppercase: ", message.upper()) print( "Capitalize: ", message.capitalize()) print( "Titile Case: ", message.title()) words = message.split() print("Words: ", words) sorted_words = sorted(words) print("Alphebet...
3.796875
4
smollm
16ca20fbd5c2745a41d1b02d25b7e1858978e8e3
GianncarloG/ACG---Python-entry-level-labs
/Message Strings
405
null
null
null
null
#Scale from PIL import Image bear = Image.open( "bear.png" ) def scale(im): (width, height) = im.size temp = Image.new('RGB', (width//2,height//2)) for x in range(width): for y in range(height): temp.putpixel((x//2, y//2), im.getpixel((x, y))) return temp minibear = scale(bear) #Calle...
3.5625
4
smollm
26a6f03ddcd3ff59b77a78f425cca21e21a4e67f
UCSD-CSE-SPIS-2021/spis21-lab05-Rena-Zoe
/Scale/scale.py
406
null
null
null
null
list1 = ["Hello", "World", 8, 7] # Length of the list print("Length of String: ", len(list1)) # Create a new list as an element of an existing list print("\nAppeding a Sub List") list1.append(["sub", "list"]) print(list1) # using slice operator print("\nList after slicing: ") print(list1[0:3]) # Replace second elem...
4.53125
5
smollm
c9e795a3f22913e8b47ddf2b7a78a4a7aa6b1a92
kumarhegde76/Scripting-Language
/SL Lab/Programs/Python/py_operation.py
1,011
null
null
null
null
class Rectangle: length=0 breadth=0 def __init__(self,a,b): self.length = a self.breadth = b def Area(self): self.answer = self.length * self.breadth return self.answer obj = Rectangle(8,9) print(obj.Area())
3.75
4
smollm
670e68f46da86a01ffa8098c4087fb5244d15103
kumarhegde76/Scripting-Language
/SL_Final/4/A/4a.py
256
null
null
null
null
mydictionary ={"name":"Archie", "identity":"Student","age":17} print(mydictionary) key=mydictionary["name"] value=mydictionary.get("name") print ("key is ",key) print("Value is",value)
4.125
4
smollm
ff768b0365ee7bbd2878f435123d10e548360ccd
kumarhegde76/Scripting-Language
/SL Lab/Programs/Python/Basic_dict.py
185
null
null
null
null
################################################################################ # PART #1 ################################################################################ # Cooperated with Lucas, Annastasia, Steve, and Marrissa import string import os from os import listdir import csv import json def countWordsUn...
3.9375
4
smollm
7d1710d3a8ffbbcaedc6a673d371a1f301b3e8d3
INFO3401/problem-set-7-HaroldChamg
/parsers.py
7,235
null
null
null
null
import sys def villages(file_path): """ Day 12 | Part 1 & 2 http://adventofcode.com/2017/day/12 Finds how many numbers are connected to 0 Takes a file as argument and creates 'output_121' containing the result for Part 1 and 'output_122' with the result for Part 2 """ villages = {} same_group = set() gro...
3.609375
4
smollm
048f38e260884ec4359c76f36ab11695f8551a9c
stelaseldano/advent_of_code_2017
/12/villages.py
1,254
null
null
null
null
import sys def registers(file_path): """ Day 8 | Part 1 & 2 http://adventofcode.com/2017/day/8 Takes a file as argument and creates 'output_91' containing the result for Part 1 and 'output_92' with the result for Part 2 """ registers = [] # name: value id_value = {} largest_val = 0 largest_val_ever = 0 ...
3.65625
4
smollm
933254ae17d00c0955b5e99861e22799c0984ccd
stelaseldano/advent_of_code_2017
/8/registers.py
2,338
null
null
null
null
#!/usr/bin/env python from neuralnets import Network # Neural network to translate digits 0 to 9 to a binary representation # Initial inputs to the network inputs = [1,0,0,0,0,0,0,0,0,0] # Number of neurons per hidden layer; length is number of hidden layers hidden_layers = [4] # Create a new neural network n = Netw...
4
4
smollm
231436ba81e261e1a650a213addfa49dce9432e5
Nat1405/neural-nets
/tobinary.py
1,592
null
null
null
null
import sys def find_first_n_version1(n): primes = [2] counter = 3 while len(primes) < n: prime = True for i in range(3,counter): if counter % i == 0: prime = False if prime: primes.append(counter) counter += 1 return primes d...
3.6875
4
smollm
4dd408629915050d2b9bffb207124aac7e282970
Cdunkling/122COM_performance
/pre_profiling.py
784
null
null
null
null
import requests from bs4 import BeautifulSoup """ a program to retrieve the number of global as well as US cases of coronavirus. @author Chris Schulz 3/21/2020 """ html_text = requests.get('https://www.worldometers.info/coronavirus/') bs = BeautifulSoup(html_text.text, 'html.parser') global_cases = bs....
3.578125
4
smollm
9bfa17897bec405bc0d2080853cf9637d22fbb5b
chrisschulz131/corona_counter
/how_many_ronas.py
932
null
null
null
null
import random def make_HTML_heading(f):#takes a function (not called yet) txt=f() def inner(): return '<h1>' + txt + '</h1>' return inner#returns a function that does not take variables #equiv to greet=make_HTML_heading(greet) @make_HTML_heading #decorator, becomes part of this thing, ...
3.90625
4
smollm
c3b8fe84026cab47bc84a692ff3838f88ac079b3
qzhou0/SoftDevSpr19WS
/23_memoize/a.py
1,565
null
null
null
null
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ from flask import Flask, request from flask import jsonify app = Flask(__name__) # The Fibonacci function #with app.app_context(): # within this block, current_app points to app. # print(current_app.name) def fibonacci(n:int): ...
3.875
4
smollm
9829af8114855ae85baae91efc9f8d682b877d05
lkothapalli/fibonacci
/main.py
1,140
null
null
null
null
# Calculate length of an arc using radius and degree angle measurement import math from stdutils import prettyFunction, inputAsDict vals = inputAsDict(('d','r')) # Convert degrees to radians vals['ra'] = vals['d']/180 # Calculate arc length vals['len'] = vals['ra']*vals['r'] # Calculations with pi vals['rap'] = vals...
4.0625
4
smollm
d647f5ea50fc3b463586bc8f7c4b1098dd7f56df
hillbs/Trigonometry-Programlets
/arclength_degrees.py
592