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
81cd4dcee9ef0ceb25c304dbc3f4bd47bec13ffb
DayGitH/Python-Challenges
/DailyProgrammer/DP20150202A.py
5,356
3.71875
4
""" [2015-02-02] Challenge #200 [Easy] Flood-Fill https://www.reddit.com/r/dailyprogrammer/comments/2ug3hx/20150202_challenge_200_easy_floodfill/ # [](#EasyIcon) _(Easy)_: Flood-Fill Flood-fill is a tool used in essentially any image editing program that's worth its salt. It allows you to fill in any contigious regio...
1b32a55dc8a8882f2181e314981c9edb2e42a5f3
DayGitH/Python-Challenges
/DailyProgrammer/DP20170825C.py
1,680
4.0625
4
""" [2017-08-25] Challenge #328 [Hard] Subset Sum Automata https://www.reddit.com/r/dailyprogrammer/comments/6vyihu/20170825_challenge_328_hard_subset_sum_automata/ # Description Earlier this year we did the [subset sum](https://www.reddit.com/r/dailyprogrammer/comments/68oda5/20170501_challenge_313_easy_subset_sum/)...
db322807d137276219ecaab479af539fe4088cb5
DayGitH/Python-Challenges
/DailyProgrammer/DP20170619A.py
1,147
4.125
4
""" [2017-06-19] Challenge #320 [Easy] Spiral Ascension https://www.reddit.com/r/dailyprogrammer/comments/6i60lr/20170619_challenge_320_easy_spiral_ascension/ # Description The user enters a number. Make a spiral that begins with 1 and starts from the top left, going towards the right, and ends with the square of tha...
843cf451a8db485aae96a11dd02ecadb8e890d25
DayGitH/Python-Challenges
/DailyProgrammer/DP20150102.py
1,602
3.8125
4
""" [2015-01-02] Challenge #195 [All] 2015 Prep Work https://www.reddit.com/r/dailyprogrammer/comments/2r4wal/20150102_challenge_195_all_2015_prep_work/ #Description: As we enter a new year it is a good time to get organized and be ready. One thing I have noticed as you use this subreddit and finish challenges you re...
35ca56b2002c47e738ea6efedc666552b9243b45
DayGitH/Python-Challenges
/DailyProgrammer/DP20140430.py
3,670
3.671875
4
""" [4/30/2014] Challenge #160 Intermediate Part 2 - Damage Control https://www.reddit.com/r/dailyprogrammer/comments/24da3f/4302014_challenge_160_intermediate_part_2_damage/ [Part 1](http://www.reddit.com/r/dailyprogrammer/comments/236va2/4162014_challenge_158_intermediate_part_1_the/) #Introduction The new building...
8ae8f2db0a591eb3bec68a906a1881bb40b979ff
DayGitH/Python-Challenges
/DailyProgrammer/DP20140827W.py
1,143
3.96875
4
""" [Weekly #8] Sorting algorithms https://www.reddit.com/r/dailyprogrammer/comments/2emixb/weekly_8_sorting_algorithms/ #Weekly Topic: Often times we need to sort the data. A basic foundation in learning programming is to understand how to do this sort on the data and why to do it. Monday we saw a challenge based on...
9cc6c399c85bf0eeb6757e4420468d5f6ff6224e
DayGitH/Python-Challenges
/DailyProgrammer/DP20140813B.py
1,330
4.03125
4
""" [8/13/2014] Challenge #175 [Intermediate] Largest Word from Characters https://www.reddit.com/r/dailyprogrammer/comments/2dgd5v/8132014_challenge_175_intermediate_largest_word/ #Description: Given a string of words and a string of letters. Find the largest string(s) that are in the 1st string of words that can be...
dea6624c859356ed196474cbb7f746f5d5b44dd8
DayGitH/Python-Challenges
/DailyProgrammer/DP20120808C.py
1,199
4.1875
4
""" [8/8/2012] Challenge #86 [difficult] (2-SAT) https://www.reddit.com/r/dailyprogrammer/comments/xx970/882012_challenge_86_difficult_2sat/ Boolean Satisfiability problems are problems where we wish to find solutions to boolean equations such as (x_1 or not x_3) and (x_2 or x_3) and (x_1 or not x_2) = true Thes...
51e69b647068cc60de578216e630fc6d6fffe082
DayGitH/Python-Challenges
/DailyProgrammer/DP20151230B.py
5,275
3.5
4
""" [2015-12-30] Challenge #247 [Intermediate] Moving (diagonally) Up in Life https://www.reddit.com/r/dailyprogrammer/comments/3ysdm2/20151230_challenge_247_intermediate_moving/ # [](#IntermediateIcon) _(Intermediate)_: Moving (diagonally) Up in Life Imagine you live on a grid of characters, like the one below. For ...
35a0fdd29e629a3e4bd1e795d6a7de6805243aaa
DayGitH/Python-Challenges
/DailyProgrammer/20120219A.py
491
4.4375
4
''' The program should take three arguments. The first will be a day, the second will be month, and the third will be year. Then, your program should compute the day of the week that date will fall on. ''' import datetime day_list = {0: 'Monday', 1: 'Tuesday', 2: 'Wednesday', 3: 'Thursday', 4: 'Friday', 5: 'Saturday'...
9d583bc0464ebcbf6876a0bc5ca748e05a4e8cd0
DayGitH/Python-Challenges
/DailyProgrammer/DP20140924B.py
5,112
4.09375
4
""" [09/24/2014] Challenge #181 [Intermediate] Average Speed Cameras https://www.reddit.com/r/dailyprogrammer/comments/2hcwzn/09242014_challenge_181_intermediate_average_speed/ # [](#IntermediateIcon) _(Intermediate)_: Average Speed Cameras In the UK, a common safety measure on motorways is the so-called [average spe...
bad24f313366dde14556e9d6f89bdacc4fb2eb7b
DayGitH/Python-Challenges
/DailyProgrammer/DP20121018A.py
976
3.984375
4
""" [10/18/2012] Challenge #104 [Easy] (Powerplant Simulation) https://www.reddit.com/r/dailyprogrammer/comments/11paok/10182012_challenge_104_easy_powerplant_simulation/ **Description:** A powerplant for the city of Redmond goes offline every third day because of local demands. Ontop of this, the powerplant has to g...
7a7ca97a97c90480d88a0a2d1355b07744842b21
DayGitH/Python-Challenges
/DailyProgrammer/DP20131104A.py
4,226
3.984375
4
""" [11/4/13] Challenge #140 [Easy] Variable Notation https://www.reddit.com/r/dailyprogrammer/comments/1q6pq5/11413_challenge_140_easy_variable_notation/ # [](#EasyIcon) *(Easy)*: Variable Notation When writing code, it can be helpful to have a standard ([Identifier naming convention](http://en.wikipedia.org/wiki/Id...
f4e0f4775698853e23a8cd47e80778a3eb34e6a3
lingwei-gu/globalEngineeringYouthSummitWorkshop
/webscrapingWithImage.py
741
3.578125
4
from bs4 import BeautifulSoup import urllib.request import requests from PIL import Image link = "https://www.reddit.com/" def webscraper(): opensite = urllib.request.urlopen(link) site_content = opensite.read() soup = BeautifulSoup(site_content, "lxml") soup.prettify() posts = soup.select('div#si...
e7a6fc9dc8fcc6d0b9e05a8a1f04bfccf023fba0
gregglind/Tic-Tac-Toe
/invincitron.py
8,029
3.765625
4
#!/usr/bin/env python ''' INVINCITRON, an opponent that can win *all games* with 100% certainty [1] Note [1]: current implementation only plays tic-tac-toe, future versions will expand on this. LICENSE: BSD, with attribution AUTHOR: Gregg Lind <gregg.lind@gmail.com> ''' ''' Intructions: 1. Fork this repo on git...
df6df81fd9a4d8f2e5346e593f14a33b1585e8de
renito09/Computer-Science
/operators.py
487
3.78125
4
import time secret_message = float (input("Enter a 2 factor number between 0 - 1 (0 or 1 doesnt count): ")) if (secret_message == 0.1) or (secret_message == 0.2) or (secret_message == 0.3) or (secret_message == 0.4) or (secret_message == 0.5) or (secret_message == 0.6) or (secret_message == 0.7) or (secret_message == 0...
5bbddcc5b486e2aa4ad57bf681afa1934f1fc485
donoghuc/code_example_2
/socket_class.py
4,063
4.03125
4
#! /usr/bin/python3 # Cas Donoghue # CS372 # Project 2 # # This is a class for sockets. It is used for the server and client side. # i got the idea from: https://docs.python.org/3/howto/sockets.html # basically just followed the docs. import socket import sys class MySocket: """class for message app. "...
a01c987f9fe31b9a56f46657ca51612cee5e0d5b
andreigabor21/Python-Games
/OrderAndChaos/Domains.py
3,018
3.515625
4
from texttable import Texttable import unittest import random class Board: def __init__(self): self.board = [[" " for j in range(6)] for i in range(6)] def __str__(self): t = Texttable() t.add_rows(self.board, []) return t.draw() def ReadFromFile(self, file_name): ...
d62891c71fa12b75124713cc57f6da21b2f0c950
RVPH/import_scripts
/textprocessing_module.py
5,263
3.515625
4
# Text processing functions for # Russkiy Vrach Publishing House article database import re # Individual functions to process text def remove_linebreaks(value: str) -> str: """Remove linebreaks (\n) """ regexp = re.compile(r'\n') return regexp.sub(' ', value) def remove_wordwraps(value: str) -> str: ...
639fa03d236ec2f8f9a26f1aa53af7c0d9b4e85a
JaiRaga/FreeCodeCamp-Data-Structures-and-Algorithms-in-Python
/Basic_Algorithm_Scripting/ReverseAString.py
237
4
4
def reverseString(s): newStr = '' for i in s: newStr = i + newStr return newStr print(reverseString("hello")) print(reverseString("Howdy")) print(reverseString("Greetings from Earth")) print(reverseString("12345"))
00901a71600d77818e99872915fb77eb17e1692e
JaiRaga/FreeCodeCamp-Data-Structures-and-Algorithms-in-Python
/Basic_Algorithm_Scripting/SliceAndSplice.py
302
3.609375
4
def frankenSplice(lis1, lis2, n): lis = lis2[:] for i in lis1: lis.insert(n, i) n += 1 return lis print(frankenSplice([1, 2, 3], [4, 5, 6], 1)) print(frankenSplice([1, 2], ["a", "b"], 1)) print(frankenSplice(["claw", "tentacle"], ["head", "shoulders", "knees", "toes"], 2))
ea8e85c489477c5736dbbaa83c565228543da9e4
seesiva/ML
/lpthw/newnumerals.py
1,169
4.65625
5
""" Your Informatics teacher at school likes coming up with new ways to help you understand the material. When you started studying numeral systems, he introduced his own numeral system, which he's convinced will help clarify things. His numeral system has base 26, and its digits are represented by English capital le...
5514cb1b4588c60ba18477693747381d99b2073f
seesiva/ML
/lpthw/ex20.py
777
4.28125
4
""" Given a string, , of length that is indexed from to , print its even-indexed and odd-indexed characters as space-separated strings on a single line (see the Sample below for more detail). Note: is considered to be an even index. """ import sys if __name__=="__main__": string_list=[] T=int(raw_input()) ...
5d99fca1cf48a39fce34f6246bf4f02155ba8f07
seesiva/ML
/lpthw/sortbyheight.py
238
4.03125
4
def sortByHeight(a): l = sorted([i for i in a if i > 0]) print l for n,i in enumerate(a): if i == -1: l.insert(n,i) return l if __name__=="__main__": print sortByHeight([-1,-1,3,4,10,2,-1,200,4,2])
9958b0569eea52042d347d1e977137d3fff8ffc8
seesiva/ML
/lpthw/euclids.py
357
4.125
4
""" Compute the greatest common divisor of two non-negative integers p and q as follows: If q is 0, the answer is p. If not, divide p by q and take the remainder r. The answer is the greatest common divisor of q and r. """ def gcd(p,q): if q==0: return p else: r=p % q return r if __na...
848503c9b6118fa2cd2cdbd860b7aba687f63a9b
seesiva/ML
/lpthw/ex11.py
342
4.09375
4
""" Write a program which can compute the factorial of a given numbers. The results should be printed in a comma-separated sequence on a single line. Suppose the following input is supplied to the program: 8 Then, the output should be: 40320 """ def fact(x): if x==1: return 1 else: return x*fac...
953469d38c6689be6f48986e855b6b3c6881aa56
seesiva/ML
/lpthw/ex9.py
698
4.21875
4
""" Higher Order Functions HoF:Function as a return value """ def add_two_nums(x,y): return x+y def add_three_nums(x,y,z): return x+y+z def get_appropriate_function(num_len): if num_len==3: return add_three_nums else: return add_two_nums if __name__=="__main__": args = [1,2,3] ...
3c3707fbc7f5f4329dd090ede98ab6dabf987639
TatianaKudryavtseva/python_algoritm
/lesson 3_3.py
554
3.9375
4
# В массиве случайных целых чисел поменять местами минимальный и максимальный элементы. import random SIZE = 30 MIN_ITEM = 1 MAX_ITEM = 100 array = [random.randint(MIN_ITEM, MAX_ITEM) for _ in range(SIZE)] print(array) index_max, index_min = 0, 0 for i in range(1, len(array)): if array[i] > array[index_max]: ...
61cc20f572aecf4040eb9be3896af7daf5ad2d73
TatianaKudryavtseva/python_algoritm
/lesson 1_3.py
556
4.09375
4
# По введенным пользователем координатам двух точек # вывести уравнение прямой вида y = kx + b, проходящей через эти точки. print('Введите координаты первой точки') x_1 = float(input()) y_1 = float(input()) print('Введите координаты второй точки') x_2 = float(input()) y_2 = float(input()) k = (y_1 - y_2) / (x_1 - x_2)...
db8b5a361d085137634b19777ef97db2ab4db46d
TatianaKudryavtseva/python_algoritm
/lesson 3_2.py
735
4.15625
4
# Во втором массиве сохранить индексы четных элементов первого массива. # Например, если дан массив со значениями 8, 3, 15, 6, 4, 2, # второй массив надо заполнить значениями 0, 3, 4, 5, # (индексация начинается с нуля), т.к. именно в этих позициях первого массива стоят четные числа. import random SIZE = 10 MIN_ITEM ...
04e6d1bbb4806b7372a3884fea13ab2be88f63d2
TatianaKudryavtseva/python_algoritm
/lesson 2_4_1.py
431
3.796875
4
# Найти сумму n элементов следующего ряда чисел: 1 -0.5 0.25 -0.125 ... # Количество элементов (n) вводится с клавиатуры n = int(input('Введите количество элементов ')) element = 1 sum_element = 0 for i in range(n): sum_element += element element /= -2 i += 1 print(f'Сумма элементов = {sum_element}')
e030b7a81514bf60108c9dea4532f16edae4087b
dohun6643/practicepython
/Funtion_tuple.py
347
3.609375
4
# def function_name([formal_args,]*var_args_tuple): # function_suite # return [expression] def print_return_tuple(arg1,*vartuple): print("inside arg1 is :" , arg1) for var in vartuple: print("inside vartuple is : ", var) return vartuple print_return_tuple(10) out_tuple = print_return_tuple...
344308fa5e539364f66195e44a4f1bc0515e5309
saileshnankani/Python-Game
/saileshNankani_JoeLin_Game.py
12,242
3.890625
4
# Filename: saileshNankani_JoeLinGame.py # Author: Sailesh Nankani and Joe Lin # Date: January 20th, 2015 # Description: This program runs a game called Dash Square where the user controls the square. The objective of the game is to dodge as many as # triangles as possible. The user gets a score for dodging each triang...
1fc3cf2c40325016868eb3b0bae7ef912d4dae9e
musyahid/pythonUnitTest
/src/convert.py
878
3.5
4
def Convert(i): angka = ['','satu','dua','tiga','empat','lima','enam','tujuh','delapan','sembilan','sepuluh','sebelas'] i = int(i) result = '' if i >= 0 and i <=11: result += f'{angka[i]}' elif i<20: result += f'{Convert(i % 10)} belas' elif i <100: result += f'{Convert(i...
ebb9c446e97928e82fbd09e394b7b6d30680e5dd
Benjaminyuan/LeetCode
/python/gennerateParentheses.py
1,168
3.515625
4
class Solution: def generateParenthesis(self, n): """ :type n: int :rtype: List[str] """ #这样会漏情况,if 后面的情况并不是基础情况 def recorsiveFun(n): if n == 1: return ["()"] else: rlist = [] print("递归"+str(n)) ...
e5a9ae0fecb0e9b9878a2e9a702150e7afe0264f
Benjaminyuan/LeetCode
/python/findSubString.py
1,319
3.5
4
class Solution: def findSubstring(self, s, words): """ :type s: str :type words: List[str] :rtype: List[int] """ slen = len(s) wordsLen = len(words) possLoc = [] if slen and wordsLen: possiList=set() wordLen = len(words[...
47a6e7a126dfc1accb2bcdd8f120fc7be23acf0b
Custom-Tech-Enterprize/sportProgrammingSubmissionsOfmoghya
/cforce/785/A/25503070.py
218
3.796875
4
data = { 'Tetrahedron':4, 'Cube':6, 'Octahedron':8, 'Dodecahedron':12, 'Icosahedron':20 } n = int(input()) ans = 0 for _ in range(0,n): s = input() ans = ans + data[s] print(ans)
6a1a8294519a15c52d511a7f5b95b2329b76d57a
dnoneill/IS289
/web_hw#1.py
2,104
4.03125
4
'''base class and sub class, understand inheritance and unit tests that test methods. travis to github, create repo. send link to repo.''' import unittest class AudioVisual(): def __init__(self, title, mediatype, genre): self.title = title self.mediatype = mediatype self.genre = genre def report(self): ret...
af93b3f45475abfc980bd53f5af21f5d4ad7c98b
cnovoab/coding-interview
/udemy-11/2.array_common_elements.py
534
3.890625
4
#!/bin/python def common_items(alist, blist): common = [] n = 0 m = 0 while(n < len(alist) and m < len(blist)): if alist[n] == blist[m]: common.append(alist[n]) m += 1 n += 1 elif alist[n] > blist[m]: m += 1 else: n += ...
e5585a7907884e4fc26f55245f3d317d96cc364f
cnovoab/coding-interview
/udemy-11/7.minesweeper_expand.py
643
3.734375
4
#!/bin/python def click(board, rows, cols, click_x, click_y): board = [[0 for col in range(cols)] for row in range(rows)] for bomb in bombs: (x, y) = bomb print "({}, {})".format(x, y) board[x][y] = -1 for i in range(x -1, x + 2): for j in range(y - 1, y + 2): ...
3181d2f1bbd8f21aafc45e9419d43f8d01491126
cnovoab/coding-interview
/udemy-11/8.rotate_array_aux.py
606
4.03125
4
#!/bin/python def rotate_array(a, n): a2 = [[None for i in range(n)] for i in range(n)] for i in range(n): for j in range(n): i2 = j j2 = n - i - 1 a2[i2][j2] = a[i][j] return a2 if __name__ == "__main__": test = [[1, 2, 3, 4, 5], [6, 7, 8, 9, 10...
9d962bf277fd03145643a05bee7804563309e38b
kd5278fi/UnitTst
/Calculate.py
404
3.96875
4
def is_tens(number): """ Return true if the number is a multiple of 10 """ if number % 10 != 0: #print ("False") return False #print ("True") return True def next_tens(number): """ Finds the next highest number by ten """ index = number while True: ...
ca138f087a7cdadb84ea054df8fff44596fc265d
AdishiSood/The-Joy-of-Computing-using-Python
/Week 4/Factorial.py
285
4.28125
4
""" Given an integer number n, you have to print the factorial of this number. Input Format: A number n. Output Format: Print the factorial of n. Example: Input: 4 Output: 24 """ k = int(input()) fac = 1 for i in range(1,k+1): if(k==0): break fac=fac*i print(fac)
76651f9226b584f4a7a0dfe0f1ceeb338ba0e2ae
AdishiSood/The-Joy-of-Computing-using-Python
/Week 12/Sentence.py
807
4.21875
4
""" Write a program that accepts sequence of lines as input and prints the lines after making all characters in the sentence capitalised. Input Format: The first line of the input contains a number n which represents the number of line. From second line there are statements which has to be converted. Each statement co...
82401ab5f1d228c0312819a08859994363fdce4f
AdishiSood/The-Joy-of-Computing-using-Python
/Week 9/First and Last.py
470
4.21875
4
""" Write a Python program to get a string made of the first 2 and the last 2 chars from a given a string. If the string length is less than 2, return instead of the empty string. Input Format: The first line of the input contains the String S. Output Format: The first line of the output contains the modified string....
8eb64625c46daa0a9254448f38a67a9a83088d07
Luv8436/Programming
/python codes/rename_file.py
498
3.625
4
import os #taking file names and saves into the list def rename_files(): file_list=os.listdir(r"C:\Users\luvku\CS 2019\prank\prank") #print(file_list) saved_path=os.getcwd() print("Current working directory is =" +saved_path) os.chdir(r"C:\Users\luvku\CS 2019\prank\prank") #rename file in the di...
da01edc64d3846f6611f60e533704cad8c871441
Panchofdez/Minigames
/Pong/Pong.py
2,388
3.671875
4
import turtle wn = turtle.Screen() wn.title("Pong") wn.bgcolor("black") wn.setup(width=800, height=600) wn.tracer(0) #Score player_a_score= 0 player_b_score = 0 #Paddle A paddle_a = turtle.Turtle() paddle_a.speed(0) #speed of animation, sets to max speed paddle_a.shape("square") paddle_a.penup() paddle_a.color("w...
628cf91b1d6030837b5b4f89aeb06b01f9842fde
SachinDevelopment/AQclone
/Player.py
2,949
3.609375
4
import sys import pygame from time import sleep #Sample class for sample.py class Player(object): def __init__(self): self.image = pygame.image.load("Images\Artixv2.png") self.x = 10 self.y = 390 self.isJumping = 0 self.velocity = 8 self.mass = 2 self.health ...
8ae1fdd34726473c458e248c6cddadbfce0cf585
biiakovnv/amis_python
/km73/Biiakov _Nikita/3/Task_3.py
67
3.53125
4
print("What is your name?") name=(input()) print("Hello,",name)
30308952b2c2948f42492e1b7389081dad07c29f
nobleator/ims-microservices
/optimizer/cvrp.py
15,627
3.59375
4
""" Route optimizer Capacitated Vehicle Routing Problem Route Scheduling Model/Module Branch and bound for integer optimization Sub-problems solved using scipy: https://docs.scipy.org/doc/scipy/reference/generated/scipy.optimize.linprog.html """ import numpy as np from scipy.optimize import linprog import random as ...
c61b0532d7fe7e3ae92bc25a41e9e1ff10cee46b
lplade/lmn
/eventful_data/read_json_file.py
2,476
3.625
4
import json class Venues(): ''' Gets the venues information, from the name to the location or urls''' def __init__(self, venue_id, venue_name, city_name, state, venue_address, venue_url, performer_name = None): self.venue_id = venue_id self.venue_name = venue_name self.city_name = cit...
96e6ba6a7d2fadfa50c06881f4c30514b1644678
perchrib/masters_thesis
/preprocessors/language_detection.py
986
3.53125
4
import langdetect as ld ENGLISH = 'en' SPANISH = 'es' GERMAN = 'de' DUTCH = 'nl' def detect_language(text, language=SPANISH, ret_conf=False): """ Uses langdetect to detect a language in text. Spanish by default :param text: text to analyze :param language: language to detect :param ret_conf: retur...
eaa288238495b0d4ae55f33571876dcd2c9f774e
don1291/Python
/km.py
179
4.1875
4
def main(): km = float(input("Enter the distances in km: ")) miles = convert(km) print(miles) def convert(km): miles = km * 0.6214 return miles main()
a4049d840d56402f7482d1ccb64a2f7d35b1b3a6
don1291/Python
/Land.py
158
3.8125
4
#Land Calculation #Program calculate square feet to arce sqft = input("Enter the square feet tract in land:") land_size = int(sqft) / 43560 print (land_size)
65ea608d7f8a1b8f1b5054c9a98b51cd93738d97
CShariff4/Programming-308
/Acutal Programs/war2.py
2,591
3.515625
4
import random from random import shuffle #deck attributes SUITS = ['H', 'D', 'S', 'C'] FACES = ['2', '3', '4', '5', '6', '7', '8', '9', '10', 'J', 'Q', 'K', 'A'] DECK = [f + s for f in FACES for s in SUITS] VALUE = dict((DECK[i], (i + 3) // 4) for i in range(len(DECK))) class WarCardGame: ## start card game War ...
b3bdc75c4be056248adef5615f3a484624775404
nayudujahnavi/guvi23
/four.py
101
3.953125
4
ch=input('') if((ch >='a' and ch<='z') or (ch >='a' and ch<='z')): print(alphabet) else: print("no")
047178a4533d3b9a24cb3b6ed24910cca6b308ed
nayudujahnavi/guvi23
/21.py
150
3.640625
4
def sumofAP(a,d,n) sum=0 i=0 while i<n: sum =sum+a a=a+d i=i+1 return sum n=int(input(" ")) a=int(input(" ")) d=int(input(" ")) print(sumOFAP(a,d,n))
16db59ddfa2af4ad84aa8efeec3199aedf0cbba0
JoyceWill/LearnPython
/coxu/Task15.py
389
3.625
4
from itertools import groupby lines = ''' This is the first paragraph. This is the second. '''.splitlines() #splitlines break line into list of string # accourding to the /n line breaker #Use intertools.groupby and bool to treturn group of #condecutive lines that either have content or don't. for has_chars, frags in...
9ed78163f19835094bc94281b4dbc37e6c015c5c
imapersonman/henri-variables
/henri_2_9_21.py
2,263
3.8125
4
from Question import Question from Expression import Int, Plus, Equals, Var, Minus def check_sub_q(a): return a.interpret() == True questions = [ Question("If a = 1, what is another way of writing 'b'?", lambda a: a == Var("b")), Question("If x = 3, what is another way of writing 'x + y?'", lambda a: a ==...
7f65cc8534cac8140b20dd82ec74c292af35084d
imapersonman/henri-variables
/henri_3_18_21.py
1,874
4.09375
4
from Question import Question from Expression import Int, Plus, Equals, Var, Minus, Times, Negative documentation = [ "expr.to_pos_neg(): If expr looks like 'a - b', it is converted to 'a + -b'", "expr.pos_neg_to_minus(): If expr looks like 'a + -b', it is converted to 'a - b'", "expr.associate_l_to_r(): I...
723a42eb6e074fe0aa54a77a9532334c8afb95dd
rohanaggarwal7997/Studies
/Python/loop.py
699
3.875
4
import random import sys import os ''' for x in range(0,10): #end at 9 print(x,' ',end="") lis=['a','b','c','d'] for y in lis: #browse through entire list print (y) num_list=[[1,2,3],[10,20,30],[4,5,6]] #create list of lists for x in range(0,3): for y in num_list[x]:#do same indentation at each place print...
39adbf633463303ae3395d0f67a349497f293c68
rohanaggarwal7997/Studies
/Python new/finding most frequent words in a list.py
337
4.125
4
from collections import Counter text=''' dfkjskjefisej tjeistj isejt isejt iseotjeis tiset iesjt iejtes est isjti esties hesiuhea iurhaur aurhuawh ruahwruawhra u njra awurhwauirh uawirhuwar huawrh uawrhuaw ajiawj eiwhaeiaowhe awhewai hiawe ''' words=text.split() counter=Counter(words) print(counter.most_common(3)) ...
e916cfd5c36631ca073f6261eca2d863c858124f
rohanaggarwal7997/Studies
/Python new/if for range while and comments Break and Continue.py
621
3.90625
4
name='rohan aggarwal' if name is 'rohan': print('You are great') elif name is 'rohan aggarwal': print('You are also great') else: print('You might be great') numb=[1,2,3,4,5] for f in numb[:2]: print(f) print('\n') #:2 is very important #range --very important for x in range(5,12): #means ...
39d722a3749955b2946925e869613350400c2fa0
thebrutus314/Alarm-clock
/alarm_clock.py
3,243
3.625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- from time import strftime from time import sleep import os print("Alarm clock") print("Codet by @thebrutus314") try: # Tkinter for Python 2.xx import Tkinter as tk except ImportError: # Tkinter for Python 3.xx import tkinter as tk APP_TITLE = "Alarm clo...
9af31f0b9f40d78ee48de71218a11b98e6d4450a
2Gdivirasalsabiil/algpython-
/Ceknilaimahasiswa5d.py
393
3.671875
4
#7. D. Penilaian mahasiswa mendapatkan huruf x #@author: Divira Salsabiil Susanto - 20083000178 - 2G print('===================') print('PENILAIAN NILAI MAHASISWA') print('===================') x = input (">> Masukkan nilai = ") #cek nilai mahasiswa if int(x)>=91: sts="A" elif int(x)>=81: sts="B" ...
4c984a05dabfef887ae4b827de02545b74299a6a
Wolfhan99/LeetCode-Javascript-Solution
/leetcode/116.填充每个节点的下一个右侧节点指针.py
2,364
3.515625
4
# # @lc app=leetcode.cn id=116 lang=python3 # # [116] 填充每个节点的下一个右侧节点指针 # # https://leetcode-cn.com/problems/populating-next-right-pointers-in-each-node/description/ # # algorithms # Medium (70.11%) # Likes: 529 # Dislikes: 0 # Total Accepted: 146.9K # Total Submissions: 209.2K # Testcase Example: '[...
176a210da966c2548f576443d74aed98c87db607
Wolfhan99/LeetCode-Javascript-Solution
/leetcode/447.回旋镖的数量.py
1,873
3.59375
4
# @before-stub-for-debug-begin from python3problem447 import * from typing import * # @before-stub-for-debug-end # # @lc app=leetcode.cn id=447 lang=python3 # # [447] 回旋镖的数量 # # https://leetcode-cn.com/problems/number-of-boomerangs/description/ # # algorithms # Medium (60.42%) # Likes: 166 # Dislikes...
e308c99dab47e48ccee9042abf7d51030db58b89
Wolfhan99/LeetCode-Javascript-Solution
/leetcode/92.反转链表-ii.py
2,198
3.953125
4
# # @lc app=leetcode.cn id=92 lang=python3 # # [92] 反转链表 II # # https://leetcode-cn.com/problems/reverse-linked-list-ii/description/ # # algorithms # Medium (54.60%) # Likes: 989 # Dislikes: 0 # Total Accepted: 196.7K # Total Submissions: 359.9K # Testcase Example: '[1,2,3,4,5]\n2\n4' # # 给你单链表的头指...
473bbd84ec28a21dad96c8207709f5981b2edb16
Wolfhan99/LeetCode-Javascript-Solution
/常考代码/sort-python/merge.py
1,006
3.796875
4
# def merge(left, right): # l, r= 0, 0 # res = [] # while l < len(left) and r < len(right): # if left[l] < right[r]: # res.append(left[l]) # l+=1 # else: # res.append(right[r]) # r+=1 # res.append(left[l:]) # res.append(right...
c4e082d8c4f62c428d77a8f667f8f619acfd8c32
Wolfhan99/LeetCode-Javascript-Solution
/leetcode/70.爬楼梯.py
1,090
3.515625
4
# # @lc app=leetcode.cn id=70 lang=python3 # # [70] 爬楼梯 # # https://leetcode-cn.com/problems/climbing-stairs/description/ # # algorithms # Easy (52.59%) # Likes: 1813 # Dislikes: 0 # Total Accepted: 533.2K # Total Submissions: 1M # Testcase Example: '2' # # 假设你正在爬楼梯。需要 n 阶你才能到达楼顶。 # # 每次你可以爬 1 ...
a4975ee06f14f6a973cf076d2c8cf7cd38a10540
Wolfhan99/LeetCode-Javascript-Solution
/leetcode/1.两数之和.py
1,769
3.65625
4
# # @lc app=leetcode.cn id=1 lang=python3 # # [1] 两数之和 # # https://leetcode-cn.com/problems/two-sum/description/ # # algorithms # Easy (51.75%) # Likes: 11862 # Dislikes: 0 # Total Accepted: 2.4M # Total Submissions: 4.6M # Testcase Example: '[2,7,11,15]\n9' # # 给定一个整数数组 nums 和一个整数目标值 target,请你在该数...
0909853dc00f03e259e991a4c6ea4fa6cae6db06
raianyrufino/URI-OnlineJudge
/1043.py
199
3.5625
4
A, B, C = map(float,raw_input().split()) if (A+B > C) and (B+C > A) and (C+A >B): perimetro = A+B+C print("Perimetro: %.1f" %(perimetro)) else: area = (A+B)*C/2 print("Area: %.1f" %(area))
2de9ef41e6bef06e07a7b20f5271e261213124a8
raianyrufino/URI-OnlineJudge
/1164.py
248
3.546875
4
n = int(raw_input()) soma = 0 for i in range(1,n+1): x = int(raw_input()) soma = 0 for j in range(1, x): if x % j == 0: soma += j if soma == x: print "%d eh perfeito" %(x) else: print "%d nao eh perfeito" %(x)
d65f2347f9e73a045e5b05728c497f91b3bfb714
raianyrufino/URI-OnlineJudge
/1066.py
385
3.53125
4
contpar = 0 contim = 0 contpos = 0 contneg = 0 for i in range(5): i = int(raw_input()) if i % 2 == 0: contpar += 1 else: contim += 1 if i > 0: contpos += 1 elif i < 0: contneg += 1 print "%d valor(es) par(es)" %(contpar) print "%d valor(es) impar(es)" %(contim) print "%d valor(es) posi...
9511bbb743d46583c05723c663929e940d8614ec
raianyrufino/URI-OnlineJudge
/1180.py
284
3.578125
4
n = int(raw_input()) vetor = [] pos = 0 vetor = map(int,raw_input().split()) for i in range(len(vetor)): if i == 0: menor = vetor[i] pos = i else: if vetor[i] < menor: menor=vetor[i] pos=i print "Menor valor:", menor print "Posicao: %i" %(pos)
22c87e695fe8c460a0ca95b13d7e9afb80a89314
amutava/Machine_learning_algorithmns
/decision_tree.py
596
3.703125
4
# Import Library # Import other necessary libraries like pandas, numpy... from sklearn import tree # Assumed you have, X (predictor) and Y (target) for training data set and x_test(predictor) of test_dataset # Create tree object # for classification, here you can change the algorithm as gini or entropy (information gai...
e588bbb9899fa27aa4ee92fc9825a38ee626259e
kildarejoe1/CourseWork_Lotery_App
/app.py
1,859
4.15625
4
#Udemy Course Work - Lottery App #Import the random class import random def menu(): """Controlling method that 1. Ask players for numbers 2. Calculate the lottery numbers 3. Print out the winnings """ players_numbers = get_players_numbers() lottery_numbers = create_lottery_numbers() if...
5d462e58a2b3cbfcbb59f6128a2c3724ea0f407c
fabricio24530/ListaPythonBrasil
/EstruturaDeRepeticao08.py
332
3.96875
4
'''Faça um programa que leia 5 números e informe a soma e a média dos números.''' lista = list() for i in range(5): num = float(input(f'Informe o {i + 1}º numero: ')) lista.append(num) soma = sum(lista) media = soma / len(lista) print(f'''A soma dos valores é: {soma} A media entre os valores é: {media:.2f}'...
9688e61269b53f9ac4de4d9652f1f42f22a2242b
fabricio24530/ListaPythonBrasil
/EstruturaDeRepeticao22.py
669
4.09375
4
'''Altere o programa de cálculo dos números primos, informando, caso o número não seja primo, por quais número ele é divisível.''' number = int(input('Enter a integer number: ')) list_ = list() divisible_list = list() not_divisible_list = list() cont_np = 0 cont_yp = 0 for i in range(number): list_.append(i) for...
d35658055b36c894a01b375bb333ae11236ffbfa
fabricio24530/ListaPythonBrasil
/EstruturaDeDecisao08.py
411
4.1875
4
'''Faça um programa que pergunte o preço de três produtos e informe qual produto você deve comprar, sabendo que a decisão é sempre pelo mais barato.''' lista = list() for i in range(3): produto = float(input(f'Informe o preço do {i + 1}º produto: ')) lista.append(produto) menor = min(lista) posicao = lista.i...
4b4295d6a734eec6c5b8d4467c9036dc04ade8a4
fabricio24530/ListaPythonBrasil
/EstruturaSequencial03.py
216
3.890625
4
'''Faça um Programa que peça dois números e imprima a soma.''' n1, n2 = int(input('Informe o primeiro numero: ), int(input('informe o segundo numero: ')) soma = n1 + n2 print(f'A soma de {n1} e {n2} é {soma}')
97c75844f36a3ad08ef63b982cee4d7a41f431de
fabricio24530/ListaPythonBrasil
/EstruturaDeRepeticao27.py
512
3.921875
4
'''Faça um programa que calcule o número médio de alunos por turma. Para isto, peça a quantidade de turmas e a quantidade de alunos para cada turma. As turmas não podem ter mais de 40 alunos.''' qtd_turmar = int(input('Informe a quantidade de turmas: ')) lista = list() for i in range(qtd_turmar): qtd_alunos = int...
8d4ede1972573ed6ea89c68ec89ee4ec7e928f55
fabricio24530/ListaPythonBrasil
/EstruturaSequencial09.py
306
4.1875
4
'''Faça um Programa que peça a temperatura em graus Farenheit, transforme e mostre a temperatura em graus Celsius. C = (5 * (F-32) / 9).''' temp_f = float(input('Informe a temperatura em graus Farenheit: ')) temp_c = (5 * (temp_f-32) / 9) print(f'A temperatura {temp_f}°F equivale a {temp_c:.2f}°C')
6f96e9df955a926865d9dcdbc2e4231762536507
fabricio24530/ListaPythonBrasil
/EstruturaDeRepeticao07.py
234
4.3125
4
'''Faça um programa que leia 5 números e informe o maior número.''' lista = list() for i in range(5): num = float(input(f'Informe o {i+1}º numero: ')) lista.append(num) print(f'O maior valor digitado foi: {max(lista)}')
3c28e8d63db49785131ea8cf92bf16b751a078b4
fabricio24530/ListaPythonBrasil
/EstruturaDeRepeticao35.py
600
3.9375
4
'''Encontrar números primos é uma tarefa difícil. Faça um programa que gera uma lista dos números primos existentes entre 1 e um número inteiro informado pelo usuário.''' num = int(input('Informe um numero: ')) lista = [] lista2 = [] for i in range(num, 0, -1): for j in range(num, 0, -1): if i % j == 0: ...
c767b4be16594d0381b03df7a0d6499b8d970825
fabricio24530/ListaPythonBrasil
/EstruturaDeRepeticao26.py
770
3.9375
4
''' Numa eleição existem três candidatos. Faça um programa que peça o número total de eleitores. Peça para cada eleitor votar e ao final mostrar o número de votos de cada candidato. ''' eleitores = int(input('Total de eleitores: ')) votos1, votos2, votos3 = 0, 0, 0 for i in range(eleitores): candidato = input('I...
ffef4b470cfb1aea38fde6d66b22d1f2c3fc70b7
Rasadell09/LeetCode
/intersection_of_two_arrays.py
530
3.984375
4
class Solution(object): def intersection(self, nums1, nums2): """ :type nums1: List[int] :type nums2: List[int] :rtype: List[int] """ res = [] if nums1 == [] or nums2 == []: return [] for x in nums1: if x in nums2: ...
564f481e560af6591880e93f0da1e6d61e9abf37
Rasadell09/LeetCode
/maximum_depth_of_binary_tree.py
995
3.765625
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 maxDepth(self, root): """ :type root: TreeNode :rtype: int """ if root is None: ...
cae5015830450552672f8abcfb4f0c96d855d15d
Rasadell09/LeetCode
/relative_ranks.py
696
3.578125
4
class Solution(object): def findRelativeRanks(self, nums): """ :type nums: List[int] :rtype: List[str] """ t = [] for e in nums: t.append(e) t.sort() t.reverse() res = [] for e in nums: if t.index(e) >= 3: ...
8466213692c72aa5f721c08853eb41a5bbca6a98
ozgurkaracam/instapy
/test.py
532
3.53125
4
class Test: def __init__(self): self.a = ["a", "b"] self.b = ["a","c"] print(self.Diff(self.a,self.b)) def Diff(self,li1, li2): li_dif = [i for i in li1 + li2 if i not in li1 or i not in li2] return li_dif if __name__ == '__main__': # f=open('notfollo...
89bcba596bf9a599b8d1c5a916f46d224c7db11d
Rosebotics/PythonGameDesign2019
/camp/Nidha/Day 1 - The Game Loop, Colors, Drawing and Animation/06-InteractingWithAPlayer.py
1,153
3.609375
4
# My first Pygame program. # Authors: Many people and Nidha Rajoli import pygame import sys import time backgroundColor = (100, 34, 188) white = (255, 255, 0) circlelocation = (300, 150) circleRadius = 180 rectX = 96 rectY = 196 rectWidth = 176 rectHeight = 186 pygame.display.set_mode((640, 480)) pygame.init() scre...
48a513a18aad8577cfb5bb634bdb0e6705a2b764
Rosebotics/PythonGameDesign2019
/camp/Marika/Day 1 - The Game Loop, Colors, Drawing and Animation/06-InteractingWithAPlayer.py
1,112
3.515625
4
# My first Pygame program. # Authors: Many people and Marika import pygame import sys from pygame.locals import * screenSize = (640, 480) backgroundColor = (0, 0, 0) circleColor = (140, 100, 255) rectColor1 = (255, 100, 120) rectColor2 = (100, 120, 255) circleRadius = 20 rectY1 = 100 rectY2 = 100 rectSpeed = 5 pyga...
8711ed470f9f0a02ff337099e757a761b4de096b
Rosebotics/PythonGameDesign2019
/camp/Aidan/Day 1 - The Game Loop, Colors, Drawing and Animation/04-Drawing.py
639
3.5625
4
# My first Pygame program. # Authors: Many people and Aidan import pygame import sys backgroundColor = (50, 60, 123.456789) white = (255, 255, 255) circleLocation = (300, 150) circleRaidous = 200 circleLocation = (300, 150) circleRaidous = 35 red = (255, 255, 255) pygame.init() screen = pygame.display.set_mode((640...
546d41138df9078ee41dcae8da40bb79c798c200
agarithm/2019_AOC
/04.py
1,763
3.5625
4
passwords = 0; for pwd in range(359282,820402,1): repeats = False; sequential = False; pwd = f"{pwd}" if "00" in pwd: repeats = True; elif "11" in pwd: repeats = True; elif "22" in pwd: repeats = True; elif "33" in pwd: repeats = True; elif "44" in pwd: ...
30c6005ca4fd8c122c8e5cf14e09734b59d2347c
allentv/DataScienceMachineLearning
/DataMunging/DataMunging.py
4,607
3.84375
4
""" Created for Dublin Data Science Beginners Meetup session on 11-Aug-2015 This is an example to showcase the results of Data Munging in Python with Pandas using wxPython GUI toolkit. The results are shown in a Grid for easy visualization of data. @author: Allen Thomas Varghese @email: allentv4u@gmail.com """ import...
fd1d5b77f2f3a1095340a82f2af4fcf685934a33
widnerlr/isat252
/lab6.py
1,076
3.640625
4
""" lab 6 5/27 """ #3.1 #for num in range(6): # if num != 3: # print(num) #3.2 #result_32 = 1 #for num in range(1,6): # result_32= result_32 * num #print(result_32) #3.3 #result_33 = 0 # num in range(1,6): # result_33=result_33 + num #print(result_33) #3.4 #result_34 = 1 #for n...
1e6686d27e2f119426aa0cf1271151d2594fa2b0
xxxfly/PythonStudy
/ProjectBaseTest1/python核心编程/07-正则表达式/03-re模块的高级用法.py
989
3.578125
4
# coding=utf-8 import re # search方法 def test1(): """ re.search() 匹配第一个结束 """ print(re.search(r'python','<html><h1>python</h1></html>')) print(re.search(r'python','<html><h1>python</h1><h2>python</h2></html>').group()) print(re.search(r'python','<html><h1>python</h1></html>').group()) def...
30b8c8d8977ed91502d51f36c4d6695a9c3cb961
xxxfly/PythonStudy
/ProjectBaseTest1/Python基础/名片管理系统-文件版.py
3,819
3.59375
4
#-*- coding: utf-8 -*- #定义全局变量 数组用来存储名片信息 card_infos=[] #新增一个名片 def add_new_card_info(): '''完成新增一个名片''' new_name=input("请输入新的名字:") new_qq=input("请输入新的QQ:") new_weixin=input("请输入新的微信:") new_addr=input("请输入新的住址:") #定义一个字典,用来存储一个新的名片 new_info={} new_info['name']=new_name new_info['q...
fe5f6811834273336c8afe8c526cc9d5973d659e
xxxfly/PythonStudy
/ProjectBaseTest1/算法与数据结构/03-排序/02-选择排序.py
604
3.84375
4
#coding:utf-8 def selectSort(orgList): """选择排序""" # for i in range(0,len(orgList)): # for j in range(i+1,len(orgList)): # if orgList[i]>orgList[j]: # orgList[i],orgList[j]=orgList[j],orgList[i] n=len(orgList) for j in range(0,n-1): # j:0~n-2 min_index=j ...
5b6b1da23f3ce3c77688148546276ca171cb0300
xxxfly/PythonStudy
/ProjectBaseTest1/python核心编程/02-高级3-元类/02-元类.py
769
4.34375
4
#-*- coding:utf-8 -*- #元类 # # --类也是对象,就是一组用来描述如何生成一个对象的代码段 # class Person(object): # num=0 # print('--person--test--') #会直接被执行,说明此时python解释器已经创建了这个类 # def __init__(self): # self.name='a' # print(100) # print('hello') # print(Person) # class Person(): # pass # p1=Person() # print(type(p1)) ...