blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
3b8a5de036cc2fbd5f92d996a798e2db5f273d02
erduin17/python
/binarystring.py
485
3.875
4
#binarysting.py em def bincon(decimal): print("BINARY\n") print(decimal) binstr="" for i in range(8): bin = decimal % 2 binstr = binstr + str(bin) decimal = decimal // 2 print (bin) print(binstr)[::-1] def main(): print("INPUT A -1 TO THE EXIT THE LOOP ") pri...
3495e4570b058b804b4617b570f933f150302624
dritancelafr/Wager
/WagerBrain/odds.py
3,289
3.703125
4
from fractions import Fraction from math import gcd import numpy as np """ Convert the style of gambling odds to Function Name (Decimal, American, Fractional). TO DO: Fix edge case related to Fraction module that causes weird rounding / slightly off output """ def american_odds(odds): """ :param odds: ...
dfa9e161f5cd75e76e87cc913276a4fcb1a1cd75
jerryzhang2019/Udacity_DSA_Project2
/Problem3_Huffman Coding.py
4,420
3.8125
4
# Problem 3: Huffman Coding 问题3:霍夫曼编码 import sys class HeapNode: def __init__(self, char, freq): self.char = char self.freq = freq self.left = None self.right = None class HuffmanCoding: def __init__(self): self.heap = [] self.codes = {} self.reverse_map...
5ad1ca6f69324baffdc616fc3fe3e50f6b8a9235
TakamasaIkeda/-100-
/NLP100/chap1/knock04.py
942
3.59375
4
#!/usr/bin/env python #-*- coding: utf-8 -*- """"Hi He Lied Because Boron Could Not Oxidize Fluorine. New Nations Might Also Sign Peace Security Clause. Arthur King Can."という文を単語に分解し,1, 5, 6, 7, 8, 9, 15, 16, 19番目の単語は先頭の1文字,それ以外の単語は先頭に2文字を取り出し,取り出した文字列から単語の位置(先頭から何番目の単語か)への連想配列(辞書型もしくはマップ型)を作成せよ. """ headNumber = [1,...
4b229af4c63f935360039b3a5e52cf2a0787eb4d
TakamasaIkeda/-100-
/NLP100/chap1/knock03.py
355
3.640625
4
#!/usr/bin/env python #-*- coding: utf-8 -*- firstCharacter = [] sentense = "Now I need a drink, alcoholic of course, after the heavy lectures involving quantum mechanics." splitSentense = sentense.split(" ") for (number, item) in enumerate(splitSentense): print item + " " + item[0:1] firstCharacter.append(item[0...
97de887f8d74f7fdc6f2023b45db82f449e8c557
nagdive1/Theory-Of-Computat
/Two's_complement_program.py
684
3.859375
4
def flip(c): return '1' if (c == '0') else '0' def printTwosComplement(bin): n = len(bin) ones = "" # for ones complement flip every bit for i in range(n): ones += flip(bin[i]) ones = list(ones.strip("")) twos = list(ones) for i in range(n - 1,...
a0c548edbb376cc43648056cddceed70baa5a8c8
kippen/Python_Class
/Lab_06_02.py
1,066
4.375
4
''' LAB 6-2: Working with returned lists 1) Create a function that returns a list of the Sum, Difference, Product, and Quotient of two numbers. 2) Display the results to the user. 3) Divide you program into data, processing, and presentation sections. ''' #-- Data --# fltN1 = 0.0 fltN2 = 0.0 lstAnswer = [] ...
ee0bfdc9fcea7236cfc8eba5cc3dbb02eec2cd03
sheppduck/python3hardway
/ex34.py
735
4.375
4
# ================================= ## Joel Sheppard - ex34 ## Learn Python3 the Hard way ## Let's access elements in a list # ================================= animals = ['bear', 'python3.6', 'peacock','kangaroo','whale', 'platypus'] ## Accessing items in the list # Cardinally (any random order I want to grab items f...
867594f8d4c69af7120a6349fca238a2275dcff7
Xtrato/Miscellaneous
/Classic Crypto/Shift Cipher.py
2,908
4.59375
5
#------------------------------------------------------------------------------- # Name: Ceaser Shift Cipher # Purpose: Example code for analysing shifts on plain text by a Caesar shift cipher. # # Author: James Woolley # # Created: 14/06/2012 # Copyright: Open Source #---------------------------...
6bd1d5d6a5fde6c27301d3112b8ac5bca395de94
Xtrato/Miscellaneous
/Other/sqlDuplicateRemoval.py
1,038
3.796875
4
#This script iterates through a SQLite database and creates a new database with any complete duplicates removed. #Requires minor changes to the SQL statements to match the input database import sqlite3 import os #Connecting to original database connOriginal = sqlite3.connect('/root/Documents/upnp.db') connOriginal.tex...
596ddedf71a097454e6ba1d94e3689349aae3813
chintan8195/Leetcode-practice
/leetcode/1359. Count All Valid Pickup and Delivery Options.py
640
3.59375
4
''' Given n orders, each order consist in pickup and delivery services. Count all valid pickup/delivery possible sequences such that delivery(i) is always after of pickup(i). Since the answer may be too large, return it modulo 10^9 + 7. Example 1: Input: n = 1 Output: 1 Explanation: Unique order (P1, D1), Del...
c89caf913a36dd74c850791029e1930c53371ffd
chintan8195/Leetcode-practice
/leetcode/348. Design Tic-Tac-Toe.py
1,203
4.09375
4
''' Design a Tic-tac-toe game that is played between two players on a n x n grid. You may assume the following rules: A move is guaranteed to be valid and is placed on an empty block. Once a winning condition is reached, no more moves is allowed. A player who succeeds in placing n of their marks in a horizontal, ver...
ede3b1faceff43c19437314a5a153cf43c0302de
chintan8195/Leetcode-practice
/leetcode/114. Flatten Binary Tree to Linked List.py
707
4.0625
4
''' For example, given the following tree: 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 \ 6 root->left->right -> preorder ''' class Node: def __init__(self, val=0,left=None,right=None): self.val= val...
20f684e42533b85dc19aa6573d4cb504460de799
chintan8195/Leetcode-practice
/leetcode/1155. Number of Dice Rolls With Target Sum.py
671
3.6875
4
def numRollsToTarget(d: int, f: int, target: int) -> int: hm = {} def dp(d, target): if d==0: return 0 if target>0 else 1 if (d,target) in hm: return hm[(d,target)] to_return = 0 for k in range(max(0,target-f),target): to_return += dp(d-1,k) ...
3ab801448ed6303560d18a124b29707aefaf285a
RahulKeluskar/python
/knapsack.py
1,483
4.3125
4
''' Python module to solve the knapsack problem to maximise loot using greedy algorithms ''' import math def get_best_item(input_list): ''' Get the best item from the remaining items based on maximum value per weight ratio ''' most_valuable_index = 0 best_value = 0 index = 0 for weight, value in...
4a993564a7b6f83a234299b0dfc7e3a53e82140f
RahulKeluskar/python
/lambda_function.py
1,855
4.65625
5
''' Implementing various usages of lambda function in python ''' def some_decorator(f): def wraps(*args): print(f'Calling function is {f.__name__}') return f(args) return wraps @some_decorator def decorated_function(argument): print(f'With argument {argument}') def trace(f): ''' Fu...
f51e690b84bf5ee371101900ce8a2918726e8857
AnneCollins/Cubes
/direction.py
1,994
3.953125
4
class Rotation(object): CLOCKWISE = -1 COUNTER = 1 R3D1 = 1 R3D2 = 2 R3D3 = 3 R3D4 = 4 class Direction(object): def __init__(self, dx, dy, dz): self.dx = dx self.dy = dy self.dz = dz def step(self, point): #returns a new point after taking a step in cu...
cdb3072fd324d0ed47ca8faa81fcb8433b6dd80d
ChenXinYu121/1
/DAY4two/jc.py
108
3.75
4
#阶乘 num = int(input("请输入一个数:")) p = 1 for i in range(1, num+1): p = p * i print(p)
fadb00c18b31049ec7ebc949eb5e080b029611cc
ansipes/hello-python
/src/readcsv.py
450
3.515625
4
import matplotlib.pyplot as plt import csv x = [] y = [] with open("./src/static/temperature.csv") as f: f.readline() reader = csv.reader(f) for row in reader: y.append(int(row[0])) x.append(int(row[1])) # plotting the points plt.plot(x, y) # naming the x axis plt.xlabel('x - axis') # naming the y ...
21cf023696892d683224bef98edc3c1c345f5af3
ansipes/hello-python
/src/static/exercises/e3_list_less_than_ten.py
110
3.734375
4
a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] l = int(input("Enter a number: ")) print([n for n in a if n < l])
b22cacadefeb5bc257325c20cf793f9cc786daa7
ajinkyamukherjee98/ModCalculator
/data.py
513
4.21875
4
import sqlite3 import _sqlite3 # connect() will try to open the specified file if not it will create a new file of that name databasefile = sqlite3.connect("calculator.sqlite") cur = databasefile.cursor() # Creating a table named ModuloCalculator to store the values of x, a , p and the calculated result as columns cu...
f33f5208745503bcc90c6c6043cdea97c88a4bf2
OCoderO/Elements-of-Software-Design---UT-Austin
/Reducible Words - A12/Reducible.py
6,641
3.953125
4
# File: Reducible.py # Description: # Student Name: Rosemary Cramblitt # Student UT EID: rkc753 # Partner Name: Wendy Zhang # Partner UT EID: wz4393 # Course Name: CS 313E # Unique Number: 52240 # Date Created:3/30/2021 # Date Last Modified: 4/4/2021 import sys # takes as input a positive integer n # return...
730c47e7a4ce2787f08d7e76e5899d0c12ff962e
OCoderO/Elements-of-Software-Design---UT-Austin
/Work Till You Drop - A7/Work.py
3,674
3.71875
4
# File: Work.py # Description: Testing Linear Search and Binary Search # Partner Name: Wendy Zhang # Partner UT EID: wz4393 # Course Name: CS 313E # Unique Number: 52240 # Date Created: 2/21/2021 # Date Last Modified: 3/3/2021 import sys import time # Input: v an integer representing the minimum lines of cod...
79b2ae49c75be207bd51ece466176847b76f6240
boyedandtoyed/learningpython
/randoms.py
382
3.703125
4
class Indexer: data = [5, 6, 7, 8, 9] def __getitem__(self, index): # Called for index or slice print('getitem:', index, self.data[index]) return self.data[index] # Perform index or slice def __contains__(self, item): return item in self.data print(7 in Indexer()) a=(range(...
6c728a7bf85d5ff4841cba67c52d74b3943c30a5
Jsavage1325/CodingChallenges
/PiEstimator.py
1,625
4.375
4
# given points randomly allocated in a square # write a program to estimate pi import random import math # first we need to get a function to randomly create points random.uniform(0, 1) # creates a new point def new_point(): x = random.uniform(0, 1) y = random.uniform(0, 1) return x, y # creates a specif...
3124ead179be465f6b5707f1c6d7636466465185
Gbolly007/AdvancedPython
/Assignment6/As6_Number2.py
2,005
3.546875
4
# Python version 3.8 # list for storing results of operations lis = [] # Loop to calculate while True: # Variable to accept input from user user_input = input('>>>') # Code block to check malformed input ui = user_input.split(' ') neg = '' for u in ui: if len(u) > 2: if '+' in u...
8a6dc2f7e61312261a1e4cb11fcb9602c0e185c7
yangshimin/git_code
/0011/0011.py
312
3.734375
4
#-*- coding:utf-8 -*- result = [] texts = open('filtered_words.txt','r').readlines() words = input('Please input:') for word in texts: result.append(word.strip()) #str.strip(rm)当rm为空时,默认删除空白符包括('\n','\r','\t',' ') if words in result: print('Freedom') else: print('Human Rights')
a20abd6b84d418122276d1ef3048aa604210838c
mokaki/AutoWeb
/自動開網址2.py
4,211
3.5
4
 ''' py3 自動開網址 ATW202106271630 mokaki pip install selenium https://sites.google.com/a/chromium.org/chromedriver/downloads https://www.learncodewithmike.com/2020/05/python-selenium-scraper.html ''' ##########################################################################import import os from selenium import we...
77f44c6e26643c663266591146fff3070117857c
Samira-Kaline/Exercicio-fila2
/Questão3.py
1,450
3.984375
4
from datetime import datetime import random import time class Cliente(): def __init__(self, nome, entrada): self.nome = nome self.entrada = entrada class Fila: def __init__(self): self.lista_nome = [] self.fila_entrada = [] def entrar(self,nome,entrada): self.lista_nome.append(nome) se...
f78eeb216d884c2608063138f422540c0de29672
i-tanuj/Drawing-Application
/PythonGui/filedialog.py
610
3.625
4
import os from tkinter import * from tkinter import filedialog, messagebox def showopen(): fname=filedialog.askopenfilenames(title="Select your fav song",filetypes=[("mp3 files","*.mp3")]) if len(fname)==0: messagebox.showinfo("No selection","you did not select any song") else: str="" ...
f5bafd05b1dd10af6ff9abcb95208603dd3000d6
i-tanuj/Drawing-Application
/Python Examples/demo.py
116
3.75
4
a=int(input("Enter first no:")) b=int(input("Enter second number:")) c=a+b print("nos are",a,b,"and their sum is",c)
7884de19968790e5adcc78a74949f9c0a9a74f06
doctoryes/python-morsels
/circle.py
1,001
4.0625
4
import math class Circle(object): def __init__(self, radius=1): self._radius = 0.0 self._diameter = 0.0 self._area = 0.0 self.radius = float(radius) def __repr__(self): return "Circle({})".format(int(self.radius)) @property def radius(self): return self...
1e5f18b96397a9c7a67d07fea822eceee853b62b
Demshin82/CppLes
/Classes.py
536
4
4
class Car: name = "None" height = 1000 speed = 200.00 def __init__(self, name, height): self.name = name self.height = height print(self.name, "has weght", self.height) def set(self, name, height, speed): self.name = name self.height = height self.speed = speed class Truck (Car): ...
e4ad101790cbb044dd4521c29154286c16ef1f0e
ProAnalyzer/CollectionInPython-
/FileHandling.py
1,036
4.1875
4
#"r" - Read - Default value. Opens a file for reading, error if the file does not exist #"a" - Append - Opens a file for appending, creates the file if it does not exist #"w" - Write - Opens a file for writing, creates the file if it does not exist #"x" - Create - Creates the specified file, returns an error i...
43e1178622163b089bc8c02439217b2931116620
Hemangi3598/chap-4_p6
/p7.py
289
3.765625
4
# p7 wapp to gen the follow: # * # * * # * * * # * * * * # where number of lines to be gen, is given by user num = int(input(" enter a number of lines")) if num < 0: print("invalid input") else: for i in range(1, num+1): print(i * " *\t ") # for more space type " *\t"
38949fbec7f40e95e1798df292a573c75f04583b
wu2014/QueueAndHeap
/timePriorityQueues.py
1,816
3.546875
4
# timePriorityQueues.py # Tests the list implementations using two stack implementations based on lists. # See if we can infer the list implementation. import queue import priorityqueue from os import times import random numberOfItems = 10000 myPriorityQueue = queue.LinkedPriorityQueue() start = times() print "TIMING...
cd8e8c0046f9d87c928dd5add0ff5888b733cb08
Thina007/Python_Project
/YouTube_Downloder.py
867
3.8125
4
import tkinter import pytube #impot the lib: from tkinter import * from pytube import YouTube #Creat Window: root=Tk() root.geometry("500x300") root.resizable(0,0) root.title("YouTube Downloder") Label(root,text="YouTube Downloder",font="arial 20 bold").pack() #Creat YouTube Enter Lin...
f20dc691fa4176c143b3c0cb1da898a0f796f8e2
obameyan/Atcoder
/Library/product_cmb_prm.py
1,473
3.875
4
from itertools import combinations_with_replacement from itertools import combinations from itertools import permutations from itertools import product for t in product([1, 2, 3], ["a", "b"]): print(t) """ (1, 'a') (1, 'b') (2, 'a') (2, 'b') (3, 'a') (3, 'b') """ for t in product(["a", "b"], repeat=3): print("...
772cd0f1bd5528c1d306de3af85b533289a9c2df
bwisgood/leetcode
/StringList/reverse_words2.py
232
3.71875
4
class Solution: def reverseWords(self, s: str) -> str: return " ".join(map(lambda x: x[::-1], s.split())) if str else "" if __name__ == '__main__': s = Solution() r = s.reverseWords("ab") print(":%s:" % r)
46c1cbf347e82c88f9c70eaf960a943505350748
bwisgood/leetcode
/StringList/find_str.py
689
3.65625
4
class Solution: def strStr(self, haystack: str, needle: str) -> int: if haystack == needle: return 0 if not haystack: return -1 if not needle: return 0 l = len(needle) lh = len(haystack) for i in range(lh): if i + l == ...
6a8259a4a5517b192f12994e3e3fd4c018b842a7
bwisgood/leetcode
/MultiThreding/print_zero.py
1,380
3.609375
4
class ZeroEvenOdd: def __init__(self, n): from threading import Lock self.n = n self.mutex = Lock() self.num = 0 self.times = 0 from threading import Thread from concurrent.futures import ThreadPoolExecutor mp = { 0: self.zero, ...
f5fdfbfc0d10874beb11c7435bc14f8dd3b3b490
nikhil0360/Python
/2019/LAB2/matrix1.py
223
4.09375
4
m1 = [ [1,2,3] , [4,5,6] ] m2 = [ [1,2,3] , [2,3,4] , [3,4,5] ] #m3 = [ [1,2,3] , [2,3,4] ] m3 = [] for i in range(len(m2[0])): temp = [] for j in range(len(m2)): temp.append(m2[j][i]) m3.append(temp) print(m3)
1336539b2714903713e195008581a50cab377a6e
nikhil0360/Python
/2019/LAB1/Q8.py
328
3.984375
4
print("type corresponding no. for the fuctions needed\n" "1) Add \n" "2) multiply \n" "3) Average\n") a = int(input()) # a is for storing no. for the function. n1 = float(input()) # input 1 n2 = float(input()) # input 2 if(a==1): print(n1+n2) elif(a==2): print(n1*n2) elif(a==3): print(n1/...
073fafbf8d81ea3c637cad52c5229fb6a9d0cb68
tartona/cs540teamk
/src/drone_world/search/node.py
2,010
3.734375
4
import copy class Node(object): def __init__(self, state, action, parent, node_count): """Initialize the node. Note that state must implement h() which is a heuristic function. """ self.state = state self.action = action self.parent = parent self.f...
287087e6e53546ca46b8c4ba3be0b866af8d5d84
Prooffreader/ipython_simple_progress_bar
/ProgressBar.py
1,578
3.703125
4
# code for the progress bar import time class ProgressBar: def __init__(self, loop_length): import time self.start = time.time() self.increment_size = 100.0/loop_length self.curr_count = 0 self.curr_pct = 0 self.overflow = False print('% complete: ', end=''...
b995b65cf8ab05f771f5b3122252e2a22014b493
hxk1633/World-Bank-Life-Expectancy
/utils.py
10,393
3.796875
4
""" Harrison Kaiser 2017 December 10 This program creates data structures needed for this project """ from rit_lib import * from quickSort import * from quickSortGrowth import * from quickSortFactors import * region_data = struct_type("region_data", (str, "name"), (str, "code"), (dict, "le_data"), (str, "income"), (st...
6b19c9a7eb76460c4b36424aa476ef946ff6a010
ths205/Python
/lcm.py
749
4.25
4
#Computes The least common multiple by multiplying two numbers # and dividing them by the Greatest Common Denominator of both numbers #imports the file gcd.py import gcd #Method to compute the least common multiple def lcm(a, b): if type(a) != int: raise TypeError('You did not enter an integer for val...
dfdd0606e4f129e21951218fbb9bc16e3cb32444
yash-rathi/CL3
/A2/quickSort.py
794
3.625
4
import xml.etree.ElementTree as tree from threading import Thread def partition(arr, low, high): pivot, i = arr[high], low for j in range(low, high): if(arr[j] <= pivot): arr[i], arr[j] = arr[j], arr[i] i += 1 arr[i], arr[high] = arr[high], arr[i] return i def quickSort...
97c52cf3c4b3481c1af5712122ae9a00ab977330
emilioanh/python_study
/ReverseWordOrder.py
706
4.40625
4
''' Write a program (using functions!) that asks the user for a long string containing multiple words. Print back to the user the same string, except with the words in backwards order. For example, say I type the string: My name is Michele Then I would see the string: Michele is name My shown back to me. ''' def r...
644f0a1b75c2de1dced80de8b95fe113f9f27543
emilioanh/python_study
/TicTacToe/DrawAGameBoard.py
893
4.28125
4
''' Time for some fake graphics! Let’s say we want to draw game boards that look like this: --- --- --- | | | | --- --- --- | | | | --- --- --- | | | | --- --- --- This one is 3x3 (like in tic tac toe). Obviously, they come in many other sizes (8x8 for chess, 19x19 for Go, and many more)...
d78e36f71921e615527b044f56e3ac2fea487d88
emilioanh/python_study
/ElementSearch.py
879
4.125
4
''' Write a function that takes an ordered list of numbers (a list where the elements are in order from smallest to largest) and another number. The function decides whether or not the given number is inside the list and returns (then prints) an appropriate boolean. Extras: Use binary search. ''' import random def fi...
2e6dda718429a67a6cf29b2a8466bddaa7025fe0
emilioanh/python_study
/file/ReadFromFile.py
1,542
3.78125
4
from string import ascii_lowercase from collections import Counter ''' Given a .txt file that has a list of a bunch of names, count how many of each name there are in the file, and print out the results to the screen. I have a .txt file for you, if you want to use it! Extra: Instead of using the .txt file from above (o...
34aa68606180738fd19bf32a72d5ac3c991029eb
LachezarKostov/machine_learrning
/beginning/5_panda_csv.py
909
3.671875
4
import pandas as pd pd.options.display.max_columns = 6 # Data-frame df = pd.read_csv(r"http://sololearn.com/uploads/files/titanic.csv") # r"C:\Users\dream\Desktop\Python\machine_learning\machine_learrning\titanic.csv" # Table # print(df.describe()) # Panda Series # col = df["Fare"] # print(col) # Small Data-frame ...
9a4b5f01983ca7090dfd7bcd3f483162738c6dbb
RabidCicada/boardgame_framework
/src/boardgame_framework/pawn.py
251
3.625
4
class Pawn(): """ Be the representation of a piece on the board A Pawn is the representation of the physical piece on the board. """ def act(): print("I'm acting!!!") return "derp" def move(): pass
2c73d755f2712c0b0c8de10ea7da58df7659c8dd
SCismycat/MeachineLearningAssignment
/CS224nAssignment/assignment1/q1_softmax.py
2,403
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # @Author : Leslee # @Email : leelovesc@gmail.com # @Time : 2019.10.28 11:41 import numpy as np def softmax(x): """Compute the softmax function for each row of the input x. It is crucial that this function is optimized for speed because it will b...
06435da54d68bd90b2c79167692ac1440db2fae7
flyandlure/pypreproc
/pypreproc/cluster.py
1,088
3.71875
4
""" Name: Functions for clustering data Developer: Matt Clarke Date: Jan 1, 2020 Description: Allows you to use unsupervised learning within supervised learning models. """ import numpy as np from sklearn.cluster import KMeans def kmeans_cluster(df, column, cluster_name, n_clusters, fillna_value): """Perform K ...
8aed547d1eab893b0b6aa69cc200171d67f64510
preethigamurugan/pythonbootcamp
/k,j.py
223
3.734375
4
name = input("please give your name") print(name) print(type(name)) collegename = input("collegename please") cgpa = int (input("cgpa please")) print("i am",name,"and i am studying in",collegename,"having cgpa",cgpa)
ab47a6ff678e2cefce3da1cf7b843368f2073327
mish-apoorva/Python-Wac-Winter-Camp
/Day 2/Nested loops.py
1,736
4.09375
4
# NESTEDC LOOPS for i in range(5): for j in range(5): print(i, end = ' ') print() # STAR PATTERN n = int(input()) for i in range(n): for j in range(n): print(" *", end =' ') print() # using string manipulation n = int(input()) for i in range(n) : print('*'*n) # print pattern of r...
753f97bcaaa65ad967652a1f85c1b41204eab9ca
UnknownPanther/Python
/Python_calendar.py
314
4.21875
4
# Python program which displays Calendar of given month of the year. # 17.02.2018 | (2) # Import module import calendar # Ask month(mm) and Year(yy) yy = int(input("Enter year: ")) mm = int(input("Enter month: ")) print("Counting...") print("Done!") print("") # Display Calendar print(calendar.month(yy, mm))
bb4a138bfe0078e02b4743be7de29533dc408589
sronkowski/csc157_hw
/CSC157-0c1 Completed Labs/1/Realtor_Draft.py
1,897
4.28125
4
#************************************************************************ # * Name: Stephen Ronkowski CSC 157 # * Date: 8/23/2018 LAB 1 # ************************************************************************* # * Statement: Determine...
f5cfcd893d4f52c1cb4f266852fee7086b6120c7
sronkowski/csc157_hw
/CSC157-0c1 Completed Labs/2/Flooring.py
1,518
4.03125
4
# ************************************************************************ # Name: Stephen Ronkowski CSC 155 # Date:9/6/2018 Lab 2 # ************************************************************************ # Statement: Determine type ...
ebcde646e8a3fa5ba774049e29db302e4419cdeb
bdjackson/ProjectEuler
/prob_013.py
2,199
3.8125
4
#!/usr/bin/env python # ============================================================================ import sys # =========================================================================== # = http://projecteuler.net/problem=13 = # = - - - - - - - - - - - - - - - - - - - - - -...
8d3ade73e5ec5123e27b90a215e07dc8fc2c9a71
bdjackson/ProjectEuler
/prob_004.py
2,159
3.796875
4
#!/usr/bin/env python # ============================================================================ import sys # =========================================================================== # = http://projecteuler.net/problem=4 = # = - - - - - - - - - - - - - - - - - - - - - -...
80726ea80e0cffa6bf9716474309613e3a136b5c
bdjackson/ProjectEuler
/prob_037.py
3,510
3.53125
4
#!/usr/bin/env python # ============================================================================ import sys import math import operator import primes_pp # =========================================================================== # = http://projecteuler.net/problem=37 = # = -...
16e24bfed514a16321bbde18f3850c9a84b37d31
bdjackson/ProjectEuler
/prob_206.py
5,004
3.78125
4
#!/usr/bin/env python # ============================================================================ import sys # import math # =========================================================================== # = http://projecteuler.net/problem=206 = # = - - - - - - - - - - - - - - - ...
5be674ed62fe9683be3d600547edb7b8d3cb2222
willwalker232/Spelling
/database_connection.py
1,394
3.859375
4
import sqlite3 def retrieve_words(level): try: # Creates or opens a file called mydb with a SQLite3 DB db = sqlite3.connect('database.db') # Get a cursor object cursor = db.cursor() # Check if table users does not exist and create it cursor.execute(''' CREATE TABLE IF NOT EXISTS words(id IN...
6cba03ae3b847fe7fa28ff1d80f29050c43a6710
yangchi/LCPractice
/ImplementStrStr.py
728
3.5625
4
class Solution: # @param haystack, a string # @param needle, a string # @return a string or None def strStr(self, haystack, needle): if needle == "": return haystack first = 0 second = 0 if len(haystack) == len(needle): for i in range(len(needle)):...
b452456b67b40737731d1775bd0439ae6c29b32b
yangchi/LCPractice
/LargestRectangleInHistogram.py
914
3.796875
4
def largestRectangleArea(height): stack = [] maxarea = 0 i = 0 while i < len(height): if len(stack) == 0: stack.append(i) i += 1 continue top = stack[-1] if height[i] >= height[top]: stack.append(i) i += 1 else: ...
4a4613df11f156c393ebf869c3f9308d18090e8a
katlings/snippets
/word_games/hexwords.py
528
3.71875
4
#!/usr/bin/env python3 """ Allowing 1337speak hax, which words can be represented entirely in hex? """ # leetspeak: 1=I=l 5=S 9=g 0=O # lesser leetspeak: 4=h 7=L letters = 'abcdefilsgo' mapping = { 'i': '1', 'l': '1', 's': '5', 'g': '9', 'o': '0', } with open('/usr/share/dict/words', 'r') as f...
cf51f6cfb3a19a583900e941a1dcc15628d1a29e
fonyango/MayOfCode
/day_02.py
1,487
4.59375
5
# ----- DAY TWO ------- ''' 1. Demonstrate how to use Python’s list comprehension syntax to produce the list [ a , b , c , ..., z ], but without having to type all 26 such characters literally. ''' # import string module import string alphabets = list(string.ascii_lowercase) # create a list of all alphabets print(alph...
1096418433a249534add3a811a71e3b169df0907
fonyango/MayOfCode
/day_01.py
2,219
4.5
4
# ----- DAY ONE -------- ''' 1. Write a short Python function, is_multiple(n, m), that takes two integer values and returns True if n is a multiple of m, that is, n = mi for some integer i, and False otherwise. ''' def is_multiple(n,m): if (m%n==0): print('True: {0} is a multiple of {1}'.format(n,m)) else: p...
35bd11604da462ce0772f8e395caf90b838c9469
Ranispoorti/1BM17CS073PY
/073 lab 4 .py
881
3.71875
4
class University: def __init__(self): self.age=0 self.name="" self.marks=0 def validate(self): if self.age>20 and self.marks in range(101): return True else : return False def check_qualification(self): if self.validate()==True: ...
9a00a7260e317c71c5ce48d5f24d17c65caf91d9
epifanovmd/gos
/Материалы/Программирование/Алгоритмы/Python_A/lab3/lab1_3.py
549
3.546875
4
print("Программа вычисляет суммарное кол-во км за все дни с учётом процента") perv_den = float(input("Пробег в первый день(км): ")) pr = float(input("Процент от пробега(%): ")) / 100 n = int(input("Количество дней пробега: ")) obshiy = 0 d = 0 while n > 0: if d == 0: d = perv_den obshiy += d els...
3a9b7ea54999400972ffecc936cbf52f65bd6ed0
epifanovmd/gos
/Материалы/Программирование/Алгоритмы/Python_A/lab2/num2_2.py
895
4.1875
4
print("Программа проверяет наименьшее число на четность") a = int(input("Введите первое число: ")) b = int(input("Введите второе число: ")) if a > b: if a % 2 == 0: print("первое число больше второго и четное") else: print("первое число больше второго и нечетное") elif a < b: if b % 2 == 0:...
46ed51ffc7885a54ba8ac2e8f12ddb384ed9e958
ddpalacios/Mastering-Your-Data-Structures-with-Python-3.7
/Section3_Trees_Graphs/Trees/BinaryTree.py
3,355
4.0625
4
# Tree Nodes ''' Tree data structures are non linear data structures that store data items in an non-linear order a data item can be connectrd to more than on data item. In the linear data structures, all of the data items in the linear data can be traversed in on pass This is NOT possible in the case of a nonlinear da...
ed4f746f34c7f738134c6ac435187ff5526a3766
ddpalacios/Mastering-Your-Data-Structures-with-Python-3.7
/Section3_Trees_Graphs/Trees/BinarySearchTrees.py
11,735
3.953125
4
# ''' # # a Binary search tree (BST) is a special kind of binart tree and it is # one of the most important and commonly used data structures in computer # science applications. # # # A BST is a tree that is structually a binary tree, and stores data in its nodes very efficiently. # It provides very fast SEARCH operati...
5d2972144bd8db2bf45ce6e3c7825a22acb926f3
davendiy/ads_course2
/subject4_stack/deque.py
5,155
3.515625
4
#!/usr/bin/env python3 # -*-encoding: utf-8-*- # created: 24.11.18 # by David Zashkolny # 2 course, comp math # Taras Shevchenko National University of Kyiv # email: davendiy@gmail.com class DequeException(Exception): pass class Node: """ Допоміжний клас - вузол деку """ def __init__(self, item): ...
388b054b418546845eae98602ca755a86e553e1b
filiptuhy/googleFoobar
/Level2/PowerHungry.py
3,365
4.0625
4
""" Power Hungry ============ Commander Lambda's space station is HUGE. And huge space stations take a LOT of power. Huge space stations with doomsday devices take even more power. To help meet the station's power needs, Commander Lambda has installed solar panels on the station's outer surface. But the station sits ...
b1aa493cb4b7f13a126a196aa6d0e1ae63df491b
NCBI-Hackathons/Biollante
/sequence_mixing.py
1,322
3.53125
4
import random """Choose an insert sequence of a given size from a large sequence, chosen randomly from all sequences of such size in the large sequence""" def choose_fragment(seq, size): if size > len(seq) or len(seq) == 0: return seq loc = random.randint(0, len(seq)-size) return seq[loc : loc + size] """...
09caa2d52f16746ae88d6d09c0ef03aec3e0379f
wangshubo90/python_code
/learn_python/data structure and algorithm/quick_sort.py
827
3.609375
4
def quick_sort(seq): N = len(seq) rec_quick_sort(seq, 0, N - 1) def rec_quick_sort(seq, first, last): if first >= last: return else: pivot = seq[first] pos = pivot_partition(seq, first, last) rec_quick_sort(seq, first, pos - 1) rec_quick_sort(seq, pos + 1, last)...
abfcf59225d639659369d1a647e160572ed4483b
wangshubo90/python_code
/learn_python/data structure and algorithm/merge_sort.py
1,701
3.671875
4
from Sorting import merge_ordered def merge_sort(ls): l = len(ls) if l == 1: return ls else: mid = l // 2 left = merge_sort(ls[0:mid]) right = merge_sort(ls[mid:]) return merge_ordered(left, right) from oned_array import Array def vir_merge_sort(seq): N ...
3b83575ff4fa405722b9199841ad0e28123f356e
MGhousSarwar/BA002
/minimax game of nim.py
1,993
4
4
import random import cmath class MarbleGame: def __init__(self, n): self.n = n def init(self): return self.n def checkEnd(self, marble): return True if marble == 0 else False def winCheck(self, marble, player): if marble == 0: if player == 1: ...
278b31ee4c956086e914dff54d43b26b249e136c
GeezFORCE/JetBrainsAcademy
/Smart Calculator1/Problems/Prime number/task.py
283
4.03125
4
num = int(input()) flag = 1 if num == 1: print("This number is not prime") exit() else: for i in range(2, num//2): if num % i == 0: flag = 0 break if flag == 0: print("This number is not prime") else: print("This number is prime")
725d7f45bd2bc97328ba1f45f134afd17dc64a9a
GeezFORCE/JetBrainsAcademy
/Smart Calculator1/Problems/mixedCase/task.py
211
3.703125
4
word_list = input().split() op_list = list() op_list.append(word_list[0]) for word in word_list[1:]: op_list.append(word.title()) if len(op_list) == 1: print(op_list[0]) else: print("".join(op_list))
0624aa532de4965ff3b8a72af9a2fd7195b5a948
mohit0103/prac5-string
/prac5.py
636
4
4
p=input("Enter your word/sentence: ") long=0 for i in p.split(): if (len(i) > long): long = len(i) print(f"longest word has {long} characters.") char = input("Enter which character to be counted: ") cnt = 0 cnt1 = 0 for i in p: cnt=cnt+1 print("Total characters in the string is", cnt) for i in p: if (i==cha...
644171452548d75ea7409253dcee588ae3f533f8
TigranTT/UDACITY-4
/UDACITY 4 resubmit.py
4,849
3.875
4
#Creating 3 different quiz scenarios with blanks and giving definitions #for each scenario with containing Lists. easy_quiz='''___1___ is a method that can help you to find the target in the string. ___2___ is a method that can help you to find out the quantity of items of the string. ___3___ is a command to show th...
be8e13fa8214c5c0f2730336de275d30e026e171
toothpik/toothpik-s-.vimrc
/bin/yearws
526
3.953125
4
#!/usr/bin/python3 # print three column year [with spaces] to stdout from calendar import setfirstweekday, calendar, SUNDAY from sys import argv from time import localtime, strftime def print_three_col_year(a_year): setfirstweekday(SUNDAY) print("") L = calendar(a_year) for l in L.split('\n'): ...
e32b1b13e865183222ee2296467a5c28826e7135
xiaoandx/learningCode
/Python_Code/ch3/experimentThree_test5.py
333
4.4375
4
# 字符串切片操作 strs = "hello Python hello c! " print(strs[6:12]) # 从后向前切片,最后一个字符串索引是-1 print(strs[-8:-1]) # 从索引为-3的字符串到字符串开始 print(strs[:-3]) print("字符串中是否包含java:",("java" in strs)) print("字符串中是否包含Python:","Python" in strs)
c0618e591fff44e3d448da48625a62a95987afd3
xiaoandx/learningCode
/Python_Code/experimentFour/experimentFour_test4.py
426
3.84375
4
# 创建一个保存满足水仙花数的列表 numberList = list(); # 循环判断每个数是否满足 for number in range(100, 1000, 1): a = number // 100; b = (number // 10) % 10; c = (number % 100) % 10; if a ** 3 + b ** 3 + c ** 3 == number: numberList.append(number); # 按照格式输出满足的数 print("所有的3位水仙花数:", end=" "); print(", ".join(str(i) for i...
e8891e76bb5d78740ae2f22ceca707825356d971
xiaoandx/learningCode
/Python_Code/ch3/experimentThree_test3.py
414
3.71875
4
# 请输入18位标准的身份证号码 ID = input("请输入十八位身份证号码:") # 判断身份证号码的长度 if len(ID) == 18: print("输入的身份证号码是" + ID) year = ID[6:10] moon = ID[10:12] day = ID[12:14] print("出生年月: {} 年 {} 月 {} 日".format(ID[6:10],ID[10:12],ID[12:14])) else: print("输入的身份证号码错误,不符合长度要求")
78281e1b01710fc2a865cb3e5fc68c7112023397
NBaiel81/winx_club
/zadachki2.py
1,533
3.546875
4
# 1. Дана строка, состоящая из слов, разделенных пробелами. Определите, сколько в ней слов. # Гарантируется, что в строке не встречается несколько пробелов подряд.Подсказка: у строк есть # полезный метод count, а количество слов напрямую связано с количеством пробелов, их разделяющих # 2. Дана строка: если она начинает...
a15f1fb9cd6631eab345b5ca54af6b814303cc26
NBaiel81/winx_club
/ex4.py
445
3.65625
4
#4. У Нуржанат 5000 сом, она купила три вида пазл и цену каждого набора добавила # в список. Помогите кассиру выдать сдачу Нуржанат. Список со стоимостью пазл – [3000,900,1199] list1=[] first=3000 second=900 third=1199 list1.append(first) list1.append(second) list1.append(third) print(list1) cassa=sum(list1) print(cass...
d79ee0c184b634dcf90681a93518ee467ee5980d
bzfrmt/PythonLesson
/Lesson01/task5.py
620
3.984375
4
inmoney=int(input("Укажите выручку фирмы: ")) outmoney=int(input("Укжите издержки фирмы: ")) money=inmoney-outmoney if money> 0: print(f'Прибыль составила {money}') print('Рентабельность','%.2f' % (money/inmoney*100),'%') peoples=int(input("Укажите колличество сотрудников фирмы: ")) print ('Прибыль на...
22c17cb1b2638fc972dc2e33a4f0d9a9bc8f242d
bzfrmt/PythonLesson
/Lesson01/task2.py
360
3.90625
4
sec=int(input("Введите время в секундах: ")) if sec<0: print ("Введите корректное значение") else: hours=sec//3600 #print (hours) minutes=(sec-hours*3600)//60 #print (minutes) seconds=(sec-hours*3600-minutes*60) #print (seconds) print(f"%02i:%02i:%02i" % (hours, minutes, seconds))
488cf77d575141d8168b7fb460125e766118d984
bzfrmt/PythonLesson
/Lesson06/task3.py
1,043
4
4
class Worker: name="" surname="" position="" _income={"wage": 0, "bonus": 0} def __init__(self): self.name=input("Введите Имя: ") self.surname=input("Введите Фамилию: ") self._income["wage"]=int(input("Введите оклад: ")) self._income["bonus"]=int(input("Введите преми...
1f3c1a3d783f79a43d4ed9bb5f827b70a4e96a44
bzfrmt/PythonLesson
/Lesson06/task5.py
530
3.53125
4
class Stationery: title="" def draw(self): print ("Запуск отрисовки") class Pen(Stationery): title="Ручка" def draw(self): print ("Тонко пишет",self.title) class Pencil(Stationery): title="Карандаш" def draw(self): print ("Царапает",self.title) class Handle(Station...
30a4ac38e2010be3088b32abce674910c2f033ee
rladpwl0512/likelion_PYTHON
/16.py
301
4.03125
4
#16. 입력으로 들어오는 모든 수의 평균값을 계산해 주는 함수를 작성해 보자. # (단, 입력으로 들어오는 수의 갯수는 정해져 있지 않다.) def avg(*args): result = 0 for i in args: result += i return result / len(args) print(avg(1,3))
249d75ac6502add3c1927d135cbe2fac68ee230b
eff-kay/combination-and-permutation
/permutation.py
937
3.5625
4
def permutation(s): if len(s) == 1: return [s] perm_list = [] # resulting list for a in s: remaining_elements = [x for x in s if x != a] print "remaining elements", remaining_elements z = permutation(remaining_elements) # permutations of sublist print "z",z for t...
bc75d8a7c5bc2766cf5ec24d1a6c4c43682c2f42
Shasheen8/TCSprojects
/selectingnameswithrandom.py
204
3.65625
4
import random names =["Tyler","Andrew","Megan","Daniella"] leader= random.choice(names) print(leader) # 4 randoms number between the range 10 and 30 for i in range(4): print(random.randint(10,30))
6df5adfc06c11dffd020224abc3febc6195b2ae1
Shasheen8/TCSprojects
/whileloop.py
137
3.6875
4
i = 1 while i<=10: print('*'*i) i= i+1 print ("Done") i = 1 while i<=20: print('*'*i) i= i+1 print("Done")