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
017a8b20d151b2e0476388740b5b5e54d8679bde
Rajkumar21098/Rajkumar-R
/test5.1.py
142
3.796875
4
a=float(input()) b=float(input()) c=float(input()) if(a>b) and (a>c): print(a) elif(b>a) and (b>c): print(b) else: print(c)
319de4659b74accfe57c9c63a49ff59b62a2906e
ihashib/socket_programming_python
/socket_client.py
1,195
3.59375
4
#python 3 import socket import threading PORT = 5050 SERVER = '' #add the ip address of the server pc ADDR = (SERVER, PORT) FORMAT = 'utf-8' HEADER = 64 DISCONNECT_MESSAGE = 'disconnect' client = socket.socket(socket.AF_INET, socket.SOCK_STREAM) client.connect(ADDR) def send(msg): message = msg.encode(FORMA...
0109ac0ab58de84992669918d9ffab9d299c2acf
Bumbi54/Advent20
/Day15/Day15.py
1,895
3.65625
4
import time def readInput(fileName): """ Read input file and parse it into a list :param fileName: name of input file :return: list of input file content (each line is new element) """ with open(fileName, 'r') as file: return list(map(int, file.readline().split(","))) class Number:...
8fe53b2379c495d2b689114daa00b7e3ec4503c4
Bumbi54/Advent20
/Day2/Day2.py
2,139
3.96875
4
import re def readInput(fileName): """ Read input file, parse lines with regex and parse it into a list :param fileName: name of input file :return: list of input file content (each line is new element) """ passwordPolicyList = [] reMatch = re.compile("(\d+)-(\d+) (\w): (\w+)") with...
fb280711c84eccc249c047ecabed423b7b9064f9
Bumbi54/Advent20
/Day21/Day21.py
2,730
3.609375
4
from collections import Counter import copy from bidict import bidict def readInput(fileName): """ Read input file, parse lines with regex and parse it into a dictinary :param fileName: name of input file :return: list of input file content (each line is new element) """ inputDict = {} foo...
e80183defbc0fadafe7c978157eaff786387f22d
GaikwadHarshad/ML-FellowShip-Program
/WEEK 1/program41.py
831
4.28125
4
""" Write a Python program to convert an integer to binary keep leading zeros. Sample data : 50 Expected output : 00001100, 0000001100 """ def convert_to_binary(num): if num < 0: return 0 else: i = 1 bin1 = 0 # loop for convert integer to binary number while num...
c8f421d31fe4ef50ad2bc987bd271de404a2e0fa
GaikwadHarshad/ML-FellowShip-Program
/WEEK 1/program25.py
233
3.890625
4
""" Write a Python program to get the current value of the recursion limit. """ import sys # get current value of recursion limit value = sys.getrecursionlimit() # display value print("current value of recursion limit is:", value)
c47c83abdede4e0468de7f12d00da0bb19295832
GaikwadHarshad/ML-FellowShip-Program
/WEEK_4/Matplotlib/Matplotlib_ScatterPlot/programs/compare weights and heights.py
2,225
3.71875
4
from myprograms.WEEK_4.Matplotlib.Matplotlib_ScatterPlot.Utility.scatterplot_utility import validate_num, create_list_all import matplotlib.pyplot as plt import numpy as np # class to perform graphical representation of data using matplotlib pie chart class CompareWeightsAndHeights: choice = 0 def scatter_pl...
6a9406cd8f98e8ad2fd636e6f3b0a744b707e36b
GaikwadHarshad/ML-FellowShip-Program
/WEEK 1/program7.py
379
4.0625
4
""" Write a Python program to check whether a specified value is contained in a group of values. Test Data : 3 -> [1, 5, 8, 3] : True -1 -> [1, 5, 8, 3] : False. """ def check_data(group_data, num): for gd in group_data: if num == gd: return True return False print(check_dat...
0a602c266cb285212e5161dcf5422627d5318724
GaikwadHarshad/ML-FellowShip-Program
/WEEK_4/Matplotlib/python matplotlib/Drawline chart for Alphabate Inc.py
1,611
4.03125
4
from myprograms.Utility.UtilityDS import validate_num from myprograms.WEEK_4.Matplotlib.Utility.UtilityModule import Utility import pandas as pd import matplotlib.pyplot as plt # class to perform graphical representation of data using matplotlib class DrawLineChart(Utility): choice = 0 def __init__(self): ...
005e8232e60c0e360f64c939d308fe2f8dc49e8a
GaikwadHarshad/ML-FellowShip-Program
/WEEK_2/List/program1.py
1,682
4.09375
4
""" Write a Python program to sum all the items in a list. """ from myprograms.Utility import UtilityDS class List1: create = [] # function to perform list creation and get sum of list def sum_list(self): while 1: print("1.Create List""\n""2.Sum of list""\n""3.Exit") try:...
cc7a4731ccb33f08769d283c87cf504a2b50be76
GaikwadHarshad/ML-FellowShip-Program
/WEEK_2/Tuple/program1.py
257
4.28125
4
""" Write a Python program to create a tuple. """ class Tuple: # creating tuple tuple1 = (2, 3, 5, 6, 5) def create_tuple(self): print("Tuple : ", self.tuple1) # instance creation Tuple_object = Tuple() Tuple_object.create_tuple()
4ab11ebab5f2712fa0fdb4aaca139f8e69960d87
GaikwadHarshad/ML-FellowShip-Program
/WEEK_12/Apriori/python file/market_basket_optimisation.py
1,349
3.546875
4
#!/usr/bin/env python # coding: utf-8 # In[23]: # import libraries import numpy as np import matplotlib.pyplot as plt import pandas as pd from apyori import apriori # In[24]: # import dataset dataset = pd.read_csv('Market_Basket_Optimisation.csv',header=None) # In[25]: # size of dataset print('Datase...
beb2df68eb4747c631909dad5c61ab3b01e5f902
GaikwadHarshad/ML-FellowShip-Program
/WEEK_2/String/program9.py
1,653
4.40625
4
""" Write a Python program to display formatted text (width=50) as output. """ from myprograms.Utility import UtilityDS class String9: string = ''' Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax...
1f81612cf47424a55788a37169f6ede46270752c
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/String/program7.py
1,299
4.0625
4
""" Write a Python program that accepts a comma separated sequence of words as input and prints the unique words in sorted form (alphanumerically). Sample Words : red, white, black, red, green, black Expected Result : black, green, red, white,red """ from myprograms.Utility import UtilityDS class String7...
533a25953d7f4b983fb28c0895016e3c72231845
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/List/program11.py
1,152
4.125
4
""" Write a Python program to generate all permutations of a list in Python. """ from myprograms.Utility import UtilityDS class List11: create = [] k = 0 @staticmethod # function to perform operations on list def specified_list(): while 1: print("-----------------------------...
2de26bfd186e7ff89dc92e968b9db2125039416a
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/Dictionary/program7.py
1,733
4.21875
4
"""Write a Python program to print all unique values in a dictionary. Sample Data : [{"V":"S001"},{"V": "S002"},{"VI": "S001"},{"VI": "S005"},{"VII":"S005"},{"V":"S009"},{"VIII":"S007"}] Expected Output : Unique Values: {'S005', 'S002', 'S007', 'S001', 'S009'}. """ from myprograms.Utility import UtilityDS class Uniq...
cdf3c07056e0fa2a6421a02aeefb69e535947ca6
GaikwadHarshad/ML-FellowShip-Program
/WEEK 1/program6.py
360
4.1875
4
""" Write a Python program to calculate number of days between two dates. Sample dates : (2014, 7, 2), (2014, 7, 11) Expected output : 9 days. """ from datetime import date date1 = date(2019, 2, 14) date2 = date(2019, 2, 26) calculatedDays = date2 - date1 delta = calculatedDays print("Total numbers of days be...
8bab9aa97d88d37ba0b094f84a1c61c09a9e4e64
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/Tuple/program5.py
737
4.15625
4
""" Write a Python program to find the repeated items of a tuple. """ from myprograms.Utility import UtilityDS class Tuple5: tuple1 = (3, 5, 6, 5, 4, 3) # function performing on tuple to get items repeat or not def repeat_items(self): try: print("Tuple1 : ", self.tuple1) ...
077de953d0aaed5dc71e9e00ee9548baa3b1eae9
Adhesh148/CMOS-Netlist-Generator
/cmos.py
11,421
3.59375
4
import itertools # Welcome message print("Welcome to RTL Compiler - Boolean Expression to Transistor Netlist\n") print("Input Symbols : ~ (NOT), . (AND), + (OR)\n") # Accept the input string print("Enter Boolean Expression") expr = input().strip() SYMBOLS = ['(',')','+','.','~', ' '] PRECEDENCE = {'~':3,'.':2,'+':1,...
60b822bddd6114eb5593ab98df399bc8a656c598
tpalczew/Exercism.io-Solutions
/python/bob/bob.py
840
3.84375
4
def hey(phrase): # Bob is a lackadaisical teenager. In conversation, his responses are very limited. # Bob answers 'Sure.' if you ask him a question. # He answers 'Whoa, chill out!' if you yell at him. # He answers 'Calm down, I know what I'm doing!' if you yell a question at him. # He says 'Fine. B...
34861b8aabeff269f16e6bc857fb02089c2e3d15
Eminayas/Exposicion
/investigacion.py
1,899
3.9375
4
from menuss import Menu from basicoo import Basico import os opcion = "" while opcion != "5": men= Menu("Menu Principal",["1) Calculadora","2) Numeros","3) Listas","4) Operaciones de cadenas","5) Salir"]) opcion = men.menu() os.system ("cls") if opcion == "2": opci1= "" ...
e69607c0379cbfc7e0cb763112574cc874eab4fe
5kip/Pynt
/file.py
588
4
4
import sort class Student: def __init__(self, name, klas, average_grade): self.name = name self.klas = klas self.average_grade = average_grade vosmoy_v = [ Student("Feodosiy", "2", 3.8), Student("Feodosia", "2", 1.2), Student("Vova", "4", 4.3) , Student("Peta", "8", 12 )...
4c9521d0cb6ead133bdfc54156376e91edcf3311
gigamosh57/CU_NuMeth_Fall2014
/140903_Class.py
8,716
3.84375
4
################################################ ###### Begin Hari Code ################################################ %example1- a script file to solve a system of linear equations %a script file is a collection of MATLAB commands organized in %a sequence. %Note: using ; at the end of a MATLAB command supresses dis...
e466ad5a5845ca20776a77b0d01b1ad1491dc819
EBPapaOurs/Python
/005 - Smallest multiple.py
234
4.0625
4
number = 0 result = 1 while result != 0: number += 5 result = 0 for i in range(1,20): result += (number % i) print("Smallest positive number that is evenly divisible by all of the numbers from 1 to 20 is", number)
bf08612dbddf6a3aea1988f01b7fd3fdacb71eb9
unbrokenguy/sys-arch-server
/src/server/utils.py
730
3.65625
4
class SingletonMeta(type): """ Metaclass realization of SingleTon. Attributes: _instances: A dict where class name is key and instance is value. """ _instances = {} def __call__(cls, *args, **kwargs): """ When class was called "class()", checking if instance of class ex...
dd0caec22ed6dbb887bb84508f37ff025b31c334
gundamace17/LeetCode
/Python/0394. Decode String.py
955
3.6875
4
# -*- coding: utf-8 -*- """ Created on Wed Sep 2 19:04:09 2020 @author: gunda """ class Solution: def decodeString(self, s: str) -> str: self.i = 0 def helper(): multi = 0 sub = [] while self.i < len(s): char = s[self.i] ...
995cd7a4bedf73c1b7cb3fbbe0e15919a75e118b
atornac/ccsf_pythonforeveryone
/7_2openingfiles.py
1,159
3.609375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Jul 17 13:19:09 2019 @author: acan """ #opening a file and counting lines #\n...the newline character ends every line fhand = open("mbox.txt") count = 0 for line in fhand: count +=1 print("Line Count:", count) #opening a file and reading the conte...
48c6d284141918d3397e9da2fdb42fcbc6b78458
theYBFL/20.21.10.1
/10a-for-range2.py
158
3.6875
4
#Girilen on sayının ortalamasını ekranda gösteren topla=0 for y in range(1,11,1): sayi=int(input("bir sayı giriniz ")) topla+=sayi print(topla/10)
0ccaea8697cf5727cf37a6e21eb4557a5093469c
theYBFL/20.21.10.1
/10a-if4.py
162
3.703125
4
ort=55; #0-100 if ort<50: #ort>=50 print("1") elif ort<60: print("2") elif ort<70: print("3") elif ort<85: print("4") else: print("5") print("aaa")
4fc87702333ad51044f029956971628ce4a25113
Solrak97/CI-0146
/Regular Expressions/6-h.py
846
3.703125
4
#Pase demasiado tiempo en darme cuenta que solo queria el tag name, sin necesidad de saber si era apertura o cierre import re str="""<div class="tut-list tut-list-new tut-row "> <div class="tut-list-primary"> <div class="tut-vote"> <video>intro</video> <span class="count">50</span> <span class="tut-upvotes-text hi...
10d20d2efdb8ac5d297858f3889393aea92e9745
thedphster90/project3
/venv/problem7.py
4,301
3.578125
4
import os # A RouteTrie will store our routes and their associated handlers class RouteTrie: def __init__(self): # Initialize the trie with an root node and a handler, this is the root path or home page node self.root = RouteTrieNode() def insert(self, pathlist, handler_input): curren...
60d79abee8b61ed889424675b9f2b784e8de5808
siddharthtelang/RRT-Holonomic-Robots
/Obstacle.py
2,251
3.796875
4
class Obstacle: def __init__(self, clearance): self.x = 10 self.y = 10 self.clearance = clearance self.robot_radius = 0.354 / 2 self.clearance = self.robot_radius + self.clearance self.dynamic_Obstacle = False # self.rect1_corner1_x = 3 # self.rect1...
7abc01af74ad3e8ccad0cf8f10eebd021b2881c3
david220wang385/ATBSWP
/fantasy_game_inventory.py
345
4.0625
4
# Displays contents of an "inventory," where keys are items and values are the item's quantity def displayInventory(inventory): print("Inventory:") totalItems = 0 for item, quantity in inventory.items(): print(str(quantity) + "\t" + item) totalItems += quantity print("Total number of ite...
784a183b735d012ea88fe244a9935e7d0ede9ee5
nzevgolisda/geometry.py
/vectorBased/Circle.py
732
3.515625
4
import math from Vector import Vector class Circle: def __init__(self, center, r, theta): self.center = center self.r = r self.theta = theta self.n = len(self.center.list) def param(self): # vector-like object v = Vector([0, 0]) x = self.r*math.cos(self.theta) ...
85e039400ac89a02c4d33e3b60f08415ae14bbfe
jasongros619/Project-Euler
/31 - 40/Euler 039 Integer right triangles.py
799
3.59375
4
""" If p is the perimeter of a right angle triangle with integral length sides, {a,b,c}, there are exactly three solutions for p = 120, {20,48,52}, {24,45,51}, {30,40,50}. For which value of p ≤ 1000, is the number of solutions maximised? """ import math side1_start = int(1000 //(math.sqrt(2) + 2)) def issqr(x): ...
b7a974e119a8a69ed6e18d8762d4dff0639dc97d
jasongros619/Project-Euler
/41 - 50/Euler 044 Pentagon numbers.py
1,090
3.9375
4
""" Pentagonal numbers are generated by the formula, P_n=n(3n−1)/2. The first ten pentagonal numbers are: 1, 5, 12, 22, 35, 51, 70, 92, 117, 145, ... It can be seen that P4 + P7 = 22 + 70 = 92 = P8. However, their difference, 70 − 22 = 48, is not pentagonal. Find the pair of pentagonal numbers, Pj and Pk, for which t...
037f01834c77bf85150cd5a924f939f25042bfc0
jasongros619/Project-Euler
/31 - 40/Euler 036 Double-base palindromes.py
403
3.5
4
""" Summery: What is the sum of all numbers < 1 million that are palindromic in base 10 and 2? """ import time start = time.clock() def ispal(n): ncopy=str(n)[::-1] return str(n)==ncopy ans = 0 for i in range(1,10**6): #check if palindrome in base 10 if ispal(i): #check if palindrome in base 2 ...
5b0621bbed6a82430816ccb29e18508da7186cf1
jasongros619/Project-Euler
/71 - 80/Euler 077 Prime summations.py
1,007
3.703125
4
""" It is possible to write ten as the sum of primes in exactly five different ways: 7 + 3 5 + 5 5 + 3 + 2 3 + 3 + 2 + 2 2 + 2 + 2 + 2 + 2 What is the first value which can be written as the sum of primes in over five thousand different ways? """ """ Math: Let W(n,c) be the number of ways to make n with primes of va...
38aff9e10dc3bfdced6e0a507a5ab5625bfa4446
jasongros619/Project-Euler
/11 - 20/Euler 015 Lattice paths.py
522
3.5625
4
""" https://projecteuler.net/problem=15 Starting in the top left corner of a 2×2 grid, and only being able to move to the right and down, there are exactly 6 routes to the bottom right corner. (Six diagrams shown) How many such routes are there through a 20×20 grid? """ #The point (x,y) has (x+y)! // (x! * y!) ways...
643eb1c88ad9eeb5f7c4a14391b00fc9557206fb
jasongros619/Project-Euler
/31 - 40/Euler 038 Pandigital primes.py
1,199
4.03125
4
""" Summary: Take a number, say 192. If you multiply it by each 1, 2, 3 and concatenate the results, you get 192384576 which contains the digits 1 through 9 exactly once. What is the largest result possible when concatenating products of a number with (1,2,...n) where n > 1 ? """ """ Note that when n = a number, som...
7ec23130d658fad561b31ea9e02887fd6c10dedb
jasongros619/Project-Euler
/71 - 80/Euler 079 Passcode derivation.py
1,940
4.0625
4
""" A common security method used for online banking is to ask the user for three random characters from a passcode. For example, if the passcode was 531278, they may ask for the 2nd, 3rd, and 5th characters; the expected reply would be: 317. The text file, keylog.txt, contains fifty successful login attempts. Given ...
81a5d0c252d9e217da0714939cbc1a0adb4cff99
jasongros619/Project-Euler
/81 - 90/Euler 087 Prime power triplets.py
1,331
3.515625
4
""" The smallest number expressible as the sum of a prime square, prime cube, and prime fourth power is 28. In fact, there are exactly four numbers below fifty that can be expressed in such a way: 28 = 2^2 + 2^3 + 2^4 33 = 3^2 + 2^3 + 2^4 49 = 5^2 + 2^3 + 2^4 47 = 2^2 + 3^3 + 2^4 How many numbers below fifty million ...
6fa2c12df4d1776bb09ea2d76532ae025cf0482b
jasongros619/Project-Euler
/21 - 30/Euler_024 Lexicographic permutations.py
994
3.921875
4
""" A permutation is an ordered arrangement of objects. For example, 3124 is one possible permutation of the digits 1, 2, 3 and 4. If all of the permutations are listed numerically or alphabetically, we call it lexicographic order. The lexicographic permutations of 0, 1 and 2 are: 012 021 102 120 201 210 Wh...
62d86cfdaf6b2c3313e4595e02a382b107e3a272
jasongros619/Project-Euler
/Over 100/Euler 102.py
1,982
3.96875
4
""" Three distinct points are plotted at random on a Cartesian plane, for which -1000 ≤ x, y ≤ 1000, such that a triangle is formed. Consider the following two triangles: A(-340,495), B(-153,-910), C(835,-947) X(-175,41), Y(-421,-714), Z(574,-645) It can be verified that triangle ABC contains the origin, whereas tr...
f6e2ec582d524b2f3cb9fd18b56e97023e23a43e
lizakalatanova/Practic
/1.py
201
3.984375
4
a = input("Введите строку: ") b = input("Введите число: ") def strt(a,b): if (len(a)>int(b)): d = True else: d = False return d print(strt(a,b))
77e973baa87d0c6e53dda194e49c79945f734a61
Oyelowo/Exercise-2
/average_temps.py
1,161
4.5
4
# -*- coding: utf-8 -*- """ Prints information about monthly average temperatures recorded at the Helsinki Malmi airport. Created on Thu Sep 14 21:37:28 2017 @author: oyedayo oyelowo """ #Create a script called average_temps.py that allows users to select a #month and have the monthly average temperatu...
d2c18db8cac22fbdb7a20d54d2732446059899a0
DenisPerez/Algoritmos
/Week 2/LCMs.py
227
3.5
4
#4 def GCD(a,b): if b == 0: return a a_prime = a%b return GCD(b, a_prime) def LCMs(a,b): return int((a*b) / GCD(a,b)) if __name__ == '__main__': a,b = map(int, input().split()) print(LCMs(a,b))
09261bea2ab0d83c303067a29a2ab7b268b4e48a
poitrek/Project-Euler-Problems
/52_permuted_multiples.py
2,254
3.671875
4
# Problem no. 52: Permuted multiples ###### SOLVED ###### """ Remark no. 1: The number 2x should be in range 1.0 ... 3.33(3) x 10^n for some n. Otherwise 2x and 6x will have different number of digits. Hence 0.5 <= x <= 1.66(6) Remark no. 2: x must be divisible by 3. Otherwise 2x and 3x have different sums of digits m...
271615ba67e7e198865692e58038b9414c887713
poitrek/Project-Euler-Problems
/36_double_base_palindromes.py
426
3.859375
4
# Problem no. 36: Double-base palindromes """ Note 1: check only odd integers. Even numbers in binary system end with '0', and always start with '1'. """ def palindrome(sr): return sr == sr[::-1] if __name__ == '__main__': s = 0 iter_stop = 10**6 for i in range(1, 10**6, 2): if palindrome(s...
3c87772079b1cce9e94dbd3ed71dcfd1b544c698
devhiteshk/PySpecialisationCoursera
/Learning.py
289
3.90625
4
def computepay(h, r): if h>=40: total = ((h-40)*1.5*r)+(40*r) return total elif h<40: total = h*r return total hrs = input("Enter Hours: ") H=float(hrs) rate = input("Enter rate: ") R=float(rate) p = computepay(H, R) print("Pay", p) s
d7d45f7afce250747c59a7b75a2ddcb4d96205b2
aidardarmesh/py-essentials
/week4/magic_methods_test.py
218
3.5
4
from magic_methods import File first = File('first') first.write('first\n') second = File('second') second.write('second\n') third = first + second lines = [] for line in third: lines.append(line) print(lines)
b38e6a8723c8eb21783ff578c2f7a595f946c914
SSungCh/Study
/startcamp/day4 190711/dict01.py
525
3.8125
4
""" Python dictionary 연습 문제 """ # 1. 평균을 구하시오. score = { '수학': 80, '국어': 90, '음악': 100 } # 아래에 코드를 작성해 주세요. print('==== Q1 ====') # 1. 기본 풀이 result = 0 count = 0 for score_value in score.values(): # result = result + score_value # count = count + 1 result += score_value count += 1 # print...
4d8b5eb39acde063de2b1d871c9b1fcdd6c3473b
Asaad404py/2D-Box-packing-in-circle
/Box Packing in Circle.py
3,736
3.6875
4
from math import sqrt, pi import pygame import sys import tkinter as tk from tkinter import messagebox class Point: def __init__(self, x, y): self.x = x self.y = y def dist(self, other): return sqrt((self.x - other.x) ** 2 + (self.y - other.y) ** 2) def valid_point...
53e08fc1fc00630ced820533fad31a40df099c02
damilo/project.ds
/project.ds.ud617/l6-project/02_reducer.py
1,108
3.578125
4
""" task: Find the monetary value for the highest individual sale for each separate store. -> instance with highest cost by store key: store value: cost """ """ [i] data comes in sorted """ #!/usr/bin/python import sys oldKey = None highestSales = 0.0 for line in sys.stdin: data = line.strip ().split ('\...
c9241d6cd66eb6dd7736794b25d46b4d4c57149a
nicholasjb89/Checkers-Server
/Server/Game/PlayerMove.py
2,141
3.890625
4
class Move(object): def __init__(self,starting,ending,player): """ :param starting: Space Object :param ending: Space Object :param player: Player Object """ self.starting = starting self.ending = ending self.player = player self.checker = s...
def4ef01d77a0c8efca7c6c18406b23af05a768f
qiyuan723/weekend3
/day4/readCsv.py
686
3.8125
4
#1.要读CSV文件,首先要准备一个CSV文件 #2.导入CSV的包 #csv是python语言内置的包,说明比selenium常用。开发和测试都常用。 import csv #要想读取csv文件,需要知道其路径 #字符串前加r说明该字符串中没有转义字符。说明反斜杠是普通字符,不看做转义字符。 path = r"C:\Users\51Testing\PycharmProjects\weekend3\data\member_info.csv" #要想读内容,需要通过路径打开文件。file就是文件的内容 file = open(path,"r") #4.通过csv代码库,读取csv格式的内容 data_table = csv.rea...
029d671c76c908a1c8bc06767c7f868b8d04322a
JosephThomasPlappallil/Pentagon
/input.py
74
3.84375
4
a=int(input("enter a number ") if a > 0 : print("positive number")
cc1fdd0a07c688ee2bf9c5449765ed328f4455e4
udbhavsaxena/pythoncode
/ex1/ex3.py
420
4.1875
4
print "I will now count my chickens:" print "Hens", 25+30/6 print "Roosters", 100-25 * 3%4 print "Now I will count my eggs:" print 3+2+1-5+4%2-1/10 print "Is it true that 3+2<5-7?" print 3+2<5-7 print "What's 3+2?", 3+2 print "What's 5-7?", 5-7 print "Oh that is why it is false" print "How about some more" pri...
cffef38bd45c1c368579772b3697a3fea61af1d5
ran-bi/Machine-Learning-for-Public-Policy
/PA3/summary.py
3,362
3.6875
4
### ML pipeline 1/3: Read and explore ### Name: Ran Bi import pandas as pd import numpy as np import csv import matplotlib.pyplot as plt import re # Please create a folder named 'output' to save files and graphs. def read_data(filename, index=None): ''' Read data into Pandas dataframe. Only support csv file for ...
8bd5c57d544b0bda353e7abe99e7dc64a606ab8f
shenmishajing/python
/week2/7-8.py
105
3.8125
4
x = int(input()) if x <= 15: print("%.2f" % (4 * x / 3)) else: print("%.2f" % (2.5 * x - 17.5))
13825df2cbf7b011b7c1174cf6d775340e96c36d
shenmishajing/python
/week2/7-3.py
166
4.03125
4
x = float(input()) if x < 0: print("Invalid Value!") elif x <= 50: print("cost = %.2f" % (0.53 * x)) else: print("cost = %.2f" % (0.58 * x - 0.05 * 50))
c10b9d85c1d774903685907e8f26154ef03882a9
shenmishajing/python
/week15/8-1.py
1,000
3.75
4
class Stock: def __init__(self, symbol, name, preClosingPrice, curPrice): self.__symbol = symbol self.__name = name self.__preClosingPrice = preClosingPrice self.__curPrice = curPrice def get_symbol(self): return self.__symbol def get_name(self): return self...
1dc2242bcfbfab4b3b725cb497ba4114c5cc6616
pfiaux/PythonChallenge
/level6.py
1,108
3.609375
4
# Python Challenge Level 6 # http://www.pythonchallenge.com/pc/def/channel.html # Title: now there are pairs # hint # <-- zip --> import zipfile import re channel = zipfile.ZipFile("level6_data.zip" ,"r") #readme = channel.open("readme.txt","r") #print readme.read() start = "90052" nothing = start count = 0 lis...
35bac0296f570f1288996ed6efce1faeb120a10c
derekb63/ME599
/lab2/estimate_pi.py
883
3.75
4
#! usr/bin/env python # Derek Bean # ME 599 # 1/24/2017 import math import numpy as np # Return the value of the sum for the input value k def sum_term(k): return np.divide((math.factorial(4*k))*(1103+26390*k)*np.power(396, -4*k), np.power(math.factorial(k), 4)) def estimate_pi(): # C...
6a0ddaf8d7fef42fb22e047150e9914dc118efb7
derekb63/ME599
/lab2/sum.py~
683
4.375
4
#! usr/bin/env python # Derek Bean # ME 599 # 1/24/2017 # Find the sum of a list of numbers using a for loop def sum_i(list): list_sum = 0 for i in list: list_sum += i return list_sum # Caclulate the sum of a list of numbers using recursion def sum_r(list): list_sum = 0 return list_sum if __name__ =...
c55dfb4e6512462c5d25aefeb533de1fe4579993
derekb63/ME599
/hw1/integrate.py
2,485
4.3125
4
#! usr/bin/env python # Derek Bean # ME 599 # Homework 1 # 1/24/2017 from types import LambdaType import numpy as np import matplotlib.pyplot as plt ''' Integrate uses the right rectangle rule to determine the definite integral of the input function Inputs: f: a lambda function to be inetgrated a:...
0e63070075f6fb8b84e83551ef2c18b91e25d3a7
derekb63/ME599
/lab3/clt_hist_subplot.py
940
4.0625
4
#!usr/bin/env python # Derek Bean # ME 599 # 1/31/2017 # Show how the central limit theorem works using a histogram. from random import random import matplotlib.pyplot as plt # Calculate the sum of 10 random numbers from 0 to 1 def uniform_sum(): sum = 0 for i in range(10): sum += random() return sum num_sa...
00626def77b6b16415816267bccdf7d65f7cfc70
jxwb108435/matesource
/cs231n/cs231n_list.py
4,511
4.125
4
# coding=utf-8 # -*- coding:cp936 -*- """""" ''' Assignment #1 ''' # 1. understand the basic Image Classification pipeline and the data-driven approach (train/predict stages) # 理解基本的图像分类流程和数据驱动方法(训练/预测 阶段) # 图像分类流程 # 图像分类就是输入一个元素为像素值的数组, 然后给它分配一个分类标签. 完整流程如下: # 输入: 输入是包含N个图像的集合, 每个图像的标签是K种分类标签中的一种. 这个集合称为训练集. # 学习...
f81142234aac2c09ee611cb511258d8200f46915
mengqing25/Python-Co-Ban
/Bai73-CacBaiTapTuRenLuyen/SoAmTrongChuoi.py
489
3.609375
4
def NegativeNumberInStrings(s: str): s = s.strip() l: list = s.split("-") s1: str print("Các số âm trong dãy số là:",end=" ") for s1 in l: strsoam = "-" for i in range(len(s1)): if s1[i].isnumeric(): strsoam += s1[i] else: break...
be7987443e4cfc708b57e15d8b23b7b953efae3c
mengqing25/Python-Co-Ban
/Bai74-HocList/Slicing.py
362
3.5625
4
lst = [0] * 12 item = 0 for i in range(len(lst)): item += 10 lst[i] = item print(lst) print(lst[0:3]) print(lst[1:3]) print(lst[2::]) print(lst[::2]) print(lst[::3]) print(lst[::-1]) print(lst[-1]) print(lst[-len(lst)]) print(lst[-2]) print(lst[3]) for i in range(-1, -len(lst) - 1, -1): print(lst[i], end="\...
29935d664792f33f7732121e96be38f641270741
mengqing25/Python-Co-Ban
/Bai74-HocList/HocKhaiBaoVaSuDung.py
450
3.671875
4
lst: list lst = [] print(type(lst), lst, "Len =", len(lst)) lst = [3, -9, 8, 2, "5"] print(type(lst), lst, "Len =", len(lst)) # Liệt kê các phần tử trong list theo Collection item: str for item in lst: print(type(item), item) print("*" * 20) # Liệt kê các phần tử theo chỉ số Index: for i in range(len(lst)): pri...
0affd2e8c760820b08d602a91831995cab1194f1
mengqing25/Python-Co-Ban
/Bai74-HocList/ListDaChieu.py
805
3.5
4
from random import randrange lst = [[4, 2, 10], [7, 10, 5], [-7, 9, 2]] print(lst) for row in lst: for column in row: print(column, end="\t") print() print("*" * 20) for i in range(len(lst)): row = lst[i] for j in range(len(row)): print(row[j], end="\t") print() print("*" * 20) f...
28b0161649cb7f7c87f919106d229995d6d886af
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-22/pong-v4-l-paddle/main.py
1,741
3.96875
4
#imports from turtle import Screen, Turtle # import time # Create the screen screen = Screen() screen.setup(width=800, height=600) screen.bgcolor("black") screen.title("Pong") # turn the screen off to not see the paddle move from center # to its position on the right at start to game. # when useing screen.tracer will n...
fd4c56fb77d2bca1b5837022acf9da5ab71d5082
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-19/turtle-race-anne-final/main.py
1,318
4.28125
4
from turtle import Turtle, Screen from random import randint is_race_on = False screen = Screen() # set screen size using setup method screen.setup(width=500,height=400) # set the output of the screen.textinput() to user_bet user_bet =screen.textinput(title="Make your bet", prompt="Who do you think will win the race?...
4409d6ef0ae89f509322a9987188386ae484e566
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-25/Day-26-pandas-rows-cols/main.py
1,617
4.21875
4
# # weather_list = open("weather_data.csv", "r") # print(weather_list.readlines()) # # with open("weather_data.csv") as data_file: # data = data_file.readlines() # print(data) # # use pythons csv library https://docs.python.org/3/library/csv.html # import csv # with open("weather_data.csv") as data_file: # ...
5106957eba1a4b4e8d952f50396718d712fe42f4
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-55/higher-lower-v2/main.py
1,385
3.515625
4
from flask import Flask import random random_number = random.randint(0, 9) app = Flask(__name__) @app.route("/") def home_route(): # adding HMGL and CSS to the return return "<h1 style='text-align: center'>Guess a number between 0 and 9</h1>" \ "<img src='https://media.giphy.com/media/3o7aCSPqXE5C...
ebb49e7ace998b22a0c5d71abdd116d0a3463b8d
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-24/Day-24-file-write-with/main.py
709
4.1875
4
# # file= open("my_file.txt") # # contents =file.read() # print(contents) # #also need to close the file # file.close() ####### another way to open a file that dosent require an explice file.close, does it for you #this is read only mode - mode defaluts to "r with open("my_file.txt")as file: contents = file.read()...
2d5e3945cfda2fde7cd6262669e85917ddc17a8e
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-22/pong-v2-create-screen/main.py
456
3.640625
4
#imports from turtle import Screen # import time # Create the screen screen = Screen() screen.setup(width=800, height=600) screen.bgcolor("black") screen.title("Pong") screen.tracer(0) # TODO Create and move paddle # TODO Create another paddle # TODO Create the ball and move it # TODO detect collision with the wall a...
50d2dacc5c130c18056dac7182fdc1474011867a
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-55/parsing-url-converter/main.py
656
3.765625
4
from flask import Flask app = Flask(__name__) @app.route("/") def hello_world(): return "Hello World" # route decorator or the route to look for when a user goes to a particular path @app.route("/bye") def bye(): return "Bye!" #adding variable to route # use a converter to specify the type of the argument li...
f79bc79ea4993f59665d55a4e3b5671920e575cf
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-21/Class-Inheritance/main.py
814
4.40625
4
class Animal: def __init__(self): #defining attributes self.num_eyes = 2 # defining method associated with the animal class def breathe(self): print("Inhale, exhale.") # passing Animal into Fish class so Fish has all the attributes # and methonds from the Animal class, then can have some...
c32e8e722bd71310b5132cf00baf49d7f2e9dee1
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-19/dat-19-event-listeners-HOCs/main.py
506
4
4
from turtle import Turtle, Screen tim = Turtle() # create screen object screen = Screen() def move_forward(): tim.forward(100) # tell screen to start listening screen.listen() # add the event listener method # screen.onkey() # bind a function that will be triggered when a key is pressed on # keyboard # when the ...
dd53a29c154f618d06def31665acd537200a5e47
AR123456/python-deep-dive
/work-from-100-days/Beginner days 1-14/day-13/day-13-debugging-steps/main.py
1,647
3.984375
4
############DEBUGGING##################### # # Describe Problem - print 20 when i =20 ## def my_function(): # # does not work -for i in range(1,20): # for i in range(1,21): # if i == 20: # print("You got it") # my_function() # # Reproduce the Bug - this sometimes works but not always # #from random i...
a118d3d5596a5a6a433fa033d897a86096de0b50
matt-ankerson/applied_data_science
/linear_regression/diabetes_dataset.py
2,306
3.765625
4
# -*- coding: utf-8 -*- """ Created on Fri Aug 14 09:21:51 2015 @author: matt """ # Linear Regression with one variable. from sklearn import datasets from sklearn import linear_model from sklearn.utils import shuffle import pylab as plt import numpy as np # load the diabetes dataset diabetes = datasets.load_diabetes...
fea9c9a4deb9d09218eb3957ed0a74fe7b760609
DenysZakharovGH/Python-works
/HomeWork4/The_Guessing_Game.py
624
4.15625
4
#The Guessing Game. #Write a program that generates a random number between 1 and 10 and let’s #the user guess what number was generated. The result should be sent back #to the user via a print statement. import random RandomVaried = random.randint(0,10) while True: UserGuess = int(input("try to guess the nu...
47bcd9f7c97992fc73a6c7df2f318f760ed1a67e
DenysZakharovGH/Python-works
/PythonHomework_6_loops.py
943
4.375
4
#1 #Make a program that generates a list that has all squared values of integers #from 1 to 100, i.e., like this: [1, 4, 9, 16, 25, 36, …, 10000] Squaredlist = [x**2 for x in range(100)] print(Squaredlist) #2 #Make a program that prompts the user to input the name of a car, the program #should save the input in a li...
bfcd8487b727f6b5f28b343aa609887233d3a145
sunillshastry/tic-tac-toe
/gtest.py
3,033
4.03125
4
# Tic-Tac-Toe # -- BASIC INFORMATION -- # Author: Sunil Shastry. # Project Started: June 4, 2021. # Guide and Tests file for TicTacToe class functions. from util.TicTacToe import TicTacToe tictactoe = TicTacToe() def print_attributes(): """Print all the attributes used in the TicTacToe class.""" print(tictactoe)...
239617d13060b5f5eca55a9152000061f30b82ab
Bilfrendho/python_tuts
/ifStatements.py
1,338
4
4
##prompt=input ("Kindly enter your favourite football league \n ") ##if prompt.capitalize()=="Epl": ## print("Bull's eye! ") ##print("No worries!") ##We are going to prompt the user to enter a number and check if it is greator than a certain value #deposit=float(input("Please enter the deposit value\n ")) #freeToast...
2213d66214f18d0bf2e78837e6de8b2ed5058a9e
vamshidhar-pandrapagada/Data-Structures-Algorithms
/Array_Left_Rotation.py
1,169
4.3125
4
# -*- coding: utf-8 -*- """ Created on Sun Jun 11 04:32:11 2017 @author: Vamshidhar P """ """A left rotation operation on an array of size shifts each of the array's elements unit to the left. For example, if left rotations are performed on array 1 2 3 4 5, then the array would become 3 4 5 1 2 Given an array of ...
d533d93ced02eb641961555b90435128c9489dae
rohangoli/PythonAdvanced
/Leetcode/LinkedList/p1215.py
1,863
4.1875
4
## Intersection of Two Linked Lists # Example 1: # Input: intersectVal = 8, listA = [4,1,8,4,5], listB = [5,6,1,8,4,5], skipA = 2, skipB = 3 # Output: Intersected at '8' # Explanation: The intersected node's value is 8 (note that this must not be 0 if the two lists intersect). # From the head of A, it reads as [4,1,8,...
1523697b003921dd04b00a9d32ac3de57201a1d3
rohangoli/PythonAdvanced
/Leetcode/LinkedList/p707_v2.py
3,148
3.96875
4
## 707. Design Linked List class Node: def __init__(self, val): self.val = val self.next = None class MyLinkedList: def __init__(self): self.head = None # print('-'*20) def get(self, index: int) -> int: idx=0 curr=self.head while ...
010f18a43932a52eb66c529dd57b85243f369b93
rohangoli/PythonAdvanced
/Leetcode/Arrays/p1164.py
672
4.25
4
## Reverse Words in a string # Example 1: # Input: s = "the sky is blue" # Output: "blue is sky the" # Example 2: # Input: s = " hello world " # Output: "world hello" # Explanation: Your reversed string should not contain leading or trailing spaces. # Example 3: # Input: s = "a good example" # Output: "example g...
b11a66211b0ecd6049cb1e74d3fc836a0c05de61
rohangoli/PythonAdvanced
/Leetcode/Queue & Stack/p1361.py
1,630
3.828125
4
class Solution: def isValid(self, s: str) -> bool: if len(s)<2: return False stack = [] for x in s: if stack and x==')' and stack[-1]=='(': stack.pop() elif stack and x==']' and stack[-1]=='[': stack.pop() ...
3876ba57a07bcfaa37118214db968bfb74c8dc03
rohangoli/PythonAdvanced
/Leetcode/Arrays/p15.py
2,068
3.734375
4
## 15. 3Sum # Example 1: # Input: nums = [-1,0,1,2,-1,-4] # Output: [[-1,-1,2],[-1,0,1]] # Explanation: # nums[0] + nums[1] + nums[2] = (-1) + 0 + 1 = 0. # nums[1] + nums[2] + nums[4] = 0 + 1 + (-1) = 0. # nums[0] + nums[3] + nums[4] = (-1) + 2 + (-1) = 0. # The distinct triplets are [-1,0,1] and [-1,-1,2]. # Notice ...
a9cd65581de1c90800575cdcdc03295205b7c98f
rohangoli/PythonAdvanced
/Leetcode/Arrays/p67.py
1,229
3.734375
4
## Add Binary # Example 1: # Input: a = "11", b = "1" # Output: "100" # Example 2: # Input: a = "1010", b = "1011" # Output: "10101" class Solution: def addBinary(self, a: str, b: str) -> str: M = len(a) N = len(b) O = max(M,N) A = ['0']*(O-M) + [x for x in a] ...
2e9c676087463e022ca79c7044a5ca009b5b1034
rohangoli/PythonAdvanced
/Leetcode/Queue & Stack/p1374.py
3,585
3.65625
4
## Number of Islands - QUEUE Implementation # Example 1: # Input: grid = [ # ["1","1","1","1","0"], # ["1","1","0","1","0"], # ["1","1","0","0","0"], # ["0","0","0","0","0"] # ] # Output: 1 # Example 2: # Input: grid = [ # ["1","1","0","0","0"], # ["1","1","0","0","0"], # ["0","0","1","0","0"], # ["0"...
37b23d90f3278da35cb676f28d27cb7f588952b9
rohangoli/PythonAdvanced
/Leetcode/String/p171.py
788
3.5625
4
## 171. Excel Sheet Column Number # Example 1: # Input: columnTitle = "A" # Output: 1 # Example 2: # Input: columnTitle = "AB" # Output: 28 # Example 3: # Input: columnTitle = "ZY" # Output: 701 class Solution: def titleToNumber(self, columnTitle: str) -> int: mapAlpha = {chr(x):x-64 for x in range(65,9...
17280dfa7edb9ce992daa53cf81ee7ef76d87f64
rohangoli/PythonAdvanced
/Leetcode/Binary Trees/p637.py
1,174
3.78125
4
## 637. Average of levels in Binary Tree # Example 1: # Input: root = [3,9,20,null,null,15,7] # Output: [3.00000,14.50000,11.00000] # Explanation: The average value of nodes on level 0 is 3, on level 1 is 14.5, and on level 2 is 11. # Hence return [3, 14.5, 11]. # Example 2: # Input: root = [3,9,20,15,7] # Output: [3...
ab0df186df85498ebb44c7ce510526a60b1c846a
rohangoli/PythonAdvanced
/Leetcode/Binary Trees/p144.py
1,067
3.734375
4
## 144. Binary Tree Preorder Traversal # Example 1: # Input: root = [1,null,2,3] # Output: [1,2,3] # Example 2: # Input: root = [] # Output: [] # Example 3: # Input: root = [1] # Output: [1] # Definition for a binary tree node. # class TreeNode: # def __init__(self, val=0, left=None, right=None): # self...
0b3c8858cfdfb2300171b44a8d2672a02679c96f
rohangoli/PythonAdvanced
/Leetcode/String/p1221.py
1,808
3.9375
4
## 1221. Split a String in Balanced Strings # Example 1: # Input: s = "RLRRLLRLRL" # Output: 4 # Explanation: s can be split into "RL", "RRLL", "RL", "RL", each substring contains same number of 'L' and 'R'. # Example 2: # Input: s = "RLLLLRRRLR" # Output: 3 # Explanation: s can be split into "RL", "LLLRRR", "LR", ea...