blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
10a10c46843adf9ccc5c3c1437ae3ff7083c7cfe
hevalenc/-Python-Introduction-to-Data-Science-and-Machine-learning
/numpy_basic_calculations.py
246
3.71875
4
import numpy as np var1 = np.array([2, 4, 6]) #array de 1 dimensรฃo print(var1) var1 = np.array([(2, 4, 6), (1, 3, 5)]) #array de 2 dimensรตes var2 = np.array([(2, 4, 6), (1, 3, 5)]) print('var1: ',var1) print('var2: ',var2) print(var1 + var2)
8464dda736161badc5d71c0a53e7c766e40629eb
click-here/practicing-python-classes
/home-inventory/inventory_1.py
547
3.9375
4
class Item: item_location = "click-here's home" def __init__(self, name, home_location): self.name = name self.home_location = home_location def __str__(self): return "Item " + self.name class Food(Item): def __init__(self, name, home_location='Kitchen'): self.name =...
3d06bb681b3256c79cd2108cc046cc707e3071d9
wherculano/Curso-Selenium-com-Python
/Exercicios Introduรงรฃo ao Python/011 - Nome e vogais.py
282
4.1875
4
""" Faรงa um programa que itera em uma string e toda vez que uma vogal aparecer na sua string, print o seu nome entre elas """ vogais = 'aeiou' string = 'bananas' nome = input('Nome: ') for letra in string: if letra in vogais: print(nome) else: print(letra)
d79bcb8f3c2efd0c375c7eb1ada3d4ac1f1d1581
wangbqian/python_work
/cainiao/cainiao_1.py
318
3.6875
4
"""1.ๆฏ”ๅฆ‚่‡ช็„ถๆ•ฐ10ไปฅไธ‹่ƒฝ่ขซ3ๆˆ–่€…5ๆ•ด้™ค็š„ๆœ‰,3,5,6ๅ’Œ9๏ผŒ้‚ฃไนˆ่ฟ™ไบ›ๆ•ฐๅญ—็š„ๅ’Œไธบ23. ๆฑ‚่ƒฝ่ขซ3ๆˆ–่€…5ๆ•ด้™ค็š„1000ไปฅๅ†…ๆ•ฐๅญ—็š„ๅ’Œ""" # sum = 0 # for i in range(1000): # if i % 3 == 0: # sum+=i # elif i%5 == 0: # sum+=i print(sum(i for i in range(1000)if i%3 == 0 or i%5 == 0))
e12382f36f55bc920681019a9967212628fca441
Anasshukri/Lets-Learn-Python
/Calculate My Age.py
688
4.0625
4
from datetime import date def ask_for_date(name): data = input('Enter ' + name + ' (yyyy mm dd): ').split(' ') try: return date(int(data[0]), int(data[1]), int(data[2])) except Exception as e: print(e) print('Invalid input. Follow the given format') ask_for_date(name) def...
5aaac4f4e78a06f4625dcffb63d73bdc169a510e
Nidhi4-p/python
/python_practice/p6.py
724
4.46875
4
'''question:You are required to write a program to sort the (name, age, height) tuples by ascending order where name is string, age and height are numbers. The tuples are input by console. The sort criteria is: 1: Sort based on name; 2: Then sort based on age; 3: Then sort by score. The priority is that name > age > sc...
12f8e890727dd995210daf79473c975530793444
matheuskiser/pdx_code_guild
/python/dungeon_crawler/main.py
3,475
3.890625
4
from player import Player from monster import * import random # Displays to player what they want to do def display_menu(): option = 0 while option != 2: print "1. Start a game" print "2. Exit" option = int(raw_input("Pick an item: ")) pick_option(option) # Picks option from...
d32dd8fdc7640533d95acb78f66181204947d004
StefanDimitrovDimitrov/Python_Fundamentals
/Python_Fundamentals/Fundamentals level/01.List Basics- lab/13.Seize the Fire.py
1,049
3.984375
4
# 1. Validate input # 2. Check Water to a fire Amount # 3. Calculate Water # 4. Calculate Effort def IsItInRange(type, value): if type == 'High' and value >= 81 and value <= 125: return True if type == 'Medium' and value >= 51 and value <= 80: return True if type == 'Low' and value >= 1 and...
0417fd64d0ae6afde3f50610475067934b5a4a61
LzWaiting/00.pythonbase
/code/function/student_info_fun.py
8,238
3.765625
4
# ๅฐ่ฃ…ๅฝ•ๅ…ฅ็š„ๅญฆ็”Ÿไฟกๆฏ๏ผš def input_student(*args): L = [] while True: name = input("ๅง“ๅ:") if not name: break d = {} # ๅˆ›้€ ๆ–ฐๅญ—ๅ…ธ๏ผŒ้‡ๅคๅˆฉ็”จ d['name'] = name age = int(input("ๅนด้พ„:")) d['age']= age score = int(input("ๆˆ็ปฉ:")) d['score'] = score L.append(d) return L # <<<โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”โ€”...
cf664bd2789ccd4ed9076c50b758a78b7031931c
tbs1-bo/hardware-101
/hd44780/lcd.py
1,995
3.546875
4
import RPi.GPIO as GPIO import time class LCD: CLEAR_DISPLAY = 0x01 RETURN_HOME = 0x02 def __init__(self, e_pin, rs_pin, d4, d5, d6, d7, boardmode=GPIO.BCM): GPIO.setmode(boardmode) self.rs_pin = rs_pin self.e_pin = e_pin self.d4 = d4 self.d5 = d5 self.d6 ...
65e0ac83c5d327b379ca39cd74cdf95498468490
Rock1311/Python_Practise
/all_divisor_of_a_number.py
207
4
4
##print(all divisor of a number) num = int(input('Please enter any number: ' )) list = [] for x in range (1,num): remainder = num%x if (remainder == 0): list.append(x) print (list)
fec76bdbb8aec39a13e86d00eddba7d2c6b03e90
mjoblin/neotiles
/examples/speckled_tiles.py
4,047
3.6875
4
# ============================================================================= # Draws three speckled tiles and updates each tile's base color once per # second. A speckled tile is just a single block of color where each pixel's # intensity is varied slightly to give it a somewhat speckled look. The top # left tile ...
63952ef79d87affb91e421d68b152321ca4e6140
stunningspectacle/code_practice
/python/projecteuler/62.py
432
3.671875
4
#!/usr/bin/python def sort_cube(num): cube = list(str(num ** 3)) cube.sort() return "".join(cube) def prob62(): TOP = 10000 cube = {} for i in xrange(11, TOP): str_cube = sort_cube(i) if str_cube in cube: cube[str_cube] += [i] if len(cube[str_cube]) == 5: print cub...
2489d3bb4927a0aab560aab694779ad62c8b500e
sivaprasadnsp/Python-OOP
/Inheritance/prog01.py
385
3.59375
4
class Person: def method1(self, a, b, c): self.var1 = a self.var2 = b self.var3 = c class Employee(Person): pass def main(): obj1 = Person() obj2 = Employee() obj1.method1(1, 2, 3) print(obj1.var1, obj1.var2, obj1.var3) obj2.method1(3, 4, 5) print(obj2.var...
37e9ec85ea551c5a0f77ba61a24f955da77d0426
loc-dev/CursoEmVideo-Python-Exercicios
/Exercicio_022/desafio_022.py
662
4.375
4
# Desafio 022 - Referente aula Fase09 # Crie um programa que leia o nome completo de uma pessoa # e mostre: # - O nome com todas as letras maiรบsculas e minรบsculas. # - Quantas letras no total (sem considerar espaรงos). # - Quantas letras tem o primeiro nome. nome = input("Digite o seu nome completo: ") print('') print...
5e18f4eb9f8a8249fc69ceecf8fbd6b24dd4512f
impankaj91/Python
/Chepter-11-Inheritance/sample_inheritance_multilevel.py
223
4
4
class Animals: type="Pet" class Pet(Animals): name="Dog" class Sound(Pet): sound="Bow Bow" s=Sound() print(f"Type of Animal is {s.type}\n Name is {s.name} and sound is {s.sound}\n***************")
bcbcefa63dbbebeeb835c35509fb6dc1bf39b3b3
Highjune/Python
/BasicConcept/class/classdemo1.py
752
4.25
4
class Employee: """Employee ๊ฐ์ฒด์˜ ์„ค๊ณ„๋„์ž…๋‹ˆ๋‹ค.""" def __init__(self, name): #์ƒ์„ฑ์ž self.name = name def getName(self): #getter return self.name def setName(self, newName): #setter self.name = newName def toString(self): #toString return 'name = {}'.format(self.name) smith ...
d4ffdc5c52bb60246493ba3ade4d455c00c309f7
usnistgov/Economic-Resilience-Guide
/GUI/InfoPage.py
36,408
3.75
4
""" File: InfoPage.py Author: Shannon Grubb Description: Interacts with EconGuide.py, builds the GUI for the InfoPage, the first page the user will input data on. """ import tkinter as tk from tkinter import messagebox from tkinter import ttk #for pretty buttons/labels ...
59c30aacd02becff8ed1935b685db4e151a3047f
cristinamais/exercicios_python
/Exercicios Estruturas Logicas e Condicionais/exercicio 41 - secao 05.py
1,247
3.984375
4
""" 41 - Faรงa um algorรญtmo que calcule o IMC de uma pessoa e mostre sua classificaรงรฃo de acordo com a tabela abaixo: IMC | Classificaรงรฃo ------------------------------------------------------------ < 18,5 ----------------> Abaixo do peso 18,5 - 24,9 -------------> Sau...
2d973f92a733cbec8cd7aef8d0adc5a3e3e555e7
jithendarreddy/guvi-set1
/13.py
171
3.5
4
n=int(input()) i=2 k=0 while i<n: if n%i==0: k=1 print("no") i=i+1 if k==0: print("yes")
f67fc8fb3f5a3de50883b84feae91e29b6ddaa2b
danieldfc/curso-em-video-python
/ex006.py
348
3.984375
4
numeric_value = int(input('Digite um nรบmero: ')) dobro = numeric_value * 2 triplo = numeric_value * 3 raiz_quadrada = numeric_value ** (1/2) print('O dobro de {} vale {}.'.format(numeric_value, dobro)) print('O triplo de {} vale {}.'.format(numeric_value, triplo)) print('A raiz quadrada de {} vale {:.2f}.'.format(num...
57593a9f14112271934e413b077691ad3ea6eb43
lookatjith/path_planning
/random_approach/random_planner.py
3,091
4.28125
4
#!/usr/bin/env python import numpy as np import matplotlib.pyplot as plt from utils.plot_simulator import plot_movement class RandomPlanner(object): """ Robot tries to achieve the goal point with in a max_step_number. The robot finds the new pose by randomly incrementing/decrementing the current pose ...
1d07a257f904aaf4487a31af6a7f6b12e430db48
Vijay1234-coder/data_structure_plmsolving
/Mix Questions/combination.py
418
3.9375
4
from itertools import combinations # A Python program to print all combinations # of given length with unsorted input. from itertools import combinations s=[] # Get all combinations of [2, 1, 3] # and length 2 a=[1,2,3,4,5,6] for i in range(len(a)+1): comb =list(combinations(a,i)) s.extend(comb) for i i...
06f4cedce03dfd7641424812899a3a9d3bb682e2
Jerrytd579/CS-with-Data-Analysis
/Highschool CS/Machine Learning.py
6,653
3.5625
4
# Improved example. Uses training and test set. __author__ = 'bixlermike' # Based on tutorial at http://www.laurentluce.com/posts/twitter-sentiment-analysis-using-python-and-nltk/ # This version uses different data set, incorporates optional neutral tweet category, # removes hashtags from tweet, and stems words i...
34aaff8097e933c8e9013b4c32ee489036f04bfb
meredithtutrone/homework
/Higher Order Function on GitHub.py
662
3.515625
4
#4 different examples higher order functions #1 def add(a): def func(b): return a + b return func twoMore = add(2) x = 10 xPlusTwo = twoMore(x) print(xPlusTwo) #2 def mult(a): def func(b): return a * b return func timesTheOther = mult(4) x = 2 xTimesA = timesTheOther(x) print(xTim...
e54dba462df62e7d002c8ed960abae968dbf2429
Rielch/holbertonschool-higher_level_programming
/0x04-python-more_data_structures/2-uniq_add.py
213
3.796875
4
#!/usr/bin/python3 def uniq_add(my_list=[]): new_list = my_list.copy() new_list.sort() res = 0 a = 0 for i in new_list: if i != a: res += i a = i return res
936c2961889ace76bdf1975d7390a83f25c9b242
jax11000/movie_display
/media.py
758
3.5
4
""" Module to display movie object, attributes and instances """ import webbrowser class Movie(): # defines what a movie object should be """ Class object stores movie info """ def __init__(self, title, storyline, image, youtube_url): self.title = title self.storyline = storyline ...
883ffcfab69077c57d009a4d45a2a0db90cb43bd
JDer-liuodngkai/LeetCode
/leetcode/945 ไฝฟๆ•ฐ็ป„ๅ”ฏไธ€็š„ๆœ€ๅฐๅขž้‡.py
743
3.859375
4
from typing import List """ ่พ“ๅ…ฅ๏ผš[1,2,2] ่พ“ๅ‡บ๏ผš1 ่งฃ้‡Š๏ผš็ป่ฟ‡ไธ€ๆฌก move ๆ“ไฝœ๏ผŒๆ•ฐ็ป„ๅฐ†ๅ˜ไธบ [1, 2, 3]ใ€‚ move ๆ“ไฝœ: ้€‰ๆ‹ฉไปปๆ„1ไธชๆ•ฐ๏ผŒ+1 ๆฏๆฌก้€‰ไธญ1ไธชๆ•ฐ๏ผŒๅขžๅŠ 1๏ผŒไฝฟๅพ—ๆ•ฐ็ป„ๅ”ฏไธ€ ้—ฎ้œ€่ฆๆ‰ง่กŒ็š„ move ๆฌกๆ•ฐ """ class Solution: def minIncrementForUnique(self, A: List[int]) -> int: A.sort() # ๆ•ฐ็ป„ๅ”ฏไธ€๏ผŒๅˆคๆ–ญไธฅๆ ผๅขžๅบ็š„ๅ€ผ ๆ˜ฏๅฆๆปก่ถณไธ็ญ‰ res = 0 n = len(A) for i in rang...
bc9f33aeef94819f7efb0ed41cbbf0e653a5dde6
thedonflo/Flo-Python
/ModernPython3BootCamp/Loops/Screaming_Repeating.py
126
3.9375
4
user_input = input("How many times do I have to tell you? ") for i in range(int(user_input)): print("CLEAN UP YOUR ROOM!")
79f0a6d026bd56e3b584a86e88ff36ccd3a316ae
yasar11732/stringutils
/stringutils.py
2,616
3.640625
4
from string import (letters, digits, punctuation, whitespace, lowercase, uppercase, hexdigits, octdigits, printable) from itertools import groupby from os import name as osname if osname == "nt": newline = "\r\n" else: newline = "\n" isSomething = lambda thing: lambda x...
3b87f84f337826485a92564e9ec76e1bd7f537b7
OSUrobotics/me499
/types/others.py
673
3.953125
4
#!/usr/bin/env python3 from math import pi import decimal import fractions if __name__ == '__main__': # There are other types in Python, and we'll show you how to create your own types later in the class. Here are # a couple of examples: # Fixed and arbitrary precision floating point arithmetic: http...
db391d6b0e7ecf265bc5c9aa66253f2c5dc32144
HBharathi/Python-Programming
/constructor1.py
221
3.625
4
class Person: def __init__(self,name): #constructor self.name=name def talk(self): print(f" Hey {self.name}, please speak up!!!") p1 = Person("Annu") p1.talk() p2 = Person("Bharathi") p2.talk()
1cccb1bb568fbd8946b5062d196efa519a6c5841
daniel-reich/ubiquitous-fiesta
/kmruefq3dhdqxtLeM_16.py
192
3.71875
4
def sum_digits(m, n): sum=0 for a in range(m,n+1): string=str(a) for b in string: b=str(b) sum+=int(b) return sum
5ec1543c3d5c2e49bc13a3a8333e966f0b429be6
jpvt/Reinforcement_Learning
/intro_projects/Intro to Gym Model-Free/qlearning_intro.py
530
3.78125
4
import gym #Inclui pacote Gym, essencial para RL env = gym.make('MountainCar-v0') #Inicializa ambiente env.reset() #Resets Env done = False #sets finished state as False random_act = 2 #For this problem there is 3 actions, for example we initially choose 2 while not done: action = random_act # define action ...
06116f147b90a8c8372e763e601734de3242df9a
umunusb1/Python_for_interview_preparation
/all/patterns/01_square_pattern.py
3,005
4.09375
4
#!/usr/bin/python def square_pattern(n): """ * * * * * * * * * * * * * * * * * * * * * * * * * """ for i in range(n): print('* ' * n) def square_number_pattern(n): """ 1 1 1 1 1 2 2 2 2 2 3 3 3 3 3 4 4 4 4 4 5 5 5 5 5 """ for i in range(1, n + 1...
273e02b28d72d9c55ffd2e50db34a3497f1579f6
cznccsjd/learnOpenpyxl
/workPandasNumpy.py
1,928
3.75
4
#coding:utf-8 """ openpyxlๅญฆไน ๆ–‡ๆกฃ๏ผšWorking with Pandas and Numpy url:http://openpyxl.readthedocs.io/en/latest/pandas.html#numpy-support """ ### Working with Pandas Dataframes # The openpyxl.utils.dataframe.dataframe_to_rows() function provides a simple way to work with Pandas Dataframes: from openpyxl.utils.dataframe impor...
f9a588b46fc5c688c977821f9b02b1b413f48154
laricarlotti/python_exs
/ex_017.py
151
4.125
4
# Exercise 17 from math import sqrt num = int(input("Type a number: ")) square = sqrt(num) print(f"The square root of {num} is {square.__trunc__()}")
8e1dfd7f11f9e5156372c741bb0b3dba0705868b
minhthe/practice-algorithms-and-data-structures
/Codility/06_Sorting/Triagle.py
373
3.578125
4
''' https://app.codility.com/demo/results/training953UNF-5F3/ ''' # you can write to stdout for debugging purposes, e.g. # print("this is a debug message") def solution(A): # write your code in Python 3.6 pass A.sort() n = len(A) if n < 3: return 0 for i in range(n-3, -1, -1 ): if A[i]...
06ba10add53d11f111afb9f5654806ef56ade38b
Aasthaengg/IBMdataset
/Python_codes/p02995/s076785723.py
367
3.671875
4
# ่งฃ่ชฌๅ‹•็”ปใฟใŸ๏ผš https://www.youtube.com/watch?v=XI8exXVxZ-Q # ๆœ€ๅฐๅ…ฌๅ€ๆ•ฐ # ใƒฆใƒผใ‚ฐใƒชใƒƒใƒ‰ใฎไบ’้™คๆณ• import math def lcm(x, y): return (x * y) // math.gcd(x, y) def f(x, c, d): res = x res -= x//c res -= x//d res += x//lcm(c, d) return res a, b, c, d = map(int, input().split()) ans = f(b, d, c) - f(a-1, c, d) print(a...
11a87f2346699328b16f42916c853be1687d614a
Superfishintights/parseltongue
/ch2/2-4.py
1,420
4.09375
4
# Car Salesman Program # Write a Car Salesman program where the user enters the base price of a car. The program should add on a bunch of extra fees such as tax, license, dealer prep, and destination charge. Make tax and license a percent of the base price. The other fees should be set values. Display the actual price ...
4340fedd7414b94ff4191d5b2537b2b447958ca2
daumie/dominic-motuka-bc17-week-1
/day_4/missing_num.py
662
4.03125
4
"""Module docstring""" def find_missing(arr1, arr2): """compares 2 arrays and returns missing elements""" new_list = [] for element in arr1: if element not in arr2: new_list.append(element) for element in arr2: if element not in arr1: new_list.append(element) ...
fbc72e29dd4e8e939f0c72fa3e0a3081870d6199
bgoonz/UsefulResourceRepo2.0
/GIT-USERS/ashishdotme/programming-problems/python/30-days-of-code/02-operators.py
700
4
4
#! /usr/bin/env python3 # -*- coding: utf-8 -*- """ Created by Ashish Patel Copyright ยฉ 2017 ashish.me ashishsushilpatel@gmail.com """ """ Given the meal price (base cost of a meal), tip percent (the percentage of the meal price being added as tip), and tax percent (the percentage of the meal price being added as tax...
aa9fa4ba2069fb1a745cff1081199353b9277e8c
elice-python-coding/MJY
/programmers/2.py
143
3.546875
4
def solution(numbers): numbers.sort(key = lambda x:(x[0], x[1])) answer=''.join(numbers) return answer print(solution([6, 10, 2]))
4eaf040dac38ccbab9f5967cf06ede97d20b5c8a
FerValenzuela-ops/PyThings
/playing.py
23,962
4.125
4
''' name = 'Jhonny' age = 55 # The clean way to use variables print(f'hi {name}. You are {age} years old') # String indexes selfish = '01234567' # where to look at [] print(selfish[2]) # Where to start/ where to finish [start:over] selfish = '01234567' print(selfish[0:4]) # Stepover [start"stop:stepover] print(selfis...
fb12667207c15934a2e903f45ef052c6b0aabdef
Mounika2010/20186099_CSPP-1
/cspp1-practice/m8/p2/assignment2.py
596
4.0625
4
''' @author : Mounika2010 # Exercise: Assignment-2 # Write a Python function, sumofdigits, that takes in one number and returns the sum of digits of given number. # This function takes in one number and returns one number. ''' def sumofdigits(n_inp): ''' n is positive Integer returns: a positive integer,...
b57ddf3048393cbe6881958774cc9abd9fce8345
fabianobasso/Python_Projects
/Contact book/schedule/validateData.py
1,681
3.546875
4
# Funรงรตes de validaรงรฃo de dados from time import sleep import os from .drawMenu import * # Validation lists numbers = ['0','1','2','3','4','5','6','7','8','9'] specialCharacters = ['!','@','#','$','%','&','*','(',')','-','_','+','=',';','.','<','>',':','/','?','~','^',']','[','{','}','ยด','`','"','|','\\','\'','\"'] ...
71102497deb51ccf40f92534aa56dfc396d06528
muindetuva/alx-low_level_programming
/0x1C-makefiles/5-island_perimeter.py
988
3.859375
4
#!/usr/bin/python3 ''' Contains the function island_perimeter ''' def island_perimeter(grid): ''' Returns the perimeter of the island descriibed in a grid Args: grid (list): A list of lists of integers ''' perimeter = 0 for i in range(len(grid)): for j in range(len(grid[i])): ...
1d5ca7eff89913816fc153e3667aa7c3bbde4cc8
28Lorena/dataproject
/week4-task10.py
620
3.8125
4
import pandas as pd import matplotlib.pyplot as plt holiday = {"Destination": ["CountryA", "CountryB", "CountryC", "CountryD", "CountryE", "CountryF", "CountryG", "CountryH", "CountryI", "CountryJ", "CountryK", "CountryL", "CountryM", "CountryN", "CountryO"], "Star Rating": [4.5, 3.0, 3.8, 4.4, 4.0, 4...
eb2750a0b08596b9350b32b0c4b6b472a8fd08f0
dbmarch/python-complete
/scope/scope.py
764
3.9375
4
def fact(n): result = 1 if n > 1: for f in range(2, n+1): result *= f return result return result def factorial(n): if (n <= 1): return 1 else: return n * factorial(n-1) def fib(n): """ F(n) = F(n-1) + F(n-2) """ if n < 2: return n ...
0d32a3a70178dc61ba190dd38efc565c09dbc7bb
moontree/leetcode
/version1/337_House_Robber_III.py
1,525
3.953125
4
""" The thief has found himself a new place for his thievery again. There is only one entrance to this area, called the "root." Besides the root, each house has one and only one parent house. After a tour, the smart thief realized that "all houses in this place forms a binary tree". It will automatically contact the po...
394131b909ae7fcf0673bc2064391437eb40eba2
pineappledreams/python-algos
/edx/Week 1-3/reverse-string.py
214
4.03125
4
#Holy macaroni you can reverse strings so easily now!! text = input("Enter thing you wanna get reversed: ") print(text[::-1]) #Take THAT, programming interviews! #No .split("").reverse().join(""); up this place!
fabfa9d6f3ca75b88f8a26d5e9e7726c2a9194ae
GeorgyZhou/Leetcode-Problem
/lc414.py
544
3.515625
4
class Solution(object): def thirdMax(self, nums): """ :type nums: List[int] :rtype: int """ if not nums: import sys return -sys.maxint - 1 import heapq window = [] nums = list(set(nums)) heapq.heapify(window) for...
aee9313035b687eacd503867c93b31ab8b15ffbf
griswoldrx/hello-world
/remove_chars.py
243
3.84375
4
def remove_chars(x, y= "aeiou"): z = "" for i in x: if i in y: pass else: z = z + i return z print remove_chars("hello") print remove_chars("abcdeiough") print remove_chars('hallo', "l") print remove_chars('hahahohohihi', 'aoi')
60d3f0b1033ac976790f7c3b29b455d763a19b8c
jaramosperez/Pythonizando
/Ejercicios/Ejercicio 02.py
341
4.25
4
# EJERCICIO 02 # Determina mentalmente (sin programar) el resultado que aparecerรก # por pantalla en las siguientes operaciones con variables: a = 10 b = -5 c = "Hola " d = [1, 2, 3] print(a * 5) #50 print(a - b) #15 print(c + "Mundo") #"Hola Mundo" print(c * 2) #"Hola" "Hola" print(d[-1]) #3 print(d[1:]) #2,3 print(d...
04f848faa94f5ec9c4c6ed7481eafd94d4061837
anilbharadia/hacker-rank
/python/6.itertools/1.product/tut.py
268
3.953125
4
from itertools import product print list(product([1, 2, 3], repeat = 2)) print list(product('ABC', repeat = 2)) print product('ABC', repeat = 2) print list(product([1,2,3], [4,5,6])) print list(product([1,2,3], 'ABC')) print list(product([1,2,3], 'ABC', [4,5,6]))
496e102bee64d2627f50d5c13f8049d7194004d7
rodolphorosa/intcomp
/perceptron/plot.py
752
3.65625
4
import matplotlib.pyplot as plt from numpy import array """ @brief Plots decision boundary. """ def plot_boundary(X, h, w, c='g'): colormap = ['r' if i < 0 else 'b' for i in h] slope = -(w[1]/w[2]) intercept = -(w[0]/w[2]) px = array([-1, 1]) py = slope*px + intercept plt.ylim([-1, 1]) plt.xlim([-1, 1]) ...
bd2071ac6ad1efbad23148acb0d38e1bf6d317c6
LuizC-Araujo/python
/EXERCICIOS PARTE 1/EXE 002 - MEDIA ARITMร‰TICA.py
279
3.796875
4
n4 = input("Digite a primeira nota: ") n4 = int(n4) n2 = input("Digite a segunda nota: ") n2 = int(n2) n3 = input("Digite a terceira nota: ") n3 = int(n3) n1 = input("Digite a quarta nota: ") n1 = int(n1) media = (n1 + n2 + n3 + n4) / 4 print("A mรฉdia aritmรฉtica รฉ", media)
62f51c63804b0a80326f429d7dcbb1f7796c37ef
emily1749/Leetcode
/103_binary_tree_zigzag_lvl_order_traversal.py
2,776
3.75
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, val=0, left=None, right=None): # self.val = val # self.left = left # self.right = right class Solution(object): def zigzagLevelOrder(self, root): """ :type root: TreeNode :rtype: L...
d067b7ab2da2cac265780cb83e4f536fb0263dd9
dpattison/cdassignments
/Python/animal.py
1,175
3.9375
4
class animal(object): def __init__(self, name, health): self.name = name self.health = health def walk(self): self.health -= 1 return self def run(self): self.health -= 5 return self def display_health(self): print self.health r...
8edd1ca8676c4b25c163eb35b32f219580584a47
v-tsepelev/Programming_HSE
/polynomial.py
13,569
3.671875
4
# Module for work with polynomials. # Author: Vladimir Tsepelev, tsepelev at openmailbox.org import math class Polynomial: def __init__(self, coefficients): if isinstance(coefficients, list): self.coefficients = coefficients elif isinstance(coefficients, int): s...
384ec3d7aca7183d3612334cc4837e910bc6157a
Manash-git/CP-LeetCode-Solve
/1523. Count Odd Numbers in an Interval Range.py
527
3.96875
4
'''Input: low = 3, high = 7 Output: 3 Explanation: The odd numbers between 3 and 7 are [3,5,7]. ''' low = 3 high = 7 # 800445804 # 979430543 # low = 800445804 # high = 979430543 count=0 for i in range(low,high+1): if i%2!=0: count+=1 print(count) def countOdd(low,high): total_no= (high-low)+1 if ...
fa2d395a19cd082cdc5952cf80cb1b04a61ba83c
EnvGen/toolbox
/scripts/parse_augustus_basic.py
1,563
3.6875
4
#!/usr/bin/env python """ Reads an augustus output file and prints the amino_acid fasta file to stdout @author: alneberg """ import sys import os import argparse def to_fasta(s, gene_id, contig_id): print('>{}_{}'.format(contig_id, gene_id)) print(s) def main(args): with open(args.augustus_output) a...
f170bc6d09ad6680d80975fb8e8d0daa99ab8b12
yangdaotamu/niuke
/็ผ–็จ‹็ปƒไน /ๆ‰พ้ฃŸ็‰ฉ.py
1,697
3.875
4
# ้ข˜็›ฎๆ่ฟฐ # ๅฐๆ˜“ๆ€ปๆ˜ฏๆ„Ÿ่ง‰้ฅฅ้ฅฟ๏ผŒๆ‰€ไปฅไฝœไธบ็ซ ้ฑผ็š„ๅฐๆ˜“็ปๅธธๅ‡บๅŽปๅฏปๆ‰พ่ดๅฃณๅƒใ€‚ๆœ€ๅผ€ๅง‹ๅฐๆ˜“ๅœจไธ€ไธชๅˆๅง‹ไฝ็ฝฎx_0ใ€‚ # ๅฏนไบŽๅฐๆ˜“ๆ‰€ๅค„็š„ๅฝ“ๅ‰ไฝ็ฝฎx๏ผŒไป–ๅช่ƒฝ้€š่ฟ‡็ฅž็ง˜็š„ๅŠ›้‡็งปๅŠจๅˆฐ 4 * x + 3ๆˆ–่€…8 * x + 7ใ€‚ๅ› ไธบไฝฟ็”จ # ็ฅž็ง˜ๅŠ›้‡่ฆ่€—่ดนๅคชๅคšไฝ“ๅŠ›๏ผŒๆ‰€ไปฅๅฎƒๅช่ƒฝไฝฟ็”จ็ฅž็ง˜ๅŠ›้‡ๆœ€ๅคš100,000ๆฌกใ€‚่ดๅฃณๆ€ป็”Ÿ้•ฟๅœจ่ƒฝ่ขซ1,000,000,007 # ๆ•ด้™ค็š„ไฝ็ฝฎ(ๆฏ”ๅฆ‚๏ผšไฝ็ฝฎ0๏ผŒไฝ็ฝฎ1,000,000,007๏ผŒไฝ็ฝฎ2,000,000,014็ญ‰)ใ€‚ๅฐๆ˜“้œ€่ฆไฝ ๅธฎๅฟ™่ฎก็ฎ—ๆœ€ # ๅฐ‘้œ€่ฆไฝฟ็”จๅคšๅฐ‘ๆฌก็ฅž็ง˜ๅŠ›้‡ๅฐฑ่ƒฝๅƒๅˆฐ่ดๅฃณใ€‚ # ่พ“ๅ…ฅๆ่ฟฐ: # ่พ“ๅ…ฅไธ€ไธชๅˆๅง‹ไฝ็ฝฎx_0,่Œƒๅ›ดๅœจ1ๅˆฐ1,000,000,006 # ่พ“ๅ‡บๆ่ฟฐ: # ่พ“ๅ‡บๅฐๆ˜“ๆœ€ๅฐ‘้œ€่ฆไฝฟ็”จ็ฅž็ง˜ๅŠ›้‡็š„ๆฌกๆ•ฐ๏ผŒๅฆ‚ๆžœ...
0fd7c11542e95bd3522dd6ffaf44f186991c4476
navinkumar-choudhary/TestPythonProject
/mainDemo.py
334
3.625
4
name = "Navin" def fun(x): print("value from fun one: ",name) print("X value before modification in Fun1: ", x) x = 100 print("X value after modification in Fun1: ", x) def main(): print("Hi") print("Value from main: ",name) x=20 fun(x) print("Value of x in main method: ...
d1fd84de6aa84041a09bae457509caeb5c55bb04
iceknc/python_study_note
/cn/iceknc/study/e_python_mult_task/b_thread_extend.py
392
3.71875
4
""" ็ปงๆ‰ฟThread็ฑปๅฎŒๆˆๅˆ›ๅปบ็บฟ็จ‹ """ import threading import time class MyThread(threading.Thread): def __init__(self): super().__init__() self.name = "MyThread" def run(self): for i in range(10): str = "My name is "+ self.name print(str) time.sleep(1) if __n...
515fa7c5cb9d4ea91d60026568c1a750a9875a5a
Gav104/practice_code
/pastimes.py
973
3.546875
4
import os import csv path = "C:/Users/Gavin/PycharmProjects/Practice_code" high_scores_dict = {} in_file_path = os.path.join(path, "scores.csv") out_file_path = os.path.join(path, "highest_scores.csv") with open(in_file_path, "r") as myFile, open(out_file_path, "w", newline="") as out_file: my_file_reader = cs...
365edf821332b7b73db7918ad7facd048bcdccbb
YeomanYe/show-me-the-code
/0020/parseExcel.py
583
3.609375
4
#! python3 # -*- coding:utf-8 -*- import xlrd book = xlrd.open_workbook("็งปๅŠจ่ฏ่ดน่ฏฆๅ•.xls") print("The number of worksheets is {0}".format(book.nsheets)) print("Worksheet name(s): {0}".format(book.sheet_names())) sh = book.sheet_by_index(0) print("sheetName:{0} sheetRows:{1} sheetCols:{2}".format( sh.name, sh.nrows, sh.n...
4b1f98c248538718ea43cce9ecf7cd0c4daed3cb
AbelRapha/Python-Exercicios-CeV
/Mundo 1/ex007 Media Aritmetica.py
239
3.921875
4
nota1 = int(input("Digite aqui a sua primeira nota ")) nota2 = int(input("Digite aqui a sua segunda nota ")) def Media(n1,n2): return (n1+n2) /2 print(f"Considerando as notas inseridas a sua media final foi {Media(nota1,nota2):.2f}")
8c25d622ce61325db3b3d19cc09e67b8729861d1
ceyhunsahin/TRAINING
/EXAMPLES/EDABIT/EXPERT/001_100/64_splitting_objects_inside_a_list.py
2,275
4.25
4
""" Splitting Objects Inside a List You bought a few bunches of fruit over the weekend. Create a function that splits a bunch into singular objects inside a list. Examples split_bunches([ { name: "grapes", quantity: 2 } ]) โžž [ { name: "grapes", quantity: 1 }, { name: "grapes", quantity: 1 } ] split_bunches([ ...
4be48b5a83e72d51ff44b0378b9992ddf48e82c1
ryanyuchen/Data-Structure-and-Algorithms
/4 Algorithms on Strings/Week 1 Suffix Trees/Programming-Assignment-1/suffix_tree/suffix_tree.py
1,840
3.6875
4
# python3 import sys _END = '$' def compress_recursive(tree, node): for (key, child_node) in tree[node].items(): if key == "start": return if len(tree[child_node]) == 1: path_char = next(iter(tree[child_node])) if path_char != "start": ...
1575bc3c5c67c5de8d4b7a0e79a4492c70843dc5
filipe1992/Teoria-da-computa-o
/hw04/05.py
1,481
3.734375
4
''' Created on 30 de nov de 2018 @author: filiped ''' ''' Implemente em linguagem de programaรงรฃo ร  sua escolha o algoritmo CYK. Seu programa deve receber como entrada uma gramรกtica livre de contexto na Forma Normal de Chomsky e uma string de teste da gramรกtica. Descreva como deverรก ser o formato dessa gramรกtica. ''' g...
5af383466d4791551082f4703bba000c696711f0
mkurde/the-coding-interview
/problems/intersections/intersections.py
144
3.625
4
def intersections(lst1,lst2): return [i for i in lst1 if i in lst2] print(intersections(['dog', 'cat', 'egg'], ['cat', 'dog', 'chicken']))
258a30e249830765833e08f164b4954d86ca44e4
h-yaroslav/pysnippets
/lections/fib.py
276
3.609375
4
#!/usr/bin/python # -*- coding: latin-1 -*- import os, sys def fib(n): # ะ’ะธะฒั–ะด ั‡ะธัะตะป ะคั–ะฑะพะฝะฐั‡ั‡ั– ะดะพ ะทะฐะดะฐะฝะพะณะพ n result = [1] a, b = 0, 1 while b < n: # print b, a, b = b, a+b result.append(b) return result a = fib(1000) print a
a61ef321e7643814224d7f238ac29561cc5cfe75
TakuroKato/AOJ
/ITP1_1_B.py
70
3.5625
4
# -*- coding:utf-8 -*- x = int(input()) result = x**3 print(result)
36ed4e9edacac9ddcfabea0c5ecbd5925bb84934
sayantann11/Automation-scripts
/password_manager/password_manager.py
11,768
3.59375
4
#!/usr/bin/python3 # Created by Sam Ebison ( https://github.com/ebsa491 ) # If you have found any important bug or vulnerability, # contact me pls, I love learning ( email: ebsa491@gmail.com ) """ This is a simple password manager CLI program based on https://github.com/python-geeks/Automation-scripts/issues/111 """ ...
5a2adee92cdca9a14b16a2313f78ebdc7f709f22
HuichuanLI/alogritme-interview
/Chapter03_LinkedList/้ข่ฏ•้ข˜.py
783
3.671875
4
# Definition for singly-linked list. # class ListNode: # def __init__(self, x): # self.val = x # self.next = None class Solution: def addTwoNumbers(self, l1: ListNode, l2: ListNode) -> ListNode: p1 = l1 p2 = l2 ov = 0 while p1 and p2: p1.val += p2.val...
581b5c03d34f708a2e8efa2c8febd653e8b4faa5
milenabaiao/python-1
/area.py
260
3.78125
4
# -*- coding: utf-8 -*- LadodoQuadrado = input("Digite o valor correspondente ao lado de um quadrado: ") x = (float( 4 * int(LadodoQuadrado) )) y = (float( int(LadodoQuadrado) * int(LadodoQuadrado) )) print("perรญmetro: " + str(x) + " - รกrea: " + str(y))
ea623c32ea494085da420c41ad6634b416fa74c6
greendar/ics4_2021
/example.py
1,315
3.8125
4
class Vehicle: def __init__(self, driver, colour, wheels): self.driver = driver self.wheels = wheels self.colour = colour self.name = 'vehicle' self.horn = 'honk' def __str__(self): return f"{self.driver} is driving the {self.colour} {self.wheels} wheeled {self.n...
854523995c3999b38f7531c0cc47f1cd9dc12903
danielkouba/insertion_sort
/insertion_sort.py
1,229
3.921875
4
import random from datetime import datetime def randomNumArrayGen(max, length): arr = [] for count in range(length): arr.append(int(round(random.random()*max))) return arr # def insertionSort(arr): # for i in range(0,len(arr)): # # print i # swap = "false" # for n in reversed(range(0, i)): # insertAt =...
a5af0827cf75d9ef163ec338bac4184d0130bba4
CharisseU/CodingDojo_Assignments
/Python_Stack/Fundamentals/insertionSort.py
383
4.03125
4
#Python Insertion Sort import sys list = [99, 88, 77, 66, 55, 44, 33, 22, 11] def insertionSort(list): for i in range(1, len(list)): key = list[i] j = i-1 while j>=0 and key < list[j]: list[j+1] = list[j] j-=1 list[j+1] = key insertionSort(list) print ("Sort...
f4953322f6511c8329c0342473800489e42b9ccb
IronE-G-G/algorithm
/ๅ‰‘ๆŒ‡offer/65hasPath.py
1,745
3.671875
4
# -*- coding:utf-8 -*- """ ็Ÿฉ้˜ตไธญ็š„่ทฏๅพ„๏ผš่ฏท่ฎพ่ฎกไธ€ไธชๅ‡ฝๆ•ฐ๏ผŒ็”จๆฅๅˆคๆ–ญๅœจไธ€ไธช็Ÿฉ้˜ตไธญๆ˜ฏๅฆๅญ˜ๅœจไธ€ๆกๅŒ…ๅซๆŸๅญ—็ฌฆไธฒๆ‰€ๆœ‰ๅญ—็ฌฆ็š„่ทฏๅพ„ใ€‚ ่ทฏๅพ„ๅฏไปฅไปŽ็Ÿฉ้˜ตไธญ็š„ไปปๆ„ไธ€ไธชๆ ผๅญๅผ€ๅง‹๏ผŒๆฏไธ€ๆญฅๅฏไปฅๅœจ็Ÿฉ้˜ตไธญๅ‘ๅทฆ๏ผŒๅ‘ๅณ๏ผŒๅ‘ไธŠ๏ผŒๅ‘ไธ‹็งปๅŠจไธ€ไธชๆ ผๅญใ€‚ ๅฆ‚ๆžœไธ€ๆก่ทฏๅพ„็ป่ฟ‡ไบ†็Ÿฉ้˜ตไธญ็š„ๆŸไธ€ไธชๆ ผๅญ๏ผŒๅˆ™่ฏฅ่ทฏๅพ„ไธ่ƒฝๅ†่ฟ›ๅ…ฅ่ฏฅๆ ผๅญใ€‚ ไพ‹ๅฆ‚ a b c e s f c s a d e e ็Ÿฉ้˜ตไธญๅŒ…ๅซไธ€ๆกๅญ—็ฌฆไธฒ"bcced"็š„่ทฏๅพ„๏ผŒไฝ†ๆ˜ฏ็Ÿฉ้˜ตไธญไธๅŒ…ๅซ"abcb"่ทฏๅพ„๏ผŒ ๅ› ไธบๅญ—็ฌฆไธฒ็š„็ฌฌไธ€ไธชๅญ—็ฌฆbๅ ๆฎไบ†็Ÿฉ้˜ตไธญ็š„็ฌฌไธ€่กŒ็ฌฌไบŒไธชๆ ผๅญไน‹ๅŽ๏ผŒ่ทฏๅพ„ไธ่ƒฝๅ†ๆฌก่ฟ›ๅ…ฅ่ฏฅๆ ผๅญใ€‚ ๆ€่ทฏ๏ผš้ๅކๆ‰พๅˆฐpath็š„็ฌฌไธ€ไธชๅ…ƒ็ด ๏ผŒ่ฟ›ๅ…ฅๅˆคๆ–ญๆจกๅผใ€‚ """ class Solution: def ha...
41d38ae411820a57aa0d3813f87d5b5ceb4cbd08
dapazjunior/ifpi-ads-algoritmos2020
/Fabio_02/Fabio02_Parte_a/f2_a_q11_numero.py
627
3.953125
4
def main(): num1 = int(input('Digite o primeiro nรบmero: ')) num2 = int(input('Digite o segundo nรบmero: ')) num3 = int(input('Digite o terceiro nรบmero: ')) opcao = int(input('Selecione a sua opรงรฃo (1, 2 ou 3): ')) verificar_opcao(opcao, num1, num2, num3) def verificar_opcao(opcao, num1...
f0a6403cbe75047b544c3c239894b954e5f6e89c
bbansalaman0/ML
/Python Learning/ass/as 4.6.py
238
3.84375
4
def computepay(h,r): if h>40: pay=h*r+((h-40)*(r*0.5)) else: pay=h*r return pay hours=input('enter hours:') rate=input('enter rate:') h=float(hours) r=float(rate) tp=computepay(h,r) print('Pay',tp)
7029b058fc45a4613620c28eb22fcc1f038d5d66
tacores/algo-box-py
/strings/suffix_tree.py
3,887
3.71875
4
# python3 import sys # $ใง็ต‚ใ‚ใ‚‹ๆ–‡ๅญ—ๅˆ—ใฎ้ƒจๅˆ†ๆ–‡ๅญ—ๅˆ—ใฎใ€ใƒˆใƒฉใ‚คใƒ„ใƒชใƒผๆง‹็ฏ‰(Compressed) class Node: def __init__ (self, index, length, node_no): # ้ƒจๅˆ†ๆ–‡ๅญ—ๅˆ—ใ‚’ไฟๆŒใ™ใ‚‹ไปฃใ‚ใ‚Šใซใ€textๅ†…ใฎไฝ็ฝฎใจ้•ทใ•ใ‚’ไฟๆŒใ™ใ‚‹ self.index = index self.length = length self.node_no = node_no def build_suffix_tree(text): """ Build a suffix tree of the string text and return...
b1a2365c9c26db6bc0702c5ecf7537c5fc9dfeae
ashleyabrooks/code-challenges
/polish_calculator.py
1,144
4.25
4
"""Calculator >>> calc("+ 1 2") # 1 + 2 3 >>> calc("* 2 + 1 2") # 2 * (1 + 2) 6 >>> calc("+ 9 * 2 3") # 9 + (2 * 3) 15 Let's make sure we have non-commutative operators working: >>> calc("- 1 2") # 1 - 2 -1 >>> calc("- 9 * 2 3") # 9 - (2 * 3) 3 >>> calc("/ 6 - 4 ...
688863f73015eb6a245ea159de1a9a7842e44173
SocratesGuerrero/ejemplo
/sentencias/sentencias_FOR.py
333
3.90625
4
""" Bucle FOR """ # Opera sobre una secuencia establecida # Sin tipos de datos ni incrementos #! /usr/bin lista = ["uno", "dos", "tres", "cuatro", "cinco", "seis"] for elemento in lista: print elemento if elemento=="tres": print "soy un tres" for var in range(2,13,1): #Valor inicial, final, incremento ...
5d4b7567369c376ad733855a955d1b2ed80f0597
Sona1414/luminarpython
/object oriented programming/concs and inheritance.py
292
3.71875
4
class Person: def __init__(self,name,age): self.name=name self.age=age class Student(Person): def __init__(self,rollno,name,age): super().__init__(name,age) self.rollno=rollno print(self.name,self.age,self.rollno) stu=Student(101,"SONA",15)
1ebaf6f862173cf65c47fde5d434b97768ed2a60
JamesP2/adventofcode-2020
/day/2/day2-2.py
994
3.796875
4
import sys import re valid_passwords = 0 with open(sys.argv[1]) as file: for line in file: # Almost did line[:-2] but then the last line would be too short line = line.replace('\n', '') # Split line into [minimum, maximum, char, password] first_index, second_index, char, password ...
79aeb79b410fbe90bd1e427c4c4aaa3b53824573
Esubalew24/Python
/Dictionary.py
332
3.984375
4
l = [1,"heh",2] m = "Hello" print l[1] my_dict = {"key1": "value1", "key2" : "value2", "key3": 123} my_dict2 = ["Value1", "Value2", 123] print my_dict["key1"][::-1].upper() print my_dict2[0][::-1].upper() print m.upper() print m.lower() n = m.upper() print n.capitalize() print my_dict["key1"] + " hekk" print my_dict[...
aff5efbfb08792b7db28d3ea384abead801922e5
lszloz/Python_apps
/python_net/TCP/tcp_server.py
904
3.796875
4
""" TCPๅฅ—ๆŽฅๅญ—ๆœๅŠก็ซฏ """ import socket # ๅˆ›ๅปบๆตๅผๅฅ—ๆŽฅๅญ— sockfd = socket.socket(socket.AF_INET, socket.SOCK_STREAM) # ใ€€็ป‘ๅฎšๆœฌๆœบๅœฐๅ€ sockfd.bind(('127.0.0.1', 8888)) # sockfd.bind(('localhost', 8888)) # sockfd.bind(('0.0.0.0', 8888)) # ใ€€็›‘ๅฌ๏ผŒ่ฎพ็ฝฎๆœ€ๅคš่ฟžๆŽฅๆ•ฐ้‡ sockfd.listen(5) # ใ€€็ญ‰ๅพ…ๅค„็†ๅฎขๆˆท็ซฏ้“พๆŽฅ while True: print("Waiting for connect....") try: ...
05f04f36611d827eb52aa114da9166f3f5f5bb61
josepforadada/DA-prework
/Duel_of_sorcerers.py
8,604
4.0625
4
print("\nDUEL OF SORCERERS\n") print("You are witnessing an epic battle between two powerful sorcerers.") print("Gandalf and Saruman. Each sorcerer has 10 spells of variable power") print("in their mind and they are going to throw them one after the other.") print("The winner of the duel will be the one who wins more ...
cd37ec7f3c0b794e5dfde334e335b21934207ee4
SJeliazkova/SoftUni
/Programming-Basic-Python/Exercises-and-Labs/Loops_Part_2_Lab/06. Max Number.py
184
3.640625
4
import sys n = int(input()) counter = 0 max_num = - sys.maxsize while counter < n: num = int(input()) if num > max_num: max_num = num counter += 1 print(max_num)
15ba9597f6fcf309c0270479473731d6805416ca
GANESH0080/Python-Practice-Again
/ElseInForLoop/ExampleOne.py
61
3.65625
4
for x in "banana": print(x) else : print("Hi Ganesh")
06ad43a4e1f10a849401235656ab1aa830f7634e
harikakosuri/Height-And-Weight-Prediction-With-ML-Algorithm
/org_wt_ht.py
3,078
3.578125
4
import numpy as np # linear algebra import pandas as pd # data processing, CSV file I/O (e.g. pd.read_csv) data = pd.read_csv('wt_ht-220.csv') #Machine Learning #Female Prediction ### Female Weight prediction #replaceing the data from data variable to df df = pd.DataFrame(data) X1 = df.iloc[:,0:1] #feactuers Y1 ...
e3d4584b27dbe9927f39385fc9c1f16ae49011d2
FilipLangr/ub201617_delta
/euler_path_all_paths.py
8,344
3.6875
4
from collections import defaultdict import copy class Graph: """ Graph represented as a dict. Keys: kmers (string). Values: List of neighbouring kmers (string). """ def __init__(self): """ Construct a sensible empty graph. self.indeg is technically not needed, b...
381ca2ab14542e2a88fe3a9dab75f28fb4d82373
roadfoodr/exercism
/python/submitted/difference_of_squares.py
610
4.1875
4
def square_of_sum(number): # https://en.wikipedia.org/wiki/Triangular_number return round((number * (number+1) / 2) ** 2) def sum_of_squares(number): # https://en.wikipedia.org/wiki/Square_pyramidal_number return round((number**3 / 3) + (number**2 / 2) + (number / 6)) def difference_of_squares(numbe...
3af6b8da88848208cfd1b61464ec76f8fc478581
benbendaisy/CommunicationCodes
/python_module/examples/443_String_Compression.py
2,050
4.125
4
from typing import List class Solution: """ Given an array of characters chars, compress it using the following algorithm: Begin with an empty string s. For each group of consecutive repeating characters in chars: If the group's length is 1, append the character to s. Otherwise, ...
907d7d476130c6340db91b8123426b92d83d47b7
thesinbio/RepoUNLa
/Seminario de Lenguajes/Prรกctica/01.programarcadegames/Prรกctica03.py
995
3.921875
4
print("Tu nueva puntuaciรณn es ",1030 + 10) print("Quiero imprimir comillas dobles \" por alguna razรณn.") print("El archivo estรก guardado en C:\\nueva carpeta") # Esto es un comentario que comienza con el signo # y # y el compilador lo ignorarรก. print("Hola") # Esto es un comentario al final de una lรญnea ''' comentari...
ef40374e7f88d42eb24666b687d3dab6be4181ee
ekougs/crack-code-interview-python
/ch5/decimal_binary_representation.py
1,750
3.703125
4
_decimal_separator = '.' def decimal_binary_rep(decimal_str): if _decimal_separator in decimal_str: point_index = decimal_str.index(_decimal_separator) else: point_index = len(decimal_str) int_part = _integer_binary_str(int(decimal_str[:point_index])) # Decimal part should have less th...
6a8712d38612c2de97484b8b0e3156341bb2a5dd
C-TAM-TC1028-003-2113/tarea-1-YalejandroFuentes
/assignments/10Videojuego/src/exercise.py
382
3.65625
4
def main(): # Este programa calcula el total de la compra de los videojuegos nuevos y usados. JuegosNuevos = int(input("Dame la cantidad de juegos nuevos: ")) JuegosUsados = int(input("Dame la cantidad de juegos usados: ")) Total = (1000 * JuegosNuevos) + (350 * JuegosUsados) print("El total de l...