blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
1fa94b76c6a2637d0d83f189fade4da04fb5e1bb
Erick-rick/Python
/Curso em video Python/Aulas/aula8.py
798
3.828125
4
# import math >> importa tudo # ceil > arredondamento para cima # floor >arredondamento para baixo # trunc > trunca o numero, eliminando da virgula para frente # pow > potencia # sqrt > raiz quadrada # factorial > fatorial from math import sqrt, ceil num = int(input('Digite um número: ')) raiz = math.sqrt(num) print...
9f49e08e865ac7fdb0dc7cc38246f07d9fc18815
Erick-rick/Python
/Exercicios I/Ex_10.py
113
3.890625
4
a = int(input('Digite um valor A:')) b = int(input('Digite um valor B:')) print ('A = {} \nB = {}'.format(b,a))
d1eab15d94a8eedc26f77f4af307c6129928d7b5
Erick-rick/Python
/Exercicios III/Ex_08.py
221
4.09375
4
num = 0 maior = 0 menor = 0 num = int (input('Digite um numero: \n')) for n in num: if (n == 0): maior = num menor = num elif(num > maior): maior = num print('Maior = ', maior)
52762fe8a2f9739dcbc5ee475550f46902d3de1b
Erick-rick/Python
/Exercicios I/EX_05.py
231
3.96875
4
print ('--Valor do produto com desconto -- ') preco= float(input('Digite o valor do produto : ')) precof = float(input('Digite o valor do desconto do produto :')) desc = (preco - precof) print('Desconto de {} % '.format(desc))
446756f680bf6a739a206c7f218c81c62fefd014
Erick-rick/Python
/Curso em video Python/Aulas/aula10.py
588
4
4
###Estrutura condicionais simples e composta tempo = int(input('Quanto anos tem seu carro?')) if tempo <=3: print('Carro novo') else: print('Carro velho') print('__FIM__') #condição simplificada print('novo' if tempo <=4 else 'velho') nome= str(input('Qual é sei nome ?')) if nome == 'Gustavo': print('...
a64cbf0b9509287a13d553e59ea79f05df327770
Erick-rick/Python
/Exercicios II/Ex_20.py
336
4.03125
4
a = float(input('Digite o comprimento do lado A:\n')) b = float(input('Digite o comprimento do lado B: \n')) c = float(input('Digite o comprimento do lado C: \n')) if (a == b and b == c): print('>>>>>> Equilatero!') elif(a == b or b == c): print('>>>>> Isosceles') elif(a!= b and b!= c and a!= c): print('...
65fc53f480d48bd49e2309bcc5cf4fec75b0fc8d
Erick-rick/Python
/Curso em video Python/Desafios/desafio031.py
309
3.734375
4
distancia = float(input('Qual é a distancia da viajem (km)?')) preco = 0 if distancia <= 20 preco = distancia * 0.45 print('O preço da passagem é {} por {} KM '.format(preco, distancia)) else: preco = distancia * 0.50 print('O preço da passagem é {} por {} KM '.format(preco, distancia))
6c477e1eeaac4a78ee7502f0d718624b897328d8
Erick-rick/Python
/Exercicios I/adivinhacao_v2.py
600
3.640625
4
print('******************************************') print('* Jogo de adivinhação *') print('******************************************') numero_secreto = 12 chute = int(input('Digite um numero : ')) print('Você digitou >>>',chute) acertou = numero_secreto == chute maior = chute > numero_secreto me...
97fd204597297b3d7a2fba5a693f072db3b482ab
Erick-rick/Python
/calculator.py
1,811
3.9375
4
import sys class Valor: a = 0.000 b = 0.000 c = 0.000 def valor1(self): try : self.a= input('Primeiro Valor: ') a = self.a return a except: print('Inválido, digite um número! Se for real digite . e não ,') self.valor1() ...
00481d9c10e9b057a44cfc2c1ffa50a31c06216a
Erick-rick/Python
/Exercicios II/Ex_11.py
271
3.984375
4
print ('***Codigo de livros****') CL = input('Digite o codigo do livro : (A / B)') if (CL == 'A'and CL =='a') : print('Livro de ficcao') elif (CL == 'B' and CL == 'b'): print('Livro de nao-ficcao') elif (CL != 'A' and CL != 'B'): print('Codigo invalido')
d2da10ddf4a090bf1b229fc3c0524ae330ed5239
Erick-rick/Python
/Exercicios II/Ex_09.py
296
3.9375
4
print('***calculo de salario') sal = float(input('Digite o salario do funcionario: ')) sal_novo = 0 if (sal <= 500): sal_novo = sal * 0.15 elif(sal >= 500 and sal<= 1000): sal_novo = sal * 0.10 elif(sal > 1000): sal_novo = sal * 0.05 print('O novo salario é {}'.format(sal_novo))
d7db3f6e1bf9061b9272c7f696fad643849e32db
Erick-rick/Python
/Exercicios II/Ex_08.py
422
3.6875
4
print ('***Quadro de funcionários***') func = 0 while func < 4: NF = input('Digite o nome do funcionário:\n') Sal = float(input('Digite o salário do funcionário: \n')) DEP = input('Selecione o departamento do funcionário\n (P) - Produção \n (E) - Engenharia') func +=1 if (Sal >= 1000 and Sal <= 150...
d31c3678411b03dff0312024913bf13617d16458
Erick-rick/Python
/Machine Learning/DesvioPadrao.py
991
4.21875
4
# DESVIO PADRÃO #Use o std()método NumPy para encontrar o desvio padrão '''Um desvio padrão baixo significa que a maioria dos números está próxima do valor médio (médio). Um desvio padrão alto significa que os valores estão distribuídos em uma faixa mais ampla. Isso significa que a maioria dos valores está dentro da f...
cb9725462e90ff9003fa76d7c187c25d967c33b2
panipinaka/PYTHON-BASIC-
/assignment1/22.py
205
3.765625
4
st=input("enter the string") count=0 count1=0 for i in st: if i.isalpha(): count=count+1 else: count1=count1+1 print("alpha count");print(count) print("number count");print(count1)
a5c7ed0d68d1ab24975f0491c44b942aa952decd
panipinaka/PYTHON-BASIC-
/assignment1/12.py
193
4.0625
4
num1=int(input("enter the number1")) temp=num1 x=0 while(num1): i=num1%10 x=x*10+i num1=int(num1/10) print(x) if x==temp: print("palindrome") else: print("not a palindrome")
8b7f4323174cc68759b560fbc0ea1eed92d9bee8
panipinaka/PYTHON-BASIC-
/assignment1/4.py
126
3.96875
4
a=int(input("enter the a value")) b=int(input("enter the b value")) Quotient =a/b reminder=a%b print(Quotient) print(reminder)
a207043768aa765587d2778c64856204f84931cb
panipinaka/PYTHON-BASIC-
/assignment2/4.py
207
3.734375
4
lis=[1,2,3,4,5,6] lis2=[2,3,5,4,1,6] flag=1 for i in lis: if i in lis2: continue else: flag=0 break if flag==1: print("same list") else: print("not a same list")
004faf32063cecb9ca3690589d4556f4420d10f4
xfhelen/OpenCode
/python/python-tutorials/document.py/01.py
889
3.96875
4
# -*- coding: utf-8 -*- """ Created on Mon Dec 12 15:56:42 2016 @author: xfhelen List and tuple的使用方法 """ # 内置数据类型 - 列表 - list - [] person1 = ['man', 20, 1.75, 'Bob'] for i in person1: print i #倒数第一个数:Bob print person1[-1], person1[-2], len(person1) sex1 = ['sex:', 'man'] # modify person1[0] = sex1 hometown1 ...
d7a6b86cf17ff4c659d04fd9dad63b78e3b77328
xfhelen/OpenCode
/python/python-tutorials/document.py/OOP/00.py
1,065
3.96875
4
# -*- coding: utf-8 -*- """ Created on Thu Dec 15 14:34:26 2016 @author: xfhelen # 继承和多态 """ # 父类 - 继承object class Animal(object): def __init__(self): pass def run(self): print 'Animal is running!' # 子类 # 可以继承父类的所有属性 # 可以覆盖或者拥有自身属性 class Dog(Animal): def __init__(self): pass # 子...
d57197af729805c4517cce615b7e4d3cc09442f2
lunarflarea/pythontraining
/2-3.py
649
4.125
4
#Context: We want to make a pressurized speaker. maximumPressure = 2.3 maximumVolume = 7.41 currentPressure = float(input("Enter the current speaker's pressure:\n")) currentVolume = float(input("Enter the current speaker's volume:\n")) if currentPressure > maximumPressure and currentVolume > maximumVolume: print...
d721895f1af89927afe71fe0637c43a9afb76720
justonemoresideproject/python-exercises
/09_is_palindrome/is_palindrome.py
651
4.21875
4
def is_palindrome(phrase): thisPhrase = phrase.replace(' ', '') for x in range(0, len(thisPhrase) - 1): if thisPhrase[x].upper() != thisPhrase[-x - 1].upper(): return False return True """Is phrase a palindrome? Return True/False if phrase is a palindrome (same read backwards an...
e3b0dac1847c264bbf888dfc8d9dc7043de84f29
alvynabranches/ml
/1_Alvyn_Abranches_linear_regression_with_library.py
2,158
3.640625
4
import numpy as np import pandas as pd import matplotlib.pyplot as plt from sklearn.linear_model import LinearRegression from sklearn.model_selection import train_test_split from sklearn.metrics import mean_squared_error from sklearn.metrics import accuracy_score from sklearn.metrics import r2_score # read cs...
06dc72f5cb8320ab098ae609b1f813512f00dfb2
Kasonsx/PythonStudy
/fluent/sushu.py
282
3.890625
4
def odd_iter(): n = 1 while True: n = n + 2 yield n def not_divisible(n): return lambda x: x % n >0 def primes(): yield 2 it = odd_iter() while True: n = next(it) yield n it = filter(not_divisible(n), it) for n in primes(): if n < 1000: print(n) else: break
efbfe189ca1d86da5ae200f0cfb011379a0cd22f
hamzakhawaja27/Artificial-Intelligence
/Assignment1/minimax_agent.py
4,621
3.859375
4
# minimax_agent.py # -------------- # COMP3620/6320 Artificial Intelligence # The Australian National University # For full attributions, see attributions.txt on Wattle at the end of the course """ Enter your details below: Name: Hamza khawaja Student Code: u6019739 email: u6019739@anu.edu.au """ fro...
3c1dc92a0435670a6486a74e1adf437a48cb37bc
hamzakhawaja27/Artificial-Intelligence
/Assignment0/dfa.py
2,064
4.09375
4
""" File name: dfa.py Author: <Khawaja Hamza u6019739> Date: <the date goes here> Description: This file defines a function which reads in a DFA described in a file and builds an appropriate datastructure. There is also another function which...
90da8047eeb9b147cf3c6904193bd2aef4c77d11
shashank-indukuri/hackerrank
/CamelCase.py
1,310
4.625
5
# There is 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...
9db6616e648db322c8bc5bbd4c287b0805fe1892
shashank-indukuri/hackerrank
/TowerBreakers.py
2,337
4.3125
4
# Two players are playing a game of Tower Breakers! Player always moves first, and both players always play optimally.The rules of the game are as follows: # Initially there are towers. # Each tower is of height . # The players move in alternating turns. # In each turn, a player can choose a tower of height and red...
b807d9433a5c92fbb46f5e09f840af1061fd49c3
tthero/tthero-mit-pset
/6.00.1x/pset2/pset1.py
1,672
4.5625
5
""" A program to calculate the credit card balance after one year if a person only pays the minimum monthly payment required by the credit card company each month. The following variables contain values as described below: balance - the outstanding balance on the credit card annualInterestRate - annual interest rate a...
59728445f69d5528d6538cb56538d4b02175b75e
Simran0401/Python-Django-LPU
/Python Basics Assignment/ninthprg.py
459
4.03125
4
""" Q9. Write a program to that accepts a string s, an index number n and a character ‘c’. And outputs the string replaced with the character at the index number n. Example- ‘hello’ , 0 , ‘j’ ==> ‘jello’. (Hint2: You can try it by join function too by typecasting it to list) """ s = input("Enter the string: ") ...
81e0a59c65f697ca784a1b9359dfc7a01612f172
Simran0401/Python-Django-LPU
/Python Assignment 2/prg17.py
391
4.125
4
''' Q17. Write a program to find if a given string is a palindrome or not. ''' def isPalindrome(str): for i in range(0, int(len(str)/2)): if str[i] != str[len(str)-i-1]: return False return True s = input("Enter the required string: ") result = isPalindrome(s) if (result): print("...
3c8faa621450cf1c4dcf723353270bc67c72f6e3
Simran0401/Python-Django-LPU
/Python Assignment 2/prg16.py
439
4.15625
4
''' Q16. Write a program that counts the occurrence of a character in a string. Example: ‘This is a test string.’ count of i = 3. ''' def count(str, c) : occurence = 0 for i in range(len(str)) : if (str[i] == c): occurence = occurence + 1 return occurence s = input...
c247ffd9c33489fd61efa17b8f50179c911e2815
tallisson/apostila-caelum-python
/cap07/historico.py
289
3.609375
4
from datetime import datetime as dt class Historico: def __init__(self): self.data_abertura = dt.today() self.transacoes = [] def toString(self): print('Data de abertura: ', self.data_abertura) print('Transações: ') for t in self.transacoes: print('-', t)
6e105468e75d6fcffced4bdd8bdfa21044443d77
tallisson/apostila-caelum-python
/cap06/forca.py
1,463
3.59375
4
from random import randrange as rrange def imprimir_mensagem_abertura(): print("********************************") print("***Bem vindo ao jogo da forca***") print("********************************") def carregar_palavra_secreta(): palavras = [] with open('palavras.txt', 'r') as arquivo: for linha in arq...
4df315deed662d838cf293e3c61b6ed35558ebe2
algoitssm/algorithm_heejong
/Baekjoon/backtracking/15652_N_and_M_4.py
317
3.53125
4
# https://www.acmicpc.net/problem/15652 def recursive(depth, k): if depth == M: print(*ans) return for i in range(k, N): ans.append(i+1) recursive(depth+1, i) ans.pop() N, M = map(int, input().split()) nums = [n for n in range(1, N+1)] ans = [] recursive(0, 0)
e81ac6c88d4650e022b211ca29148137861d8d92
algoitssm/algorithm_heejong
/Baekjoon/tree/1991_tree_circuit.py
641
3.546875
4
# https://www.acmicpc.net/problem/1991 def pre_order(char): if char != '.': print(char, end='') pre_order(tree[char][0]) pre_order(tree[char][1]) def in_order(char): if char != '.': in_order(tree[char][0]) print(char, end='') in_order(tree[char][1]) def post_...
d68cd3e62d3797f3658371737fbbc6dd78a7bde8
algoitssm/algorithm_heejong
/Baekjoon/divide_and_conquer/2630_making_color_paper.py
710
3.703125
4
# https://www.acmicpc.net/problem/2630 def divide_and_conquer(r, c, length): initial_val = papers[r][c] for row in range(r, r+length): for col in range(c, c+length): if papers[row][col] != initial_val: divide_and_conquer(r, c, length//2) divide_and_conquer...
b5187cd59c3cf45cfb2de457c86de9111eda62a1
chrisnorton101/myrpg
/battlescript.py
2,379
3.640625
4
from Classes.characters import * from Classes.abilities import * import time player = player enemy = beg_enemies[random.randrange(0,4)] def battle(): print("A {} has attacked!".format(enemy.name)) time.sleep(1) running = True while running: print("==================") ...
bea4db8ab5c37b9218d04b9cb4f55290e4d7fb84
nmanzano/codewars
/hangman/exercise2.py
1,818
3.96875
4
word = 'longhorns' letters_correct = [] wrong = [] incorrect_scrore = len(word) addbody = [] COUNT = 0 masterword = list(word) wordsofar = [] for x in masterword: wordsofar.append(' _ ') def startgame(): if len(letters_correct) < len(masterword): print 'Correct: ' + ''.join(wordsofar) ...
7d270d1a9cd034283636f29f9a7ed62569e221d0
bucketHaneul/programmers-algorithm-practice
/Programmers_42587/solution.py
623
3.53125
4
def solution(priorities, location): # 동일한 우선 순위 구별 위해 idx부여 priorities_with_idx = [(p, idx) for idx, p in enumerate(priorities)] print_list = [] while priorities_with_idx : pop_item = priorities_with_idx.pop(0) for p in priorities_with_idx : if p[0] > pop_item[0] : ...
1462a380444aa3a36eaacd7e3fb52c7d5dc1a481
Aman6233/Algorithmic_Toolbox
/week2_algorithmic_warmup/8_last_digit_of_the_sum_of_squares_of_fibonacci_numbers/fibonacci_sum_squares.py
446
3.953125
4
# Uses python3 from sys import stdin def fibonacci_sum_squares(n): n = n%60 if n <= 1: return n else: f = [] for i in range(0,n+1): f.append(0) f[0] = 0 f[1] = 1 sum = 1 for i in range(2, n+1): f[i] = f[i-1]+f[i-2] ...
4babfe0baa8d45cb19ee573ce566d2e2e6253b1f
megamayoy/Coursera-Algorithmic-toolbox
/week3_greedy_algorithms/3_car_fueling/car_fueling.py
1,003
3.890625
4
# python3 import sys def compute_min_refills(distance, tank, stops): # write your code here min_refills = 0 num_of_stops = len(stops) # insert the whole distance at the end of stops stops.append(distance) # insert 0 at the beginning of stops stops.insert(0, 0) current_stop = 0 ca...
7be247b0d4462550454f3a0fc742633177d6d766
DenisStepanoff/LP
/projects/lesson2/while_cycle.py
1,246
3.609375
4
QUESTION_ANSWER1 = {'Как дела':'Хорошо', 'Что делаешь':'Программирую', 'Знаешь python':'Ктож его не знает', 'Python или bash':'Конечно python'} QUESTION_ANSWER2 = {'Эй чувак':'Что', 'Иди сюда':'Ну что такое', 'Семки есть':'Н...
687d722e195347a192021ef38810674e00208141
gorpo/Exemplos-Python
/timymodule.py
1,284
4.03125
4
""" Written by: Shreyas Daniel - github.com/shreydan Description: an overview of 'timy' module - pip install timy A great alternative to Pythons 'timeit' module and easier to use. """ import timy # begin by importing timy @timy.timer(ident='listcomp', loops=1) # timy decorator def listcomprehension(): # the func...
e666e1417161dbc9aa43b9f25a3ac099a81ee6f2
ErkangXu/Leetcode
/25 Reverse Nodes in k-group/reverseKGroup.py
847
3.6875
4
# Definition for singly-linked list. # class ListNode(object): # def __init__(self, x): # self.val = x # self.next = None class Solution(object): def reverseKGroup(self, head, k): """ :type head: ListNode :type k: int :rtype: ListNode """ nh=ListN...
af82d7402ad5e808a465d0ca60b57ca8359bd735
ErkangXu/Leetcode
/56 merge intervals/merge.mergesort.py
1,463
3.859375
4
# Definition for an interval. # class Interval(object): # def __init__(self, s=0, e=0): # self.start = s # self.end = e class Solution(object): def mergeSort(self,inp,start,end): if start<end: self.mergeSort(inp,start,(start+end)/2) # It's (start+end)/2 not (end-start)/2 ...
f5d76b1c2951b8d574bc3ed15ecb31fda1dbd603
lassilias/dit
/contradiction_detection/logistic_regression/antonym_feature_wordnet.py
1,443
3.5625
4
# ! /usr/bin/env python # coding=utf-8 """ Contradiction detection : antonym from WordNet (original mthod)""" import sys from nltk.corpus import wordnet as wn def main(argv): sentence1 = "fall" type_node = "v" sentence2 = "rise" # lemmatize 4 parts sentence1 = wn.synset(sentence1+'.'+type_node+'...
382cf8f59c810db09edbe31e9a3fbd8ef2fa4dc3
Hoani-TeWhata/Caesar_Cipher
/main.py
3,669
4.53125
5
#This is my menu function menu to get the menu function def menu (): print("[1] Encrypt") print("[2] Decrypt") print("[0] Exit Program") #This makes it so the user will have to choose what they want before it the code is started def my_introduction(fname): print("Ceasar Cipher Game") print("Welcome ", fname...
9baa633ea96eac71f83cc25a879cafef55938ef8
dsdewi/Lasers-IOT
/driver.py
849
3.578125
4
import csv CutVsEng = str("") Material = str("") Passes = int(0) Power = int(0) Speed = int(0) Material = input("Enter what material you are cutting: ") Material = Material.lower() while (CutVsEng != "cutting" or CutVsEng != "engraving"): CutVsEng = input("Are you cutting or engraving: ") if (CutVsEng...
44f9dd284db81526f7ed83019c51332758c363df
lucashuysmans/CMI-External-Project
/Delaunay_floattype.py
19,746
3.609375
4
import math import random import numpy as np import torch """ Install pytorch first, see https://pytorch.org/get-started/locally/ for instructions """ """ If a GPU is available set device to "cuda" below, and this will speed up the code significantly (be careful not to overflow the GPU memory) To find out if a GPU ...
2ebf5019e187ced70ba9a449316aeae05b680c8d
jcardinal/exercism-python
/luhn/luhn.py
1,004
3.546875
4
class Luhn: def __init__(self, card_num): self.cleaned_card_num = [] for char in card_num: if char in "0123456789": self.cleaned_card_num.append(int(char)) elif char == " ": pass else: self.is_valid = False ...
e5f77d12248e4154b18ba6dd01edb5c623be34fa
Fabiofuentres/logica2021
/ejercicio3.py
543
3.78125
4
#este no es el ejercicio 3 #la agregart texto entre 3 comillas permite realizar saltos entre lineas mensaje = """esto es un texto""" print(mensaje) mensaje2 = " asdasdas\ asdasdas \ mas texto" print (mensaje2) #ejercicio4 numero1 = 5 numero2 = 7 numero3 = numero1 + numero2 print (numero3) ...
4399caf67a2049a1d0a08f27d57bcc3250f5270c
kanfangtingyu/python_pandas
/pandas/numpy2.py
221
3.9375
4
import pandas as pd import numpy as np df = pd.DataFrame( np.arange(12).reshape(3,4), columns=['A','B','C','D'] ) df.drop("A",axis=1,inplace=True) df.drop(index=1,axis=0,inplace=True) # 或者直接写1 print(df)
19db9c92684719a7ffd3ef9e380e4e6fcdb4de76
Andrzejdab/katowice_01_02_2020
/dzien_5/k5.py
274
3.625
4
def anagram(napis, tekst): napis = napis.lower() tekst = tekst.lower() a = set() b=set() for i in napis: a.add(i) for j in tekst: b.add(j) if a == b: ret else: napis ="ola" tekst ="alo" print(anagram(napis,tekst))
3e6a1701e1f5d5debb5d8dda1d9cbf69d8d48b8a
bruce-jy/dev_courses
/learn_python/oop/static.py
2,952
3.734375
4
# 2020.02.13 # Static and class method (200~206) # Instance 하지 않고도 바로 사용할 수 있는 static class String: @staticmethod def is_palindrome(s, case_insensitive=True): s = ''.join(c for c in s if c.isalnum()) if case_insensitive: s = s.lower() for c in range(len(s) // 2): ...
07a7ceada5486dc88e98fe1b53244993428fcb4c
JacobNegri/CP1404-Prac3
/str_ASCII_table shown.py
531
4.03125
4
def main(): lower = 10 upper = 50 numbers = get_number(lower,upper) print(numbers) ##for i in range(10, 120, 11): # make sure we have integers of different 'length' ##print("{} {}".format(i, chr(i))) def get_number(lower,upper): values = input("Enter a number {} , {}".format(lower,uppe...
f4a03ebaeaf9e4019c5e655980df2096333b9ee3
kavyan92/amazon_practice_problems
/min-difficulty-of-a-job-schedule.py
2,663
4.34375
4
"""You want to schedule a list of jobs in d days. Jobs are dependent (i.e To work on the i-th job, you have to finish all the jobs j where 0 <= j < i). You have to finish at least one task every day. The difficulty of a job schedule is the sum of difficulties of each day of the d days. The difficulty of a day is the m...
44798c380c83f1cd20fd45286c77199c94d37000
kavyan92/amazon_practice_problems
/word-search-ii.py
1,800
3.890625
4
"""Given an m x n board of characters and a list of strings words, return all words on the board. Each word must be constructed from letters of sequentially adjacent cells, where adjacent cells are horizontally or vertically neighboring. The same letter cell may not be used more than once in a word. Example 1: Input:...
d7ebe0dbfe059b9237efae4d1c3b4a9cf7811707
kavyan92/amazon_practice_problems
/defanging-ip-address.py
772
3.90625
4
"""Given a valid (IPv4) IP address, return a defanged version of that IP address. A defanged IP address replaces every period "." with "[.]". Example 1: Input: address = "1.1.1.1" Output: "1[.]1[.]1[.]1" Example 2: Input: address = "255.100.50.0" Output: "255[.]100[.]50[.]0" """ class Solution: def defangIPaddr...
e3415ecda1006aaa8f4ddf1c94a15f9bbfe73a80
kavyan92/amazon_practice_problems
/range-sum-of-bst.py
1,787
3.65625
4
"""Given the root node of a binary search tree and two integers low and high, return the sum of values of all nodes with a value in the inclusive range [low, high]. Example 1: Input: root = [10,5,15,3,7,null,18], low = 7, high = 15 Output: 32 Explanation: Nodes 7, 10, and 15 are in the range [7, 15]. 7 + 10 + 15 = 32....
cc06445bfef4e7410682768ddb5477bf4a611d4e
Gabrielganchev/Programming0
/week1/thefirst_week/week3/count_elements.py
138
3.53125
4
def count_elements(items): rez=0 for whateverint in items: rez +=1 return rez #print(count_elements([1,2,3,4,55]))
b0724ef447b84a587b9fb33e3594c011a9bcccdb
Gabrielganchev/Programming0
/week1/thefirst_week/week2/listProblems/read_n_numbers.py
265
3.90625
4
n = int(input("Enter count of numbers: ")) count = 1 numbers = [] while count <= n: number = [int(input("Enter number: "))] # ako maxnem int vuvejda chislata kato str numbers = numbers + number # malko remake ot men count += 1 print(numbers)
da59b8acb494f0ce7040747f7427c0919d687afb
Gabrielganchev/Programming0
/week1/zad 5 if.py
258
3.921875
4
a= int(input("chislo za a ")) if a%2==0: print(str(a) + " e chetno") else : print(str(a) + " ne e chetno") b = int(input("chislo za b ")) if b%2!=0: print(str(b) + " chisloto ne e chetno") else: print(str(b) + "chisloto e chetno")
5c36f4f39037ae0028ad7c8b987bdc25c2bf7dad
Gabrielganchev/Programming0
/week1/thefirst_week/if else problems/calculator.py
278
4.21875
4
a=int(input("number")) b=int(input("number")) operation =input("Enter Operation") if operation == "+": print(a+b) elif operation=="-": print(a-b) elif operation=="*": print(a*b) elif operation=="/": print(a/b) else: print("WE do not support that operation")
b7a39a3b1011373257aaf32d2be11443611c58be
Gabrielganchev/Programming0
/week1/zad 1 sled iff.py
112
3.984375
4
a = int(input("put a number ")) if (a>20 and a%2==0): print("yes it is ") else: print("no its not ")
924d54856b30de72392aef85b163f56429a66b7b
Gabrielganchev/Programming0
/week1/thefirst_week/if else problems/compare.py
207
4
4
a=int(input("number")) b=int(input("number")) if a==b: print(str(a) + " is equal to " +str(b)) elif a>b: print(str(a) + " is bigger then " +str(b)) else: print(str(a) + " is less then " +str(b))
3ef6ccbd16dc890a91d06813f700df255bd32b54
Gabrielganchev/Programming0
/week1/thefirst_week/LoginUsernamepasswrod Test.py
1,519
4.125
4
import time print ("Welcome to Test login fucntio of a program") time.sleep(2) print ("Enjoy") time.sleep(0.5) username = (input("Type Username Please").lower())#using . lower() for less code in the if's if len(username) >3 and username=="gabriel": time.sleep(1) print("Valid username") else: time.sle...
793b1ed22dbe8d632d3d684315e8ff9fbaba9374
Gabrielganchev/Programming0
/week1/thefirst_week/sundayweekend/bigger_last_digit.py
287
3.96875
4
a=int(input("number for a ")) b=int(input("number for b ")) #tazi ne q razbiram modulno ot 10 ? utre shte q pogledna pak a_last = a % 10 b_last = b % 10 if a_last > b_last: print(a) elif a_last < b_last: print(b) else: if a > b: print(a) else: print(b)
b85a25e048427696a603a67f77c0156c8b48c0fe
jinhaijun8106/python-learn
/for.py
125
3.765625
4
for i in range(1,5): print(i) else: print("The for loop is done") print("The for loop is done, add in test1 branch")
bcc517ea8355c257333bc8183830e45644d4cce8
Mullisb430/Random-employee-database-creator
/Main.py
730
3.640625
4
import sqlite3 import names import random from utilities import generateEmail, getDate count = 1 amount = 2001 conn = sqlite3.connect('employees.db') c = conn.cursor() c.execute('CREATE TABLE IF NOT EXISTS employees(ID INT, name VARCHAR(40), email VARCHAR(25), salary INT, gender VARCHAR(6), hire_date VARCHAR(10))') ...
e50855ea8c532583455d668bc1878bf40ff5def4
formosa21/learning_python
/working_w_numbers/frac_calculator.py
484
4.125
4
''' Fraction opeartions ''' from fractions import Fraction def add(a, b): print('Result of addition: {0}'.format(a+b)) def substract(a, b): print('Result of substraction: {0}'.format(a-b)) if __name__ == '__main__': a = Fraction(input('Enter the first fraction: ')) b = Fraction(input('Enter the second ...
922900bc1e965654d76933adc0c4a4f280f545e7
nzsdyun/Learn
/Book/python/PycharmProjects/Learn/lean3/test_collections.py
3,150
3.71875
4
# -*- coding: utf-8 -*- from collections import namedtuple, deque, defaultdict, OrderedDict, ChainMap, Counter # namedtuple # 定义namedtuple类型 Point = namedtuple('Point', ['x', 'y']) # 使用新创建的namedtuple类型创建对象 point = Point(1, 2) # 使用属性访问 print("(x:%s, y:%s)" % (point.x, point.y)) # 下标访问 print("(x:%s, y:%s)" % (point[0], ...
f02df4b0d71103eb2a71d9a8649bede35c20e3fa
RadmirSad/Pyth
/Proj/Neur.py
963
3.5625
4
import numpy as np def sigmoid(x): return 1 / (1 + np.exp(-x)) def derivative(x): return x*(1 - x) x = np.array([[0.7, 0.9, 1.0, 2.0], [0.3, 1.1, 4.0, 4.5], [1.2, 1.1, -3.0, 2.0], [0.6, 0.5, 2.5, 2.0], [0.1, 0.1, -1.0, 0.0], ...
c192b94ded05c0d3208a5c159667927adbb6bc36
SaladkevichM/exercism
/python/pangram/pangram.py
325
3.578125
4
def is_pangram(sentence): alphabet = 'qwertyuioplkjhgfdsazxcvbnm' hits = {} for i in range(0,len(sentence)): if sentence[i] != " " and alphabet.__contains__(sentence[i].lower()): hits[sentence[i].lower()] = 1 if len(alphabet) == len(hits.keys()): return True return F...
a21cb139a6a2ab1f12f7f347273d40673bd0f83e
Shchodryi/pythoncore
/are you playing banjo.py
210
3.515625
4
def areYouPlayingBanjo(name): if name[0][0] == "R": return name + " plays banjo" if name[0][0] == "r": return name + " plays banjo" else: return name + " does not play banjo"
c9c936eccd3e022a544600be3ecb578283eab2f0
afproy/IoTProject
/src/postprocess/tgram_pp/engine/users/User.py
1,407
3.578125
4
class User: """Class User: Class representing a User, a User is uniquely identified through his Telegram chat_ID. Attributes: chat_ID (int): unique identifier for a User latU (float): latitude of the user's position longU (float): longitude of the user's position bUmbre...
c7af44d271f79853213ecc430b76746f9b122d2e
KaganMuslu/GlobalAIHubPythonHomework
/Homework2.py
311
4.125
4
name = input("First name: ") surname = input("Last name: ") age = int(input("Age: ")) birth = int(input("Date of birth(Year): ")) info = [name,surname,age,birth] for i in info: print(i) if age < 18: print("You can't go out beacuse it's so dangerous!") else: print("You can go out street.")
6e1e1097d18b1786ff3e4629c5a457b1f114f500
Aviv-Cyber/Library_VOL1
/chess_old/lichess_db_puzzlefileCODE.py
3,507
3.5625
4
import pandas as pd from sklearn import linear_model import csv from sklearn.preprocessing import Binarizer import ast # with open('cars.csv', 'w', newline='') as csvfile: # fieldnames = ['Weight', 'Volume', 'price'] # writer = csv.DictWriter(csvfile, fieldnames=fieldnames) # # writer.writeheader() # w...
21b2b52b7c14e03bd5be4ccc9da9cc5500b01094
dalongyihao/My_firest_flie
/My_firest_file/屏保/Tkink_屏保.py
4,131
3.859375
4
import random import tkinter class RandomBall(): """ 定义球的运动 """ def __init__(self, canvas, scrnwidth, scrnhight): ''' canvas:画布,所有的内容都应该在画布上呈现出来此处通过这个变量传入 scrnwidth/scrnhight>屏幕的宽高 ''' self.canvas = canvas self.xpos = random.randint(10,int(scrnwidth)-20) ...
9f743e555cbaf0577d6ef0087ee6e4e52fd1dcdc
grupoicclosbicados/GitHub
/borrador.py
138
3.65625
4
#triángulo def triangulo(x): for i in range(1,x+1): for j in range(i): print(" x ",end="") print()
ad867203becdb057e077d516ab30413e198e917c
ajaxer37/python_learn
/count.py
276
3.78125
4
def count(sequence,item): cnt = 0 for i in sequence: if i == item: cnt += 1 return cnt input_strings = raw_input("Lists and pattern : ").split(' ') for ii in input_strings: print ii print count(input_strings[0],input_strings[1])
5af51d37eaeefc5b94a145ef6a3ad92f2a53ed0e
xiashiwendao/openCVHaveATry
/CamraCapture/test.py
378
3.515625
4
from cv2 import cap = cv2.VideoCapture(0) #调用笔记本内置摄像头 words = 'hello, cat' words[::-1] '%s,%s,%d'%('hello','lorry',5) words[-4:-2] A=[1,2,5,6,9] B=[2,8,9,11] print(set(A)&set(B)) print(set(A)^set(B)) def getInt(): r = range(1, 100) w = range(0.1, 0.9) for i in r: yield from w # yield fro...
30e08642a590cc8f7cabd33d02325648851413c3
sim0601/FNP
/np6/6.1.3.py
3,079
3.75
4
#!/usr/bin/env python3 #author : Simran Kohli simran.kohli@colorado.edu #name : 6.1.py #purpose : A script to connect to an FTP server and get data #date : 2017.10.22 #version : 1.3 import sys from ftplib import FTP import os down_file = 'README' def checkArg(): if len(sys.argv) != 3: print("Error: Ente...
0127475b883907499d77fb83c1c2b9d76da9d835
sim0601/FNP
/np5/5.2.py
1,900
4.125
4
#!/usr/bin/env python3 #author : Simran Kohli simran.kohli@colorado.edu #name : 5.2.py #purpose : A script to print planet info after reading from a database #date : 2017.10.04 #version : 1.1 import sys import os import sqlite3 DBname = sqlite3.connect('planetDB.db') DBname.row_factory = sqlite3.Row cursor = DBname....
3a43c9558ed4e9aaa51e8f717014dcc28216ed00
saschaschramm/DynamicProgramming
/environment.py
2,414
4.15625
4
""" A simple environment to study reinforcement learning problems similar to the environment defined in the book Reinforcement Learning: An Introduction. Definition of the environment: - A robot has the job to clean the room. - The robot gets a reward when it moves. - If the energy level is high the robot can move wit...
14a5d8c39b1f44b9c567525b2abe17f8e2b560d9
SAURAVBORAH22/covid-19-deep-analysis-
/app.py
37,620
3.53125
4
import streamlit as st import numpy as np import seaborn as sns import pandas as pd from PIL import Image import matplotlib.pyplot as plt from sklearn import preprocessing st.set_option('deprecation.showPyplotGlobalUse', False) def main(): activities=['About','Initital Period Analysis(January-March)','Apr...
c2683ed937960849932447d1cda2c044dbe995f2
beninbeta/Python-Projects
/breakfastbot.py
1,901
4.15625
4
import time sleep_time = 1 options = [ ["waffles","Waffles with strawberries and whipped cream."], ["pancakes", "Sweet potato pancakes with butter and syrup." ], ["donuts","Yummy gooey chocolate donuts."]] def print_pause(msg): print(msg + "\n") time.sleep(sleep_time) def ask_pause(msg): answ...
8a951541d19c01c0e298b00325c580ff17010c24
Tiago851/Data-Visualization
/mpl_squares.py
571
3.84375
4
#Script para definição e estilização do gráfico de linhas "normal" #Important modules import matplotlib.pyplot as plt #Values for y and x axis input_value = [1, 2, 3, 4, 5] squares = [1, 4, 9, 16, 25] plt.style.use("seaborn") fig, ax = plt.subplots() ax.plot(input_value,squares, linewidth=3) #Set th...
13fc3a4c9ce2f58ceea8782ddef600eaf1851a38
sarfarazsyed/Coursera
/Data Structures and Algorithms Specialization/algorithmic-toolbox/week2_algorithmic_warmup/4_least_common_multiple/lcm.py
726
3.671875
4
# Uses python3 import sys import random # def lcm_naive(a, b): # for l in range(1, a * b + 1): # if l % a == 0 and l % b == 0: # return l # # return a * b def gcd_opt(x, y): while y: x, y = y, x % y return x def lcm_opt(x, y): return (x * y) // gcd_opt(x, y) if __...
c09a393821a83d1762b19cc082ccc6d5105caf1a
olamide234/z_attempt
/bankaccount.py
2,858
4
4
"""This have a lookalike to how a bank operate. Login, Register a user, generate account number, deposit and withdraw funds, etc""" #login #register #bankaccount import random database = {} #dictionary #initializing the bank account def initiate(): print('Welcome to bank Apex') haveAccount= int(input('...
be081fd811fb2d437ed933e5bd90c90dfb9ed86d
ssarangi/pygyan
/RegressionClassifier.py
1,083
3.765625
4
import numpy as np class RegressionClassifier: def __init__(self, num_variables, learning_rate, threshold): self.num_variables = num_variables self.threshold = np.full(num_variables + 1, threshold) self.learning_rate = learning_rate # Training data is in the form of a numpy array with ...
ea064853883ee0dfbcd4055ef44c655402df61b2
mercedes-benz/GreenCodeEvaluator
/CodeEvaluator_Team_Bertha_Benz/experiments/romaissa/scaled_functions.py
1,859
3.515625
4
import numpy as np import time # useless imports import matplotlib import os def bad_search_10_power_2(): print("start bad_search") data, element = [i for i in range(10**2)], np.random.randint(2*10**2) for i in range(len(data)) : if data[i] == element : time.sleep(1) retur...
21d6e8a9a5321eed01c12d73b4edcedf620fa60b
liamhorne98/Text-editor
/main.py
887
3.625
4
from tkinter import * from tkinter import filedialog root = Tk() root.title('read - write') root.geometry("500x450") my_text= Text(root, width=40, height=10) my_text.pack(pady=20) def open_txt(): text_file = filedialog.askopenfile(initialdir="D:/user/Desktop", title="open text", filetypes=(("text Files", "*.txt")...
cc7d6895c1fd611cd1bbee1d1c018f71bf80c98f
marcboeker/mongodb-object
/mongodbobject/doclist.py
1,293
3.5625
4
from doc import Doc class DocList: """Represents a list of documents that are iteratable. Objectifying the documents is lazy. Every doc gets converted to an object if it's requested through the iterator. """ def __init__(self, collection, items): """Initialize DocList using the collection it belongs to an...
f6edc0bc8ea78585828b799bae425c316ccab210
BSir17/Leetcode
/Leetcode-Easy-20ValidParentheses.py
727
3.84375
4
# -*- coding:utf-8 -*- # Code by Fan.Bai #用个栈就完事了 class Solution: def isValid(self, s: str) -> bool: if len(s)==0: return True dict={} dict['(']=')' dict['{']='}' dict['[']="]" mystack=[] if s[0] not in dict: return False mysta...
fdd5343292051780711024a973d9b68f51e77f2c
BSir17/Leetcode
/110BalancedBinaryTree.py
610
3.828125
4
# -*- coding:utf-8 -*- # Code by Fan.Bai # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None import math class Solution: def judge(self,root): if not root: return 0,True lh,lf=self.judg...
77d3e824ebdcbf6a0f71a3e548c41da62c136a72
BSir17/Leetcode
/Leetcode-Medium-22GenerateParentheses.py
1,228
3.6875
4
# -*- coding:utf-8 -*- # Code by Fan.Bai #可以用全排列来做 #传入左边有多少个括号,如果为待匹配为0,当前字符只能是左括号,否则可以是右括号或左括号 class Solution1: def generateParenthesis(self, n: int): self.res=[] self.n = n*2 self.generate(0,0,"") return self.res def generate(self,leftnum,wait,s): if len(s)==self.n-1:...
6c2835106b874eb140b49f8bdf714a4bdc335168
BSir17/Leetcode
/141LinkedListCycle.py
1,040
3.78125
4
# -*- coding:utf-8 -*- # Code by Fan.Bai # Definition for singly-linked list. class ListNode(object): def __init__(self, x): self.val = x self.next = None #两种思路,一是快慢指针,二是替换掉节点里头的值为一个不会出现的数字,如果循环到了这个数字,则有环 class Solution(object): def hasCycle(self, head): """ :type head: ListNod...
a57405f436d740fe31f68b5dd98745e51e0d0503
BSir17/Leetcode
/101SymmetricTree.py
753
4.03125
4
# -*- coding:utf-8 -*- # Code by Fan.Bai # Definition for a binary tree node. class TreeNode: def __init__(self, x): self.val = x self.left = None self.right = None #分情况讨论,思路简洁明了 class Solution: def isSymmetric(self, root: TreeNode) -> bool: if not root: return True...
26c8f9e88476aa262d9533833f18dcc6c8d68ea8
rifqirianputra/DSMLCourse-Module-1
/6 May 2020 Training.py
1,259
3.578125
4
# a = b = c = 10 # d = 10 # e = 10 # f = 10 # print(a,b,c,d,e,f) # g,h,i = 15,20,30 # j = 15 # k = 20 # l = 30 # print(g,h,i,j,k,l) # x = 1 # y = "satu" # x,y = y,x # x = 10 # print(x) # x = "Andi" # print(x) # status = False # print(status) # print(a * a) # print(a / a) # print(type(1)) # print(type(1.0)) ...
57dc5f0fdaab70f8c86ea45093833b35aa9df263
rifqirianputra/DSMLCourse-Module-1
/8 May 2020 training 2.py
4,480
4.21875
4
# # SOAL 1 # # list data structured # # input: masukkan nama hari # # jumlah: -2 hari # # output: # # 100 hari dari sekarang adalah hari # days = ["monday", "tuesday", "wednesday", "thursday", "friday", "saturday", "sunday"] # userinputdays = str(input("what day is today? ")).lower() # if (userinputdays == "monda...