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
ce3b278840ff90d8b71498410c902ee628f85666
ZPaulovich/python_git
/Ex4_2_about_file.py
970
4
4
# Скопировать в файл F2 только четные строки из F1. Подсчитать размер файлов F1 и F2 (в байтах). import io import os # создание итерируемого объекта = строки файла main_iter = io.open('FIRST_FILE') x = 0 f2 = open('SECOND_FILE', 'w') # clear file # проход по итерируемому объекту с помощью цикла for st in ...
f6afe453d7f7c30e9f6a1d13caebf584560f9368
eadasfa/LeetCode
/23.合并k个排序链表.py
2,182
3.78125
4
# # @lc app=leetcode.cn id=23 lang=python # # [23] 合并K个排序链表 # # @lc code=start # Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def mergeKLists(self, lists): '''分治 131/131 cases pa...
3893c55517a6bab347eeb228eb1ea8d1c2b3b56a
eadasfa/LeetCode
/26.删除排序数组中的重复项.py
1,812
3.515625
4
# # @lc app=leetcode.cn id=26 lang=python # # [26] 删除排序数组中的重复项 # # @lc code=start class Solution(object): def removeDuplicates(self, nums): """ :type nums: List[int] :rtype: int """ index = 0 for i in range(len(nums)): if nums[i] != nums[index]: ...
fd58e80dce9d1d8a30a93b8bf7b0b6372ac468b0
scmurphy96/Project-Euler
/p2.py
547
3.78125
4
# Each new term in the Fibonacci sequence is generated by adding the previous two terms. # By starting with 1 and 2, the first 10 terms will be: # 1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ... # By considering the terms in the Fibonacci sequence whose values do not exceed four million, # find the sum of the even-valued term...
e34575d87bda4fdfd9e0bcbd2fba023d5d45924c
KrapivinAndrey/AdventOfCode_2019
/03_b.py
1,340
3.578125
4
import progressbar def read_input(): res = [] with open("input.txt") as inf: for line in inf: res.append(line.strip()) return res def get_direction(d): if d == 'U': return 0, 1 elif d == 'D': return 0, -1 elif d == 'L': return -1, 0 elif d == '...
f855fcb095df37f452064e67a5a1afaa5774bc43
NekoNya3/IMG_Python_Assignment
/Python CF problem 118A.py
205
3.671875
4
I=input("") V=("a","e","i","o","u","y") if I.isalpha(): for i in I: if i.lower() in V: continue else: print("."+i.lower(), end="") else: print("Invalid Input\nProgram terminated")
cb94a34c12f81b9b227f28c803a13355df0cb547
victoriavilasb/Python-Algorithms
/1045.py
610
4
4
# -*- coding: utf-8 -*- linha = input().split(" ") a, b, c=linha #ordenar os valores lista=[float(a),float(b),float(c)] lista=sorted(lista) a=lista[2] b=lista[1] c=lista[0] if a>=(b+c): print("NAO FORMA TRIANGULO") else: if ((a)**2)==((b)**2+(c)**2): print("TRIANGULO RETANGULO") if ((a)**2)>((b)...
07a5fa48fcce4e9c8bd2495209526d4e53546e61
victoriavilasb/Python-Algorithms
/1014.py
136
3.609375
4
# -*- coding: utf-8 -*- distancia = int(input()) combustivel = float(input()) total = distancia/combustivel print("%1.3f km/l"%(total))
2cbdba1e2ed2cef3eee9571f718121e2ec541471
victoriavilasb/Python-Algorithms
/1015.py
240
3.65625
4
# -*- coding: utf-8 -*- import math ponto_1 = input().split(" ") ponto_2 = input().split(" ") p1_x, p1_y=ponto_1 p2_x, p2_y=ponto_2 distancia = math.sqrt((float(p2_x)-float(p1_x))**2+(float(p2_y)-float(p1_y))**2) print("%1.4f"%(distancia))
7e696e318a86794c40357671e253eb568adfb8bf
victoriavilasb/Python-Algorithms
/1020.py
209
3.546875
4
# -*- coding: utf-8 -*- dias = int(input()) anos = int(dias/365) resto = dias%365 meses = int(resto/30) dias = resto%30 print('%1.0f ano(s)'%(anos)) print('%1.0f mes(es)'%(meses)) print('%1.0f dia(s)'%(dias))
6400eb91742ec7d7a7bd614fff2b509bf7914963
victoriavilasb/Python-Algorithms
/1049.py
642
3.859375
4
# -*- coding: utf-8 -*- passo1=str(input()) passo2=str(input()) passo3=str(input()) if passo1=="vertebrado": if passo2=="ave": if passo3=="carnivoro": resultado="aguia" else: resultado="pomba" else: if passo3=="onivoro": resultado="homem" els...
7b272a3efd5b8ffa683219f29b23b64920d8523c
faithogachi/Project-X
/command_line.py
1,973
3.515625
4
""" This module defines a command line interface for the skills tracking program. usage: program_name.py --a or -a : add a new skill program_name.py --view_all or -l : add a new skill program_name.py --view_studied or -s : add a new skill program_name.py --view_unstudied or -u : add a new skill program_name.py --progr...
9ddb853fcf9dc3b55d5046a7285c44ea904d1140
woosyume/robotframework-basic
/ExcelWork/ReadExcel.py
617
3.546875
4
import openpyxl # Load workbook workbook = openpyxl.load_workbook("testdata.xlsx") print(workbook.sheetnames) print("Active sheet= " + workbook.active.title) sheet = workbook['Sheet2'] print(sheet.title) print(sheet["A1"].value) cell = sheet.cell(1, 1) print(cell.value) print(cell.row) print(cell.column) # Find Row...
fb2e46a0f5eb1e58ab0769a70a4ac931835f99d3
abhishekshinde2104/Machine_Learning_A-Z
/Part 4 - Clustering/Section 24 - K-Means Clustering/k_means.py
1,550
3.515625
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt #importiing datasets dataset = pd.read_csv('Mall_Customers.csv') X=dataset.iloc[:,[3,4]].values #Using the elbow mtd to find optimal number of clusters from sklearn.cluster import KMeans wcss=[] for i in range(1,11): #here we made ...
3c8c759dc8273363739ba0292757d1599f7b1901
abhishekshinde2104/Machine_Learning_A-Z
/Part 7 - Natural Language Processing/Section 36 - Natural Language Processing/NLP.py
3,863
3.609375
4
import pandas as pd import numpy as np import matplotlib.pyplot as plt #Importing Dataset dataset=pd.read_csv('Restaurant_Reviews.tsv',delimiter='\t',quoting=3) #qutoing=3 ingnores the double quotes # Cleaning the texts #this is impt as when u create the bag of words it gets rid off the unrelevant words li...
cac5b49e2418156bd69d23da1ae441126069dc14
andy12290/Pythonic_Trick
/Aseert/Assert.py
1,098
3.96875
4
# This is related to assert statment def apply_discount(product,discount): discount_price = int(product['price'] * (1-discount)) return discount_price # test shoes = {'name': 'Fancy Shoes', 'price': 14900} print(apply_discount(shoes,0.25)) # output 11175 print(apply_discount(shoes,2.0)) # out: -14900 # we h...
afed5225df3b7a8cc6b42ba7691710a8a019459d
colten-cross/CodeWarsChallenges---Python
/BouncingBalls.py
784
4.375
4
# A child is playing with a ball on the nth floor of a tall building. The height of this floor, h, is known. # He drops the ball out of the window. The ball bounces (for example), to two-thirds of its height (a bounce of 0.66). # His mother looks out of a window 1.5 meters from the ground. # How many times will the ...
dd6c0d2b64065514365c1a0cc43643c62f732ddc
zopletalova/python-012021
/program23.py
1,746
3.53125
4
import pandas as pd #import wget #wget.download("https://raw.githubusercontent.com/pesikj/python-012021/master/zadani/5/country_vaccinations.csv") DataFrame = pd.read_csv("country_vaccinations.csv") # print(DataFrame.info) # Dotaz na vakcinaci v konkrétní den print("Vakcinace za 10. 3.:") vakcinace_den = DataFrame[Da...
8bfa76ac8f085f0df1e829c02c3b1f49b65ca480
zopletalova/python-012021
/program05.py
1,007
3.6875
4
prodeje2019 = { "Zkus mě chytit": 4165, "Vrah zavolá v deset": 5681, "Zločinný steh": 2565, } prodeje2020 = { "Já jsem nový klíč": 3157, "Vrah zavolá v deset": 3541, "Vražda podle knihy": 2510, "Past": 2364, "Zločinný steh": 5412, "Zkus mě chytit": 6671, } """Klíč mu...
a093cf17d8be0da15cfea18ef94dd7c13de16cef
tat2133/walmart-scrape
/code/walmartScrape.py
3,046
3.546875
4
# -*- coding: utf-8 -*- """ @author: taylorthompson Module containing functions to open a webpage, source it, parse the html """ from bs4 import BeautifulSoup from urllib.request import urlopen import re from datetime import datetime import csv #csv name and searches can be modified by user CSV_NAME = 'results.csv' ...
fe5377a64159902e22a2ffcfe6d9cce04e472d73
sauleddy/python_practice
/leetcode/543_DiameterofBinaryTree/main.py
710
3.703125
4
# 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 diameterOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ deepest = [0...
8a3c28d582397dc1dc1908587faa2d48fbf84eae
sauleddy/python_practice
/variables/variable.py
360
3.546875
4
a = 5 print(type(a)) b = 12 print(b / a) print(b // a) print(2 ** 3) print(divmod(9, 5)) print(0b10) print(0o10) print(0x10) print('''The things you need to buy 1. brush 2. toothpaste 3. mirror ''') strA = "123" print(strA[1]) #strA[1] = "5" strB = "abcdef" print(strB[2:-2]) print(strB[::2]) strC = "a:b:c:de:fi...
55bee7a38a4cc294ba3f710f9859348b53c2505a
sauleddy/python_practice
/class/main.py
975
3.859375
4
class Person(): def __init__(self, name): # print('Person()__init__') self.name = name self.__hidden_name = name + '_hidden' @property def hide_name(self): print('inside hidden_name getter') return self.__hidden_name @hide_name.setter def hide_name(self, in...
cc345f7bf713de418fc8c057c6badef3cf46ec94
sauleddy/python_practice
/leetcode/173_BinarySearchTreeIterator/main.py
943
3.875
4
from collections import deque # Definition for a binary tree node class TreeNode(object): def __init__(self, x): self.val = x self.left = None self.right = None class BSTIterator(object): def __init__(self, root): """ :type root: TreeNode """ self.deque...
3e91391ee630b6f053b05bde0dfd6ef3e839b254
sauleddy/python_practice
/comprehension/main.py
562
4
4
print('generate list using comprehension') my_list1 = list(range(1, 10)) print(my_list1) print('generate list 1x1 2x2... using comprehension') my_list2 = [(idx, idx) for idx in range(1, 10) if idx % 2 == 0] print(my_list2) print('generate list permutation of \'ABC\' and \'DEF\' using comprehension') my_list3 = [m + ...
d296b95d612852341e44bd05deed8bb75937fbe0
harishbalakrishnan3/DS-and-Algo-in-Python-MG-MT-MG
/Chapter 4/CH4RecursionExercises_4_7.py
6,145
3.6875
4
""" This module contains the solutions to the Exercises of Ch 4 Function List : MaxElement_r41 NthHarmonicNumber_r46 MaxMin_c49 ElementUniqueness_c411 TowersOfHanoi_c414 PowerSet_c415 StringReverse_c416 VowelsConsonants_c418 OddEven_c419 RearrangementUsingK_c420 SumOfIntegers_c422 Author: Harish Bala...
58f99618238ebedc92e013c8b47b259e1fb2b197
ryadav4/Python-codes-
/EX_05/Finding_largestno.py
263
4.28125
4
#find the largest number : largest = -1 print('Before',largest) for i in [1,45,67,12,100] : if i>largest : largest = i print(largest , i) else : print(i , 'is less than',largest) print('largest number is :', largest)
df12df4375859750303429c7a3f958dfc12b237d
srikanthimmaneni143/Python
/Patterns.py
282
4.0625
4
row=int(input("Enter the rows: ")) col=int(input("Enter the Cols: ")) for i in range(row): for j in range(col): print('*',end=' ') print() row=int(input("Enter the rows: ")) for i in range(row+1): for j in range(i): print('*',end=' ') print()
b31b75a07554977b744dce7fe7236691c4ebae05
liujiamingustc/phd
/surrogate/crossover/cxTwoPoint.py
1,708
3.578125
4
# Copyright 2016 Quan Pan # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
865c6e5f97cf67caa879110914bf4054d9818ecd
liujiamingustc/phd
/surrogate/mutation/mutGaussian.py
2,240
3.640625
4
# Copyright 2016 Quan Pan # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, s...
b285dbb0552ebbe5372588dc4165fb55e63e5a2c
mguerra502/CommandLineFPSWithPython
/intall_requirements.py
1,282
3.734375
4
from pathlib import Path import subprocess import sys import os def install(requirements_file: 'string'): """This function is used to installed the modules indicated in the requirements file Args: requirements_file (string): Requirements file """ output = subprocess.check_output([sys.executabl...
527358ac98d9762771042594f2fe0a10866c4592
shivam190/mypython
/break_continue.py
192
4.03125
4
# break statement for i in range(10): if(i==6): break print(i) # continue statement for n in range(1,10,1): if(n%2==0): print(n,"is even number") continue
0b2f55509daa1787893b2dcb7c99b7b0bec57ac7
Reksa4/Laba3
/laba2.py
3,074
3.71875
4
from turtle import * from math import * shape('turtle') def zero(): forward(100) right(90) forward(200) right(90) forward(100) right(90) forward(200) penup() right(90) forward(300) pendown() def one(): penup() right(90) forward(100) left(90) pendown(...
b6dc894b5aadc6f1798585ce4c753da688db6669
Dragon-Dane/networkx-graph-theory
/degree of node in graph.py
839
3.96875
4
# -*- coding: utf-8 -*- """ Created on Tue Oct 20 10:58:25 2020 @author: shrey """ import networkx as nx G=nx.Graph()#creating a graph G l=int(input("Enter no. of nodes")) nodes=input("enter the nodes separated by comma").split(',') for i in range(l): G.add_node(nodes[i])#adding the node in G no_o...
6faa436ab98bac3d2f6c556f8cb239c48ba72b0f
BusgeethPravesh/Python-Files
/Question6.py
1,549
4.15625
4
"""Write a Python program that will accept two lists of integer. Your program should create a third list such that it contain only odd numbers from the first list and even numbers from the second list.""" print("This Program will allow you to enter two list of 5 integers " "\nand will then print the odd num...
b44106cde22513d62c34322a1aa137391b80567d
rotsix/python-datatypes
/hashmap.py
4,257
3.609375
4
#!/usr/bin/env python from linkedlist import LinkedList class HashMap: def __init__(self, **kwargs): self._occupied = self._old_occupied = 0 self._size = 2 self._store = [None] * self._size self._load_factor = 0.75 self._resizing = False # used to increase capacit...
68c03e43266dc6b9d41f041ab4bf4d61a2bc99cc
adrianme213/PythonCourse
/Section_04/assignment_08.py
1,117
3.84375
4
# Assignment 8 """ Return the sum of the numbers in the list, except ignore sections of numbers starting with a 7 and extending to the next 8 (every 7 will be followed by at least one 8). Return 0 for no numbers. EXAMPLE: sum78([1, 2, 2]) → 5 sum78([1, 2, 2, 7, 99, 99, 8]) → 5 sum78([1, 1, 7, 8, 2]) → 4 """ #Your ...
ab1194fa1c7d8edcffd3573b59358d193e621c4a
ZhuravelViktoria/Lab1
/2.py
374
3.71875
4
V0=float(input ("Введіть початкову швидкість V0 в метрах за секунду : ")) t=float(input ("Введіть час гальмування t в секундах : ")) a=V0/t print("\n") print("Прискорення гальмування дорівнює ",round(-a, 3),"метрів за секунду в квадраті")
7e6d0500c808b3dfa4f26a5133c1851efcfdd9c3
cwoodall/pytrumpet
/bin/pytrumpet.py
12,089
3.5625
4
#!/usr/bin/python ## # trumpet.py : Play trumpet using your computer through python # # trumpet.py allows you to play a sound font by using your keyboard as valves, # and your microphone to listen to the sound produced by a mouthpiece. Using # these two features a note is played using Fluidsynth (via mingus) from a ...
5ce89e3e78462e57bb63829f35fd8375ea1102e6
rohit-kumar6/DailyCode
/Day2/optimise_day2_5.py
340
3.578125
4
nums = [1,2,3,4,5] n = len(nums) left, right, result = [1] * n, [1] * n, [1] * n for i in range(1, len(nums)): left[i] = nums[i - 1] * left[i - 1] for i in range(len(nums) - 2, -1, -1): right[i] = right[i + 1] * nums[i + 1] print(left) print(right) for i in range(0, len(nums)): result[i] = left[i] * rig...
3f30a06f838cca1e51efd74259fa2c990698431e
abujawed11/c_program
/harry/tcs.py
302
3.984375
4
R = [] print("Enter the distances covered by racers in Marathon(Kilometers) please (press q to terminate):") num = input() while num !='q': R.append(float(num)) num = input() result = sorted(R) for i in result: if i < 0 : print("Invalid Input") break print(result[-4:-7:-1])
6d2b1521f57a9eaab23375a14a1724f36532221d
eufrazio/ProcessamentoImagem
/proc_imagem-Distancias.py
977
3.65625
4
#-* coding: cp1252 -*- __author__ = 'Euf' from PIL import Image import numpy as np from math import sqrt import math#biblioteca para poenciacao #---------------------------------------------------------------- print("\n\nClculo de Distncias\n") imagem = Image.open("robotech1.jpg") imageDist = np.array(imagem,dtype=...
4941731b3ba8b7f549ac97f01cb7d2bdfb63f1a4
charpty/charpty.com.mds
/codes/struct/write_rb_tree_example.py
10,411
3.6875
4
# -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') RED = 0; BLACK = 1; # 我们就用一个key存整数这样简单点 class Node: def __init__(self, key, value, color, parent): self.key = key self.value = value self.left = None self.right = None self.parent = parent ...
f81bcc364fdf72a4494940fcd6c8acdd52c9cca8
falcon97/wallbreakers
/Week 1/Arrays/array_parity.py
434
3.890625
4
from typing import List class Solution: def sortArrayByParity(self, A: List[int]) -> List[int]: even_elements = [element for element in A if element % 2 == 0] odd_elements = [element for element in A if element % 2 != 0] return even_elements + odd_elements if __name__ == "__main__": ...
1fcaa46e52937ab46b482e68a4525c3736ea3386
falcon97/wallbreakers
/Week 1/String Manipulation/reverse_words.py
313
3.71875
4
class Solution: def reverseWords(self, s: str) -> str: l = s.split(" ") l = [s[::-1] for s in l] rev = " ".join(l) return rev if __name__ == "__main__": solution = Solution() input = "Let's take LeetCode contest" out = solution.reverseWords(input) print(out)
3f3daa4eb8144c17e9db7474672e23b7001a8f8f
falcon97/wallbreakers
/Week 1/Basic Math/plus_one.py
344
3.59375
4
from typing import List class Solution: def plusOne(self, digits: List[int]) -> List[int]: num_str = ''.join(str(digit) for digit in digits) return [int(digit) for digit in str(int(num_str) + 1)] if __name__ == "__main__": solution = Solution() input = [1, 2, 3] out = solution.plusOn...
1fbef6ccc8104db1c02a064f1cafb00d913a3e2a
HemangRajvanshy/Twilio-StockBot
/Server-python/stringSanitize.py
561
3.65625
4
def stringClean(s): removeThese=["the","eh","uh","a","i","what","want","to","two","share","shares","see","wants","not","do"] listOfString = s.split() retS = "" for x in range (len(listOfString)): listOfString[x]=listOfString[x].strip('.') listOfString[x]=listOfString[x].strip(',') ...
563a52f4e068089014d626ce488a8d77a66da485
cooligc/POCRepo
/Sample.py
318
3.703125
4
class Employee: employeeGreetings = "" def __init__(self,name = "Sitakant"): self.employeeGreetings='Hi ! '+name def sayHello(self): print "Message , {0}".format(self.employeeGreetings) if __name__ == '__main__': print "~~~~~~ Hello ~~~~~~" e = Employee('Me') e.sayHello()
f7789e9d8ba69c7974aa42131a6bf08c8cb8a293
vithalsamp/AlgosWithPython
/merge_insertion_sort.py
1,470
4.21875
4
# This program shows how to speed up merge sort using insertion sort def merge_insertion_sort(arr): if len(arr) > 1: mid = len(arr)//2 L = arr[mid:] R = arr[:mid] # Set threshold length of sub-arrays to use insertion sort # divide array if it is greater then 10 if ...
2eb9dfd83c1a3403b2c427603240bf581b40be23
vithalsamp/AlgosWithPython
/heap_sort.py
1,589
3.84375
4
# Original Heap sort implementation in Python # Identify Parent Node def parent(i): return (i-1)//2 # Identify LEFT node def left(i): return 2*i + 1 # Identify RIGHT node def right(i): return 2*i + 2 # Apply max heap property. Parent node of subtree should be larger then child nodes def max_heapify(...
1db25f3d5ab544fae9dd4be515d8195e62494d41
andrewkmin/utxo_algorithms
/tiebreaker.py
975
3.53125
4
def tie_breaker(sorted_by_value) : i = 0 tiebreaker = [] min_change = sorted_by_value[0][1] while (i < len(sorted_by_value)) : # avoid non-min change date-ranges if (min_change != sorted_by_value[i][1]) : break else : tiebreaker.append(sorted_by_value[i])...
5c09acf7c76152c20bdf9d3374e3774c5238cd63
kjg116/College-Assignments
/Python-Lab-Assignments-master/Lab7_Music_Library/cd.py
2,164
3.71875
4
from Song import * class CD: def __init__(self, album, artist, song_list = []): self.set_album(album) self.set_artist(artist) self.set_song_list(song_list) return #Removes beginning and trailing whitespace characters in album and #stores the attribute def set...
04890c636e097a33fdad2ff75e9c00be0da9ee06
Oluyosola/micropilot-entry-challenge
/oluyosola/count_zeros.py
544
4.15625
4
# Write a function CountZeros(A) that takes in an array of integers A, and returns the number of 0's in that array. # For example, given [1, 0, 5, 6, 0, 2], the function/method should return 2. def countZeros(array): # count declared to be zero count=0 # loop through array length and count the number of ze...
8e1d0d20621bc7cae56575bfc9c90feece19afd0
s155154155/age
/age.py
449
3.875
4
#年齡判斷 driving = input('請問你有沒有開過車?') if driving != '有' and driving != '沒有': print('只能輸入有或沒有') raise SystemExit age = input('請問你的年齡?') age = int(age) if driving == '有': if age >= 18: print('你通過測驗了') else: print('奇怪 你怎會開過車') elif driving == '沒有': if age >= 18: print('你可以考駕照了') else: print('很好再過幾年就可以考')
44ca5522a5b4ef8db8c1a955dc35e74c08bb318f
tomPlus353/Simple-To-Do
/Simple Daily ToDo.py
2,790
3.734375
4
#barebones task list #list of tuples of tasks with start time #Q - does tuple support datetime object - YES #Takes in list with start time. #When task is done it is written into the text file with the total time taken. import datetime, time import os from progress.bar import ChargingBar #import shelve # perhaps...
d461f782f9a2da1fab1703c4c04aa75619b6c6ee
mb-la/ACTstreamlit
/act_app.py
6,969
3.765625
4
import streamlit as st import pandas as pd import matplotlib.pyplot as plt import numpy as np import pydeck as pdk import plotly.express as px def main(): st.title("Exploratory Data Analysis on ACT Scores") st.sidebar.title("EDA on ACT Scores") st.sidebar.subheader("By [Meral Balik](https://github.com/Mera...
05ca1067cbb87f6936db956516dbffe133d3cec6
Meowsers25/Head-First-Python
/chapt2/panic.py
754
3.90625
4
phrase = "Don't panic!" plist = list(phrase) # puts phrase into a list print(phrase) print(plist) for i in range(4): # iterates 4 times plist.pop() # pops off the last 4 characters ! c i n # print(plist) plist.pop(0) # pops off the first character D # print(plist) plist.remove("'") # removes the apostrophe; no...
ccd5b8e0268c00b58aff68708f05e83439fbd2ee
Tashsub/book-store-app
/backend.py
2,483
3.96875
4
import sqlite3 import app conn = sqlite3.connect("bookshop.db") cur = conn.cursor() cur.execute("CREATE TABLE IF NOT EXISTS books (id INTEGER PRIMARY KEY, title TEXT, year INTEGER, author TEXT, isbn INTEGER, attachment TEXT )") conn.commit() conn.close() def insert_book(title, year, author, isbn, file_path=""): ...
db9707d14817908fb8e745e5c5408edd1973f499
tribadboy/algorithm-homework
/week2/寻找旋转排序数组中的最小值.py
487
3.703125
4
# -*- coding:uft-8 from typing import List class Solution: def findMin(self, nums: List[int]) -> int: left = 0 right = len(nums) - 1 while left <= right: mid = int(left + (right - left) / 2) if nums[left] <= nums[right]: return nums[left] ...
8d1c54d193bf0770a1cbeb045551fa9735326654
FlyingRockSquirrel/CoronaSim
/main.py
5,244
3.703125
4
import random import networkx as nx import matplotlib.pyplot as plt # TODO: improve visualizer, potentially implement quarantine if time permits, # do some sort of reinforcement learning to optimize quarantine. # Will be node in the graph. Contains data specific to each person class Person: def __ini...
5e144f517c74603b648386199acae73eabe77a7d
salmonofdoubt/TECH
/PROG/PY/py_wiki/wiki_code/w15_IO_a.py
309
3.625
4
#!/usr/bin/env python # 15 File IO # Write a file out_file = open("test.txt", "wt") out_file.write(input("Write something (nice): ")) out_file.close() input('\n+++Saved+++\n\nPress enter to view content ') # Read a file in_file = open("test.txt", "rt") text = in_file.read() in_file.close() print(text)
122538778c805fc3da16c13d6fba9e82e118671f
salmonofdoubt/TECH
/PROG/PY/strings/string5.py
563
3.78125
4
#!/usr/bin/python import sys # Gather code in a main() function def main(): response = raw_input("Call string_find function? (Y)\n") if (response == 'y' or response == 'Y'): name = raw_input('Enter name: ') number = raw_input('Enter number: ') substitute(name, number) #calls fct... else: ...
d9315a24017cc7df415ab6192f9bbded8f2116c1
salmonofdoubt/TECH
/PROG/PY/pyquick/yearnames/solution/yearnames_test.py
1,596
3.828125
4
#!/usr/bin/python2.4 # Copyright 2008 Google Inc. All Rights Reserved. """YearNames exercise unit test. This unit test is written as a standard python test. The google3 python tests will look very similar. The test methods testGetYear() and testGetRank() are provided. You can add tests for GetRanks() and GetSummaryT...
805e82a3f7c673eb16696b5f66fb0efc4b581700
salmonofdoubt/TECH
/PROG/PY/i2p/week10/demo_files/exceptions/except_exit.py
439
3.921875
4
#!/usr/bin/python2.6 import sys def main(): for try_num in range(3): try: num = int(raw_input('Enter an integer: ')) break except ValueError: if try_num == 2: sys.exit('Failed to give valid integer in 3 tries.') else: print 'Invalid Integer...try again.' print 'You...
d9504458070080dca24cf9736564196369483c82
salmonofdoubt/TECH
/PROG/PY/py_wiki/wiki_code/w8e.py
1,551
4.125
4
#!/usr/bin/env python #8_Lists - test of knowledge def get_questions(): #Note that these are 3 lists return [["What color is the daytime sky on a clear day? ", "blue"], ["What is the answer to life, the universe and everything? ", "42"], ["What is a three letter wor...
603615cdfaa58389c5284906fffb94720af7f8c6
salmonofdoubt/TECH
/PROG/PY/py_dummies/py4du_classes-subclasses2.py
445
3.78125
4
#!/usr/bin/env python # encoding: utf-8 """ """ class Employee: def __init__(self, lastname, firstname=None): self.lastname = lastname self.firstname = firstname def __str__(self): if self.firstname: return "%s %s" % (self.firstname, self.lastname) else: return self.lastname a = Empl...
df7cfa7f74c9ac6d00ee5f0cb1c059aeac69febb
salmonofdoubt/TECH
/PROG/PY/dicts/ex40.py
800
4.1875
4
#!/usr/bin/env python # encoding: utf-8 """ Discription: dicts Created by André Baumann 2012 Copyright (c) Google Inc. 2012. All rights reserved. """ import sys from sys import exit import os def find_city(which_state, cities): if which_state in cities: return cities[which_state] else: return "Not found." def ...
3de44b016d5b45e0670397bfe59d69aedb9bef33
salmonofdoubt/TECH
/PROG/PY/classes/dog.py
1,881
4.53125
5
#!/usr/bin/env python # encoding: utf-8 ''' How to use classes and subclasses - classes are templates Created by André Baumann on 2011-12-11. Copyright (c)2011 Google. All rights reserved. ''' import sys import os class Dog(object): # means Dog inherits from 'object' def __init__(self, name, breed): #...
7c57cdd40d750c2dfabda2d3bb522b8f76550bf0
salmonofdoubt/TECH
/PROG/PY/i2p/b2.py
596
3.515625
4
#!/usr/bin/env python # encoding: utf-8 """ bashing2.py Created by André Baumann on 2011-12-10. Copyright (c) 2011 __MyCompanyName__. All rights reserved. """ import sys import os def main(): while True: what = raw_input('part (finger):') how = raw_input('tool (knife):') print '\"iscut return value\":', isc...
bc79e560f3b94a63f34c2a708761b88653f5457d
salmonofdoubt/TECH
/PROG/PY/py_dummies/py4du_generator_iterator1.py
330
3.828125
4
#!/usr/bin/env python # encoding: utf-8 """ untitled.py Created by André Baumann on 2011-08-24. Copyright (c) 2011 __MyCompanyName__. All rights reserved. """ sets = raw_input('') def uniq(input): prev = object() for word in input: if word != prev: yield word prev = word print myinput uniq(myinput...
10e0044016ec1b4f2f1f6b2504d0918bdd20d7f2
salmonofdoubt/TECH
/PROG/PY/i2p/week7/challenging/animals/labrador2.py
331
3.703125
4
#! /usr/bin/python import random class Dog2(): def __init__(self,name,size): self.name = name self.size = size def Bark(self): return 'woof woof!' + 'I am a ' + self.size + ' sized dog' class Labrador2(Dog2): def Greet(self): return 'My name is ' + self.name + ' and I LOVE YOU and LOVE...
0c52d9c5924a64b98ea2e84a0b7cf2b72063c3be
salmonofdoubt/TECH
/PROG/PY/strings/string_ex2.py
4,343
4.28125
4
#!/usr/bin/python2.4 -tt import string # D. verbing # Given a string, if its length is at least 3, add 'ing' to its end. # Unless it already ends in 'ing', in which case add 'ly' instead. # If the string length is less than 3, leave it unchanged. # Return the resulting string. def verbing(s): if len(s) >= 3: if ...
79863049458940aa9fcd619e4eec6f88ed8a1389
salmonofdoubt/TECH
/PROG/PY/dicts/ex41.py
2,209
3.859375
4
#!/usr/bin/env python # encoding: utf-8 """ Discription: Created by André Baumann 2012 Copyright (c) Google Inc. 2012. All rights reserved. """ from sys import exit from random import randint def death(): # --------- 7. ----------- quips = ["You died. You kinda suck at this.", "Nice job, you died ...jack...
2f3e14bec17b97afd523081d2e116dea6ddcd6d8
salmonofdoubt/TECH
/PROG/PY/py_wiki/wiki_code/w12a.py
434
4.125
4
#!/usr/bin/env python # 12_Modules import calendar year = int(input('Type in the bloody year: ')) calendar.setfirstweekday(calendar.SUNDAY) calendar.prcal(year) # Prints the calendar for an entire year as returned by calendar(). from time import time, ctime prev_time = "" while True: the_time = ctim...
64cfff5c644361c844f06bca46217dd1a4b4246a
salmonofdoubt/TECH
/PROG/PY/list/ex34.py
784
4.09375
4
#!/usr/bin/env python # encoding: utf-8 """ Discription: lists, ordinals, cardinals Created by André Baumann 2012 Copyright (c) Google Inc. 2012. All rights reserved. """ import sys import os def my_list(): animals = ['bear','tiger','pengiun','zebra', 'bear','tiger','pengiun','zebra'] #ordinal numbers, as or...
5e2509f05a8d653c6a13e063bb01c433146422f0
salmonofdoubt/TECH
/PROG/PY/py_abs/abs_code/abs_maitre.py
272
3.84375
4
#!/usr/bin/env python print('Welcome') money = input('How much will you slip the Maitre\'D tonight? ') if money: print('ah, I reminded of a table') else: print('Please sit, it may be a while..') input('exit')
a4c50e20578681884054d7be779e1ce92caf732a
salmonofdoubt/TECH
/PROG/PY/spoj/penny.py
1,789
3.765625
4
#!/usr/bin/python2.4 -tt # Copyright 2008 Google Inc. All Rights Reserved. """Mimic pyquick exercise -- optional extra exercise. """ __author__ = 'nparlante@google.com (Nick Parlante)' import random import sys def A(arg1, arg2): """Returns mimic dict mapping each word to list of words which follow it.""" # +...
94a5f0bbd207361294866fe625cee1a976749bf8
salmonofdoubt/TECH
/PROG/PY/pyintro/coding/week3homework.py
1,027
3.96875
4
#!/usr/bin/python2.4 -tt #PART1 while True: no = raw_input('Enter a number 1-6: ' ) if no == '1': print 'that is the best' elif no == '2': print 'that\'s the type of pencil you use in the SAT' elif no == '3': print 'that rhymes with \'me\'' elif no == '4': print 'I want some more' elif no =...
c0887e2a9fa8c473be0ece4f7d22469905f55352
CCabada/CS2302
/Lab 7/EditDistance.py
831
3.609375
4
''' Carlos Cabada CS 2302 - Fall 2018 Lab Assignment No.7 : EditDistance.py Date: November 30, 2018 Instructor: Diego Aguirre Purpose: Implementation of Edit Distance. ''' def edit_distance(string1, string2, len1, len2): d = [[0 for x in range(len2 + 1)] for x in range(len1 + 1)] for i in range(l...
d642b30819be2297d6c438af051152f0112d7e6a
reagan-oliver/Final-Project
/ReaganOliverFinal.py
11,597
3.96875
4
""" Name: Reagan Oliver CS230: Section 05 Data: Cambridge Airbnb Data Summary: There are two main functions of this program: 1.) Have property owners input info about their property and help determine a possible price for it - produces an actual number based on inputs from the sidebar -...
939a3eaa4a3ccd2177e7865757b9fd0370ecbd3d
PavloTitov/titov
/lesson_6_Titov/main.py
540
3.875
4
#1 задача for i in range(7,30,7): print('i=', i) #2 задача count=0 for i in range (0,30): print('i=', i) print() for i in reversed(range (0,30)): print('i=', i) print() for i in range(0,30): if i % 7== 0: print('i=', i) print() for i in range(0,30): if i % 5 ==0: count +=1 print(cou...
dcbd1853ef092fcdc8e9e12b24a24bd158e3aed1
molusca/Python
/python_games/play.py
588
3.859375
4
import hangman.hangman import guessing_game.guessing_game def chose_game(): print() print('*****************************************') print('****** CHOSE YOUR GAME!!! *******') print('*****************************************') print("\n(1) - Hangman, (2) - Guessing Game") game = in...
cb7e18fd05f7cb9b2bedb14e80ceef0c9d5591ea
molusca/Python
/learning_python/speed_radar.py
955
4.15625
4
''' A radar checks whether vehicles pass on the road within the 80km/h speed limit. If it is above the limit, the driver must pay a fine of 7 times the difference between the speed that he was trafficking and the speed limit. ''' def calculate_speed_difference(vehicle_speed, speed_limit): return (vehicle_speed - s...
9b0ba84ddd0d3272b4daf979e62d3819eff589c3
molusca/Python
/learning_python/product_discount.py
574
4.03125
4
def calculate_discount_percentage(discount): return discount / 100 def calculate_final_value(product_value, discount_percentage): return product_value - (product_value * discount_percentage) print('\nDISCOUNT CALCULATOR') product_value = float(input('\nProduct value: $')) discount = float(input('Discount off...
1dee8d560ac13155623ff5c7dc5f84a961ff4b0b
danielmcorreia/Computational_Intelligence_Optimization_Project
/fitness_functions.py
5,434
4
4
import numpy as np def set_grids(solution): '''Takes a canditate solved sudoku and stores the contents of each 3x3 grid in a list. In total, it creates a list of 9 lists, each list corresponding to a 3x3 square whose elements, in theory, should be all unique''' squares = [] for row in ran...
d42a976ef1d36757a6ec9abde74d5cb8a125ed77
swatha96/python
/logical_operator.py
115
3.890625
4
## logical ## will return true or false ## or, and, not a,b=50,30 print(a>b or a<b) print(a<b and b<a)
18fa6287bdfec727517bb2073845c911f1494b2f
swatha96/python
/preDefinedDatatypes/tuple.py
928
4.25
4
## tuple is immutable(cant change) ## its have index starts from 0 ## enclosed with parenthesis () - defaultly it will take as tuple ## it can have duplicate value tup=(56,'swe',89,5,0,-6,'A','b',89) t=56,5,'swe' print(type(t)) ## it will return as tuple print(tup) print(type(tup)) ## it will return datatyp...
0253fd0177753a21f767d09cfefc4f6eea4427fb
swatha96/python
/digits.py
1,101
3.921875
4
number=int(input("enter thr number:")) class digit: def digit0(self): print("enter the number :") def digit1(self): print("single digit number") def digit2(self): print("double digit number") def digit3(self): print("3 digits number") def digit4(self): ...
4205c5ca3e4edd81809135f9aa3f79323a0db129
swatha96/python
/numberDatatype.py
327
4.3125
4
#int #float #complex - real and imaginary number: eg:5 : it will return 5+0j #type() - to get the datatype - predefined function #input()- predefined function - to get the inputs from the user a=int(input("enter the number:")) b=float(input("enter the number:")) c=complex(input("enter the number:")) print(a...
aa166a28d78ffbe66338c1abadcbaa6f1a34d669
swatha96/python
/reverse_number.py
153
4.09375
4
number=int(input("enter the number:")) reverse=0 while(number>0): r=number%10 number=number//10 reverse=(reverse*10)+r print(reverse)
317b17c8ac8c70a11950599c1c150feadf2cf034
swatha96/python
/large_number_list.py
478
4.1875
4
""" number=[23,98,56,26,96,63] number.sort() maxi=len(number) minus=maxi-1 for i in range(maxi): if(i==minus): print("the largest number is :",number[i]) """ number=[] n=int(input("how many numbers you wants to add:")) for i in range(n): num=int(input("enter the number:")) num...
0204e7550cb207f95814399df7606fdca4fafd34
WUBOFAN1/Day100-python
/day2-4/最大公约数和最小公倍数.py
225
3.625
4
a=int(input("第一个数:")) b=int(input("第二个数:")) m=a n=b if a<b: c=a b=c a=b while(b!=0): r=a%b a=b b=r print("最大公约数为%d" %a) print("最小公倍数为%d" %(m*n/a))
7c5f1259f09c1807d2df89c2ef2e5fd2d27b6587
WUBOFAN1/Day100-python
/day5-6/斐波拉契数列.py
279
3.859375
4
num=int(input("输出前n个数字:")) value_1=1 value_2=1 print("第1个数为%d"%value_1) print("第2个数为%d"%value_2) for i in range (num-2): total=value_1+value_2 print("第%d个数为%d"%(i+3,total)) value_1=value_2 value_2=total i+=1
ca57cc1bbfd87ec818c1aaa15b6eef059409d100
gabrezues/u4l5
/drawings/problem2.py
169
3.84375
4
from turtle import * sofi = Turtle() def drawTri(): for x in range(3): sofi.forward(100) sofi.left(120) for x in range(12): drawTri() sofi.left(30) mainloop()
f90ed31d9f6d5015783079006406b9add12de14b
haydenj/2018-Advent-of-Code
/Day 7 Puzzle 1.py
2,240
3.515625
4
def parse(filename): """ Reads file into list while stripping away whitespace characters, expecting tuples """ with open(filename) as file: lines = [line.strip() for line in file] scrubbedlines = list() for line in lines: splitline = line.split(' ') scrubbedline = (splitline[1]...
c0272b8fe2d373d2c738ee0476d611ef16fc5bdb
haydenj/2018-Advent-of-Code
/Day 2 Puzzle 1.py
946
3.828125
4
import collections def parse(filename): """ Reads file into list while stripping away whitespace characters. """ with open(filename) as file: lines = [line.strip() for line in file] return lines def countletter(wordlist): """ Accepts a list of strings and parses each to record number of inst...
fb58468d51444a13d2e359100e7669f27fa17a2a
MugBergerFries/ObjectOriented
/HW3_final.py
8,217
3.703125
4
import random import numpy as np class Store: money = 0 # Total money made so far currentRentals = [] # Rentals that have not finished yet completedRentals = [] # Rentals that have already completed tools = [] # List of all tools (Availability is indicated by the 'available' bool in the Tool class...
038b5f6d860dd29624f15e21e1895b0840d1f289
aakorolyova/DeSpin
/namespace.py
7,138
3.53125
4
class nametype(): def __init__( self, typ ): assert( type( typ ) is str ) self.label = typ self.maxid = 0 self.all_names = [] self.reset_maxid = 0 # used only when reseting all the names of a type self.old2new_name_mapping = {} def __del__( self ): dymmy...
9d148a4b0b90c6ce1ce150b9b859982bedf9a4dc
wf-Krystal/TestDemo
/PTestDemo/listTest/listDemo.py
1,313
3.90625
4
#!/usr/bin/python # -*- coding: UTF-8 -*- """ products = ['Iphone8',6888],['MacPro',14800],['小米6',2499],['Coffee',31],['Book',80],['Nike Shoes',799] shopcar =[] while True: print('---------products---------') for index, p in enumerate(products): print('%s.%s %s' %(index, p[0], p[1])) choice = inpu...
f341beabb8073553316b8c64b1b0c040a5c82b75
wf-Krystal/TestDemo
/PTestDemo/funcTest/funcTest4.py
1,128
4.40625
4
#!/usr/bin/python # -*- coding: UTF-8 -*- #案例5:计算传入的列表的最大值、最小值和平均值,并以元组的方式返回; import math def numdel(li): list = [] list.append(float(max(li))) list.append(float(min(li))) sum = 0 for i in li: sum += float(i) aver = sum/len(li) list.append(aver) return tuple(list) print...