blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
26985dd0275d4550a2b4c97dc8509b69cd31123e
horeaNicolae/python_training
/ica/builtInFunctions.py
375
3.546875
4
def highest_num(*args): print(max(args)) return(max(args)) x = highest_num(-20, 4, 1, 14, -10, 0) def lowest_num(*args): print(min(args)) return(min(args)) y = lowest_num(-20, 4, 1, 14, -10, 0) def abs_function(a): print(abs(a)) abs_function(-20) abs_function(15) print(type(99)) print(type(9...
57506ef6eb295cb4208606227baa50ef1ea36f9d
Matt-J-Jones/Password-Cracking-Game
/Password Cracker Game.py
1,244
3.671875
4
import random x=[0,0,0,0,0] y=[1,2,3,4,5] def genX(): x[0]=random.randint(1,5) x[1]=random.randint(1,5) x[2]=random.randint(1,5) x[3]=random.randint(1,5) x[4]=random.randint(1,5) def genY(): global y userInput1=input("Enter First Number (1-5): ") if userInput1 == "": userInput1=0 use...
4fde366610d69b95e54c0e7559212c87780270a2
jinwoov/hacktoberfest
/Scripts/random_print_of_helloworld.py
834
3.78125
4
# Aim: print each letter of 'hello world' in order and in random points in time # How: printing letter based on whether the ascii code of each letter appears in the milliseconds of the current time # get the characters of the phrase in ascii code and put them in a list helloworld = 'hello world' in_ascii = [] for i in...
63fba9e5bc8ee5944df55ad7c3741a10d663c456
jinwoov/hacktoberfest
/Scripts/heythere.py
135
4
4
greeting = '' for i in range(3): if i < 2: greeting +="HEY, " else: greeting += "HEYYY THERE!!" print(greeting)
fdfd6c6a56dafa81ae766ca6406906903b17200b
jinwoov/hacktoberfest
/Scripts/jk.py
444
4
4
from time import sleep ## iterating to the forloop def iterator(numb): for i in range(1,numb): print(f"Mochi love you") sleep(.01) def interface(): userInput = input(""" 1) Iterator 2) Exit """) if(userInput == "1"): how_many = input("how much do you want to it...
9cf547fba54288f0cec08d817c2868309001ef40
urjasvit/Team6_INFO7374_Spring2021
/Labs/Lab-06/app.py
1,088
3.625
4
import streamlit as st import os import pandas as pd st.title('Heart Disease Diagnosis Assistant') st.markdown('This application is meant to **_assist_ _doctors_ _in_ diagnosing**, if a patient has a **_Heart_ _Disease_ _or_ not** using few details about their health') df = pd.read_csv('heart.csv') if ...
8f8ee9eb7c243c63805a6db391b9d6fd4727222e
Soogyung1106/Algorithm-Study
/백준/삼성 SW 역량 테스트 기출 문제/[14499]주사위 굴리기/지민.py
1,253
3.546875
4
import sys def roll_dice(move): if move == 0: #동쪽 dice[3], dice[2], dice[6], dice[4] = dice[2], dice[6], dice[4], dice[3] elif move == 1: #서쪽 dice[3], dice[2], dice[6], dice[4] = dice[4], dice[3], dice[2], dice[6] elif move == 2: #북쪽 dice[3], dice[5], dice[6], dice[1] = d...
eaa1708dccc03a0c802d4b6051b6ea462b35a2a2
Soogyung1106/Algorithm-Study
/백준/문자열/[5636] 소수 부분 문자열/지민.py
1,046
3.5
4
import sys def find_prime_number(): _n = int(max_number**0.5)+1 for n in range(2, _n): if prime_number[n]: for _idx in range(n+n, max_number+1, n): prime_number[_idx] = False input_func = sys.stdin.readline if __name__ == '__main__': max_number = 100000 prime_numb...
adaa8f9e9005302d140b7e3cc43d8d7c6ce97b64
rosithkumar143/python-programming-
/lap year.py
77
3.703125
4
a=int(input()) if(a%4)==0: print("leap year") else: print("not leap year")
0ceeda305b02e9467fe56139d3c71f1b0db0d0d4
flyingcoder900/ReactionCoach
/ReactionGameSample.py
1,517
3.90625
4
from time import time as the_timer import datetime import random import time now = datetime.datetime.now() print(str(now)) # print("current year: {}".format(now.year)) # print("current month: {}".format(now.strftime("%B"))) # print("current day: {}".format(now.strftime("%A"))) # print("current hour: {}".format(now.s...
121d8e794a21c00c081bdcc7d1314d85ef5cf605
OscarLpz95/TC1014
/WSQ11.py
906
3.859375
4
#Oscar Lopez def pal(x): x2 = str(x) x3 = x2[::-1] x4 = int(x3) if(x==x4): return True else: return False nonlycherels = 0 Lycherels = 0 npalindromes = 0 x = int(input("Give me the lower bound of the sequence: ")) y = int(input("Give me the upper bound of the sequence: ")) print("Range of numbers analysed: ...
098485957c576193159618e2013e2f9fd4896c47
Dememedp/pet26
/Task26/Task26.py
805
4.03125
4
def get_shortest_word(str): array = list() word = "" arrayoflen = list() length = 0 for letter in str: if letter == " ": array.append(word) arrayoflen.append(length) word = "" length = 0 else: word += letter ...
1d519bcef6dfc587beafcc8dd5e459367f5b2e4b
jihed98/DjangoProject
/WordCommunity/forum/textProcessor.py
1,018
3.8125
4
import string import re def textToDict(text,short=0): ''' la punteggiatura viene eliminata :param text: testo come stringa :param short: lunghezza delle parole da eliminare quando si crea l'articolo :return: è un dizionario contentente come chiave la parola del testo e come valore la sua frequenz...
71f12b82745824ee72f0290b2a977a04edd34dd1
Lone-Warrior007/Registration_Form.py
/Registration_Form.py
1,370
3.5
4
import tkinter as tk import tkinter.ttk as ttk from openpyxl import * from tkinter.messagebox import showinfo win = tk.Tk() win.title("Registration Form") def save(): f_name = entry.get() l_name = entry1.get() age = entry2.get() wb = Workbook() ws = wb.active ws["A1"] = "First Name" ws["...
4233b2fd0b9b01fb4655e0dc96dd3ac0399696c4
kamarshi/data-structures
/binheap/minheap.py
1,649
3.515625
4
#!/usr/bin/python import os import sys import heapq import show_tree # Implements a minheap class, using the heapq module class minheap(object): def __init__(self): ''' Possibly nothing ''' pass def heappush(self, objlist, obj): ''' Make sure new obj type...
f777c4b90ed54004826574981d312f2b100c7dc0
cwey12/Data_Generation_BNG
/Data_formatter.py
3,415
3.515625
4
# this function takes an input of 'gene' and 'number of cells' and 'directory' and outputs a df with the time resolutions x data for the genes in the cells import pandas as pd import os import math import random import matplotlib.pyplot as plt #this function takes in a directory of gdat files and returns one list of d...
916669b0d2621eb81de02c21c0d90b5709c42e47
pymmrd/mazezoom
/src/mazezoom/creepers/utils.py
575
3.609375
4
# -*- coding:utf-8 -*- from datetime import datetime, timedelta def get_yesterday(d=None): if d is None: d = datetime.now() yesterday = d - timedelta(days=1) return yesterday def datetime_range(d=None): if d is None: today = datetime.now() start_date = datetime( to...
b36bca14ab140cd97731f155eb0a78358c6dd6bf
abilal19/building_footprint_ensemble
/common_utils/time_keeper.py
1,271
3.6875
4
import time from common_utils.basic import roundf # A utility class for keeping track of the elapsed times of various tasks class TimeKeeper: def __init__(self, default_precision=None): self.timers = {} self.default_precision = default_precision # Store the starting time of a task via its name...
c2052f2b337e2d196a07461344e76d160c1d0d6d
sandeshxen/myfirstgitrep
/hello.py
328
3.796875
4
lis = ["ram","shyam","hari"] a = int(input("enter any quantity of name you wanna generate : " )) if a==1: print(lis[0:1]) elif a==2: print(lis[0:2]) elif a== 3: print(lis[0:3]) else: print("you can not generate more than 3 name!!!!") # there is nothing you can do about it #sandesh mayar #sandesh sen th...
2ff8bcf33a669379325ba7e282c23ed9faec8029
devclassio/200-interview-algorithm-questions
/binarySearchTree/core/insertBST.py
3,242
4.15625
4
''' Insert into a Binary Search Tree You are given the root node of a binary search tree (BST) and a value to insert into the tree. Return the root node of the BST after the insertion. It is guaranteed that the new value does not exist in the original BST. Notice that there may exist multiple valid ways for the inser...
ce8b6f338d0d31ee74831b5e343356a49123275e
ajbyrd/python-chapter-8-exercises
/cashToCoins.py
564
3.578125
4
import math def make_change(): dollarAmount = 8.69 piggy_bank = { "pennies": 0, "nickels": 0, "dimes": 0, "quarters": 0 } piggy_bank["quarters"] = math.floor(dollarAmount / .25) dollarAmount = dollarAmount % .25 piggy_bank["dimes"] = math.floor(dollarAmount / .1...
033982803269a8a3f5051c2bc3a90a0029406709
komerela/twitterbot
/user.py
624
3.5625
4
#!/usr/bin/python3 """ User class """ class User: """ Documentation """ def __init__(self): """ Documentation """ self.__email = 0 @property def email(self): """ Getter function """ print("getter method called") return self.__email @email.setter d...
766a706c6e3c45afd34358703d59fc450ba8ce1f
ndeimler99/motif-mark
/motif-mark.py
19,177
3.71875
4
#!/usr/bin/env python #import required modules (argparse for user input, cairo for graphics) import argparse import cairo import re import itertools import matplotlib as mpl import matplotlib.pyplot as plt ################################################################################################################...
045a87bbeed739632eff5020cc67a2837ef56eed
isharajan/python_stuff
/lincked_list.py
1,437
3.796875
4
class Node(): def __init__(self,data): self.data = data self.nxt =None @staticmethod def display(head): temp=head while(temp.nxt!=None): print("%s-->"%(temp.data),end=" ") temp = temp.nxt print("%s-->"%(temp.data)) @staticmethod def ...
0f503a003d39ea448435a6e440c8034143b0c1a9
PanaratDuke/python-challenge
/PyFinances/main.py
2,281
3.515625
4
import os import csv csv_path = os.path.join('budget_data.csv') csv_out = os.path.join('budget_analysit.csv') #--Variable for storing data in dictionary total_month = 0 net_total = 0 cal_change = [] cal_percent_change = [] last_row = 0 count = 0 acc_bd = 0 budget_diff = 0 great_inc = 0 great_dec = 0 #--Readin...
8645806695acd442fee2a71f61c041f0b1eef055
AlenVeselic/PyTest
/Chapter 12/cmdEmail.py
1,635
3.578125
4
#! python3 # cmdEmail - sends an email from the users gmail account # Inputs: Recipient email, message and when selenium reaches gmail login it prompts the user to put it in into the command line from selenium import webdriver from selenium.webdriver.common.keys import Keys import pyinputplus as pyip i...
e77b99f897eedbf0435dc9a1fdb45c1b9743836a
suguby/promprog15_1
/homework2/39 - conditional counters.py
606
3.78125
4
#! /usr/bin/env python # -*- coding: utf-8 -*- my_list = [2, 3, 5, 7, 9, 13, 21, 25, 38, 42, 65, 90, ] # разделить на 3.0 те элементы # которые делятся нацело на 5 # в результате должен получится укороченный список my_list_3 # вариант 1 - c помощью цикла for for ...: ... # вариант 2 - с помощью операций map и ...
c61a4867be3b484942279f88404f779e72fa7bf8
suguby/promprog15_1
/homework3/41 - factorial fabric.py
357
3.9375
4
#!/usr/bin/env python # -*- coding: utf-8 -*- # написать генератор для получения последовательных факториалов def factorial(N): value = 1 for i in range(...): value = ... yield ... for f in factorial(5): print f # должен выдать 1, 2, 6, 24, 120
04b4e9b437206b2d0251a8a9d6abdc86ea887c7a
you-leee/python-hackerrank
/Algorithms/Implementation/1_1_CatsAndMouse.py
441
3.734375
4
# https://www.hackerrank.com/challenges/cats-and-a-mouse/problem def catAndMouse(x, y, z): a = abs(z - x) b = abs(z - y) if(a < b): print("Cat A") elif(b < a): print("Cat B") else: print("Mouse C") if __name__ == "__main__": q = int(input().strip()) for a0 in range(...
66da7b4e586750198995938782b1c2773bee265a
you-leee/python-hackerrank
/ProjectEuler/2_EvenFibonacci.py
260
4.03125
4
def fibonacci(n, a, b, fiter): if b < n: if fiter % 3 == 0: return b + fibonacci(n, b, a + b, fiter + 1) else: return fibonacci(n, b, a + b, fiter + 1) else: return 0 s = fibonacci(10, 1, 1, 2) print(s)
322843a47adca993b93faee42b3ee2788ce0c25b
you-leee/python-hackerrank
/Algorithms/Implementation/1_1_AppendAndDelete.py
681
3.609375
4
# https://www.hackerrank.com/challenges/append-and-delete/problem def appendAndDelete(s, t, k): s_len = len(s) t_len = len(t) if (s_len + t_len) <= k: return "Yes" # Find number of letters in common subsequence from begin of str for i in range(min(s_len, t_len)): steps_required = s...
0f0db916478c81874e6ba3e9e8df46e703162adb
you-leee/python-hackerrank
/Algorithms/Implementation/1_1_DrawingBook.py
757
4.0625
4
# Brie’s Drawing teacher asks her class to open their n-page book to page number p. # Brie can either start turning pages from the front of the book (i.e., page number 1) # or from the back of the book (i.e., page number n), # and she always turns pages one-by-one (as opposed to skipping through multiple pages at o...
ccfc4dbac1cf78f323c33bb8a15f12ad4e351b9b
Catbug33/task1
/task1.py
1,374
3.609375
4
import numpy array = numpy.random.random_integers(0,9,(10,10,10)) print array biggest_sum = 0; dimension = len(array) for i in range(dimension): for j in range(dimension): for k in range(dimension): sum_current = 0 # print 'XXX' for x in range(0, dimension): ...
46b433f1c653944e90b83aea12b4ebdf3b9a7f43
nicolassnider/python_39
/seccion14/45 - ejercicio compresion list.py
468
3.5
4
x = int(input("ingrese el valor de X: ")) y = int(input("ingrese el valor de y: ")) z = int(input("ingrese el valor de z: ")) n = int(input("ingrese el valor de N: ")) # devolver -->[i, j, k] # i : 0<= i <= x --> range(0,x+1) # j: 0<= j <= y --> range(0, y+1) # k: 0<= k <= z --> range(0, z+1) # (i + j + k) != ...
5e80df1b92278b78b7503089d8626f34ffc8d575
nicolassnider/python_39
/analisis y visualizacion de datos/seccion03/09 array multid.py
487
3.640625
4
import numpy as np arreglo = np.array([0,1,2,3,4,5]) arreglo, type(arreglo) notas = [16,17,14,17,19,15] print(type(notas)) ar_notas = np.array(notas, dtype=float) print(type(ar_notas)) print(type(ar_notas[0])) ar_notas_todas = np.array(([0,1,2,3,4,5], notas)) print(ar_notas_todas) for nodo_nota in ar_notas_todas...
5ea7cea6583da010e517b931a041079f629fc4a1
nicolassnider/python_39
/seccion03/09 - cadenas.py
443
3.734375
4
cad1 = "hola " cad2 = "mundo!" print (cad1 + cad2) cad1 = "hola" cad2 = "mundo!" print (cad1 +" "+ cad2) print (3 * cad1) largo = len(cad1) print(largo) cad3="" print(len(cad3)) argentina = "Argentina" print("Index char 1: ", argentina[1] ) print("Index char -1: ", argentina[-1] ) print("Index char 2:5 ", argenti...
ebe9ee4adc8052944f22fce6651398ce28f0c21c
SubhamPaul21/Python_Projects
/Data_Structures/Binary_Search_Tree.py
3,712
4.28125
4
# Initialize the Node class to create new node class Node(object): def __init__(self,data): self.data = data self.leftChild = None self.rightChild = None # Initialise the BST class to make the tree class BinarySearchTree(object): def __init__(self): self.root = None ...
8d99efc97d979365f491f606c932b3787c4d66d0
stellaribas09/Avaliacao1
/Questao_20.py
216
3.828125
4
argumento1 = input('Primeiro argumento: ') argumento2 = input ('Segundo argumento: ') argumento3 = input ('Terceiro argumento: ') Soma_Argumento = argumento1 + argumento2 + argumento3 print (Soma_Argumento)
e9a5c7d3b742de776d9c441c5dc4e979d246ffb7
Weifarers/ECEN-689-Machine-Learning
/Homework #5/cs231n/classifiers/neural_net.py
15,102
3.90625
4
from __future__ import print_function from builtins import range from builtins import object import numpy as np import matplotlib.pyplot as plt from past.builtins import xrange class TwoLayerNet(object): """ A two-layer fully-connected neural network. The net has an input dimension of N, a hidden layer di...
0edfe460eb044805f188bdf8727eb4f74dd4e539
Sarbjyotsingh/learning-python
/Control Flow/forLoop.py
4,826
4.03125
4
cities = ['new york city', 'mountain view', 'chicago', 'los angeles'] for city in cities: print(city.title()) capitalized_cities = [] for city in cities: capitalized_cities.append(city.title()) # Range Function # With one variable argument become stop element print(list(range(4))) # With two variable arg...
8b958447d85aaffeb958caf95aec93742e7377f8
Sarbjyotsingh/learning-python
/Data types and Operators/integersAndFloats.py
409
4.21875
4
print(3/4) print(16/4) print(type(4)) print(type(3.4)) # After decimal point there is no need to put number or 0 print(type(3.)) # operation on int and float will always be float print(type(3+4.2)) # Converting Float to int print(int(49.7)) # converting int to float print(float(3520 + 3239)) # python use approxim...
26d6c0cb5e6108fff856f4bba8f72d5d5483bec9
manojbahadur/python-programs
/csvattach_mj.py
422
3.75
4
import matplotlib.pyplot as plt import csv filename = "sheet1.csv" x = [] y = [] with open(filename, 'r') as csvfile: csvreader = csv.reader(csvfile, delimiter=",") for row in csvreader: x.append(int(row[0])) y.append(int(row[1])) plt.plot(x, y, color='b', linestyle='--', marker='o', markerfacecolor='g', m...
d697a20f98301603b4afe6f512289a0dbbbd0ae3
manojbahadur/python-programs
/mjran.py
204
3.875
4
import random p=0 d=0 while True: r=input("Press r to roll the die") if r=="r": d=random.randint(1,6) print("You got:",d) if d==1 or d==6: p=d break print("You are in the game at position",p)
ff225c1c021de4a11a950f741e1f4effb29769c6
NeelJVerma/Daily_Coding_Problem
/Class_Scheduler/main.py
775
3.765625
4
""" Given an array of time intervals (start, end) for classroom lectures (possibly overlapping), find the minimum number of rooms required. """ def scheduler(l): l = sorted(l, key=lambda x: x[1]) queue = [] rooms = 1 queue.append(l[0]) for i in range(1, len(l)): while queue and queue[0][1...
22ae7a51494dcf7cee8fc2d0514297af53dc009b
NeelJVerma/Daily_Coding_Problem
/First_Missing_Positive/main.py
1,059
3.578125
4
""" Problem statement: Given an array of integers, find the first missing positive integer in linear time and constant space. """ def separate(l, size): returnpos = 0 for i in range(size): if l[i] <= 0: l[i], l[returnpos] = l[returnpos], l[i] returnpos += 1 return returnp...
89393cbeeaeb1c65f8988ffe6930667660fe1dcd
NeelJVerma/Daily_Coding_Problem
/Construct_Sentence/main.py
1,325
4.0625
4
""" Given a dictionary of words and a string made up of those words (no spaces), return the original sentence in a list. If there is more than one possible reconstruction, return any of them. If there is no possible reconstruction, then return null. For example, given the set of words 'quick', 'brown', 'the', 'fox', a...
f87e3eddcb5d2262dd90e7633572c767a23d2212
Cathalysator/cenglert
/triangle.py
249
3.734375
4
# Task 4: Draw a equilateral triangle with edge-length 100. import turtle turtle.home() turtle.forward(50) turtle.left(120) turtle.forward(100) turtle.left(120) turtle.forward(100) turtle.left(120) turtle.forward(50) input("press enter to exit")
70f556478a7eed12a3d3bb22e1cb74c2c7b5829a
HollowJH/Rock-Paper-Scissors
/Rock-Paper-Scissors/task/rps/game.py
1,982
3.59375
4
import random name = input("Enter your name: ").strip() print(f"Hello, {name}") choices = input().split(",") options = choices if choices != [""] else ["rock", "paper", "scissors"] rating = open("rating.txt") read = rating.readlines() lines = [i.strip("\n").split(" ") for i in read] names = [i[0] for i in lines] rat ...
879448270cb7ab8df14f79a49989a058db9ba40d
wlodpawlowski/python-test-docs
/python-first.py
12,873
3.96875
4
# The range() Function: print('--------------------') for i in range(5): print(i) print('--------------------') for i in range(5, 10): print(i) print('--------------------') for i in range(4, 34, 3): print(i) print('--------------------') for i in range(-10, -100, -20): print(i) print('-------------...
e974188b0338c8c08998690d5bf1b7ba99c259a8
Oliver-Feighan/exercise_log
/utils/data_objects.py
1,419
3.546875
4
import datetime class CalisthenicsData(object): """ the data object that contains the data to be input into the calisthenics table. >>> import datetime >>> calisthenic_data = \ CalisthenicsData({ \ "logdate" : datetime.datetime.now().date() \ , "pushups" : 75 \ , "pullups" : 18...
4d28f77951325d58ecbf585d271b5e431bb3b7d7
mjmandelah07/Hyperskill-Python
/python_overview.py
1,879
4.5625
5
# 1. The Hello World program # Here, print is the name of a function. A function is a block of code that does some useful work for you, e.g. prints a text. # In some sense, a function is a subprogram that can be reused within your programs. # When the name of a function is followed by parentheses, it means t...
b01f4813b29e53a64ed756e8efa5cbbd65691ba8
mjmandelah07/Hyperskill-Python
/boolean_logic.py
1,022
4.0625
4
# Boolean type # The Boolean type, or simply bool, is a special data type that has only two possible values: True and False. # In Python, the names of boolean values start with a capital letter. is_open = True is_closed = False print(is_open) # True print(is_closed) # False # Boolean operations # There are three ...
1c3b5db0540617e4865d2c4e04dca5765892c29b
edwinsentinel/pythonbots
/webscraper.py
546
3.71875
4
# import libraries import urllib from bs4 import BeautifulSoup #specify the url quote_page='http://www.bloomberg.com/quote/SPX:IND' #query the website and return the html to the variable 'page' page= urllib.urlopen(quote_page) #parse the html using beatifulsoup and store in variable 'soup' soup=BeautifulSoup(pag...
9667ba5c386431ef022b882533cfbe5f36974f4f
Blitzidus/Schoolwerk
/Les 4/PE4_4.py
277
3.546875
4
def new_password(oldpassword, newpassword): if oldpassword != newpassword: if len(newpassword) < 6: return 'Prima' else: return print('oldpassword + honderd') print('newpassword + honderd') print(new_password(honderd, honderd))
077c4870a8df5dc31f36d6aaa0f0d3f27e3c8a21
Blitzidus/Schoolwerk
/Les 3/Les.py
410
3.6875
4
nameAgeList = [('Jeroen', 18), ('Pieter' , 14), ('Maria', 23)] #name = input('geef je naam: ') #age = eval(input('Geef je leeftijd: ')) for item in nameAgeList: name = item[0] age = item[1] if age >= 18: print('Beste ' + name + ', je mag stemmen.') else: wachtTijd = 18 - age pri...
5c0000e8dca31c9c3a4f80cb3a5a148a89e05d27
Blitzidus/Schoolwerk
/Les 6/PE6_3.py
400
3.53125
4
invoer = "5-9-7-1-7-8-3-2-4-8-7-9" numbers = invoer.split("-") numbers = list(map(int, numbers)) numbers.sort() print("Gesorteerde list van ints: {}".format(numbers)) print("Grootste getal: {} en Kleinste getal: {}".format(numbers[-1], numbers[0])) print("Aantal getallen: {} en Som van de getallen: {}".format(len(numbe...
8112f60936076c8bd0dfd8965381e8e028937599
nickcresner/python-lessons
/ex2.py
461
4.15625
4
print("I will now count my chickens:") print("Hens: ", (25+30)/6) print("Roosters: ", ((100-25)*3)%4) print("I will now count my eggs: ") print("Eggs: ", 3+2+1-5+4%2-1/4+6) print("Is it true that 3 + 2 < 5 - 7?") print(3+2<5-7) print("3 + 2 = ", 3+2) print("5 - 7 = ", 5-7) print("Oh that's why it's false.") p...
d701cd08f37e2d59da4cfc8a0a8d7379578e61d9
nickcresner/python-lessons
/ex-5-homework1.py
503
4.1875
4
# write a paragraph out with a bunch of equations and variables so people can choose their own adventre. Practice with variables and maths variable1 = input("Where did you take her for on Monday? ") variable2 = input("What did you make on Tuesday? ") variable3 = input("What did you do on Sunday? ") print(f"") print(f...
5e473069a96483f159efbdbdbd4973f6c8a5c8aa
pannal/Sub-Zero.bundle
/Contents/Libraries/Shared/rebulk/utils.py
3,867
3.6875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Various utilities functions """ from collections import MutableSet from types import GeneratorType def find_all(string, sub, start=None, end=None, ignore_case=False, **kwargs): """ Return all indices in string s where substring sub is found, such that sub...
ca2bad5f7998e5d5f1b164ab80307714d63efee7
pannal/Sub-Zero.bundle
/Contents/Libraries/Shared/guessit/rules/common/words.py
2,504
3.703125
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Words utils """ from collections import namedtuple from . import seps _Word = namedtuple('_Word', ['span', 'value']) def iter_words(string): """ Iterate on all words in a string :param string: :type string: :return: :rtype: iterable[str] ...
76e5d27ca6d508952b64614bd928f4d0a2e43eab
The-Rabak/100Days_25
/states_game.py
1,366
3.640625
4
import pandas as pd import turtle screen = turtle.Screen() screen.title("US States Guessing Game") img_file = "blank_states_img.gif" screen.addshape(img_file) turtle.shape(img_file) df = pd.read_csv("50_states.csv") df['state'] = df.state.apply(lambda x: x.lower()) total_states = len(df) correct_answers = dict() def ...
db72eae63b062f090440a79c7f2509f54965fc23
dipro007/Python-all-in-one
/TaxCal.py
519
4.125
4
income = int(input("Enter income : ")) taxPayable = 0 print("Given income", income) if income <= 10000: taxPayable = 0 elif income <= 20000: # income is $45000 the income tax payable is $10000*0% + $10000*10% + $25000*20% = $6000. taxPayable = (income - 10000) * 10 / 100 else: # firs...
cbdba60732998526c70d22021aa0decedfddfd6f
dipro007/Python-all-in-one
/+-.py
234
4.28125
4
a = int(input("Enter a number: ")) if a > 0: print(a, "is Positive") elif a < 0: print(a, "is Negative") else: print(a, "Equal to zero") if a % 2 == 0: print(a, "is Even") else: print(a, "is Odd")
7e06262e4276715b96c3f63865c934b07e888245
dipro007/Python-all-in-one
/Varriable.py
408
3.625
4
name = "Muhtasim Shafi Dipro" age = 23 cgpa = 3.5 pa = 2021 code = 'Python' print("Our student name is "+name) print(name+" lives in London") print(name+" is ",age," years old") print(name+" is ",age," years old ,started learning ",code," programming language") print(name +" scored ", cgpa, ' CGPA in final')...
38a43f71ad7871dcec6b8f029a896c258c68d69b
zjjzjj123/thread_learn
/11.线程通信.py
1,296
3.78125
4
import threading import time ''' 1.线程同步:存在多个线程时,每个线程访问共享资源的时候,保证每次只能有一个线程对其访问 但到底是哪个线程抢到访问权,是未知的,谁先抢到谁先 随机的 2.线程通信:每次也是只能有一个线程访问资源,但是,在当前线程结束后,可以通知指定的线程过来访问资源 有序的,非随机的 ''' def goevent(): e = threading.Event() # 事件 def go(): e.wait() #等待 #直到set e.clear() print('go') threading...
cd604603104b75749450f85f4af266132b87f692
kgisl/english
/example.py
390
3.796875
4
def fact(n): if n <= 1: return 1 else: return n * fact(n-1) # Output 2 Compare n and 1 2 If n is lesser or equal to 1 3 Return 1 4 Else 5 Compute n minus 1 5 Call fact with result of n minus 1 as argument 5 Compute n times result of call to fact 5 Return result of n times call to fact def foo...
2dec19fb4d938e63a32926a527ea4aab45419770
TKristof09/ConnectFour
/game.py
989
3.78125
4
class Game(): def __init__(self, name): self.name = name def get_initial_board(self): """ Return: initial board """ pass def is_over(self, board, player): """ Return: 0 if not over -1 if player lost ...
cbc3fff809c8c7fa4c0f8b096aaf984554e5dc69
AlexMusabelliu/Elevator-Scheduling
/Elevator.py
5,528
3.734375
4
from turtle import Turtle, Screen from random import randint #Finds shortest available path for one elevator: |*| #Finds shortest available path for multiple elevators: |*| #Adds delay to command to prevent bumping with more than minEdge(n) elevators: |*| #Add way to carry out commands | | #Able to queue command:...
fa4d57d2a595a01ae651da76b6814b960e624bc3
HydrogenQAQ/LeetCode-Python
/#102.py
1,832
3.984375
4
# Author: Jin # Definition for a binary tree node. class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def levelOrder(self, root): """ :type root: TreeNode :rtype: List[List[int]] """ ...
b6dd1ea9822c33fe4eb8ada4d1ed50af7e152c7f
HydrogenQAQ/LeetCode-Python
/#9.py
718
3.71875
4
# Author: Jin class Solution(object): def isPalindrome(self, x): """ 判断数字是否回文(正序倒序一样) :type x: int :rtype: bool """ # 负数不是回文数 if x < 0: return False cnt, n = 0, x while n: n //= 10 cnt += 1 left, ri...
7142f793b08041a549fabf5f225198ca545ec3e6
HydrogenQAQ/LeetCode-Python
/#55.py
657
3.78125
4
# Author: Jin class Solution(object): def canJump(self, nums): """ :type nums: List[int] :rtype: bool """ if len(nums) == 1: return True def path(num, index): if num + nums[num] >= index: l.append(True) elif nums[...
4bec02b21c2ff4609a880c9fe0016e873e11c7ea
imohweb/Code-Challenges
/land_perimeter.py
1,547
4.09375
4
"""Given an array arr of strings complete the function landPerimeter by calculating the total perimeter of all the islands. Each piece of land will be marked with 'X' while the water fields are represented as 'O'. Consider each tile being a perfect 1 x 1piece of land. Some examples for better visualization: ['XOOXO', ...
7beda138884dac08e6aa497a05fc524bb555385e
imohweb/Code-Challenges
/curry_partial.py
843
4.65625
5
"""Currying and partial application are two ways of transforming a function into another function with a generally smaller arity. While they are often confused with each other, they work differently. The goal is to learn to differentiate them. Given: def add(x, y, z): return x + y + z add(1, 2, 3) # => 6 But we ca...
a8199e89b4d50b2fc82e1b85309d1aff2eb7fe21
imohweb/Code-Challenges
/sum_pairs.py
1,005
3.53125
4
"""Given a list of integers and a single sum value, return the first two values (parse from the left please) in order of appearance that add up to form the sum.""" # def sum_pairs(ints, s): # result = [] # seen = {} # for i in range(len(ints)): # if seen.get((s - ints[i]), 0) != 0: # ...
5609821239e8c74ec594edd130756ca2587b06e9
imohweb/Code-Challenges
/sort_array.py
1,272
4.15625
4
"""You have an array of numbers. Your task is to sort ascending odd numbers but even numbers must be on their places. Zero isn't an odd number and you don't need to move it. If you have an empty array, you need to return it.""" #====================initial solution====================================== # def sort_a...
4ccdfb78294e17ea5c5c9fdd16ed5e02aa381c8c
imohweb/Code-Challenges
/scramble_words.py
3,127
3.921875
4
# Background # There is a message that is circulating via public media that claims a reader can easily read a message where the inner letters of each words is scrambled, as long as the first and last letters remain the same and the word contains all the letters. # Another example shows that it is quite difficult to re...
4f7ebe249160c7c83edc23a7de43303cd206053e
imohweb/Code-Challenges
/mode.py
742
4.21875
4
"""Find the most frequent num(s) in nums. Return the set of nums that are the mode:: >>> mode([1]) == {1} True >>> mode([1, 2, 2, 2]) == {2} True If there is a tie, return all:: >>> mode([1, 1, 2, 2]) == {1, 2} True """ def mode(nums): """Find the most frequent num(s) in nums.""" ...
ead5c702607f40a787203cd76dfb243e4a11249f
pshapard/New_projects
/send_email/Email_attach_image.py
1,878
3.578125
4
# Author: Patrick Shapard # Created: 04/22/2020 #updated: 04/24/2020 # Python script to send emails with and without attachments # If you don't have an email account to use, issue the command below to run on your local host. # python -m smtpd -c DebuggingServer -n localhost:1025 """Email_variables is a file which con...
902a3163c8bf0d515051658c70b7b07b0f5c74fb
pshapard/New_projects
/real_python_courses/Python_Data_types.py
4,759
4.3125
4
#Python data types a = 1 b = 5 c = 10 e = a + b + c print(e) print(f' variable e is type {type(e)}') print(f'Convert variable e to a hex, octal, and binary') o, b, h = oct(e), bin(e), hex(e) print(f'e variable converted to octal: {o}, binary: {b}, hexidecimal: {h}') print('#'*90) #FLOATS #whenever you divide ...
9302dfd76c77763cbe2c838c889757a5d13b14bb
elizabeth1304/python_lessons
/tenth_lesson.py
2,742
3.6875
4
# list_1 = [] # for i in range(11): # list_1.append(i) # list_1 = [i for i in range(11) if i % 2 ==0] # list_1 = [[j for j in range(10)] for i in range(11)] # print(f"List values are: {list_1}") # a = int(input("Tell number and see the half.\n")) # half_number = a / 2 if a % 2 == 0 else a // 2 # print(f"the half ...
456c79367cf138f963b4fdd66db1e24b9f5603c7
tmager/Composte
/composte/network/fake/security.py
748
3.515625
4
class Encryption: """ Filler class defining the minimum interface that network encryption_scheme must implement. Note that this particular one doesn't do anything. """ def __init__(self): pass def encrypt(self, message): return message def decrypt(self, message): ...
b6d7204f9154066841d998e9a146e9e631eb347a
pascalNtso/Meilleur-itin-raire
/meilleur_chemin.py
4,968
3.5
4
import itertools, random import numpy as np from scipy.spatial import distance from sklearn.neighbors import DistanceMetric #lecture de fichier with open('lieux.txt', "r") as file : lines = file.readlines() """ Definition de la class Solver pour la résolution du problème """ class Solver: def __init__...
bf715258c9b77404c7715a6ee950f09da93cff34
yanqinghao/mltraining
/ex56.py
3,107
3.609375
4
import numpy as np import neurolab as nl import matplotlib.pyplot as plt # Define input data data = np.array([[0.3, 0.2], [0.1, 0.4], [0.4, 0.6], [0.9, 0.5]]) labels = np.array([[0], [0], [0], [1]]) # Plot input data plt.figure() plt.scatter(data[:,0], data[:,1]) plt.xlabel('X-axis') plt.ylabel('Y-axis') plt.title('In...
b7609e40ef8c9c22dd6ad42eb1c1a2856c56c9fa
7aske/uni
/cs324/cs324-v04/main.py
907
3.65625
4
def zad01(): use_inp = False # @formatter:off first_name = input("Ime: ") if use_inp else "Nikola" last_name = input("Prezime: ") if use_inp else "Tasic" birth_year = input("Godina rodjenja: ") if use_inp else "1995" index = input("Indeks: ") if use_inp else "3698" # @formatte...
5740bdbac36bb8acaed03c8b27132a9cf5f207f2
7aske/uni
/cs324/cs324-dz05-nikola_tasic_3698/zad01.py
1,281
3.609375
4
from pprint import pprint class Document: def __init__(self, name, num_words): self.name = name self.num_words = num_words class Book(Document): current_num = 1 def __init__(self, name, num_words, author, genre, year): super(Book, self).__init__(name, num_words) self.key = "lib{}".format(str(self.curren...
64ed92927d5c8475ae9973bc089e599f93011094
Sokiryanskaya/apachlab
/age.py
284
4.03125
4
age=input('Введите ваш возраст') age= int(age) if age <=7: print ('ходит в садик') elif 7<=age<= 16: print ('учиться в школе') elif 16<=age<= 22: print ('учиться в институте') elif age >=22: print ('работает')
0d02ab8d185819cbc36c80376ca50d40108551d0
amriteshs/comp9021-codes
/Quizzes/quiz09/quiz09.py
8,138
3.90625
4
# Randomly fills a grid of size 7 x 7 with NE, SE, SW, NW, # meant to represent North-East, South-East, North-West, South-West, # respectively, and starting from the cell in the middle of the grid, # determines, for each of the 4 corners of the grid, the preferred path amongst # the shortest paths that reach that corne...
96a33f390f5698321c729d3dfd9d070dc5fa5064
amriteshs/comp9021-codes
/Labs/lab02_q1.py
1,478
3.78125
4
import sys from math import factorial def method1(f): num = factorial(n) ctr = 0 while num: if not num % 10: ctr += 1 else: break num //= 10 return ctr def method2(f): num = str(factorial(n)) ctr = 0 for i in ...
e06c6bc6071c02c35d3c28d6908225f44181c85f
amriteshs/comp9021-codes
/Quizzes/quiz01/quiz01.py
2,455
3.609375
4
import sys from random import seed, randrange try: arg_for_seed = int(input('Enter an integer: ')) except ValueError: print('Incorrect input, giving up.') sys.exit() seed(arg_for_seed) x = randrange(10 ** 10) sum_of_digits_in_x = 0 L = [randrange(10 ** 8) for _ in range(10)] first_digit_greater_than_last ...
c8b38bd6613670ca643d4d2d9c3ed37f76dc01ca
wwest4/crypto1
/wk2/aes-ctr.py
2,737
4.15625
4
#!/usr/bin/env python # # Stanford Crypto1 (Coursera) HW2. parts 3 and 4 (AES CTR ciphers) # ...implement CTR mode decryption of ciphers with a given key. OK to use # library for encrypt() and decrypt(), but implement the block mode here. # import Crypto.Cipher.AES as AES BS = AES.block_size ciphertext1 = '69dda845...
7f158f08b590273a5b4ba8eda0ba89b45819c1c2
fooSynaptic/exam
/jianzhiOffer/problems/oddevenswap.py
735
3.765625
4
# -*- coding:utf-8 -*- class Solution: def reOrderArray(self, array): # write code here print(array) n = len(array) pre = -1 for i in range(n): if array[i]%2 == 1: pre += 1 array[i], array[pre] = array[pre], array[i] ...
30e58fa14e126d9fd3a18592856508d54fbc0a0d
fooSynaptic/exam
/interviewProblem/valide_balence_BST.py
716
3.921875
4
# encoding = utf-8 # /usr/bin/python3 class Tree_node(): def __init__(self, val): self.val = val self.left, self.right = None, None def check(node): if not node: return 0 left, right = 0, 0 if node.left: left = check(node.left) if node.right: righ...
e35a217c631f79efce9c94741943527c7426b522
fooSynaptic/exam
/jianzhiOffer/problems/stackWithmin.py
1,852
3.71875
4
# -*- coding:utf-8 -*- ### use list with pop method only class Solution: def __init__(self): self.array, self.heap = [], [] ###min heap def heapify(self, i, n): if self.heap[i] > self.heap[n]: self.heap[n], self.heap[i] = self.heap[i], self.heap[n] top = self.heap[n...
8473ac4c8f3f5bbdeaefc2ca8941cd37f937ac3b
fooSynaptic/exam
/csCourses/AlgorithmsFourthEdith/unionFind.py
6,080
4.21875
4
# encoding = utf-8 # /usr/bin/python3 ''' 原地址:https://www.coursera.org/learn/algorithms-part1 教材:Algorithms,Fourth Edition 算法 第四版 ''' import random, time from random import randint random.seed(1234) '''quick find (eager algorithm)''' '''Time complexity On^2''' class QuickfindUF(): def __init__(self, N): ...
4042d6cd695cc458d76f66bc9d17a95ad2970459
fooSynaptic/exam
/Coding/build_binary_tree.py
757
3.734375
4
#py3 class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class Solution(object): def buildTree(self, preorder, inorder): """ :type preorder: List[int] :type inorder: List[int] :rtype: TreeNode """ ...
29ee7c5f0b525a680fd16d9a6da65055f443e951
Gabriel-Lance/Web-Scraping-Projects
/getting_to_philosophy.py
2,647
4
4
""" A web crawler that automatically plays the Getting to Philosophy game on Wikipedia. By navigating to a Wikipedia article and clicking the first link in the body of the article that is not parenthesized, and repeating this for each new page you visit, you are almost guaranteed to eventually reach the page on Philos...
b48109b936d0b694f2b6ac46033dc3baaefef602
merinoraldua/codingground
/New Project/main.py
3,826
4.09375
4
#Please Check This link For Theory Of TST : # http://en.wikipedia.org/wiki/Ternary_search_tree # Each node contains 5 parts They are # self.ch => contains the character # self.flag => Flag to Check whether the node is an end character of a valid string # self.left, self.right => Links to the next nodes ( Working simi...
de263b4b9567bff9e443b5453db2e7bfc9556cd7
JLDaniel77/Sorting
/src/iterative_sorting/iterative_sorting.py
1,254
4.21875
4
# TO-DO: Complete the selection_sort() function below def selection_sort(arr): # loop through n-1 elements for i in range(0, len(arr) - 1): # Isolate the first index of each iteration # Check the remaining indexes to the right for a value # smaller than the value at the current index (in...
4b12a7b8c865f33134e6970d42a3ce77bc84aa9a
JDanielPR/Project_SofwareLab
/Sw_lab_tool/pkg/isdh/deformation_step.py
2,203
3.5625
4
class DeformationStep: def __init__(self, amount, initial_deformation_amount, transformation): self.amount = amount self.frame_begin = initial_deformation_amount self.frame_end = initial_deformation_amount + amount self.transformation = transformation # 'm' or 'd' or 'b' ## # ...
9cc2330c5a3e7e65ffb63db19fc4c9f63b4ab5a3
BajajGirik/PyFileFinder
/main.py
951
4.1875
4
import os # function to find file paths def find_files(filename, startPath): res = [] # walking top-down from the startPath for root, dirs, files in os.walk(startPath): # this is for not entering mac's read-only folder dirs[:] = [d for d in dirs if d not in "System"] if filename in fil...