blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
7c73a88b1896480031f1572c3994afcb1e2e9a00
stekodyne/python-class
/exercises/solution_ex08_concurrency/subprocesses/encrypt.py
2,903
3.515625
4
""" encrypt.py - uses the subprocess module to encrypt multiple files in parallel. """ import getpass import os import sys # TODO: import the subprocess module import subprocess # TODO: note the definition of the run_openssl() function. This function will # be the target of the processes that you create. # (no code ...
26aec7ce43dcc700806987187f196b5d546b2dc8
99zraymond/python-lesson-2
/python_2_4.py
543
4.625
5
# Zackary Raymond chapter 2 lesson 2. excersise-2 2-8-2018 #Exercise 4: Please copy the link to your program and attach it for turn in. Assume that we execute the following assignment statements: #width = 17 #height = 12.0 #For each of the following expressions, write the value of the expression and the type (...
78dd33951ab6deec901dc2dcbc50a9745aef0938
chadmccully/training
/beginner_lessons.py
623
3.875
4
#tuples and indexses # numbers = [1,4,6,3,4] # # for index, number in enumerate(numbers): # # print(f'{index} - {number}') # # # # values = list('aeiou') # # # # ['a', 'e', 'i', 'o', 'u'] # # for index, vowel in enumerate(values): # # ... print(f'{index} - {vowel}') # number = 5 # if(number%2==0): # isEve...
27eded1b392e124ba3abdcaff0fdd37563215185
vipin26/python
/PYTHON/New folder/not practised/list75/1 list.py
92
3.609375
4
lis1=[23,34,45,56,67] print lis1 print"printing list elements" for i in lis1: print i
9f667e7b8153624f51119d6d040502a366fe858d
AshishMaheshwari5959/Projects
/CH26_check_tic_tac_toe.py
2,135
3.828125
4
#import CH24_gameboards import random print("PLAYER 1 : X") print("PLAYER 2 : O") row1=[] row2=[] row3=[] gameover=False a=['X','O','_'] a1=random.choice(a) row1.append(a1) a2=random.choice(a) row1.append(a2) a3=random.choice(a) row1.append(a3) b1=random.choice(a) row2.append(b1) b2=random.choice...
a743cdf9b3d1137829d1e85ae14c212808d6ba16
ammfat/KotaKode-Challange
/case-03.py
1,388
3.609375
4
#!/usr/bin/env python def subsetTerbesar(inputList): ''' Mengembalikan subset dari elemen tak bersebalahan yang jika ditotal memiliki jumlah terbesar. Bila semua elemen bernilai negatif, maka akan dikembalikan nilai 0 ''' subset = [] maksTotal = 0 for i in range(len(inputList)): ...
7b1966ee824f64f14d51202886e24cafcd981566
kausthub/Python-Sessions
/Day2/derived.py
330
3.859375
4
#How to created a derived class #Here drclass() is derived from myclass defined in the classes.py example #Same rules apply here as well #Eg. of usage - a=drclass() from classes import myclass class drclass(myclass): def surname(self,name): global sur sur=str(name) def printsur(self): ...
b6c8ebac38345d119461ca2801a211c015b65e7b
Sofia-Ortega/mathDiscordBot
/math_game/generator.py
2,456
3.953125
4
""" Contains Generators for the equations """ from random import randint def add_gen(rangeArray): """Takes array of min and max values. Returns str of unique 2 num equation and their sum""" num1 = randint(rangeArray[0], rangeArray[1]) num2 = randint(rangeArray[0], rangeArray[1]) sum = num1 + num2 ...
5e7f96cf94fa805e98ee0431f533096900e25cbd
ozanozd/Firestation-DSS
/utilities.py
12,553
3.59375
4
""" This module contains general utility functions for the entire program """ #Open close debugging , testing IS_DEBUG = False IS_TEST = False #General constants initialization NUMBER_OF_DISTRICT = 867 #Number of district for solvers VIS_NUMBER_OF_DISTRICT = 975 #Number of district for visualization #General library ...
96fa62527da2066a2b80127206c92bc00d2213b2
harshbakori/classic_py_repo
/p1.py
426
3.890625
4
def main(): a=10 print(a,type(a)) a,b,c=3,4,5 print("%d %d %d"%(a,b,c)) a,b = b,a print("%d %d "%(a,b)) print ("array....") arr1 =[1,45,3,54,3] # if we use () brakets we cannot alter data with [] we caan ater data... print(type(arr1),arr1) arr1.append(8) arr1.insert(0,23...
369b3d3989879abf26b8a5f1d035e7dbcd4fd29d
snaveen1856/Python_Revised_notes
/Core_python/_24_DB_Connection_Python/_05_storing_image.py
211
3.5
4
import sqlite3 conn = sqlite3.connect('db.sqlite3') cursor = conn.cursor() m = cursor.execute(""" SELECT * FROM mark_employee """) for x in m: print(x[0], x[0]) conn.commit() cursor.close() conn.close()
e472d504cefb1803c4a4dd454d329f51fafddb5f
leticiamchd/Curso-Em-Video---Python
/Desafio035.py
384
4.125
4
lado1 = float(input('Digite o tamanho do primeiro lado do triângulo: ')) lado2 = float(input('Digite o tamanho do segundo lado do triângulo: ')) lado3 = float(input('Digite o tamanho do terceiro lado do triângulo: ')) if lado1 < (lado2+lado3) and lado1 > (lado2-lado3): print('Essas medidas formam um triangulo')...
00fee21bf78dc452a548213e5ead8f6051cc7a11
zhaoqyu/DeepLearningForTSF
/5.预测用电量(多变量,多步骤)/2.传统机器学习的多步时间序列预测/02.将分钟级别数据合并成日级别.py
626
3.90625
4
# 将分钟级别的数据合并成不同级别,确实的日期中间补零 from pandas import read_csv # 加载数据 dataset = read_csv('household_power_consumption2.csv', header=0, infer_datetime_format=True, parse_dates=['datetime'], index_col=['datetime']) # 根据年级别合并数据 #daily_groups = dataset.resample('Y') # 根据月级别合并数据 #daily_groups = dataset.resample('M') # 根据日级别合并数据 d...
830ebd341b15e3dbaa7df5c931969fadbaecb2f6
C-CCM-TC1028-111-2113/homework-3-MAngelFM
/assignments/07VolumenPrismaRectangular/src/exercise.py
409
3.71875
4
def main(): #escribe tu código abajo de esta línea def volumen(r,h,p): v = r * h * p print("Volumen del Prisma: ",v) def area(r,h): a = r * h return area base = float(input("Dame la base ")) altura = float(input("Dame la Altura ")) profundidad = float(input("Dame la Profundidad ")) volume...
95383291e15173d9347c028e2d15607f4b40ce18
fanainaalves/Mundo-1-2-e-3-de-Python-Curso-em-Video-
/exe091.py
631
3.6875
4
from random import randint from time import sleep from operator import itemgetter jogo = {'Jogador 1': randint(1, 6), 'Jogador 2': randint(1, 6), 'Jogador 3': randint(1, 6), 'Jogador 4': randint(1, 6)} ranking = list() print('Valores Sorteados: ') for keys, valores in jogo.items(): pr...
a4a6c4d07ebdbd892eff33800676de9063d208ca
binzamu/geeksforgeeks
/arrays/basic/find_number_of_numbers.py
442
3.890625
4
# https://practice.geeksforgeeks.org/problems/find-number-of-numbers/1 def num(arr, n, k): arr_separated = [] for i in arr: arr_separated += list(str(i)) return arr_separated.count(str(k)) if __name__=='__main__': t = int(input()) for i in range(t): n = int(input()) arr = l...
8dd3f81f8bff59379c7b5278d978b6cff1cad814
harishsakamuri/python-files
/basic python/codecata.py
108
3.5
4
a = int(input()) s = 0 b = 1 while (b>0): if (a==b): s = s+b b=b+1 print(s)
9046217f42f7d15e84611241cc7bbaf590412ab9
fallaciousreasoning/study
/pair_that_sum.py
1,741
3.703125
4
def naive_pair_that_sum(numbers, sum): for i in range(len(numbers)): for j in range(i, len(numbers)): if i == j: continue if numbers[i] + numbers[j] == sum: return True return False def bs_pair_that_sum(numbers, sum): sorted_numbers = sorted(numbers) f...
cc21cf06ffa25086aa34c765230bfe93581ce7e6
CollegeBoreal/INF1042-202-20H-02
/4.QuickSort/b300117806.py
461
3.984375
4
# -*- coding: utf-8 -*- """ Created on Tue Feb 11 15:20:15 2020 @author: User """ def quicksort(array): # base case if len(array) < 2 : return array else: # recursive case pivot = array [0] less = [i for i in array [1:] if i <= pivot] greater = [i for i in array[1:]...
3209947bf5e2e8f33dd65561744ecc8380faf4ab
aziaziazi/Euler
/problem 2.py
235
3.765625
4
def sum_fibonacci_not_even(): fib = [1,1] total = 0 while fib[-1]<4000000: to_add = fib[-1]+fib[-2] fib.append(to_add) if not fib[-1] % 2: total+=to_add fib[-1] = 0 print fib return total print sum_fibonacci_not_even()w
930ccd4f4320719c96b15e6c84a9397f40587ec8
alex19451/us-states-game
/main.py
1,006
3.84375
4
import turtle import pandas data = pandas.read_csv("50_states.csv") all_states = data.state.to_list() screen = turtle.Screen() title = screen.title("Find USA states Games") image = "blank_states_img.gif" screen.addshape(image) turtle.shape(image) guessed_states = [] while len(guessed_states)< 50: answer = scre...
775c2ea9d60a9b7e92462c04ae97016cd6f8d909
Helton-Rubens/Python-3
/exercicios/exercicio080.py
666
4.0625
4
#colocar os valores em ordem sem a função .sort() digito = [] for c in range(1, 6): user = int(input('Digite um número: ')) if c == 1: print('Número adicionado no começo da lista') digito.append(user) elif user > digito[-1]: digito.append(user) print('Número adicionado no fin...
b66a310d6aa0fe4497bfa529fa7382f396a74f03
1141938529/ClassExercises
/week01/day04/demo07.py
716
3.671875
4
# 猜数字游戏 # 规则:随机产生一个0-1000 的数字 用户进行输入数字 import random answer = random.randint(1, 1000) myAnswer = None while myAnswer!=answer : myAnswer= eval( input("请猜一个数字(0-1000):")) if myAnswer==-1 : print("老子不想玩了 gun") break else: if (myAnswer>1000 or myAnswer<0): print("骚年,睁大眼睛看看条件" ...
75cd6c3220bab095fbc663393017db84989b68fb
yura20/logos_python
/hw_01/hw.py
561
4.34375
4
name = input("enter your name: ") surname= input("enter your surname: ") group_name = input("enter your group name: ") university = input("enter your university: ") mark = int(input("enter your average mark: ")) name = name[0].upper()+name[1:].lower() surname = surname[0].upper()+surname[1:].lower() university = unive...
d43057b2e7a28cabbbb28e3ee40618a03580bab5
ihavegerms/pythonpractice
/primefactorpe3.py
422
3.546875
4
#!/usr/bin/env python # comment your code better... can't explain why you did something 1 or 2 days later def primefactor(a): b = 2 while (a > b): if (a % b == 0): # i'm a derp i did this cause x,y a = a / b; # this causes x to happen cause y is dumb b = ...
5cc5514ddce6cc4a8216ddd77513d85aae52fe95
MengleJhon/python_1
/python1.0/python_study1/little_game1.0.py
2,029
4.1875
4
# Lin Xin import random def roll_dice(numbers = 3,points = None): # numbers:骰子个数 points:预置骰子点数列表 print('<<<<< ROLL THE DICE ! >>>>>') if points is None: points = [] while numbers > 0: point = random.randrange(1,7) points.append(point) numbers = numbers - 1 return points...
a249d02c6806b5aceaf068fad44606132275cf2c
kungbob/Leetcode_solution
/python/6_ZigZag_Conversion.py
1,484
3.515625
4
################################################################################ # Question : 6. ZigZag Conversion # Difficulty : Medium # Author : Kung Tsz Ho # Last Modified Date : 2018/8/3 # Number of Method : 1 # Fastest Runtime : 84 ms ############################################...
a5e115eff881231ef49dba9c28148c3a27ed59ca
flematthias/exo-python
/exo-14/myClass.py
356
3.59375
4
class myClass: """classe pour agrandir """ @staticmethod def staticmethod(up): """methode pour agrandir Arguments: a {str} -- le string en minuscule Returns: str -- le resultat en capitale """ return up.upper() print(myC...
13c80a7a4131419370c73c7bcd3c415608f99585
allyrob/parsing
/stringparsing.py
1,699
4.34375
4
# grocery_string = "item:apples,quantity:4,price:1.50\n" # split_item = grocery_string.split(",") # print split_item # item_data = split_item[0] # print item_data # item = item_data.split(":") # print item[1] # my_name = "Sonia" # print list(my_name) # numbers = "1,2,3,4,5" # numberslist = numbers.split(",") # prin...
60954f75a9c3fd0f1c285c38a80c30cb85e057dd
EmersonBraun/python-excercices
/cursoemvideo/ex052.py
431
4
4
# Faça um programa que leia um número inteiro # e diga se ele é ou não um número primo num = int(input('Digite um número para ver ser é primo: ')) cont = 0 print('{} é divisível por: '.format(num),end='') for c in range(1, num + 1): if num % c == 0: print('{} ,'.format(c) ,end='') cont+=1 if cont ...
feddef1c18fd87ddd77a50f188dd9b408ff6f8de
rakaar/OOP-Python-Notes
/6-decorators-get-set-deleters.py
1,177
4.125
4
''' @property a decorator used to access the methods as attributes setters allows us to set the attributes deleter runs when something is deleted ''' class Employee: bonus = 100 def __init__(self, firstName, lastName, salary): self.firstName = firstName self.lastName = lastName sel...
e1db6fc30efc4468dbac2529a0450f12a7ad9aa6
gennis2008/python_workspace
/CrazyPythonTalkLiGang/part03/section3.3/update_test.py
355
3.546875
4
a_list = [2,4,-3.4,'crazyit',23] a_list[2] = 'fkit' print(a_list) a_list[-2] = 9527 print(a_list) b_list = list(range(1,5)) print(b_list) b_list[1:3] = ['a','b'] print(b_list) b_list[2:5] = [] print(b_list) b_list[2:2] = ['x','y'] print(b_list) b_list[1:3]='charlie' print(b_list) c_list = list(range(1,10)) c_list[2:9...
9bc662d868ae4a8428428732f26e71227fb0d151
andresparrab/Python_Learning
/SQLite/05. UPDATE and DELETE.py
1,711
3.859375
4
import sqlite3 import datetime import matplotlib.pyplot as plt import matplotlib.dates as mdates from matplotlib import style conn = sqlite3.connect('tutorial.db') cursor = conn.cursor() def graph_data(): cursor.execute('SELECT unix, value FROM stuffToPlot') dates = [] values = [] data = cursor.fetch...
61833c2b811a23fb4429b640ba42015720a4c5ed
harababurel/homework
/sem1/fop/practical-simulation/models/route.py
1,671
4.1875
4
class Route: """ Class models a bus route as a real world object. A bus route is defined by: self.__ID (int): the unique ID of the route. self.__code (str): the unique code of the route (<= 3 characters). self.__usage (int): the percentage that indicates the route's us...
4d9629aae3d871e063a896c4ded416afcb8577e2
SamuelDovgin/INFO490Assets
/src/dmap/lessons/color/lib/LessonUtil.py
854
3.8125
4
# # common code given to the students # only edit the source, this gets copied into distribution # import random as r import numpy as np class RandomData(object): def __init__(self, n=50, cat_count=3): r.seed(101) np.random.seed(101) self.x = np.random.randn(n) # norm dist, mean 0; var: 1...
f1b62a292a1c02362501f2c30beb58abc3a5b593
ZihengZZH/LeetCode
/py/MaximumProductSubarray.py
2,052
4.15625
4
''' Given an integer array nums, find the contiguous subarray within an array (containing at least one number) which has the largest product. Example 1: Input: [2,3,-2,4] Output: 6 Explanation: [2,3] has the largest product 6. Example 2: Input: [-2,0,-1] Output: 0 Explanation: The result cannot be 2, because [-2,-1...
519b4e21e5bb85d752b17993b65893df053fc69e
mattjax16/pitching_video_analysis
/kmeansGPU.py
38,279
3.578125
4
'''kmeans.py Performs K-Means clustering YOUR NAME HERE CS 251 Data Analysis Visualization, Spring 2021 ''' import numpy as np import matplotlib.pyplot as plt from palettable import cartocolors import palettable import concurrent.futures import pandas as pd import cupy as cp class KMeansGPU(): def __init__(self, d...
966df10a557099162bebf95b42c79042a5f3d57a
Zen-Master-SoSo/legame
/examples/board-game.py
4,283
3.546875
4
""" Demonstrates board game moves, jumps, state changes, and animations """ import random from pygame.locals import K_ESCAPE, K_q from pygame import Rect from pygame.sprite import Sprite from legame.game import * from legame.board_game import * from legame.flipper import * from legame.exit_states import * class Tes...
e8939e901f55d02c0a520a80b493cdb4ec9fd5a4
amishramuz/attendance_management_system
/db.py
786
3.796875
4
import sqlite3 class Database: def __init__(self,db): self.conn=sqlite3.connect(db) self.cur=self.conn.cursor() self.cur.execute("CREATE TABLE IF NOT EXISTS STUDENT (id integer primary key,name text,regi INTEGER ,branch text)") self.conn.commit() def fetch(self): ...
aae22cc73f327d9a128c0c313de0369ae6923e1f
caoxp930/MyPythonCode
/49class/7.01/7.01/lesson13/two_内置装饰器.py
1,579
4.0625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # author:fei time:2019/7/1 20:35 # 类的定义和使用 class Cat: """这是一个猫类""" name = '猫' def __init__(self, color, eat): self.color = color self.eat = eat @property def print_cat(self): print("{}-{}".format(self.color, self.eat)) @s...
4bb63801ee4d89f2812a86cce4815cd0d465f718
gogomillan/holbertonschool-higher_level_programming
/0x0C-python-almost_a_circle/models/base.py
4,646
3.59375
4
#!/usr/bin/python3 """ Module for class Base """ import json import csv class Base: """ Class Base """ """ Private class attribute """ __nb_objects = 0 def __init__(self, id=None): """ Class constructor method Args: id (int): The id for the Base class ...
e034787a22486272a59e5e4abb0d8bde0cfb31a4
messersm/sudokutools
/sudokutools/solvers.py
20,083
4.125
4
"""High level solving of sudokus. This module provides classes which represent typical sudoku solving steps used by humans. Steps can be found and applied to a given sudoku. But steps can also be printed without applying them, e.g. to inform a user, what steps can be taken to solve the sudoku. A single solve step may...
4d25f9383bf7b596ebd89aa88930cd821be41d82
masterkanch/Comproproject
/login.py
1,899
3.8125
4
def begin(): global option print("Welcome to Game") option = input("Login or Register or LeaderBoard(login,reg,score): ") if(option!="login" and option != "reg" and option != "score"): begin() def login(name,password): success = False file = open("user.txt","r") for i in file: ...
e4244518438e52cd1f3b9859f3b039e4ef86a700
ankitt8/mahawiki
/Python Challenge/Solution3/solution_three_PradnyaB - Pradnya Borkar.py
239
3.8125
4
String1=input("Enter String") list1=list(String1) set1=set(list1) maximum=0 val="" for i in set1: if maximum<list1.count(i): maximum=list1.count(i) val=i print(val) """ Enter String aaaaaaaaaaaaaaaaaabbbbcddddeeeeee a """
0992ddaa2d28a61131abe027bc16ce71f094417f
mcgowent/Python-Adventure-Game
/src/room.py
569
3.828125
4
# Implement a class to hold room information. This should have name and # description attributes. class Room: # base class for rooms def __init__(self, name, description, itemArr=[]): self.name = name self.description = description self.itemArr = itemArr def showItems(self): ...
38580d205b5c2fea47b7841b932043433047d93e
mbakin/py-samples
/biggestNumber.py
541
4.3125
4
""" Traning: Which number is the biggest """ number1 = float(input("First Number = " )) number2 = float(input("Second Number = ")) number3 = float(input("Third Number = ")) a = [number1, number2, number3] a.sort() print("Sorted Values = " + str(a)) print("************************") if number1>numb...
d9d381b1ecbc86e933c63274a9945fa8ba4e1914
shivasitharaman/python
/py3.py
116
3.890625
4
num1 = 50 num2 = 3 div = int(num1) / int(num2) print('The div of {0} and {1} is {2}'.format(num1, num2, div))
c53793bb40c36b89481c06266eab87da9b372ade
lohitha02/task1
/task1.py
1,330
4.1875
4
import random computer=["rock","paper","scissors"] userscore=0 computerscore=0 for i in range(0,5): user=input() while(user!="rock" and user!="paper" and user!="scissors"): print("enter either rock or paper or scissors") user=input() choice=random.choice(computer) if(user==choice): ...
cfbc419f57f21ae71877a00208876e7d1b8cd407
wesleyjr01/rest_api_flask
/2_python_refresher/52-mutable_default_params.py
629
3.90625
4
""" Mutable Default Parameters (and why they're a bad Idea.) Never make a parameter equal to a mutable value by default. __init__(self, List[int] = []) # Bad __init__(self, List[int] = None) # Good """ from typing import List class Student: def __init__(self, name: str, grades: List[int] = []): ...
245852d73edba80c8a39bb7336452489d127a85d
yunnong770/EE-247-HW
/HW5-codes/nndl/conv_layers.py
11,881
3.875
4
import numpy as np from nndl.layers import * import pdb """ This code was originally written for CS 231n at Stanford University (cs231n.stanford.edu). It has been modified in various areas for use in the ECE 239AS class at UCLA. This includes the descriptions of what code to implement as well as some slight potenti...
9719a907ede711f73d75f5ea03df9223c19f1e13
Aasthaengg/IBMdataset
/Python_codes/p03080/s548707550.py
64
3.609375
4
N=int(input()) print("Yes" if input().count('R')>N//2 else "No")
c87486bfb55a0668a2b57859a24bfb332fc9445c
JaymesKat/Prime-Number-Generator
/src/app.py
498
4.09375
4
# this python function returns a list containing sequence of prime numbers below the given argument def prime_num_generator(end): noprimeNums = set(j for i in range(2, 8) for j in range(i*2, end, i)) primeNums = [x for x in range(2, end) if x not in noprimeNums] return primeNums def is_prime(num): ...
f63902d53439d6264484239ad5c1569d59a2a5de
Mandella-thi/Exercicios-Massanori-py
/exercícios-massanori-py/exercicios/pontas lista 11.py
305
3.921875
4
# B. pontas # Dada uma string s, retorna uma string com as duas primeiras e as duas # últimas letras da string original s # Assim 'palmeiras' retorna 'paas' # No entanto, se a string tiver menos que 2 letras, retorna uma string vazia def pontas(s): return s[0]+s[1]+s[-2]+s[-1] print(pontas('thiago'))
c54c8be82457e37117717d23c50ede328e6bcc56
firework-eternity/Personal-Python-Repository
/basics_test/csv_file.py
547
3.53125
4
import csv import os def csv_read(csv_name): # csv_path = "../test_data/" + csv_name dir_path = os.path.dirname(__file__) csv_path = dir_path.replace("basics_test", "test_data/" + csv_name) re_table = [] # file = open(csv_path) with open(csv_path) as file: # 文件自动关闭 table = csv.reade...
66a30dca87d42c916422a13db170716bf6dba583
tangentstorm/pirate
/pirate/test/python/microthreads_more.py
152
3.53125
4
from __future__ import generators #@TODO: 2.3 def count(): x = 0 while 1: yield x x = x + 1 g = count() for i in [1,2,3]: print g.next(),
9834c38ffda66a0a37b9046b89f8fb304e5d8e0e
guilleCM/Programacion_Python
/POO/Cuenta corriente/CuentaCorriente.py
3,603
3.53125
4
# Autor: guilleCM # coding=utf-8 # Enunciado: ##Construye una clase de nombre CuentaCorriente que permita almacenar ##los datos asociados a la cuenta bancaria de un cliente, e interactuar con ellos. #Propiedades privadas (de momento, en Python nos da igual que sean privadas): ####nombre, apellidos, dirección, teléfon...
59fa9a61a24a02406e42e9d7e8b35360338ae3a3
cjdhein/Random-Word-Generator
/Random-Word-Constructor.py
3,204
3.828125
4
import random """A Random Word Generator that uses a built-in algorithm that follows the syllable rules in the English language. Useful for finding a creative name for a business or app.""" alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w',...
1382183bfe6b698816e1a5031f7640f1f3d9276b
bmviniciuss/ufpb-so
/project1/SJF.py
3,723
3.5
4
class SJF: """Implements an SJF scheduler (Shortest Job First) """ def __init__(self, processes): self.processes = processes.copy() self.done = [] self.ready_queue = [] self.cpu_active = False self.on = False self.timer = 0 def get_processes(self): "...
41c7c0204d01fb2f3a891cd7b641a8452cd831f1
zwcoop/guttag_intro_comp_ed3
/ch2/fig2-7.py
322
4.03125
4
# Figure 2-7 Squaring an integer the hard way # The abs(x) is essential for the code not to enter an infinite loop x = int(input('Enter a positive or negative integer: ')) ans = 0 num_iterations = 0 while (num_iterations < abs(x)): ans = ans + abs(x) num_iterations = num_iterations + 1 print(f'{x}*{x} = {ans}'...
2e5764db0d1f898fb04850b04621bd646bf6ac75
akshitgupta29/Competitive_Programming
/LeetCode & GFG & IB/P2 - Happy Number.py
718
3.859375
4
''' Write an algorithm to determine if a number is "happy". A happy number is a number defined by the following process: Starting with any positive integer, replace the number by the sum of the squares of its digits, and repeat the process until the number equals 1 (where it will stay), or it loops endlessly in a cycle...
9bd70354f1fc810336177c846a20ab6738db9d5a
hsartoris/python
/Lab 5/read_file.py
250
3.515625
4
''' Created on Sep 23, 2013 @author: hsartoris ''' in_file = 0 if (raw_input("Short or long file? (S/L)") == "S"): in_file = open("yelp-short.txt", 'r') else: in_file = open("yelp.txt", 'r') for line in in_file: print line, len(line)
b59587c38765e23a5d821cc6d9560284ca88a71e
Jitha-menon/jithapythonfiles
/PycharmProject/fundamental_programming/Swapping/flow_of_controls/Looping_For Loop.py
372
4.21875
4
# For i in range (5): # print('hello') for a in range (2,8): print (a) # for in range with initial value final value and increment value for i in range (1,10,2): print (i) #problem to find numbers between min and max range min= int(input('enter the min num')) max=int(input('enter the max num')) for...
740ae7e5efdb1b428fcf131e70e9012a87e455ce
rnaster/Today-I-Learned
/2018/1811/181101.py
791
3.625
4
# BOJ - 2504 from collections import deque s = tuple(input()) stack = deque() for i in s: if i == ']' or i == ')': num = 0 while len(stack): val = stack.pop() if isinstance(val, int): num += val else: if i == ']' and val == '[': ...
70d105c4d4e13e8d42bfde1b9ebeed141b8a9eec
Valavala24/Rock-paper-scissors-
/RockPaperScissors.py
2,864
4.03125
4
# RockPaperScissors import getpass x = 0 # Keeps track of player X's current selection y = 0 # Keeps track of player Y's current selection x_wins = 0 # Keeps track of player X's overall wins y_wins = 0 # Keeps track of player Y's overall wins num_games = 2 # Player X will first choose and then player Y accordin...
26c845769a9608e625c87d0fd20c58efd155f762
heartyhardy/data-structs-python
/phaseII/data_structs/deque_test.py
343
3.75
4
from deque import Element, LinkedList, Deque el1 = Element("Apple") el2 = Element("Peach") el3 = Element("Orange") el4 = Element("Pear") el5 = Element("Kiwi") dq = Deque() dq.enqueue(el3) dq.push(el2) dq.enqueue(el1) dq.push(el4) dq.enqueue(el5) print(dq.ll.toArray()) dq.pop() dq.dequeue() dq.dequeue() dq.pop() ...
4a8674127013d05ff067051061d65f81c362f0dd
thesmigol/python
/1015.py
565
3.6875
4
import math enrtada = None entrada = None jfghjhgjhg = None kkkkkkkkkkk = None x1 = None x2 = None y1 = None y2 = None def read_line(): try: # read for Python 2.x return raw_input() except NameError: # read for Python 3.x return input() enrtada = read_line().split(" ") x1 = float((enrtada[0])) y...
81d206d3695e472459b642296717a5fd83bd6ee4
javahongxi/pylab
/lang/misc/enum_demo.py
336
3.671875
4
# from enum import Enum from enum import IntEnum,unique @unique class VIP(IntEnum): YELLOW = 1 GREEN = 2 BLACK = 3 RED = 4 print(VIP.YELLOW) print(VIP.YELLOW.name) print(VIP.YELLOW.value) print(VIP['YELLOW']) for v in VIP: print(v) print(VIP.YELLOW == VIP.YELLOW) print(VIP.YELLOW is VIP.YELLOW)...
d57c69aa459c52c3eb578ace97b827becbec8645
kalmalang/BMES-T580-2019
/Module06/wizard_battle.py
2,556
3.53125
4
import wizard_code as wc from random import choice if __name__ == '__main__': #creature = wc.Creature('small animal', 1) creatures_to_fight = [wc.Creature('bear', 5), wc.Creature('bird', 3), wc.Creature('wolf', 8), wc.Wizard('Evil Gu...
609c1cd4d9270abe2379ae59abbc32541d1a095e
doweyab/Personal_projects
/Piglatin_Translator.py
1,033
4.125
4
print("This code doesn't handle upper-case letters or punctuation.") vowels = "eaoui" consonants = "bcdfghjklmnpqrstvwxyz" def get_consonant_prefix(word): consonants = "bcdfghjklmnpqrstvwxyz" i = 0 consonant_prefix = "" while (consonants.find(word[i]) > -1): consonant_prefix += word[i] ...
51280fef7365a1f453e657fa8e4edf12599f01c6
StefanDimitrovDimitrov/Python_Basic
/03.Conditional_Statement_Ex/08_Schoolarship.py
656
3.625
4
from math import floor income = float(input()) average_score = float(input()) min_salary = float(input()) soc_scholarship = 0 scholareship_hight_score = 0 if income < min_salary: if average_score > 4.5: soc_scholarship = min_salary * 0.35 if average_score >= 5.50: scholareship_hight_score = average_...
9482600b6cd586262e84abbfa31f79f5d2bb5ffd
suraj-singh12/python-revision-track
/06-conditionals/64_ten_chars.py
172
3.859375
4
username = input("Enter username: ") if (len(username) < 10): print("Error!!",username,"is less than 10 characters long.") else: print(username,"meets conditions.")
21fddbf80ad8c0faabfdff76fe8cf1a0b31b56bf
solzhen/tarea1nn
/activation_functions.py
1,010
3.734375
4
# -*- coding: utf-8 -*- """ Activation functions Created on Fri Aug 30 23:55:11 2019 @author: Cristobal """ import numpy as np class ActivationFunction: def apply(x): ''' Applies function to input X ''' pass def derivative(z): ''' Calculates derivative in terms of the fu...
ca669658a7918b14db2a3d0b1249c70a040bbe1f
mauro-20/The_python_workbook
/chap1/ex04.py
264
4.09375
4
# Area of a field width = float(input('type the width of the field in feet\n')) length = float(input('type the length of the field in feet\n')) # computing the area in acres area = width * length / 43560 print('the area of the field is %.2f acres' % area)
cdacf80f2d8b772ba1d45a93d15abfeea9065f17
paulopradella/Introducao-a-Python-DIO
/Aula_8/Aula8_1.py
1,832
4.03125
4
#Lidando com módulos, importação de classes, métodos e # construção de funções anônimas (lambda) #Ex1.: # >>> import Aula7_3(tirar os prints # >>> televisao = Aula7_3.Televisao() # >>> televisao.ligada # False # >>> televisao.power() # >>> televisao.ligada # True # Ex2.:Outras forma de acessar um módulo: # >>> from...
c4c0a9e34f2ca6a59bbff71bdfde67c743f45b58
evenchen0321/testmac
/rework/3级菜单.py
847
3.578125
4
#!/usr/bin/env python # -*- coding:utf-8 -*- # Author: Even menu = { '北京':{ "昌平":{ "沙河":["oldboy","test"], "天通苑":["链家地产","我爱我家"] }, "朝阳":{ "望京":["奔驰","陌陌"], "国贸":{"CICC","HP"}, "东直门":{"Advent","飞信"}, }, "海淀":{}, ...
8236a429cf28322d7a826063478626777c8e9b27
iac-nyc/Python
/Python2.7/ichowdhury_3.1.py
778
3.5625
4
#Name: Iftekhar Chowdhury #Date: Nov 10, 2015 #HW : 3.1 while True: input = raw_input("Please enter 4 digit number: ") if input.isdigit() and len(input) == 4: break else: print "Sorry, '{}' is not a valid number.".format(input) this_sum = 0 count = 0 filename = 'c:\users\...
3f1d6d0aa11836b78ce6361f60a3c027568dc4fd
mick-d/python_lecture
/vs_tut/exam1.py
853
4.1875
4
import teaching def print_student_feedback(student_info: dict, feedback_mode="normal") -> None: '''Print students feedback according to their grades Parameters ---------- student_info A dictionary with student name as key and student grade as value feedback_mode ...
e3f06d27b15cbcec0484632c1c8506988961c006
JonLevin25/coding-problems
/daily-coding-problems/old/problem008/tests.py
1,366
3.6875
4
import unittest from solution.solution import * from queue import Queue def left_setter(parent_node): def assign(node): parent_node.left = node return assign def right_setter(parent_node): def assign(node): parent_node.right = node return assign def create_tree(*args): open_spots...
7727d174598ea2150e9faec0e9640bbf69d1ab46
FerisZura/RPG-Game
/Equip.py
7,353
3.875
4
from Functions import * # prints a gem if it is owned. prints (E) after if it is equipped def print_gem(gemCount, equipped, string): if equipped == 0: if gemCount > 0 and gemCount < 3: print(string) elif gemCount >= 3 and gemCount < 6: print(string + " LV2") ...
4350eae23b841f537ee8c7dc630855eb3ba509bb
profnssorg/henriqueJoner1
/exercicio43.py
1,055
4.46875
4
""" Descrição: Este programa verifica os maiores e menores números apresentados pelo usuário Autor:Henrique Joner Versão:0.0.1 Data:25/11/2018 """ #Inicialização de variáveis a = 0 b = 0 c = 0 maior = 0 menor = 0 #Entrada de dados primeiro = int(input("Digite um número: ")) segundo = int(input("Ok! Agora digit...
93eaa61623894e98372e5f371a91fcc1484dfa26
lilukai1/Coding-Challenges
/guessing_game.py
1,988
4.03125
4
## A simple 'guess the number' game! ## import random ## maybe add extra functionality? Like displaying what the old scores were, or how many times the game has been played ## scores = [100000,] def game_on(): solved = False answer = random.randrange(1,11) guesses = 1 if len(scores) == 1: pri...
5013d4b87e26d5cc38c90fc23b948912f267b4b4
KingsleyDeng/CoolPython
/国旗/国旗.py
565
3.90625
4
import turtle # 定义一个函数,可以画五角星 def picture(x1,y1,x,y): turtle.up() turtle.goto(x1, y1) turtle.down() #用于填充颜色 turtle.begin_fill() turtle.fillcolor("yellow") for i in range(5): turtle.forward(x) turtle.left(y) turtle.end_fill() # 速度为3 turtle.speed(3) # 背景红色 turtle.bgcolor("red")...
7ab4f08ce17a7323d55092c76d22ad088b899ff8
MartinMa28/Algorithms_review
/linked_list/0206_reverse_linked_list.py
652
3.96875
4
class ListNode: def __init__(self, x): self.val = x self.next = None class Solution: def reverseList(self, head: ListNode) -> ListNode: if head == None or head.next == None: return head next_node = head.next head.next = None while next_node: ...
ff243e6110546cd9f316131e1eb951a77e383704
Guan-Ling/20210125
/3-L.py
431
4.03125
4
# Write a program that solves a linear equation ax = b in integers. # Given two integers a and b (a may be zero), print a single integer root if it exists and print "no solution" or "many solutions" otherwise. a=int(input("a:")) b=int(input("b:")) if a!=0: c=b/a c=c*10 if c%10!=0: print("no solution") e...
12d10d3fefa15500836bc535bbe4209eebbc8b29
BlakeBagwell/week_one
/list_exercises/smallest.py
322
4.09375
4
numbers = [1, 2, 3, 3, 2, 5, 2, 3, 1, 3, 2] lowest = 0 #for i in range(len(numbers)): # for j in range(len(numbers)): # if numbers[i] < numbers[j]: # lowest = numbers[i] #print lowest a = [1, 2, 3, 2] minimum = a[0] for number in a: if minimum > number: minimum = number print minimu...
ea44a6bca42f1180ea54e392716322068f357d14
pretom97/Day5
/day5/lesson5B.py
835
3.828125
4
'''' if text expression: statment ''' players = ['Torun','Sourov','Asik','Rajib','Pritom'] for name in players : if name == 'Sourov': print(name.upper()) else: print(name.lower()) age = 21 if age >= 18: print('your old enough to vote') print('have you register for vote yet') else: prin...
4a33b07178ac0c0673e600b36eef6ef357bd1563
DeepNoceans/PythonPrograms
/Pygame!/L2/L2_C1_MadLib.py
2,363
3.796875
4
print("Mad Lib Game") print("Enter answers to the following prompts\n") guy = input("Name of a brave knight: ") girl = input("Name of princess: ") clan = input("Cool/Heroic animal (plural): ") enemy = input("Evil animal (plural): ") hours = input("Number from 2-5: ") weapon = input("Medival weapon (singular)(close com...
31ad5daff1576d5257d8fd2e170067db43836f3b
NourDT/Sudoku
/solution.py
7,377
3.96875
4
assignments = [] def assign_value(values, box, value): """ Please use this function to update your values dictionary! Assigns a value to a given box. If it updates the board record it. """ # Don't waste memory appending actions that don't actually change any values if values[box] == value: ...
aefc93b1c86e35ce1cdb7f285fa27e8dbc52cf1d
DriveMyScream/Python
/03_Strings/05_Escape_Sequence_character.py
328
3.96875
4
str = "Shubham is Good Boy" # For New Tab in String str = "Shubham \nis a Good Boy" print(str) # For New Tab in String str = "Shubham \t is a Good Boy" print(str) # Want a single coat in string str = "Shubham\' is a Good boy" print(str) # Want a Slash or in String str = "Shubham \\ is Good Boy" pr...
dc4f8e19d515d4e81109b86454c759b3623e55ae
qfaizan401/OpenCV
/chapter1.py
914
3.609375
4
#Chapter 1: Read- Images, Videos, Webcam import cv2 import numpy as np print('Package Imported', cv2.__version__) #Part 1: Read Images img_path = 'Resources/lena.jpg' img = cv2.imread(img_path) cv2.imshow('Lena', img) cv2.waitKey(0) #Part 2: Read Video video_path = 'Resources/IMG_0275.MOV.mp4' cap = cv2.VideoCapture...
5404390248ec7b0409a22df6ba2ab8019e83f1e5
MJHutchinson/PytorchPrivacy
/pytorch_privacy/analysis/online_accountant.py
2,118
3.671875
4
class OnlineAccountant(object): """ A class to perform accounting in an online manner to speed up experiments. requires an accountancy method to have an online method. """ def __init__(self, accountancy_update_method, ledger=None, accountancy_parameter...
0cef636afac5369a7b0d672335fd745535505303
zhengchaoxuan/Lesson-Code
/Python/Python基础/day 7/exercise_5计算指定的年月日是这一年的第几天.py
1,208
4.71875
5
""" exercise5:计算指定的年月日是这一年的第几天 设计逻辑:年判断是否为闰年,月的话每月的日期都不同,用元组表示 Version : 0.1 Author : 郑超轩 Date : 2020/02/11 """ """ param: year :年 month:月 day :日 return: date:该年第几天 """ def get_date(year,month,day): if year%4 ==0 and year%100!=0 or year%400==0 : months =(31,28,31,30,31,30,31,31,30,31...
e491168fad60c24e43e4c2f5f0e3687495ef39b2
cruigo93/leetcode
/easy/709.py
417
3.734375
4
from typing import List class Solution: def toLowerCase(self, str: str) -> str: new_str = "" for i in range(len(str)): c = str[i] if ord("Z") >= ord(c) >= ord("A"): c = chr(ord(c) + 32) new_str += c return new_str def main(): sol =...
8c0806adbd691d6e7db5e25da631da0c7e54a63d
KaShing96/hackerrank-challenges
/easy/sherlock_and_array/functions.py
3,009
3.75
4
# === Imports === import math import os import random import re import sys # === Function === def balancedSums(arr): """ Your code goes here. """ # Left and right sums left = 0 right = sum(arr) # Loop through each element, adding the previous element to left, and removing the current ele...
1a2d2826db7c0848f99e1a1d65bb4db2d8b3b32c
sunjilong-tony/python1
/test.py
273
3.984375
4
#coding=utf-8 print("hello,world") number=int(input("please input your number:")) if number < 18 : print("you are young") elif number >=18 : print("hello ,骚年") elif number >60 : print("haha") input("enter 退出") for number in range(100): print(numer)
105df97eb4c77c1098c818a825ebced65bb8cd50
mathans1695/Python-Practice
/codeforces problem/WayTooLongWords.py
227
3.65625
4
n = int(input()) result = [] for i in range(n): word = input() if len(word) <= 10: result.append(word) else: result.append(word[0] + '{}'.format(len(word[1:len(word)-1])) + word[len(word)-1]) for i in result: print(i)
738dcee30452cdf0f170339df27d88064069c845
jocelo/rice_intro_python
/practice_excercises/week_0b/11_herons_formula.py
528
3.75
4
#x0, y0 = 0, 0 #x1, y1 = 3, 4 #x2, y2 = 1, 1 #x0, y0 = -2, 4 #x1, y1 = 1, 6 #x2, y2 = 2, 1 x0, y0 = 10, 0 x1, y1 = 0, 0 x2, y2 = 0, 10 a = ((x0-x1)**2+(y0-y1)**2) ** (1.0/2.0) b = ((x1-x2)**2+(y1-y2)**2) ** (1.0/2.0) c = ((x0-x2)**2+(y0-y2)**2) ** (1.0/2.0) semi = (a+b+c)/2.0 area = (semi*(semi-a)*(semi-b)*(semi-c)...
fb30a2e639653d9a98a9440be797384c0de87278
tsumo/solutions
/project_euler/003-largest_prime_factor.py
1,747
3.984375
4
#!/usr/bin/env python3 """ Largest prime factor Problem 3 The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ? """ import pe_utils def lpf_naive(n): largest_prime = 0 current_prime = 0 while current_prime < n: current_prime = next_prime...
cad38b889cf060f59298ecd216d914f3435fb155
Staggier/Kattis
/Python/leftbeehind.py
299
3.921875
4
def leftbeehind(): while True: n, k = [int(x) for x in input().split()] if n == 0 and k == 0: return if n + k == 13: print("Never speak again.") elif n == k: print("Undecided.") elif n > k: print("To the convention.") else: print("Left beehind.") leftbeehind()
542e58c6e54d714b60944bbbeb08b6cd1ea9b103
lokeshagg13/Path-Finder
/Helper/Geometry.py
726
3.78125
4
class Vector2: def __init__(self, _x=0, _y=0): self.x = _x self.y = _y @staticmethod def zero(): v = Vector2(0,0) return v @staticmethod def one(): v = Vector2(1,1) return v def __str__(self): return '({0},{1})'.format(self.x,sel...