blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
c01ae39c310d664a70d13125a91dadcc730b5237
nkrishnappa/100DaysOfCode
/Python/Day-#40/Ex-47.py
460
3.90625
4
# Write a script to extract the 26 letters from the file and add it to the list only if that letter is in PYTHON import glob FILE_PATH = r"C:\Users\nkrishnappa\Desktop\100DaysOfCode\Python\Day-#40\Ex-45" extract_letter = [] for file in glob.glob(f"{FILE_PATH}\*.txt"): with open(file, "r") as f: content = ...
ab0148bf436a4a3f24f6abbf7211b3159db92fd6
Meowse/IntroToPython
/Students/imdavis/session04/mailroom/mailroomfunct.py
5,103
3.75
4
#!/usr/bin/env python2.7 # -*- coding: utf-8 -*- from textwrap import dedent import math """ A set of functions which support the mailroom main program. Do: >>> print functname.__doc__ for the docstring for each. """ def prompt1(): """ This function will prompt the user for one of the av...
57e4340ab364ed612996d75a764b3d58cd8bac4e
Khalid-Sultan/Phase-2-Algorithms-Prep
/Leetcode/Depth-First_Search,Breadth-First_Search/2_-_Medium/79._Word_Search.py
1,008
3.78125
4
class Solution: def exist(self, board, word): for row in range(len(board)): for col in range(len(board[row])): if board[row][col] == word[0]: if self.dfs(board, word, (row, col), set(), 0): return True return False def dfs(...
5b995e9a319400d8ce740f95431cf6faddc2afff
AlinePhDPhysics/studies-pyhton
/test7.5.py
183
4
4
n = input ('Digite um número inteiro qualquer: ') n = int (n) if n<= 11: for n in range(1, 11, 1): n = n+1 print (n) else: if n > 11: print("Feito!")
54bbf4618dc60a1224805f8324c980029bf7877d
benny-chou/AI-homework-
/車牌辨識/TkinterTEST.py
1,231
3.890625
4
import tkinter as tk # 使用Tkinter前需要先导入 # 第1步,实例化object,建立窗口 window = tk.Tk() # 第2步,给窗口的可视化起名字 window.title('My Window') # 第3步,设定窗口的大小(长 * 宽) window.geometry('500x300') # 这里的乘是小x # 第4步,在图形界面上设定标签 var = tk.StringVar() # 将label标签的内容设置为字符类型,用var来接收hit_me函数的传出内容用以显示在标签上 l = tk.Label(window, textvariable=var ...
966e4e21c71d083d2dda805048780dd01d40aaee
viralsir/python_programs
/arithmeticdemo.py
587
4.03125
4
''' Arithmetic operators operator symbol addition + substraction - multiplication * division / modual % exponent ** type covnersion int(str) float(str) str(int) ''' no1=int(input("Enter No:")) # input will return str "1" no2=int(input(...
f7aa06c3203bbb72dfbb13bdbbfbb4c3fcabb3fe
Ssatyr/programowanie2021
/drugie zajecia/lista.py
2,244
3.734375
4
import random from statistics import median def menu(): print("Menu:") print("1. Generowanie listy") print("2. Sortowanie listy") print("3. Wyswietlanie liczb") print("4. Usuwanie liczb") print("5. Dodawanie liczb") print("6. Średnia itd") print("7. Koniec programu") def generowanie_listy(lista): print ("il...
0659b48bcd129b712d641fabf4daf63fdee8f590
Megan0145/Sprint-Challenge--Data-Structures-Python
/reverse/reverse.py
2,314
4.15625
4
class Node: def __init__(self, value=None, next_node=None): # the value at this linked list node self.value = value # reference to the next node in the list self.next_node = next_node def get_value(self): return self.value def get_next(self): return self.next_node def set_next(self, n...
0798425ff44a2a514bb72b38a219a0be45a757a3
eshimelis/cpp_practice
/src/license_key_formatting.py
706
3.5
4
class Solution(object): def licenseKeyformatting(self, s, k): """ :type s: str :type k: int :rtype: str """ # remove all dashes and convert to upper s = s.replace('-', '') s = s.upper() # reverse for easier parsing result = "" ...
6b947a28141d6a99cec03ad52d2caf94c2af4a5c
psmilovanov/Python_HW_04
/homework_04_6.py
740
3.96875
4
# Задание 6. from random import randint from itertools import count, cycle x = int(input( "Введите целое положительное число. Программа выведет все числа, начиная с этого и до числа в три раза большим: ")) for el in count(x): if el > x * 3: break else: print(el) first_list_len = randint(2...
e99a7babec55602a1d8e72ea50607311fb305187
porosya80/stepic
/python373.py
389
3.609375
4
exList = [] chkText1 = [] for i in range(int(input())): exList.append(input().lower()) for i in range(int(input())): chkText1.extend(input().lower().split()) # exList = ["a","bb","cCc"] # chkText1 = ["a","bb","aab","aba","ccc","c","bb","aaa"] chkText = set(chkText1) for i in set(exList).interse...
64d843dfe5c609f15d773df19130339b2974e5b7
Darcy382/code-breakers
/3.hash-maps/lru-cache.py
1,895
3.78125
4
# First attempt and second attempt, O(1) time and space class Node: def __init__(self, key, val): self.key = key self.val = val self.next = None self.prev = None def remove(self): self.prev.next = self.next self.next.prev = self.prev self.prev = None ...
7c4bdaeab4fcb72a63131495f7fcdfa0dc622313
lqktz/python_practice
/ex25.py
1,018
4.375
4
# -*- codind: utf-8 -*- def break_words(stuff): """This function will break up words for us""" words = stuff.split(' ') return words def sort_words(words): """sort the words""" return sorted(words) def print_first_word(words): """prints the first word after popping it off.""" word = words....
c0bb2af84cf42b7b2a1bfe54f30d7deccb9daef9
codingxnusret/learning-python
/LearningVariables.py
787
4.375
4
#Variables and Data Types review #1.create a variable called intVal and assign it an integer value intVal=5 #2.create a variable called floatVal and assign it a float value floatVal= 6.5 #3 create a variable called boolVal and assign it a Boolean value boolVal=False #4 use a print() to display the Blooean value assi...
9b5c67fde50c74604e6eb4b0d13a5334e242fc01
ed-cetera/project-euler-python
/001_solution.py
410
3.75
4
#!/usr/bin/env python3 import time def main(): noninclusive_upper_limit = 1000 total_sum = 0 for number in range(1, noninclusive_upper_limit): if number % 3 == 0 or number % 5 == 0: total_sum += number print("Solution:", total_sum) if __name__ == "__main__": start = time.tim...
2e6e93feed0a4c5244810e7088095af24dab44ea
apugithub/Programming-for-Everybody-Python-
/Week-5/finding the largest number.py
207
4.0625
4
### Findiding the largest number largest=None for value in [3,50,1,78,5]: if largest is None: largest=value elif value>largest: largest=value print (" Largest is: "), largest
b1096f59fff43c841813ce21405b242762c6115c
ES2Spring2020-ComputinginEngineering/project-1-liv-and-soham
/Step 3/logger.py
1,071
3.75
4
################## # FILL IN HEADER ################# import microbit as mb import radio # Needs to be imported separately # Change the channel if other microbits are interfering. (Default=7) radio.on() # Turn on radio radio.config(channel=7, length=100) print('Program Started') mb.display.show(mb.Image.HAPPY) wh...
eb1723b7ac80d90154f48e1698fe4f7e310ef784
hickeroar/project-euler
/040/solution042.py
1,100
3.90625
4
""" The nth term of the sequence of triangle numbers is given by, t(sub)n = 1/2n(n+1); so the first ten triangle numbers are: 1, 3, 6, 10, 15, 21, 28, 36, 45, 55, ... By converting each letter in a word to a number corresponding to its alphabetical position and adding these values we form a word value. For example, t...
3837feef9b7baabd45186ef4956883477ead0f67
josezm/python-excercises
/ejercicios 1.py
555
3.53125
4
def retornar(x): lista=[] for i in range(0,x+1): lista.append(i) return lista print retornar(5) def retornar2(x): lista=[] if x==-1: return lista else: lista=retornar2(x-1) lista.append(x) return lista print retornar2(5) def suma(x): ...
b7906daa08bb154006b5bc26d8ed724f39fe895f
cliffjsgit/chapter-17
/exercise17.1.py
548
4.1875
4
#!/usr/bin/env python3 __author__ = "Your Name" ############################################################################### # # Exercise 17.1 # # # 1. Download the code from this chapter from : # http://thinkpython2.com/code/Time2.py. # Change the attributes of Time to be a single integer representing seconds...
bd985886bdb5cdfab5b335f02c64fc1c6527ae59
rthunoli/PythonRepo
/num2word.py
1,542
3.8125
4
#!/usr/bin/python3 def n2w(number): words = '' NumWord = \ { 0:'zero', 1:'one', 2:'two', 3:'three', 4:'four', 5:'five', 6:'six', 7:'seven', 8:'eight', 9:'nine', 10:'ten', 11:'eleven', 12:'twelve', 13:'thirteen', 14:'fourteen', 15:'fifteen', 16:'sixteen', 17:'seventeen', 18:'eigh...
b6a7cd513bc9d9fd85a3581108f265f62278d84d
Joepolymath/dictionary
/main.py
171
3.859375
4
import json data = json.load(open('original.json') def diction(word): result = data[word] return result word = input("enter your word: ") print(diction(word))
ddff16a3c85da287a03fd674ec84d224fdbb919b
itkasumy/PythonGrammer
/day05/12-循环嵌套里的break.py
194
3.5625
4
i = 0 while i < 10: j = 0 while j < 10: print("j = %d " % j, end="") j += 1 if j == 7: break print("i = %d" % i) i += 1 print("over...")
cb1f1f55e87ee5c06f4bbf444a8bd529a10d49fd
AlinaDiaz21/Python-Essetials
/Tarea funciones 2.3.py
639
3.84375
4
""" @author: Alina Díaz """ def isYearLeap(yr): if yr%4 == 0 and yr%100 !=0 or yr%400 == 0: return True else: return False def daysInMonth(yr, month): if yr<1900 or month>12: return None if month==1 or 3 or 5 or 7 or 8 or 10 or 12: return 31 elif mon...
2a28b6f0af5207b7bec6e19b1aebc676bf9d1597
NewAlice/python-code
/exceptions/except3.py
221
3.71875
4
def main(): try: fh=open('file1.txt') for line in fh: print(line.strip()) except IOError as e: print('could not open this file',e) #else: # for line in fh: print(line.strip()) main()
1193cd3f1e82f956729ec90ce8128bd1ff20633d
suryak24/python-code
/85.py
169
3.984375
4
n=input("Enter the string:") even="" odd="" l=len(n) for i in range(1,l+1): if(i%2==0): even=even+n[i-1] else: odd=odd+n[i-1] print(odd,"",even)
ab1536cd4a742842118cffbe0d1882e5bceac801
paulmedeiros92/AdventOfCode2019
/day4/d4.py
663
3.71875
4
rawInput = input() ranges = rawInput.split('-') count = 0 doubles = ['00', '11', '22', '33', '44', '55', '66', '77', '88', '99'] triples = ['000', '111', '222', '333', '444', '555', '666', '777', '888', '999'] def twoAdjacent(num): strNum = str(num) for i, double in enumerate(doubles): if double in strNum and ...
c6f1afc5afb79e72485b06da0994d4d844e58b85
weiliu93/PythonMiniInterpreter
/test/test_packages/class_usage/example.py
200
3.703125
4
class A(object): def __init__(self): self.name = "haha" self.id = "hehe" def print(self): print("name is {}, id is {}".format(self.name, self.id)) a = A() a.print()
a82fb12f1781b700d9d262fccdd5ae8bb703de17
PutkisDude/Developing-Python-Applications
/week10-11/pygame/game.py
2,744
3.578125
4
# Author Lauri Putkonen # Create a small pygame game: e.g. moving objects on a screen. # Video - https://youtu.be/7vtKaASa0oY import pygame from mobs import Mob # PRESS ARROW OR WASD KEYS TO PASS MOBS # ESC EXIT # Initialize the pygame pygame.init() clock = pygame.time.Clock() mobs = [] # Create screen width = 580...
6160ad951fc77aa840af373befaad7c5fb69a8be
dchtexas1/projectEuler
/pythonEuler/projectEuler5,6,7,8.py
4,660
3.921875
4
############################################################################### # Name: Dax Henson # Date: 2017/02/09 # Description: Solves problems 5, 6, 7, and 8 of Project Euler. ############################################################################### from math import sqrt from fractions import gcd # PLEASE N...
6e5378745299af63897c16c757836f1fd2e53531
116581658/QA
/Python/TestCases/Message_Boxes.py
784
3.515625
4
import tkinter #import ctypes # Another library for message boxes, but simple one ##### The following code works with ctypes BEGIN ######### # def mbox(title, text, style): # ctypes.windll.user32.MessageBoxW(0, text, title, style) # mbox('Your title', 'Your text', 1) # ## Styles: # ## 0 : OK # ## ...
a0da6f49dea7a8a0a53809ba15759eeb12c7423e
minsuklee80/aggie
/turtle/turtle_도형에컬러채우기.py
145
3.640625
4
import turtle as t t.speed(0) t.color('red') t.begin_fill() for i in range(108): # t.pensize(i) t.circle(i*2) t.lt(10) t.end_fill()
ff517e35c73eb3ea5663a64d2748e01f16f297e1
Valink16/primer
/primer.py
845
3.703125
4
from time import time def primeList(limit,getTime=False): if(getTime): s=time() primes=[2,3] for act in range(5,limit,2): isPrime=True for i in range(3,act): if(act%i==0): isPrime=False break if(isPrime): primes.append(a...
6e57527a49c4076311a58895cdee29fe8cf3769f
BJV-git/leetcode
/array/monotonic_array.py
855
3.5
4
# logic: def isMonotonic(A): flagg = 0 flag_set = 0 prev = A[0] for i in A: curr = i diff = prev-curr if flag_set ==0: if diff < 0: flagg -= 1 flag_set = 1 if diff > 0: flagg+=1 flag_set = ...
48eeb74579632828f6a2ccacd00014c3ff7020a0
jaygoyani1/Solved_Leetcode_Python
/insert-delete-getrandom-o1/insert-delete-getrandom-o1.py
1,252
4.15625
4
class RandomizedSet: def __init__(self): """ Initialize your data structure here. """ self.dic = {} self.list = [] def insert(self, val: int) -> bool: """ Inserts a value to the set. Returns true if the set did not already contain the specified ...
84999ee2907b3a68737f00a2652e641e41412da3
idep-nter/rock-paper-scissors
/RockPaperScissors.py
2,686
4.15625
4
import random def main(): """ The main function starts by printing an intro as usual, then asks for a player's move, generates opponent's move and evaluates a result. If it's a tie, it automatically starts over again. At the end it asks the player if he wants play again and if not, it prints...
43569b22088e989eb4239ab9e7d4927aef23bc3c
mohitbishnoi/Basic-Python
/datatypes.py
1,157
3.671875
4
# -*- coding: utf-8 -*- """ Created on Sat Mar 2 10:48:09 2019 @author: Mohit """ #datatype = different type od values python can store #1 integer - numeric values #2 float - numeric values with decimal #3 string - character or any types of value #4 complax - a+bj where 'a' is real value and 'b' is imagi...
ad41cbc550bd46e96ee6aa153cf71095fb580a60
EricksonGC2058/all-projects
/practice3.py
652
4.40625
4
day = input("What is today? ") if day == "Monday" or day == "monday": print("It's Monday, the weekend is over") elif day == "Friday" or day == "friday": print("It's Friday, the weekend is close") elif day == "Saturday" or day == "saturday": print("It's the weekend, time to relax") elif day == "Tuesday" or day...
f71f8833f6efd00ea8197899a514ada8f7ab5eea
alehpineda/python_morsels
/add/add.py
453
3.953125
4
""" add function """ from typing import List from itertools import zip_longest def add(*args: List) -> List: """ Function that accepts two lists-of-lists of numbers and returns one list-of-lists with each of the corresponding numbers in the two given lists-of-lists added together. """ ...
23641cdc0b3dd4cba891380a3a6a775c51099a4d
mahavenkatvas/my_coding
/strspecial.py
162
3.546875
4
n=input() c=0 for i in n: if i.isnumeric(): c=c elif i.isalpha(): c=c elif i.isspace(): c=c else: c=c+1 print(c)
c994854ce1a6988295994714b94ba4ca005f1a66
jamesedchristie/calculator
/check.py
1,667
4.1875
4
# Function to check input is valid operation def valid_input(prefix, all_variables): valid_ops = ['+', '-', '*', '/', '^'] # Check that expression doesn't end in operator if prefix[-1] in valid_ops: print("Invalid expression") return False # Check that there is only one = sign if pr...
fc245a88dbc9f2a740e8b193ac13786bba81a861
Uyouii/TPS-SLG-GAME
/server/storage/accountTable.py
1,962
3.78125
4
import sqlite3 from table import Table class AccountTable(Table): def __init__(self, db_connect, table_name='Account'): super(AccountTable, self).__init__(db_connect, table_name) self.columns = ['name', 'password'] def create_table(self): db_cursor = self.db_connect.cursor() #...
65d199e50408aef54a361447a59d8f87639d48ba
mandamg/Exercicios-de-Python-do-Curso-em-Video
/mundo 3/aula 16/desafio3.py
447
3.953125
4
# from random import sample # numeros = (sample(range (0,11), 5)) # print(f'a sequencia de 5 numeros: {numeros}') # print(f'o maior numero é: {max(numeros)}') # print(f'o menor numero é: {min(numeros)}') from random import randint numero = (randint(0,11), randint(0,11), randint(0,11), randint(0,11), randint(0,11)) fo...
89e3165e5921ca69fa0e4119e5f19918f12f2ae9
mxdzi/hackerrank
/problem_solving/algorithms/bit_manipulation/q2_maximizing_xor.py
452
3.65625
4
#!/bin/python3 import math import os import random import re import sys # Complete the maximizingXor function below. import itertools import operator def maximizingXor(l, r): return max(operator.xor(*i) for i in list(itertools.combinations_with_replacement(range(l, r + 1), 2))) def main(): l = int(input()...
19b3e87b3384c564e400f469b1f8ae5698ee9404
ANGIE0077/python_turtle_homework
/homework.py
722
3.75
4
import turtle as tt def star(): tt.pensize(1) tt.color('black','pink') tt.begin_fill() for i in range(5): tt.forward(20) tt.right(144) tt.end_fill() def tree(length): if length>=5: tt.speed(0) tt.forward(length) tt.right(20) tree(length-10) ...
f5bb5e7a4cfa1091a643032e9533da3a2e3aa2de
JuliandresCanon/MISION_TIC_2022
/1. Python/Clases/clase_11.5.py
1,664
3.875
4
precio_manzana = 2500 cant_manzana = 5 precio_panes = 1500 cant_panes = 3 precio_salchichas = 1200 cant_salchichas = 7 precio_salsas = 3000 cant_salsas = 2 subtotal = 0 cantidad = 0 print("Calculando el total del mercado... ") total_manzana = precio_manzana * cant_manzana print("El valor total de las manzanas es: $"...
ecc99c87b78cc97046f4602cf1aab11c8f0ad44d
boh-prog/More-Projects
/WAR cardGame/WarGame.py
5,201
3.796875
4
## War Game ## ver1 import random class Card: '''build card object''' ##every card object have ranking and alliance2666 def __init__(self, rank, alliance, value): self.rank = rank self.alliance = alliance ## self.value = value ##card numeric value def __r...
e899908dde01b08114cc3c268ed89eb5ee4e1d23
rafalwilk4ti1/Projekt2020
/TheArtOfDoing-basic/Lists/Different Types of Lists Program.py
1,882
3.8125
4
import math import cmath import datetime from math import sqrt import random # Lists Challenge 7 - Different Types of Lists Program # Making 4 lists num_strings = ["15","100","55","42"] num_ints = [15,100,55,42] num_floats = [1.2, 2.3, 3.4, 4.5] num_lists = [[1,2,3,],[4,5,6],[7,8,9]] # First 3 sentences...
745ef9a1fab4e92f2c043ae040081f2ac13e88d2
CodeInDna/CodePython
/Basics/20_functions_part2.py
4,322
4.5
4
#------------functions part 2--------------# # *args (it can be named anything like *nums) operator (it is used to pass a variable # number of arguments to a fn) # In the below example, it treat the first param as num1 and rest of them treated # as the list of tuples def sum_nums(num1, *args): print(num1) #3 total...
487aa606c22118ec61378c256f8803991a1b5d3e
uathena1991/Leetcode
/Interview coding problems/google/dp_possible_path.py
1,180
4.03125
4
""" 第一题:矩阵从左上角到右下角有多少种走法 给定一个矩形的长宽,用多少种方法可以从左上角走到右上角 (每一步,只能向正右、右上 或 右下走) Follow up 1:如果给矩形里的三个点,要求解决上述问题的同时,经过这三个点 Follow up 2:如何判断这三个点一定是合理的,即存在路径 Follow up 3:如果给你一个H,要求你的路径必须向下越过H这个界,怎么做 --- (All - those without H) Follow up 4:要经过某些特定row怎么走?要先经过一个row再经过另一个row怎么走? -- (SAME as asking Follow up 3, H = max(row_i) """ ""...
43b9d86b2279178db0515035eec05863165c5805
rupaku/Leetcode-solutions
/May/08CheckItsStraightLine.py
789
4.03125
4
''' You are given an array coordinates, coordinates[i] = [x, y], where [x, y] represents the coordinate of a point. Check if these points make a straight line in the XY plane. Example 1: Input: coordinates = [[1,2],[2,3],[3,4],[4,5],[5,6],[6,7]] Output: true ''' # Solution:::::::::::::::::::::: class Solution: de...
2e254a70e2300225d8ab8101183ce30db4b5532c
ritwiktiwari/AlgorithmsDataStructures
/LinkedList/Problems/problem-3.py
932
4.09375
4
# Find Loop in the Linked List from LinkedList import Node # Creating Circular Linked List h = Node(8) g = Node(7, h) f = Node(6, g) e = Node(5, f) d = Node(4, e) c = Node(3, d) b = Node(2, c) a = Node(1, b) h.next_node = c def tortoise_hare(head): """ Also known as Floyd Cycle Finding Algorithm :param...
32ce65d0ed2d59e6bc2ff12d4fa360f40cddd2c2
KhaterehMohajery/DataScience-PythonProjects
/dataquestexcer/dataquestexcercise.py
2,106
4.15625
4
# This is an excercise to handle data base from SQl and basic manipulation of data base in python import os import pandas as pd import math import sqlite3 import numpy as np os.chdir('/Users/khaterehmohajery1/Documents/DataScience/DataScience-PythonProjects/dataquestexcer') conn = sqlite3.connect('factbook.db') query =...
7c8f80866b517fb409e34c9b3da3a6574858550f
jbeast/Doomtown-for-OCTGN
/o8g/Scripts/card.py
333
3.578125
4
def is_outfit(card): """ Returns True or False on whether card is an Outfit. :param card: A Card :return: bool """ return card.type == 'Outfit' def is_joker(card): """ Returns True or False on whether card is a Joker. :param card: A Card :return: bool """ return card.ty...
f7198b2ea2bcd59a0640aad92c8647e73b70e2e8
kaskirana01/Myproject
/01刘/Day17/代码/turtleUsage/textDemo04.py
540
3.6875
4
#绘制五角星 import turtle,time turtle.pensize(10) turtle.color("yellow") turtle.fillcolor("red") turtle.speed(1) #开始填充 turtle.begin_fill() for i in range(5): #向前移动 turtle.forward(200) #按照顺时针移动,参数表示移动的角度,left表示逆时针 turtle.right(144) #turtle.left(100) #结束填充 turtle.end_fill() time.s...
9aa8895673191a653a91adbc4e73e25451803abd
leosantosx/exercicios-em-python
/exercicios/ex54.py
483
3.921875
4
""" EXERCÍCIO 055: Maior e Menor da Sequência Faça um programa que leia o peso de cinco pessoas. No final, mostre qual foi o maior e o menor peso lidos. """ maior = 0 menor = 0 for i in range(1,6): peso = int(input('Digite o peso da {}° pessoa: '.format(i))) if peso > maior: maior = peso if i == 1...
73eb3f15d8e3b4eb58de4d8444edc3f9a500f111
in-s-ane/easyctf-2014
/Python Basics 10-75/solution.py
532
3.90625
4
# This question was initially extremely vague as to the format of the answer, but it was soon clarified ''' args[0] is a result of XOR encryption on two hexadecimal strings. You only know one of the two original strings, args[1], can you find the other? Clarification: after finding the second string you should print th...
10192827b3ad0e36647b9318ba410de0c9bb5ccb
wangjianming/CodeBase
/呼叫转移小编程题目/forward.py
4,620
3.53125
4
#coding=UTF-8 import re import sys """ 假定从文件input.txt读入记录,文件内容同题目要求 主入口main共调两个函数getRecords和calculate,一个读取记录,另一个计算 1.getRecords读取文件并解析内容,通过一个正则表达式来匹配每一行呼转记录,如果匹配可以直接得到各个值,如果不匹配,报错并返回 2 2.1 calculate中首先找到“包含要计算日期的呼转记录” 2.2 然后将呼转记录保存到一个map(key=设置了呼转的号码,value=被转移到的号码),<此时就得到当天设置的实际的呼转个数,题目要求之一> 保存到map的另一个额外好处...
aa785c3d96ad750c707fab79f72dc385b0ff2830
thompestmanhu/tpestmanProgv1p
/les 4/opdrles4_3.py
214
3.609375
4
uurloon = input('Wat verdien je per uur: ') uurgewerkt = input('Hoeveel uur heb je gewerkt: ') salaris = float(uurloon) * int(uurgewerkt) print(uurgewerkt + ' uur werken levert ' + str(salaris) + ' Euro op')
9a3e5eb2507544374fdda02210122e10ade7f389
codingninja614/python
/zip2.py
131
3.921875
4
my_strings = ['a', 'b', 'c', 'd', 'e'] my_numbers = [5,4,3,2,1] reverse=my_numbers.sort() print(list(zip(reverse,my_strings)))
e34cdb16cf3a0fd2a4ca3ff3e4038907651b59ea
Ali-Jahromi/Game-of-Life
/main.py
2,070
3.859375
4
#!/usr/bin/env python3 import matplotlib.pyplot as plt import os import random import time #Fucntion to draw the world of cells def draw(u, h, w): #Draw in terminal print("------------------------------") for x in range(30): for y in range(30): if y != 29: print(u[x][y]...
c0f6610699a7dfc82f91e900a59e0bd85e08ca25
zhujiecong/shiyanlou-000
/cal_01_02.py
1,135
3.75
4
#!/usr/bin/env python3 import sys #config premium_rate = 0.165 Threshold = 3500 def pay(salary): taxable_income = salary*(1- premium_rate) -3500 if taxable_income <= 1500: tax = taxable_income * 0.03 elif 1500 < taxable_income <= 4500: tax = taxable_income * 0.10 - 105 elif 4500 <...
f6a2ef05c4148402f11c52f5fc6a1d1e7dbbd040
DidactsOrg/graph_learning
/minimizer.py
3,775
3.578125
4
'''Minimizer routine based on scipy.optimize.minimize''' import pickle import numpy as np from scipy.optimize import minimize from numpy import linalg as LA class Minimizer(): """ A class to minimize an objective function give an f(0) and constraints """ def __init__(self, n_sensors=127, alpha=0.0...
e8760147773d9bbb109a5a2dc7a3310fc08eb89b
Sanzhar26/Chapter4
/task2.py
920
3.796875
4
class Airplane: def __init__(self,mark,model,year,max_speed): self.mark = mark self.model = model self.year = year self.max_speed = max_speed self.odometer = 0 self.is_flying = False def take_off(self): self.is_flying = True message_take ...
c88b5b73458260dbed90e6e0207fd016a77b2e8e
nishio/atcoder
/abc194/a.py
205
3.671875
4
MUSHI, NYUSHI = map(int, input().split()) NYUKO = MUSHI + NYUSHI if NYUKO >= 15 and NYUSHI >= 8: print(1) elif NYUKO >= 10 and NYUSHI >= 3: print(2) elif NYUKO >= 3: print(3) else: print(4)
2ee3c334ec38d1b0c478d5c99ce48f39d385aa35
Nain08/Python-Codes
/occurence of given character.py
172
4.3125
4
#count the occurence of a given character s1=input("Enter a string:") c=input("Enter a character:") for x in s1: n=s1.count(c) print("Occurence of given character:",n)
b879e428442e6c5b9716dfc11732bd86549ca30c
ryumaggs/ryumaggs.github.io
/downloads/changeMaker.py
484
3.953125
4
# This program takes an amount of change from the user, and computes the # numbers of each coin using the smallest total number of coins possible. remainder = eval(input("Enter the total amount in cents (<100) ")) quarters = remainder // 25 remainder = remainder % 25 dimes = remainder // 10 remainder = remainder % ...
917c9f2d37fb10ff4167ba094d422abed8d9883c
Riturajvats/Python-Codes
/if.py
174
4
4
num1 = 100 num2 = 100 if num1>num2: print("num1 is greater than num2") elif num2>num1: print("num1 and num2 are equal") else: print("Both number are equal")
fc0ef6a13249f60d9100ef8837ae193ee8aed349
MinenoLab/ict-ai-seminar1-2019
/03/ex3-6_func.py
452
3.765625
4
def div(bunshi_value, bunbo_value): answer = bunshi_value / bunbo_value return answer while True: print("分子を入力してください: ", end="") bunshi = input() print("分母を入力してください: ", end="") bunbo = input() if float(bunbo) == 0: print("分母0を検知しました") else: answer = div(flo...
35fa5431ecda5cc5da3a3f28f6d652359bd1bb74
slott56/building-skills-oo-design-book
/demo/tests/test_hw_1.py
991
3.65625
4
""" Mastering Object Oriented Design, 4ed. Example tests using :class:`unittest.TestCase` """ from io import StringIO from unittest import TestCase from unittest.mock import Mock, patch import hw class TestGreeting(TestCase): def test(self): g = hw.Greeting("x", "y") self.assertEqual(str(g), "x y...
b8e702ac9b94cec513fa556145f50b64173bdc30
RicardoBernal72/CYPRicardoBS
/libro/ejemplo1_13.py
233
3.546875
4
CAL1=int(input("calificacion 1")) CAL2=int(input("calificacion 2")) CAL3=int(input("calificacion 3")) CAL4=int(input("calificacion 4")) CAL5=int(input("calificacion 5")) PROMEDIO= (CAL1 + CAL2 + CAL3 + CAL4 + CAL5)/5 print(PROMEDIO)
fdc3194901afcd31173461b2d874acce07fb51b5
SatrioPratama75/Lab2
/Menentukanbilanganterbesar.py
393
3.9375
4
#Menentukan bilangan terbesar menggunakan statement if print("~"*39) kelereng_udin = input("Udin memiliki kelereng sebanyak : ") kelereng_budi = input("Budi memiliki kelereng sebanyak : ") if kelereng_udin == kelereng_udin: if kelereng_udin > kelereng_budi: print("Benar, kelereng Udin lebih banyak ") ...
f168262e84a4eeeedc955e6ca6924df5820ce06a
aoakes356/CS351A4
/wah.py
7,555
3.546875
4
### ### # Assignment 4 | by Andrew Oakes | WAH compression test # # # ### ### import os # This is imported ONLY to get file size. before and after c...
2daed4b9dc32fdcbdcb726771ed4bd9150a207b1
Davidhfw/algorithms
/python/binarysearch/33_searchRevolveOrderArray.py
1,693
3.625
4
# 假设按照升序排序的数组在预先未知的某个点上进行了旋转。 # # ( 例如,数组 [0,1,2,4,5,6,7] 可能变为 [4,5,6,7,0,1,2] )。 # # 搜索一个给定的目标值,如果数组中存在这个目标值,则返回它的索引,否则返回 -1 。 # # 你可以假设数组中不存在重复的元素。 # # 你的算法时间复杂度必须是 O(log n) 级别。 # 解题思路 # 使用二分发查找数组,可能会找到一个有序的数组,如果没有,可以继续二分,最终一定可以找到一个有序数组, class Solution(object): def search(self, nums, target): if not nums...
8d84f3832420496eeced2c041c0ae5e1c04778a2
almirderland/pp2
/1attestation/sis1/5.py
165
3.96875
4
x1 = int(input()) x2 = int(input()) x3 = int(input()) if x1 == x3 == x2 : print('3') elif x2 == x3 or x1 == x2 or x1 == x3 : print('2') else: print('0')
d6ac6516fa911cc4d1ddcd988d4983ae167b9245
Hoop77/PythonSimplexAlgorithm
/linearProgram.py
15,260
3.796875
4
from fractions import Fraction import numpy import math class LinearProgram: def __init__( self, targetFunction, restrictions, baseVariables, nonBaseVariables, lexicographic ): """ targetFunction: Array of numbers having the form: [ b, c_1, ..., c_n ] representing the function: b + c_1*x_1...
5227674ac6fae53f5c88ad759dbc6fef9948fc7b
jjypainter/Pygame
/draw_circle2.py
586
3.640625
4
import pygame pygame.init() BLACK = (0, 0, 0) WHITE = (255, 255, 255) BLUE = (0, 0, 255) GREEN = (0, 255, 0) RED = (255, 0, 0) size = [400, 300] screen = pygame.display.set_mode(size) pygame.display.set_caption("Drawing Rectangle") done = False clock = pygame.time.Clock() while not done: clock.tick(10) f...
bd77362a8168950cdd93aeaf922b3272ca4119d0
mysourcese/shiyanlou-code
/jump7.py
83
3.625
4
for i in range(101): if i%7==0 or i%10==7 or i//10==7: continue else: print(i)
e9eb8b20f5e9a3341343764d7a9fb79fea1f3857
asanelnur/2021pp2
/TSIS1/If else/6.py
52
3.53125
4
a=2 b=2 c=5 d=5 if a==b and c==d: print("Hello")
2673db128dbfb64109f1543fe1f9c11fe10fd979
jeet23/AI-Game-Trees
/tree.py
3,048
3.65625
4
import random import pdb INFINITY = 10001 class Node(object): def __init__(self, data): self.data = data self.children = [] self.reordered_children = [] def add_child(self, obj): self.children.append(obj) self.reordered_children.append(obj) def insertNodes(root, branching, height, approx): level = height...
b4b29aac560fafbf9f559c30878b15ebf84a00e5
anaxronik/Eulers-tasks-python
/7.py
610
3.796875
4
# Выписав первые шесть простых чисел, получим 2, 3, 5, 7, 11 и 13. # Очевидно, что 6-ое простое число - 13. # # Какое число является 10001-ым простым числом? from is_simple import is_simple n = 10001 i = 2 simple_list = [] print(len(simple_list)) while True: if is_simple(i): simple_list.append(i) p...
086b20cb7aee749937790b366ce618338dfde7e7
sharmapradyumn/PYTHON-Adhoc
/removechar.py
172
3.859375
4
#!/usr/bin/python3 s = input("enter a string") i=0 s1="" for x in s: if s.index(x)==i: s1+=x i+=1 print("removed character string is") print("\n") print(s1)
af377640fbda906b74595bc685cfaf2b25e57ce2
CHALASS770/WorldOfGame
/CurrencyRouletteGame.py
1,299
3.71875
4
from random import * from time import sleep #in this game we must find the trust conversion from USD to ILS class CurrencyRouletteGame: def __init__(self, difficult): self.total_money = int(randint(5,1000)) #random the money in USD that the player must fnd the convert in ils self.intermin = 0 ...
cb1d7bd79a59b43a5d077081a3599788444574e2
ruddysimon/HackerRank-solutions
/Python/Introduction/Python If-Else.py
223
4.0625
4
n = int(input()) w = "Weird" nw = "Not Weird" # if n is odd if n % 2 == 1: print(w) # if n is even else: if 2 <= n <= 5: print(nw) elif 6 <= n <= 20: print(w) elif n >= 20: print(nw)
afce544deb8c096068401586b3c7b883d6b91856
alexander-colaneri/python
/studies/curso_em_video/ex027-primeiro-e-ultimo-nome-de-uma-pessoa.py
1,440
4.1875
4
# Primeiro e Último Nome de Uma Pessoa. # Descrição: Faça um programa que leia o nome completo de uma pessoa, mostrando em # seguida o primeiro e o último nome separadamente. class AnalisadorDeNomes(): '''Indica separadamente qual é o primeiro e o último sobrenome no nome completo indicado.''' def _init__...
1466772355c4666d8937e95413898a560c7039e7
bupthl/Python
/Python从菜鸟到高手/chapter9/demo9.08.py
1,449
3.875
4
''' --------《Python从菜鸟到高手》源代码------------ 欧瑞科技版权所有 作者:李宁 如有任何技术问题,请加QQ技术讨论群:264268059 或关注“极客起源”订阅号或“欧瑞科技”服务号或扫码关注订阅号和服务号,二维码在源代码根目录 如果QQ群已满,请访问https://geekori.com,在右侧查看最新的QQ群,同时可以扫码关注公众号 “欧瑞学院”是欧瑞科技旗下在线IT教育学院,包含大量IT前沿视频课程, 请访问http://geekori.com/edu或关注前面提到的订阅号和服务号,进入移动版的欧瑞学院 “极客题库”是欧瑞科技旗下在线题库,请扫描源代码根目录中的小程序码安装“极客...
daa86189a47dca4b0984417f13457f7f9065f95a
Minglee2018/Data_science
/Data_science_with_python/week1/bai6.py
126
3.515625
4
s = input("Enter string : \n ") w = int (input("Enter width : \n ")) k = 0 while k < len(s): print (s[k:(w+k)]) k +=w
9a42ded35525817559e7dbf41f96eb292a59c1b6
Nakibaman/python
/10.05.2019/odd_even_from_list.py
181
3.75
4
x=[1,2,3,4,5,9,10] even=0 odd=0 for i in range(0,len(x),1): if x[i]%2==0: even=even+1 else: odd=odd+1 print "No of even is ",even print "No of odd is ",odd
9bc8f399a141167165ae4da19395a49822ce5710
rajeshsvv/Lenovo_Back
/1 PYTHON/2 COREY SCHAFER/PART 2/38_class_variables.py
1,697
4.59375
5
# class variables that are shared among all instances of a class # instance variables contain data that is unique to each instance class Employee: raise_amount = 2.36 # class variable num_of_emps = 0 def __init__(self, first, last, pay): self.first = first self.last = last self....
82125770d13475ea42a916030ca0ac8ec2f326fc
WinrichSy/HackerRank-Solutions
/Python/CollectionsNamedtuple.py
389
4.03125
4
#Collections.namedtuple() #https://www.hackerrank.com/challenges/py-collections-namedtuple/problem from collections import namedtuple times = int(input()) Students = namedtuple('Students', ' '.join(input().split())) total = 0 for i in range(times): data = input().split() student = Students(data[0], data[1], d...
252020c337b849657069c2b920d4aaf50240392f
enxicui/Python
/PythonAssignments/p4.5/p4-5p3.py
330
3.921875
4
while True: amount=float(input('please enter your amount', )) tax_larger=amount * 0.6 * 0.135 tax_smaller=amount * 0.4 * 0.23 total =amount + tax_larger + tax_smaller if amount >= 0: print('total amount=',total) else: print('Amount of income must be >= 0. Please try again.') ...
6391bd2eb4bdb85c1f9b4d9fccf7b5b799135807
akshaykhadse/matlab-usage-stats
/parser/pop_ldap.py
817
3.578125
4
def pop_ldap(ip, active_csv, archive_csv): """ Finds LDAP UID for given IP from Portal Log Files. For multiple entries in log, latest UID will be returned. First active file will be queried followed by archived file. **Args:** *ip: String* IP address of client. *active_csv: Strin...
a9b11031143f0d4f1aff6ba3f7c9c0badaf470d6
herojelly/Functional-Programming
/Chapter 6/6_13.py
355
3.765625
4
# Gregory Jerian # Period 4 def main(): print("This program converts a list of strings to a list of ints.") Input = input("Enter a list of numbers separated by commas: ") strList = Input.split(",") print(toNumbers(strList)) def toNumbers(strList): for i in range(len(strList)): strList[i] = ...
a788fc1caffc05a3425000b04c8381110ccea6b9
DainDwarf/AdventOfCode
/2020/Day06/day06.py
841
3.9375
4
#!/usr/bin/python3 from collections import Counter def part_one(inp): count = 0 for group in inp.split('\n\n'): count += len(set(group.replace('\n', ''))) return count def part_two(inp): count = 0 for group in inp.split('\n\n'): group_len = len(group.split('\n')) for lett...
4ff322a8ecd874baefd5cc6b58fc3b18049beaf7
cebrusfs/kattis-examples
/en/revadd/output_validators/python2_judge.py
1,136
3.546875
4
#!/usr/bin/env python # ./validator input judge_answer feedback_dir [additional_arguments] < team_output [ > team_input ] from sys import stdin, argv import os import sys import re input_file = argv[1] ans_file = argv[2] feedback_dir = argv[3] judge_feedback = open(os.path.join(feedback_dir, 'judgemessage.txt'), 'w...
415320df9c59395d859c2fa07e32582ed6bffc80
pwang867/LeetCode-Solutions-Python
/0205. Isomorphic Strings.py
1,272
3.859375
4
# time/space O(n) # similar to #290 word pattern from collections import defaultdict class Solution(object): def isIsomorphic(self, s, t): """ :type s: str :type t: str :rtype: bool """ if len(s) != len(t): return False s_dict = defaultd...
20173b8dcd3bd7b39b13f2f072340b1a6725ed2b
olagesin/Algorithm-Interview-Questions
/binary_tree.py
1,839
4.1875
4
""" implementing a binary tree using Classes and References """ class BinaryTree(object): def __repr__(self): return "Root of tree is {0} \n" \ "Left child is {1}\n" \ "Right Child is {2}\n" .format(self.key, self.leftChild, self.rightChild) def __init__(self, root): ...
7e61db983ebf4594d7f75b2a18274748a91f8cc7
shua-ti/Binsearch
/查找右边区间.py
594
3.75
4
#-*-coding=utf-8-*- #/usr/bin/env python "Ҽ" import bisect intervals=[[3,4],[2,3],[1,1.2]] def findRightInterval(intervals): intvl = sorted([(x[0], i) for i, x in enumerate(intervals)], key=lambda x: x[0]) starts, idx = [x[0] for x in intvl], [x[1] for x in intvl] res = [] for x in intervals: ...
80f69e7a2f542cd7ff7357d936b6e9fdd3782b35
justin-ho/security-tools
/crypto/vigenere.py
2,479
4.21875
4
#!/usr/bin/python """Python script to decrypt a vigenere cipher Uses the given key to shift the letters in the given message. -m, The message to encrypt using the key -k, The key to encrypt the message with -a, enumerate vigenere using keys in the dictionary -f, dictionary file -e, encrypt th...
a0fdb7711af550ff86faf975c61d7e4fd0a8e5db
coolxv/DL-Prep
/04_Algorithms/Leetcode/JZ15 反转链表.py
1,586
3.890625
4
import json class ListNode: def __init__(self, x): self.val = x self.next = None def stringToIntegerList(input): # print('input',input) return json.loads(input) # list 转换成链表 def stringToListNode(input): # Generate list from the input # numbers = stringToIntegerList(input) n...