blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
2b57053ce8d80b2bccea2037613a8b03bac2eaf2
daniela-mejia/Python-Net-idf19-
/Python2/1.py
285
4.25
4
#! /usr/bin/env python3 def main(): argument = float(input("Enter a value to be multiplied by 10: ")) times_ten(argument) def times_ten(num): product = num * 10 print("The Output is", product) show_value(12) def show_value(quantity): print(quantity) main()
c7deb48e1949208a6d13ce36e0e3bcc6fd4b3f7f
kylapurcell/A01088856_1510_assignments
/A2/test_choose_inventory.py
1,423
3.609375
4
from unittest import TestCase from A2 import dungeonsanddragons import random class TestChooseInventory(TestCase): def test_choose_inventory(self): self.assertEqual([], dungeonsanddragons.choose_inventory([], 0)) # Tests that 0 as selection # returns empty list def test_choose_inventory2(se...
5cf43c44ed701e3c2ba5b1da8c80c428e0c8f92a
SpencerHarper/python
/csvScrapeExample.py
3,711
3.75
4
#!/usr/bin/env python3 '''This module contains functions for web scraping off KEGG pages''' import pandas as pd import urllib.request import re def kegg_gene_scraper(myfile,baseurl,output_file): '''This is a script for scraping gene symbols and gene Entrez ids from KEGG pathway web pages. Input is a c...
ef42dd924e9c256661b893c8c1341898d734ebd2
sankaranarayanankj/python
/linkedlistatdiffposition.py
931
4.25
4
class Node: def __init__(self,node): self.node=node self.next=None class List: def __init__(self): self.head=None def display(self): node1=self.head while(node1): print(node1.node) node1=node1.next list1=List() #Insert at...
d1bccefd640bad658f94e076a6d6aef7078a94f6
parlovich/hashcode
/2019/pizza/pizza.py
8,041
3.5625
4
#! /usr/bin/python import sys import copy M_INT = 1 T_INT = 2 class SliceType: BIG = "big" SMALL = "small" GOOD = "good" class PizzaSlicer: def __init__(self, pizza, L, H): self.pizza = copy.deepcopy(pizza) self.R = len(pizza) self.C = len(pizza[0]) self.L = L ...
44d6b59e154d8641d0657ad1891722cf90600754
jvm269/Python-Challenge
/PyPoll/main.py
2,326
3.734375
4
#import modules import os import csv #output file output_path="/Users/jihanmckenzie/Desktop/Python-Challenge/PyPoll/PyPoll.txt" #input path election_data = os.path.join("election_data.csv") # list for candidates` candidates = [] # list for number of votes each candidate receives num_votes = [] # list for votes eac...
bb9527a0b6eafa8ee233ca7832881b06d8ab7535
jorzel/codefights
/arcade/python/checkPassword.py
1,136
3.640625
4
""" Medium Recovery 100 Implement the missing code, denoted by ellipses. You may not modify the pre-existing code. You're implementing a web application. Like most applications, yours also has the authorization function. Now you need to implement a server function that will check password attempts made by users. Sin...
3b932f16b7ab0f9afefb4df7dd1e23167cfe67e2
fengxiaolong886/leetcode
/1544整理字符串.py
1,000
3.90625
4
""" 给你一个由大小写英文字母组成的字符串 s 。 一个整理好的字符串中,两个相邻字符 s[i] 和 s[i+1],其中 0<= i <= s.length-2 ,要满足如下条件: 若 s[i] 是小写字符,则 s[i+1] 不可以是相同的大写字符。 若 s[i] 是大写字符,则 s[i+1] 不可以是相同的小写字符。 请你将字符串整理好,每次你都可以从字符串中选出满足上述条件的 两个相邻 字符并删除,直到字符串整理好为止。 请返回整理好的 字符串 。题目保证在给出的约束条件下,测试样例对应的答案是唯一的。 注意:空字符串也属于整理好的字符串,尽管其中没有任何字符。 """ def makeGood(s): re...
84998e8797eac44ac87438d5ba0c7cb6bd491eb4
projeto-de-algoritmos/D-C_Dupla10B
/merge.py
1,771
3.859375
4
count = 0 tam = 0 def mergeSort(arr): global count, tam if len(arr) > 1: mid = len(arr)//2 L = arr[:mid] R = arr[mid:] if count == 0: tam = len(arr) print('Divide-se o array:', L, R) count += 1 mergeSort(L) mergeSort(R) ...
07c2f4df4c0d97df93c7cbca628e8eed628a1d25
wangzhankun/python-learn
/basic/code/test.py
1,540
3.53125
4
class Product(): def __init__(self,id,name,price,yieldly): self.id = id self.name = name self.price = price self.yieldly = yieldly class Cart(): def __init__(self): self.product = {} self.products = [] self.total_price = 0 def buy_product(self,produ...
7e18d5352cee0abcf38ef82447b2e3cdb23c24de
nfernando-io/speedreader
/Documents/Programming/python/Speedreader/speedreader.py
1,743
3.78125
4
#Speedreader program #TODO LIST: #Should either be able to upload text file or copy paste text #Print a certain amount of words specified by user #Make a gui #Have a text box that you upload file #A lightbox pops up and displays the text #make previous words disappear #Scan import time ...
62a442b0a2d85b599bbb3957110bff1ca0a048d1
sonam2905/My-Projects
/Python/Exercise Problems/prefix_for_new_line.py
621
3.734375
4
import textwrap sample_text = ''' Python is an interpreted, high-level and general-purpose programming language. Python's design philosophy emphasizes code readability with its notable use of significant indentation. Its language constructs and object-oriented approach aim to help programmers write clear, logical c...
dfd365abbeb80796a76a7811d97d9b8467592d97
Itseno/PythonCode
/1st.py
293
4.21875
4
total = 0.0 number1=float(input("Enter the first number: ")) total = total + number1 number2=float(input("Enter the second number: ")) total = total + number2 number3=float(input("Enter the third number: ")) total = total + number3 average = total / 3 print ("The average is " + str(average))
6e1628b86f2cf97483fb07cee92a0510d1a96d07
abdiassantos/estudosPython
/djangoPython/python/tipos_de_dados.py
1,722
4.25
4
##LISTAS lista = [] print(type(lista)) lista.append("Python") lista.append("Java") lista.append("Javascript") lista.append("PHP") print(lista) #Inverte os dados da lista. lista.reverse() print(lista) ##Insere no local indicado e move para a direita todos os outros termos da lista. lista.insert(0, "Android") print(l...
79e1b626df68a5d7ab44f049372f0cf6fc343c58
BenMtl/python-csv
/python-merge-multiple-csv-files-into-one-csv-file/merge-csv-files.py
1,515
3.515625
4
import csv csv1_header = [] csv1_data = [] csv2_header = [] csv2_data = [] with open('csv1.csv') as csv1: reader = csv.reader(csv1) csv1_header = next(reader, None) with open('csv2.csv') as csv2: reader = csv.reader(csv2) csv2_header = next(reader, None) #print(csv1_header) #print(csv2_header) set...
17a916edc61a1740ccdda27f28255e891cbe9a8a
asd153866714/Data-structure
/python/09-sort/InsertSort02.py
264
3.984375
4
# InsertSort def InsertSort(data): for i in range(1, len(data)): j = i - 1 while data[j] > data[j+1] and j >= 0: data[j], data[j+1] = data[j+1], data[j] j -= 1 return data data = [5, 3, 2, 9] print(InsertSort(data))
6790635f3e5466584c1537f49a791fe0c7ad3689
bbuluttekin/MSc-Coursework
/PoPI/mock_two.py
228
3.625
4
def sqrProd(x, y): return (x * y) ** 2 def power(a, n): if n == 0: return 1 else: return power(a, n - 1) * a if __name__ == "__main__": assert sqrProd(2, 5) == 100 assert power(2, 3) == 8
3cb1b8121073a0b5bba382c99cf4873a58d9c39e
Indiana3/python_exercises
/wb_chapter5/exercise130.py
1,633
4.34375
4
## # Read, tokenize and mark the unary operators # in a mathematical expression # from exercise129 import tokenGenerator ## Identify unary operators "+" and "-" in a list of tokens # @param t a list of tokens # @return a new list where unary operators have been replaced # by "u+" and "u-" respectively # def unaryIdent...
c602ea5c64e8085349ed046158f934cdd0d0d0c4
markus-seidl/pybutcherbackup
/backup/terminal/table.py
1,136
3.609375
4
import texttable class TableColumn: def __init__(self, name): self.name = name self.min_len = None self.max_len = None self.align = "l" self.type = "t" class Table: def __init__(self, table_data: list, columns: [TableColumn]): self.table_data = table_data ...
18b7c42caa3e46040d03444e2a5dfd8155eefee8
argpass/coding_life
/ai/decision_tree/utils/tree_plot.py
3,798
4.03125
4
#!coding: utf-8 from matplotlib import pyplot as plt class PLTNode(object): def __init__(self, tag, area, depth, parent_x, arrow_text=None): self.parent_x = parent_x self.depth = depth self.area = area self.tag = tag self.arrow_text = arrow_text def show_tree(plot, tree):...
f5edbdac7b5ff053f73da7c92c23c5737c117243
likhitha5101/DAA
/Assignment-4/Point.py
747
3.71875
4
# -*- coding: utf-8 -*- class Point(object): __slots__ = ['_x', '_y'] def __init__(self, x=0, y=0): self._x = x self._y = y def __str__(self): return "(" + str(self._x) + "," + str(self._y) + ")" def __add__(self, other): return Point(self._x + other._x, self._y + o...
717cdf06013ec54a4a8bbb91a96ab92fe360732a
QinmengLUAN/Daily_Python_Coding
/wk2_TwoSum_v1.py
557
3.875
4
#Given an array of integers, #return indices of the two numbers such that they add up to a specific target. #You may assume that each input would have exactly one solution, #and you may not use the same element twice. # Example: # Given nums = [2, 7, 11, 15], target = 9, # Because nums[0] + nums[1] = 2 + 7 = 9, # r...
1bf38cc373359cf286d7ac63ceb650001dd64b5d
thelmuth/cs110-spring-2020
/Class07/warmup.py
114
3.859375
4
# What does this print: test = "This is a test." a = test.find("is") b = test.find(".") print(test[a:b])
8ea4d323c5bef46fa7d336e149bcacbcb9bbb597
raysmith619/Introduction-To-Programming
/exercises/functions/figures/polygon_mod.py
2,545
3.671875
4
#my_polygon_mod.py 21Jan2022 crs, from my_polygon_keyw_2.py """ Module to Make a regular polygons """ from turtle import * # Previous values prev_color = "black" # color prev_side = 200 # side in pixels prev_nside = 4 # number of sides prev_width = 4 # line width def polygo...
eafd651285f500bc3d19128a09f0652175ae3a4c
sujeet05/python-code
/lession5.py
741
3.53125
4
#x = "There are many dogs in this society %d ", 10 x = "There are %d types of people." % 10 print x # before 10 % is mising in line no 1 . % is mandatory binary ="binary" dont ="dont" #y = "those who knows %r can't say %s" (%binary,%dont) y = "those who knows %r can't say %s" %(binary,dont) # % should be before...
51af4f58574d5300a9b5beecad583b0c55016513
Evilzlegend/Structured-Programming-Logic
/Chapter 06 - Arrays/Instructor Samples/sort_function.py
251
3.75
4
myList = [9, 1, 0, 2, 8, 6, 7, 4, 5, 3] print('Original order:', myList) myList.sort() print('Sorted order:', myList) myList = ['beta', 'alpha', 'delta', 'gamma'] print('Original order:', myList) myList.sort() print('Sorted order:', myList)
e849afe585c0d25de97fbe749f49c5c34a0b092c
saratkumar17mss040/Python-lab-programs
/Classes_and_Object_Programs/cls9.py
251
3.71875
4
# encapsulation - protected members - 1 class Person: def __init__(self): self._name = 'sam' class Student(Person): def __init__(self): Person.__init__(self) print(self._name) s = Student() p = Person() print(p._name) print(s._name)
86eed08745d81e2cafdff1e93b734350b04f56a5
u98106/Python-learning-notebooks
/References.py
468
3.65625
4
# coding: utf-8 # ## What is a reference? # Very similar to a pointer in C # # ### A different var name pointing to the same data # In[ ]: # In[ ]: # Let's look at the following code: # In[1]: x = [1,2,3,4,5] # In[2]: x # In[3]: y = x # In[4]: x.pop() # In[5]: x # In[6]: y # In[7]: id(x...
34c2e4709e8a3163856dfa0306debdf6899ef297
mattb33/BC-Hours-Request-Checker
/Hours Request Checker.py
1,879
3.6875
4
# Import modules import csv # Initialise output list results = [] header = ["Employee Code", "Hours", "Percentage"] # Define the starting variables z = 0.70 # Threshold that must be met to qualify for increase in hours # Import CSV - file called 'hours' should be employee code in first c...
301a0d6e924987f8392f9950268dee14eead2025
haiou90/aid_python_core
/day08/homework_personal/04_chuanjiang.py
296
3.515625
4
# list01 = [1,2,3,4] # list02 = list01 # list03 = list01[:] # print(list03) # list03[0] = 100 # print(list03) # print(list01) # list01[:] = []#修改列表元素 # print(list03) # print(list01) # print(list02) message = "to have people" list01 = message.split(" ")[::-1] print(" ".join(list01))
b399941806dc85a2f11bc33f59ead53b0d61b25f
Mtmh/py.1nivel1
/98ListaValorCero.py
524
3.953125
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Thu Sep 7 13:20:05 2017 @author: tizianomartinhernando """ lista=[[100,7,85,8], [4,8,56,25], [67,89,23,1], [78,56]] print(lista) for x in range(len(lista[0])): if lista[0][x]>50: lista[0][x]=0 print(lista) ''' Se tiene la siguiente lista: ...
4be536608ca338cae08a905b8ab50c378d91683d
Commandoz/Portif-lio
/Desafio06.py
291
4
4
print('Desafio 06 - Dobro - Triplo e Raiz Quadrada') print('Escolha um número para sabermos o Dobro, Triplo e Raiz Quadrada') n1 = int(input('Escolha um número: ')) d = n1 * 2 t = n1 * 3 rq = n1 ** (1/2) print('O Dobro é {}, o Triplo é {} e a Raiz Quadrada é {}'.format(d, t, rq))
9db3f31a9220e816cd7756e61eba7cfd3b5b2611
cyril-lav/osu-learn
/Osu!Learn/untitled100.py
244
3.515625
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt import sklearn as sk rng = np.random.RandomState(42) x = 10 * rng.rand(50) print('la taille de notre ehantillon est :',x.shape) y=2*x-1+ rng.randn(50) plt.scatter(x,y);
66c60b30659f683b67cd379657aad9f902d8b9e2
xXxSovereign/WorldOfPlus
/commands/mapStuff.py
2,627
3.9375
4
import os import random as r def display_Map(world_map): # Function to display the world map, parameter is the current explored map os.system("cls") # Clears previous text in the Terminal os.system("chcp 65001") # sets current code page to UTF-8 to display chars for i in world_map: output = "" ...
3afac317c3d09d13465bd2403f57a5f7122b3ae0
Shiva2095/Pattern_python
/5.py
421
3.59375
4
"""Pattern-5: A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J A B C D E F G H I J""" r=int(input("Enter Number Of Rows : ")) c=int(input("Enter Number Of Column : ")) for ...
27398de528e753c805beeab33d0fd69d38c9423b
heenamkim/Basic-programming
/python/3주차/파이썬 연습_3주차_추가 공부 자료_실습9.py
194
3.703125
4
#파이썬 연습_3주차_추가 공부 자료_실습9.py a=3 b=9 a=b b=a print(a) print(b) #2 임시 변수를 하나 더 만들어서 바꾸는 방법 a=3 b=9 x=a a=b b=x print(a) print(b)
f970b4cf61ca8704252c728f7f555042fa90871d
howarding/interviews_py
/leetcode/208_implement-trie-prefix-tree.py
1,667
4.25
4
# Implement a trie with insert, search, and startsWith methods. # # Note: # You may assume that all inputs are consist of lowercase letters a-z. class TrieNode: def __init__(self): self.isEnd = False self.child = dict() class Trie(object): def __init__(self): """ Initialize y...
72749234a83fd86b08000408ae24d31a790be7de
zyhsna/Leetcode_practice
/problems/remove-duplicate-node-lcci.py
805
3.578125
4
# _*_ coding:UTF-8 _*_ # 开发人员:zyh # 开发时间:2020/8/25 10:02 # 文件名:remove-duplicate-node-lcci.py # 开发工具:PyCharm # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None class Solution(object): def removeDuplicateNodes(self, head): """...
6995285aca86a20c600d1814e1535438a2e0bda0
Hasnake/lc101
/initials.py
600
4.09375
4
def get_initials(fullname):#if you haven't argument,then you have to call your function name to end. """ Given a person's name, returns the person's initials (uppercase) """ # TODO your code here xs = (fullname) name_list = xs.split() initials = "" for name in name_list: # go through each nam...
222337324281ee9092c9139cbce0c0122a4e9c23
RHARO-DATA/DataStructure--Algorithms
/Find Subtree.py
587
3.734375
4
""" Find Subtree Given 2 binary trees t and s, find if s has an eaqul subtree in t, where the structure and the values are the same. Return True is it exist, otherwise return False """ class Node: def __init__(self, value, left = None, right = None): self.value = value self.left = left sel...
58cd10a448ebd2efeed5077874db310ec42e9a37
LawerenceLee/coding_dojo_projects
/python_stack/hospital.py
1,776
3.59375
4
import hashlib class Patient(): def __init__(self, name, allergies=""): self.name = name self.allergies = allergies self.bed_number = None self.id = hashlib.sha512(name + allergies).hexdigest()[-8:].upper() def __str__(self): return "PATIENT-ID: {}\nNAME: {}\nALLERGIES...
2cd08e8ceea8345153c6b45c8ff61839435aa33c
iutzeler/NumericalOptimization
/Lab7_StochasticMethods/algoProx.py
1,544
3.921875
4
#!/usr/bin/env python # coding: utf-8 # # Proximal algorithms # # In this notebook, we code our proximal optimization algorithms. # # 1. Proximal Gradient algorithm # # For minimizing a function $F:\mathbb{R}^n \to \mathbb{R}$ equal to $f+g$ where $f$ is differentiable and the $\mathbf{prox}$ of $g$ is known, given...
8d43be3a0fe91988e037e8144748861d9609bedc
sy-jamal/Machine-Learning
/datasets_questions/explore_enron_data.py
2,079
3.640625
4
#!/usr/bin/python """ Starter code for exploring the Enron dataset (emails + finances); loads up the dataset (pickled dict of dicts). The dataset has the form: enron_data["LASTNAME FIRSTNAME MIDDLEINITIAL"] = { features_dict } {features_dict} is a dictionary of features associated with that pers...
e7f28b245d26d132c107ad0b925227ab71374605
Sinha-Ujjawal/LeetCode-Solutions
/StudyPlans/Algorithms/Algorithms1/combinations.py
436
3.640625
4
from typing import List class Solution: def combine(self, n: int, k: int) -> List[List[int]]: stack = [([], 1)] while stack: xs, i = stack.pop() if len(xs) == k: yield xs else: for j in range(i, n + 1): stack.a...
18292f279526f4a9bd07143b5517ab0655d3258f
rafaelperazzo/programacao-web
/moodledata/vpl_data/104/usersdata/250/50761/submittedfiles/av1_2.py
120
3.6875
4
# -*- coding: utf-8 -*- import math N=int(input('digite numero de linhas e colunas:')) x1=int(input('cordenada da linha
66352731d8b952a633dea499c56cc58903051b4d
nikitakumar2017/Assignment-4
/assignment-4.py
1,450
4.3125
4
#Q.1- Reverse the whole list using list methods. list1=[] n=int(input("Enter number of elements you want to enter in the list ")) for i in range(n): n=int(input("Enter element ")) list1.append(n) print(list(reversed(list1))) #Q.2- Print all the uppercase letters from a string. str1=input("Enter string ") for...
3058db44e858b4e84ac998bdc52adf4fb5b22988
rhaxlwo21/Python_Sunrin
/practice29.py
177
3.515625
4
def cal_area(radius): area = 3.14*radius**2 return area user = int(input("반지름을 입력하세요:")) c_area = cal_area(user) print("원의 넓이는 :",c_area)
cccded751a245d6498486330f1202dbcb6020243
SeavantUUz/LC_learning
/LowestCommonAncestorofaBinarySearchTree.py
463
3.5625
4
# coding: utf-8 __author__ = 'AprocySanae' __date__ = '15/10/14' def lowestCommonAncestor(root, p, q): lower, higher = sorted([p.val, q.val]) while root: if not root: return None val = root.val if val == higher or val == lower or (val > lower and val < higher): ...
856d1eec286ec74b172f57c2af23d14890361820
UWPCE-PythonCert-ClassRepos/SP_Online_PY210
/students/zach_thomson/lesson05/comprehensions_lab.py
1,104
3.984375
4
def count_evens(nums): return len([num for num in nums if num % 2 == 0]) #print(count_evens([2,5,3,4])) #print(count_evens([2,4,5,6,8,10])) food_prefs = {"name": "Chris", "city": "Seattle", "cake": "chocolate", "fruit": "mango", "salad": "greek", ...
49baa75b2582bc9919a1db6d3fe50686bb1451c5
JIAWea/Python_cookbook_note
/03grouping_records_based_on_a_Field.py
1,539
4.53125
5
# Python cookbook学习笔记 # 1.15 Grouping Records Together Based on a Field # You have a sequence of dictionaries or instances and you want to iterate over the data # in groups based on the value of a particular field, such as date. # The itertools.groupby() function is particularly useful for grouping data togethe...
171259ac64c71a2ecfaf17e65f49f7854b4a0db9
gyenana/pythoniii
/github/make_calculator/make caculator_ver1.py
1,652
4.03125
4
# 계산기 내에서 사용할 사칙연산 함수 만들기 def sum(a,b): return a+b def diff(a,b): return a-b def multiple(a,b): return a*b def divide(a,b): return a/b #계산기 함수 만들기 def caculator(): try: # 첫번째 초기 값 result=int(input('숫자를 입력하세요:')) while True: c=str(input('연산자를 입력하세요:')) ...
17beb6717f0b752d12dbb4479e91520bad2dce41
David-Sangojinmi/Adventure-Game-PY
/adventure.py
3,645
3.890625
4
#Name: David S #Date: 20/07/2016 #Project: Simple Text Based Game import time import sys print """ --------------------------------- --------------------------------- -- Hello my friend! -- -- Welcome to my game, -- -- Adventure! -- --------------------------------- ---------------...
834ae082145358382d1754e19b08509abbfd39eb
MakarFadeev/PythonTasks
/TK15/TEST.py
2,333
3.703125
4
from tkinter import * #Настройки окна window = Tk() window.geometry('400x300') window.title('Ввод-вывод данных') window.resizable(False, False) smallLetter = False bigLetter = False number = False nice = False def show(): global smallLetter global bigLetter global number global nice password = inpu...
5f8ed03e94b139527ac44011e02d2ad0d467aa8a
HemantSinghEdu/MachineLearningPython
/002. Regression/02.MultipleLinearRegression/main.py
4,058
4.125
4
#Multiple Linear Regression - multiple features, one label #General Equation is that of a straight line with multiple features: y = b0 + b1x1 + b2x2 + ... + bnxn #sourced from superdatascience.com #-------------------------------- Preprocessing ----------------------- #import the libraries import numpy as np import p...
8ccd74719ddc3591031088bf53d66b1a4a435300
minapetr/test
/.vscode/ProblemSet0.py
157
3.53125
4
import numpy as np x=int(input("Please enter value for x")) y=int(input("Please enter value for y")) z=x**y print("x**y=",z) p=np.log2(x) print("log(x)=",p)
115af2e4885d150f20827305416759225f47de00
jonag-code/python
/file_reader.py
821
3.6875
4
#filename = 'pi_1000.txt' filename = 'pi_100.txt' #filename = 'pi_30.txt' ##Store lines of .txt file into a list, with open(filename) as f: lines = f.readlines() print("%s \n" %lines) ##print an element at a time, stripping ## off the insisible newline characters ## from the original .txt file. for line in lines:...
96d097a608004e9bbdb43004345e0bb393d28bbd
nielsonnp/CursoemVideo
/resumos/lembretes_strings.py
680
4.15625
4
frase = "Curso em Vídeo Python" print(frase[3:13:2]) #Vai de 3 até 13 pulando de 1 em 1 print(frase.count('u')) #Conta quantas vezes tem o 'u' minusculo na variavel frase print(len(frase)) #Conta quantos tamanhos tem a frase print(len(frase.strip())) #Remove os espaço em branco print(frase.upper()) #Coloca a frase em ...
a4f6d076c4b22c375a6448f3c3bf89864fa63904
stefan1123/newcoder
/合并两个排序的链表.py
1,148
3.796875
4
# -*- coding:utf-8 -*- """ 题目描述 输入两个单调递增的链表,输出两个链表合成后的链表,当然我们需要合成后的链表满足单调不减规则。 代码情况:accepted """ # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: # 返回合并后列表 # 写的过程中要注意不要使得链表断开之后找不到下一节点了。 def Merge(self, pHead1, pHead2): # write code ...
c254eb64b60e8bb81f052eb3a8d2341c6b4e85da
molliegoforth818/py-ch4prac-lists
/planets.py
906
4.0625
4
# Ch 4 example # import random # """ # Print a message to the console indicating whether each value of # `number` is in the `my_randoms` list. # """ # my_randoms = list() # for i in range(10): # my_randoms.append(random.randrange(1, 6)) # Generate a list of numbers 1..10 # numbers_1_to_10 = range(1, 11) # Iter...
f28bffd0246bb036669a3a023a22ff1aab4127ce
vertig0d/PythonProgrammingExercise
/Q3L1M2.py
549
4.15625
4
""" With a given integral number n, write a program to generate a dictionary that contains (i, i*i) such that is an integral number between 1 and n (both included). and then the program should print the dictionary. Suppose the following input is supplied to the program: 8 Then, the output should be: {1: 1, 2: 4, 3: ...
18c1eaf8597cd79ca046e47b3885c3b288f30104
codeAligned/codingChallenges
/Courses/algorithms_illuminated_part_1/Chapter 1/KaratsubaMultiplication.py
2,169
3.984375
4
""" Input: two n-digit positive integers x and y Output: the product x · y Assumption: n is a power of 2. n = length of digits """ import math def recIntMult(x, y): xDigits = str(x) yDigits = str(y) n = min(len(xDigits), len(yDigits)) if len(xDigits) <= 1 or len(yDigits) <= 1: return x * y...
dceaefb05dcf2e68b27b28d961b2c9ebf40d100f
Jiezhi/myleetcode
/src/739-DailyTemperatures.py
1,968
3.703125
4
#!/usr/bin/env python """ Github: https://github.com/Jiezhi/myleetcode Created on 2019/10/17 Leetcode: https://leetcode.com/problems/daily-temperatures/ https://leetcode.com/explore/learn/card/queue-stack/230/usage-stack/1363/ Difficulty: Medium """ from typing import List class Solution: def dailyTemperatur...
6c3728db4e39c83647c7d045ba131af0f5b35521
SimretA/CPV
/quicksort.py
625
4.0625
4
def quick_sort(list1): if len(list1) > 1: left = list() right = list() pivot = list1[-1] for i in range(0, len(list1)-1): if list1[i] > pivot: right.append(list1[i]) else: left.append(list1[i]) print("left pivot right", ...
576ddb993ed3b221798b6530cb11bcacb92e8b2d
vaclav0411/algorithms
/Задания 13-го спринта/Простые задачи/F. Стек - Max.py
640
3.6875
4
class StackMax: def __init__(self): self.items = [] def push(self, x): self.items.append(x) def pop(self): if self.items: return self.items.pop() else: print('error') def get_max(self): if self.items: print(max(self.items)) ...
33583d7ddcd40ae0303255c123e7062d076045f3
dongbo910220/leetcode_
/Dynamic Programming/322. Coin Change Medium.py
771
3.625
4
''' https://leetcode.com/problems/coin-change/ ''' class Solution(object): def coinChange(self, coins, amount): """ :type coins: List[int] :type amount: int :rtype: int """ n = amount + 1 dp = [amount + 1] * n dp[0] = 0 for i in range(1, n): ...
c23f5dd4d508f0bafc278fa903bb038be8d9fb84
DavidArmendariz/data-structures-hse
/week3/fibonacci.py
203
3.6875
4
count = 0 def foo(n): global count count += 1 if n == 0 or n == 1 or n == 2: return 1 return foo(n - 1) + 2 * foo(n - 3) if __name__ == "__main__": foo(6) print(count)
003cf2b5c7d94ae86de8eb430551c1e808a81f35
diegoasanch/Fundamentos-de-Progra-2019
/TP5 Funciones/TP5.13 Extraccion de los ultimos N digitos.py
1,360
3.96875
4
# Devolver los últimos N dígitos de un número entero pasado como parámetro. El valor de N también # debe ser pasado como parámetro. Devolver el número completo si N es demasiado grande. Ejemplo: # ultimosdigitos(12345,3) devuelve 345, y ultimosdigitos(12345,8) devuelve 12345. #funcion extraer digito def extraerdigi...
b234511c394f2cf35fbeb34f18c869895ae9c07c
sjdlloyd/piProjects
/time-lapse/timer.py
495
3.8125
4
import datetime import time def time_in_range(start, end, x): """Return true if x is in the range [start, end]""" if start <= end: return start <= x <= end else: return start <= x or x <= end def sleep_in_time_range(start,end, sleep_len= 600): now = datetime.datetime.now() nowt = ...
00918245f13c27a1ec4ea2f1df8d35a87262c0b5
JasonLuis/python-basico
/dicionarios_e_conjuntos.py
1,125
3.84375
4
""" ##Coleções #Dicionários """ coleta = { 'Aedes aegypt': 32, 'Aedes albopictus': 22, 'Anopheles darlingi': 14 } print(coleta['Aedes aegypt']) coleta['Rhodnius montenegrensis'] = 11 print(coleta) del(coleta)['Aedes albopictus'] print(coleta) #retorna os items do dicionario print(coleta.items()) #retorna ...
48ae76611afc50260e874c6c39844db85004d040
cubeyang/python_15
/test_0221/xyz.py
221
3.796875
4
#huash12 sum=0 for i in range(1, 5): for j in range(1, 5): for z in range(1, 5): if i != j and i != z and j != z: print("{}{}{}".format(i,j,z)) sum=sum+1 print(sum)
7f33fb8cfaba04d49f97be9e9a93f253fb3b7fbb
augustomy/Curso-PYTHON-01-03---Curso-em-Video
/ex017.py
329
3.8125
4
import math co = float(input('Digite o valor do cateto \033[1;31moposto\033[m: ')) ca = float(input('Digite o valor do cateto \033[1;32mdjacente\033[m: ')) h = math.sqrt((co ** 2) + (ca ** 2)) print('\033[1;31mCateto oposto: {}\033[m\n\033[1;32mCateto adjacente: {}\033[m\n\033[1;35mHipotenusa: {}\033[m'.format(co, ...
f08e438f08d7ad115e13679acf9a523289343a73
Abhijit070590/Evaluation-of-python-program
/2013-09-30-Midterm/checkChessCheck/IMT2013038checkChessCheck.py
8,918
4.21875
4
def find_kings(board): ''' Find the positions of the two kings return a hash that has a tuple (x,y) associated with 'k' and 'K' (black and white kings) respectively ''' kings = {} for row in board: for column in row: if(column=='k'): kings['k']=(row,column) ...
32c4ee6896dfd3b985c965c977e8d0f73379e746
IngridFCosta/Exercicios-de-Python-Curso-em-video
/Strings/ex023_separarDigitos.py
390
3.984375
4
"""023- faça um programa que leia um numero de 0 a 9999 e mostre na tela cada um dos digitos separados.""" numero=int(input('Escreva um numero inteiro: ')) unidade=numero//1%10 dezena=numero//10%10 centena=numero//100%10 milhar=numero//1000%10 print('Unidade: {}'.format(unidade)) print('Dezena: {}'.format(dezena)) pr...
1c4b8a8d34ceb431c38f30764258ffa6c078bc26
KiruthikaGopalsamy/GraduateTrainingProgram2018
/Python/Day4.py
2,572
4.21875
4
<PROBLEM SET 04> SEPTEMBER 05,2018 SUBMITTED BY kiruthika.gopalsamy """You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. alison heck => Alison Heck Given a full name, your task is ...
2669789aca50c3d6a4bfc0d46f2a621b584a0b35
wngus9056/Datascience
/Python&DataBase/5.17/hou/Python06_23_Chap02_김주현.py
1,788
3.828125
4
''' #1. grade = [1, 2, 3] 1.loop 적용 2. 합계 3. 평균 : len() ''' grade = [80, 75, 55] gsum = 0 for x in grade: gsum += x ave = (gsum/len(grade)) print('# 문제 1.') print('합계 : ', gsum) print('평균 : ', ave) print() print('-'*15) ''' #2. int(input()) 숫자 입력 짝수 입니다. 홀수 입니다. ''' print('# 문제 2.') nu...
ba085c3bffc229e511eb2476504863e423380e66
Nitesh101/test
/assignments/python_ assignments/command_line_argu.py
1,341
4.0625
4
#!/usr/bin/python """ import sys print 'Number of arguments:', len(sys.argv), 'arguments.' print 'Argument List:', str(sys.argv) #/!usr/bin/python import sys print "command line argument are: ", total_nums = len(sys.argv) if total_nums > 1: for index in range(1,total_nums): num = (sys.argv[index]) if num.isdig...
3b33abec5143deccf9227511e5af51e1ad592a78
AyelenDemaria/frro-soporte-2019-23
/practico_01/ejercicio-05.py
327
3.640625
4
# Implementar la función es_vocal, que reciba un carácter y # devuelva un booleano en base a si letra es una vocal o no. # Resolver utilizando listas y el operador in. def es_vocal(letra): if letra in ['a','e','i','o','u']: return True return False assert (es_vocal('a')) == True assert (es_vocal('b')) == F...
166f0746a2f7ba2dac3d8e94738d7e78f74217e1
taruchit/CodeChef_Beginner
/Pall01.py
310
3.578125
4
# -*- coding: utf-8 -*- """ Created on Mon Sep 13 12:29:28 2021 @author: pc """ #Number of testcases T=int(input()) #Input, Computation and output for i in range(T): N=input() N1=int(N) temp=N[::-1] N2=int(temp) if(N1==N2): print("wins") else: print("loses")
719bc3f463435654f6a838b059a59b43c55701c1
nazlitemur/oware
/players/oware/oware_human.py
1,416
3.625
4
import game_state import game_player import oware class OwarePlayer(game_player.GamePlayer): def __init__(self, name, game_id): game_player.GamePlayer.__init__(self, name, game_id) def minimax_move(self, state): # see what the valid moves are so we can check the human's answer successors = state.successor_m...
2500331d622071e6a2d52b03af667091ec17ea45
MichalChim/PW_Python
/Zmienne, funkcje/1. Typy danych/exercise_1.py
417
3.546875
4
a = 1 print("Zmienna a typu int =>", type(a)) b = 5.32 print("Zmienna b typu float =>", type(b)) c = "test" print("Zmienna c typu string =>", type(c)) d = """ Test Test wielolinijkowy długi napis """ print("Zmienna d typu string =>", type(d)) e = True print("Zmienna d typu bool =>", type(e)) # komentarz #...
474300a61b014513acda2cfe82cb6024014ad7e4
n0ma/code
/3.py
243
3.78125
4
def primes(limit) i = 7 primes = [2, 3, 5] while len(primes) <= limit: prime = True for x in primes: if i % x == 0: prime = False if prime: primes.append(i) i += 2 return primes
fed7b075cc121eeb3bcd6369185bd16273709dbe
2453302416/py1
/day8/eml.py
292
3.546875
4
# 编写函数,判断输入参数字符串是否为邮箱地址, # 检验条件为:字符串中间用@分隔,末尾是.com或者.net( arr1 = input('请输入字符串邮箱:') arr2 = 'com' if arr2 in arr1: print('邮箱正确') else: print('邮箱不正确请重新输入')
5749e822a7016fab678ad217cb5ddcd047e19434
Kirkules/Python-Challenges
/linkedlist.py
920
3.828125
4
# Kirk Boyer # Sunday, Dec. 29 # This challenge is a sequence of sites with url # www.pythonchallenge.com/pc/def/linkedlist.php?nothing=##### # where the last part is a 5-digit number. # My guess is that eventually they'll stop the pattern at some point and either # give another hint about the next challenge's url, ...
915033e9e98cff67f8dca15589ae6602192bd7b8
bilal8171/file_based_key_value_datastore
/code_Module.py
2,625
3.53125
4
from threading import* import time database={} #Actually its dictionary def create(k,v,timeout=0): if k in database: print("error: this key already exists") else: if(k.isalpha()): if len(database)<(1024*1024*1024) and v<=(16*1024*1024): if timeout==0: ...
17e7694a091ff362f3eb436e9fdea1925d34db1f
Trismeg/python_beg
/circlesrand.py
257
3.59375
4
from graphics import * wind=GraphWin() wind.setCoords(0,0,10,11.2) centers=[] for i in range(10): centers=centers+[Point(5,1+i)] circles=[] for i in range(10): circles=circles+[Circle(centers[i],1)] for i in range(10): circles[i].draw(wind)
6a6b828072ff809269408f1a88e5427a6a8876ab
Jessicammelo/cursoPython
/tipo_booleano.py
284
3.71875
4
#True -> verdadeiro #False -> falso ativo = True logado = False print(ativo) print(not ativo) print(ativo or logado) """ Ou (or) Um deve ser verdadeiro True or False False or True True or True E (end) Se tiver algume false é false tudo se for tudo false é verdadeiro """
1c9247f5d4679880f33b52f73ba9508d27600ca2
jasminro/2021python
/Week5/h3.py
799
4.09375
4
def palindrome(word): word = word.lower() word = "".join(word.split()) if len(word) <= 1: return True elif word[0] != word[-1]: return False return palindrome(word[1:-1]) strn = 'Saippuakauppias' result = palindrome(strn) if result==True: print("a palindrome!") else: pri...
afa962dbe99e88ea066f69e9247d8b57f175b2a0
walonso/Python_Estudio
/3 Temas avanzados/1 Modulos/3 Paquetes Comunes/Ejercicios/3 Generador/generador.py
1,150
3.609375
4
# -*- coding: utf-8 -*- """ Created on Fri Jun 7 15:06:57 2019 @author: walonsor """ import random import math def leer_numero(ini, fin, mensaje): while True: try: valor = int(input(mensaje)) except: print("Error: Número no válido") else: if valor...
c4a7b1be43e2f5069083698329eb7274bf918e42
summer-vacation/AlgoExec
/tencent/array_and_str/longest_palindrome.py
2,022
3.859375
4
# -*- coding: utf-8 -*- """ File Name: longest_palindrome Author : jing Date: 2020/3/18 https://leetcode-cn.com/explore/interview/card/tencent/221/array-and-strings/896/ """ class Solution: def longestPalindrome(self, s: str) -> str: if s is None or len(s) == 0: ...
39c6770ff43b8876791540bcaaa99e08fe1268d4
algebra-det/Python
/DataStructures/Total_of_non_diagonal.py
1,844
3.90625
4
# Here we are making lists for each diagonal # One list for the top-left to right-bottom diagonal # Second list for bottom-left to top-right diagonal # Than Iterating through each row and column and checking if the (row number, column number) is in the diagonal list # If it's in the diagonal list than "PASS" otherwise ...
3fc2da8fc0f70ab303510c890a43f3ec20ffdae4
ZachMillsap/PyCharm
/Module2/main/camper_age_input.py
551
4.1875
4
""" Program: camper_age_input.py Author: Zach Millsap Last date modified: 06/03/2020 The purpose of this program is to accept any integer(years), and convert to months(integer). """ def convert_to_months(x): return if __name__ == '__main__': '' years = int(50) convert_to_months = int(years * 12) print(years, ...
689f38f10d85f0f6a7a1ade2a4a773b4796b22f0
rgjha/Useful_Scripts
/multiplicative_order_compute.py
385
4.03125
4
import numpy as np from math import * def multiplicative_group(n): # Returns the multiplicative group (MG) modulo n. # n: Modulus of the MG. assert n > 1 group = [1] for x in range(2, n): if gcd(x, n) == 1: group.append(x) return group n = 21 print(f"The multipli...
9b257cdc5fe30b6bb1b8cc13684dd9c5e11b8657
hstefek/Wikipedia_BDD
/features/pages/log_in.py
1,184
3.5
4
#Name: Wikipedia website test #Author: Hrvoje Stefek #Tools: Python, Behave, Nose, Selenium #Note: Feel free to edit and reuse the code, it is made as tutorial and quick showcase from selenium.webdriver.common.by import By from browser import Browser class LogInLocator(object): HEADER_TEXT = (By.XPATH, "//h1") ...
b783b6fbba31fbe7b6fa6032f2c8729c0969eded
miohsu/CodingInterviews
/07/07_1.py
1,831
3.734375
4
""" 输入一个二叉树的前序遍历和中序遍历的结果,请重建二叉树,假设输入的前序遍历和中序遍历的结果中不含重复的值。 例如,输入前序遍历[1, 2, 4, 7, 3, 5, 6, 8],中序遍历[4, 7, 2, 1, 5, 3, 8, 6],则重建二叉树并输出它的头结点。 """ class BinaryTreeNode(object): def __init__(self, value=None): self.value = value self.left = None self.right = None def construct_core(preo...
d8cc1d911923575060d62c6325bd511b9646ef96
JoacoDiPerna/frro-soporte-2019-12
/practico_01/ejercicio-10.py
571
3.828125
4
# Escribir una función mas_larga() que tome una lista de palabras y devuelva la más larga. # La función devolverá la primer palabra "más larga". def mas_larga(lista): length = 0 index = 0 for i in range(0, len(lista)): if len(lista[i]) > length: length = len(lista[i]) index ...
3d8d2765afaa54cfa68f3fc97fa2330651c4d3a7
zsJacky/CorePython
/python-ex8/8-2.py
152
3.59375
4
def myrange(froms, to, increment): start = froms while start <= to: print start, start += increment if __name__ == '__main__': myrange(2, 26, 4)
f87c7045623675a99b7541c1552dac641b1b78ee
winiz/Galennor
/final 1.0.5 vertically printed table.py
3,708
3.921875
4
def welcomeMesg(): print "Welcome to the Survival and Surprises CMPT 120 Games!" print "=========================================================" def askTwoValues(val1,val2,question): while True: truthValue1 = raw_input(question) if truthValue1 == val1 or truthValue1 == val2: ...
34966b64a827740657952e37fb40ca35902f1929
yangzongwu/leetcode
/20200215Python-China/0896. Monotonic Array.py
1,078
3.859375
4
''' An array is monotonic if it is either monotone increasing or monotone decreasing. An array A is monotone increasing if for all i <= j, A[i] <= A[j].  An array A is monotone decreasing if for all i <= j, A[i] >= A[j]. Return true if and only if the given array A is monotonic.   Example 1: Input: [1,2,2,3] Outpu...
cfde67af03c2cc3c7ebf11fba210bd075d035f61
aiden-david-coker/python_crash_course
/working_with_lists.py
1,395
4.25
4
print('-----slicing a list-----') players = ['charles', 'martina', 'michael', 'florence', 'eli'] # print(players[0:3]) # print(players[1:4]) # print(players[:4]) # print(players[2:]) print('\n-----looping through a slice-----') print("Here are the first 3 players on my team:") for players in players[:3]: ...
aefa7def75338b969db10ab67df074e8bba28e3a
tanmaya191/Mini_Project_OOP_Python_99005739
/6_OOP_Python_Solutions/set 4/date_string.py
228
3.71875
4
dates= "45/08/2018" days=[31,28,31,30,31,30,31,31,30,31,30,31] dd = 10*int(dates[0]) + int(dates[1]) mm = 10*int(dates[3]) + int(dates[4]) if dd> days[mm]: dd=dd- days[mm] mm+=1 print(dd,"/",mm,"/ "+dates[6:10])