blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
35372799a5ae683c2c793ada2e03810ca388a7d1
juandsuarezz/holbertonschool-higher_level_programming
/0x0B-python-input_output/2-read_lines.py
507
4.21875
4
#!/usr/bin/python3 """Documentation of a Read n lines function""" def read_lines(filename="", nb_lines=0): """Function that reads n lines of a text file Arguments: filename (str): filename to open nb_lines (int): number of lines to print """ with open(filename, encoding='utf-8') as f...
26c3abf53e2c3d614bdfa6a0aebf19b8e0f0ae91
jdbelm/pytesserae
/tests/test_dictionary.py
1,605
3.875
4
from collections import Counter import argparse #source = ['banana', 'Rui Chaves', 'Rui Chaves'] #target = ['Mickey Mouse', 'Rui Chaves', 'banana'] def _parse_args(): parser = argparse.ArgumentParser( description='Find matching terms between two texts') parser.add_argument( 'source', h...
53db9400ef7bc3abf83268a221790f4238c97995
bemarte/Exercicios-Basicos-Python
/Estrutura_Decisão/Ex_ED_3.py
647
4
4
#Faça um Programa que peça uma data no # formato dd/mm/aaaa e # determine se a mesma é uma data válida. dia = int( input('Dia: ') ) mes = int( input('Mês: ') ) ano = int( input('Ano: ') ) valida = False #meses com 31 dias if( mes==1 or mes==3 or mes==5 or mes==7 or \ mes==8 or mes==10 or mes==12): if(dia<=...
101599deaf6242766f5312b8590d11fefab63e2b
yunyusha/xunxibiji
/month1/week1/Python_class4/dict.py
1,402
3.875
4
""" 字典:通过若干个键值对存取数据,每一对键值对都包含两部分 :key,value,从字典中存取数据可以直接根据key实现,因此数 据根据存取效率比列表更加高效 """ infor = {"name": "ddd", "sex": "男"} # 字典的拼接 dic1.update(dic2):视同字典dic1对dic2做数据更新 # 如果dic2中对应的键值对对dic1之前不存在,此时对该键值对执行拼接操作, # 如果该键值对中 键存在,此时执行数据更新 diel = {"name": "翠花", "sex": "女"} diel2 = {"name": 30, "class": "计算机应用"} diel.updat...
70286f3e9dfdec5bb28e33e352cb330050f3bf29
manojkumarmc/python-examples
/primer_advanced.py
387
3.859375
4
from itertools import islice def is_prime(n): return all(n % x for x in xrange(2,n)) def prime_gen(): ret_val = 1 while True: if is_prime(ret_val): yield ret_val ret_val += 1 # print 100 prime numbers sum_prime = 0 for x in islice(prime_gen(), 0, 100): print x sum_pri...
8aefdb550bc3373b87ebbfc94f50367f5f32f003
drippydik/finnSchool
/lesson2.py
4,676
4.34375
4
#!/bin/python # _ _ _ _ # _ __ ___ __ _| | _(_)_ __ __ _ ___| |__ ___ (_) ___ ___ ___ # | '_ ` _ \ / _` | |/ / | '_ \ / _` | / __| '_ \ / _ \| |/ __/ _ \/ __| # | | | | | | (_| | <| | | | | (_| | | (__| | | | (_) | | (_| __/\__ \ # |...
0494d566da41b924dff75b0f2f2c3c5ea2c7eaf0
enochsarpong/globalcode
/is_even.py
204
3.65625
4
#from function import even #num=[2,6,8,10,12] def is_even(x): return x % 2==0; numbers = [1,56,234,87,4,76,24,69,90,135] a=list(filter (is_even, numbers)) print (a)
bcdd5667ab79a373f0b9f2c0221412582ac4ca48
Servsobhagya/assignment
/asig15.py
2,455
3.6875
4
# Q1- Create a database. Create the following tables: # 1. Book # 2. Titles # 3. Publishers # 4. Zipcodes # 5. AuthorsTitles # 6. Authors # Refer to the diagram below import pymysql as py db=py.connect("localhost","root","**","library") book='create table book(book_id char(40),title_id char(40),location char(40),gr...
983a86e3d584c6917d3c5019cd95a73e968ac939
javedalamthabrealam/javed
/url.py
131
3.734375
4
str1='dhoni' inp=input() list1=list(inp) list1.sort() lst=list(str1) lst.sort() if(lst==list1): print("yes") else: print("no")
497e8d95a8933d20ea683ec352966b2ffd0dc3d4
pacomgh/universidad-python
/08-clases_objetos/04-caja.py
650
3.84375
4
#Crear un codigo en donde se pida el largo, ancho y la altura para calcular el area de #una caja, los datos debe proporcionarlos el usuario class Caja: def __init__(self, largo, ancho, altura): self.largo = largo self.ancho = ancho self.altura = altura def calcVolumen(self...
6513aea4d09e8eca3cda880a9414e828f8df301d
jkuatdsc/Python101
/1.Intro_to_python/4.user_input.py
484
4.34375
4
# 1. Using input() function to get user input my_name = input('Enter your name: ') print(f'Hello, {my_name} ') age = input('Enter your age: ') # Added a new function age to convert a string into an integer age_num = int(age) print(f'You have lived for {age_num * 12} months {my_name}') """ Another cleaner way to do...
eb7a682962c4c1b894395f97cc157de9c60b0908
Gyanesh-Mahto/Practice-Python
/String_coding_interview/18_string_vowel_count.py
344
4.0625
4
# Q18) Write a program to find the number of occurrences of each # vowel present in the given string? s=input("Please enter your string: ") vowel='aeiouAEIOU' output='' for x in s: if x not in output: output=output+x output=sorted(output) for y in output: if y in vowel: print("character {} occurs {} times...
fe7a66ac5515f2f04fe37d6bcefa6c4bb84673bf
AmritaMathuriya/Class2019
/Python/Stack/reverseNum/funGetNum.py
439
3.84375
4
def getNum( st ): reverse = 0 place = 1 # Popping the digits and forming # the reversed number while (len(st) > 0): elem = st.pop() prevNum = reverse reverse = prevNum + (elem * place); print "elem: ", elem, " reverse: ", reverse, ", place: ", place, ", stack:...
6121bd212c61ef5c5ff52a2a186e41fd7484c444
MartinAndu/TDA1-1C2018
/tp1/Main.py
501
3.65625
4
#!/usr/bin/python from selection_sort import selection_sort from insertion_sort import insertion_sort from quick_sort import quick_sort from heap_sort import heap_sort from merge_sort import merge_sort import random ''' for i in range(10) : l = list(range(10)) random.shuffle(l) ordenada = sorted(l) print ("Orig...
3a8806daf0323b212417bfb47a192ae01ac7b126
alda07/hackerrank
/03.Python/02.Whats_Your_Name.py
188
3.625
4
# input # a = "Guido" # b = "Rossum" # output # Hello Guido Rossum! You just delved into python. def print_full_name(a, b): print ("Hello %s %s! You just delved into python." % (a, b))
8f66ecda8084ada8acca15668059a3eb65643480
benwei/Learnings
/pySamples/class_dp/factory_dp1.py
1,164
3.515625
4
from beutil import * class Worker: def __init__(self, name=None): self.name = capfirst(name) if name else "The worker" def getName(self): return self.name def attrib(self): return "Worker" def lookandfeel(self): print "%s is a %s" % (self.name, self.attrib()) class De...
691180f2346859bfb14ef8b5ae55ab30438572e8
KideoHojima/python_repo
/ch3/3-8.py
268
3.75
4
places = ['japan', 'china', 'usa'] print(places) print(sorted(places)) print(places) print(sorted(places,reverse=True)) print(places) places.reverse() print(places) places.reverse() print(places) places.sort() print(places) places.sort(reverse=True) print(places)
a0e929da31c79225d2cb888f5b6e72654580e43b
GrimmeryGonsa/DSA-PYTHON
/Recusrion/SumOfNaturalNumbers.py
215
4.125
4
def summation(n): if n == 0 or n ==1: return n else: return n + summation(n-1) n = int (input('Enter the number')) print("sum of first "+ str(n) + " natural numbers is") print(summation(n))
c557a2fe8a1257dc82c869ebc002f0d5929b67ad
jinxin0924/LeetCode
/Rotate Image.py
1,514
3.859375
4
__author__ = 'Xing' # You are given an n x n 2D matrix representing an image. # # Rotate the image by 90 degrees (clockwise). class Solution(object): def rotate2(self, matrix): """ :type matrix: List[List[int]] :rtype: void Do not return anything, modify matrix in-place instead. """ ...
b17e4e01cca9b38e847e9b860ad7bcbe5a9ab9d8
chuanfanyoudong/algorithm
/leetcode/List/KthLargestElementinanArray.py
731
3.546875
4
def solution(target_number): if not isinstance(target_number, int): return None list_target_number = list(str(target_number)) length = len(list_target_number) j = length - 1 tag = 0 while j > 0: k = j while k > 0: if int(list_target_number[j]) > int(list_targ...
3a0c144b6dbc3e152ef760a377a0d87e07f118df
suptaphilip/how-to-think-like-a-computer-scientist
/ch15_classes_and_methods/ch15.py
1,702
3.890625
4
class Point: def __init__(self, x=0, y=0): self.x = x self.y = y def __str__(self): return '(%d, %d)' % (self.x, self.y) def __add__(self, other): return Point(self.x + other.x, self.y + other.y) def __sub__(self, other): return Point(self.x - other.x, self.y - other.y) def __mul__(self, other): r...
95752ad07a000e2c78e12257fe5dcba26fba2a2c
wanghan/my_code
/workspace/Pearl_Python/src/section4/BinarySearch.py
354
3.828125
4
''' Created on 2011-8-2 @author: t-hawa ''' def binary_search(list, x): l=0 r=len(list) while l<r: mid=l+(r-l)/2 if list[mid]>x: r=mid elif list[mid]<x: l=mid+1 else: return mid return -1 if __name__ == '__main__': print binary_s...
9f63628c7a15a753498215c73894f6fe69f2521a
paularodriguez/python-core-and-advance-course
/sec18-exceptionhandlingassertionsandlogging/assertdemo.py
181
3.796875
4
try: num = int(input("Enter an even number: ")) assert num%2 == 0, "You have entered an odd number" except AssertionError as ob: print(obj) print("After the exception")
f7f823d1d87276e7d7c26786a49dd976ca705908
Flup3r/ProMaaaan
/data_manager/data_manager_operations.py
1,935
3.5
4
import db_connection import bcrypt def register(data): credentials = (data["username"], data["email"], hash_password(data['password'])) sql_query = """INSERT INTO credentials(user_login, user_email, user_password) VALUES (%s, %s, %s);""" db_connection.sql_data(sql_query, "write", credentials) def ve...
efa580a9d762267cd760006fd370667d86794882
ByteCommander/AdventOfCode
/2017/aoc2017_5a.py
436
3.515625
4
# Advent Of Code 2017, day 5, part 1 # http://adventofcode.com/2017/day/5 # solution by ByteCommander, 2017-12-05 with open("inputs/aoc2017_5.txt") as file: instructions = [int(instr) for instr in file] i, counter = 0, 0 while 0 <= i < len(instructions): instr = instructions[i] instruction...
e93ca366cb873797e155b269d710933c786e3c35
Blitk/Game-A-batalha-de-Heaven-Hill
/RPG.py
17,912
3.84375
4
def batalha(inimigo, ataque, vida_inimigo, arma): """Batalha(Nome do inimigo, HP por ataque, HP do inimigo, arma do inimigo)""" print(f'\n~ {hero["Nome"]} empunha um {Armamento["Arma"]} ') import sys from time import sleep cont = 1 sair = False while True: sleep(3) ...
42bd0d788bc621a989b84439a3c39f691bc89c54
brpadilha/exercicioscursoemvideo
/Desafios/desafio 045.py
1,087
3.6875
4
#fazer um jogo do jokenpô import random a=['Pedra','Papel','Tesoura'] a=random.choice(a) b=int(input('1-Pedra\n2-Papel\n3-Terousa\n')) if b==1 and a=='Pedra': print('Computador escolheu {}.'.format(a)) print('Empatou.') elif b==1 and a=='Tesoura': print('Computador escolheu {}.'.format(a)) pri...
36dc1d67c3af93cddf94db041fb46bc370597d44
raphaelrlfreitas/connect-n
/game/connect_n.py
1,715
3.609375
4
from connect_n_lib import * # Perform a play def player_turn(player_num, current_board, win_count): print_board(current_board) sel = input("\nPlayer {0} Turn, please make a selection (0-{1}) ".format(player_num, col_count - 1)) # Validate the input as an integer sel = input_validation(sel) while ...
b6aab980e33710f5b078ff17e5c8f50f980d9e86
patricklee90/AIRAStock
/Tutorial/[Youtube - Computer Science] Stock Tutorial/1- Build A Stock Web Application Using Python/StockWebApp.py
3,325
4.15625
4
# Description: This is a stock market dashboard to show some charts and data on some stock # Import the libraries import streamlit as st import pandas as pd from PIL import Image # Add a title and an image st.write(""" # Stock Market Web Application **Visually** show data on a stock! Date range from Jan 2, 2020 - Aug...
103df96ef337d1fe6feaee72d4504d7486c4bdeb
PaulinaSz122/rozdzial4
/zwariowany_lancuch.py
197
4
4
word = input("Wprowadź jakieś słowo: ") print("\nOto poszczególne litery twojego słowa:") for letter in word: print(letter) input("\n\nAby zakończyć program, naciśnij klawisz Enter")
4928ac44e67788d51ac0b85ab7a0dba3799c32b2
choroba/perlweeklychallenge-club
/challenge-064/lubos-kolouch/python/ch-1.py
592
4.0625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- from typing import List def min_sum_path(matrix: List[List[int]]) -> int: rows = len(matrix) columns = len(matrix[0]) for i in range(1, rows): matrix[i][0] += matrix[i - 1][0] for j in range(1, columns): matrix[0][j] += matrix[0][j - 1] ...
60de955c0c4469648eaf6dd52ba3c66a3a1b214e
Stormcross/PY
/kol1.py
430
3.75
4
#Zadatak 1 - http://degiorgi.math.hr/prog1/materijali/p1-zadaci_za_prakticni_kolokvij.pdf k=0 k= int(input("Unesite cijeli broj: ")) suma=0 djeljenik=1 while djeljenik<=k: if k%djeljenik==0: print(djeljenik) suma+=djeljenik djeljenik+=1 else: djeljenik+=1 if k<suma: print(...
24d10d7ea21307e9079ee6d8fdc5d01010b22557
Aishaharrash/holbertonschool-machine_learning
/math/0x00-linear_algebra/6-howdy_partner.py.bak
326
3.765625
4
#!/usr/bin/env python3 """ 6-howdy_partner.py Module that defines a function that concatenates two arrays """ def cat_arrays(arr1, arr2): """ Function that concatenates two arrays Args: arr1 (list): List 1 of integers/floats arr2 (list): List 2 of integers/float """ return arr1 +...
35be5f54e21587949afcc912acf1c96c2afef091
satty08/practice_problems_python
/Day58.py
1,966
4
4
''' We are given a binary tree (with root node root), a target node, and an integer value K. Return a list of the values of all nodes that have a distance K from the target node. The answer can be returned in any order. ''' import collections def distanceK(self, root, target, K): def dfs(node, parent = None): ...
1ceee6478a962600a4cdbabf6ffcc2e298b9aa57
kaseyriver11/leetcode
/src/python/1470.py
516
3.953125
4
""" Given the array nums consisting of 2n elements in the form [x1,x2,...,xn,y1,y2,...,yn]. Return the array in the form [x1,y1,x2,y2,...,xn,yn]. Input: nums = [2,5,1,3,4,7], n = 3 Output: [2,3,5,4,1,7] Explanation: Since x1=2, x2=5, x3=1, y1=3, y2=4, y3=7 then the answer is [2,3,5,4,1,7]. """ from typing import Li...
55c87fb1151a382f95af812387eac98f76332297
rmaduri9/BhavCopy
/test_ideas/paneWindow3.py
369
3.890625
4
''' Created on 09-Apr-2017 @author: rmaduri ''' from tkinter import * m1 = PanedWindow(background="blue") m1.pack(fill=BOTH, expand=1) left = Label(m1, text="left pane") m1.add(left) m2 = PanedWindow(m1, orient=VERTICAL, background="green") m1.add(m2) top = Label(m2, text="top pane") m2.add(top) bottom = Label(m...
316f1d2cb0602f445840d568d06522d0d81f3c7b
arun11299/ALgos-in-python
/strongest_conn_components.py
2,895
3.71875
4
##==================================================================== """ Strongest Connecting Components in a DIRECTED Graph using Kosaraju's 2 pass algorithm using DFS (Non recursive/Stack Based). """ ##==================================================================== ELEMENTS = 9 """ @class stack: A cl...
77cdea7fdc4647f12d0422ced545ce05fb6c231c
EugeneS30/SikuliHugeFrame
/csvToHtml.sikuli/csvToHtml.py
1,144
3.84375
4
import sys import csv import fnmatch if len(sys.argv) < 3: print "Usage: csvToTable.py csv_file html_file" exit(1) # Open the CSV file for reading reader = csv.reader(open(sys.argv[1])) # Create the HTML file for output htmlfile = open(sys.argv[2],"w") # initialize rownum variable rownum = 0 # write <table> t...
d28481575005d31b46bf0ff169d9ef3df94c67a6
Isur/python-algorithms
/app/statistics/poisson_process.py
776
4.15625
4
import math from matplotlib import pyplot as plt from numpy import random def poisson_process(rate, t1): """ Args: rate: events/time unit t1: number Returns: times: list of 'times' when event occur """ times = [] time = 0 while True: rnd = random.rand() ...
50aedf10b6987e44110eb159691f93a543cd1d22
HamPUG/examples
/ncea_level2/snippets/snip_l2_12_a.py
1,779
4.34375
4
#!/usr/bin/env python3 # import sys import math _description_ = """ Get integer entry for cubic meters. Calculate radius, diameter, and circumference in meters, of sphere holding this volume. Use iteration and output data for each loop. Simple programming flow. """ _author_ = """Ian Stewart - Decemb...
520b0b3ca15de8867ffed536eb229573219c4df9
LogeshNarayanan/Competitive-Coding-Challenges
/camelCase.py
509
4.09375
4
""" Alice wrote a sequence of words in CamelCase as a string of letters, , having the following properties: It is a concatenation of one or more words consisting of English letters. All letters in the first word are lowercase. For each of the subsequent words, the first letter is uppercase and rest of the letters are ...
a3d39ea100a2803e5faee9ad63e2ee778dc30251
palfrey/shiv
/stats.py
598
3.96875
4
from math import sqrt def mean(values): return sum(values) / (len(values) * 1.0) def median(values): avg = mean(values) values = sorted(values) for k in range(len(values) - 1): if values[k] < avg and values[k + 1] > avg: return values[k] assert False, "Shouldn't get here" ...
4148bef978d86b6817e9b9c51b6193e9987ca938
greenDNA/Python-Crash-Course
/Exercises/Chapter 9/2.py
565
3.75
4
class Restaurant: def __init__(self, restaurant_name, cuisine_type): self.name = restaurant_name self.cuisine = cuisine_type def describe_restaurant(self): print("Restaurant name is {} and serves {}.".format(self.name, self.cuisine)) def open_restaurant(self): print("The re...
38a9525548994482d3d69234dcfa1c3469676e12
gousiosg/attic
/coding-puzzles/binary_search_tree.py
2,599
3.96875
4
#!/usr/bin/env python3 from typing import List class Node: def __init__(self, left: 'Node', right: 'Node', val): self.left = left self.right = right self.val = val def insert(self, val): if val > self.val: if self.right is None: print(f"add {val} a...
009f60e23d18c465e16cefb3d2261bbfa0920f92
sumitpatra6/leetcode
/check_subtree.py
971
4.09375
4
# another solution is to cjeck for the pre order traversals for the binary trees # the smallest subtree will be a sub string of the bigger tree from binary_tree import BinaryTree def check_similarity(root1, root2): if not root1 and not root2: return True if not root1 or not root2: ret...
98c049679c2c67d4e9d40a1a18abc42d8b0ad8c0
htl1126/leetcode
/41.py
834
3.546875
4
# Ref: https://leetcode.com/problems/first-missing-positive/discuss/17080/Python-O(1)-space-O(n)-time-solution-with-explanation # Similar hash technique: https://leetcode.com/problems/find-all-duplicates-in-an-array/ class Solution(object): def firstMissingPositive(self, nums): """ :type nums: List...
536ce5824a57e42340fd5b2417af4353ba2d4a17
Rovinjan2231/Python-Final-Machine-Problem
/Project.py
7,804
3.640625
4
import os from Menu import Menu class Project(Menu): ''' Creates the project and handles all project-related operations. ''' # initialization def __init__(self, id = None, title = None, size = None, prio = None): self.__id = id self.__title = title self.__size...
98e66754fd9b7fd268930472ea70d88bc051cf2a
leenatomar123/list
/max.py
177
3.765625
4
number=[50,40,23,70,56,12,5,10,7] index=0 max=number[0] while index<len(number): m=number[index] if m>max: max=m index+=1 print("maximum num is",max)
7a352643920cd3090694d7d6ebd96a30f9ec3978
JacobLemley/SampleProject
/calculator.py
375
4.34375
4
#float() converts input number into a float num1 = float(input("Enter first number m8: ")) op = input("Enter Operator: ") num2 = float(input("Enter second number m8: ")) if op == "+" : print(num1 + num2) elif op == "-" : print(num1 - num2) elif op == "/" : print(num1 / num2) elif op == "*" : print(num1...
1fd4abd37651c8138059df3fbed7d4975c2b1714
AkibSadmanee/nfa2dfa
/Preprocess/nfa_preprocess.py
4,987
4.21875
4
def take_alphabet(): """ Takes input of alphabet(s) of a language and returns a list of alphabets """ alphabets = set() #Empty container for Symbols (Data-structure: DISJOINT-SET) key = "" alphabets.add('ε') counter = 1 print("ENTER ALPHABET") print(""" Enter 'done' to...
f78c33350e654e5dc50e7dacc9d1a6f9102456eb
ahmednkhan24/Object-Oriented-Languages-and-Environments
/hw3/src/akhan227HW03.py
2,233
4.1875
4
''' all print statements and input statements are only in this file, which allows future iterations to completely change the user inteface of the game by simply changing code in this file. This file can simulate any 2 player game without changing anything. All this file does is play a 2 player game by: continuin...
4b4500102536b3db078919dea2262eb6f61caed8
YuliiaShalobodynskaPXL/IT_essentials
/coursera_ex/king.py
185
3.84375
4
x = int(input()) y = int(input()) a = int(input()) b = int(input()) if a == x + 1 or a == x - 1 or a == x and b == y + 1 or b == y - 1 or b == y: print('Yes') else: print('No')
f49bc011d2d9bc138da3fa2f8336845ca041f5b5
wyh0106/python_homework
/SourceCode/work4-2.py
1,740
3.796875
4
# def get_name(firstn, lastn, middlen=''): # if middlen: # full_name = firstn.title() + '·' + middlen.title() + '·' + lastn.title() # else: # full_name = firstn.title() + '·' + lastn.title() # return full_name # # # stu_name = get_name(lastn="bush", middlen="N", firstn="gave") # print(stu_...
34c04a6f1f8d51b3adb85384546bfe7edd02795b
Dinesh-98/Python
/17.07.19/prog1.py
126
4.28125
4
n=int(input("Enter a number:")) if n%2 == 0: print("{} is Even".format(n)) else: print("{} is Odd.".format(n))
76d4eb589190511e998096b24a6837c810bf1444
jklemm/curso-python
/exercicios_basicos/ex_05_calculo_de_imc_v2.py
1,254
3.890625
4
# coding: utf-8 print('=== Cálculo de IMC ===') # meu editor estava reclamando que não inicializei as variáveis com valores peso = 0 altura = 0 try: peso = input('Informe seu peso: ') # converte string para float e remove sinal negativo (não existe peso negativo) peso = abs(float(peso)) except ValueError...
29a7a693fc725060a3527bdc52cca8f5efc41002
roblivesinottawa/school_database
/main.py
7,262
3.703125
4
import mysql.connector from mysql.connector import Error import pandas as pd from passcode import pw # connecting to MYSQL server def create_connection(hostname, username, passcode): connection = None # closes any exisiting connections so that the server doesn't become confused try: connection = mysql....
518864d837a10bf5a1d9b78e7d0a227d73ac262f
pontes-guilherme/webservice
/client/Requests.py
2,001
3.53125
4
import requests as req from Functions import Functions as func class Requests: #urls get passagem URL_GET_PASSAGEM = 'http://localhost/pacotes/server/passagem' URL_POST_PASSAGEM = 'http://localhost/pacotes/server/passagem/comprar' #urls get hospedagem URL_GET_HOSPEDAGEM = 'http://localhost/pacotes/...
ada4adea62de8d57ddb3e52063dbc41ba19b4e66
hiepxanh/C4E4
/DauMinhHoa/W2-as3-Sheep.py
488
3.671875
4
<<<<<<< HEAD ##2.1 sizes = [5,7,300,90,24,50,75] print('Hello, my name is hiep and these are my sheep sizes:') print(sizes) ##2.2 m=max(sizes) print("Now my biggest sheep has size",m, "let's shear it !") ##Tu 2.3 chiu ======= ##2.1 sizes = [5,7,300,90,24,50,75] print('Hello, my name is hiep and these are my she...
d40d3c407d82e2cc1fbdd06bc80ad617f520dfe2
cycosan/udemy
/encapsulation.py
291
3.65625
4
class computer: def __init__(self): self.__maxprice=1000 def sell(self): print("Selling price {}".format(self.__maxprice)) def setmaxprice(self,price): self.__maxprice=price c=computer() c.sell() c.__maxprice=1100 c.sell() c.setmaxprice(1100) c.sell()
846218a0937151020b2c0bf85dde1c655ab2dbdf
aijimenez/Application
/Habitsbox_app/menu.py
34,724
3.59375
4
""" This module shows the different options that the user has when adding his/her habits and trackings. """ import sys import pyinputplus as pyip from app.analytics import Analytics class Menu: """ Show a menu and react to the user options. """ def __init__(self): """ Create an insta...
29e8c0cb177245be8026ae5bf5f1807d1f5abf66
amz049/IS-Programming-samples
/IS code examples/Unit 5/stats.py
787
3.8125
4
# Put your code here lyst = [3, 1, 7, 1, 4, 10] # Median function def median(x): medianNum = [] for numbers in x: medianNum.append(float(numbers)) medianNum.sort() midpoint = len(medianNum) // 2 if len(medianNum) % 2 == 1: return medianNum[midpoint] else: return (medianN...
92c6cf4b8bb0307946ee629cd01e1f28ecaedd39
sankeerthankam/Code
/Leetcode/Learn/1. Array/1295. Find Numbers with Even Number of Digits.py
384
3.75
4
# Approach 1 # Type convert int to str, Calculate len of each string and store them in list comp # Return len of list def findNumbers(nums): x = map(lambda x: len(str(x)), nums) return len([i for i in x if i%2 == 0]) # Approach 2: # Naïve Approach def findNumbers(nums): cnt = 0 for i in nums:...
949e478cb4a83b5938bb29f0d01c0a20ea0cd943
lobhassangai/Lobhas-sangai
/Assignment 2.py
832
4.15625
4
#!/usr/bin/env python # coding: utf-8 # In[7]: #assigning elements to different lists list1=[1,2,3,4] list2=[] for i in range(len(list1)): list2.append(list1[i]) # In[8]: #accessing elements from a tuple tuple = ("virat","mahendra","rohit") for x in tuple: print(x) # In[ ]: #deleting differen...
e0f963daa8e4d916904ee752dadcce20b5b6b6a3
PayPalHack-Chicago/Team-15
/python/test.py
1,223
3.6875
4
import csv import json a='salary data.csv' b='median_.csv' f = open(b ) reader = csv.reader(f) reader = csv.reader(f) #csv reader next(reader) dic={} #for a,b,c,d,e,f,g,h in reader: # loop gives each column a name # b=str(b).replace('"','').replace('$','').replace(',','') # c=str(c).replace('"','').replace('$...
573e5e4e76813d0ecd9797497574d9e43367c20d
s3icc0/Tutorials
/DBTut/Lesson 006 Lists/pytut_006_004.py
589
4.125
4
# LIST COMPREHENTION # perform action on each item in the list import random import math # double each i to be put to the list # perform a e.g. calculation on the geerated range evenList = [i * 2 for i in range(11)] for i in evenList: print(i) print() print() numList =[1, 2, 3, 4, 5] # multidimensional list...
d9d1e3140303067543c4d0eb78b1759cb568a744
pombreda/comp304
/Assignment4/atom3/Kernel/GraphicEditor/Handles.py
9,069
3.9375
4
# Handles.py # Francois Plamondon # Summer 2003 import Tkinter # class HandleSet: # A handle set is made of 8 handles which are placed around a box given as argument. The # box can be set with the "set" method. A handle in a handle set is named according to its relative # position in the set: # # "x0y0"......"x01y...
77997a1dde16b45d3e4ff9327be367d49838ed66
aksonai/leetcode
/0020-valid-parentheses/solution.py
565
3.703125
4
class Solution: parens = {'(': ')', '[': ']', '{': '}'} def isValid(self, s: str) -> bool: if not s: return True elif len(s) % 2 == 1 or s[0] in self.parens.values(): return False arr = [] for paren in s: if paren i...
9f5b45ac1a71f97224e859da28df2f341d9f3d9a
Marcus-Mosley/ICS3U-Unit3-08-Python
/leap_year.py
783
4.375
4
#!/usr/bin/env python3 # Created by Marcus A. Mosley # Created on September 2020 # This program checks if a year is a leap year def main(): # This function checks if a year is a leap year # Input year = int(input("Please enter the year: ")) print("") # Process & Output if year % 4 == 0: ...
ba9ea13fc7964817b2dacd9569cd984961d36b43
pocoyog/pocoyog
/Hangaroo.py
2,150
3.9375
4
import string alph = string.ascii_lowercase print ("Hey! Welcome to Hangaroo Let's start by choosing any word. Type it like: The game hangaroo('word')") def isWordGuessed(secretWord, lettersGuessed): t = 0 for s, letter in enumerate(secretWord): if letter in lettersGuessed: t += 1 if t ==...
512bd2a927ed1901ca805c454a904db07530ab6d
Vanya-Rusin/labs
/Завдання 2.py
996
3.84375
4
# This is a sample Python script. # Press Shift+F10 to execute it or replace it with your code. # Press Double Shift to search everywhere for classes, files, tool windows, actions, and settings. def print_hi(name): # Use a breakpoint in the code line below to debug your script. print(f'Hi, {name}') ...
689d92a8e07ab072afa437407b9c9786dd12acd3
garybergjr/PythonProjects
/GettingStarted/conditionals/ifStatement06.py
147
3.5
4
number = 5 if number != 5: print("This will not execute") python_course = True if not python_course: print("This will also not execute")
decbfc38831727a209ff0e580e1d0ac291bee92a
devesh37/HackerRankProblems
/Datastructure_HackerRank/Linked List/FindMergePointOfTwoLists.py
1,508
4.09375
4
#!/bin/python3 #Problem Link: https://www.hackerrank.com/challenges/find-the-merge-point-of-two-joined-linked-lists/problem import math import os import random import re import sys class SinglyLinkedListNode: def __init__(self, node_data): self.data = node_data self.next = None class SinglyLinkedL...
68c6b70724fc8123c9058b226f58d7be503f0745
Subhasishbasak/Python
/Syntax/ExpTreeTrivial.py
568
3.75
4
from Tree import * class ExpTree(Tree): def evaluate(self): if self.isempty(): return None if self.leaf(): return self.value if self.value == '+': return(self.left.evaluate() + self.right.evaluate()) elif self.value == '-': return(self.left.evaluate() - self.right.ev...
8537c1f2c3f1864dd43e93fb9cd46451eeb000a3
ManushApyan/python_lessons
/input_dict.py
194
4.03125
4
my_dict = {} my_count = int(input("Please input how many keys: ")) key = [] for i in range(my_count): j = input("enter your key ") x = input("enter your value ") my_dict[j] = x print(my_dict)
64523da8f93b24f487239859a3e52da6d0b1af70
vinaud/Exercicios-Python
/Algoritmos/lista_grande.py
252
3.625
4
# dado n, gera uma lista com n inteiros from random import randint def lista_grande(n): lista = [] for i in range(n): x = randint(0,100000) lista.append(x) return lista print(lista_grande(5)) print(lista_grande(4))
e8f5b6d49eadcba82f319ce159ba9bbdd89ea465
RadicalZephyr/Python-Stuff
/random/getBinary.py
223
3.765625
4
def getbinary(number): k ='' while(number): if number%2==1: k='1'+k number = number/2 else: k='0'+k number = number/2 print k getbinary(int(raw_input()))
334f7c165fe3e16d3b88a40fd536e88d2c6f3f52
tuonglan/Study
/Python/ZoneA-HelloWorld/errorExample.py
285
3.546875
4
import traceback def spam(): bacon() def bacon(): raise Exception('This is the error message') try: spam() except: errorFile = open('errorInfo.txt', 'w') errorFile.write(traceback.format_exc()) errorFile.close() print('The traceback info was written to errorInfor.txt file')
ac36de30268281c199dc674c023e9e6e1737b165
mathiujesse/PythonPracticeMosh
/comparisonops.py
335
4.28125
4
temperature = 35 if temperature != 30: print("its a hot day") else: print("it's not a hot day") #exercise #after correction name = ['Jesse'] len(name) if len(name) > 3: print("you're name is too long") elif len(name) > 50: print("Name can't be maximum of 50 characters") else: print("Name looks go...
41d82ea784b345283e5dc4df0efbad43cfd5ea42
LudweNyobo88/SickleCellDisease
/SickleCellDisease.py
1,977
3.75
4
import time #TRANSLATE FUNCTION def translate(DNA_seq): #Defining translate function with DNA_seq as a parameter #Declaring the table of SLC and codon constants as a variable(dictionary) table = { 'ATA':'I', 'ATC':'I', 'ATT':'I', 'CTA':'L', 'CTC':...
be978ea10344389577386068b79cbf5c258916ae
BenDu89-zz/MoveWebsite
/media.py
938
3.8125
4
import webbrowser # To open urls in a webbrowser in the def show_movie class Movies(): ''' The class movie contains the basic data of the movie, as title, storyline, trailer url and poster image url''' VALID_RATINGS = ["G","PG","PG-13","R"] # diffrent posible rankings for the movies def __init__(self, ti...
3194bab1bfc8560ec40b6d261a9ecadb3c5e87a4
amoako1/weather
/globalcode/evens.py
205
3.921875
4
def evens(): fr = int (input('input your first number')) ln = int (input ('your second number')) for i in range (fr,ln): if (i %2 == 0): print (i) evens()
4be4cbe10bf49846214381efe9a763f6625ceefc
chlos/exercises_in_futility
/leetcode/design_most_recently_used_queue.py
1,812
3.828125
4
from sortedcontainers import SortedList class ListNode(): def __init__(self, val=None): self.val = val self.next = None def __repr__(self): return f'{self.val}' def print(self): out = f'{self.val}' node = self.next while node: out += f' -> {no...
46b68d21d387002133ec3fb3eab88651f169780f
annaiszhou/LC
/python/543.py
668
3.796875
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def diameterOfBinaryTree(self, root): """ :type root: TreeNode :rtype: int """ se...
905c09d92cafd5cdcf6f14584c81860caf41d255
iqzar/Marksheet-assignment1
/Task8.py
263
4.34375
4
#Make a new string from given string use 'is' in front of that string def new_string(str): if len(str) >= 2 and str[:2] == "Is": return str return "Is" + str #Main program string=input("Enter your string: ") print("New string :",new_string(string))
cb3bfd88df2adcea6b606766ea30b9a048f676c4
nabhanyaneb/CS440--AI
/Code2_nn291_ar1516/minesweeper_basic_better_decisions.py
12,278
3.515625
4
import random from random import randrange import pygame import heapq #colors WHITE = (255,255,255) BLACK = (0,0,0) MINE = (168, 89, 154) CLICKED = (82,82,82) UNCLICKED = (181, 181, 181) SAFE = (128, 176, 160) RED = (140, 21, 10) class State: #State object that makes up the board uncovered = False total_neigh...
083980d2008cc85b6df4657aa790cdcd44146d99
AvanthaDS/PyLearn_v_1_0
/Av1.py
288
3.984375
4
__author__ = 'Avantha' a = input('please enter a:') b = input('please enter b:') print('The summation of a + b is:') print(int(a)+int(b)) if a>b: c = (int(a)+int(b))/int(a) else: c = (int(a)+int(b))/int(b) print('the golden ration of the two number you enterd is:' + str(c))
3f88e849f819e5320f076a012e9e19ee50cabe21
alexvasiu/FP-Labs
/Teme/UI/UI.py
1,522
3.671875
4
""" UI Layer """ class UI: """ clasa de UI """ def __init__(self, controller): """ initializare cu controller """ self.__controller = controller def showMenu(self): """ afisare meniu, citire date, afirare rapoarte """ w...
55d583989b36193f9681cb40aab76c66e511ae18
DoubleAV/Python-DSA-Practice
/firecode.io/LevelOne/repeatedElementsInArray.py
281
4.0625
4
# check for repeated elements in an array and return those elements in a sorted array def duplicate_items(list_numbers): # key here is to use a set return sorted(set(x for x in list_numbers if list_numbers.count(x) > 1)) print(duplicate_items([9,8,8,3,3,9,1,1,3]))
f7565eaf4d876caed63ed97c3ecf6dc36cb3ab19
rakesh90084/practice
/tuple.py
158
3.703125
4
names=("rakesh","arif","gulshan") id=(13,45,56) print(len(names)) print(names+id) print(id*3) if(names in id): print("yes") else: print("no") print(names)
dcd15dedbd9dea9782e4d594a555e20f86ae293a
e-harris/vehicle_classes
/car_class.py
556
3.71875
4
from vehicle_class import * # car class # import my vehicle class # define car class here and make it inherit from vehicle #Characterists: # brand # horse_power # max_speed #methods : # park # honk class car(vehicle_class): def __init__(self, passengers, cargo, brand, horse_power, max_speed): super...
671c21d4fa45462aa8c6bc5110976e84a32f839a
haozou/AI_1
/src/player/player.py
8,651
3.703125
4
''' Created on 2013-1-26 this file contains the Class Player and the Class AI, AI inherits the Player. @author: Hao Zou ''' import time from chessboard.chessboard import ChessBoard # the chess board cb = ChessBoard(3,3) # the class Player, used to implement the player's behavior class Player: # initial functio...
81dea2d0616d76bf696a8f182c9753ebd1e4d9fa
Ahmed-Saleh-007/python-labs
/day1/lab1_6.py
218
3.890625
4
def locations_of_char_in_str(string, char): lst = [] for i in range(len(string)): if (string[i] == char): lst.append(i) return lst print(locations_of_char_in_str("Google", 'o'))
22530f8b818ee9b686c1094e2dacf5fc5ed8fa1f
RRoundTable/CPPS
/DP/Cherry_Pickup.py
3,140
4.21875
4
''' link: https://leetcode.com/problems/cherry-pickup/ In a N x N grid representing a field of cherries, each cell is one of three possible integers. 0 means the cell is empty, so you can pass through; 1 means the cell contains a cherry, that you can pick up and pass through; -1 means the cell contains a thorn that...
df132a59706cc953c09afdc91bdddf692e11a5a4
nitishk111/InfyTQ-Python-Assignment
/Assignment11.2.py
515
4.09375
4
# -*- coding: utf-8 -*- """ Created on Mon Jul 27 02:02:08 2020 @author: Nitish """ def fact(num): if num==0: return 1 else: return fact(num-1)*num num_list=list(map(int,input("Enter list: ").split())) strong_num=list() for i in num_list: b=0 j=i while i>0: ...
7f4c4611d67ac011f211556a0db561fa049c1755
FumihisaKobayashi/The_self_taught_python
/7_section/7_9.py
312
4.09375
4
for i in range(1,6): if i == 3: continue print(i) #1〜5の数字を入力したいが3を省きたい。 #iが3の時continueで続きは表記されないwhileループとの組み合わせ。 i = 1 while i <= 5: if i == 3: i += 1 continue print(i) i += 1
7d5777a4e8b0eaac6598cb7f34612da5c2fe4476
OgieeRakha/learning
/python-learn/sequence_types/unpacking.py
324
3.984375
4
#we could easily assign a value into a variable #and this happens to be the easiest way to do one a = b = c = d = e = f = 42 print(c) x, y, z = 1, 2, 76 print(x) print(y) print(z) data = 1, 2, 76 x, y, z = data print(x) print(y) print(z) #trying to unpack a list data_list = 1, 2, 76 x, y, z = data_list print(data_li...
3ae4398698d07b06673f71b71adfcc12f0b23965
Vaughn19/Piggy
/student.py
9,774
3.671875
4
#!/usr/bin python3 from collections import OrderedDict from teacher import PiggyParent import sys import time class Piggy(PiggyParent): ''' ************* SYSTEM SETUP ************* ''' def __init__(self, addr=8, detect=True): PiggyParent.__init__(self) # run the parent constructor ...
84a7e375e06e613e114b19d490a0304ee3a796f2
90yongxucai/jarvisoj.com
/Basic/Baby's Crack/solve.py
569
3.75
4
#!/usr/bin/env python3 ciphertext = b'jeihjiiklwjnk{ljj{kflghhj{ilk{k{kij{ihlgkfkhkwhhjgly' def Encrypt(bs): ret = bytearray() for i in bs: if 47 < i and i <= 96: i += 53 elif i <= 46: i += i % 11 else: i = i // 61 * 61 ret.append(i) retu...
ba9988c8e1df43f75276d2167f8414fcfe726af6
JahnChoi/USStockMarketActivityProgram
/stockmarket_csv_reader.py
1,495
3.5625
4
# U.S. Stock Market Activity Program (Stock Exchange CSV Reader) # 3/4/17 import csv EXCHANGE_DICT = {'AMEX': 'C:\\Users\\JahnC\\Desktop\\Stock Market API\\Stock Exchange CSVs\\AMEXcompanylist.csv', 'NASDAQ': 'C:\\Users\\JahnC\\Desktop\\Stock Market API\\Stock Exchange CSVs\\NASDAQcompanylist.c...
3fe71757623ba9eac28b194823d1aa2b32e90053
jayinai/inf1340
/inf1340_ass1/exercise3.py
2,761
4.59375
5
#!/usr/bin/env python3 """ INF 1340 (Fall 2014) Assignment 1, Exercise 3 Purpose of Assignment: to create a table that determines the result of an imaginary rock, paper, scissors game. There are two participants in the game: Player1 and Player2. Each player is able to input rock, paper and scissors. ...