blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
75a0b7c9babd8bc984d8c206a7ec8a6d344e0fa3
shyamkumar2412/python-programming3
/42.py
150
3.734375
4
ch=input().split() if(len(ch[0])>len(ch[1])): print(ch[0]) elif(len(ch[1])>len(ch[0])): print(ch[1]) elif(len(ch[0])==len(ch[1])): print(ch[0])
5c95ae8d6c0354eb02fb6ca1e77cf5a7a38e8af9
shyamkumar2412/python-programming3
/36.py
147
3.71875
4
ch=input() c=0 for i in range (len(ch)): if(ch[i].isdigit()or ch[i].isalpha() or ch[i]==' '): continue else: c+=1 print(c)
9a05a95b04095b01cbb33ee94cf362d18b5a8a1d
shrutijai1/21-DAYS-OF-PROGRAMMING-CHALLENGE-ACES
/#day12.py
575
3.953125
4
n = int(input()) input_list = input().strip().split() #list of string for x in range(n): input_list[x] = int(input_list[x]) #convert list of string into integer string input_tuple = tuple(input_list) #converting list into tuple print(hash(input_tuple)) """ Note that: swapcase() function is used to con...
bad9fb2044ecbb5eac225341f1408881a72a471d
shrutijai1/21-DAYS-OF-PROGRAMMING-CHALLENGE-ACES
/#day18.py
7,318
4.4375
4
thisarray = ["shruti", "mohini","prachi", "karishma"] while True: print("OPERATIONS ON THE LIST") print(" Enter 1 What is the difination of the array? ") print(" Enter 2 for printing Array") print(" Enter 3 for finding the length of the array") print(" Enter 4 for print the array in reverse or...
9c76e88549554fd6377e482cb3de15a90a37943a
parkkhee/studyAlgorithm
/BOJ/1110/1110.py
596
3.5
4
x= int(input()) i=1 if(x>0 and x<99) or (x==0 or x==99): if(x>9): fir=x%10 sec=x//10 res=int(str(fir)+str((fir+sec)%10)) if(res!=x): while(res!=x): i+=1 fir2=res%10 sec2=res//10 res=int(str(fir2)+...
1dc8cbb172e5f635d92aa9ddf62b9fee8ff2cebc
tdelgado37/ticTacToe
/src/board.py
1,098
3.625
4
class Board: def __init__(self): self.isCreated = True self.slots = {"TopL": " ", "TopM": " ", "TopR": " ", "MiddleL": " ", "MiddleM":" ", "MiddleR":" ", "BottomL": " ", "BottomM":" ", "BottomR": " "} #TODO: add in logic to handle invalid positions on the board def m...
627023dff02f8904a68d2e185eab89f227b2b83d
ReddyRohan/MuleSteve
/csvtojson/src/main/resources/csvToJson.py
433
3.578125
4
import json import csv a= """column1;column2;column3;column4;column5 abc;def;dghi;jkl;mno pqr;stu;vwx;;""" #get rows of the csv file rows=a.splitlines() #get the headers from the csv file fieldnames=rows[0].split(';') #Delete the rows containing headers rows.pop(0) #read CSV and convert csv to Json reader = csv.Di...
d41c3ff944ef258d036cc7ac22e836d739cb0a46
msom/newton-polynomial
/src/newton_polynomial/__init__.py
922
3.546875
4
from numpy import diagonal from numpy import zeros from sympy import simplify from sympy import symbols def coefficients(x, y): assert len(x) == len(y), "arguments must have the same size" size = len(x) result = zeros((size, size)) result[:, 0] = y for column in range(1, size): result[colu...
ce7c1e92da3dcf692ca1c044d3a14c6042c16a7a
deepnik/Assignment-3-Python-
/Problem1.py
143
3.828125
4
#1.CREATE A LIST WITH USER DEFINED I/P x=input("enter the value=") y=input("enter the value=") z=input("enter the value=") n=[x,y,z] print(n)
54d486c9340d665068d8935e35c2304d3c6705d1
LaluIqb/16-coffee-machine
/coffee-machine/main.py
2,963
4
4
from coffee_menu import menu, resources money = 0 water_source = resources["water"] milk_source = resources["milk"] coffee_source = resources["coffee"] def coffee_order(order): amount = menu[order] water = amount["ingredients"]["water"] coffee = amount["ingredients"]["coffee"] milk = am...
9958cd212de0d2c36d608a088f100429c95dd6ff
jadeaxon/hello
/Python/generator.py
772
4.46875
4
#!/usr/bin/env python # Python has special functions called generators. # All a generator is is an object with a next() method that resumes where it left off each time it is called. # Defining a function using yield creates a factory method that lets you create a generator. # Instead of using 'return' to return a valu...
bdbbd12701724f9ce66ea63f772b4354681fbff4
jadeaxon/hello
/Python/webbot/webbot2.py
5,419
3.765625
4
#!/usr/bin/env python # A few libraries that may be useful for HTML scraping. # urllib2 # BeatifulSoup # Scrappy # Mechanize import urllib2 # Allows you to access URLs. import re # Regular expressions. # We are in the region of the file that has actor names. inActors = False inGenres = False inRuntime = False inSyn...
b3b5f8b1c1feab8fa39327f993256ecc3872f250
jadeaxon/hello
/Python/path.py
921
3.625
4
#!/usr/bin/env python import os # We'll split out this path into its directory, filename, and extension components. path = "/home/jadeaxon/junk.tar.gz" directory, filename = os.path.split(path) basename = os.path.basename(path) name, extension = os.path.splitext(filename) # Does not include a trailing /. print "dir...
07e9d0808600a2cefe6a616d3a94f3aa4c6abde4
jadeaxon/hello
/Python 3/lp3thw/ex17/ex17.py
990
3.640625
4
#!/usr/bin/env python3 # This script copies a file to a new location. # Use argv to get command-line args. from sys import argv # Import a symbol from a submodule. from os.path import exists # Unpack the command-line args. script, from_file, to_file = argv # Tell user what we're doing. print(f"Coping from {from_fil...
d08aa1d852e828dd1a4df4e4b0c3a265c18f40c0
jadeaxon/hello
/Python/dictionary.py
888
3.984375
4
#!/usr/bin/env python # A dictionary is like a hash in Perl. An assosciative array. # You can use any immutable object as the hash key, not just strings. D = {'jack': 4098, 'sape': 4139} D['guido'] = 4127 print D print D['jack'] del D['sape'] D['irv'] = 4127 print D print D.keys() # Check if a key is in the dicti...
711b0da87e3c90aa3fd25c9d902d2c8433d796ea
jadeaxon/hello
/Python 3/interview/singly_linked_list.py
2,260
4.21875
4
#!/usr/bin/env python3 """ A singly-linked list class that can be reversed in place. Avoids cycles and duplicate nodes in list. """ class Node(object): """A node in a singly-linked list.""" def __init__(self, value): self.next = None self.value = value class SinglyLinkedList(object): """A...
9fe3da25c75f7ced2dedb02cf8e3c63547d22937
jadeaxon/hello
/Python 3/lp3thw/ex34/ex34.py
192
3.953125
4
#!/usr/bin/env python3 # The point that list indexes are 0-based. l = ['apple', 'orange', 'banana', 'kiwi', 'pineapple', 'pear'] print(l[0]) # First. print(l[-1]) print(l[7]) # IndexError
ea91e41e939909b6d58f425c36b4f4203ce7de72
jadeaxon/hello
/Python/LPTHW/example33.py
315
4.15625
4
#!/usr/bin/env python i = 0 numbers = [] while i < 6: print "At the top, i is %d." % i numbers.append(i) # i++ -- Are you joking? No ++ operator!!! i += 1 print "Numbers now: ", numbers print "At the bottom, i is %d" % i print "The numbers: " for number in numbers: print number
1020a5826a22f38931de3ca78a557998883ea3fa
jadeaxon/hello
/Python 3/tkinter/hello_tkinter/radiobuttons.py
727
4.09375
4
from tkinter import * from tkinter import ttk root = Tk() title = ttk.Label(root, text="Choose a flavor:") title.grid(column=1, row=1, sticky=(N)) flavor = StringVar() flavor.set('vanilla') flavor1 = ttk.Radiobutton(root, text="Chocolate", variable=flavor, value='chocolate') flavor2 = ttk.Radiobutton(root, text="Va...
4b8592a49cba1c3519243b0e79f840e9271013e6
jadeaxon/hello
/Python 3/tkinter/hello_tkinter/buttons.py
912
3.6875
4
from tkinter import * from tkinter import ttk # PRE: pip install pillow # This was already installed by default (or by something else) for me. from PIL import Image from PIL import ImageTk def button_handler(): print("Button pushed.") root = Tk() button1 = ttk.Button(root, text="Button 1") button1.grid(column=1...
ecbb25714ca7892d9ebd822cfee826fff61d45a2
jadeaxon/hello
/Python 3/lp3thw/ex48/ex48/parser.py
1,049
3.9375
4
# Maps word to word type. word_type = { 'go': 'verb', 'kill': 'verb', 'eat': 'verb', 'north': 'direction', 'east': 'direction', 'south': 'direction', 'west': 'direction', 'up': 'direction', 'down': 'direction', 'bear': 'noun', 'princess': 'noun', 'to': 'preposition', ...
5cf870dc74d4123a3f80ddb51a261f56caf22c90
ezsx/more
/LP/Diskr_9.py
4,091
3.625
4
# -*- coding: utf-8 -*- s= input("введите путь к файлу:") with open(s, 'r',encoding="utf-8") as f: #считываем файл с заданным текстом st = f.read() string = st.lower() #если в файле есть заглавные буквы то преобразуем их в строчные для экономии ru_alf = """абвгдеёжзийклмнопрстуфхцчшщъыьэюя,.:!?-–()'\n """ #alf= "ab...
28224815fb499ec53db781bcb0dee2f91be8ff9a
lsy512/python_exercise
/3.py
115
3.703125
4
print 'Hello Python world!\n' print '*' * 10 for i in range(5): print '* *' print '*' * 10 print '*\n' * 6
c884a658eeb8142212c3f464366a90ac5c028423
svantepihl/30DaysOfCode
/Python/day28.py
451
3.59375
4
#!/bin/python3 import re GMAIL_PATTERN = re.compile('^[\w.+\-]+@gmail\.com$') if __name__ == '__main__': result = list() N = int(input()) for N_itr in range(N): firstNameEmailID = input().split() firstName = firstNameEmailID[0] emailID = firstNameEmailID[1] ...
9491f9373666fc27ba8156b6bd5cd2203a60b096
nymeowmeow/algorithm-specialization
/divide/karatsuba.py
1,313
3.53125
4
import sys import math def pad(data, length): return data.zfill(length) def karatsuba(first, second): # make sure operand are of the same length if first < 10 and second < 10: return first * second firststr = str(first) secondstr = str(second) length = max(len(firststr), len(secondstr...
81208825f899b575c1795a651f4eca8764e0a2c7
nymeowmeow/algorithm-specialization
/graph/median.py
1,115
3.515625
4
import heapq if __name__ == '__main__': input = [] with open('median.txt', 'r') as f: for line in f: input.append(int(line.strip())) print ('number of input elements: {}'.format(len(input))) heapmin = [] heapmax = [] heapq.heapify(heapmin) heapq.heapify(heapmax) to...
1081d059b7b581f2060e0e06091bf4005ab74b44
RafaelFFranca/Desenvolvimento-de-Sistemas---Atividade-21-08-17
/Atividade 21-08-17.py
2,403
3.71875
4
"""Rafael Fernandes França - RA: 1700791 Rilmo Ponciano - RA: 1700143 Henrique Cardoso - RA: 1601600""" #Exercício 1 print("Exercicio 1") def troca(vetor): for i in range(30): if vetor[i] >= 1: vetor[i] = 1 else: vetor[i] = 0 return vetor vet = [...
6fbb482414f39ebd09a30f97241ac749ba523cc2
arsenyku/training-coursera-NLP
/Programming Assignment 1/utility.py
1,340
3.59375
4
def CategorizeRareWords(rareWords): numeric = [] allCaps = [] lastCap = [] rare = [] for rareWord in rareWords: if isNumericWord(rareWord): numeric.append(rareWord) elif isAllCapsWord(rareWord): allCaps.append(rareWor...
629a180da6c366cefa32c2f1b8b262db403a63a2
ralph-dev/Pandas-Pipe
/pandas_pipe/_util.py
795
3.625
4
# -*- coding:utf-8 -*- def match_in_dict(keys, values): '''(type(keys), type(values)) -> list of values *Description* ''' assert len(keys) == len(values) return { keys[i]: values[i] for i in range(0, len(keys)) } def equals_for_dict(d1, d2): """(type(d1), type(d2)) -> bool Deep...
b07d0f9925e7a4c8836e9a8fceef6b54b93b1818
maistrotoad/Break20
/src/factor.py
183
3.75
4
def factor(number): factors = [] for whole_number in range(1, number + 1): if number % whole_number == 0: factors.append(whole_number) print(factors)
dc155049cd1010efaad60c0e9ea4f54663d12c2e
johnneppel96/Blackjack-in-python
/BlackJack/dealer.py
2,781
3.546875
4
from player import * class dealer(player): def __init__(self, card_deck_to_deal, name = 'Dealer'): player.__init__(self,name) self.card_deck_to_deal = card_deck_to_deal def deal_cards(self,num_cards_to_deal=4): dealt_cards = [] # this will deal a number of cards from the car...
f8e46227a7d594581f7786ea99a8cbd9ff8df0c3
devsagul/HanabiHack
/data/python/718.py
1,904
3.609375
4
import sys import os import ephem from datetime import datetime def loc(): print "Set your location" global lat lat = raw_input('Lat: ') global lon lon = raw_input('Lon: ') def choice(): print "Press 1 to find a star, 2 to find a planet" choice = raw_input('> ') if choic...
5e217e1f01bbd262c524620d0688a7db0be95d76
devsagul/HanabiHack
/data/python/4033.py
1,184
3.578125
4
# Project Euler Problem 67 def import_triangle(): with open('problem67.txt') as f: # Split each line by spaces and convert to integers return [list(map(int, line.split(' '))) for line in f] # The max of this row is the maximum sum up to its parent items plus the value # in this row. But no...
5505577cd78612237ef5577112c01dfc96e05bf3
Rbtski/Procesos-Python-Trabajos
/Suma.py
311
4
4
print("Suma de dos numeros enteros") #Entrada de datos a = input("ingrese el primer numero: ") b = input("ingrese el segundo numero: ") #Operaciones a = int(a) b = int(b) suma = a + b #Salida #print(type(a)) #Entrega el tipo de dato seria integer no es necesario print("La suma total es: ", suma)#resultados
96b2e4886daa9b734d439473f0b356797cf80b6a
EscFrog/Try-helloworld-python
/while.py
171
3.578125
4
selected = None while selected not in ['가위','바위','보']: selected = input('가위, 바위, 보 중에 선택하세요> ') print('선택된 값은:',selected)
146b4f8f64f6ad0a9eb7b0793a240e8880790098
EscFrog/Try-helloworld-python
/Exam_Part12_2.py
550
3.578125
4
shops = { "송일문방구":{ "가위":500, "크레파스":3000 }, "알파문구":{ "풀":800, "도화지":300, "A4용지":8000 }, "다이소":{ "풀":500, "목공본드":2000, "화분":3000 } } try: for shop, products in shops.items(): for product, price in products.items(): ...
b9997d901527cb2788d450296cb3cd541d307525
jameschengpeng/MCMC-of-Final-Year-Project-HKU
/focus_edges/coloring.py
2,475
3.5
4
import random import copy # adjacency_matrix should be constructed beforehand # q is the number of colors class graph_coloring(): def __init__(self, adjacency_matrix, q): self.adjacency_matrix = adjacency_matrix self.q = q self.neighbors = {} for i in range(len(self.adjacency_matr...
64c9b8502af8a747ff20b9bc9709e343fadd52e8
cindyzhang26/Processing
/Animation1/Animation1.pyde
288
3.515625
4
x = 100 y = 100 speed = 5 def setup(): size(400, 400) def draw(): global x global speed if x >= 400: speed = -speed *0.95 elif x <= 0: speed = -speed*0.95 x += speed background(255) noStroke() fill(0, 0, 190) ellipse(x, y, 40, 40)
6f4eb668562ddad8449b0fa4cd1e402a7498f5e6
eddo888/Argumental
/Argumental/Attribute.py
256
3.75
4
#!/usr/bin/env python3 from Argumental.Argument import Argument class Attribute(Argument): """ used for class attributes examples: @args.attribute( ... ) """ def __init__(self, fn, kwargs=None): super(Attribute, self).__init__(fn, kwargs)
e7aa8a12260575565eaf66bc1434d82b4617555e
usnistgov/OOF3D
/SRC/common/EXTRA/app_inet_nossh
1,026
3.78125
4
# -*- python -*- # Simple application -- listens on the initial "srvr" socket # for an internet connection to arrive, then answers # rather trivial questions. import string, socket, os sock_buf_size = 80 # Socket needs to be visible from outside, so use the host's name. sockaddr = (socket.gethostname(), socket.INA...
97ebd340fa0ad0f04af10221266a369397831767
megabyte264/Claw-Machine
/Electrical and Software/joystick.py
5,929
3.515625
4
#!/usr/bin/python3 # joystick.py # Author: Shane Williams # Author contact: smw0031@auburn.edu # Last Edit: 16 November 2016 by Eric Van Horn # Program description: # joystick.py is a basic program meant to interact with a basic HID joystick device. It reads the values of the # joystick's axes and represents them o...
299143c4b0e6870d58ed85109a43af6fa7f52d17
ajinmathew/Python
/factorial.py
123
4.03125
4
def fact(num): if num>1: num=num*fact(num-1) return num inp=int(input("Enter a Number :")) print(fact(inp))
7a805429b8ee85d09c685de82a32cccf20b11c06
lboeman/acic2016final-cali
/AverageMonthly.py
1,853
3.5
4
""" This Program takes in a directory of csv files formatted after a MoLS run through the output is a separate directory full of csv files containg the monthly averages from each csv in the input directory """ import sys import os import re def getDataPoint (path , filename): filenameOut = "./Monthly_Avg_Csvs/...
7e91b89425ccab93005ddee58e7dbbe82be35af3
apswe/NNLearningLog
/example/LearnCNN/mnistCNN.py
4,893
3.59375
4
# coding=utf-8 """ Trains a simple convnet on the MNIST dataset. """ from __future__ import print_function import keras from keras.models import Model from keras.layers import Dense, Dropout, Flatten, Input from keras.layers import Conv2D, MaxPooling2D from example.utils.datasets import load_mnist import os import mat...
c70857df23d7a07629d783b1b34706b1871b4113
greatertomi/Codility-Practices
/Solutions/Sorting/Triangle.py
545
3.65625
4
def solution(array): new_array = [] check = False for i in range(len(array)): for j in range(i + 1, len(array)): for k in range(j + 1, len(array)): new_array.append([array[i], array[j], array[k]]) for triple in new_array: if (triple[0] + triple[1] > triple[2...
e19dc3ff2792c11523bd6686bd0e71f9c3532297
greatertomi/Codility-Practices
/Solutions/Euclidean Algorithm/CommonPrimeDivisors.py
783
3.625
4
def solution(array1, array2): arrays = list(zip(array1, array2)) countSame = 0 for i in range(len(arrays)): primes1 = primeDivisorLister(arrays[i][0]) primes2 = primeDivisorLister(arrays[i][1]) if primes1 == primes2: countSame += 1 return countSame def primeDivisorL...
98c9cb4b17351442624fec668dec4ba3959d6343
greatertomi/Codility-Practices
/Solutions/CountingElements/MaxCounter.py
745
3.609375
4
# def solution(operations, counter_num): # counters = [0 for _ in range(5)] # for i in operations: # if i == counter_num + 1: # max_num = max(counters) # counters = [max_num for _ in counters] # elif i <= counter_num: # counters[i-1] += 1 # else: # ...
8b7de7bea318f7d429db9df222d7e1de357940f5
GeorgeIulian23/georgecergau
/c4-l1.py
186
3.796875
4
lista_de_la_tast = ['citit', 'vorbit', 'cantat'] list = input('') string = str(list).split(' ') print(string) for i in string: lista_de_la_tast.append(i) print(lista_de_la_tast)
df1a920bc9c43eed8bcbc7707f26cedc04f68cda
matttodd/Jam
/2017/qualification/problem_b/b.py
316
3.546875
4
def main(): t = int(input()) # read a line with a single integer for i in range(1, t + 1): n = int(input()) print(("Case #{}: " + solve_problem(n)).format(i)) # print("Case #{}: {} {}".format(i, n + m, n * m)) def solve_problem(n): pass if __name__ == '__main__': main()
3ab21f021a662e769d8b91df69ae956c4c6f492d
himkt/hackerrank
/mini_max_sum.py
237
3.703125
4
def miniMaxSum(arr): arr = sorted(arr) ttl = sum(arr) return ttl-arr[-1], ttl-arr[0] if __name__ == '__main__': arr = list(map(int, input().rstrip().split())) min, max = miniMaxSum(arr) print(f"{min} {max}")
2165feab278448109e2b55e193324f4e2a4342af
Sara-Rajaee/plexy
/src/utils.py
2,658
3.890625
4
def read_list(path: str): """ Read UTF-8 encoded word list from path. Example file: house play train ... :param path str: file path to utf-8 word list """ with open(path, 'r') as file: word_list = [] for line in file: word_list.append(line.strip()) ...
55ba130af8c9bedfe2a376952cc7c22934db3b37
tylerbourgeois/CSCI127
/lab12.py
2,310
3.53125
4
import numpy as np import matplotlib.pyplot as plt # ----------------------------------------------------- # CSCI 127, Lab 12 # November 21, 2017 # Tyler Bourgeois # ----------------------------------------------------- def read_file(name): input_file = open(name, "r") number_buckets = int(input_fi...
f490b7603a49f839359416570e9ceafb16557b82
gowrijsuria/RRT-PathPlanning
/RRT_nonholonomic_drawn.py
15,628
3.5625
4
import pygame from random import randint as ri pygame.init() import time import numpy as np screen = pygame.display.set_mode([500, 550]) SIDE_x = 20 SIDE_y = 40 WINDOW_width = 440 WINDOW_height = 400 GAME_border = 3 WHITE=(255,255,255) BLUE=(0,0,255) BLACK=(0,0,0) RED=(255,0,0) GREEN=(0,255,0) RAND=(120,120,120) C1=...
cbcd0eeb45758079ff186ba96526dcfc9a09102b
Koldar/phdScripts
/scripts/ya-csv-formatter/yacsvformatter/ya-csv-formatter.py
3,166
3.8125
4
#!/usr/bin/python3.6 import argparse import os import sys import csv from typing import Union import pandas as pd def get_column_name(val: Union[str, int], df: pd.DataFrame) -> str: try: val = int(val) return df.columns.values[val] except Exception as e: return val def main(): ...
9746a887eb3d21b430b43e5aa1f7b1cd5bdb5c5f
goodrahstar/travel-nottravel
/model_keras_classification.py
7,381
3.75
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sat Nov 23 12:53:24 2019 @author: rahulkumar ## Tasks Your code needs to do the following: - data preparation: - calculate the geographic distance between origins and destinations - convert raw data to a format suitable for the classification task -...
f4b87f484b75d42a2cf11e1458cbf7532de4c04d
happy789450/python
/study/mem.py
544
3.5625
4
# a=140 # b=140 # print(id(a)) # print(id(b)) # del a # del b # c=140 # print(id(c)) biga=10000 bigb=10000 print(id(biga)) print(id(bigb)) del biga del bigb bigc=10000 print(id(bigc)) # 大整数池和小整数池的区别是: # 1 从结果来看是一样的 # 2 大整数池是没有提前创建好对象, 是个空池子,需要我们自己去创建 # 创建好之后,会把整数对象保存到池子里面,后面都是不需要创建了 直接拿过来使用 # 小整数池是提前将 【-5,256】的数据都是提前创...
af1558e78172d696613b99a8a110d69ba8751db2
SheezaShabbir/Python-code
/Date_module.py
546
4.4375
4
#Python Dates #A date in Python is not a data type of its own, but we can import a module named datetime to work with dates as date objects. #Example #Import the datetime module and display the current date: import datetime x = datetime.datetime.now() print(x.year) print(x.strftime("%A")) print(x) x = da...
f07443f0174818f2a9abadcd724ce6b60d9ebdd1
SheezaShabbir/Python-code
/finaltestithink.py
889
4.1875
4
def str_analysis(pass_argument): if(pass_argument.isdigit()): int_conversion=int(pass_argument) if(int_conversion>90): printvalue=str(int_conversion)+" "+"is pretty big number." return printvalue elif(int_conversion<90): printvalue=str(int_conversion)+" "+"is p...
e3463e71f5b84871675627a4a3466ecd0934c9a8
pedestrianlove/10901_Python_THU
/EX/CH7/regularPolygon.py
274
3.5625
4
class RegularPolygon: def __init__(self, side=1): self._side = side class Square(RegularPolygon): def area(self, side): return side * side class EquilateralTriangle(RegularPolygon): def area(self, side): return side * side * 0.433
7f90c4162972c8fa6c9e72d1abc1f2971c1d35e3
pedestrianlove/10901_Python_THU
/HW/HW2/58.py
483
3.640625
4
# for formatting purpose class underline: start = '\033[04m' end = '\033[0m' # input future = eval (input ("Enter future value: " + underline.start)) print (underline.end, end = '') rate = eval (input ("Enter interest rate (as %): " + underline.start)) print (underline.end, end = '') year = eval (input ("Enter...
c0955e2983fc6ad306d8f3467e8ec7bc82ffa85c
pedestrianlove/10901_Python_THU
/HW/FINAL_GUESS/CH7/1-c.py
508
3.578125
4
import pickle # input infile = open ("nationsDict.dat", 'rb') nation_obj_dict = pickle.load (infile) infile.close () # process continent = input ("Enter a continent: ") continent_nation_list = [] for nation in nation_obj_dict: if (nation_obj_dict[nation]._continent == continent): continent_nation_list.append (nat...
18face2e7acfeeec7db2137a32b3d1b61cbb001b
pedestrianlove/10901_Python_THU
/HW/HW10/6.3/2.py
468
4.0625
4
import turtle # title turtle.title ("2.py") # draw a blue horizontal line turtle.color ("blue") turtle.forward (100) # draw a red dot (diameter 100 pixel) turtle.color ("red") turtle.fillcolor ("red") turtle.speed (0) turtle.begin_fill () ## draw circle (not filled) length = 370 x = 0 while x <= length: turtle.rig...
ea0c356c4204d42d0127a96780bef29a042f387b
pedestrianlove/10901_Python_THU
/HW/HW3/3.4/74.py
528
3.875
4
# for formatting purpose class underline: start = '\033[04m' end = '\033[0m' # input startingWord = input ("Starting word: ") # process counter = 0; crossedOutLetters = "" remainingLetters = "" for char in startingWord: if (counter % 2 == 0) : crossedOutLetters = crossedOutLetters + char + " " else: r...
046aadb5a587fdc8a8b47ffeb443f8021e62093f
pedestrianlove/10901_Python_THU
/EX/CH6/6_3_Comment4.py
182
3.5
4
import turtle t = turtle.Turtle() t.hideturtle() t.color("blue", "light blue") t.begin_fill() for i in range(36): t.forward(200) t.left(170) t.end_fill()
0b9d8f72d360987f3b1181dfefd1979f1e62d33a
pedestrianlove/10901_Python_THU
/EX/1215/recursive_factorial.py
179
4.1875
4
def factorial (n): if n == 0: return 1 return n * factorial (n - 1) # driver code num = eval (input ("Please input a number to compute factorial: ")) print (factorial (num))
1cb9163c58765a7d31bfef21fc03636b185fa666
pedestrianlove/10901_Python_THU
/HW/HW2/54.py
359
3.546875
4
# for formatting purpose class underline: start = '\033[04m' end = '\033[0m' # input revenue = eval (input ("Enter revenue: " + underline.start)) print (underline.end, end = '') expenses = eval (input ("Enter expenses: " + underline.start)) print (underline.end, end = '') # output print ("Net income: ", "${...
1625c8eabb79062f2ce36ef47b5ba4de2b257ca8
pedestrianlove/10901_Python_THU
/EX/1013/if-condition.py
343
3.984375
4
# input num1 = eval (input ("Enter the first number: ")) num2 = eval (input ("Enter the second number: ")) # process if num1 > num2 : print (str(num1) + ">" + str (num2)) elif num1 == num2 : print (str(num1) + "=" + str (num2)) else: print (str(num1) + "<" + str (num2)) # output #print ("The larger value is", st...
c2e1f808b0a9c993fa791c70a44bacd632102d94
pedestrianlove/10901_Python_THU
/EX/1201/extractOrderedData.py
903
3.671875
4
import pickle import os def main (): fileName = os.path.join ("..", "CH5", "UNdict.dat") nations = getDictionary (fileName) continent = input ("Enter the name of a continent other than Antarctica: ") continentDict = constructContinentNations (nations, continent) displaySortedResults (continentDict) def getDictio...
f2b4c7102f61bd8ceb0f7c76ddfa82afef8e3fe6
pedestrianlove/10901_Python_THU
/HW/week2/exercise2-1.py
2,941
3.703125
4
# 2 print (7 ** 2, "== 49") # 4 print (3 + (4 * 5), "== 23" ) # 6 print (3 * ((-2) ** 5), "== -96") # 8 print (14 % 4, "== 2") # 10 print (14 // 4, "== 3") # 12 print (5 % 5, "== 0") # 14 print ("'room&Board' is not a valid variable name.") # 16 print ("'1040B' is not a valid variable name.") # 18 print ("'INCO...
bf65cc1ebb5dd6c2ad20c077f1a7651375e1bcb4
pedestrianlove/10901_Python_THU
/HW/HW3/3.2/40.py
512
3.71875
4
# FIXME textbook required # for formatting purpose class underline: start = '\033[04m' end = '\033[0m' ## Bestow graduation honors. # input gpa = eval ( input ("Enter your gpa: " + underline.start)) print (underline.end, end='') # Determine if honors are warranted. if gpa >= 3.9: honors = " summa cum laude....
f9b3e01632f6787a714948fc759fe45838913123
pedestrianlove/10901_Python_THU
/EX/1020/whileLoop-continue.py
455
3.828125
4
# FIXME THIS PROGRAM IS BAD IN STYLE # Find the first integer divisible by 11 list1 = ["one", 23, 17.5, "two", 33, 22.1, 242, "three"] index = 0 foundFlag = False while index < len (list1) : x = list1 [index] i += 1 if not isinstance (x, int) continue if x % 11 == 0 : foundFlag = True print (x, "is the firs...
4d62a4444c3ca60bc5a2a8ca827774df446862d3
pedestrianlove/10901_Python_THU
/EX/CH7/7-1-6.py
953
4.0625
4
import lgStudent def main(): ## Calculate and display several students' semester letter grades. listOfStudents = [] # List to hold an object for each student. carryOn = 'Y' while carryOn == 'Y': st = lgStudent.LGstudent() # Obtain student's name, grade on midterm exam, and grad...
003027f62ce664df062b0ed24d0ca351722a81e3
pedestrianlove/10901_Python_THU
/HW/HW2/104.py
240
3.734375
4
# for formatting purpose class underline: start = '\033[04m' end = '\033[0m' # input name = input ("Enter a 3-part name: " + underline.start) print (underline.end, end = '') # output print ("Middle name: " + name.split (' ')[1])
8fc0ead8ce695be43f92142c327022a3bf986a30
pedestrianlove/10901_Python_THU
/EX/1013/expressions.py
337
3.5625
4
n = 4 answ = "Y" print (2 < n) and (n < 6) print (2 < n) and (n == 6) print (not (n < 6)) print (answ == "Y") or (answ == "y") print (answ == "Y") and (answ == "y") print (not (answ == "y")) print ((2 < n) and (n == 5 + 1)) or (answ == "No") print ((n == 2) and (n == 7)) or (answ == "Y") print (n == 2) and (n == 7) o...
30bfb9aaa2b9a0d077ec2e90a891b00204470e0c
pedestrianlove/10901_Python_THU
/EX/CH6/6_2_1.py
292
3.5
4
import random elements = ["earth", "air", "fire", "water"] print(random.choice(elements)) print(random.sample(elements, 2)) random.shuffle(elements) print(elements) print(random.randint(1, 5))
9aaa3956619a75c42d64ea23670d1afcc65d0cbc
pedestrianlove/10901_Python_THU
/EX/1020/dec2bin.py
555
3.75
4
def dec2bin_integer (num): if num > 1 : dec2bin_integer (int (num / 2)) print (num % 2, end='') def dec2bin_float (floating): counter = 1 while counter <= 15 : if floating >= 0.5 ** counter: floating -= 0.5 ** counter print (1, end='') else: print (0, end='') counter += 1 number = float (input ("...
9da660b1a6be7846f6f92112ca2f65538e061ed6
pedestrianlove/10901_Python_THU
/HW/HW3/3.4/68.py
340
3.53125
4
# for formatting purpose class underline: start = '\033[04m' end = '\033[0m' # variables deposit = 10000.0 lost = 0.84 gain = 1.18 # process for i in range (6): deposit *= lost for i in range (6): deposit *= gain print ("The value of the stock at the end of the year was: ", end='') print ("${:,.2f}".forma...
95edd6be453aea76654b47d65cd87b8870a9d7c1
5h3rr1ll/kleineAufgabenOhneLoesung
/Aufgabe3.2.2.py
511
3.6875
4
def Anzahl_Vokale(w): w = w.lower() zaehler = 0 for b in w: if b == "a" or b == "e" or b == "i" or b == "o" or b == "u" or b == "ö" or b == "ä" or b == "ü": zaehler += 1 return zaehler print(Anzahl_Vokale("immer")) def Viele_Vokale(lst, n): for w in lst: Anzahl_Vokale(w...
42350e73d085b6ad465b2b813379ac012da96ae3
jmavis/CodingChallenges
/Python/NumberOfOnes.py
1,335
3.9375
4
#--------------------------------------------------------- # Author: Jared Mavis # Username: jmavis # Problem name: Number of Ones # Problem url: https://www.codeeval.com/open_challenges/16/ #--------------------------------------------------------- import sys #-----------------------------------------------...
6a20b87f76f5e01dab9552208c1a42b197199e9a
jmavis/CodingChallenges
/Python/DecimalToBinary.py
1,796
4.3125
4
#--------------------------------------------------------- # Author: Jared Mavis # Username: jmavis # Problem name: Decimal To Binary # Problem url: https://www.codeeval.com/open_challenges/27/ #--------------------------------------------------------- import sys import math #-------------------------------...
b2d2dd3baed364c81e22d193586c21f0abbd56d0
jmavis/CodingChallenges
/Python/Star.py
898
4.4375
4
#------------------------------------------------------------------------------ # Jared Mavis # jmavis@ucsc.edu # Programming Assignment 2 # Star.py - Creates an n-pointed star based on user input #------------------------------------------------------------------------------ import turtle numPoints = int(inpu...
4ab4a3d99ebd411506b23b8da3096c1ee80e56c9
hb918902/Python_easypractices
/0011/filter.py
465
3.96875
4
#! /usr/bin/env python3 # coding = utf-8 import re import os def filter_word(a): flag = 0 with open('filtered_word.txt', encoding='utf-8') as f: for line in f.readlines(): line = line.strip(os.linesep) if re.search(line, a): flag += 1 if flag: print...
a1de92ef7bc7ebbf9715f5e75a362d24b03c91ba
widgetti/solara
/solara/website/pages/examples/utilities/todo.py
6,479
3.609375
4
"""# Todo application Demonstrates the use of reactive variables in combinations with dataclasses. With solara we can get a type safe view onto a field in a dataclass, pydantic model, or attr object. This is using the experimental `solara.lab.Ref` class, which is not yet part of the official API. ```python import ...
153707587ddcb205ba094047db6ad617e866717b
cleilsonjose/algoritmo
/uri 1019.py
141
3.609375
4
N = int(input()) horas = N//3600 minutos = (N % 3600)//60 segundos = (N % 3600)%60 print("{}:{}:{}".format(horas,minutos,segundos))
e69db4554f0e13dd8a10cfc6eb4cc4c5b6fa245e
cleilsonjose/algoritmo
/uri 1043.py
314
3.6875
4
valores = input().split() A = float(valores[0]) B = float(valores[1]) C = float(valores[2]) if (B-C)< A and A < (B+C) and (A - C) < B and B < (A + C) and (A - B)< C and C < (A + B): Perimetro = A+B+C print("Perimetro = %.1f"%Perimetro) else: Area = ((A+ B)*C)/2 print("Area = %.1f"%Area)
93ebdd8a5766c3490ce8d661bf74564649bb5ec0
RayChen3636/Python_Basic_1
/main3.py
214
3.734375
4
a = 3 + 3.14 print(a) b = a * 2 print(b) #非常重要!! a = a * 3 print(a) a = abs(-2 * a) print(a) a = pow(a, 2) print(a) #bmi: (體重) / (身高公尺) ^ 2 bmi = 75 /pow(1.75, 2) print(bmi)
208977fabb918e9ade504d56fd12cc00b0f8ae89
RayChen3636/Python_Basic_1
/main11.py
219
3.515625
4
times = 0 #一個記憶區 result = 0 end = 5000 #加到 > 5000才停, 你最後加的數字是多少 while result <= end: result = result + (times+ 1) times = times + 1 print("最後加數字是",times)
c9780c8c8960670476edf883a8ac694d3d6d7caf
adoniramj/code_challenges_py
/prime_num.py
295
4
4
# function to test if an integer is a prime number # prime number is a whole number greater than one whose only factors are 1 and itself. def prime_num(num): if isinstance(num, int): for i in range(2, num): if num % i == 0: return -1 return num
d63f3afd031ffb0bed4e997ec286b4b521b1529e
adoniramj/code_challenges_py
/steps_in_prime2.py
452
3.65625
4
def step(g,m,n): arr_primes = [] for j in range(m, n + 1): item = j for k in range(2,j): if j % k == 0: prime = False break if prime: arr_primes.append(j) prime = True for j in arr_primes: if(j+g) in arr_prim...
5944e6708a33d092408b737b8f44c1cb1f891120
flpdantas/Estrutura-de-dados
/LQ03.py
288
3.921875
4
def main(): print('----------') n= int(input('Digite um determinado valor:')) print(n) if n>10: print('É MAIOR QUE 10!') if n==10: print('O VALOR DIGITADO É IGUAL A 10!') if n<10: print('É MENOR QUE 10!') print('----------') main()
a9c6ebfcc981474bc92556d59eecdd6f24205be2
flpdantas/Estrutura-de-dados
/LQ15.py
343
4.09375
4
def main(): estoque = int(input("Digite a quantidade total de mercadorias:")) for i in range (0, estoque): mercadoria = float(input("Qual o valor da mercadoria" + str ( 1 + i ) + " : ")) print("O valor em estoque é:", estoque*mercadoria) print("O valor médio das mercadorias é:", estoque*mercado...
7de4cb048dca1c7eb680d342d2dc6634de9b863e
thejacobhardman/Calculator-GUI
/Calculator.py
11,260
4.03125
4
# Jacob Hardman # Intro To Programming # Professor Marcus Longwell # 4/10/19 # Python Version 3.7.3 # Credit for sound effects to Marianne Gagnon # http://soundbible.com/1682-Robot-Blip.html # http://soundbible.com/1669-Robot-Blip-2.html # Importing pkgs import tkinter as tk import tkinter.font as tkFont from tkinter...
ae32600805a01e4e98dea95e2f4e2b55b2060645
soerenbnoergaard/adventofcode2020
/day18/python/puzzle1.py
1,064
3.71875
4
""" No precedence between + and *. Whichever comes first, gets evaluated first. """ import re def main(): input_file = "../puzzle_input.txt" # 209335026987 # input_file = "../test_input1.txt" # 2245406496 # input_file = "../test_input2.txt" # 51 # input_file = "../test_input3.txt" # 26335 total = ...
5eef5eba8b38ad1b4d78e0780e8ab108ba830d5e
crazynuxer/mapcakes
/wordcount_example.py
2,285
3.5
4
from mapreduce import MapReduce import sys class WordCount(MapReduce): def __init__(self, input_dir, output_dir, n_mappers, n_reducers): MapReduce.__init__(self, input_dir, output_dir, n_mappers, n_reducers) def mapper(self, key, value): """Map function for the word count example Note...
d38d3f01e9fbabb2f6eda2cc561886d72266ec97
snirvt/cryptocurrency
/block.py
2,034
3.703125
4
from time import time from utility.printable import Printable from transaction import Transaction class Block(Printable): """A single block of our blockchain. Attributes: :index: The index of this block. :previous_hash: The hash of the previous block in the blockchain. :timestamp: Th...
75dc6a0a49a2d720ef29cfa7e43cb46972f469f3
catalin407/OpenCV-Python-Tutorials
/image_pyramids_opencv.py
952
3.515625
4
import cv2 import numpy as np ## Pyramid : Using Blur and subsample we downscale the image in low size. ## Use for Reduce the size of images. img = cv2.imread('test_images/lena.jpg') layer = img.copy() # 1. Gaussian Pyramid # pyrDown : reduce the size # pyrUp : increase the size # applying pyrUp on pyrdowned im...
f94c7f28b9217c754cbe5279551310ee3900bfac
shashanksinghania/Path-Finder
/pathfinder.py
7,464
3.59375
4
import pygame from queue import PriorityQueue # Make a new window with pygame WINDOW_WIDTH = 800 WIN = pygame.display.set_mode((WINDOW_WIDTH, WINDOW_WIDTH)) pygame.display.set_caption("Pathfinding Visualizer") # Colors constants in RGB format RED = (255, 0, 0) WHITE = (255, 255, 255) BLACK = (0, 0, 0) GREEN = (0, 255...
f3de22bac358ba35c3d264ec5c41d607275d4889
prasannabe2004/MITx
/6.00.1.x/Week2/Lecture3/SecreteNumber.py
539
3.859375
4
low = 0 high = 100 print "Please think of a number between 0 and 100!" while True: mid = abs((low+high)/2) print "Is your secrete number ", mid, "?" user = raw_input("Enter 'h' to indicate the guess is too high. Enter 'l' to indicate the guess is too low. Enter 'c' to indicate I guessed correctly. ") ...
0726e2e9a3b60941b670507367f54a745b6d897c
prasannabe2004/MITx
/6.00.1.x/Week2/ProblemSet2/ProblemSet2.2.py
301
3.578125
4
annualInterestRate = 0.18 balance = 3926 bal = balance pay = 0 while(bal >=0): bal = balance pay = pay + 0.0001 for month in range(1, 13): UnpaidBal = bal - pay bal = UnpaidBal + UnpaidBal*(annualInterestRate/12.0) print("Lowest Payment: %4.2f" % float(pay))
776b7805c53610a6f4f5ac43ecae3bbee01e429b
prasannabe2004/MITx
/6.00.1.x/Week6/Lecture11/scratchpad.py
1,806
3.90625
4
class courseInfo(object): def __init__(self, courseName): self.courseName = courseName self.psetsDone = [] self.grade = "No Grade" def setPset(self, pset, score): self.psetsDone.append((pset, score)) def getPset(self, pset): for (p, score) in self.psetsDone: ...