blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
d287f23e43f1a5d17ad986c3cf70ed55ae1f1dad
yash-learner/py-tricks
/py-trick0.py
274
3.734375
4
l1 = [1,5,4,8] l2 = [8,4,5,9,8] l3 = [8,8,7,5,4] # TODO: method: 1 s1 = sum(l1) s2 = sum(l2) s3 = sum(l3) print(s1,s2,s3) # TODO: method: 2 s1, s2, s3 = sum(l1), sum(l2), sum(l3) print(s1,s2,s3) # TODO: method: 3 s1, s2, s3 = map(sum,(l1,l2,l3)) print(s1,s2,s3)
132740d093039564b28abe9113140c13215e00e5
natancamenzind/kurs_pythona_APE
/4/numbers.py
264
3.578125
4
from random import randint random_number = randint(1, 10) user_numer = input("Podaj liczbe od 1 do 10") tries = 1 while int(user_numer) != random_number: tries += 1 user_numer = input('Sporóbuj jeszcze raz!') print('KONIEC po {} próbach'.format(tries))
f18748b830ae0b122a62bb99c50b436e014d0b3c
natancamenzind/kurs_pythona_APE
/regexp/regex.py
872
3.625
4
# importujemy bibliotekę odpowiedzialną za wyrażenia regularne import re # przykładowy teskt text = "My name is Loren and my email is loren@gmail.com" # wyrażenie regularne opisujące struktrę maila mail_regex = re.compile(r'\w+@\w+.\w+') # znajdź w danym tekscie pierwsze wyrażenie, które spełnia moje wymagania # opera...
36258ae41c33a29c742a51f26e46a557714d8670
chris-graham/dsp
/python/advanced_python_csv.py
375
3.703125
4
import csv from advanced_python_regex import Faculty # Create a new Faculty object and get the list of emails from the data file f = Faculty('faculty.csv') emails = f.get_emails() # Create emails.cvs and write each email as a row in the file with open ('emails.csv', 'wb') as csv_file: email_writer = csv.writer(csv_f...
a340f4d57da7fc9b33db96f2c50fbb9d8a77fd0b
maryellenphil/CE232
/HW22_Phillips.py
3,105
4.40625
4
#Follow the instruction on this page, create the Node Class and the linkedList Class. Instantiate a linked list object from the linkedList Class and test all the methods designed in the class. # Node Class class Node: def __init__(self,data): self.data = data self.next = None # Linked List Clas...
e3e8af1efd0adbca06cba83b769bc93d10c13d69
jalalk97/math
/vec.py
1,262
4.125
4
from copy import deepcopy from fractions import Fraction from utils import to_fraction class Vector(list): def __init__(self, arg=None): """ Creates a new Vector from the argument Usage: >> Vector(), Vector(None) Vector([]) creates empty vector >> Vector([5, 6, 6.7, Fracti...
35d7d4a2fe0c6cd7a6d77356788fe737f158a672
Masterroy1210/python-codes
/snake.py
1,020
3.65625
4
import turtle from random import randrange from freegames import square,vector food=vector(0,0) snake =[vector(10,0)] aim = vector(0,-10) def change(x,y): aim.x =x aim.y = y def inside(head): return-200<head.x<190 and -200<head.y,190 def move(): head = snake[-1].copy() head.move(aim...
57d5b147631c2b58a3bcf08e7703830594f09506
MLPMario/Mision-08
/listas.py
3,112
3.828125
4
#Autor: Luis Mari Cervantes Ortiz #Descripcion: Uso de listas, regreso de otras listas y numeros def sumarAcumulado(lista): #Sumar del numero anterior de la lista lis=[] for k in range (1,len(lista)+1): lis.append(sum(lista[:k])) return lis def recortarLista(lista): #Borrar el primer y ulti...
9c0600a587a6a221406f7295247f241e5b7c690a
crawftv/lambdata
/lambdata_crawftv/ClassificationVisualization.py
1,529
3.59375
4
import sklearn from sklearn import metrics from sklearn.metrics import classification_report from sklearn.metrics import confusion_matrix from sklearn.utils.multiclass import unique_labels import seaborn as sns import numpy as np import matplotlib.pyplot as plt """ IMPORTANT must upgrade Seaborn to use in goog...
852697b63672abe67766d8e45986884fbd89b9d3
Handagege/stdpyTest
/algorithm/mergeSort.py
650
4.03125
4
#!/usr/bin/python def mergeSort(a): mi = len(a)/2 if len(a) > 2: return merge(mergeSort(a[0:mi]),mergeSort(a[mi:len(a)])) else: return merge(a[0:mi],a[mi:len(a)]) def merge(a,b): i,j,z = len(a)-1,len(b)-1,len(a)+len(b) mergeResult = [0]*z while i > -1 and j > -1: z -= 1 if a[i] > b[j]: mergeResult[...
a658488db211b33e2722357d169b9ef3654bafad
Handagege/stdpyTest
/algorithm/LIS.py
534
3.703125
4
#!/usr/bin/python import sys def binarySearch(a,r,i): right = r left = 0 while(left <= right): mid = (left+right)/2 if a[mid] == i: return mid elif a[mid] < i: left = mid+1 else: right = mid-1 return left def LIS(a): ans = [0]*len(a) ans[0] = a[0] l = 0 for index,value in enumerate(a): i...
e7f58e8914dc7a95d8d9570d9770856d6bf7bf0d
hyuntaedo/Python_generalize
/GUI_Basic/6_listbox.py
763
3.546875
4
from tkinter import * from typing import List root = Tk() root.title("CodeBasic") root.geometry("640x480") listbox = Listbox(root, selectmode="extended", height=0) listbox.insert(0, "사과") listbox.insert(1, "딸기") listbox.insert(2, "바나나") listbox.insert(END, "수박") listbox.insert(END, "포도") listbox.pack() ...
237d6097bb1712a441b007e8065e963c0ff77988
TestowanieAutomatyczneUG/laboratorium-8-Plastikowy-Metal
/tests/sample/test_get_meals_functions.py
10,175
3.703125
4
from src.sample.main import * import unittest class MealTest(unittest.TestCase): # SET UP def setUp(self): self.temp = Meal() # BY NAME def test_get_meals_by_name1(self): self.assertEqual(self.temp.get_meals_by_name("Steak"), ['Steak Diane', 'Steak and Kidney Pie']) def test_g...
64344c5fe201898e58386d0b58588e1cd4d055f6
jackgene/amazebot
/public/templates/level4.py
2,108
3.78125
4
# The maze is much more complex in this level. # # To help you navigate this map, you have been given a new # tool - the sonar. # # The sonar detects how far walls are from the robot. # # There are sonars in three directions: # - left # - right # - center (front) # # A new method has been introduced that uses sonar: # ...
7650c660b7c6eabf23af7b9b5c6f2e166b05b2a4
DasVisual/projects
/aToBeCompleted/sampledefinitionkgtolbs/sampledefinitionkgtolbs.py
199
4.25
4
#! python3 def calculate_kg_to_lbs(kg): answer = (kg) * (2.2) print(answer) print('Enter your weight in kilograms') kg = int(input()) print('Your weight in pounds is: ') calculate_kg_to_lbs(kg)
a84f6776548484ef96ab81e0107bdd36385e416e
DasVisual/projects
/temperatureCheck/tempCheck2.py
338
4.125
4
#! python 3 # another version of temperature checker, hopefully no none result print('What is the current temperature of the chicken?') def checkTemp(Temp): if Temp > 260: return 'It is probably cooked' elif Temp < 260: return 'More heat more time' Temp = int(input()) Result = checkTemp(Tem...
3c5e07ca784b470d32025573a9926bc82a7fb872
DasVisual/projects
/FirstNameLastName(funny)/firstLastName.py
823
4.09375
4
#! python 3 # ask for the first name print('What is your first name strangerrr?') firstname = str(input()) # ask for the last name print('What is your last name?') lastname = str(input()) # list of random funny names/job titles print('Type a number from 0 to 6 and press ENTER') def funnyjobs(number): if nu...
929dd3a95dc260f624a43363353c287d475cf800
pak21/aoc2018
/20/20.py
1,554
3.5
4
#!/usr/bin/python3 import collections import sys directions = { 'E': (1, 0), 'N': (0, 1), 'W': (-1, 0), 'S': (0, -1) } stack = [] with open(sys.argv[1]) as f: for regex in f: regex = regex.strip() current = (0, 0) stack = [] valid_moves = c...
aadf02bc8b2b9c5bd8e2dab02f1143ec9e2cb853
CS486-Group64/Onitama-AI
/game/engine_bitboard.py
19,323
4.0625
4
"""Onitama game engine. Note that (x, y) goes right and down. Blue uses positive numbers, red uses negative numbers. Bitboard has red on the most significant side""" import numpy as np import random from typing import List, NamedTuple, Optional BOARD_WIDTH = 5 BOARD_HEIGHT = 5 class Point(NamedTuple): ...
7beb9513f2a745fc7bbdecae583da956cd317a75
pombredanne/victims-lib-python
/test_cases/3.x tests/classesAndImports2.py
380
3.515625
4
#This program prints hello world twice import sys class HelloWorldGenerator(): """Wooo a docstring""" def __init__(self): #functions might not just have comments print("HelloWorld") self.str = "Hello World" def sayHello(self,string:'wow_an_annotation'): print(self.str) def main(): hwg = HelloWorldGenera...
55b4ec53a56a23c88096f026f57e4e598bae30b0
pranavtailor/LoginPage
/LoginGui.py
3,476
3.65625
4
import tkinter as tk import tkinter.font as font root = tk.Tk() HEIGHT = 400 WIDTH = 300 # Create account Page def createAccount(): topCreate = tk.Toplevel(height = HEIGHT, width = WIDTH) topCreate.title("Register") # put info in text doc def storeData(): Users = open('Users.txt', 'a') ...
9649b2243dd2b2f593fcf5943f6fea83699b39ae
z-mac/MyFirstWork
/src/test/add.py
439
3.59375
4
''' Created on 2018年2月23日 @author: Administrator ''' class Adder(): def __init__(self, start = []): self.data = start def add(self, y): print('Not Implemented') def __add__(self, other): return self.add(self.data, other) class ListAdder(Adder): def add(...
a803ef403052f87a2825f4b54c66dbb382ff35bd
hornsbym/WarGame
/_modules/Label.py
3,966
4.0625
4
""" author: Mitchell Hornsby file: Label.py purpose: Provides an object that displays text on a Pygame surface. """ import pygame as pg class Label(object): def __init__(self, text, position, font, fontColor=(0,0,0), bgColor=(255,255,255), padding=(10, 6), transparent=False, visible=True): """ text...
82e800234cfedfc6a350df2090302a27a039fa01
iain-waugh/iw_pyutils
/array_extras.py
5,417
3.921875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Extend the standard Numpy array manipulation routines, particularly for 2D array operations. Copyright (C) 2021 - Iain Waugh, iwaugh@gmail.com """ from __future__ import print_function, division import numpy as np __version__ = "1.0.0" def shift_2d(arr, shifts, stri...
3369b53aa0325ae1104dd941025cff8ef06593cd
ahmedMshaban/MITx-6.00.1x-
/helloworld.py
316
4.0625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 17 13:14:05 2019 @author: ahmedshaban """ count = 0 s = 'azcbobobegghakl' for letter in s: if letter == 'a' or letter == 'e' or letter == 'i' or letter == 'o' or letter == 'u': count += 1 print ("Number of vowels: " + str(count))
a34aa5e03ca7177a6455364c394fb1d6a1c7c866
springrolldippedinsoysauce/pythonshit
/FileIO/Main.py
2,064
3.609375
4
import FileIO.StockDriver as stockDriver def menu(): loop = False driver = None while not loop: print("==========================================================================") print("Welcome to the Stock Exchange!") print("============================================...
b14efeb7a750b4de30abc061fbbeb62ba94fe2f0
springrolldippedinsoysauce/pythonshit
/Hashing/HashTable.py
5,880
4
4
class HashEntry: empty = None key = None value = None used = None def __init__(self): self.empty = True self.used = False self.key = "" self.value = None class HashTable: def __init__(self, max_size): if max_size < 1: print("...
0cb6b2083d80d47a117d55dc33f50b0379afcd6f
Olayinka2020/ds_wkday_class
/practice.py
4,012
4.125
4
# Given a two integer numbers return their product and if the product is greater than 1000, then return their sum # a = int(input("First integer: ")) # b = int(input("Second integer: ")) # product = (a * b) # sum = (a + b) # if(product <= 1000): # print(product) # else: # print("The product is more...
2d8d833c7ef4ea7411848251e673088c3ea18c88
GauravKTri/-All-Python-programs
/calculator.py
334
4.28125
4
num1=float(input("Enter the first number")) num2=float(input("Enter the second number")) num3=input("input your operation") if num3=='+': print(num1+num2) if num3=='+': print(num1+num2) if num3=='-': print(num1-num2) if num3=='/': print(num1/num2) if num3=='*': print(num1*num2) if num3=='%': pri...
777e2b1f0f996f15264480824925ca5887b2d67b
GauravKTri/-All-Python-programs
/if-else.py
105
3.875
4
v=8 print("enter a number") v2=int(input()) if(v2>v): print("greater") else: print("smaller")
740df03bac4c0b8d7513cff0d73344133cd83f92
GauravKTri/-All-Python-programs
/pattern wrong.py
261
4.0625
4
print("pattern printing") a=int(input("Enter how many rows you want:\n")) print("Enter 1 or 0") b=bool(input("1 for true and 0 for false:\n")) if b=="1": for i in range(0,a+1): print("*"*i) if b=="0": for i in range(a,0,-1): print("*"*i)
764f75c9c2cdcbf001efd9cd958a1708a07b02af
GauravKTri/-All-Python-programs
/function.py
411
3.78125
4
def avg(a,b): """This is doc type of a function in which we write for what we have made the function""" average=(a+b)/2 #print(average) return average #return is must to get value,not to get none """ this is not doc type ,this is comment for multi line """ ''' this is also a multi line ...
979920ae73ed9e7dde27d8749c20e2d93a473d4f
sandhoefner/sandhoefner.github.io
/6034/lab3/toytree.py
6,304
3.59375
4
# MIT 6.034 Lab 3: Games from game_api import * from copy import deepcopy class ToyTree : def __init__(self, label=None, score=None) : self.score = score self.label = label self.children = [] self.zipper = [] self.sibling_index = None # sibling index records how man...
215ea7fc3c7f1911948258214c20c25bfe91bee5
sandhoefner/sandhoefner.github.io
/6034/lab6/lab6.py
7,609
3.6875
4
# MIT 6.034 Lab 6: Neural Nets # Written by Jessica Noss (jmn), Dylan Holmes (dxh), Jake Barnwell (jb16), and 6.034 staff from nn_problems import * from math import e INF = float('inf') #### NEURAL NETS ############################################################### # Wiring a neural net nn_half = [1] nn_angle = [...
c29e30dc572cf85aa394b2902922383a74539529
tabatagloria/exercicios-uri
/Python/1018.py
178
3.5625
4
n = int(input()) lista = [100, 50, 20, 10, 5, 2, 1] print('{}'.format(n)) for i in lista: notas = n // i n = n % i print('{} nota(s) de R$ {},00'.format(notas, i))
bd44668fbed826ab124e7a45ee67f15937d42c9d
tabatagloria/exercicios-uri
/Python/1010.py
231
3.578125
4
cod1 = int(input()) pecas1 = int(input()) valor1 = float(input()) cod2 = int(input()) pecas2 = int(input()) valor2 = float(input()) total = pecas1 * valor1 + pecas2 * valor2 print('VALOR A PAGAR: R$ {}'.format(round(total, 2)))
2101666625cd541714b52dbfca46491650f46ccf
dariansk/files-sorted
/main.py
1,055
3.6875
4
def convert_file_to_list(file): with open(file, 'r', encoding='utf-8') as f: text_list = f.readlines() return text_list # сортируем файлы и записываем их в результирующий файл # спасибо гуглу за подсказку, как сортировать словарь по значениям def write_to_sorted_file(): files = {'1.txt': conve...
cd3b288dc03da30a69439727191cb18e429d943a
olympiawoj/Algorithms
/stock_prices/stock_prices.py
1,934
4.3125
4
#!/usr/bin/python """ 1) Understand - Functions - find_max_profit should receive a list of stock prices as an input, return the max profit that can be made from a single buy and sell. You must buy first before selling, no shorting - prices is an array of integers which represent stock prices and we need to find the ...
9391b65636aebee9a50ed4aa57430319a5a07d81
roymatchuu/LoanCal
/LoanHandler.py
2,593
3.5625
4
import openpyxl import os from Loan import * from datetime import datetime # method for calculating the number of days for subsidized a subsidized loan def calculateDays(loan): today = datetime.today().strftime("%m/%d/%y") borDate = datetime.strftime(loan.dateBorrowed.value, "%m/%d/%y") a = datetime.strp...
fc11217e6b71a26134d39ca4506b71e64bb22e6b
wlazlok/Python_small_university_projects
/Average_mark.py
2,430
3.765625
4
class Pupil: def __init__(self, name, surname): self.name = name self.surname = surname self.marks = {} @property def name(self): return self.__name @name.setter def name(self, name): if len(name) >= 3: self.__name = name else: ...
4a2b41034fe078c06fdc064b07909cf6b7ee1aa3
wlazlok/Python_small_university_projects
/Dice_game.py
1,173
3.90625
4
import random class Die: def __init__(self, sides): self._sides = sides self._value = None def roll(self): self._value = random.randint(1, self._sides) def get_sides(self): return self._sides def get_value(self): return self._value die_computer = Die(8); die_use...
f1df24378ddad1aa027eac2f45172d7dc121635b
GTC7788/pythonCrawler
/parserWiki.py
1,703
3.625
4
import re import urlparse from bs4 import BeautifulSoup # This is a basic parser program, by using BeautifulSoup, it can find all URLs in the form: wikipedia.org/wiki/*** # Those URLs are added to the URLmanager for further crawl. # # Wikipedia html content example: class HtmlParser(object): def _get_new_urls(s...
778630f3c8b1b6a9cf1ce955f6e5317a54b4593f
davearonson/exercism-solutions
/teams/gnarly/python/two-fer/two_fer.py
779
4.03125
4
default_name = "you" def two_fer(name=default_name): if isinstance(name, str): name = name.strip() if name == "": name = default_name else: # If it's not even a string, just go with the default # name. We COULD skip the "else" and just go with # whatever the param's str...
1fc954955401cfa8784c05a8725bd1693ec46f02
2470370075/-
/pra.py
192
3.609375
4
#不可变类型 int float str tuple #可变 list dic print('aaa'.ljust(6),'bbb'.ljust(6),'ccc'.ljust(6)) print('aaa'.ljust(6),'bbb'.ljust(6),'ccc'.ljust(6)) print(7/2) print(7//2) print(7%2)
9b41b7f866d07f57016a438d529b15fe91dea892
hungcu/beautiful-strings
/beautifulStrings.py
1,869
3.890625
4
# Problem: # String s is called unique if all the characters of s are different. # String s2 is producible from string s1 if we can remove some characters of s1 # to obtain s2. # String s1 is more beautiful than string s2 if s1 is longer than s2 or # they have equal length and s1 is lexicographically greater than ...
da6e5034ab9652b4ab98874be9daef9ba7efa9ff
espag/CS-555-Gedcom-Parser
/Sprint 1/US02.py
980
3.5625
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 02 12:52:45 2017 @author: rishi """ import sqlite3 import datetime conn=sqlite3.connect('GEDCOM_DATA.db') conn.text_factory = str def Story02(): query1="select NAME,BIRTHDAY,MARRIED from INDIVIDUAL AS I,FAMILY AS F where I.ID=F.HUSBAND_ID OR I.ID=F.WIFE_I...
51fc935081356e32b0f1a24d9987c05a42046637
tonyiovino/helloworld
/paridisp.py
194
4.09375
4
print("Scrivi un numero e ti dirò se è pari o dispari!") num = input("Numero: ") num = int(num) if num%2 == 0: print("Questo numero è pari!") else: print("Questo numero è dispari!")
a39c1637e05acd2522518aa8e202cb8d124b9e4c
amatsuraki/CheckiO
/Elementary/FizzBuzz.py
347
3.640625
4
def checkio(number: int) -> str: if number % 15 == 0: number = "Fizz Buzz" elif number % 5 == 0: number = "Buzz" elif number % 3 == 0: number = "Fizz" else: pass return str(number) test = [15, 6, 5, 7] for i in range(len(test)): item = test[i] ...
b1118a012245df733a1e78abc55e8e0e519dfff7
amatsuraki/CheckiO
/Elementary/FirstWord.py
651
4
4
# -*- coding: utf-8 -*- """returns the first word in a given text.""" def first_word(text: str) -> str: print(text) text = text.replace(",", " ").replace(".", " ") text = text.strip().split() return text[0] test = [ "Hello world", " a word ", "don't touch it", "greetings, frien...
109c984ec4e49eafe310f5b60c5b52d2cb14b053
Xu-Yuefangzhou/Advanced-Programming-note-exercise
/Exercise.py
1,514
3.609375
4
# coding: utf-8 # In[1]: 2 + 2 # In[2]: 2.0 + 2.5 # In[3]: 2 + 2.5 # In[4]: a = 0.2 # In[5]: s = "Hello!" s # In[6]: s = '''Hello! ''' s # In[9]: s = '''hello world''' print (s) # In[10]: s = "hello" + "world" s # In[11]: s[0] # In[12]: s[-1] # In[13]: s[0:5] # In[14]: s.split() #...
0affe2658592fab3415002287c348ef24ae372bb
Swaraajain/learnPython
/learn.python.loops/calc.py
384
4.1875
4
a= int(input("provide first number : ")) b= int(input("provide second number : ")) sign= input("the operation : ") def calc(a,b): if sign == '+': c= a+b elif sign== '-': c= a-b elif sign=='*': c= a*b elif sign=='/': c= a/b else: print("This option is not ...
17209e6ac514e763706e801ef0fb80a88ffb56b7
Swaraajain/learnPython
/learn.python.loops/stringQuestions.py
457
4.1875
4
# we have string - result must be the first and the last 2 character of the string name = "My Name is Sahil Nagpal and I love Programming" first2index = name[:2] last2index = name[len(name)-2:len(name)] print(first2index + last2index) #print(last2index) #string.replace(old, new, count) print(name.replace('e','r',2))...
8d895964bd49c9b70d02da96c01d1fa5e935caa3
Swaraajain/learnPython
/learn.python.loops/lisOperations.py
729
4.125
4
# list1, list2 = [123, 'xyz'], [456, 'abc', 'ade', 'rwd', 'ghhg'] # # print(list1[1]) # print(list2[2:4]) # list2[2]=123 # print(list2) # #del list2[2] # print(list2) # print(len(list2)) # print(list1+list2) # print(456 in list2) # for x in list2: # print(x) # def cmp(a,b): # return (a > b) - (a < b) # # list1 ...
18e0f9e51fbacbf3e168c52e11e9ae07c5e12d47
Nikita0102/homework_4_volotov
/3.4.py
227
3.609375
4
A = int(input("Input A:")) B = int(input("Input B:")) if A < B: a = [] for i in range(A, B+1): a.append(1) print(a) if A > B: b = [] for k in range(B, A+1): b.append((A + 1) - k) print(b)
15827661617839596229859a1a6d99c5c20d89b3
hershsingh/manim-dirichlet
/play.py
10,400
3.921875
4
#!/bin/python ### # from manim import * import manim class Example(manim.Scene): def construct(self): circle = manim.Circle() # create a circle circle.set_fill(manim.PINK, opacity=0.5) # set the color and transparency anim = manim.Create(circle) self.play( anim ) # show the cir...
acd213987246915ac800f0ec5203d21ad6d32e73
Anisha2510/tkinter-miles_to_km
/main.py
705
4.03125
4
from tkinter import * def miles_to_km(): miles = float(miles_input.get()) km = miles * 1.689 km_result.config(text=f"{km}") window = Tk() window.title("Miles to km Converter") window.minsize(width=300, height=100) window.config(padx=20, pady=20) miles_input = Entry(width=7) miles_input.grid(column=1, r...
d049ca74673235d9d3ba02356692b1aae1d30573
egbertcw0711/MachineLearning
/Coding/solutions.py
5,825
3.96875
4
def question1(s, t): """ determine whether some anagram of t is a substr of s input: string s, string t output: True or False """ # dictionary counts for t alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz' dt = {c:0 for c in alphabet} for c in t: # O(len(t)) dt[c] += 1 # print(dt) ...
309dc04376ecf8ebd54c85dcc75ed4ea003a88b1
LizaM19/name
/app.py
2,714
4
4
# Импорт необходимых библиотек from tkinter import * import random #Функция сортировки вставками def sorting(list): for i in range(1, len(list)): current = list[i] f = i-1 while f>=0: if current < list[f]: list[f+1] = list[f] list[f] =...
e0121a988808867f6c317b7123b908833a029d44
RaduEmanuel92/ctfs
/aeroctf/crypto/magic1/task.py
7,530
4.03125
4
#!/usr/bin/env python3.7 import numpy as np import math from itertools import chain import numpy as np import string # Python program to generate # odd sized magic squares # A function to generate odd # sized magic squares def generateSquare(n): # 2-D array with all # slots set to 0 magicSquar...
550fc4a7bfcad18a559b99b2d0838455b45478be
RaduEmanuel92/ctfs
/onlinectf/basecption/catch.py
1,883
3.515625
4
#!/usr/bin/env python import sys ct = "KRSWE4TJNNWGK4RBEBAW2YJAMJ2SA23BMRQXEIDLN5WGC6JAN5WG2YLZMFRWC2ZAHIUSACQKKZDVM2LDNVWHEYSHKZ4USRDPOBEUKSRRMJXFKZ3BI5DHESKHKYYGIR3MOVEUGMBLKBVDIZ2SNN4EEURTORFFQMKJPJJDCSL2KZDDSR2VNJBE4WBQJJBFKMCVGJHEQMB" bigrams = ["TH", "HE", 'IN', 'OR', 'HA', 'ET', 'AN', 'EA', 'IS', 'OU', 'HI', ...
30b00fa63b7e9b96a1023dbd23525da69509d791
colingalvin/RPSLSPython
/main.py
1,490
3.71875
4
from human import Human from ai import AI def compare_gestures(gesture1, gesture2): if gesture1.name == gesture2.name: return "tie" elif gesture1.name == "Rock": if gesture2.can_beat_rock: return "lose" elif gesture1.name == "Paper": if gesture2.can_beat_paper: ...
33b368e1050fc87f3f791ab2ac75530fe0c9cd71
aaaaaaaaaron/encrypton
/encrypt.py
1,361
4.0625
4
""" Credit: https://www.thepythoncode.com/article/encrypt-decrypt-files-symmetric-python """ from cryptography.fernet import Fernet from encrypt_gen import * import time def encrypt(filename, key): """ Given a filename (str) and key (bytes), it encrypts the file and write it """ f = Fernet(key) wi...
45f9b5ee0016aa045ab26d0e1672342da2386939
mallimuondu/vote
/vote.py
411
4.09375
4
def work(): while True: try: age = int(input("pls input your age: ")) except ValueError: print("sorry i did'nt understund that") continue else: if age < 18: print("you can not vote") elif age>18: prin...
ec0ffabb1915e05653e3c710fdcbe2a25d5b6af8
satyanrb/Mini_Interview_programs
/Base.py
242
3.71875
4
from functools import reduce nums = [3, 2, 4, 6, 8, 9] evens = list(filter(lambda n:n%2==0, nums)) doubles = list(map(lambda n:n*2, evens)) sum = reduce(lambda a,b: a+b, doubles) print(evens) print(doubles) print(sum)
6abd6b9ab84d8d7d1403f6823c68bf5dc188e679
satyanrb/Mini_Interview_programs
/Stopwatch.py
518
3.765625
4
import time while True: try: print(" Press Enter to Start the Timer and CTRL-C to end the timer") start_time = time.time() print(" The timer is started") while True: print("time elapsed = ", round(time.time() - start_time, 0), 'secs', end='\n') time.sl...
85118d5cea1ed16ca198b40e82b62ab9e508d54e
mcalidguid/quiz-FRIENDS
/quiz-FRIENDS-show.py
2,767
3.65625
4
import json import random def quiz(no_of_question): score = 0 with open("questions.json", 'r') as f: question_list = json.load(f) for i in range(no_of_question): total_questions = len(question_list) # print(total_questions) question = random.randint(0, total...
b1c010b5007a8331300fa9bd43d0b16556b07b62
Mamata720/List
/list out of integer.py
126
3.5625
4
a=[1,2,3,"12a","13s",12,"sd"] i=0 b=[] while i<len(a): if type(a[i])==type(i): b.append(a[i]) i=i+1 print(b)
8e54970cecaccf8a20a7723968d5d17b4e596811
JYOTIPALARIYA/Module5_WebSraping
/scrap2.py
1,833
3.765625
4
import requests #To Obtain the information we use requests from bs4 import BeautifulSoup #to parse that information we ue beautiful soup and with the help of beautifulsoup we #can target different links to extract Information url="https://finance.yahoo.com/quote/GOOGL?p=GOOG...
94fadec437cfa9039d216d55814c62f251629a63
miltonsarria/teaching
/basics/ex3.py
324
3.875
4
#Programa para ilustrar como manipular texto #asignar variables con valores especificos word1 = "Good" word2 = "Morning" word3 = "to you too!" #imprimir variables de forma individual print(word1, word2) #crear una nueva variable sumando los valores anteriores sentence = word1 + " " + word2 + " " + word3 print(senten...
49592f7c88c7fbeeca3e84f1817401b32dfa9383
aidaFdez/Cipher
/Cipher.py
4,419
3.875
4
from tkinter import * abc = ['a','A','b','B','c','C','d','D','e','E','f','F','g','G','h','H','i','I','j','J','k','K', 'l','L','m','M','n','N','o','O','p','P','q','Q','r','R','s','S','t','T','u','U','v','V','w', 'W', 'x','X','y', 'Y','z', 'Z'] ciph = "Here will be the output" ########################### ...
4dfbbc90cc00427f5f699cc282f7fe53890eab18
shalgrim/advent_of_code_2017
/day01_1.py
367
3.578125
4
def main(number): digits = [int(c) for c in number] matching_digits = [c for i, c in enumerate(digits[:-1]) if c == digits[i+1]] if digits[-1] == digits[0]: matching_digits.append(digits[-1]) return sum(matching_digits) if __name__ == '__main__': with open('data/input01.txt') as f: ...
aa8cef657ef3278cf948499f1e70b8720f7a5239
shalgrim/advent_of_code_2017
/day03_2.py
1,040
3.6875
4
from collections import defaultdict def get_next_xy(x, y, values): if x == 0 and y == 0: return 1, 0 elif values[(x - 1, y)] and not values[(x, y - 1)]: return x, y - 1 elif values[(x, y+1)] and not values[(x-1, y)]: return x-1, y elif values[(x+1, y)] and not values[(x, y+1)]:...
fbc2b174ff0abcb78531105634d19c6ec9022184
40309/Files
/R&R/Task 5.py
557
4.28125
4
checker = False while checker == False: try: user_input = int(input("Please enter a number between 1-100: ")) except ValueError: print("The value entered was not a number") if user_input < 1: print("The number you entered is too low, Try again") elif user_input > 100: ...
aa645875aad41809e87f75462965d0ef49ce3519
ThomasGarm/Simon_Game
/sequence.py
247
3.546875
4
from random import randint class Sequence: def __init__(self): self.number = [] self.last_number = None def random_sequence(self): #get a random integer self.number.append(randint(0, self.last_number))
136df2aff65fa8667228b6bbab1812df388510fb
munawwar22HU/CS-351-Artificial-Intelligence
/Assignment01/ma04289_Ass1/Task 1/routePlanning.py
3,412
3.5625
4
import csv import sys from search import * # Maps Cities to their ids Cities = {} # Map Cities to their heuristics Heuristics = {} # Map Cities to their neighbours Connections = {} def load_data(directory): """ Load data from CSV files into memory. """ with open(f"{directory}/cities.csv", enc...
f8b1f4263226bbff9d98bec916648cdfebd4bb3b
Nickolasjucker/Cp1404-Practicals
/prac_04/intermediate exercises.py
581
4.0625
4
def main(): number_list = [] number_sum = 0 for i in range(5): number_input = int(input("Enter a number: ")) number_list.append(number_input) number_sum += number_list[i] number_average = number_sum / 5 print("The first number is {}".format(number_list[0])) print("The las...
8b83b53c42c1499f6b0313b9d2b921e17f488abf
Nickolasjucker/Cp1404-Practicals
/prac_01/electric_bill_2.0.py
559
3.9375
4
TARIFF_11 = 0.244618 TARIFF_31 = 0.136928 tariff_per_kwatt = int(input("Which tariff? 11 or 31: ")) daily_usage_kwatt = float(input("Enter daily use in kWh: ")) billing_days = int(input("Enter number of billing days: ")) if tariff_per_kwatt == 11: estimated_bill = TARIFF_11 * daily_usage_kwatt * billing_days pr...
7fcba95cd54cd8f4564b71a1a4150cb95918aa58
smorenburg/python
/src/print_pyramid.py
274
3.875
4
def print_pyramid(num): """ >>> print_pyramid(5) o oo ooo oooo ooooo >>> print_pyramid(3) o oo ooo """ for num in range(num): line = 'o' for num in range(num): line += 'o' print(line)
7d8e675e90f20c96366cd6c6ab2f3c9f9caf6c72
smorenburg/python
/src/old/acloudguru/lambdas-and-collections/collection_funcs.py
563
3.734375
4
from functools import reduce domain = [1, 2, 3, 4, 5] # f(x) = x * 2 our_range = map(lambda num: num * 2, domain) print(list(our_range)) evens = filter(lambda num: num % 2 == 0, domain) print(list(evens)) the_sum = reduce(lambda acc, num: acc + num, domain, 0) print(the_sum) words = ['Boss', 'a', 'Alfred', 'fig', ...
8534ccc5fceb5827a2e2c49cd7b2d561be89bad0
smorenburg/python
/src/old/acloudguru/python_objects/car.py
682
3.515625
4
from vehicle import Vehicle class Car(Vehicle): default_tire = 'tire' def __init__( self, engine, tires=None, distance_traveled=0, unit='kilometers', **kwargs ): super().__init__( distance_traveled=distance_traveled, unit=uni...
577fc65755df718ed2aa9d22b08c3d01d2887032
smorenburg/python
/src/old/contains.py
541
3.890625
4
#!/usr/bin/env python3 import argparse parser = argparse.ArgumentParser( description='contains: Search for words including partial word.' ) parser.add_argument( 'snippet', help='partial (or complete) string to search for in words' ) parser.add_argument( '--version', '-v', action='version', ...
064f159df2974e2dc1b7bf012e44a780437f2e29
smorenburg/python
/src/old/exam-practice.py
1,866
3.59375
4
#!/usr/bin/env python3 ages = { 'Keith': 30, 'Levi': 25, 'John': 20, } del ages['Keith'] print(ages) values = ['Kevin Bacon', 60, '555-555-5555', False] val = not values[-1] print(val) ages = { 'Keith': 30, 'Levi': 25, 'John': 20, } output = [str(value) for value in ages.values()] print(outpu...
c4ff4cd5e5f17c70f7527be634cddda045db972f
smorenburg/python
/src/old/exam-practice3.py
2,104
4
4
#!/usr/bin/env python3 def greeting(name=""): print("Hello", name) greeting() numbers = [[1, 2, 3]] initializer = 1 for i in range(1): initializer *= 10 for j in range(1): numbers[i][j] *= initializer print(numbers) x = 0 for i in range(10): for j in range(-1, -10, -1): x += 1 pri...
7e9c168b30e2ef6b98fd6d36f0f70ae2e57ecba4
Marinagansi/PythonLabPractice
/practiceq/class/patternq.n2.py
162
3.5625
4
ascii_number=65 for i in range(4): for j in range(i+1): character=chr(ascii_number) print(character, end=" ") ascii_number +=1 print()
102821abda68058175455a06bae24169ffae610a
Marinagansi/PythonLabPractice
/pythonProject1/q.1.py
155
3.90625
4
#check wheather 5 is in list of first natural number or not Hint list>=[1,2,3,4,5] list=(1,2,3,4,5,6,7) if 5 in list: print("yes") else: print("no")
543721c9305979661f6c83e16d3d90e0a1496c91
Marinagansi/PythonLabPractice
/practiceq/class/evn.py
109
3.96875
4
for i in range(0,10): if i%2==0: print (i,"even number") else: print (i,"odd number")
ccb9085a49b2c86e8ba038127e386205e0e06133
Marinagansi/PythonLabPractice
/qn6.py
107
4.21875
4
'''given a integer number, print it last digit''' num=int(input("enter the number:")) rem=num%10 print(rem)
aad05d66c26fa07d7b9ea7b59ca719af4f456248
Marinagansi/PythonLabPractice
/practiceq/pythonProject1/fucntion/q1.py
225
4.1875
4
''' to print multipliacation table of a given number by using fuction''' def multi(a): product=1 for i in range(11): product=a*i print (f"{a}*{i}={product}") a=int(input("enter the nnumber")) multi(a)
8adef0dd43f92dd18d064ed8c52b9be6a290cc29
Marinagansi/PythonLabPractice
/practiceq/pythonProject1/fucntion/qfactorial.py
186
4.21875
4
'''find factorial num''' def fact(a): product=1 for i in range(2,a+1): product=product*i return product a=int(input("enter the number:")) c=fact(a) print(f"the ans is{c}")
a31e24fc138ca9767e2709f3ec3b2b376783dd6b
Marinagansi/PythonLabPractice
/practiceq/pythonProject1/fucntion/function5.py
163
3.578125
4
'''have parameter and return type''' def dev(a,b): return a/b a=int(input("enter the num:")) b=int(input("enter the num:")) c=dev(a,b) print(f"the ans is {c}")
fb154305fee8fbb0d9f8ba861c0e633d54bffde8
Marinagansi/PythonLabPractice
/practiceq/class/q.5 pattern.py
170
3.9375
4
alphabet= ord("A") for i in range (6,1,-1): for j in range(1,i-1): character=chr(alphabet) print(character, end=" ") alphabet +=1 print()
e28269d4d872492ed3133fd2b8c9a7a96e34c62b
sabina2/DEMO3
/Hurray.py
138
3.953125
4
num1 = int(input("Enter your 1st number")) num2 = int(input("Enter your 2nd number")) if num1==num2 or num1+num2==7: print("Hurray")
32c1121ea0baa887256bde8e45d8c3e1017b5b11
pritamnegi/Machine-Learning-in-Python
/Day 3/Session 1/Multiple_Regression_Using_Train_and_Test_Split.py
1,541
3.703125
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt import scipy.stats as stats import sklearn # Importing the dataset marketing = pd.read_csv("C:\\Users\\app\\Desktop\\marketing.csv") # Getting first five rows of the marketing dataset marketing.head() # Getting type marketing dataset type(marketin...
7dfe63d7af4f0bbb3ff0bb6798c55c4c0e5563d8
CaravanPassenger/pytorch-learning-notes
/image_classification/core/simpleNet.py
1,462
3.5
4
# -*-coding: utf-8 -*- """ @Project: pytorch-learning-tutorials @File : simpleNet.py @Author : panjq @E-mail : pan_jinquan@163.com @Date : 2019-03-09 13:59:49 """ import torch from torch import nn from torch.nn import functional as F class SimpleNet(torch.nn.Module): def __i...
2c21e4855b3463c2330a2081b93f556d0ac6fb3e
zhigang0529/PythonLearn
/src/main/operation/File.py
1,331
3.734375
4
#!/usr/bin/python # _*_ coding: UTF-8 _*_ import psutil from io import open file_path = "content.txt" # 写文件内容 content = u'''Python is a programming language that lets you work quickly and integrate systems more effectively.''' f1 = open(file_path, "a") # a是追加文件内容 f1.write(content) f1.write(u"\n") f1.close() ''' #读文...
66bb84f9550a7dcc3828abb09a13bf9e536b6e29
senseyluiz/estudopython
/exercicios/ex006.py
290
4.03125
4
# Crie um algoritmo que leia um número e mostre o seu dobro, triplo e raiz quadrada. num = int(input("Digite um número: ")) dob = num * 2 tri = num * 3 rai = num ** (1/2) print(f"O dobro de {num} é {dob}\n" f"O triplo de {num} é {tri}\n" f"A raiz quadrada de {num} é {rai}")
916e91fff916b3c759185524bf71d2d4c8591592
senseyluiz/estudopython
/exercicios/ex012.py
327
3.671875
4
# Faça um algoritmo que leia o preço de um produto e mostre seu novo preço, com 5% de desconto. pAtual = float(input("Qual o preço do produto: R$ ")) nPreco = pAtual * 0.95 print(f"O produto que custa R$ {pAtual:.2f}, com 5% de desconto, custará R$ {nPreco:.2f}\n" f"O desconto total foi de R$ {pAtual * 0.05:.2f}"...
8e2d656729f0671a1994d903e6ce858394477bc7
senseyluiz/estudopython
/exercicios/ex031.py
385
3.9375
4
# Desenvolva um programa que pergunte a distância de uma viagem em Km. Calcule o preço da passagem, # cobrando R$0,50 por Km para viagens de até 200Km e R$0,45 parta viagens mais longas. dis = int(input("Qual a distância da viagem? ")) if dis <= 200: valor = dis * 0.50 else: valor = dis * 0.45 print(f"V...
a6ed1a1ebd769832c55f0ba000e05812ac01c63f
senseyluiz/estudopython
/exercicios/ex039.py
695
3.84375
4
# Faça um programa que leia o ano de nascimento de um jovem e informe, de acordo com a sua idade, # se ele ainda vai se alistar ao serviço militar, se é a hora exata de se alistar ou se já passou do tempo do alistamento. # Seu programa também deverá mostrar o tempo que falta ou que passou do prazo. from datetime im...
707681af05d6cb4521bf4f729290e96e6c347287
Dirac26/ProjectEuler
/problem004/main.py
877
4.28125
4
def is_palindromic(num): """Return true if the number is palindromic and false otehrwise""" return str(num) == str(num)[::-1] def dividable_with_indigits(num, digits): """Returns true if num is a product of two integers within the digits range""" within = range(10 ** digits - 1) for n in within[1:]...