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
762590b15e731cd375109e8d6d88a9c9c8ba46b1
kylerlittle/hackmit-puzzles-2019
/puzzle-4/puzzle-4.py
1,108
4
4
# each location has only a zip code; likewise, # each of the first three notes of each recording are distinct # this is the mapping to phone numbers recordings = [ { "notes": "D C# Eb B F B A Bb C D", "location": "fort smith", "zipcode": "479" }, { "notes": "C B Eb A Bb B E...
d8fd09cbd25c6fe085aacf33768aedcc713b7e04
jurbanski/week2
/solution_10.py
2,721
4.34375
4
#!/usr/local/bin/python3 # 2015-01-14 # Joseph Urbanski # MPCS 50101 # Week 2 homework # Chapter 8, Question 10 solution. # Import the sys module to allow us to read the input filename from command line arguments import sys # This function will prompt the user for a filename, then check to see if the file exists. I...
e8e74b30ac6da31bb4907216ea45f4a3136c23cb
eembees/molstat_water
/rotation.py
2,600
4.15625
4
## rotation.py Version 1.0 ## Written by Magnus Berg Sletfjerding (eembees) ########################################################### """Rotation Functions, inspired by http://paulbourke.net/geometry/rotate/ Verified as working 01/07/17 by eembees""" """Importing modules""" import numpy as np from math import pi, si...
c2711bd3fa8bdaa69a4d50a1cccf7a4165c91ba9
can2lily/SchoolPrjts
/Python/M04/8.2.py
1,232
4.0625
4
''' Liliana Varela-Rodriguez SDEV 220 PYTHON M03 Programming Exercises 8.2 02/10/2018 ''' # 8.2 Check substrings def main(): #input strings s1 = input("Enter a string: ").strip() s2 = inp...
adfdb0e772fcd9d7a7e6c46e337dc273d9435d97
can2lily/SchoolPrjts
/Python/M03/Excersise/5.2.py
883
3.75
4
''' Liliana Varela-Rodriguez SDEV 220 PYTHON M03 Programming Exercises 5.2 02/10/2018 ''' # 5.2 Repeat additions import random import time correctCount = 0 count = 0 NUMBER_OF_QUESTIONS = 10 startTime = time.time() while count < NUMBER_OF_QUESTIONS: number1 = random.randin...
a38cf505091b59af920310fd7d58de9f98c58e2a
can2lily/SchoolPrjts
/Python/M09/Assignment/Exercise/replaceText.py
738
3.859375
4
''' Liliana Varela-Rodriguez 04/01/2018 M09 13.5 ''' #13.5 Replace the Text def main(): #input file name file1 = input("Enter a filename: ").strip() #replacing string in old file oldline = input("Enter the string to replace: ") #new string to be used newline = input("Enter the new string to ...
17cf1b4636dd3a4681717ffd8a4c9ee40be57558
can2lily/SchoolPrjts
/Python/M14/20.1.py
5,139
3.765625
4
''' Liliana Varela-Rodriguez M20 20.1 ''' # 20.1 Displaying AVL tree graphically from BinaryTree import BinaryTree from BinaryTree import TreeNode class AVLTree(BinaryTree): def __init__(self): BinaryTree.__init__(self) def createNewNode(self, e): return AVLTreeNode(e) def insert(self...
ea7ef0b6724f034a251111f5a946d9ba02510ae8
can2lily/SchoolPrjts
/Python/M02/Excersises/3.14.py
772
4.09375
4
''' Liliana Varela-Rodriguez SDEV 220 PYTHON M02 Programming Exercises 3.14 01/27/2018 ''' # 3.14 Turtle: draw the Olympic symbol import turtle radius = eval(input("Enter the radius for the circle: ")) turtle.showturtle() turtle.pensize(10) turtle.color("blue") turtle.penup()...
250f70aed746abc6b79d6a45d605a92ed548b620
can2lily/SchoolPrjts
/Python/M08/assignments/triangle.py
2,710
4
4
''' Liliana Varela-Rodriguez M08 Chapter 12 Exercise 12.1 ''' #12.1 The Triangle class import math #class for the GeometricObject, must be defined before Trianble. includes fill class GeometricObject: #if true the color will be green def __init__(self, color =" ", filled = True): self.__color = color ...
69d83bc340e708146c85f2957396617ba66f5c67
radik1999/pytest_tasks
/P11_T2.py
729
3.765625
4
# Create a coloredDoor class that has the 'color' attribute. # # Create a ClosedDoor class that has a default status of 'closed'. # # Create a ToggleDoor class that has a method toggle() that toggles # the status of the door. class ColoredDoor: def __init__(self, color): self.color = color ...
76f5a8e44c0457ed5b86039cdefc2e8856836f7d
radik1999/pytest_tasks
/P11_HW3.py
586
3.71875
4
##3. В класі Name визначте: ##атрибути для first name та last name (fname та lname відповідно); ##атрибут fullname що повертає first і last names; ##атрибут initials який повертає ініціали (перші літери first та last name, ##розділених ‘.’ . class Name: def __init__(self, fname, lname): self.fname ...
a6270d5d401a276e5297ac91643d979de4dc7a87
jpsank/fbla-csa
/app/util/helpers.py
233
3.6875
4
def is_valid_name(text): """ Checks if name is valid (only ASCII printable characters, no slashes) """ return all(32 <= ord(ch) <= 126 and ch != '/' for ch in text) def nl2br(text): return text.replace('\n', '<br>')
332c54a6f0c05546912a24a45a0ff27669967cbe
Napenthy/dsp
/python/advanced_python_regex.py
2,028
3.96875
4
# Advanced Python # Part 1 - Regular Expressions import re import pandas as pd # read data url = "https://raw.githubusercontent.com/Napenthy/dsp/master/python/faculty.csv" df = pd.read_csv(url) # Q1. Find how many different degrees there are, and their frequencies: Ex: PhD, ScD, MD, MPH, BSEd, MS, JD, etc. #remo...
0cd750ef23856a364908d62638982d0733f1e686
RoseReyes/python
/find-char.py
212
3.828125
4
word_list = ['hello','world','my','name','is','Anna'] char = 'o' new_list = [] for text in range(len(word_list)): if char in word_list[text]: new_list.append(word_list[text]) print(new_list)
43a7678f14cb53b9a2aeaf9c66b7d685f2b3c02c
RoseReyes/python
/car_OOP.py
810
3.84375
4
class Car(object): def __init__ (self,price,speed,fuel,mileage,tax): self.price = price self.speed = speed self.fuel = fuel self.mileage = mileage if price > 10000: self.tax = 0.15 else: self.tax = 0.12 self.display_all() def disp...
272a25b8fad371d6d7e5d40b0d453ecfbc06b41c
RoseReyes/python
/strings-list.py
550
3.859375
4
'''Find and Replace''' words = "It's thanksgiving day. It's my birthday,too!" print(words.find("day")) newWord = words.replace("day","month") print (newWord) '''Min and Max''' x = [10,54,-90,100,0,-98] print(max(x)) print(min(x)) '''First and Last''' x = ["hello",2,54,-2,7,12,98,"world"] print(x[0],x[7]) newList = ...
3398482ebef858d694155c6dc661edd503dae614
jdunne/eliza
/eliza.py
1,483
3.578125
4
import os import random responses = [ ('james', 'What is your favorite thing about James?'), ('mommy', 'What color does mommy like the best?'), ('daddy', 'What food does daddy like to eat the most?'), ('no', 'Tell me. Why not?'), ('you', 'We are talking about you. Not me.'), ('I', 'Do you alwa...
88b87c9130b34576b199d68fc714aca193edb06c
NataDiazP/PetShop-Python
/Persona.py
4,436
3.75
4
class Persona(): """ Persona: Información básica de usuarios y empleados Atributos: id, nombre, email, telefono, direccion, comentarios, pedidos """ personas = [] # Lista de personas contador_ids = 0 # Contador de ids - AUTOINCREMENTABLE def __init__(self, nombre="", email="", telefono=...
77ae9d64082aca2a187b1cd3495833649cf1423c
mmonro/Python-MITx
/Lesson11/Queue.py
636
3.953125
4
class Queue(object): def __init__(self): self.myqueue = [] def insert(self, e): self.myqueue.append(e) def remove(self): try: return self.myqueue.pop(0) except: raise ValueError() def __str__(self): return '{'...
18d8eb7d015279f37959615f30e5cee7e67f879f
Shariarbup/Shariar_Python_Object_Oriented
/class_method.py
795
3.6875
4
class Employee: raise_amount = 1.04 no_of_emp = 0 def __init__(self, first, last, pay): self.first = first self.last = last self.pay = pay self.email = first + '.' + last + '@company.com' Employee.no_of_emp += 1 def full_name(self): return f'{self.first} {...
663a7109c44a87007877ca67556797caa7c82307
Akoo510/oc20
/game/Jeux.py
13,033
3.84375
4
import pygame import sys, os, time, random from pygame.locals import * pygame.init() score = 0 b = 0 # Source: # https://pygame.readthedocs.io/en/latest/5_app/app.html class Text: """The Text class creates a text objet. """ def __init__(self, text='Text', pos=(0, 0), **options): self.pos = pos ...
7179db30c3fe363da1b61dd872d186609043b847
breanneboland/Hackbright-project-data-processing
/data-count.py
472
3.75
4
import csv survey_results = open("survey_responses.csv") survey_responses_dict = { "infrequent": {} } def count_answers(): readable_survey = csv.reader(survey_results) for row in readable_survey: if row[1] == "Once a week" count elif row[1] == "Once a month" elif row...
2fb743ee2a443afe23af41031cfa671cd88df847
privateEye-zzy/detective
/detective_2.py
1,511
3.65625
4
# 第十三条大街问题 import random, time def judge(answer, n): # 问题一:n小于500吗?已知回答为假 if answer[0] is True and n < 500: return False if answer[0] is False and n > 500: return False # 问题二:n是平方数吗?已知回答为假 if answer[1] is True and n in arr2: return False if answer[1] is False and n not in...
239e5a82474cc862a33c9e4e183d736e5ad48049
itearsl/bomb_detector
/timer.py
463
3.59375
4
import time from tkinter import * class Timer: def __init__(self, secs): self.secs = secs self.window = Tk() self.lbl = Label(self.window, text = 'lol') self.lbl.grid(column = 0, row = 0) def start(self): copy = self.secs while copy != 0: ...
7c57ed755f03c05a03c281e2b9a03529f8b441a2
Re-Creators/ScriptAllTheThings
/Temperature Scale Converter/temperature_scale_converter.py
1,211
4.5
4
""" Temperature Scale Converter - Inputs the value from the user and converts it to Fahrenheit,Kelvin & Celsius Author : Niyoj Oli Date : 01/10/21 """ temp = input("Input the temperature you would like to convert? (e.g., 45F, 102C, 373K ) : ") degree = float(temp[:-1]) # the first value of the input is taken as th...
efc8169de6a436f2ba9910ae37a8526d92bd7456
JuliasBright/Python
/Simple Calculator.py
1,685
4.3125
4
import sys while True: print("Welcome To My Simple Calculator") print("Enter this Abbreviations To Continue") print("Enter + for Adding") print("Enter - for Substractiing") print("Enter * for Multiplication") print("Enter / for Dividing") print("Enter ** for Exponation") print("...
d6f3036f5869236f9bd1a739cb1027c99b0fbfa4
krishcmd/Random_Python
/pong.py
1,281
3.6875
4
from random import choice, random from turtle import * from freegames import vector def value(): return (3+random()*2)*choice([1,-1]) #randomly generate value between (-5,-3) or (3,5) ball = vector(0,0) aim = vector(value(),value()) state = {1:0,2:0} def move(player,change): #Move player position by change state...
b48e322d78d253fb65c856d6101feeb52f4e83e3
carolwanjohi/lorem-read-files
/test_readfiles.py
1,878
3.828125
4
import unittest import readfiles class TestReadFiles(unittest.TestCase): ''' Class to test the functions on the readfiles module Args: unittest.TestCase class from the unittest module to create unittest ''' # Check if data is gotten def test_get_data(self): ''' Test...
d653381c3aed69c37f075ed1af5c5a99bd5ccaa9
Gagan-453/Python-Practicals
/Regular Expressions/Using Regular Expressions on files.py
1,063
3.96875
4
#USING REGULAR EXPRESSIONS ON FILES ##Write text into the file #f = open('mails.txt', 'w') #f.write('This project is assigned to Mr.Gagan Adithya Reddy at gaganreddy2705@gmail.com, and in case of any queries, you can contact Mr.Jagdish Babu at ejbsiro@gmail.com, or Mr.Anoop at anoop@project.org who would be acting as ...
207da591d51992ed559b70dccecc6aef922f4595
Gagan-453/Python-Practicals
/IDLE/lcm and hcf.py
523
3.828125
4
lst = [ ] a = int(input('How many numbers: ')) for i in range(a): print('Enter any number: ', end = ' ') lst.append(int(input())) print(lst) y = max(lst) x = 0 def LCM(m, n): if m>n: num = m elif m<n: num = n while True: if num%m == 0 and num%n == 0: ...
5a5bfac15fdf423e125b8aa56655bdb3dbccff7a
Gagan-453/Python-Practicals
/Searching names from a list.py
1,103
4.1875
4
# Searching elements in a list lst=['Gagan Adithya', 'Advith', 'Harsha', 'Praveen'] for i in range(len(lst)): lst[i] = lst[i].lower() #Converting all the names in the list into lower case letters print(lst) x = input("enter element to search:") x = x.lower() #Converting all the letters into lower case...
3756486b3c91b557bff353dff8708ef25cca9a32
Gagan-453/Python-Practicals
/GUI/Canvas/Creating oval.py
1,375
4.875
5
# Creating Oval using Canvas from tkinter import * #Create a root window root = Tk() # var c is Canvas class object # root is the name of the parent window, bg is background colour, height is the height of the window and width is the breadth of window, cursor represents the shape of the cursor in the canvas c = Canva...
52a149c679fb0740c4dc8685c485ee583ce9a66b
Gagan-453/Python-Practicals
/Abstract Class example.py
1,041
4.34375
4
# Example of Abstract Class from abc import* class Car(ABC): def __init__(self, regno): self.regno = regno def opentank(self): print('Fill the fuel into the tank') print('For the car with regno ', self.regno) @abstractmethod def steering(self): pass ...
44c151aff1f59e0ca9418405b9a4d7ba2ce98f30
Gagan-453/Python-Practicals
/GUI/Canvas/Creating images.py
939
4.125
4
#We can display an image with the help of create_image function from tkinter import * #Create a root window root = Tk() #Create Canvas as a child to root window c = Canvas(root, bg='white', height=700, width=1200) #Copy images into files file1 = PhotoImage(file="Peacock.png") file2 = PhotoImage(file='Screenshot (40)....
c6ab1ccc4139c95c5c69d5251dc3dc4e0b8cff10
Gagan-453/Python-Practicals
/Networking in Python/Two way communication/Chat Server.py
715
3.609375
4
# A program to create basic chat server program in python import socket host = '' # means 'localhost' port = 9999 # create server side socket s = socket.socket() s.bind((host, port)) # Maximum number of connections -1 s.listen(1) # wait till a client connects c, addr = s.accept() print('A client connected...') # s...
554f38054fbb5da57d3a88668beb4acae711007d
Gagan-453/Python-Practicals
/GUI/Frame/Frame and Widget.py
1,701
4.375
4
# FRAME Container #a frame is similar to canvas that represents a rectangular area where some text or widgets can be displayed from tkinter import * #Create root window root = Tk() #Give a title for root window root.title('Gagan\'s frame') #Create a frame as child to root window f = Frame(root, height=400, width=50...
21e92d5add01747577aac38d6d9e46180f0492eb
Gagan-453/Python-Practicals
/GUI/Frame/Listbox Widget.py
2,547
4.40625
4
# LISTBOX WIDGET # It is useful to display a list of items, so that he can select one or more items from tkinter import * class ListBox: def __init__(self, root): self.f = Frame(root, width=700, height=400) #Let the frame will not shrink self.f.propagate(0) # Attach the f...
d96e1b7876aebe651540e50fa717d03bd162c853
Gagan-453/Python-Practicals
/GUI/Frame/Button Widget/Arranging widgets in a frame/Place layout manager.py
1,899
4.5625
5
# PLACE LAYOUT MANAGER # Place layout manager uses place() method to arrange widgets #The place() method takes x and y coordinates of the widget along with width and height of the window where the widget has to be displayed from tkinter import * class MyButton: #Constructor def __init__(self, root): #...
e96c178fafa0ec0e56ae7aa706827c52a642434b
Gagan-453/Python-Practicals
/GUI/Root Window.py
635
3.796875
4
#Graphical User Interface #We should create space to display Graphical Output. This space is called Root Window #Program to create a root window from tkinter import * #Import all components from tkinter root = Tk() #Create the root window #Wait and watch for any events that may take place in the root window root.mainl...
c0309348cb3d4dba07c8d321cbc157e5dbdd6d0f
Gagan-453/Python-Practicals
/GUI/Frame/Menu Widget.py
1,979
4.1875
4
# MENU WIDGET # Menu represents a group of items or options for the user to select from. from tkinter import * class MyMenu: def __init__(self, root): # Create a menubar self.menubar = Menu(root) # attach the menubar to the root window root.config(menu=self.menubar) ...
56b0a0a2582b0e26197affa6d27865dbfe5abb26
Gagan-453/Python-Practicals
/Date and Time.py
2,356
4.5625
5
#The epoch is the point where the time starts import time epoch = time.time() #Call time function of time module print(epoch) #Prints how many seconds are gone since the epoch .i.e.Since the beginning of the current year #Converting the epoch into date and time # locatime() function converts the epoch time into time_s...
ec4fc0042d9e6100b485588b60be49413925bcb7
Gagan-453/Python-Practicals
/Exceptions.py
2,030
4.59375
5
# Errors which can be handled are called 'Exceptions' # Errors cannot be handled but exceptions can be handled #to handle exceptions they should be written in a try block #an except block should be written where it displays the exception details to the user #The statements in thefinally block are executed irrespective...
14d7bb228dd87f88554f724bfe7d54f0cd0b3648
Koko-John/hangman
/FinalCode.py
22,539
3.65625
4
from functools import partial # To prevent unwanted windows from tkinter import * from tkinter import messagebox from string import ascii_uppercase import random import sqlite3 background = "#EECFBB" foreground = "#FAF0E4" # Connecting to database db_conn = sqlite3.connect('hangingGame.db') print("Databa...
69faba724bfadf9f27a8090af7e46749bda5a0ab
Chiafl/Wallbreakers-Cohort-3
/Solutions/Week 2/sort-characters-by-frequency.py
357
3.671875
4
from collections import OrderedDict, defaultdict class Solution: def frequencySort(self, s: str) -> str: d = defaultdict(int) for x in s: d[x]+=1 order = OrderedDict(sorted(d.items(),key=lambda item: item[1], reverse=True)) val = "" for x in order: va...
6f3f38753ae27b884c1c94e41975298e6740c31f
Chiafl/Wallbreakers-Cohort-3
/python3/Week 3/lemonade-change.py
673
3.5
4
class Solution: def lemonadeChange(self, bills: List[int]) -> bool: five = 0 ten = 0 for i in bills: i-=5 if i==0: five+=1 elif i==5: if five<1: return False five-=1 ten+=1...
1c9400b7b475ebcb23666f8c0e1a5dd95e749980
Chiafl/Wallbreakers-Cohort-3
/python3/Week 2/word-pattern.py
424
3.5
4
class Solution: def wordPattern(self, pattern: str, str: str) -> bool: d = dict() ls = str.split(" ") if len(pattern)!=len(ls): return False for x,y in zip(pattern, ls): if x not in d.keys() and y not in d.values(): d[x] = y elif x in d.keys() ...
81703827bdeb2893256d79ebaf0d74849e47f024
ChristopherJonMyers/emulab
/cgenerator.py
287
3.546875
4
import sys import random def randNum(): return random.randint(0,3) if __name__ == "__main__": iterations = int(sys.argv[1]) p = open("nums.txt", "w+") for x in range(0, iterations): num = randNum() p.write(str(num)) p.close()
cf6401932fa541cc3d76bb472770182bf10e12fb
wthoutjc/ciencias3-as
/Parse/parse_tree.py
1,920
3.828125
4
class ParseTree(): def __init__(self, data): self.root = Node(data) #PRIVATES def __add_recursive(self, node, data): if data < node.data: if node.left is None: node.left = Node(data) else: self.__add_recursive(node.left, data) ...
332cbbdce7c7ddeb86f4dab1209c68cc7233e30c
saamkim/Minimax_2048_Test
/Minimax_2048.py
4,664
3.65625
4
from copy import deepcopy from typing import Tuple, List # https://www.nablasquared.com/tag/playing-2048-with-minimax/ class Grid: def __init__(self, matrix): self.setMatrix(matrix) def __eq__(self, other): for i in range(4): for j in range(4): if self....
b3a045b0649342236300272420e3d5ecdb13f65d
sabbir421/python
/if elif else.py
313
4.1875
4
day=int(input("number of day: ")) if day==1: print("Saturday") elif day ==2: print("Sunday") elif day ==3: print("Monday ") elif day ==4: print("Tuesday ") elif day ==5: print("Wednesday ") elif day ==6: print("Tuesday") elif day ==7: print("Friday ") else: print("7 days in week")
48fee37664872eb762a918d98d16b482012177e5
harshbhardwaj5/Coding-Questions-
/Palindromerec.py
341
3.984375
4
def rev(n, temp): # base case if (n == 0): return temp; # stores the reverse of a number temp = (temp * 10) + (n % 10); return rev(n / 10, temp); # Driver Code n = 121; temp = rev(n, 0); if (temp != n): print("yes"); else: print("no"); # This code is c...
58d37c8c9a0be25faee85b7d15e6a1958cbf466f
harshbhardwaj5/Coding-Questions-
/Allsubarrayrec.py
501
4.15625
4
# Python3 code to print all possible subarrays def printSubArrays(arr, start, end): # Stop if we have reached the end of the array if end == len(arr): return # Increment the end point and start from 0 elif start > end: return printSubArrays(arr, 0, end + 1) # Print the subarray and inc...
fce906b202ab341d6b903bcd01fd7cc3de327ab6
gilleseulemans/CSES-problems
/CSES/problem2.py
476
3.515625
4
#first input line contains an integer n #giving numbers between 1 and n with one missing number, find tehe number def main(): n = int(input()) n2 = input().split() i = n sum = 0 sum2 = 0 list = [] for x in n2: sum2 += int(x) while i != 0: s...
df20385acc0d2e304ddd08ecf21303c614ddf09a
Ricky-Lim10/atm-project
/project bank atm/atm.py
1,392
4.03125
4
class Atm: def __init__(self,cardnumber,pin): self.cardnumber = cardnumber self.pin = pin #Your balance (fixed amount) def check_balance(self): print("Your balance is 50000") #withdrawling your money from your fixed amount def withdrawl(self,amount): new_amount =...
ffed98cf90136a2dded5ca443ef9695d209a0e49
thomasjiangcy/tic-tac-toe
/tic_tac_toe.py
7,630
4.09375
4
""" Tic tac toe game implemented in Python 3.x """ import sys class Game: def __init__(self, n, player1, player2): self.row = n self.column = n self.total_squares = self.row * self.column self.player1 = player1 self.player2 = player2 self.ICONS = { s...
35adde3c89d43b0f22acb7a9023825fc77e866ab
5u4/greenhub-cli
/Greenhub/Date.py
8,329
4
4
import time from datetime import datetime import calendar import operator class Date: timestamp = 0 ONE_DAY = 86400 ONE_WEEK = ONE_DAY * 7 def __init__(self, date=None): """ initialize current object with given date or now Args: date (str): the date/datetime form...
e836b9001b53c9dc15f856e035aefc46b00c58e0
Ananta139/my-captain-projects
/positive no (1).py
123
3.875
4
#selecting positive numbers from a list list=[-10,9,-4,-5,6,7,8,-19] for n in list: if n>=0: print (n, end=' ')
73a429211c79e41a18bed46173146199a1be7a97
Bhanuvishwa/Crypto-System-for-classic-ciphers
/crypto project/autokey_cipher.py
1,545
3.796875
4
# Autokey cipher: def encrypt(): pt=str(input("enter plain text ")) key=int(input("enter your key ")) p=[] ct="" j=0 for i in range(len(pt)): y=ord(pt[i])-ord("a") p.append(y) if(i==0): z=key+y%26 if(z<0): z=z+26 ...
c18a4faa67dd8870a3c18e9bd0e253396c6ebb5e
djmaan/py
/Advanced_re.py
2,281
3.703125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 3 09:04:34 2021 @author: djmaan """ # 1 import re def transform_record(record): new_record = re.sub(r",(\d{3})",r",+1-\1",record) return new_record print(transform_record("Sabrina Green,802-867-5309,System Administrator")) # Sabrina Green,+...
5e9910f98bdb2552805adb204cab676ee4c76bb2
drhans666/test
/listy2d.py
489
3.640625
4
lista = [ [1, 11, 111], [2, 22, 222], [3, 33, 333], [4, 44, 444], [5, 55, 555], ] for wiersz in lista: for komorka in wiersz: print(komorka) for i, wiersz in enumerate(lista): for j, komorka in enumerate(wiersz): print(i, j, komorka) for i in range(0, len(lista)): for ...
979d5f22c1775a3600f1de86d60fad518660cfca
anmol27katyani/Python-codes-practice
/venv/Must Do/Leetcode/Linkedlist Pldrome.py
574
3.59375
4
class Solution: def deleteDuplicates(self, head: ListNode) -> ListNode: if (not head or head.next is None): return head else: curr = head last=head while(curr.next is not None): if(curr.val == curr.next.val): curr =...
1595de6bf111e00e6d5b9d1478543d615e881a33
siyiwolf/PythonProgram
/main.py
3,893
4.125
4
#!/usr/bin/env python #import python_p1 as myFun #x = float(raw_input('Please input the dir:')); #y = myFun.calcCircleValue(x); #print "The circle Value is", y; #data struct #1. int float, #i = 100; #print i; #i = 100.0; #print i; #print 12 + 3.4 #print 3.4 + 45 #2. string #str = 'I\'m ok!'; #print str; #str = ...
8af264702da695f7a8e129dc8457d1b813c46fa0
lotaku/board-game
/v1.2/client/gwElements/team.py
868
3.734375
4
#!/usr/bin/env python # encoding: utf-8 class Team(): """ 创建一下新的队伍实例,不需要参数 """ def __init__(self): self.caption = '' self.member=[] def create(self,player): self.caption = player.name self.name="TN"+player.name self.member.append(player) player.team = ...
de8aa33c69290800a158c3a0fd5c2d73bce17df0
Evan-CSE/Utility
/zip-extractor.py
156
3.890625
4
import zipfile filename = input("Enter file name") print("-----------Extracting file ------------\n"); ob = zipfile.ZipFile(filename); ob.extractall();
3ee05bf33d82369bb21064e8e1ccd7610ff04a0a
Keerthirithi/guvi
/task/sum2num.py
271
3.90625
4
count=1 while(count>0): a=int(input("enter the number")) b=int(input("enter the number")) c=a+b print(c) print("do u want to continue") n=input() if (n=="yes"): count=1 continue else: count=0 exit()
54f38bb650eb1db4e4c11e198f1539e97506d25c
Chadius/terminal-checkers
/components/checkerboard.py
16,240
3.90625
4
class Checker(object): """Also called a draught, this is an individual piece on the board. """ def __init__(self, *args, **kwargs): self.color = None self.is_captured = False self.is_king = False def set_color(self, color): """Sets the checker's color. Raises a K...
de3c52eaf74c11a44a9d09f8603fe39bedcbf466
Mati0106/did_you_know
/NLP_basics.py
4,818
3.6875
4
# Import necessary modules import nltk from nltk.tokenize import sent_tokenize,word_tokenize nltk.download('punkt') import re scene_one ="""It's some of the text! Should you read it? I don't think so.""" print(scene_one) # Split scene_one into sentences: sentences sentences = sent_tokenize(scene_one) # Use word_token...
b10e2717875651d169f91d0c0716f8eb14a29d74
parasvasishth/python_crash
/classes/class.py
10,240
3.875
4
# todo class with method and instance # class Dog(): # def __init__(self,name,age): # self.name = name # self.age = age # # def sit(self): # print(self.name.title() + " is now sitting..") # # def roll_over(self): # print(self.name.title() + " rolled over!") # # # my_dog = Dog...
14b0c0767ebd8bd529146c09b1cf0c553a0390f2
szobonyaerik/homeexercises
/dice_for_a_risk2.py
663
3.90625
4
import random attack_list = [] defend_list = [] for i in range(3): attack = random.randint(1, 6) attack_list.append(attack) print("Attacker: {}".format(attack_list)) for j in range(2): defend = random.randint(1, 6) defend_list.append(defend) print("Defender: {}".format(defend_list)) defend_list = sor...
c4cd80942ff2aba8123ce343e31790a99218804c
Virentanti/Cute-Little-Projects
/flatten a n-dimensional list.py
201
3.6875
4
flatten_list=[] def flatten(initial_list): for i in initial_list: try: flatten(i) except TypeError: flatten_list.append(i) flatten(list) print(final_list)
2c7a0389973d56f548d7182859703cceaa5726a6
mryilanc1/Python-temel-kodlar
/Temeller/vucut kitle indeksi.py
171
3.65625
4
# coding: utf-8 # In[1]: Kilo=int(input("Lütfen Kilonuzu girin:")) Boy=float(input("lütfen boyunuzun girin:")) print("Beden kitle indeksiniz {}".format(Kilo*Boy))
4e49818d830928e380929e832eb07d9335bb1e6e
mryilanc1/Python-temel-kodlar
/Döngülü/atm makinesi.py
825
3.796875
4
# coding=utf-8 print(""" ****************************************************** Atm Makinesine Hoşgeldiniz İşlemler; 1-Bakiye Sorgulama 2-Para Yatırma 3-Para Çekme Çıkmak için 'q' basın... ****************************************************** """) bakiye = 1000 while True: islem= input("İşleminizi gir...
60a89203923cbfc21b9a5d5f2db7219751180764
mryilanc1/Python-temel-kodlar
/Koşullu durumlar/Zayıf-normal-kilolu ve obez tespiti.py
307
3.75
4
# coding: utf-8 # In[29]: a=float(input("Boyunuzu Girin:")) b=int(input("Kilonuzu Girin:")) k=b/ (a**2) if(k<18.5): print(" Durunuz *Zayıf") elif (k >= 18.5 and k <= 25): print("Durunuz *Normal") elif (k>= 25 and k <= 30): print( "Durunuz *Fazla Kilolu") else: print("Obez")
de825f286a2df1961310f8d266d4df0403c4ead0
mroguljic/LDR_analysis
/cleanData.py
1,436
3.640625
4
import csv def filterData(filename,outlierValue=5): lines=[] with open(filename+'.csv', 'r') as csvfile: csvreader = csv.reader(csvfile, delimiter=',') lines = [row for row in csvreader] outlierIndices = [] for i,line in enumerate(lines): if(i<2): con...
0ea2bcdd009487f2d34eb31efc0e1802edd6aded
leanTrin/countDown
/countDownSolver/letters.py
1,377
3.609375
4
import json import requests import argparse WORDS_URL = 'https://raw.githubusercontent.com/dwyl/english-words/master/words_dictionary.json' def get_response(url): resp = requests.get(url) resp.raise_for_status return resp def load_words(): resp = get_response(WORDS_URL) return resp.json() def is...
55bebc6fcd4c498092ac0ab7df43a2c83c3af860
marcelofreire1988/python-para-zumbis-resolucao
/Lista 1/questão02.py
182
4
4
#Escreva um programa que leia um valor em metros e o exiba convertido em milímetros metros = float (input("Quantos Metros?: ")) centimetros = metros * 100 print centimetros, 'cm'
2f694967a809cc7ddd3ceef6e36f8360edfe121b
marcelofreire1988/python-para-zumbis-resolucao
/Lista 1/questão10.py
581
3.65625
4
#Escreva um programa para calcular a reduo do tempo de vida de um fumante. Pergunte a quantidade de cigarros fumados por dia e quantos anos ele j fumou. Considere que um fumante perde 10 minutos de vida a cada cigarro, calcule quantos dias de vida um fumante perder. Exiba o total de dias. cigarroFumados = int(input("Q...
fd34971b5f918ca88df5eeb9009280948d527cd1
subwaymatch/layer-is-python
/layeris/utils/hsl.py
1,563
3.53125
4
import numpy as np """ RGB to HSL color conversion Note that using rgb_to_hsl_arr() and hsl_to_rgb_arr() is very slow compared to matplotlib's colors.rgb_to_hsv() and colors.hsv_to_rgb(). You should only use the methods below if you absolutely need HSL color space """ def rgb_to_hsl_arr(image_data): return np...
65ab5a1820881c192b8261d2359075a2fee00537
msarfati/pythonds-ms
/pythonds_ms/4_recursion/palindrome.py
591
3.890625
4
#!/usr/bin/env python def preproc(s, memo=""): if len(s) == 0: return memo if s[0].isalpha(): memo += s[0].lower() return preproc(s[1:], memo) def palindrome(s): if len(s) == 1: return True return s[0] == s[-1] and palindrome(s[1:-1]) assert palindrome('racecar') == True...
0301cc326cd47f36cf6f47c7026f53af4499a05c
msarfati/pythonds-ms
/pythonds_ms/2_analysis/ac2.py
215
3.65625
4
#!/usr/bin/env python from time import time def foo(tom): s = time() fred = 0 for bill in range(1,tom+1): barney = bill fred = fred + barney return fred, time() - s print(foo(10))
93fe621719192fd6fc2a29f328bdb0181be8ba54
ncamperocoder1017/CIS-2348
/Homework1/ZyLabs_2_19.py
1,885
4.125
4
# Nicolas Campero # 1856853 # Gather information from user of ingredients and servings amount print('Enter amount of lemon juice (in cups):') l_juice_cups = float(input()) print('Enter amount of water (in cups):') water_cups = float(input()) print('Enter amount of agave nectar (in cups):') agave_cups = float(input()) ...
6eb198e4a015286bf8628047051d41dd73c3ca86
mamal72/shekam
/main_test.py
614
3.8125
4
import unittest from main import normalize class MainTestClass(unittest.TestCase): def test_normalize_function(self): """It should test normalize function and get a normalized text""" input_text = 'در می‌زند و دوباره وارد مي شود . همه مي گویند قدمش پربرکت است .' expected_text = 'در می‌زند و...
e06c5e4e6e8b867a4d65af9e97bd3a31e41b2131
Cypherball/Data-Structures-And-Algorithms
/Algorithms/BalancedParantheses.py
807
3.953125
4
def is_opening_parantheses(ch): return ch == '(' or ch == '[' or ch == '{' def is_balanced(exp): balancer = [] for x in exp: if is_opening_parantheses(x): balancer.append(x) elif x == ')': if len(balancer) > 0 and balancer[-1] == '(': balancer.pop() ...
1ffb485435fe1dbc0dd9b2004238a2cf923826e7
hen20060/matala1new
/equations.py
1,041
3.6875
4
def exponent(x): result=1 for n in range(1,120): result = result + helper2(x, n)/helper(n) return result def helper(n): x=1 for i in range(int(n)): x=x*(i+1) return x def abs1(x): if x<0: x=x*(-1) return x def helper2(x, n): temp =1 if int(n) == 0: ...
be107aab3a84d670531155fcf27d2098e30d72c6
GhostLyrics/crafting_calculator
/crafting/shoppinglist.py
3,638
3.53125
4
"""Shopping List class to hold all required items.""" import logging from json import dumps from typing import List, Dict, Any # 3rd party from yaml import safe_dump # internal from crafting.common import find_recipe class ShoppingList: """A shopping list holds all items required to craft the given item.""" ...
ab22b2cb491573ab3af983ccb6c279eef8aaf433
sosi-deadeye/randomchar
/randomChar.py
1,450
3.65625
4
import random import string import secrets def Letter(length = 1): charSequence = [] for i in range(length): charSequence.append(random.choice(string.ascii_letters)) return ''.join(charSequence) def LoCase(length = 1): charSequence = [] for i in range(length): charSequenc...
658eee10422c7635597084f0f7f3e49f7ff47a69
juliagolder/unit-2
/quiz2.py
811
4.0625
4
#julia golder #3/20/18 #quiz2.py word1 = input('Enter a word') word2 = input('Enter a word') length1 = int(len(word1)) length2 = int(len(word2)) if length1 == length2: print('The words are the same length!') elif length1 > length2: print('The first word is longer') else: print('The second word is longer'...
73f2fa07999ca1fcc2bc2f8bf0abd832276bd149
juliagolder/unit-2
/unitConverter.py
938
4.46875
4
#julia golder #2/14/18 #unitConverter.py - how to convert units print('1: kilometers to Miles') print('2: Kilograms to Pounds') print('3: Liters to Gallons') print('4: Celsius to Fahrenheit') number = int(input('Choose a number: ')) if number == 1: celcius = int(input('Enter Degrees in Celcius: ')) fahrenh...
99d10b5a6f1bbedd17d12f4dc1cf38423d837761
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/Exercicio64.py
279
4
4
#programa que soma numeros ate digitar 999 x = 0 tot = 0 nd = 0 while x != 999: x = int(input('Digite um numero (condiçao de parada 999)')) if x != 999: tot+=x nd += 1 print('Voce digitou {} numeros e a soma entre eles é de \n {}'.format(nd,tot))
8fc8f101c61e374418ce471ef4a7e57e516a4a56
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/exercicio96.py
183
3.5
4
def area(larg , comp): a =larg*comp print(f'A area é {larg}m X {comp}m que da {a}m quadrados') a = float(input('LARGURA (m)')) c = float(input('Comprimento (m)')) area(a,c)
ce2cdf89913e349ad1865672052c04db5788f323
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/DoisJogosSimples/Jogo matrizes.py
478
3.828125
4
import random import funcoes_jogo_matriz as jog # PROGRAMA PRINCIPAL x = jog.criamatriz() matrizganhou = [[1,2,3,4],[5,6,7,8],[9,10,11,12],[13,14,15,0]] while True: linha = int(input('Digite a linha do numero a ser trocado com o 0')) coluna = int(input('Digite a coluna do numero a ser trocado com o 0')) ...
156084abe9fbd7de5883cb94942338bde38299ff
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/Exercicio5.py
192
4.125
4
#programa que le um numero e mostra seu sucessor e antecessor n1 = int(input('Digite um numero')) n2 = n1-1 n3 = n1+1 print ('O antecessor de {} é {} e seu sucessor é {}'.format(n1,n2,n3))
36659bab552fd48db1fc43b48444c6b521c44b28
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/exercicio74.py
242
3.796875
4
from random import randint num = (randint(0,10),randint(0,10),randint(0,10),randint(0,10),randint(0,10)) print(f'os numeros sorteados foram {num}') print(f'O menor valor da lista é {min(num)}') print(f'O maior valor da lsita é {max(num)}')
ec9667b62ed556f309304cdc3bf056b46b12774c
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/exercicio13.py
287
3.5625
4
# aumento do salario do jobersvaldo x = float(input('ola jobersvaldo quanto voce ganha ?')) y = x*15/100 print ('jobersvaldo voce ganha só {} celoko vou dar um aumento pra voce de 15 porcento blz?' '\n vai dar um aumento de {} seu salario final vai ser {}'.format(x,y,x+y))
3d85738207feeb0f8d1b942cbb26d766a4a55898
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/exercicio59.py
894
3.90625
4
x = 0 mn = 0 n1 = int(input('Digite um valor')) n2 = int(input('Digite outro')) while x != 5: if n1 > n2: mn = n1 else: mn = n2 print('''[1]SOMA\n[2]MULTIPLICAÇAO\n[3]MAIOR\n[4]NOVOS NUMEROS\n[5]SAIR DO PROGRAMA''') x = int(input('sua opcão é ?')) print ('-='*10) if x == 1: ...
7786300dae2fc48d659bbc4b1796321725146381
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/exercicio42.py
577
4
4
l1 = int(input('Digite um comprimento')) l2 = int(input('Digite outro')) l3 = int(input('E mais um')) if (l2-l3)<l1<(l2+l3) and (l1-l3)<l2<(l1+l3) and (l1-l2)<l3<(l1+l2): print('Os comprimentos informados podem formar um triangulo') if l1 == l2 == l3: print ('Todos os lados sao iguais triangulo EQUILATERO...
be264204daccbfce4cda7f508c49822f949cdc2b
JoaoScheleder/Exercicios-de-python-resolvidos-CEV
/Exercicios/exercicio40.py
254
3.828125
4
n1 = float(input('Digite a primeira nota')) n2 = float(input('Digite a segunda nota')) m = (n1+n2)/2 if m < 5.0: print('\033[1;31mREPROVADO\033[m') elif m < 7.0: print('\033[1;33mRECUPERAÇAO\033[m') else: print('\033[1;32mAPROVADO\033[m')
2441d05afe991ea177f0b71f0884ffd210c43673
kayham2/DataStructuresPractice
/LinkedList_new.py
6,081
3.96875
4
class Node(): def __init__(self, data): self.data = data self.next = None class LinkedList(): def __init__(self): self.head = None def append(self, data): new_node = Node(data) current = self.head if self.head is None: self.head = new_node return else: while current.next: current = curre...
46ce5c3a624620f2f581a7394cfc25de8ccb8012
kayham2/DataStructuresPractice
/stack_brackets.py
514
4.0625
4
### Checking to see if the brackets are matched import sys from stack1 import Stack string1 = sys.argv[1] def is_match(x): if x == "}" and s1.peek() == "{": return True elif x == "]" and s1.peek() == "[": return True elif x == ")" and s1.peek() == "(": return True else: return False s1 = Stack() for char...
d3a42e545d4d97f92b2d496a79da1abd3b814722
jomyemmanuel/InfoRetrievalFromVerbalData
/django/irapp/readless/Parse/parse.py
1,630
3.609375
4
#!/usr/bin/python import glob import io class Parse(): def __init__(self): print "Parser for textual data" def dataFromFile(self, path): ''' Read textual data from a file Arguments: path: path of the file (syntax is os dependent) Returns: ...