blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
8ed7f69357b2f78ae4761ebf7ef32c59a9e0f21c
VijayVictorious/Python-Practice
/for loop upto n/sum of natural numbers upto n.py
223
4.21875
4
""" Write a program sum of natural numbers upto n """ n = int(input("Enter n = ")) for i in range(1,n+1) : sum = 0 for j in range(1,i+1) : sum = sum + j print("sum of natural number upto n = ",sum)
93dc8566a70de7141b49a24e001b1d034394271d
VijayVictorious/Python-Practice
/if else programs/program --3.py
259
4.09375
4
""" write a program to find a number is positive or negative or zero """ num=int(input("Enter num : ")) if num >= 0 : print(num, "is the postive value") elif num >= 0: print(num, "is the zero value") else: print(num, "is the negative value")
97de48a3d51162dafda6edd9ba0d9099922b230a
VijayVictorious/Python-Practice
/Basic program/average of three numbers.py
111
3.90625
4
a=int(input("Enter a: ")) b=int(input("Enter b: ")) c=int(input("Enter c: ")) d=a+b+c/3 print("value is = ",d)
e3ffe8e7d070378ddecca3059e592cc456e1a157
obuseme/Codecademy-Python
/16.py
935
4.09375
4
#Code for codecademy.com Lesson 16 grades = [100, 100, 90, 40, 80, 100, 85, 70, 90, 65, 90, 85, 50.5] def print_grades(to_print): for grade in grades: print grade print_grades(grades) def grades_sum(scores): total = 0 for score in scores: total += score return total def grades_average...
11f5d0566d48abbd4ac52be92934027fa616946c
mora-ahya/not30
/not30.py
1,782
3.78125
4
import random,time def Select(): while True: try: number_CPU=int(input("CPUの数を入力してください(1人~8人)>")) if number_CPU>8 or number_CPU<1: print("無効です") else: Player_tarn=random.randint(1,number_CPU+1) member=[number_CPU,...
c5bb7f32d863193a471340e6a3a3227045c69416
EduardoMouraSilva/Algoritmos
/2 Condições/2_2_divisivel_por_6.py
543
4.25
4
num = float(input('Digite um número: ')) if (num % 2 == 0): if (num % 3 == 0): print(f'{num} é divisível por 6.') else: print(f'{num} é divisível por 2, mas não por 3,', end=' ') print(f'então não é divisível por 6.') elif (num % 3 == 0): if (num % 2 == 0): print(f'{num} é u...
cb2e9d8ef0822a4d6bf2b94e6d9338355394d019
AnAnteup/icp2
/icp 2(stack).py
1,056
4.125
4
class Stack(object): # 定义一个空栈 def __init__(self): self.items = [] # 添加一个元素 def push(self, item): self.items.append(item) # 删除一个元素 def pop(self): return self.items.pop() # 返回栈顶 def top(self): return self.items[-1] # 判断是否为空 def is_empty(self): ...
7cccd1f9e0e45b65fdfa22f8cdfba174efd58991
lhxcy/TensorflowLearn
/TFLearn_bidirectional_lstm.py
1,659
3.578125
4
""" Simple example using LSTM recurrent neural network to classify IMDB sentiment dataset. """ import tflearn from tflearn.data_utils import to_categorical,pad_sequences from tflearn.datasets import imdb from tflearn.layers.core import input_data,dropout,fully_connected from tflearn.layers.embedding_ops import embeddin...
9e3757ec77a544236f83ebbef902a8b727399918
lhxcy/TensorflowLearn
/Example_dynamic_rnn.py
6,908
4.15625
4
""" Dynamic Recurrent Neural Network. TensorFlow implementation of a Recurrent Neural Network (LSTM) that performs dynamic computation over sequences with variable length. This example is using a toy dataset to classify linear sequences. The generated sequences have variable length. """ import tensorflow as tf from ten...
dbc217d73e37f1c38b70544bc307783ca81324da
demka-archive/UliEngineering
/UliEngineering/Electronics/Capacitors.py
923
3.671875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from UliEngineering.EngineerIO import normalize_numeric from UliEngineering.Units import Unit import numpy as np def capacitor_energy(capacitance, voltage) -> Unit("J"): """ Compute the total energy stored in a capacitor given: - The capacitance in farads ...
3ad133232532f952b3b559780509072ce0968359
LaurenDiana16/Intro-to-Pandas
/LectureNotes/pronto_utils.py
749
3.703125
4
"""I am a file.""" from urllib.request import urlretrieve import os def download_if_needed(url, filename, force_download=False): """Download url to filename if filename does not exist""" if force_download or not os.path.exists(filename): print("Downloading file from {0} to {1}".format(url, filename...
eb70b44cf1342412b979ed656ddd79dba6bfd613
hornstrandir/Spidersolitaire
/spidersolitaire.py
13,106
3.53125
4
import random # Dieses dictionary dient lediglich zur Ausgabe in der Console. # Es wird in der Klasse Card und Stack für die magische Methode '__str__' verwendet n = [i for i in range(14) if i != 11] uni_cards = { 'hearts': {v+1: chr(127153 + n[v]) for v in range(13)}, 'spades': {v+1: chr(127137 + n[v]) for v ...
b36431b9e92ddfe8546464b6923b28311143aa5f
BOGICAR/Lesson-8
/exchange_rates.py
2,180
3.5625
4
import requests import argparse import json import datetime import time def request(): get_info = requests.get('https://api.exchangerate.host/convert', params={'from': args.currency_from, 'to': args.currency_to, ...
2a7755056b68823d24d80b5c3ab0e88125c887ac
FelipeSBarros/PythonTrainning
/TimeConvert.py
518
4.0625
4
""""" https://www.coderbyte.com/editor/guest:Time%20Convert:Python Challenge Have the function TimeConvert(num) take the num parameter being passed and return the number of hours and minutes the parameter converts to (ie. if num = 63 then the output should be 1:3). Separate the number of hours and minutes with a co...
d8af61c1fc8d1054766c46bc06d1885cb5b6ada8
FelipeSBarros/PythonTrainning
/LetterChanges.py
1,130
4.25
4
"""" https://www.coderbyte.com/editor/guest:Letter%20Changes:Python Challenge Have the function LetterChanges(str) take the str parameter being passed and modify it using the following algorithm. Replace every letter in the string with the letter following it in the alphabet (ie. c becomes d, z becomes a). Then capi...
21f3cdaf1e1e74ecba975402622ccb7a870931a3
FelipeSBarros/PythonTrainning
/AlphabetSoup.py
515
4.15625
4
"""" https://www.coderbyte.com/editor/guest:Alphabet%20Soup:Python Challenge Have the function AlphabetSoup(str) take the str string parameter being passed and return the string with the letters in alphabetical order (ie. hello becomes ehllo). Assume numbers and punctuation symbols will not be included in the string. S...
2a322d55e5c45895408e901b924034798d560076
fluke31007/cardGame
/CardGame/cardFunc.py
6,054
3.734375
4
import random class stat(object): """docstring for stat""" def __init__(self): self.HP = 0 self.atk = 0 self.defend =0 self.brk =0 class Hero(stat): """docstring for Hero""" def __init__(self): super(Hero, self).__init__() self.hp = 300 self.atk = 50 self.deff = 30 self.brk = 70 self.pick = 0 ...
bb1a7128eebf8f2a9f96d316b3c59d42799142c7
Jay07/Workshop8
/guitars.py
1,006
3.703125
4
from guitar import Guitar guitarList = [] print("My Guitars!") UserQuit = False while not UserQuit: name = input("Name: ") if name == "": UserQuit = True else: year = input("Year: ") cost = input("Cost: ") guitar = Guitar(name, int(year), float(cost)) guitarListIte...
a2b0c932ed09483beb68dae5ff2d1ca1c4e6257b
C-CCM-TC1028-102-2113/tarea-1-programas-que-realizan-calculos-SamyEa12
/assignments/09Telefono/src/exercise.py
432
3.859375
4
def main(): #escribe tu código abajo de esta línea #Leer los datos mensajes=float(input("Dame el número de mensajes: ")) megas=float(input("Dame el número de megas: ")) minutos=float(input("Dame el número de minutos: ")) pmen=mensajes*0.8 pmeg=megas*0.8 pmin=minutos*0.8 precio=pmen+p...
bb4228a6087acce3f4a83ccd1442f0f0792ea594
prashantkadam-py/deepdive_part1
/closure_104.py
529
3.578125
4
def counter(fn, counters): cnt = 0 def inner(*args, **kwargs): nonlocal cnt cnt += 1 counters[fn.__name__] = cnt return fn(*args, **kwargs) return inner def add(a, b): return a + b def mult(a, b): return a * b if __name__ == "__main__": counters = {} ...
9f25c01983b344cb6641c5477b633566845b016d
prashantkadam-py/deepdive_part1
/named_tuples_app_126.py
721
3.59375
4
from collections import namedtuple Color = namedtuple("Color", "red green blue alpha") def random_color(): red, green, blue, alpha = 1, 2, 3, 4 return Color(red, green, blue, alpha) def tuplify_dicts(dicts): keys = { key for dict_ in dicts for key in dict_ } Struct = namedtuple("Struct", sorted(ke...
2e812457d698e0ad20411c8dd6da2933aa0ebb19
ganiirsyadi/leetcode
/solutions/2. Add Two Numbers/add_two_numbers_1_BR.py
2,431
3.578125
4
class ListNode: def __init__(self, val=0, next=None): self.val = val self.next = next def __str__(self) -> str: current_node = self result_list = [] while current_node != None: result_list.append(str(current_node.val)) current_node = current_node.n...
a4595fcb393e5bb2c773c9f664f6f8d8a9f72adc
vvpwork/goit-python
/lesson_2/hw_3.py
1,566
4
4
data = [] operators = '+-/*=' result = 0 def isFloat(val): try: float(val) return True except ValueError: return False while True: try: user_command = input('Enter your number or operation: ') isOperetor = user_command in operators if user_command == '=': ...
f9ce6809f4a97f0f046b1d013244c8fa8650ce24
vvpwork/goit-python
/lesson_8/test.py
975
3.640625
4
import random from datetime import datetime def get_days_from_today(date): date_arr = list(map(lambda x: int(x), date.split('-'))) now_date = datetime.now() print(now_date, date_arr) user_date = datetime(year=date_arr[0], month=date_arr[1], day=date_arr[2]) print(user_date) result = now_date -...
2f2ad80f66be8eec2870c44618aee2ab887ab43c
huyjohnson/200605_009_Guttag_Ch3.1_FingerExercise_ExhaustiveEnumeration
/ExhaustEnumeration.py
749
4.09375
4
# - Finger Exercise - Chapter 3.1 num = int(input('Please enter an integer: ')) root = 0 pwr = 2 # Started at 2 because all sets allowed for root**1 = num endbound = 6 while pwr < endbound and root**pwr != abs(num): while root < abs(num): root += 1 if root**pwr == abs(num): if num > ...
eac7e8dbfdf0a60aac6ed1138c488661dd1d72ad
maicon-silva/vccode
/Lista de exercicios 1/Exercício 5.py
778
3.75
4
# Um motorista deseja abastecer um valor X em reais, de combustível. # Escreva um algoritmo para ler o preço do litro do combustível e o # valor que o motorista deseja abastecer. Em seguida, informe quantos # litros foram abastecidos. # Variavel preço da gasolina, ficou fixo. valor_gasolina = float(3.675) # Mostra o...
f6bfc8eb6ec63f5ef0a687366b045d754a18705a
maicon-silva/vccode
/Lista de exercicios 1/Exercício 8.py
853
3.921875
4
# Crie um algoritmo que calcule o novo valor de um salário a partir de um valor percentual de reajuste. # O valor atual do salário e o valor percentual do reajuste devem ser informados pelo usuário como, por exemplo, 7,3%. print("Para calcular o reajuste salarial voce vai precisar do valor do salário atual e da porcen...
51b3b1f6b5e9fca80ee2acc0bb46d8ab92e89aeb
maicon-silva/vccode
/Lista de exercicios 1/Exercício 12.py
592
4.15625
4
# Crie um algoritmo que calcule a área de uma esfera, sendo que o comprimento do raio é informado pelo usuário. # A área da esfera é calculada multiplicando-se 4 vezes pi e o raio ao quadrado. # Mostra as informações necessáras a tarefa print("Para efetuarmos o cálculo da área da esfera, precisamos saber o valor do ra...
bcee66dd7e1715b38cc47df91e402cb150a13b2e
bajrakushal/Python
/assignment4/Exercise3.py
1,499
4.21875
4
""" Implement question number 1, 2 and 6 from Session 3 Exercise as different functions Exercise 1: Write a program to display all prime numbers from 1 to 100. Exercise 2: Ask the user for a string and print out whether this string is a palindrome or not. Exercise 6: Create a dictionary that has a k...
be3f75fe58d7ff6d8dec0db904efb2eec3f26d3b
tedkx/advent-of-code-2019
/day4/a.py
739
3.84375
4
def isValidPassword(password): foundAdjacent = False strPassword = str(password) for idx in range(1, len(strPassword)): current = strPassword[idx] previous = strPassword[idx - 1] if(current < previous): return False if(current == previous): foundAdjace...
a99d98d4e3bb7f4cbf71fba244e5819487cf7307
tedkx/advent-of-code-2019
/day3/a.py
1,057
3.5
4
from instruction import Instruction from point import Point def main(): file = open("input.txt", mode="r", encoding="utf-8") wire1 = file.readline().strip().split(',') wire2 = file.readline().strip().split(',') pos = Point(1, 1) dic = {} for idx in range(len(wire1)): instr = Instructi...
34871c5d681fa4a8a6828233da46811a7edfb229
Christopher-Teague/RecognizePython
/file.py
2,760
3.921875
4
num1 = 42 #variable declaration num2 = 2.3 #variable declaration boolean = True #boolean string = 'Hello World' #string pizza_toppings = ['Pepperoni', 'Sausage', 'Jalepenos', 'Cheese', 'Olives'] #list person = {'name': 'John', 'location': 'Salt Lake', 'age': 37, 'is_balding': False} #dict...
8ad0551090e46e5f4316c8682d1ccdd0d173257b
vituscze/prog1
/cviceni1.py
653
3.640625
4
# Algoritmizace: Vážení N kuliček # * Nalezení nejtěžší kuličky pomocí N - 1 zvážení (formální důkaz správnosti a optimality) # * Nalezení nejtěžší a nejlehčí kuličky pomocí 3/2 N - 2 zvážení # * Nalezení dvou nejtěžších kuliček pomocí N + log N - 2 zvážení (turnajový postup) # * Nalezení jedné odlišné kuličky pomocí l...
ad9428b4e2e5ce7c21946f18de996325d3134df9
salaheddinechehbi/python_tutorial
/json/json_exem.py
794
3.703125
4
import json data ={ 'Personnes' : { 'name':'said', 'age':25, 'wifes':[ {'name':'safia','age': 22}, {'name':'wejdan','age': 24}, {'name':'oumaima','age': 25} ], 'childrens':[ {'name':'saffa','age': 2}, {'name':'maje...
ef3088c586afe444b6addfdaadfe03a9b5cfc7e1
salaheddinechehbi/python_tutorial
/methodes_classes.py
1,034
3.5
4
#class Personne class Personne : entreprise_actuell = "KS-Events" # varialbe de class def __init__(self, p_nom,p_age,p_sexe): self.nom = p_nom self.age = p_age self.sexe = p_sexe def parler(self,message):# methose standart pour acceder a cette class il faut instansier une un...
cac2f30f92a152d7c8f208a025df163e8d42b98c
salaheddinechehbi/python_tutorial
/personne.py
1,020
3.796875
4
class Personne : ville_actu = "Marrakech" # Cnostructeur def __init__(self,p_name="",p_sexe="",p_age=""):# p_name="" pour donnée une valeur par defaut a cette ettribut self.name = p_name self.sexe = p_sexe self.age = p_age print("Object crée ......... ") def parler(...
6878420b97d3ade2dcdd8065ebb161e3262777a4
Shreiya/coderama
/week1-python/lists.py
675
3.90625
4
my_list = [1, 2, 3, 4, -3] my_list = list([3, 4, 5]) my_list = list() my_list.append(7) print my_list print len(my_list) b = [8] c = my_list + b print c c.append(3) print c c.insert(1, 1000) print c #slice me up print c[1:] print c[1:3] print c[-1] #since no colon, it'll only return an element print type (c[-...
e2714f7ecec9c6e1546996b83448a37974c422d1
OedaLab/Python100knock
/checkISBN.py
1,332
3.875
4
# 現行規格のISBN (ISBN-13) のチェックディジットは、JANコードと同じく、 # 「モジュラス10 ウェイト3・1(モジュラス10 ウェイト3)」という計算法 # にて算出される。 # ここでは例として,ISBNを9784873116556とする. # 検査数字は,先ずISBNの左から奇数桁の数字の合計と, # 偶数桁の数字の合計を3倍にしたものを加え,10からその和の下 # 一桁の数字を引いて求める. # 9784873116556の場合, # 奇数の和:9+8+8+3+1+5 = 34 # 偶数の和:7+4+7+1+6+5 = 30 # 34 + 30*3 = 124 # 124の一桁目は4 # 10 - 4 ...
02495f57c796230980a62de18aa83933752ba8e4
OedaLab/Python100knock
/countWords.py
206
3.5625
4
str = 'Could you send me an e-mail.' print(str) # ダサい ct = 0 for i in str: if i==' ': ct+=1 ct += 1 print('word1 = %d' %(ct)) # クール ct = len(str.split()) print('word2 = %d' %(ct))
a8525081fbbd68b36e70646e1b68fc72ce468bc1
OedaLab/Python100knock
/makeGroup.py
737
3.640625
4
#!/usr/bin/env python # 36. グループ分けを行うプログラムを作成せよ. import sys import random import pandas as pd import numpy as np # 引数チェック argvs = sys.argv argc = len(argvs) if argc!=3: print("Usage: makeGroup クラス人数 1班の人数") sys.exit(1) classNum = int(argvs[1]) groupNum = int(argvs[2]) # ランダムシャッフル member = [i+1 for i in range(c...
e8a66b46c9ed19661981c362dfc3015d19904bf7
linseanwin/learning-note
/homework/hw2/merge_sort_06170140.py
873
3.8125
4
class Solution(object): def merge(self,left,right): ans = [] while len(left) > 0 or len(right) > 0: if len(left) > 0 and len(right) > 0: if left[0] <= right[0]: ans.append(left.pop(0)) else: ...
0eb02469796ba91bad5473c6f3f6c73f3b8be1db
praba230890/Simultaneity
/queue_threading.py
558
3.53125
4
import threading, queue import time q = queue.Queue() def task(i): d = 0 for v in range(100000): d += 1 q.put(d) print("Thread: %s" % (i)) time.sleep(1) if __name__ == "__main__": tasks = [] for i in range(100): add_task = threading.Thread(target=task, args=(i,)) ...
9bdd1c1f669e48115ef9c3feb3a6ddb5e9e3b07a
esong200/K-Nearest-Neighbors_Movie_Classifier
/movie_classifier.py
47,218
4.125
4
#!/usr/bin/env python # coding: utf-8 # In[90]: # Initialize OK from client.api.notebook import Notebook ok = Notebook('project3.ok') # # Project 3: Movie Classification # Welcome to the third project of Data 8! You will build a classifier that guesses whether a movie is a comedy or a thriller, using only the num...
4307e0071d82643b280c8e5acdbdf8d8364ff504
sumit162-sys/pythonprojetcs
/src10.py
1,284
4.34375
4
''' Using the concept of object oriented programming and inheritance, create a super class named Computer, which has two sub classes named Desktop and Laptop. Define two methods in the Computer class named getspecs and displayspecs, to get the specifications and display the specifications of the computer. You can u...
5280331e368f8c9342deb2d1c1285aa4953bab90
sumit162-sys/pythonprojetcs
/src21.py
299
3.96875
4
''' Tkinter:Messagebox ''' from tkinter import * import tkinter.messagebox root = Tk() tkinter.messagebox.showinfo("Title","This is awesome") response= tkinter.messagebox.askquestion("Question1","Do you like coffee") if response== 'yes': print("Here is a coffee for you") root.mainloop()
b64be89ba986341df612ea926372475a0eab44f1
timcowlishaw/kaggle-nr
/import_to_sqlite.py
593
3.765625
4
import sqlite3 import csv if __name__ == "__main__": datasets = ["train", "test"] conn = sqlite3.connect("data/data.sqlite") cur = conn.cursor() for dataset in datasets: print dataset csv_file = open("data/%s.csv" % (dataset,)) data = csv.reader(csv_file) data_list = list(data) header = data...
99f6b77a9619ca7cbc8bf505eb6648f46a536942
QQpy3ko/project-lvl1-s566
/brain_games/games/brain_calc.py
485
3.9375
4
import operator import random OPERATORS = { '+': operator.add, '-': operator.sub, '*': operator.mul } DESCRIPTION = "What is the result of the expression?" def get_question_and_answer(): a = random.randint(1, 20) b = random.randint(1, 20) random_operator_key = random.choice(l...
8b1a3acf90e018d9d3fd83424b990bea4e77d090
QQpy3ko/project-lvl1-s566
/brain_games/games/brain_prime.py
472
3.84375
4
import random import math DESCRIPTION = 'Answer "yes" if given number is prime. Otherwise answer "no".' def is_number_prime(x): if x == 1 or not x % 2: return False for i in range(3, int(math.sqrt(x)), 2): if not x % i: return False return True def get_question_and_answer()...
8a21c6124fa50fd75b8f25edd888ec0d50a70bb8
vanesa/codepractice
/hackbright/whiteboarding/whiteboarding.py
866
3.96875
4
import random def is_palindrome(word): """ Find if the word is a palindrome! >>> is_palindrome("a") True >>> is_palindrome("ete") True >>> is_palindrome("marvel") False >>> is_palindrome("racecar") True """ for i in range(len(word)/2): if word[i] != word[len(word)-i-1]: return False return True ...
732ce9a3213784cf322c48e88c1e26fb5a1a1be2
andreso21/ProgramasAndresQuishpe
/Primer_Diccionario.py
318
3.6875
4
# -*- coding: utf-8 -*- """ Created on Mon Jan 18 14:11:33 2021 @author: Usuario """ dict1={'R1':'10.0.0.1',1:'AP',2:2.5,3:True, 'R2':'172.17..0.1'} print(dict1) print(len(dict1)) print(type(dict1)) print(dict1[1]) print(dict1[2]) print(dict1[3]) print(dict1['R1']) dict1['R3']='10.0.0.3' print('R3'in dict1)
2014aa37826d6fec774272499020f825daf1d061
asmaaismaiel/PythonDeveloping
/Lab_1/CharacterLocator.py
293
3.953125
4
word = input("Enter your word\n") letter = input("Enter your letter\n") def locate(word): pass myList = [] counter = 0 for i in word: if letter == i: pass myList.append(counter) counter += 1 return myList x = locate(word) print(x)
a47644945696c1b54b5e4fec3371ea71629ce3ed
itsmefarhan/Python-Assignments
/Assignment-1/marksheet.py
2,142
3.984375
4
name = input('Enter Your Name: ') roll_number = input('Enter Your Roll Number: ') institute = input('Enter Your Institute Name: ') subject_1 = int(input('Enter marks obtained in Physics ')) subject_2 = int(input('Enter marks obtained in Chemistry ')) subject_3 = int(input('Enter marks obtained in Maths ')) subject_4 ...
1044f399fc1fc031692213d6d152c7207c78fdaf
nikolaykochubeev/itmo_AlgorithmsAndDataStructures
/5 laboratory/5c.py
2,529
3.609375
4
class Node: def __init__(self, key): self.left = None self.right = None self.value = key def insert(node, key): if node is None: return Node(key) else: if node.value == key: return node elif node.value < key: node.right = insert(node...
7d3288ca3ac53ac638981667fe7bfeabdf8b0fbf
zangsir/dialogue-self
/dialogue-tree.py
2,648
4.09375
4
import pickle import os.path import sys class Tree: def __init__(self, cargo, left=None, right=None): self.cargo = cargo self.left = left self.right = right def __str__(self): return str(self.cargo) def __repr__(self): return str(self.cargo) def print_tree_indent...
3a2ab469860f01bc73f88062774d32fc160cbc76
Alapnachavan/variable
/variable.py
243
3.96875
4
= input ("enter the day ") time = ("enter the time ?dinner , lunch, breakfast") if day == "monday" time == "breakfast" print ("pohdaya") eilf time =="lunch" print ("dal chaval") time =="dinner" print("dal subji") else : print ("invalid")
03a3c0313977efd2806a6238037d4b5a2341b6db
sbahaddi/bootcamp_python42
/Module00/ex07/filterwords.py
1,035
4.71875
5
""" Using list comprehensions, you will have to make a program that removes all the words in a string that are shorter than or equal to n letters, and returns the filtered list with no punctuation. The program will accept only two parameters: a string, and an integer n. Example: > python filterwords.py "Hello, my frien...
db20429267607defa3633439cd35799db9798afb
sbahaddi/bootcamp_python42
/Module01/ex00/recipe.py
1,649
3.71875
4
class Recipe: def __init__(self, name, cooking_lvl, cooking_time, ingredients, recipe_type, description=""): self.name = self.set_name(name) self.cooking_lvl = self.set_cooking_lvl(cooking_lvl) self.cooking_time = self.set_cooking_time(cooking_time) self.ingredients = self.set_ingred...
1c2da926795c9092066c57cefabcfcd4dea59caf
5l1v3r1/Python-Advanced
/Templates/Template_Usage.py
1,041
4.125
4
'''Here are some points about templates: 1. We can escape the delimiter by using it twice i.e. Template('I have $$0.') will output: "I have $0." 2. To attach a string at end of a placeholder you need to specify placeholder in {} i.e Eg. Template("This is our ${place}yard.") will output: "This is our sh...
8af5c94c4828cbd111dca9ea8e612a0325809a63
camohe90/-mision_tic_G1
/s18/18.4_conteo_letras.py
376
3.828125
4
frase = input("Digite la frase que desea que verifiquemos") conteo = {} for letra in frase.lower(): if letra not in conteo: conteo[letra] = 1 else: conteo[letra] +=1 mensaje = ( f"En la frase {frase} se encontraron las siguientes letras \n") print(mensaje) for clave, valor in...
aeec01b06609c8015fad90ab875c533f830d730f
camohe90/-mision_tic_G1
/s17/17.4.2_for_validaciones_funcione2.py
842
4.125
4
"""Solicitar al usuario que ingrese una lista de numero, digite x para finalizar y que ingrese un numero que desea limite, con ese limite desea saber numeros hay menor que este en la lista original y generar un lista con esos numeros""" numero = 0 numeros_ingresados = [] def numero_menores(numeros, numero_l...
9c633ffed8f939cfe41ccf8d2cea8c1f44f96427
camohe90/-mision_tic_G1
/s11/11.7.1_condicionales_anidados_ejemplo.py
448
3.875
4
numero1 = int(input("Por favor ingrese el numero 1:")) numero2 = int(input("Por favor ingrese el numero 2:")) if numero1 == numero2: resultado = numero1 * numero2 print(f"El resultado es: {resultado}") else: if numero1 > 5 and numero1 <=10: resultado = numero1 + numero2 print(f"E...
587228b75d03929d1706e59ee720af4d3d7a4210
camohe90/-mision_tic_G1
/s11/11.5_condicionales.py
122
3.71875
4
MAYORIA_EDAD = 18 edad = int(input("Ingresa tu edad")) if edad >= MAYORIA_EDAD: print("Puedes ingresar al bar")
44593fea8e6a697b8fcc198a71ec060d9e6ed0cb
camohe90/-mision_tic_G1
/s5/1.6_asignacion.py
232
3.5
4
suma = 2 + 3 print(suma) resta = 5 - 4 print(resta) multiplicacion = 3 * 3 print(multiplicacion) division = 10 / 3 print(division) division_entera = 10 // 3 print(division_entera) modulo = 10 % 3 print(modulo)
f510735cf0c0f5c972c8af6963815805cf3c18ff
camohe90/-mision_tic_G1
/s12/11.5.4_ejercicio1.py
1,174
4.0625
4
"""Determinar la cantidad de dinero que recibirá un trabajador por concepto de las horas extras trabajadas en una empresa, sabiendo que cuando las horas de trabajo exceden de 40, el resto se consideran horas extras y que estas se pagan al doble de una hora normal cuando no exceden de 8; si las horas extras exceden ...
c223184461e9191c8e633c786711008883042463
Eduardogit/MathCodeprojects
/Computer_Simulation/meanProducts.py
295
4
4
print "ingresa tus 2 semillas" x1 = input("1>:") x2 = input("2>:") x = input("numero de repeticiones") arr = [] while len(arr)<x: x3 = x2 * x1 print "x1 * x2 =%i"%x3 print "ri = 0.%s"%str(x3)[2:6] x1 = x2 x3 = float(str(x3)[2:6])#conversion antes de pasar x2 = x3 arr.append(x3)
71508bde9ea7eab8c322a4b1c41e7ae109ea7c53
Kanagaraj-NN/ECFL
/5_sort_susp_lines_DStar.py
3,289
3.53125
4
import csv import operator import os import time PROJECTS = ['Closure', 'Lang', 'Chart', 'Math', 'Mockito', 'Time'] PROJECT_BUGS = [ [str(x) for x in range(1, 134)], [str(x) for x in range(1, 66)], [str(x) for x in range(1, 27)], [str(x) for x in range(1, 107)], [str(x) for x in range(1, 39)], ...
8b21749a04719da47c4cc39ea4bb2bae926f3512
mcgranam/projecteuler
/projecteuler027.py
824
3.671875
4
#!/usr/bin/env python # File name: projecteuler027.py # Author: Matt McGranaghan # Date Created: 2014/05/04 # Date Modified: 2014/05/04 # Python Version: 2.7 def prime_list(max_prime): target = max_prime prime_numbers = range(1,target+1) for p in range(2,target): if prime_numbers[p-1] != None: for i ...
480b48a14892fc72ddb064ff96aa14746b0796f5
mcgranam/projecteuler
/projecteuler006.py
856
3.890625
4
#!/usr/bin/env python # File name: projecteuler006.py # Author: Matt McGranaghan # Date Created: 2014/04/17 # Date Modified: 2014/04/17 # Python Version: 2.7 # The sum of the squares of the first ten natural numbers is, # 12 + 22 + ... + 102 = 385 # The square of the sum of the first ten natural numbers is, ...
a729930fe6f939e021675b81b58e151715a1ee97
mcgranam/projecteuler
/projecteuler035.py
978
3.65625
4
#!/usr/bin/env python # File name: projecteuler035.py # Author: Matt McGranaghan # Date Created: 2014/05/07 # Date Modified: 2014/05/07 # Python Version: 2.7 def no_odd(n): k = n odd = True while k > 0: if k%2 == 0: odd = False break else: k = k/10 return odd def solution035(): target = 100...
8d280bae9a9a7e2cc707ceb94ebe32684afd8fa2
edofi123/FindSimilar
/doublePicture/findDuplicates.py
5,950
3.6875
4
import os import random from PIL import Image '''Const variables''' PTC_MUL = 2 PTC_START = 5 PR_START = 30 PR_MUL = 4 MIN = 1 MAX = 5 def rand(min_val, max_val): return random.randint(min_val, max_val) def tuple_calc(my_tuple, num, state): val = 1 if state else -1 return tuple((my_tuple[0] + (num*val...
e2243b78bcd900214f149ace03084048785178be
zxsted/graphs
/algorithms.py
10,965
3.828125
4
from .graph import * from .digraph import * from collections import deque import heapq def dfs(g, start_node = None): """Runs Depth First Search on a graph. Args: - g: A directed or undirected graph. - start_node: A node of g from where the search will start. If this is None, the search will ...
b8c6fd03300481c54c71a798675b924ac13d8bfa
MaloMn/advent-of-code
/day-10/adaptater-array.py
1,555
3.75
4
from utils import get_lines, product def builtin_voltage(volts): volts.sort() volts = [0] + volts one_jolt, three_jolt = 0, 0 for i in range(1, len(volts)): # print(volts[i-1], volts[i]) if volts[i] - volts[i-1] > 3: return volts[i-1] if volts[i] - volts[i-1] == 1:...
610af6facf3bcb54a5fd6f27f5307b49408067dc
MaloMn/advent-of-code
/day-9/encoding-error.py
1,016
3.65625
4
from utils import get_lines def _check_is_sum(numbers, nb): for a in numbers: for b in numbers: if a + b == nb and a != b: return True return False def _find_contiguous_set(lines, result): for j in range(len(lines)): compound = 0 output = [] f...
def7a5997bf05ac5a4d546d0a371d586c4c2033d
MaloMn/advent-of-code
/day-11/seating-system.py
2,593
3.515625
4
from utils import get_lines from typing import Tuple from copy import deepcopy occupied = '#' empty = 'L' floor = '.' def _grid(size: Tuple[int, int]): for a in range(size[0]): for b in range(size[1]): yield a, b def _is_seat_correct(position: Tuple[int, int], size: Tuple[int, int]) -> bool...
ce7f93855d8bd55882b66a52fd8715b140983ea3
DarrenDanielDay/git-learning
/factorial.py
145
3.84375
4
def factorial(n: int) -> int: if n == 0: return 1 return factorial(n - 1) * n if __name__ == "__main__": print(factorial(6))
22ba944af8d8f0f74f235d1f0e3b7fed7441fcab
AnudeepGunukula/qdk-python
/qdk/qdk/chemistry/geometry/xyz.py
1,737
3.765625
4
# Copyright (c) Microsoft Corporation. # Licensed under the MIT License. """Module for converting coordinates to XYZ-formatted data The formatting of the .xyz file format is as follows: <number of atoms> comment line <element> <X> <Y> <Z> ... Source: https://en.wikipedia.org/wiki/XYZ_file_format. ""...
728f03626f0867159139fb21f4c8edd3193ff45d
AnilkumarS9125/Introduction-to-programming-with-Python-3.7
/sourcefiles/manipulatevariable.py
394
4.15625
4
############################################ # Storytelling Program # Shiva Kambala ############################################ # Taking userinput animal = input(“Your favourite animal:”) building = input(“Name a famous building:”) color = input(“Your favourite colour:”) # Telling the story print("Hickory Dickory ...
b4c27762816ce6e4e409f679667600abc502fb0f
AnilkumarS9125/Introduction-to-programming-with-Python-3.7
/sourcefiles/stringfunctions.py
415
4.1875
4
############################################ # Variable manipulation # Shiva Kambala ############################################ # Taking userinput animal = input("Your favourite animal:") # Converts the user input to lower case print(animal.lower()) # Converts the user input to upper case print(animal.upper()) ...
e32174a432108d37c95882317adaa092343cf8db
AnilkumarS9125/Introduction-to-programming-with-Python-3.7
/sourcefiles/nested-if.py
314
3.953125
4
################################################### # nested - if statements # Shiva K ################################################### monDay = True freshCoffee = False if monDay: if not freshCoffee: print("Go and buy a fresh coffee!") print("I hate Monday") print("You can go to office now!")
9e50be7cf04ff1b49dbeb95ffdbb1a5c599da139
suhanidesale/Python
/dictionary.py
260
3.640625
4
data = {'suhani': 'c++', 'om' : 'python' , 'mayuresh' : 'c#'} data1 = {'aahana' : 'java' , 'vaishanavi' : 'c'} list1 = ['suha' , 'omi' , 'mayu'] list2 = ['c++' , 'c#' , 'java'] data3 = dict(zip(list1 , list2)) print(data3) x ='1011' print(int(x,2))
790212ba60d5df90fad2c65b9b074df0ba8c58f8
Grivine-19/Financial-Inclusion
/apps/bivariate.py
3,507
3.6875
4
import streamlit as st import plotly.express as px import plotly.graph_objects as go from apps.data import get_data finance_data = get_data('data/inclusion.csv') def app(): menu = ["Gender Vs Bank Account", "Education Vs Bank Account", "Marital Status Vs Bank Account", "Cellphone Access Vs Bank Account"] ...
59b4f2e3656f92ee73a5b995725bd8382e3c738a
wberkhof/knowit
/luke23.py
1,087
3.5625
4
import time def isprime(num): if num > 1: # Iterate from 2 to n / 2 for i in range(2, num//2+1): # If num is divisible by any number between # 2 and n / 2, it is not prime if (num % i) == 0: return False else: ...
1b18ee0f93692376e4c132b951326009a928934b
fiddlerwoaroof/emen2
/emen2/db/group.py
2,460
3.765625
4
"""Group: Represents a group of users, each with certain permissions.""" # EMEN2 imports import emen2.db.dataobject import emen2.db.exceptions class Group(emen2.db.dataobject.PermissionsDBObject): """Groups of users. Provides the following parameters: disabled, displayname, privacy Groups are us...
fc129ee732ac0d670e028354ea26b1c8ac97b7f1
hanshengzhao/python
/day_01/test.py
496
3.890625
4
#!/usr/bin/env python #-*- coding:utf-8 -*- import sys print "welcome login" import getpass name=raw_input("enter your name :") pwd=getpass.getpass("enter your pwd:") if name == 'hansz' or name == "hansz1" or name == "han": if pwd == '123': print "欢迎 %s" %(name) if name == 'hansz': print "good" elif name ==...
bce6565abce7f2b35cfc532c4f7e7322eead2778
sudhanshu150/PYTHON
/working_of_ATM_machine .PY
1,067
3.890625
4
class atm: def __init__(self,name,balance): self.name=name self.balance=balance def withdraw(self): Withdraw = float(input("Enter Withdraw amount: ")) if Withdraw > 0: forewardbalance = (self.balance - Withdraw) print("Foreward Balance :", forewar...
0e29235b3e71869eb3930431d6fb89571244132c
Manchikatlachethana/Assistant
/your_assistant.py
1,774
4.25
4
import time,datetime name=input('Enter your name:') print('Hi',name) user_ans=input('How are you today? Good or Bad:') #if its Good from user: if user_ans=='Good': time.sleep(1) print("That's happy to hear from you...") time.sleep(2) print('Now,lets start programming and learn more!') time.sleep(2) print("""Wor...
f2f2f3ac0a6ad5ef4a822ff16afb8d0a0ef204f1
ae0616/math_problems
/abcde-problem/abcde_problem/__init__.py
1,330
3.546875
4
__version__ = "0.1.0" from os import EX_SOFTWARE for e in range(10): e_str = str(e) t_str = e_str + e_str + e_str + e_str + e_str + e_str t = int(t_str) for a in range(10): if a == e: continue a_str = str(a) for b in range(10): if b == e or b == a: ...
5ca374ff1acb48827a94450b22d2d5dad9aff226
ShaqeTarverdyan/cs50
/pset6/dna/dna.py
1,249
4
4
from sys import argv from csv import DictReader, reader if len(argv) < 3: print("Please add 3 arg`s") exit() # //open dna file with open(argv[2]) as file: dnaList = reader(file) for dnaRow in dnaList: # //convert dna list to string dna = dnaRow[0] # take dna sequence # // open peopleLi...
e4d393c7f03eb89d4ebe0674bcab9a23d4c4e127
abishekganesh72/bigdata-homework-1
/BD_HW_1_2_reducer.py
1,246
3.546875
4
#!/usr/bin/env python ''' Abishek Ganesh Quest 2: Your task is to compute how many times every term occurs across titles, for each author. For example, the author Alberto Pettorossi has the following terms occur in titles with the indicated cumulative frequencies (across all his papers): program:3, transformation:2, ...
03d1ff76cdb5c4fb86f90e9878d6b42477233baa
pdsmith90/hackerrank
/practice/problem_solving/drawing_book.py
444
3.59375
4
#!/bin/python3 import os import sys # # Complete the pageCount function below. # def pageCount(n, p): if n==2 and p==1: return 0 elif n % 2 == 0 and (p + 1 == n or p+2 ==n): return 1 else: return min([p // 2, (n-p)// 2]) if __name__ == '__main__': fptr = open(os.environ['OUTPUT_PATH'], 'w') ...
706efc9e6ab7e84abfc2c04fe75c6e046e8c6cc1
SofyaTorosyan/python
/HW_wiki.py
803
3.765625
4
import wikipedia wiki_info = wikipedia.page("Yerevan") # get info about Yerevan text = wiki_info.summary.split(". ") #split string using . def word_count_in_text(text): dict = {} for str in text: s = str.replace(',', ' ') words_in_text = s.split(" ") word_count = len(wo...
6822d7c12c66431b2b0e48a48b51b7b8cc824b63
venkatakaza/HackerRank-tasks
/HackPearsoncorrelation.py
1,072
3.765625
4
import math def correlation_numerator(x,y,n): sum_xy=sum([a*b for a,b in zip(x,y)]) sumX_sumY=sum(x)*sum(y) return (n*sum_xy)-(sumX_sumY) def correlation_denominator(x,y,n): square_x=sum([a*b for a,b in zip(x,x)]) total_sum_x=sum(x)*sum(x) square_y=sum([a*b for a,b in zip(y,y)]) total_sum_y...
f0af77a7b4a6375b21dcff5e9d7dd6b30f2745d6
k-freeman/anti_bicycle_theft
/python-api/env/bikeDB/bikeDB.py
1,013
3.5
4
""" This module exposes two functions: 1) insertPosition() This function allows a basestation to insert a newly logged position of a bike 2) getIdsOfStolen() This function returns an array with the IDs of every bike that has been marked as stolen """ import pymongo from bson import objectid class BikeDB: def __ini...
b3a2fdb1573dd5aeba9805e3ce8645ac0daaf343
shravankumargulvadi/Least-Common-Multiple
/LCM.py
492
3.640625
4
# coding: utf-8 # In[5]: def gcd(p,q): if p>q: a=p b=q else: a=q b=p r=a%b if r==0: return b else: while r!=0: c=b%r b=r r=c return b def lcm (p,q): g=gcd(p,q) lcm=p*q/g return int(lcm) ...
f36bcb7206926c3853f7b7d7e2371a12c457c403
24apanda/python_useful
/date_check_if.py
601
4.0625
4
# -*- coding: utf-8 -*- """ Spyder Editor This is a temporary script file. """ #Month and date month=eval(input("Enter the month between 1 to 3 :")) day=eval(input("Enter date between 1 to 3 :" )) if month ==1: print("jan",end='') elif month==2: print("feb",end='') elif month==3: print("...
a0b1369491f427e9dd89bb03d02f2254b5ae0684
24apanda/python_useful
/list_fucn.py
1,052
3.859375
4
# -*- coding: utf-8 -*- """ Created on Sun Dec 18 17:49:49 2016 @author: apanda88 """ """ ids = ["9pti", "2plv", "1crn"] ids.append("1alm") #append an element print(ids) del ids[0] #delete an element print(ids) ids.sort() print(ids) ids.reverse() print(ids) ids.insert(1, "10pti") #insert el...
881f0bdafb3963d070592808c3e821a32ecd401c
24apanda/python_useful
/combination_loop.py
254
3.890625
4
# -*- coding: utf-8 -*- """ Created on Wed Dec 14 00:38:28 2016 @author: apanda88""" for x in 'ABC': for y in 'ABC': if y != x: for z in 'ABC': if z != x and z != y: print(x,'|',y,'|',z)
1e060ac858c4460088cd17488b0b2760b003393e
oayllon-bf/pythoncourse
/session_2/Iteration_slicing_example.py
464
3.953125
4
""" This is the header of the python file company name: pythoncourse """ def perm(string): # Compute the list of all permutations of string if len(string) <= 1: return [string] r = [] for i in range(len(string)): s = string[:i] + string[i+1:] p = perm(s) for x in p: ...
0e5a3e57eb9ae3c4c9d1565f3883c1d9d9c32af1
oayllon-bf/pythoncourse
/session_3/example_1.py
580
3.765625
4
""" This is the header of the python file company name: pythoncourse """ import sys import random ans = True while ans: question = input("Ask the seer a question: \n-> ") answers = random.randint(1, 4) if question == "": ans = False print("Game ended!") #sys.exit() elif ans...
64a51d5da67218ce3607e47151ac692cb1ce18fd
amunro7116/code-change-test
/greenBottles.py
308
3.75
4
bottles = 10 def bot(): while bottles > -1: print(bottles, " green bottles sitting on the wall\n", bottles ," green bottles, sitting on the wall\n If 1 green bottle should accidentally fall, They'll be", bottles ," green bottles sitting on the wall.") if bottles == 0: return bottles