blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
f8b01b3e9b6e2a3979cde4b563ba06c274f11e45
janvirighthere/projecteuler
/01_mult_three_five.py
240
4.5
4
def multiples(number): """Takes in a number and returns the sum of all numbers that are multiples of 3 or five""" sum = 0 for i in range(1, number): if i % 3 == 0 or i % 5 == 0: sum += i return sum
292c478494f5324435a68edf7230fff9b5d9ff2e
Sudheer-Movva/Python_Assignment01
/Assignment-1/Chap5/ChapFive30.py
2,882
4.3125
4
year,first_day =eval(input("Enter the year and the first day of the year: ")) if first_day%7 == 1: day_name = "Monday" elif first_day%7 == 2: day_name = "Tuesday" elif first_day%7 == 3: day_name = "Wednesday" elif first_day%7 == 4: day_name = "Thursday" elif first_day%7 == 5: day_name = "Friday" e...
479aebdde27dc2f13403abedb4f51efab1f14274
acanida0623/week2day1
/program.py
679
3.765625
4
import fibo print (fibo.fib(2000)) #enumerate returns each item as a tupell for i, n in enumerate(fibo.fib2(1000)): print("{0}: {1}".format(i,n,)) #The {0} and {1} are indexes of the enumerate values that i had place in the format method. {2} is going to print i #take ninthe fibo number and divide ...
7ee8328a9a33b47d50eb82b2aceb45e217068917
manjesh41/project_4
/9.py
293
4.28125
4
''' . Write a program to find the factorial of a number ''' num=int(input('Enter the number:')) factorial=1 if num<0: print('error') elif num==0: print('the factoral of 0 s 1') else: for i in range(1,num+1): factorial*=i print(f'The factorial of {num} is {factorial}')
6ce360d523aeba59e55618e05eb046308406ff1b
LichiSaez/mi_primer_programa
/comer_helado.py
912
4.25
4
apetece_helado_input = input("¿Te apetece un helado? (Si/No):").upper() if apetece_helado_input == "SI": apetece_helado = True elif apetece_helado_input == "NO": apetece_helado = False else: print("Te he dicho que me digas si o no, no se que has dicho pero lo tomo como que no") apetece_helado = False ...
5406e10e7b398bf24a544490a0ba588e0ce2c621
sgarg87/sahilgarg.github.io
/code_bases/python_coding_practice/reverse_linked_list.py
1,960
4.0625
4
# Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class ReverseLinkedList: def __init__(self): pass def input_number_as_list(self, numbers_list): assert len(numbers_list) >= 1 previous_node = None ...
0afb28b346345116100fe18b25a67b86ff5e50d6
Sildinho/PPBA2021_AndreIacono
/ppybaAndreIacono_77.py
706
4.40625
4
# -- coding utf-8 -- """ Udemy - Programação Python do Básico ao Avançado 2021 - Andre Iacono - Seção 10: OOP (Python Object-Oriented Programming) - Aula: 77 """ # 77. Criando a sua primeira classe # classes # utilizamos para criar objetos (instances) # objetos sao partes dentro de uma class (instancias) ...
72374a38bdb9ec39143bbe586a0a3e92e10a1c5e
alvinlee90/TensorFlow-Tutorials
/04 Batch Normalisation/mnist_model.py
6,292
3.5625
4
""" CNN model based from the TensorFlow tutorial for the MNIST dataset (https://github.com/tensorflow/serving/blob/master/tensorflow_serving/example/mnist_saved_model.py) """ from __future__ import absolute_import from __future__ import division from __future__ import print_function import tensorflow as tf def c...
e7e8e0c7f9cc16870d0320726367a2f4e5d85b9d
daniel-reich/turbo-robot
/CszujsGawysQPJoyZ_0.py
1,600
4.0625
4
""" You're working for Jaffar in the newest game of Prince of Persia. The prince is coming to get the princess and you have to stop him. He's entering the castle on a horse, don't ask me why he's riding a horse... he just is! You're standing next to the cannon and you have to check if the aim / velocity / height is...
34ac2345aa4da35db46609f3e2c990f7692c20b2
jcshott/interview_prep
/cracking_code_interview/ch1_arrays-strings/ispermutation.py
400
4.0625
4
def is_permutation(str1, str2): """ check if one string is a permutation of another """ char_a = {} char_b = {} for a in str1: char_a[a] = char_a.get(a, 0) + 1 for b in str2: char_b[b] = char_b.get(b, 0) + 1 return char_a == char_b assert is_permutation("aabbcda", "cdababa") == True assert is_permutatio...
4d4d08aff07b671e154e427c8dd897e0e9674bdf
mariahmm/class-work
/8.1.2Answer.py
124
3.859375
4
def middle(m): return m[1:len(m)-1] numbers = ['1', '2', '3', '4' '5'] rest = middle(numbers) print(rest) print(numbers)
00ac58a6d615f9b876083903298c332bf120b059
davidbriddock/rpi
/learn-python/MicroMartSeries/turtle-shapes.py
269
4.0625
4
from turtle import * # set a shape and colour shape("circle") shapesize(5,1,2) fillcolor("red") pencolor("darkred") # move to the start penup() goto(0, -100) # stamp out some shapes for i in range(72): forward(10) left(5) tilt(7.5) stamp() exitonclick()
924f6dd747d81204ed0d4e14a2a2e1ff7dc7ef80
SANOOPKV/PythonLessons
/dictionary.py
259
3.671875
4
#!/usr/bin/env python # coding: utf-8 # In[1]: #Disctionary # In[2]: dict = {1:"Python",2:{"Cpp"}} print(dict[1]) # In[4]: print(1 in dict) # In[6]: print("Python" in dict) # In[9]: print(str(dict)) # In[10]: print(dict) # In[ ]:
b8f7d165c7bd6c6752df47c1bcd6a3a0210ba5ba
MIS407/ClassWork
/pandas_work.py
692
4.0625
4
""" we have read in our excel file using pd.read_excel(io, sheetname='somename', index_col='colname') import pandas as pd Read excel file name d SuperstoreSales.xlsx create a logical file name fn = 'C:/myPy/SuperstoreSales.xlsx' Read into a data frame df = pd.read_excel(fn, sheetname='Orders', index_col='Order Dat...
cc72eb178bdc51fd2beaa7350d7a2cc8f2fbcb1d
techgymjp/techgym_python
/U2gr.py
153
3.9375
4
number = 3 if number == 1: print('1です') elif number == 2 or number == 3: print('2か3です') else: print('条件に当てはまりません')
4a31adb0f713309db63fd4771bf4935a5e38c52e
fuckdinfar/project-hehehehhehe
/Stats_project1.py
1,785
3.546875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Nov 1 13:27:24 2018 @author: Thomas, Frederik """ import numpy as np def dataStatistics(data, statistic): #Calculates mean Temperature if statistic == 'Mean temperature': result = np.mean(data[:,0]) #Calculates mean Growth rat...
7a7370bec2a2fe6c22d55fd23a499e5ff0df9306
hquanitute/unit_test
/testFile.py
1,082
3.75
4
import unittest execfile('D:/KLTN/UnitTest/Python/basic/reverse-a-string.py') class TestReverseString(unittest.TestCase): def test_should_return_string(self): self.assertEqual(type(reverseString("hello")) is str, True, "{{%<code>hello<code> should be return String%}}") print("{{<code>hello<code> s...
6b6e9b8f3553ece126889f27055c48dc5fb3bc7e
Aakancha/Python-Workshop
/Jan19/Assignment/List/Q2.py
241
3.75
4
n = int(input("Enter number of items: ")) listn = [] for each in range(n): i = input("Enter item: ") listn.append(i) cnt = 0 for each in listn: if len(each) >= 2 and each[0] == each[len(each)-1]: cnt += 1 print(f"{cnt}")
89e07aa21f7d6744ef0d6ecfbc70422c4c12cb38
gnikolaropoulos/AdventOfCode2020
/day01/main.py
1,646
3.984375
4
from itertools import combinations def solve_part_1(puzzle_input): for a, b in combinations(puzzle_input, 2): if a + b == 2020: return a * b return "" def solve_part_2(puzzle_input): for a, b, c in combinations(puzzle_input, 3): if a + b + c == 2020: return a * b ...
9327604254218d96fd33ce44ded5e7f50d6f7416
liuchangling/leetcode
/竞赛题/第 190 场周赛/5418. 二叉树中的伪回文路径 .py
1,426
3.71875
4
# 5418. 二叉树中的伪回文路径 # 题目难度Medium # 给你一棵二叉树,每个节点的值为 1 到 9 。我们称二叉树中的一条路径是 「伪回文」的,当它满足:路径经过的所有节点值的排列中,存在一个回文序列。 # 请你返回从根到叶子节点的所有路径中 伪回文 路径的数目。 # Definition for a binary tree node. class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = r...
39c4648f52aae00000f239e9f86ed17617b2e2e6
Surya0705/Pythagoras_Theorem_in_Python
/Main.py
588
4.5625
5
import math # Importing the math module for Square Root. a = float(input("Enter the Measure of First Side: ")) # Taking the Measure of the First Side as Input from the User. b = float(input("Enter the Measure of Second Side: ")) # Taking the Measure of the Second Side as Input from the User. c = (a ** 2) + (b ** 2) #...
810876bfb394350d84319e3d6f5f05e9db55d5fa
jiayaozhang/taichi
/lsys.py
2,528
3.53125
4
from math import sin, cos, radians class Lsystem: def __init__(self): self.axiom = "F" self.angle = 22.5 self.length = .05 self.rules = { "F": "FF+[+F-F-F]-[-F+F+F]" } def custom(self, ax, ang, rules, length=.05): self.axiom = ax self.angle ...
d3c387b052af624f65eeb0f6fc47a4c3a074e1ca
marcingorecki/crazy-pigeon-studios
/pigeon_school/pigeon school.py
141
3.640625
4
print "Welcome to pigeon school" print for a in range (1,6): for b in range (1,6): print "%s + %s = %s" % (a, b, a+b) print
13fdaede655fe32092ae2e0a30cbce205f040e5a
SimpleLogic96/cs_problem_sets
/a04_string_processing/a04_strings_puzzles.py
1,205
3.96875
4
#PtI: String Processing Puzzles #Reveres Function def reverse(s): reverse_text = s[len(s):: -1] return reverse_text #Test print(reverse('blackbird')) #Every Other Function def every_other(s): every_other_text = s[:len(s):2] return every_other_text #Test print(every_other('blackbird')) ...
e61e4af53563e2a8b3f62e69797e1a2a9d1c1f8f
Aasthaengg/IBMdataset
/Python_codes/p02846/s267827015.py
991
3.71875
4
#!/usr/bin/env python3 import sys INF = float("inf") def solve(T: "List[int]", A: "List[int]", B: "List[int]"): if A[0] < B[0]: A, B = B, A if A[1] > B[1]: print(0) return elif A[0]*T[0]+A[1]*T[1] > B[0]*T[0]+B[1]*T[1]: print(0) return elif A[0]*T[0]+A[1]*T[1]...
5f292a4f5a4eac811e94b51c9e6a7ddd4f303ccf
yuchanmo/python1_class
/ch4/palindrome.py
754
3.953125
4
def pallindrome(): p_candidate = input("type your pallindrome candidate : ") print('here is your pallindrome',p_candidate) p_candidate = p_candidate.lower() print('after lowering characters ==>',p_candidate) isp_candidate = True p1 = 0 p2 = len(p_candidate)-1 while isp_candidate and p1<...
bc79cfdc032c72dbaa0d5ec12eff996326930c8f
AtharvaTiwari56/ATM
/atm.py
1,539
4.03125
4
class Atm: def __init__(self, cardnum, pinnum, balance): self.pinnum = pinnum self.cardnum = cardnum self.balance = balance def cashWithdrawal(self): amount = int(input("Enter the amount you want to withdraw:")) pin = int(input('Verify PIN number')) if(a...
c31f4ad74a3bdf4bb368d67664e5a22144b9d3c6
act5924/MomLookImCoding
/plots_cli.py
3,250
3.90625
4
''' Arthur Tonoyan Assignment 5.2 ''' import plots def student_average(): while True: lst = input('Enter the... File FirstName LastName (Enter to go back): ') bst = lst.split() if lst == '': return True try: if len(bst) > 3: raise IndexError ...
52c2029295f2f49244a37d8ee02716a9cd56e4c9
Lwk1071373366/zdh
/S20/day02/03作业.py
3,721
3.734375
4
# print(bool('1>1or3<4or4>5and2>1and9>8or7<6')) # print(bool('not2>1and3<4or4>5and2>1and9>8or7<6')) # TRUE # 利⽤while语句写出猜⼤⼩的游戏: # 设定⼀个理想数字⽐如:66,让⽤户输⼊数字,如果⽐66⼤,则显示猜测的结果⼤ # 了;如果⽐66⼩,则显示猜测的结果⼩了;只有等于66,显示猜测结果正确,然后退出 # 循环 # num = 66 # while True: # num = int(input('请输入一个数字:')) # if num > 66: # print('大了')...
7858582492fadaf24fedaad03a02f326cdc6c021
ZordoC/How-to-Think-Like-a-ComputerScientist-Learning-with-Pytho3-and-Data-Structures
/5.4.6.1_without_col_5.py
439
3.625
4
strin = "ThiS is String with Upper and lower case Letters" def cunt_letters(s): s= string.lower() s = s.split() s = "".join(s1) pint(s2) 0 1 2 ltter_counts = {} 3 4 fr l in s2: 5 letter_counts[l] = letter_counts.get(l ,0)+1 6 7 8 _ist = list(letter_counts.items()) 9 _ist.sort() ...
b5cedd51003cb2531c11325249d90cf5ebcd0a73
KATO-Hiro/AtCoder
/ABC/abc001-abc050/abc031/c.py
1,173
3.59375
4
# -*- coding: utf-8 -*- def main(): n = int(input()) a = list(map(int, input().split())) ans = -float('inf') # See: # https://www.slideshare.net/chokudai/abc031 for first in range(n): # aに負の値があるため,0で初期化するとマズい # See: # https://atcoder.jp/contests/abc031/sub...
4e6e1358db5cc44ad7de58508df1d60109c3e4c9
666syh/python_cookbook
/python_cookbook/2_string_and_text/2.5_字符串搜索和替换.py
692
4.03125
4
""" 问题 你想在字符串中搜索和替换指定的文本模式 """ # 简单的替换 text = 'yeah, but no, but yeah, but no, but yeah' print(text.replace('yeah', 'yep')) # yep, but no, but yep, but no, but yep # 复杂的替换 text = 'Today is 11/27/2012. PyCon starts 3/13/2013.' import re print(re.sub(r'(\d+)/(\d+)/(\d+)', r'\3-\1-\2', text)) # Today is 2012-11-27. PyCo...
45c9008852a14be6d6244e59886bd4667bb9fb32
Giby666566/programacioncursos
/programa1.py
117
3.875
4
print("Dame un numero") a=input() b=input("Dame otro numero") print(int(a)+int(b)) print(a-b) print(a*b) print(a/b)
4553542e1122be8eb1ac7ce6730c37acf1df6703
judDickey1/Codewars
/findMissingLetter.py
238
3.875
4
from string import ascii_letters def find_missing_letter(chars): start = ascii_letters.index(chars[0]) for char, match_char in zip(chars,ascii_letters[start:]): if char != match_char: return match_char
c85ce19c20cccf2abcbb5ea3b9ef301b8656525e
n-apier/CC-CS-PRACT
/Misc_Functions/dna.py
740
3.75
4
dna_1 = "ACCGTT" dna_2 = "CCAGCA" def longest_common_subsequence(string_1, string_2): print("Finding longest common subsequence of {0} and {1}".format(string_1, string_2)) grid = [[0 for col in range(len(string_1) + 1)] for row in range(len(string_2) + 1)] for row in range(1, len(string_2) + 1): print...
b87ef074a7d143c3006bad66ab57fae2c6409cc8
raal7102/raghad
/week9_exercise3.py
275
3.671875
4
import sys #print "Number of arguments: ", len(sys.argv), 'arguments' #print "Argument List:", str(sys.argv) userNumber1 = int(sys.argv[1]) userNumber2 = int(sys.argv[2]) sum = userNumber1+userNumber2 print "The sum of the two numbers you entered is: ", sum
ee732f92e1574a35409a575e238488710456bb28
SmatMan/password-cracking
/random-with-no-confirmation.py
390
3.671875
4
import random import string alpha = dict(enumerate(string.ascii_lowercase)) password = input("Password: ").lower() maxLength = len(password) while True: temp = "" for i in range(maxLength): tempCharGen = random.choice(alpha) temp = temp + tempCharGen print("testing: " + temp) if te...
72cd6bc57927b9dd01498b2fd77a4a403a38e0ae
nptravis/python-studies
/try_except.py
735
3.609375
4
# f = open('testfile.txt') try: # f = open('test_file.txt') # var = bar_var f = open('corrupt_file.txt') if f.name == 'corrupt_file.txt': raise Exception # pass # except Exception: # will catch many other exception errors # print("Sorry, this file does not exist") # # pass # except FileNotFoundError: # make ...
c55a72a9c6b892371d328ac47264f018eeca0778
JoeyCipher/Kattis-Solutions
/Python/shiritori/shiritory.py
550
3.515625
4
list = set() cases = int(input()) fair = True for i in range(cases): curr = input() if curr in list: if i % 2 == 0: print("Player 1 lost") else: print("Player 2 lost") break list.add(curr) if i != 0: if lLetter != curr[0]: fair = False ...
ea0c94b0987d9e4ad39bbd72d6fad1b293670bea
amit5570/python
/label_tk.py
308
3.734375
4
from tkinter import * root=Tk() root.title("LABEL") def disply(): print('Name '+ent1.get()) l1=Label(root,text="Enter Name: ") ent1=Entry(root) b1=Button(root,text="Submit",command=disply,bg="black",fg="white") l1.grid(row=0,column=0) ent1.grid(row=0,column=1) b1.grid(row=1,columnspan=2)
e43dec94279a2fe46fa7efc67d8b1095059fd179
svnavytka/lv-485.2.PythonCore
/CW_4.py
1,631
4.1875
4
#Task 1 Which value is bigger a=int(input("Enter first number ")) b=int(input("Enter second number ")) if a>b: print('First value is more then Second') else: print('Second value is more then First') #Task 2 Even or Odd value z=int(input("Enter any number ")) if z%2==0: print ("Even number") ...
88c7ded1d2ecff45526b0abebfd3523631df8503
Fliv/my-leetcode
/roman-to-integer.py
633
3.578125
4
class Solution(object): def romanToInt(self, s): """ :type s: str :rtype: int """ strTable = {'I': 1, 'V': 5, 'X': 10, 'L': 50, 'C': 100, 'D': 500, 'M': 1000} romanSum = 0 for i in range(len(s)): if i == len(s) - 1: romanSum += strT...
ad786ec83d96250508b1af575e7167a6ad75e87c
Souravvk18/DSA-nd-ALGO
/Data Structures/array_rotation.py
892
3.8125
4
# import sys # def leftRotation(a, d): # out = list(a) # a_len = len(a) # for ind, el in enumerate(a): # out[(ind + a_len - d) % a_len] = el # return out # if __name__ == "__main__": # n, d = input().strip().split(' ') # n, d = [int(n), int(d)] # a = list(map(int, input()....
89593271b035f5a0d0facde0f31850033d08efa8
alinenecchi/AULAS_ALGORITIMOS_III
/aula03/main.py
3,045
4.0625
4
from data import Data if __name__ == '__main__': def verificaData(): print("Digite uma data") dia, mes, ano = input('Data (dd/mm/aaaa): ').split('/') dataP= int(dia),int(mes),int(ano) data = Data._valida(dataP) print("{}/{}/{}".format(dia,mes,ano)) if data == Tr...
3867b67cd796ee73ade0f756ec132326d38c41e0
rohinikavitake/pa
/char_range.py
114
3.734375
4
pharse="This is an example sentance. Lets see if we can find letters" print(re.findall('[a-z]+',pharse)) print()
cd03b7b76bfb8c217c0a82b3d48321f8326cc017
jnassula/calculator
/calculator.py
1,555
4.3125
4
def welcome(): print('Welcome to Python Calculator') def calculate(): operation = input(''' Please type in the math operation you would like to complete: + for addition - for substraction * for multiplication / for division ** for power % for modulo ''') number_1 = int...
74ed32084e927932f5e2ad7d0007294225ade577
JumiHsu/HeadFirst_python
/Simon_discuss_01/Simon_discuss_01_rewrite01.py
9,130
3.796875
4
import random import math import time # ============================================================================= # 生成一個隨機向量 (input= 長度上限,元素值上限) # ============================================================================= def generateList(lengthMax,elementMax): A=[] length=random.sample(range(1,lengt...
dcdb4f3cb8d8363d5d2f6e86ec4fa5fdabb60b4f
Buremoh/fibonacci-ageFind-timeZone
/time-zone.py
1,011
3.546875
4
from datetime import datetime from pytz import timezone fmt = "%Y-%m-%d %H:%M:%S %Z%z" # get the current time in UTC now_utc = datetime.now(timezone('UTC')) print('UTC :', now_utc) # Convert this to EST now_est = now_utc.astimezone(timezone('US/Eastern')) print('EST :', now_est) # Convert this to Berlin now_berlin ...
9bd98561d0dba03bbac528643bcd44c6ec87a495
millerg09/python_lesson
/dict_sandbox.py
343
4.03125
4
# create a mapping of people to numbers phone_numbers = { 'Gabe': '607.437.4130', 'Amy': '321.662.8623', 'Dad': '607.435.0122', 'Mom': '607.435.0537' } print "This is the original dict of numbers: \n\n", phone_numbers phone_numbers['New'] = "number not available" print "This is the new dict of number...
5c66634ab29b8d9303fefaa936169edd96663fdb
MichaelCoding25/Programming-School
/High_School/Python/24.09.17/name.py
116
3.75
4
name = "" while name!= 'your name': print 'Please type your name:' name= raw_input() print 'Well done!'
a0cb5530904823e33f54cf394f11408db0ab61e2
ISEexchange/Python-Bootcamp
/pythonbc_winners/view_extract_from_file.py
5,891
4.375
4
''' Function searches through a file and checks for the presence of a specified string. If there are any occurrences of this string, the function return True, otherwise False. The function also takes an optional parameter to provide an extract of x lines before and after the occurrence of the search string in the file....
ef1581c47e02e4124bf66090c87b3f841c2ad722
Hoon94/Algorithm
/Leetcode/257. Binary Tree Paths.py
652
3.75
4
from typing import List, Optional class TreeNode: def __init__(self, val=0, left=None, right=None): self.val = val self.left = left self.right = right class Solution: def binaryTreePaths(self, root: Optional[TreeNode]) -> List[str]: stack, ret = [(root, "")], [] whil...
79f77de5dd47044ce54baef757330b24c7cf90de
MichaelShaneSmith/Code2040
/code2040_partII.py
582
3.515625
4
import requests urls = { 'reverse' : 'http://challenge.code2040.org/api/reverse', 'validate' : 'http://challenge.code2040.org/api/reverse/validate' } # Setup params1 = { 'token' : '<token>' } response1 = requests.post(urls['reverse'], data=params1) # Reverse word word = response1.text ans = word[::-1] # ^^ This i...
0b92ca1f61c3219a8c1e5a3ab19e76fc4900da40
sdbaronc/LaboratorioRepeticionRemoto
/Mayor.py
203
3.875
4
a= int(input("ingrese un numero entero")) if a >0: print ("el numero" + str(a) + "es mayor que 0") elif a == 0: print ("el numeroes igual a 0") else: print ("el numero" + str(a) + "es menor que 0")
f8b95e5f2931dec5a2cd4d8f3c20875b4a8b8290
gspillman/fun_with_python
/funwithcsv.py
2,435
4.25
4
#Hacking on CSV files! import csv import shutil from tempfile import NamedTemporaryFile #write a very basic CSV file #+w means read/or/write and overwrite an existing file or create a new one with open("templates/data.csv", "w+") as csvfile: writer = csv.writer(csvfile) writer.writerow(["Title", "Description"]) w...
74ab5f2e1b930965b34902b376ce8393f70fa2a2
karunaswamy1/Dictionary
/qu5.py
115
3.625
4
# list1=["one","two","three","four","five"] # list2=[1,2,3,4,5,] # for i in list1: # print(list1.keys()) #
213bd2740f3af9c22d6dcf6dec14ae23702f1076
clylau/E206_Labs
/Lab0/traj_tracker.py
2,212
3.609375
4
import time import math import random from traj_planner_utils import * TIME_STEP_SIZE = 0.01 #s LOOK_AHEAD_TIME = 1.0 #s MIN_DIST_TO_POINT = 0.1 #m MIN_ANG_TO_POINT = 0.10 #rad class TrajectoryTracker(): """ A class to hold the functionality for tracking trajectories. Arguments: traj (list of lists): ...
f775baa553afd29868bf6fd81ad767507ac31ae5
MattHill94/Python-hangman-game
/phrasehunter/game.py
2,200
3.734375
4
import random from .phrase import Phrase import string class Game(list): def __init__(self, *args): super().__init__() for phrs in args: self.append(Phrase(phrs)) self.active = random.choice(self) self.life = 5 self.choices_made = set() def res...
3d4a321bd71155c4a7fd746a7da5f28785cf6b1b
kxu12348760/ProgrammingInterviewExercises
/misc.py
1,119
3.65625
4
#!/usr/bin/python def expansions(original, relatedWords): results = [] strippedSentence = original.strip() words = strippedSentence.split(" ") if strippedSentence != "": firstWord = words[0] restOfSentence = " ".join(words[1:]) subExpansions = expansions(restOfSentence, relatedW...
17ca9ef1eac45553ea260f145c3f34055ce573f5
zhuyanzhe98/evaptransmission
/weather.py
1,360
3.515625
4
#!/usr/bin/env python # coding: utf-8 # In[116]: import csv import numpy as np import matplotlib.pyplot as plt # Weather data source: # https://www.ncdc.noaa.gov/cdo-web/datatools/lcd # In[119]: # Here consider Feb 1 as Day 1, different for a new data file def weatherdataprocess(filename): weatherdata = [] ...
54b7739c9327c9360c3b491b2ecbac5881e3a8f3
ramenkup/Madlib
/madlib.py
3,498
3.96875
4
vowl_list='aeiou' consinant_list='bcdfghjklmnpqrstvwxyz' ''' #def print_report(txt file) this method runs through a text file line by line and sums the number of vowls, consinants, punctuation, and white space. it then outputs them along with their percentages in a text box formatted by the homework outline ''' def pr...
fefabae50f638d4ac8d00622f98dd5f125a4de12
Krishan00007/Python_practicals
/AI_ML_visulizations/string_nullfilling.py
517
3.921875
4
import pandas as pd import numpy as np data=pd.read_csv('employees_with_missing_data.csv') #printing the first 10 to 24 rows of the data frame form visualization print( data[10:25] ) #Analyse the value of gender in RowIndex no 20 and 22 #Now we are going to fill all the null values in Gender column with "NO GENDE...
68b5a1c517c55ed324331051a1c7b5fe6a3accad
ZemiosLemon/HillelPythonBasic
/homework_05/task_2.py
267
3.59375
4
user_text = input() def main(text: str) -> (int, int): words = len(text.split()) symbols = len(text) return words, symbols print('Количество слов:', main(user_text)[0]) print('Количество символов:', main(user_text)[1])
a8a82701b2270f5eba020dd843f2998c9149e7bf
paulgryllz/DONE
/lab3ahsan.py
591
3.609375
4
def is_long(srz): return 'very long' if (len(srz) > 10) else 'kinda short' def longer(str1, str2): if len(str1) > len(str2): return len(str1) else: return len(str2) def earlier(str1, str2): if str1 < str2: return str1 else: return str2 def where(str1, str2): ...
a7eed180c94bfcc06bcad6fa498f0316df153fad
liusska/Python-Fundamentals-Jan-2021
/Final Exam Solutions/04.04.2020_2/emoji_detector_02.py
659
3.90625
4
import re pattern = r"([:]{2}|[*]{2})([A-Z]{1}[a-z]{2,})(\1)" data = input() matches = re.findall(pattern, data) cool_threshold = 1 for word in data: for ch in word: if ch.isdigit(): cool_threshold *= int(ch) emoji_count = len(matches) coolness_emoji = [] for match in matche...
ed9726dde5c3e88eea0e495cd880a10d0848e4ac
Jaden5672/Python_Coding
/list.py
779
4.375
4
fruits=["Apple","Apple","Bananas","Blueberry"] print(fruits) #duplicates are allowed in a list mixed=["Car",56,789,"cat",True,"bus"] print(mixed) #A list allows multiple data types print(type(fruits)) print(mixed[0:4]) print(mixed[:2]) mixed[0]= "Jeep" print(mixed) #you can change the values of a list, these...
e4b1591177816b550add00586b1c55fd3addbcff
Pittor052/SoftUni-Courses
/Python/Fundamentals/0.8-Text-Processing/More-Exercises/treasure_finder.py
749
3.53125
4
keys = [int(n) for n in input().split()] text= input() while text != "find": keys_i = 0 for i in range(len(text)): text = text[:i] + chr(ord(text[i]) - keys[keys_i]) + text[i + 1:] keys_i += 1 if keys_i == len(keys): keys_i = 0 treasure, coordinates = "", "" ...
2b986a453bcdb614b7bbf834becfc9a1c010c17c
percevalw/treeprinter
/treeprinter/tests/test_default_printer.py
1,639
3.5
4
from unittest import TestCase from treeprinter.printers.default_printer import TreePrinter class Tree(object): def __init__(self, tag, children=None): self.children = children or [] self.tag = tag class TestDefaultPrinter(TestCase): def setUp(self): self.tree = \ Tree("an...
3828dacb61ea45e62f75a183beb4d8c677fe1cba
mohanraj1311/leetcode-2
/evaluatReversePolish/main.py
773
3.5625
4
class Solution: # @param tokens, a list of string # @return an integer def evalRPN(self, tokens): stack = [] for t in tokens: if t in ["+", "-", "*", "/"]: a = stack.pop() b = stack.pop() s = b + '.0' + t + '(' + a + '.0'...
2687229bdc1950715af798d282ad4b70b1a75248
gflorianom/Programacion
/Practica4/Ejercicio6.py
266
3.921875
4
"""Biel Floriano Morey - 1 DAW - PRACTICA4 - EJERCICIO 6 Escriu un programa que demani l'alada d'un triangle i ho dibuixi de la segent manera:""" print "Dime la altura del triangulo" a=input() for i in range(1, a+1): for j in range(i): print "*", print " "
4a5bb679a7fe9362ba4c4af787b4779880f7dc89
andreodendaal/coursera_algo_toolkit
/week3_greedy_algorithms/4_collecting_signatures/covering_segments2.py
2,624
3.6875
4
# Uses python3 import sys from collections import namedtuple import operator Segment = namedtuple('Segment', 'start end') def optimal_points(segments): points = [] common_points = [] #write your code here segments.sort(key=operator.itemgetter(0)) intersected = set() for s in segments: ...
84a936413a2b79d8ce2f41a6642dae7034421c3d
stefanocovino/SRPAstro
/SRP/TimeAstro.py
11,111
3.90625
4
"""Adapted from Practical Astronomy with your Calculator. By Peter Duffett-Smith""" # Bugs in version 1.6 # Modified by stefano Covino (covino@mi.astro.it), 10 Aug 2003 from .TimeAstro_algs import * Error='astro.Error' class Time: """ Class to handle time requirements. Initialize with 3 arguments: longit...
205839f94fed14c48c703d2120aeef40de935f92
wuhaochen/kutils
/examples/grader.py
2,562
3.734375
4
import kutils import random # Implement your own question class following instructions in # each function. class SumQuestion(kutils.KQuestion): # Used to identify your class. # DO NOT CHANGE _name = 'Sum Question' # Initializer. The specification of the problem should # be initilized here. ...
4d58d61a87a6b51265ebd821ede8897de3441db0
MissSheyni/HackerRank
/Python/Sets/py-set-intersection-operation.py
218
3.65625
4
# https://www.hackerrank.com/challenges/py-set-intersection-operation _ = raw_input() M = set(map(int, raw_input().split(" "))) _ = raw_input() N = set(map(int, raw_input().split(" "))) print(len(M.intersection(N)))
7f07ec309d8360ab094042ec6152c8e3c0c87ec1
PrangeGabriel/python-exercises
/ex070.py
891
3.640625
4
nome = fim = nomebarato = '' preco = ptotal = contprodk = maisbarato = contcomp = 0 print('.:|:.' * 3, 'Supermercado BIG BALDE', '.:|:.' * 3) while True: nome = str(input('QUal o nome do produto?')) preco = float(input(f'Qual o preço do {nome}?')) ptotal += preco contcomp += 1 if preco > 100...
f419d2356d38610375261a81f24fc47873070644
tedye/leetcode
/tools/leetcode.002.Add Two Numbers/leetcode.002.Add Two Numbers.submission15.py
826
3.671875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # @return a ListNode def addTwoNumbers(self, l1, l2): s = (l1.val + l2.val) % 10 carry = (l1.val + l2.val) // 10 head = ListNode(s) ...
2d1bc79931cee4b40665af15e09f337a8de8ecd9
amit19-meet/meet2017y1lab4
/turtle_party.py
264
4
4
strawberries = 39 is_weekend = True if is_weekend: if strawberries > 39: print("Fun") else: print("Not fun") else: # weekday if strawberries > 39 and strawberries < 61: print("Fun") else: print("Not fun")
9f78ca9755c70655b8b74df2def537fa0d44efd9
anjalilajna/Bestenlist
/day10.py
1,157
3.8125
4
#1. import re def check(string): charRe = re.compile(r'[^a-zA-Z0-9.]') string = charRe.search(string) return not bool(string) str=input() #gdg27ASF print(check(str)) #true #2. import re def match(text): if re.search('\w*ab.\w*', text): return 'matched' else:...
75eb5916dd140f40e30fa3872ee18b79fa0732f2
fredy-glz/Fundamentos_de_Programacion_en_Python_Curso
/Modulo_04/34_ProyectoTICTACTOE.py
1,927
3.828125
4
from random import randrange def DisplayBoard(board): print("+-------+-------+-------+") for col in board: print("|\t|\t|\t|") print("| ", end=" ") for fil in col: print(fil, " | ", end=" ") print("\n|\t|\t|\t|") print("+-------+-------+-------+") def En...
b1e73571def58d26120d767bab52ca0d5822878f
MiroVatov/Algorithms-and-Data-Structures
/Algorithms and Data Structures Tutorial - Full Course for Beginners/Sorting and Searching/quick_sort_search_names.py
288
3.5
4
from quick_sort import quicksort from load import load_strings unsorted_names = load_strings('names/unsorted.txt') sorted_names = quicksort(unsorted_names) file = open('names/sorted.txt', 'w') for n in sorted_names: file.write(n + '\n') print(n) file.close()
9fad8ae6dc61908027124d8b05aee77409111e8a
CyberSecurityUP/Python-Introduction
/exercicio função.py
1,180
4.03125
4
#Problema: Faça um programa que tenha uma função chamada escreva(), que receba um texto qualquer # como parâmetro e mostre uma mensagem com o tamanho adaptável. # Função para imprimir mensagens dentro de cabeçalho com bordas def escreva(mensagem): print('-' * (len(mensagem) + 4)) print(f' {mensag...
76537c8170559803e53c7956e22bea6373c0e05d
aoruize/Machine-Learning
/regression/regression.py
1,065
3.578125
4
from statistics import mean import numpy as np import matplotlib.pyplot as plt from matplotlib import style style.use('fivethirtyeight') xs = np.array([1,2,3,4,5,6], dtype=np.float64) ys = np.array([5,4,6,5,6,7], dtype=np.float64) def best_fit_slope_and_intercept(xs, ys): m = (((mean(xs) * mean(ys)) - mean(xs *...
8ce457e3d773ade5db9353d9a3e063e7b5e012ec
LiFulian/LearnPython
/01.网络编程/tcp-client.py
670
3.546875
4
import socket def main(): # 1. 创建tcp的套接字 tcp_scoket = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # 2.链接服务器 server_ip = input("请输入要连接的服务器的ip:") server_port = int(input("请输入要链接的服务器的port:")) server_addr = (server_ip, server_port) tcp_scoket.connect(server_addr) while True: ...
cb21b4ab6885aff5693517342e185f1a730a737f
bhupendpatil/Practice
/Python/Program based on loop for prime numbers.py
179
4
4
# Program based on loop for prime numbers prime1 = int(input(("How many outputs you want: "))) i = 1 while i <= prime1: if i%2 != 0 and i>2: print(i) i = i + 1
979f45ff9a1d46849ad0016cc6bec930b5cb78ce
pf1990623/py-gs-lean
/student_day3/oldboy_4.py
844
3.625
4
# 4、 写函数,检查传入字典的每一个value的长度,如果大于2,那么仅保留前两个长度的内容,并将新内容返回给调用者。 # dic = {"k1": "v1v1", "k2": [11,22,33,44]} # PS:字典中的value只能是字符串或列表 dic = {"k1": "v1v1", "k2": [11, 22, 33, 44]} def fun4(dict_data): for k in dict_data.keys(): print(k, dict_data.get(k)) if len(dict_data.get(k)) > 2: ...
0917db04d4d77b9c408039f7761c8dcf7f189d78
RenegaDe1288/pythonProject
/lesson21/mission1.py
215
3.921875
4
def count(start, end): if end != start: print(start, end=' ') return count(start+1, end) else: print(start) num = int(input('Введите число: ')) count(start=1, end=num)
d9ec6a708c1efee6e02179894f15160ab993a33c
Leopbrito/Curso_em_Video
/Python/Exercicios/012.py
150
3.6875
4
p = float(input('Digite o preço do produto: R$')) print('Valor do produto: R${:.2f}\nValor do produto com 5% de desconto: R${:.2f}'.format(p,p*0.95))
5a083633fede80a18656aa75b08f8d328c5b7446
worklifesg/Computer-Vision-Algorithms-and-Projects
/2-Image Enhancement using Histogram Equalization/1-histogram-equalization-and-CLAHE-opencv.py
1,235
3.53125
4
''' Program to apply histogram equalization and CLAHE algorithm using OpenCV Credits: PyImageSearch ''' import cv2 image1 = '1_Chest_XRay.jpg' image2 = '2_BrainTumor.jpg' image3 = '3_HandSkeleton.jpg' imagePaths = [image1,image2,image3] ### text on images text1 = 'HISTOGRAM EQUALIZATION' text2 = 'CLAHE' color = (0,...
7837688649e4cdc954a8592ffa99c0c3277cda59
sudhanvalalit/Koonin-Problems
/Koonin/Chapter2/Exercises/Ex4.py
3,732
3.65625
4
""" Exercise 4: Try out the second-, third- and fourth-order Runge-Kutta methods discussed above on the problem defined by Eq. (2.7). Compare the computational effort for a given accuracy with that of other methods. """ import numpy as np def f(x, y): return -x*y def RK2(f, x0, xe, y0, h): times = np.arange...
e4268599c81c1f461b2a9d0f9c42f55ab6bf63f1
yanky2000/ud_course_backend
/test.py
220
3.90625
4
import encrypt s = "some text" s1 = "abc" z = enumerate(s) t = [t for t in enumerate(s)] l = list(s) print s1[-1] # dic = encrypt.Rot13().encrypted_dic() # for char in s: # print char, chr(ord(char)+13) # print dic
3a1ce12cd7d388aa994fcb27a00888339bd56807
frankieliu/problems
/leetcode/python/1021/sol.py
1,976
3.609375
4
[Java/C++/Python] One Pass https://leetcode.com/problems/best-sightseeing-pair/discuss/260850 * Lang: python * Author: lee215 * Votes: 49 Hope some explanation in this [video](https://www.youtube.com/watch?v=AxVUCzee-XI) (chinese) can help. The link is good, preview is somehow broken on the Leetcode. ## **In...
4d8aa8c36171bb6d7180593fdd437dc77e5498fd
hanking356/python_practice
/day1/pack01/multi_data.py
1,079
3.53125
4
food = ['아이스크림','아이스아메리카노','생수'] #목록(list) # hobby = [] print(food[0]) print(food[1]) print(food[2]) #food의 요소 3개를 변수 i로 순서대로 print 함 for i in range (0,3): print(food[i], end='') print() #food에 있는 요소를 차례대로 하나씩 뽑아서 print 함 for x in food: #for-each print(x, end='') ###### #오늘 끝나고 나서, 할 일 5가지를 목록으로 만들어보세요. #2가...
559298441349290383d7d6d1cf28655d3d8c4c2f
Tatz18/Web-Crawler
/json-url.py
554
3.859375
4
import urllib.request as ur import urllib.parse as up import json # for manually input the url json_url = input("Enter the url >>> ") json_url = "https://python-data.dr-chuk.net/comments_22962.json" # url for the data(in json) print('Retrieving ', json_url) data = ur.urlopen(json_url).read().decode("utf-8") print("R...
c9ebce1600c9f8c38eb0a413c38dcb1f4e9990ce
Damianpon/damianpondel96-gmail.com
/zjazd 2/sklep_spozywczy.py
1,993
3.984375
4
produkty = {"pomidory": 4, "malina": 8, "banan": 2, "jabłko": 4.4} magazyn = {"pomidory": 10, "malina": 10, "banan": 10, "jabłko": 10} def sklep_spozywczy(): lista_zakupow = dict() koszt = list() print("Dzień dobry! W czym możemy pomóc?") while True: print("Jeśli chcesz kupować to naciśnik- k...
a37c385c45a17c7b2d70204519a3c4a8d20f5515
Drishtant-Shri/seglearn
/examples/plot_imblearn.py
2,720
3.5625
4
""" =============================== Simple imbalanced-learn example =============================== This example demonstrates how to use imbalanced-learn resample transforms inside a seglearn Pype. """ # Author: Matthias Gazzari # License: BSD import numpy as np from sklearn.dummy import DummyClassifier from segle...
43e75644a2d81551e4c45f0b40078bf96356e49d
minininja/crap-fibonacci
/src/python/fib.py
102
3.5625
4
def fib(n): if n == 0: return 0 if n <= 2: return 1 return fib(n-1) + fib(n-2) print(fib(45))
f04d32cb757a50fe7ad0ccacf74c8b5354317d99
pogostick29dev/LL-Python
/CInput.py
206
4.03125
4
name = input("What is your name?\n") print("Hello, " + name + "!") age = int(input("What is your age?\n")) age2 = int(input("What is your friend's age?\n")) print("Your combined age is " + str(age + age2))
c2cd3898acefc79a9059e223c6afd5cc604cc251
jasonwbw/jason_putils
/putils/tools/words_length.py
3,185
4.15625
4
#!/usr/bin/env python # -*- coding: UTF-8 -*- # # count how much word in one line, get the statistics result # # @Author : Jasonwbw@yahoo.com import sys des = '<input file name> [-p parts] [-c threshold]' + \ '\n\tcompute average word count for each line, default will print out int average length, standard varian...
889e7a85a3df22fac5730d1de9a2d00a39dab40e
rafaelnunes44/pythonGuanaba
/Desafio 08 Conversor medidas.py
280
4.09375
4
""" 08. Escreva um programa que leia um valor em metros eo exiba convertido em centimetros e milimetros """ n1 = int(input('Digite um valor em metros , para ser convertido em cm e mm: ')) cm = n1 * 100 mm = n1 * 1000 print('{}m, equivale a {}cm e {}mm '.format(n1, cm, mm))
0d81de91db63d3b09e947662aaab6e2153bf1dbe
DimaRubio/Python3_SeleniumWD
/python_basic/sec3_variables/string.py
1,270
3.8125
4
class StringWrapper: def convert_case(self, s, case ="lower"): res = s.lower() if case=="lower" else s.upper() print("*"*10, "\nPrevious value is: {0}\n" "Current value is: {1}".format(s,res)) def get_word(self, s, n = 0): wordList = s.split() return...