blob_id stringlengths 40 40 | repo_name stringlengths 5 119 | path stringlengths 2 424 | length_bytes int64 36 888k | score float64 3.5 5.22 | int_score int64 4 5 | text stringlengths 27 888k |
|---|---|---|---|---|---|---|
f5525de60ee896adde7ce25763cdef9cad71efe1 | haihala/FSM | /backend/UI.py | 963 | 3.578125 | 4 | """
UI is a parent class to UIs that cli uses.
"""
from abc import abstractmethod
from .action_tree import ActionTree
class UI():
"""
Parent for cli and possible later graphical UI.
"""
def __init__(self, *args):
self.running = True
self.args = args
@abstractmethod
def tick(sel... |
fff9ffb1bddd3c768f9d64a19a0cf92f433f11f5 | Md-Monirul-Islam/Python-code | /Python-book-OOP/Method overloading-bangla bool-2.py | 227 | 3.8125 | 4 | class My_num:
def __init__(self,value):
self.__value = value
def __int__(self):
return self.__value
def __add__(self, other):
return self.__value+int(other)*int(other)
a=2
b=3
c=a+b
print(c) |
fe42375fa9fcaeec7e8a2172f84685ca69bdf88b | deekshithanand/PythonExcercises | /pg6.py | 469 | 4.03125 | 4 | '''
Question:
Write a program that accepts a sentence and calculate the number of letters and digits.
Suppose the following input is supplied to the program:
hello world! 123
Then, the output should be:
LETTERS 10
DIGITS 3
'''
ip=input()
lcount=dcount=0
for i in ip.split():
for j in i:
if j.isdigit():
... |
1b0524cb770c5cc380bd0534fa10edbd62d0ea74 | dr-dos-ok/Code_Jam_Webscraper | /solutions_python/Problem_53/516.py | 621 | 3.640625 | 4 | #!/usr/bin/python
n = 2
k = 3
def solve(n, k):
"""docstring for solve"""
on = (2 ** n) - 1
nk = k % (2 ** n)
if nk == on:
return "ON"
else:
return "OFF"
def main():
"""docstring for main"""
input = open("problem")
ilines = [l.strip() for l in input.readlines()]
... |
bb2dda37d10cb92e1458a3e83dba7b4282b6eb8b | tthompson-thb/ssw567-HW-01 | /classifyTrianglewithUnittest.py | 1,418 | 4.25 | 4 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Tonya Thompson - SSW567-NBA
Assignment - HW 01: Testing triangle classification 02/12/21:
Attemp at unit testing
"""
import unittest
try:
def classify_triangle(side1, side2, side3):
if side1 == side2 == side3:
#print("\nEquilateral Triangle... |
22dbe7082f001979122470792716b40aabd2f9dc | MartinPons/BookingAnalysis | /rearrangements.py | 2,816 | 3.65625 | 4 | import pandas as pd
from BookingData import Booking
def get_stay_df(df, group_vars = None, status = None):
"""Transforms a DataFrame with booking information to a stay date
DataFrame. Each row has to include infthe basic info for it to be
converted in a Booking object
Args:
df (Data... |
d053662c9a5f3c9e2db3390b057ca57fa3883fd4 | basakrajarshi/LC | /Top Int Ques/020_valid_parentheses.py | 1,337 | 3.859375 | 4 | class Solution(object):
def isValid(self, s):
"""
:type s: str
:rtype: bool
"""
if s == "":
return True
# -------------
# USING A STACK
# -------------
open_brackets = ["[", "{", "("]
close_brackets = ["]",... |
a5bd31f6fa37b0eb3b8ed67180f11cd3d908da23 | sean578/advent_of_code | /2019/day_6_part_2.py | 1,990 | 4.0625 | 4 | def get_pairs_into_dict(debug=False, debug_array = None):
orbit_dict = {}
if debug:
for line in debug_array:
a, b = line.split(')')
if b not in orbit_dict.keys():
orbit_dict[b] = a
else:
print('Duplicate orbit found')
else:
... |
3d8096c4129e3aaa4df6624bbacc83ec92cc74f7 | ktp-forked-repos/py-algorithms | /py_algorithms/data_structures/__init__.py | 3,556 | 3.59375 | 4 | __all__ = [
'new_deque',
'Deque',
'new_queue',
'Queue',
'new_stack',
'Stack',
'new_heap',
'Heap',
'new_max_heap',
'new_min_heap',
'new_priority_queue',
'PriorityQueue',
'new_suffix_array',
'new_tree_node',
'TreeNode',
]
from typing import Any
from typing impo... |
f503a76cf01ef51bc080e7b543fc1ed792585945 | yongseongCho/python_201911 | /day_10/class_10.py | 2,234 | 3.5625 | 4 | # -*- coding: utf-8 -*-
class Animal :
def __init__(self, name, age, color) :
self.name = name
self.age = age
self.color = color
def showInfo(self) :
print(f'name : {self.name}')
print(f'age : {self.age}')
print(f'color : {self.color}')
# ์์ฑ์ ์ฌ์ ์... |
d7d3cd44bfe75129f2b58a153087016a0faedc53 | youjin9209/2016_embeded_raspberry-pi | /pythonBasic/break_letter.py | 158 | 4.125 | 4 | break_letter = input("break letter: ")
for letter in "python":
if letter == break_letter:
break
print(letter)
else:
print("all letter print completed")
|
c357db2ed020c6ccc8a56f4fa258d3cff1020062 | hyosung11/PycharmProjects | /modules/randomgame.py | 635 | 3.96875 | 4 | from random import randint
import sys
# generate a number between 1~10
answer = randint(int(sys.argv[1]), int(sys.argv[2]))
while True:
try:
# input from user?
guess = int(input('Guess a number from 1 ~ 10 '))
# check that input is a number 1~10
if guess > 0 < 11:
# ch... |
95e3e3f022c9202b5fae722d3a1c8075093e2284 | tpusmb/lei-ihm_video_mapping | /datas/models/Player.py | 1,397 | 3.953125 | 4 | class Player:
"""
Player Model, which represents the user of our system
Example:
>>> p = Player()
>>> assert p.name == "LEI"
>>> assert p.level == 0
>>> assert p.xp == 0
>>> assert p.total_xp_needed_for_next_level() == 30
XP is retained through level up
>>> p.xp += 50
>>> a... |
ccc1d2915391662c013013b2b5ef92296c54b235 | here0009/LeetCode | /Python/1653_MinimumDeletionstoMakeStringBalanced.py | 2,075 | 3.984375 | 4 | """
You are given a string s consisting only of characters 'a' and 'b'โโโโ.
You can delete any number of characters in s to make s balanced. s is balanced if there is no pair of indices (i,j) such that i < j and s[i] = 'b' and s[j]= 'a'.
Return the minimum number of deletions needed to make s balanced.
Example 1:... |
b2c6835595f629bba3d6f59879d00c8948006522 | tvarol/leetcode_solutions | /sortColors/sortColors.py | 1,332 | 4.03125 | 4 | #Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are adjacent, with the colors in the order red, white and blue.
#Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively.
#Note: You are not suppose to use the libr... |
41927b68035e1582b7ab573feae937be9b34b6bb | jmelton15/Python-Console-BlackJack | /BlackJackMain.py | 6,089 | 3.59375 | 4 | import random
import blackjackMoney
import CardDeck
import colorama
from colorama import Fore, Back, Style
ready = ''
playing = True
def hit_or_stand():
go = ''
try:
go = input("Would you like to Hit or Stand?")
except:
print("Your response must be h,s,hit, or stand. Please try again!")
... |
986c1086c526df8f0cd5f4921f1091b35c5a4453 | xiaotuzixuedaima/PythonProgramDucat | /PythonPrograms/python_program/perfect_square_and_sum_all_digit_less10.py | 435 | 4 | 4 | #102. Program to Find all Numbers in a Range which are Perfect Squares and Sum of all Digits in the Number is Less than 10
list=[]
n= int(input("enter the lower limit:"))
m= int(input("enter the upper limit:"))
i=1
while i < m+1: # i is greater than upper limit +1 times .
n=i*i # find the perf... |
b35f905625c4d8d91260229269452b5f9ad0d472 | kuige-whu/python- | /python_work/data_structure_and_algorithm/hackerrank/counting_valleys.py | 938 | 3.734375 | 4 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# author : frontier8186 time: 2019/11/5 16:01
import math
import os
import random
import re
import sys
# Complete the countingValleys function below.
def countingValleys(n, s):
s_num = []
for i in range(n):
if s[i:i + 1] == 'U':
if i == 0:
... |
08d3a78f5035b95bb7ea3eddf6dba74f2eb1a588 | zhoushujian001/homework | /pythonไธไบๅฐไปฃ็ /็ๆณ.py | 738 | 3.59375 | 4 | import random
while True:
num = int(input('ๆฌข่ฟๅๅ ๅชๅ๏ผ็ณๅคด๏ผๅธ ็ๆณๆธธๆ\nๆจ็ๅฏนๆๅทฒๅๅค๏ผๅชๅ่พๅ
ฅ1๏ผ็ณๅคด่พๅ
ฅ2๏ผๅธ่พๅ
ฅ3\n่ฏท้ฎๆจ่ฆๅบไปไน๏ผ้ๅบ่ฏท่พๅ
ฅ4๏ผ'))
if num in [1,2,3]:
answer=random.randint(1,3)
if num==answer:
print('ไธค่พน็็ไธๆ ทๅข๏ผ็้ๆพ๏ผๅฏนๆนๅบ็ๆฏ%d'%answer)
elif (num==3 and answer==2) or (num==2 and answer==1) or(num==1 and ans... |
639369aa54266ad1c191c35e82492f6e290053e3 | yunjipark0623/python_2018 | /06/gugudan.py | 329 | 3.96875 | 4 | ## ๋ณ์ ์ ์ธ ๋ถ๋ถ
i, k, guguLine = 0, 0, ""
## ๋ฉ์ธ(main) ์ฝ๋ ๋ถ๋ถ
for i in range(2, 10):
guguLine = guguLine + ("# %d๋จ # " %i)
print(guguLine)
for i in range(1, 10) :
guguLine = ""
for k in range(2, 10) :
guguLine = guguLine + str("%2d X%2d = %2d " % (k, i, k *i))
print(guguLine)
|
8478241f34025631de334b6eb09dc5c494be85e9 | prasadnaidu1/kv-rao | /polimarphism/operator overloding.py | 287 | 3.640625 | 4 | class operator:
def __init__(self,name,pages):
self.name=name
self.pages=pages
def __add__(self,other):
print(self.name+other.name)
print(self.pages+other.pages)
#calling block
o1=operator("python",100)
o2=operator("adv python",20)
print(o1+o2) |
e434fe0be53f62eab4e41078d149a9fdc04845d2 | Hilldrupca/LeetCode | /python/Top Interview Questions - Medium/Array and Strings/longestpalindromesubstring.py | 941 | 3.859375 | 4 |
class Solution:
def longestPalindrome(self, s: str) -> str:
'''
Returns the longest palindrome within a given string. If there exist
two or more palindromes of the same length, whichever comes first
aphabetically will be returned.
Example:
longestPalindr... |
a3274656b13e5e5ff9b9c45d6c44ced0800999d7 | TheDarktor/Ex-Python | /ex021.py | 601 | 4.125 | 4 | # ALGORITIMO QUE RECEBE O NOME DE UMA PESSOA E RETORNA AS SEGUINTES INFORMAรรES:
# Nome com todas as letras maiรบsculas e minรบsculas.
# Quantas letras tem o nome completo (sem considerar os espaรงos)
# Quantas letras tem o primeiro nome.
nome = str(input('Digite seu nome completo: ')).strip()
print('Seu nome em ... |
b448008dcec180654421e24c0134dbee474d5d93 | budavariam/advent_of_code | /2020/21_2/solution.py | 2,262 | 3.65625 | 4 | """ Advent of code 2020 day 21/2 """
import math
from os import path
import re
from collections import defaultdict
class AllergenAssessment(object):
def __init__(self, data):
self.lines, self.allergenes, self.ingredients = data
def solve(self):
mapping = {}
while len(mapping) < len(s... |
5013dd18822f296e1d1da4fb5ff34f463176569b | Vekselsvip/HW-Python | /homework5.8.py | 157 | 3.6875 | 4 | a = [1, 2, 3, 4]
b = [5, 4, 7, 8]
c = [9, 10, 11, 12]
d = [13, 14, 15, 16]
matrix = a, b, c, d
x = 0
for i in matrix:
x += len(i)
print(matrix)
print(x)
|
e0940199096a20d7ace0bc7b4991076de47be294 | MarcelArthur/leetcode_collection | /Greedy/860_Lemonade_Change.py | 507 | 3.6875 | 4 | #!python3
# Best Solution
class Solution:
def lemonadeChange(self, bills: List[int]) -> bool:
# Time O(N) one loop
five = ten = 0
for b in bills:
if b == 5:
five += 1
elif b == 10:
five -= 1
ten += 1
elif te... |
b3af271bb29c33e75332f3ef3c1f735f774ecb7a | prafful/python_feb2020 | /24_inheritance.py | 822 | 3.921875 | 4 | class Employee:
def __init__(self, fname, lname):
print("In Employee Constructor!")
self.fname = fname
self.lname = lname
def getFname(self):
return self.fname
def getLname(self):
return self.lname
def getEmployeeDetails(self):
print("In getEmpl... |
709779669418a19b281a860830d9d87e7db15e8d | syves/algorithms | /recursive_choc.py | 722 | 3.8125 | 4 | # ::num_choc //[int], int=>int
def num_choc(dollars, cost, wrappers_required, wrappers):
if dollars >= cost:
return (1 + num_choc(dollars - cost, cost, wrappers_required, wrappers + 1))
elif wrappers >= wrappers_required:
return 1 + (wrappers - wrappers_required) + num_choc(dollars, cost, wrappe... |
a97c0a7f2c94c8f561d3581d391a7f25ca86e903 | chao-yuan-cy/DataStrucures | /DS3_BaseStructures/lesson3_queue.py | 6,187 | 4.3125 | 4 | '''
้ๅ:ๆฏไธ็ณปๅๆ้กบๅบ็ๅ
็ด ็้ๅ๏ผๆฐๅ
็ด ๅ ๅ
ฅๅจ้ๅ็ไธ็ซฏ๏ผ่ฟไธ็ซฏๅซๅ'้ๅฐพ(rear)'
ไปฅๆๅ
็ด ็็งป้คๅ็ๅจ้ๅ็ๅฆไธ็ซฏ๏ผๅซๅ'้้ฆ(front)',ๅฝไปฅๅ
็ด ่ขซๅ ๅ
ฅๅฐ้ๅไนๅ๏ผ
ไปๅฐฑไป้ๅฐพๅ้้ฆๅ่ฟ๏ผ็ดๅฐไปๆไธบไธไธไธชๅณๅฐ่ขซ็งป้ค้ๅ็ๅ
็ด
ๅ
่ฟๅ
ๅบ(FIFO):ๆๆฐ่ขซๅ ๅ
ฅ็ๅ
็ด ๅคไบๅฏนๅฐพ๏ผๅจ้ๅไธญๅ็ๆ้ฟๆถ้ด็ๅ
็ด ๅคไบ้้ฆ
-----------------------------------
rear front
-----------------------------------
ๆฝ่ฑกๆฐๆฎ็ฑปๅ(ADT):
Queue() ๅๅปบไธไธช็ฉบ้ๅๅฏน่ฑก๏ผๆ ้... |
95459a6354f4c8641e2287b0ce97a5ae8ed87ad1 | abdullahcheema63/itc_assignments | /i160033_assignment1/i160033_assignment1_question6.py | 187 | 3.703125 | 4 | #question_6
count=5
while count>0:
space=count
while space>0:
print " ",
space-=1
print count,
print "\n",
#print ((" "*count)+str(count))
count-=1 |
a84225c3220e3cc74ba9eb22329fca4eb591245e | etwit/LearnPy | /Day3/ex10.py | 1,019 | 3.734375 | 4 | #!/usr/bin/env python
#_*_coding:utf-8_*_
'''
Created on 2017ๅนด7ๆ21ๆฅ
@author: Ethan Wong
'''
#ไธๅ
่ฟ็ฎๅlambda่กจ่พพๅผ
temp = None
if 1>3:
temp = 'gt'
else:
temp = 'lt'
print temp
result = 'gt' if 1>3 else 'lt'
print result
#lambda่กจ่พพๅผ
def foo(x,y):
return x+y
print foo(4,10)
#ๆบ่ฝ่ฐ็จไธๆฌก ๅฝๆฐ็ฎๅไธไผ็ปๅธธ่ขซ่ฐ็จ
temp = lambda x,y,z... |
ecfa72e8bb480c7caaf3977d1852e723858d0c02 | dhitalsangharsha/GroupA-Baic | /question16.py | 315 | 3.828125 | 4 | '''16) Convert the code snippet given below to list comprehension to get the exact result.
my_list = []
for x in [20, 40, 60]:
for y in [2, 4, 6]:
my_list.append(x * y)
print(my_list) # Output: [40, 80, 120, 80, 160, 240, 120, 240, 360]'''
x=[20,40,60]
y=[2,4,6]
my_list=[i*j for i in x for j in y]
print(my_list) |
e0cf291af346f5509ca3464e2a8520b3998080be | MilanDonhowe/AoC2019 | /day3/ww3.py | 2,261 | 3.921875 | 4 | # Day 3: let's get this bread ๐
import pprint
def manhattan_distance(pos):
return abs(pos[0]) + abs(pos[1])
def generate_vertices(pathstr, return_list=False):
steps = pathstr.split(",")
vertices = set()
list_option = []
# x, y
this_x = 0
this_y = 0
for step in steps:
... |
83767cb2796f1fd41f1dbb203ca48cf121144434 | shreyansh-tyagi/leetcode-problem | /integer replacement.py | 838 | 4.25 | 4 | '''
Given a positive integer n, you can apply one of the following operations:
If n is even, replace n with n / 2.
If n is odd, replace n with either n + 1 or n - 1.
Return the minimum number of operations needed for n to become 1.
Example 1:
Input: n = 8
Output: 3
Explanation: 8 -> 4 -> 2 -> 1
Example 2:
Input:... |
f0acb9b80b78f3ff92889ea8bf66a215593523df | brpadilha/exercicioscursoemvideo | /Desafios/Desafio 017.py | 205 | 3.8125 | 4 | #achar hipotenusa
from math import sqrt,hypot
op=float(input('Cateto oposto: '))
ad=float(input('Cateto adjacente: '))
#hip= sqrt(op**2+ad**2)
hip=hypot(op,ad)
print('Hipotenusa = {}' .format(hip))
|
fd54e4dc2b235f3c7bc976f74335d424eb58cd34 | dallasmcgroarty/python | /DataStructures_Algorithms/linked_list_problems.py | 1,843 | 4.0625 | 4 | # function to check for a cycle in a linked list
# the node class defined below:
class Node(object):
def __init__(self, value):
self.value = value
self.next = None
def cycle_check(node):
temp = node
while(temp):
if temp.next == node:
return True
else:
... |
d4b303a89a076ff3791850b1ca1039855dee44e6 | Ashish-012/Competitive-Coding | /linkedlist/deleteNode.py | 922 | 4 | 4 | '''
If the head is `None` return. Setup two pointers, one pointing to the previous node and one to the current node and one variable counting the
positions. Traverse till we reach the end of the list or the position. After that check if we reach the position or not, if not then the position
does not exists ... |
1c7b1d661fa37200a80eca2770a9370767d16850 | hector-cortez/python_examples | /ej019.py | 304 | 3.828125 | 4 | # -*- coding: utf-8 -*-
'''
@author: Hector Cortez
Calcular el factorial de un nรบmero N por sumas sucesivas,
desplegar el resultado.
'''
n = int(input("Introduzca un nรบmero: "))
f = 1
sf = 0
for ca in range(1, n + 1, 1):
for cs in range(1, ca +1, 1):
sf = sf + f
f = sf
sf = 0
print n, f
|
9053ae9fb05feb4046a9b002d63561e051d3aeda | Bjarkis/School_assignments | /max_int.py | 477 | 4.46875 | 4 |
num_int = int(input("Input a number: ")) # Do not change this line
# Fill in the missing code
#The program should ask the user for positive integers and and then print the highest one out
#If a negative integer it put in the program quits
max_int = 0
#it needs to hold on to the largest int
while num_int >= 0:
... |
a36c2bf8e14e07b4b0d3bc49c449ca3478877ba0 | WorkWithSoham/Eel-Python-Sudoku | /Backend/OnlyPythonGenSolve.py | 804 | 3.796875 | 4 | import Sudoku_generator
import Sudoku_solver
def printPuzzle(string, SudokuPuzzle):
print(string)
for grid in SudokuPuzzle:
print(grid)
print("\n\n")
if __name__ == '__main__':
loop = True
while loop:
Difficulty = int(input("Enter difficulty level from 1 to 5, with 5 being most dif... |
73155475c33a8d7b73408c7572f67c6b9de4977e | michaelRobinson84/Assignment2 | /prac_02/files.py | 596 | 3.75 | 4 | # Program 1
name = input("Please enter your name: " )
out_file = open("name.txt", "w")
out_file.write(name)
out_file.close()
# Program 2
in_file = open("name.txt", "r")
name = in_file.read()
print("Your name is", name)
in_file.close()
# Program 3
in_file = open("numbers.txt", "r")
first_num = int(in_file.readline... |
d45818a6ad143c1768f9b84c5b521afd64ae8c9d | laszewsk/cloudmesh | /cloudmesh/util/menu.py | 1,275 | 3.84375 | 4 | '''Ascii menu class'''
def ascii_menu(title=None, menu_list=None):
'''
creates a simple ASCII menu from a list of tuples containing a label and a functions refernec. The function should not use parameters.
:param title: the title of the menu
:param menu_list: an array of tuples [('label', f1), ...]
... |
e2b5b0bcd58d35bccc9f5968236c75411fc23622 | bproetto92/midterm | /Q3.py | 751 | 3.90625 | 4 |
#
# QUESTION 3
#
import os
import pandas
csv_filepath = "albums.csv"
csv_data = pandas.read_csv(csv_filepath)
print("------------------")
print("PROCESSING SONG DATA FROM CSV...", csv_filepath)
print("CSV FILE EXISTS?", os.path.exists(csv_filepath)) #> should be True, otherwise run the preceding setup code cell (on... |
efde7c9000ab9c0c88b9ce9891afb5f31a9977b1 | bridgidrankin/Easter-Sunday-Calculator | /easter_sunday_calculator.py | 1,210 | 4.21875 | 4 | #!/usr/bin/env python3
def calcEasterSunday(year):
#perform Easter calculation
D = year - 1900
R = D % 19
P = (7 * R + 1) // 19
S = (11 * R + 4 - P) % 29
Q = D // 4
T = (D + Q + 31 - S) % 7
result = 25 - S - T
if result > 0:
month = "April"
day = s... |
cb7ee0e90771d70e649a95186c5b6893550ba290 | SimonLundell/Udacity | /Intro to Self-Driving Cars/Vehicle motion and control/Lesson_1/Understanding the Derivative.py | 17,102 | 4.375 | 4 | #!/usr/bin/env python
# coding: utf-8
# # Understanding the Derivative
#
# You just saw these three statements.
#
# > 1. **Velocity** is the instantaneous rate of change of **position**
# > 2. **Velocity** is the slope of the tangent line of **position**
# > 3. **Velocity** is the derivative of **position**
#
# Bu... |
d46f3a2abef1c0c945840a22f13b85135a8d9fc8 | PiyushMishra318/Programs | /Python/Knapsack.py | 429 | 3.765625 | 4 | max_weight=int(input("Enter the maximum weight the burgalur can carry:"))
n=int(input("Enter the no. of items in the house:"))
value=[]
weight=[]
for i in range(0,n):
a=int(input());
value.append(a);
b=int(input());
weight.append(b);
while(i<n):
maxim=max(value);
if(value[i]==maxim):
if... |
e013bb9696774beb815997ceadd8915113cf0e45 | devhliu/arterial_vessel_measures | /utils/search_utils.py | 3,932 | 3.671875 | 4 | import os
from pathlib import Path
import pandas as pd
# finds files(used to find error_files) and gives a dictionary as output
# this function is used only for manual error preparation
def find_error_file(directory, file="001.nii", search="string"):
"""
finds files(used to find error_files) and gives a dicti... |
b714da7b9acfe90347b87becb7d3174e48248bd2 | vishaalgc/codes | /Array/kadane.py | 421 | 3.6875 | 4 | def maxSubArray( nums):
"""
:type nums: List[int]
:rtype: int
"""
max_ending_here = 0
max_so_far = 0
for i in nums:
max_ending_here += i
if max_ending_here < 0:
max_ending_here = 0
max_so_far = max(max_so_far, max_ending_here)
if max_so_far ==... |
071e2fdace928eee78cd0b23ca6e69906a369d3b | Danielwong6325/ICTPRG-Python | /week11/question6.py | 1,020 | 3.953125 | 4 | def Getpasswordfromuser():
SpecialSym =['$', '@', '#', '%','!','*','?','/','-','^','&']
while True:
try:
pas = str(input("Please enter your password"))
for i in len(pas):
if pas.upper <1:
raise ValueError("You need at least one uppercase letter... |
93e0b55bf6a69dcb828dc3fba3b24315c11ea724 | Aniketthani/Python-Tkinter-Tutorial-With-Begginer-Level-Projects | /32flashcard.py | 8,112 | 3.65625 | 4 | from tkinter import *
from PIL import ImageTk,Image
from random import randint, shuffle
root=Tk()
root.title("Flashcard App By Aniket Thani")
root.geometry("700x700")
root.config(bg="orange")
#functions
def random_image():
#list of state names
global our_states
our_states = ['chhattisgarh... |
815d1c457f96c17f89899f1085def24a07f767c0 | anaswara-97/python_project | /flow_of_control/looping/even_btw_range.py | 277 | 4.1875 | 4 | min=int(input("Enter minimum limit : "))
max=int(input("Enter maximum limit : "))
print("even numbers between",min,"and",max,"are :")
# for i in range(min,max+1):
# if(i%2==0):
# print(i)
#while using
i=min
while(i<max+1):
if(i%2==0):
print(i)
i+=1 |
d71bc7c9cd312bd8edfb5b63c5e52cb4c1220559 | kingwangz/python | /king26.py | 494 | 3.609375 | 4 | fdict = dict((['x', 1], ['y', 2]))
print(fdict)
ddict = {}.fromkeys(('x', 'y'), (-1, -2))
print(ddict)
print(ddict.keys())
print('y' in ddict.keys())
print(hash('x'))
s = set('cheeseshop')
print(s)
t = frozenset('bookshop')
print(t)
myTuple = (123, 'xyz', 0, 45.67)
legends = {('Poe', 'author'): (1809, 1849, 1976), ('Ga... |
c8d8dc910aac2a8db2ee3fdfc300f60d8658dfaa | bodsul/code2040-challenge | /challenge.py | 3,408 | 3.8125 | 4 | #import library for making HTTP requests
import requests
#import library for converting python objects to JSON format
import json
#import object from library to convert ISO date to python date format
import dateutil.parser as parser
#import object from library to add dates in python format
from datetime import timed... |
b92e50b0a0c20a19b71e18500dea4612363e3dda | jossefaz/python_test_automation | /_1_basics/tests/test_main.py | 318 | 3.703125 | 4 | from ..app.main import add
def test_add_num():
assert add(1,2) == 3
def test_add_str():
assert add("hello ", "world") == "hello world"
class TestMain:
def test_add_num(self):
raise
assert add(1, 2) == 3
def test_add_str(self):
assert add("hello ", "world") == "hello world"
|
226c25531b4b79451cfdf69647c22dfa54c9ab07 | jieer-ma/algorithm_practice | /max_string.py | 1,092 | 3.890625 | 4 | #!/usr/bin/python
# -*- coding: UTF-8 -*-
# author: MSJ
# date: 2021/3/11
# desc๏ผ่ฎก็ฎๅญ็ฌฆไธฒๆๅ่กจไธญๆฏไธชๅญ็ฌฆๅบ็ฐ็ๆฌกๆฐ๏ผๅนถๆๅฐๅบ็ฐๆฌกๆฐๆๅค็ๅญ็ฌฆ
def calc_max_string(str):
# ๅฐๅญ็ฌฆไธฒ่ฝฌๅๆๅ่กจ
str_list = list(str)
# ๅฎไนไธไธช็ฉบๅญๅ
ธ๏ผ็จๆฅๅญๅจ ๅญ็ฌฆ: ๅบ็ฐๆฌกๆฐ
str_dict = {}
# ้ๅๅ่กจ(ๅญ็ฌฆไธฒ)
for x in str_list:
# ๅฆๆ่ฏฅๅญ็ฌฆๆฒกๆๅจๅญๅ
ธไธญๅบ็ฐ่ฟ๏ผๅ่ตๅผไธบ1๏ผๅฆๅๅจๅๆฅๅบ็กไธ+1
if... |
439c5270cc6c81e4bbde866a26d2bfcbf2325007 | devak23/python | /other_progs/sorting.py | 768 | 4.3125 | 4 | #!/usr/bin/python
# An implementation of the quick sort algorithm
from enum import Enum
class Order(Enum):
ASCENDING = 1
DESCENDING = 2
def quicksort(collection, order):
"Quicksort over a list-like sequence"
if len(collection) == 0:
return collection
pivot = collection[0]
small = ... |
c6f5cb86c18f49889926147e51e947ee969e1533 | theMonarK/Snake2p | /mCase.py | 1,170 | 3.640625 | 4 | # -*- coding: cp1252 -*-
#Module case
#Constructeur
def creer(etat) :
assert type(etat) is str
entier=0
if etat == "rien":
entier=0
elif etat == "vide":
entier=1
elif etat == "bonbon":
entier=2
elif etat == "snake1":
entier=3
elif etat == "sn... |
94e7c649d370b33515a8c9b6e8fb9a3017bde8f5 | Dino-Dan/PassManager | /PassManager.py | 5,466 | 4.1875 | 4 | import os
class PassManager():
'''(None) -> None
This is a class that will manage passwords by storing them in a text
file. They will be in a format that follows this:
WEBSITE:[USERNAME, PASSWORD]
This will also be able to read the passwords within the text file and
output them if the ... |
30c11a5cddec6270eaa71709cdc84d31222c17b7 | Chris0089/adaline-single-modular | /perceptron.py | 17,636 | 3.8125 | 4 | '''
Neuronal Networks Algorithm
Neuron availables:
Perceptron
Adaline
Activation functions available:
step
logistic
Training methods available:
feedforward
backpropagation
'''
import sys
import random
import numpy as np
import pylab
import matplotlib.pyplot as plt
from itertools import chain
... |
d402eb159e0d2fc5557077a39a0e910eb1dd3504 | jose-carlos-code/CursoEmvideo-python | /exercรญcios/EX_CursoEmVideo/ex022.py | 407 | 3.859375 | 4 | nome = str(input('qual o seu nome completo?: ')).strip()
print('analisando o seu nome... ')
print('o seu nome em maiusculas e {}'.format(nome.upper()))
print('o seu nome em minusculas e {}'.format(nome.lower()))
print('seu nome tem um total de {} letras'.format(len(nome) - nome.count(' ')))
dividido = nome.split()
prin... |
66bfc88e0b5a80940ffa717bb3870b57cabc400b | SMcDick/BookPriceAnalyst | /example.py | 756 | 3.65625 | 4 | from selenium import webdriver
from bs4 import BeautifulSoup
#example of finding the price of a book
driver=webdriver.PhantomJS(executable_path='/Users/jameszheng/GitProj/BookPriceAnalyst/phantomjs');
driver.get('http://bookscouter.com/prices.php?isbn=9780132139311&searchbutton=Sell');
html = driver.page_source;
soup =... |
c63cc95cc0244f27e0cc70fd46e651c7f2f4ae83 | wangbo-android/python | /Pythonๅ่ๆๅ4/chapter3/ch3.py | 460 | 3.9375 | 4 | def compare(a, b):
if a is b:
print("a is b")
elif a == b:
print('a == b')
elif type(a) is type(b):
print('type a is type b')
l1 = list()
l2 = l1
compare(l1, l2)
print(dir(l1))
l3 = ['hello', 'world']
l4 = l3.copy()
l5 = l3[:]
del l4[1]
print(l3)
print(l4)
print(l5)
print(list({'name': 'wangbo', 'age': 30}... |
61beaf6ddc778d8b44333e96d8f46bcab9c2ca97 | aaronfox/LeetCode-Work | /MeetingRoomsII.py | 2,706 | 3.875 | 4 | # URL: https://www.lintcode.com/problem/meeting-rooms-ii
# Meeting Rooms II
# Given an array of meeting time intervals consisting of start and end times
# [[s1,e1],[s2,e2],...] (si < ei), find the minimum number of conference rooms required.
def getMeetingRooms(times):
# Sort separately created start and end time... |
e42a2a16261c919901dbd4a6b97f7eb3e6293586 | Valen558/gao | /generator.py | 404 | 4 | 4 | #generator that uses yield
def wordGenerator():
n=-1
allWords=['tea','table','go','speak','swim','jump','Earth','fly','plane','study','girl','boy','student']
while(True):
n+=1
if(n<len(allWords)):
yield allWords[n]
else:
raise StopIteration()
wordGenera... |
50d6ed7304d7c7814456b2ec448b689a56409cc1 | zsmountain/lintcode | /python/interval_array_matrix/64_merge_sorted_array.py | 1,201 | 4.375 | 4 | '''
Given two sorted integer arrays A and B, merge B into A as one sorted array.
You may assume that A has enough space (size that is greater or equal to m + n) to hold additional elements from B. The number of elements initialized in A and B are m and n respectively.
Example
A = [1, 2, 3, empty, empty], B = [4, 5]
... |
bfa6ef82ed7e1f9db2e74bab27fef8677d22c509 | stefanverhoeff/leetcode | /is_palindrome.py | 956 | 3.890625 | 4 | import re
class Solution:
def isPalindrome(self, s):
"""
:type s: str
:rtype: bool
"""
if len(s) < 2:
return True
# Ignore case
s = s.lower()
# Strip non-alpha numerics from the string
s = re.sub(r'[^a-z0-9]', '', s)
... |
53433f98d50292faf01ed0c8244b50626421c86a | arvindkg/Machine-Learning | /Classification-ForestCoverType-RandomForest/Classification-ForestCoverType-RandomForest.py | 1,202 | 3.5625 | 4 | # ------------------------------------------------
# Classification of Forest Cover Type Using Random Forests Algorithm
#
# Data Source: https://archive.ics.uci.edu/ml/datasets/covertype
#
# Author: Arvind Kumar
# Email: arvindk.cse@gmail.com
#-------------------------------------------------
import pandas... |
b8e53d65674188feea0828c73211948ab211de8a | brookeclouston/CISC499 | /initialization.py | 4,466 | 3.84375 | 4 | """
This script creates an initial population of candidate timetables.
Each timetable will be represented as an array of values.
Each value will represent a timeslot/room pairing for one of the courses
to be timetabled.
Input values will include the number of courses, number of entries in the timeslot/room grid,
and p... |
483e663109c2e43b9d15237711ff8eafae68e621 | suntyneu/test | /test/่พๅ
ฅไธไธชๅญ็ฌฆไธฒๆๅฐๅ
ถไธญๆๆๆฐๅญ็ๅ.py | 166 | 3.578125 | 4 | str = input()
index = 0
sum = 0
while index < len(str):
if str[index] >= "0" and str[index] <= "9":
sum = sum + int(str[index])
index += 1
print(sum)
|
798dcb961584951bfc047e07ff1a770cc5d4bfe2 | lamceol/python | /score.py | 407 | 4.03125 | 4 | #
# Script for checking the score of a grade
# Robert Lambe
#
# Get input
inp = raw_input("Enter Score: ")
score = float(inp)
# Calculate score
if score < 0 :
print "Error1"
quit()
elif score > 1 :
print "Error2"
quit()
elif score >= 0.9 :
print "A"
elif score >= 0.8 :
print "B"
elif score... |
56ece4cad55fc5c0569e6ed4a9efce58fb92cae0 | brpadilha/PythonPractice | /AprovedOrNot.py | 275 | 4.09375 | 4 | #a program that reads the note of a studend and if is greater than 6, returns approved else desapproved.
def consult(n):
if n >= 6:
print ('Approved')
else:
print ('Desapproved')
note = int(input("What is the note of the student: "))
consult(note)
|
70196d1c97f5973e09cbe4fe46d3f084fdde6ddf | ameyalaad/2048 | /Game.py | 6,927 | 4.03125 | 4 | from Storage import Storage
from Move import Move
import os
class Game:
"""
The class that keeps track of a Game session
Each game is represented by a Storage class object
"""
def __init__(self):
self.max_score = 0
self.storage = None
def new_game(self):
"""
S... |
12b35199553afa6ad379198820c63ff8b0e2e6c2 | JmcRobbie/novaRoverDemos | /nova_rover_demos/utils/python_benchmarking/lib/module.py | 1,644 | 4.46875 | 4 | # The following codes for sorting algorithms are taken from GeekforGeeks
# (https://www.geeksforgeeks.org/)
# SAMPLE CODE
# YOU CAN DELETE THIS
# Function to do insertion sort
def insertionSort(arr):
# Traverse through 1 to len(arr)
for i in range(1, len(arr)):
key = arr[i]
#... |
7e583113833f6adbbde9d50f391376a86a4ab58f | paolithiago/python_DSA | /VermaiorvalornnaLista_Reduce_Lambda.py | 396 | 3.75 | 4 | from functools import reduce
#Cria uma lista
lista= [1,16,2,444,69,8,4,36,54,87]
print(lista)
#gera um for para imprimir a lista
#for i in lista:
# print(i)
#agora gerar um reduce para verificar o maior valor da lista sendo que o lambda ira para uma variavel
chlista = lambda a , b: a if (a > b) else b
typ... |
c16fe0870e7e9f81761d4b25892c1915a3603788 | mohitgureja/DSA_Nanodegree-Python | /Project_1-Unscramble computer science problems/Task4.py | 1,291 | 4.28125 | 4 | """
Read file into texts and calls.
It's ok if you don't understand how to read files.
"""
import csv
def get_telemarketers(remove_set,calls_list):
number_set = set()
for number in calls_list:
if(number[0] not in remove_set):
number_set.add(number[0])
return number_set
def get_removable_telemarketers(texts_li... |
a7d27d04180c0c01c9ef5a6bde71266409cd531c | avin2003/ASlevel | /hollow.py | 258 | 3.953125 | 4 |
size = int(input("Input number of rows:"))
for row in range(1,(size+1)):
for col in range(1,(2*size)):
if row== size or row+col== size+1 or col-row== size-1:
print("A",end = "")
else:
print(end=" ")
print()
|
86a3cb2e6f694acefcd7ebbe6456dc716ad29ea2 | vaibhavd2103/GitHubMini | /Python/palindrome.py | 298 | 3.703125 | 4 | def isPalindrome(num):
return str(num) == str(num)[::-1]
def largest(min, max):
z = 0
for i in range(max, min, -1):
for j in range(max, min, -1):
if isPalindrome(i*j):
if i*j > z:
z = i*j
return z
print(largest(100, 999))
|
ed80455e7d05ea88690b53af1ed111c65218a980 | nichollasong/Python- | /Chatbot/Chatbot.py | 3,061 | 3.984375 | 4 | print("Hello")
response = raw_input("\nWhat is your name ?\n ")
print("\nHello " + response + ". How are you feeling?\n ")
import random
moods1 = ["bad", "not great", "horrible", "not too bad"]
responses1 = ["\nOh cheer up, I'm sure you'll be just fine\n "]
moods2 = ["ok", "good", "great", "amazing", "fantastic"]
res... |
17de8bf3f3b6f898225ef2e4d32391340e0b57c1 | dipanbhusal/Python_practice_programs | /ques4.py | 536 | 4.21875 | 4 | # 4. Write a Python program to get a single string from two given strings, separated
# by a space and swap the first two characters of each string.
def string_swap(string1, string2):
modified_str1 = string2[0:2]+string1[2:]
modified_str2 = string1[0:2] + string2[2:]
result = modified_str1 + ' ' + modified... |
1503cf36b31931b5fdc27a3044fa06ba096fcf10 | dlefcoe/daily-questions | /contiguousSum.py | 1,069 | 4.28125 | 4 | '''
This problem was asked by Lyft.
Given a list of integers and a number K, return which contiguous elements of the list sum to K.
For example, if the list is [1, 2, 3, 4, 5] and K is 9, then it should return [2, 3, 4], since 2 + 3 + 4 = 9.
'''
def contigElem(intList, sumReq):
'''
takes a list and searc... |
fe0333281e247a5aba14247c93f39ebd50e8963c | g10guang/offerSword | /app/tree/median.py | 2,727 | 3.796875 | 4 | # -*- coding: utf-8 -*-
# author: Xiguang Liu<g10guang@foxmail.com>
# 2018-05-05 16:59
# ้ข็ฎๆ่ฟฐ๏ผhttps://www.nowcoder.com/practice/9be0172896bd43948f8a32fb954e1be1?tpId=13&tqId=11216&rp=1&ru=%2Fta%2Fcoding-interviews&qru=%2Fta%2Fcoding-interviews%2Fquestion-ranking
class Solution:
"""
ๆฏๆฌกๅไธญไฝๆฐๆถๅๅฐฑ้ๆฐๆๅบ
"""
... |
3362c4d866825394bef76541b33e6ceade012bdd | Kashif1Naqvi/Python-Algorithums-the-Basics | /unorder_list_searching.py | 196 | 3.75 | 4 | items = [1,2,3,4,5,6,7,8,9,11]
def find_items(item,itemslist):
for i in range(0,len(items)):
if item == itemslist[i]:
return i
return None
print(find_items(11,items))
# output: 9 |
96faf832fe2dc14ab3046933631618b5c06410ea | dylanbr0wn/ProjectGames | /db_init.py | 860 | 3.546875 | 4 | """
Initialize SQLite database.
Should only be called when one doesn't already exist
"""
import sys
import os
import sqlite3
def init(dbname):
""" Initialize database with name dbname """
assert dbname is not None
# Connect & get db cursor
conn = sqlite3.connect(dbname)
curs = conn.cursor()
#... |
ba3e900a96147d3a735f9f64cb12973d805358b0 | djinn00/CryptoScripts | /caesar.py | 632 | 4.0625 | 4 | #!/usr/bin/env python3
from sys import argv, exit
import string
def caesar(s, n):
letters = string.ascii_uppercase
out = ""
for c in s:
if c in letters:
i = letters.index(c)
ni = int((i + (n % len(letters))) % len(letters))
out += letters[ni]
else:
... |
f9ad5f4af65e603c0dda41b6f8ad011f3ae002dd | improvbutterfly/twilioquest-exercises | /python/fizzbuzz.py | 278 | 3.546875 | 4 | import sys
for i in range(len(sys.argv)):
if i > 0:
if (int(sys.argv[i]) % 3 == 0) and (int(sys.argv[i]) % 5 == 0):
print("fizzbuzz")
elif int(sys.argv[i]) % 3 == 0:
print("fizz")
elif int(sys.argv[i]) % 5 == 0:
print("buzz")
else:
print(int(sys.argv[i]))
|
d1b2484512d0b7ab51f40b6a48746d9c7422b330 | kaci65/Nichola_Lacey_Python_By_Example_BOOK | /Maths/divide.py | 294 | 4.21875 | 4 | #!/usr/bin/python3
"""Use whole number division and remainder"""
import math
num1 = int(input("Enter first number: "))
num2 = int(input("Enter second number: "))
div = num1 // num2
rem = num1 % num2
print("{:d} divided by {:d} is {:d} with {:d} remaining".format(
num1, num2, div, rem))
|
f69988ac1d9596891def606b4f44101230d068e0 | hankerkuo/PythonPractice | /Introduction and Basic data types/Runner-Up Score.py | 471 | 3.6875 | 4 | #Problem:https://www.hackerrank.com/challenges/find-second-maximum-number-in-a-list/problem
print(dir(list))
Score_Number = int(input())
Score_List = list(map(int,input().split(' ')))
RunnerUp = int()
Score_List.sort()
if Score_List[0] == Score_List[Score_Number-1]:
print("ERROR : All the scores are same")
for i i... |
733d9c50a5e8e2d062c8f57a22544016932274ce | pauldubois98/MathematicalPaper_ModularForms | /SpeedComparison/SparsePython.py | 810 | 3.796875 | 4 | def delta(LENGTH):
f = []
indice = 1
i = 1
while indice < LENGTH:
f.append(indice)
i += 2
indice = i**2
return (f, LENGTH)
def square(form):
f_sq = []
f = form[0]
for n in f:
if 2*n-1 <= form[1]:
f_sq.append(2*n-1)
return (f_sq, form[1])
... |
2149775bc373e37b82201b10a08a5a6433c87ad4 | zlc1994/Google-Foorbar | /string_cleaning.py | 2,605 | 4.0625 | 4 | """
String cleaning
===============
Your spy, Beta Rabbit, has managed to infiltrate a lab of mad scientists who
are
turning rabbits into zombies. He sends a text transmission to you, but it is
intercepted by a pirate, who jumbles the message by repeatedly inserting the
same word into the text some number of times.
At ... |
e20e80a8cb0f4ed881e0a2a3e2ff9cc00cc6ce55 | bagorbenko/home-tasks | /jug_problem.py | 3,045 | 4.125 | 4 | print('ะะฐะฟะพะปะฝะธัั ัะพััะด A (A+).\n ะะฐะฟะพะปะฝะธัั ัะพััะด B (B+).')
print('ะัะปะธัั ะฒะพะดั ะธะท ัะพััะดะฐ A (A-).\n ะัะปะธัั ะฒะพะดั ะธะท ัะพััะดะฐ B (B-).')
print('ะะตัะตะปะธัั ะฒะพะดั ะธะท ัะพััะดะฐ A ะฒ ัะพััะด B (A-B).\n ะะตัะตะปะธัั ะฒะพะดั ะธะท ัะพััะดะฐ B ะฒ ัะพััะด A (B-A).')
print('ะะปั ะทะฐะฒะตััะตะฝะธั ัะฐะฑะพัั ะฒะฒะตะดะธัะต "ะัั
ะพะด").')
A = input('ะะฒะตะดะธัะต ะพะฑัะตะผ ะฑะพะปััะตะณะพ ะฒะตะดัะฐ ะ: ... |
7a7d84894d31742cd6d3dc5e1985b95dc88e73a2 | anjanasrinivas/Intuit-Coding-Challenge- | /problem_1.py | 298 | 3.625 | 4 |
lst = [1,10,5,63,29,71,10,12,44,29,10,-1]
def sorted_list(lst):
for i in range (len(lst)):
for j in range (len(lst)-1-i):
if lst[j] > lst[j+1]:
lst [j], lst[j+1] = lst[j+1], lst[j]
sorted_list(lst)
print(lst)
#Using python built in feature to sort
def sort(lst):
lst.sort()
|
146747c4c52d3d59074a6809ed53b6128fdba1a7 | furyjack/Connect4 | /game.py | 3,278 | 3.609375 | 4 | from board import Board
from node import Node
from copy import deepcopy
from tree_render import create_graph
from random import shuffle
class Game:
def __init__(self):
self.has_ended = False
self.current_state = Board()
#assuming game starts with the player
self.turn = 0
def pl... |
e3f47696dd48aa98ba8260e2ed68923ff5d6b2e3 | byunwonju/2020_programming | /prob101.py~ prob130.py/prob 115.py | 418 | 3.828125 | 4 | #์ฌ์ฉ์๋ก๋ถํฐ ํ๋์ ๊ฐ์ ์
๋ ฅ๋ฐ์ ํ ํด๋น ๊ฐ์ 20์ ๋บ ๊ฐ์ ์ถ๋ ฅํ๋ผ. ๋จ ๊ฐ์ ๋ฒ์๋ 0~255์ด๋ค. 0๋ณด๋ค ์์ ๊ฐ์ด๋๋ ๊ฒฝ์ฐ 0์ ์ถ๋ ฅํด์ผ ํ๋ค.
a= int(input("๊ฐ์ ์
๋ ฅํ์ธ์.:")
if(a>=0 and a<=255):
a=(a-20)
if (a<=255):
print("0")
else:
print(a)
else:
print("0-255 ์ฌ์ด์ ๊ฐ์ ์
๋ ฅํ์ธ์.")
|
95f7acb5e03b1d0d1d66266238bcadd0c969b98c | ObinnaEE/Programming-Applications-Course-Spring-2016 | /Week 1/PlotHW1.py | 936 | 3.5 | 4 | #import numpy and matlibplots module
#generate array of x values from 0 to 6pi
#calculate y values for sin wave
#calculate y values for cosine wave
#plot x and y values for both functions
#set dashed line for sine wave and solide line for cosine wave
#add legend
#leave comment here with your information
#Name... |
d01285162112d08887ec9c5adb3daa92a3b67597 | LucasPires50/jogo_memoria | /jogos.py | 501 | 3.71875 | 4 | import forca
import adivinhacao
def escolha_jogo():
print("*********************************")
print("*********Escolha um jogo!********")
print("*********************************")
print("(1)Forca (2)Adivinhaรงรฃo")
jogo = int(input("Qual jogo?"))
if (jogo == 1):
print("Jogo da Forca... |
223560954afb6b5c4ead7f7de81a2270df5b625f | vashistak/Basic-Python-Codes | /Basic Python Codes/nanodegrexample.py | 200 | 3.546875 | 4 | def mystery(N):
s = []
while N > 0:
s.append(N % 3)
N = N / 3
buf = ""
while len(s) > 0:
buf += str(s.pop())
return buf
print mystery(50)
|
7593e3eeade2c8c2a00cdafbb48fa79a98f6282b | gitbot41/sunny-side-up | /src/Baseline/Bayes/feature_extractors.py | 1,935 | 3.75 | 4 | ''' The file is a collection of functions that take in a sentence string
as input, and output a set of features related to that sentence
Output of each function is of the following format:
{feature_1, feature_2, ... , feature_n}
'''
from nltk import word_tokenize
from nltk.corpus import stopwords as s... |
aad2b9686d74cdb756eb0df236c7d8922a1bfa8f | ParthRoot/Basic-Python-Programms | /Ways to remove iโth character from string.py | 238 | 3.921875 | 4 | # Programme by parth.py
# Ways to remove iโth character from string
def remove(str,j):
for i in range(0,len(str)):
if i != j:
print(str[i], end="")
a = "APPLE"
b = remove(a, 2)
"""
Output:
APLE
""" |
f307f5835b24fda917ce719f768474c154fe7f2c | Wambuilucy/CompetitiveProgramming | /Project Euler/ProjectEuler6.py | 801 | 3.96875 | 4 | #! /usr/bin/env python
'''
Project Euler 6 (https://projecteuler.net/problem=6)
Sum Square Difference
The sum of the squares of the first ten natural numbers is,
1^2 + 2^2 + ... + 10^2 = 385
The square of the sum of the first ten natural numbers is,
(1 + 2 + ... + 10)^2 = 55^2 = 3025
Hence the difference between t... |
a832e86bba417951a64dc96e76afd57e234b1402 | NikolasMatias/urionlinejudge-exercises | /Iniciante/Python/exercises from 2001 to 2600/exercise_2146.py | 114 | 3.5 | 4 | while True:
try:
number = int(input())
print(str(number-1))
except EOFError:
break |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.