blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
545k
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
545k
523e25ba4c88d8ab682e4124572f9e69ce642680
vinicius-gadanha/python-courses-cev
/MUNDO 1/ex002.py
147
3.5
4
nome = input('Digite o seu nome:') print('{}É um prazer em te conhecer,{}{}{}{}!'.format('\033[1;37m', '\033[m', '\033[1;35m', nome, '\033[m'))
58863a9807d5697f81738f8ba8617c49d7fe5bd8
vinicius-gadanha/python-courses-cev
/MUNDO 1/ex023.py
528
3.625
4
n = int(input('\033[1;30mDigite um número de 0 a 9999:')) u = n // 1 % 10 d = n // 10 % 10 c = n // 100 % 10 m = n // 1000 % 10 print('') print('\033[1;32m-'*25) print('\033[4;30mAnalizando o número {}'.format(n)) print('\033[1;32m-'*25) print('\033[4;30mUnidade:{:2}\nDezena:{:3}\nCentena:{:2}\nMilhar:{:3}'.fo...
ce30dc54e8109c24bbc5e555fd17888afb9fdaf9
vinicius-gadanha/python-courses-cev
/MUNDO 2/ex060b.py
301
3.609375
4
n = int(input('\033[1;30mDigite um número para calcular seu FATORIAL:')) f = 1 print('\033[1;35m-' * 60) print('{}! \033[1;30m= '.format(n), end='') for c in range(n, 0, -1): print(c, end='') print(' x ' if c > 1 else ' =', end='') f *= c print('\033[1;35m', f) print('-' * 60)
db64e615fdb827a270a04b01f4e3373f0191ccb2
vinicius-gadanha/python-courses-cev
/MUNDO 1/ex006.py
214
3.625
4
n = int(input('\033[1;36mDigite um numero:')) print('\033[0;36mO dobro é \033[1;31m{}\n\033[0;36mO triplo é \033[1;35m{}\n\033[0;36mSua raiz quadrada é ' '\033[1;33m{:.3f}.'.format(n*2, n*3, n**(1/2)))
ab0572b3a900af80e26738959f41da4229e2df58
vinicius-gadanha/python-courses-cev
/MUNDO 2/ex038.py
569
3.828125
4
print('\033[1;30mDigite dois números inteiros:') n1 = int(input('\033[1;36mPrimeiro Número:')) n2 = int(input('\033[1;36mSegundo número:')) print('') print(' \n\033[46m{}\033[m'.format(' ' * 30)) if n1 > n2: print('\033[1;30mO primeiro número é maior.') print('{} > {}'.format(n1, n2)) elif n1 < n2: ...
23c0943ec479f6c63048bd90b8e57221d85f8c23
vinicius-gadanha/python-courses-cev
/MUNDO 1/ex018.py
481
3.734375
4
import math ang = int(input('\033[1;30mDigite um ângulo:')) sen = math.sin(math.radians(ang)) cos = math.cos(math.radians(ang)) tan = math.tan(math.radians(ang)) print('\033[1;30mO seno, cosseno e a tangente do angulo {}° é:'.format(ang)) print(' ') print('\033[1;30m-' * 20) print('\033[1;36mSen{}° é {:.2f}'....
37c882d5c6e5313091767c02f84c99744c9de110
vinicius-gadanha/python-courses-cev
/MUNDO 2/ex050.py
444
3.546875
4
cont = 0 s = 0 for c in range(1, 7): num = int(input('\033[1;30mDigite o {}º valor:'.format(c))) if num % 2 == 0: s += num cont += 1 print('') if cont > 1: print('Você informo {} números pares, e as soma deles é {}.'.format(cont, s)) elif cont == 1: print('Você informo {} núme...
f0f2ecbf5ba05c38c85530a5302a87f1ecb381d9
praveenpmin/Python
/dest1.py
261
3.734375
4
# Python program to illustrate destructor class Employee: # Initializing def __init__(self): print('Employee created.') # Deleting (Calling destructor) def __del__(self): print('Destructor called, Employee deleted.') obj = Employee() del obj
85f2ba90389fb93c15f832f74166552bbbf44061
praveenpmin/Python
/list1.py
693
4.1875
4
# Let us first create a list to demonstrate slicing # lst contains all number from 1 to 10 lst = range(1, 11) print (lst) # below list has numbers from 2 to 5 lst1_5 = lst[1 : 5] print (lst1_5) # below list has numbers from 6 to 8 lst5_8 = lst[5 : 8] print (lst5_8) # below list has numbers from 2 to 10 lst1_ =...
9b9e328f6d305e27c0253299ab347b161f179dbf
praveenpmin/Python
/ML/DAT8-master/code/07_web_scraping.py
8,278
4.15625
4
''' CLASS: Web Scraping with Beautiful Soup What is web scraping? - Extracting information from websites (simulates a human copying and pasting) - Based on finding patterns in website code (usually HTML) What are best practices for web scraping? - Scraping too many pages too fast can get your IP address blocked - Pay...
595d3f99cbe522aaaf59a724de0d202dd32bbd44
praveenpmin/Python
/tuples.py
1,370
4.46875
4
# Creating non-empty tuples # One way of creation tup='Python','Techy' print(tup) # Another for doing the same tup= ('Python','Techy') print(tup) # Code for concatenating to tuples tuple1=(0,1,2,3) tuple2=('Python','Techy') # Concatenating two tuples print(tuple1+tuple2) # code fore creating nested loops tuple3=(tup...
1acd357b716e8b304581d59179941a769737576a
praveenpmin/Python
/conversion3.py
570
4.3125
4
# Python code to demonstrate Type conversion # using dict(), complex(), str() # initializing integers a = 1 b = 2 # initializing tuple tup = (('a', 1) ,('f', 2), ('g', 3)) # printing integer converting to complex number c = complex(1,2) print ("After converting integer to complex number : ",end="") print (c) #...
d9aca0f48d29458fde3174259a840b5ccf535355
praveenpmin/Python
/operatoverload1.py
212
4.4375
4
# Python program to show use of # + operator for different purposes. print(1 + 2) # concatenate two strings print("Geeks"+"For") # Product two numbers print(3 * 4) # Repeat the String print("Geeks"*4)
c4b0602b03fedeef579efbb0a9694df624cf3b7c
praveenpmin/Python
/var4.py
413
4.375
4
a = 1 # Uses global because there is no local 'a' def f(): print ('Inside f() : ', a) # Variable 'a' is redefined as a local def g(): a = 2 print ('Inside g() : ',a) # Uses global keyword to modify global 'a' def h(): global a a = 3 print ('Inside h() : ',a) # Global scope print ...
45e33e30da71b818d66df9894067b92737ae0212
praveenpmin/Python
/ML/DAT8-master/code/05_pandas_merge_nb.py
4,441
4.1875
4
# # Joining (Merging) DataFrames # Using the [MovieLens 100k data](http://grouplens.org/datasets/movielens/), let's create two DataFrames: # # - **movies**: shows information about movies, namely a unique **movie_id** and its **title** # - **ratings**: shows the **rating** that a particular **user_id** gave to a part...
c74901d9e80c204115ead86d6377750fd6ca8609
praveenpmin/Python
/listmethod2.py
521
4.71875
5
# Python code to demonstrate the working of # sort() and reverse() # initializing list lis = [2, 1, 3, 5, 3, 8] # using sort() to sort the list lis.sort() # displaying list after sorting print ("List elements after sorting are : ", end="") for i in range(0, len(lis)): print(lis[i], end=" ") print("\r")...
dafe549b4a7ed56973bdc913ada8188d6c30ff50
praveenpmin/Python
/numpy/arrfromexistdata.py
726
3.90625
4
# convert list to ndarray import numpy as np x = [1,2,3] a = np.asarray(x) print (a) # dtype is set import numpy as np x = [1,2,3] a = np.asarray(x, dtype = float) print (a) # ndarray from tuple import numpy as np x = (1,2,3) a = np.asarray(x) print (a) # ndarray from list of tuples import numpy as np...
9afbc3eaa5be74b0e9a251e732faeff46323e7d8
praveenpmin/Python
/dest3.py
214
3.984375
4
# Python program to illustrate destructor class A: def __init__(self, bb): self.b = bb class B: def __init__(self): self.a = A(self) def __del__(self): print("die") def fun(): b = B() fun()
0dac0cb701015ed737b286b087ae89f743d72fb6
praveenpmin/Python
/ML/DAT8-master/code/00_python_intermediate_workshop.py
7,613
4.28125
4
''' Python Intermediate Workshop ''' ''' LISTS ''' # creating a = [1, 2, 3, 4, 5] # create lists using brackets # slicing a[0] # returns 1 (Python is zero indexed) a[1:3] # returns [2, 3] (inclusive of first index but exclusive of second) a[-1] # returns 5 (last element) # appending a[5] = 6 ...
d30bed3acba3f3f9e28de0e9ab5f5fb85fbaffa2
praveenpmin/Python
/webscrapingfordatascience-master/python-examples/captcha-cracking/test.py
1,539
3.515625
4
import cv2 import numpy as np # Change this to one of your generated images: image_file = 'example.png' image = cv2.imread(image_file) cv2.imshow('Original image', image) # Convert to grayscale, followed by thresholding to black and white gray = cv2.cvtColor(image, cv2.COLOR_BGR2GRAY) _, thresh = cv2.threshold(gray,...
6fa1af52a4965d5b74ed3274a2b0f2e7aafe7192
praveenpmin/Python
/inherit1.py
715
4.34375
4
# Python code to demonstrate how parent constructors # are called. # parent class class Person( object ): # __init__ is known as the constructor def __init__(self, name, idnumber): self.name = name self.idnumber = idnumber def display(self): print(self.name) print(self.idnumber) #...
39c1c7d2b4ba56f246dd94b4168c48a5d4b9b6d9
praveenpmin/Python
/numbsear.py
270
3.515625
4
i = [1, 2, 3, 4, 5] j=1 # print(i[0]) print(len(i)) for y in i: print(y) if y==4: #print(i[y]) print ("found") # break else: print ("not found") # break for x in i: #if i==j: print(i) # if i==2: # break
c2f887c4e61320c71677beab7e8b81ce285cf8e8
praveenpmin/Python
/Array1.py
2,642
4.46875
4
# Python code to demonstrate the working of array import array # Initializing array with array values arr=array.array('i',[1,2,3]) # Printing original array print("The new created array is:",end="") for i in range(0,3): print(arr[i],end="") print("\r") # using append to insert value to end arr.append(4) # prin...
797a06acc18b4a3c9590c3cff9fb4f3ed698c22f
yescine/TabHotelTest
/subject1.py
179
4.09375
4
def toUpperCase(string): result = '' for char in string: if ord(char) >= 65: result += chr(ord(char) - 32) return result print(toUpperCase('abcdé--#λ'))
cefe3c2f80d8cfdbe3fdfe791c985a00355f216e
vikas0104/spoj_basics
/SERI07.py
636
3.5625
4
tc = int(input('')) l = list() s=list() primes=[] for i in range(tc): l.append(int(input(''))) def getprime(x): for a in range(2,10000): for b in range(2,a): if a%b==0: break else: primes.append(a) if len(primes)==x: return primes y = m...
0cb5e76d7998f8df5be74f49e564883e8d47de8f
LanYehou/shared_by_Lan
/python/100.py
313
3.703125
4
a = int(input('you score :')) while a < 0 and a >100 : print('error') break while a <= 100 and a >= 90 : print ('A') break while a < 90 and a >= 80 : print ('B') break while a < 80 and a >= 70 : print ('C') break while a < 70 and a >= 60 : print ('D') break while a < 60 and a >= 0: print ('E') break
6b00144868f5c61dcbc1dc8ca8b5263c7ef887ba
LanYehou/shared_by_Lan
/python/test.py
1,730
4.21875
4
def theReturn(): def funx(x): #function funx, def funy(y): #function funy is in function funx. return(x*y) #return x*y means now the function funy(y)=x*y . if you use print(funy(y)) you will get the answer of x*y . return(funy(2)) #now in funy(y) , y=2 . So funx(x) = ...
70ae2dbb7ce1644dd84927a1dc7af9d060f5ee50
Satorino01/dijkstra_maze_python
/main.py
9,079
3.765625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- def input_map(x, y): map_list = [] for j in range(y): x_list = input().split(" ") map_list.append(x_list) return map_list def wallCreation(map_list): # リスト外への探索を防ぐため、マップの周りに壁を生成するメソッド for i in range(len(map_list)): # y map_list[...
ccd1785e19f8fbc77c086eee6c3e774ef363d7ef
HosseinSheikhi/navigation2_stack
/ceiling_segmentation/ceiling_segmentation/UNET/VGG16/VGGBlk.py
2,915
4.34375
4
""" Effectively, the Layer class corresponds to what we refer to in the literature as a "layer" (as in "convolution layer" or "recurrent layer") or as a "block" (as in "ResNet block" or "Inception block"). Meanwhile, the Model class corresponds to what is referred to in the literature as a "UNET" (as in "deep learning ...
ecffbf4c0690641a823c2259f65d1d22cc632ce7
HosseinSheikhi/navigation2_stack
/ceiling_segmentation/ceiling_segmentation/DenseNet/models/layer.py
1,400
3.5
4
import tensorflow as tf from tensorflow.keras import layers class Layer(tf.keras.layers.Layer): def __init__(self, growth_rate: int, mode: str, name: str) -> None: """ The "layer" building block as is defined in the paper. "layer"s will be used for building dense blocks Arguments:...
41487b87795850cb807db9b4b8611924645fe546
DanielWimpress/Project-Euler---Python
/Problem3.py
443
3.78125
4
#Problem 3 #The prime factors of 13195 are 5, 7, 13 and 29. #What is the largest prime factor of the number 600851475143 ? def problem_3(): num = 9 print (prime_check(num)) def prime_check(num): if num < 2: return False if num == 2: return True else: for i in range(2, num)...
2cb51ea1acc4548996ca72448e944cae8e4aa23a
wendychau/python-challenge
/PyBank/main.py
2,166
3.875
4
import os import csv csvpath = os.path.join('.', 'Resources', 'budget_data.csv') # list to track different months on record months = [] # list of profits or losses from month to month profit_loss = [] # list to track changes monthly_change = [] with open(csvpath, 'r') as csvfile: csvreader = csv.reader(csvfile, d...
8e6982bc512f11aa56039c9fe8364fe1f9841b27
ChuanleiGuo/Machine_Learning
/Deep_Learning/pytorch/60_minute_blitz/tensor_tutorial.py
665
3.84375
4
'''This is the pytorch's learning tutorial''' import torch import numpy as np # construct a 5 * 3 matrix, uninitialized x = torch.Tensor(5, 3) print(x) # construct a randomly initialized matrix x = torch.rand(5, 3) print(x) print(x.size()) # Operations y = torch.rand(5, 3) print(x + y) print(torch.add(x, y)) resul...
da3a66bfcd0abf09460b271250091c659e82f619
prasantakumarsethi/python
/Python Probs/List_Mutability.py
436
4.125
4
#to show list and Dictionary are mutable or not # list Fruits = ["Apple","Banana","Mango","Strawberry","Watermelon"] print(id(Fruits)) print(Fruits) Vegetables = Fruits Vegetables[1]='Orange' print(id(Vegetables)) print(Vegetables) #dictonary Fruits = {1:"Apple",2:"Banana",3:"Mango",4:"Strawberry",5:"Watermelon"} p...
1c997c22556219a1f50260653ec305f09dbf03d7
Pter18/plandebecarios
/GeneradorPassword.py
792
3.84375
4
#!/usr/bin/python # -*- coding: utf-8 -*- #UNAM-CERT ''' Programa que genera contraseñas seguras ''' import sys import string import random def DefaultRandomPassword(passwordCharacters, minLetters, maxLetters,x): passwd = "".join(random.choice(passwordCharacters) for i in range(random.randint(minLetters, maxLette...
179a2434a5f74bc68dc20538808418e7de18da2c
KiteQzioom/Module-4.2
/Module 4.2.py
372
4.1875
4
def isPalindrome(word): length = len(word) inv_word = word[::-1] if word == inv_word: answer = True else: answer = False print(answer) """ The function isPalindrome takes an input of a string and checks if it is a palindrome. It outputs the answer in boolean as True or False...
1f2ebc6f30d3c439ca346fc766cb69f4ef7288e0
Sanster/document-scanner
/helper.py
7,829
3.546875
4
import math import cv2 import numpy as np from scipy.spatial import distance as dist # https://www.pyimagesearch.com/2016/03/21/ordering-coordinates-clockwise-with-python-and-opencv/ from scanner import DEBUG def clockwise_points(pnts): """ sort clockwise :param pnts: numpy array [[x1,y1],[x2,y2],[x3,y3...
f29f7d81ef8a0632daddcd32ecdd59ab52ee560b
jackieallam/day86_breakout_game
/main.py
1,676
3.609375
4
from turtle import Screen from paddle import Paddle from ball import Ball from brick_manager import BrickManager from scoreboard import Scoreboard import time screen = Screen() screen.bgcolor("black") screen.setup(width=800, height=800) screen.title("Breakout") screen.tracer(0) bricks = BrickManager() paddle = Paddle...
e4848db8126a011867ead9df965044cdbac2fc64
sekuoia/PracticePython.org
/list_less_than_ten.py
334
4.0625
4
new_list = [] a = [1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89] # for num in a: # if num < 5: # new_list.append(num) # print(new_list) # new_list = [num for num in a if num < 5] # print(new_list) user_num = int(input("Please enter a number: ")) for num in a: if num < user_num: new_list.append(num) p...
3cf688f4c06041356a2fceca53c77fe9d968650a
megha-05/firstprjct
/stringlength.py
87
3.859375
4
str1=input("enter a string") length=len(str1) dict1={} dict1[str1]=length print(dict1)
4f2188f683bd9c7c934cac5f29db20d7de19133e
amanaam/15112-Final-Project-Chess
/Chess.py
27,984
3.8125
4
''' 15-112: Principles of Programming and Computer Science Project: Chess Name : Abdul Manaam AndrewID : amanaam ''' ############################## Helper Functions ############################## def printBoard(b): print ' |a b c d e f g h|' print ' -----------------' print '8 |'+...
87503d419d0f97755b43bc6558440ca2114b2547
apxhd/assignment_II
/Assignment_Aabiskar/Deleting_from_list.py
376
3.84375
4
list_random = [] n= int(input("Enter the number of elements in the list")) if n > 7 : for i in range(n): new_element = input("Enter a element for the list :") list_random.append(new_element) print(f"The list is {list_random}") print(len(list_random)) del list_random[0] del list_random[4] del list_r...
b873604f10de07769ed99882b0a75d91b29dd819
ivarhaugerud/master
/rough_channel/plot/main_channel_Re0.py
7,063
3.578125
4
import os import numpy as np import matplotlib.pyplot as plt def lighten_color(color, amount=0.5): """ Lightens the given color by multiplying (1-luminosity) by the given amount. Input can be matplotlib color string, hex string, or RGB tuple. Examples: >> lighten_color('g', 0.3) >> lighten_c...
5f23cc82b99c2f18fec7e60e0625a32be423a458
evilusean/FreeCodeCampPythonBeginners
/TryExceptBlock.py
362
3.78125
4
try: number=int(input("Enter a number")) print(number) except ZeroDivisionError as err: print(err) except ValueError: print("Invalid Input") #creates a new error message for all errors can specify with 'except ZeroDivisionError:' 'ValueError:' ,etc # best practice is to except specific errors #...
194763b9a88b77746c05beef66aeed772c53944c
evilusean/FreeCodeCampPythonBeginners
/2DList.py
284
3.8125
4
number_grid = [ [1,2,3], [4,5,6], [7,8,9], [0] ] #print(number_grid[0][2]) # lists within lists [0]=row [2]= grid [0][2] =3 for row in number_grid: for col in row: print(col) #print(row) prints rows [1,2,3], etc. # print column individual
2b44763b19991eaa9ff3c8b6083dbf5a514f72ac
evilusean/FreeCodeCampPythonBeginners
/SecretWordGame.py
288
3.859375
4
secret_word = "sean" Guess = "" guesscount= 0 guesslimit= 3 outofguess = False while Guess != secret_word and not(outofguess): if guesscount < guesslimit: Guess = input("Enter guess: ") guesscount += 1 else: outofguess = True print("You win!")
b3de21a387447243dac575fb967d07b5d34b6679
siying1031/Econ406
/hw3/exercise.py
2,731
4
4
''' Siying homework3 ''' import timeit import functools import numpy as np #1 def generate_s_matrix(size_of_matrix): '''Generates an NxN matrix where all edges are 1 and all inner values are 0. Parameters ---------- size_of_matrix : int The size of the matrix. Returns ------- s_ma...
42218bfabb4d37304b7fa25e958368c26efea75f
woosukman2/myproject
/homework3/104.py
185
3.703125
4
# num = int(input()) # num_add = num+20 # # if num_add > 255: # num_add = 255 # # # print(num_add) # num = int(input("입력하실 숫자: ")) print("출력값:",min(num+20,255))
914c64272ef4e56be777df07db7ace7768cf30fc
AsemAntar/codewars_problems
/add_binary/add_binary.py
899
4.28125
4
def add_binary(a, b): sum = a + b return bin(sum)[2:] ''' ==================================================================================================== - writing the same function without the builtin bin method. - Here we will follow a brute force approach. - we follow the following method: --> divide ...
dd41527eebb329e606afa1c55db40f304c5124f1
AsemAntar/codewars_problems
/create_phone_number/phone_number.py
1,033
4.25
4
# Author: Asem Antar Abdesamee # Problem Description: """ Write a function that accepts an array of 10 integers (between 0 and 9), that returns a string of those numbers in the form of a phone number. Example: create_phone_number([1, 2, 3, 4, 5, 6, 7, 8, 9, 0]) --> (123) 456-7890 """ ''' ============================...
cd5ed7b76187ad57f328fe19abf9b57698445bfe
arwazkhan189/NPTEL---Programming-Data-Structures-And-Algorithms-Using-Python
/Week 1/#4 greatest common factor backward scan.py
266
3.8125
4
def gcd(m,n): for i in range(min(m,n),0,-1): if (m%i)==0 and (n%i)==0 : mrcf=i break return(mrcf) m=int(input('Enter m =>')) n=int(input('Enter m =>')) print(f'The greatest common divisor of {m} and {n} is {gcd(m,n)}')
b83391fd09571389e3c67fe769e9c7cd852be8dd
matias-real/Nivelacion
/19082019/001252.py
1,124
3.5
4
# -*- coding: utf-8 -*- """ Created on Mon Aug 19 21:07:35 2019 @author: USUARIO """ e = 18 # Con un signo igual estoy diciendo que la variable de la izquierda tiene el valor de la derecha f = 5 # Con un signo igual estoy diciendo que la variable de la izquierda tiene el valor de la derecha if e < f: # Com...
6b5cdf750c8494b77a7abcd7d56f0af4f4f23bd7
PrayagDesai1/Essential-Data-Structures-and-Algorithms-in-Python-for-Software-Developer-coding-interview-
/Linked Lists/implementation_and_insertion_at_beggining.py
923
3.890625
4
""" LinkedList implementation and Insert node at beggining of Linked List """ class Node(object): def __init__(self, data): self.data = data self.next_node = None class LinkedList(object): def __init__(self): self.head = None def insert_at_beggining(self, data): if s...
fcf0c88890d578097c3ca0ecc943ae5416786e75
PrayagDesai1/Essential-Data-Structures-and-Algorithms-in-Python-for-Software-Developer-coding-interview-
/Array/delete_item_at_given_position.py
806
3.875
4
""" delete(index) - delete item at index, shifting all trailing elements left """ class Array(object): def __init__(self): self.array = list() def insert_at_end(self, data): self.array.append(data) def display(self): if self.array is None: print('Array i...
e199f17d58cb5333de0ee06c197899d94fdafa47
Kailashw/HackerRank_Python
/Day 25.py
339
4.1875
4
import math def is_prime(n): if n == 2: return 'Prime' if n % 2 == 0 or n < 2: return 'Not prime' for j in range(3, int(math.sqrt(n)) + 1): if n % j == 0: return 'Not prime' return 'Prime' n = int(input()) for i in range(n): number = int(input()) print(is_pr...
197ac9fbc523b77aedac5f9bfc867fad8ebd57b1
ikonushok/My_studying_Python_developer
/lesson_5/ultrapro/number.py
659
3.515625
4
def number(): a = print("Загадайте число от 0 до 100") start = 0 end = 100 for i in range(start, end + 1): if (end - start) > 2: m = (start + end) // 2 print('Ваше число больше', m, ' ?') s = input('да или нет:') if s == 'да': start...
e048fbdc4ef3da5d4bcbdceb96a13e6ae8b50060
ikonushok/My_studying_Python_developer
/lesson_5/HW_5_pro.py
591
3.84375
4
from divisor_master import dividers_num num = int(input('Введите число: ')) def list_simple_dividers(num): prime_list = dividers_num(num)[1:] print(prime_list) result = [] for i in prime_list: while num % i == 0: result.append(i) num //= i if num == 1: ...
838b11c3e333becb37fd59b7a1c8ec5b7c84a86c
ikonushok/My_studying_Python_developer
/lesson_4/HW_4_UltraPro_account.py
1,932
4
4
# Menu def menu(num): """ :param num: :return: """ print(f'Доступная сумма: {num} руб.', end='\n\n') print('1. Пополнить счет') print('2. Совершить покупку') print('3. История покупок') print('4. Выход') ans = input('Введите номер пункта: ') return ans # Покупка def add(num,...
7b4224f573eee957b63ce31b515d6b4d6ee0f1b8
MisterBalboa/nashbox
/lib/test_helpers.py
411
3.609375
4
def is_same_combination(list_1, list_2): if len(list_1) != len(list_2): raise Exception('lists are not the same length') list_of_lists = [ isinstance(e, list) for e in list_1 \ and isinstance(e, list) for e in list_2 ] for item_1 in list_1: all_in = False for item_2 in list_2: if i...
588bff1418ba77840c17efa6c3292e049f08f259
juancjuanc/Praktikum
/exception.py
324
3.96875
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- while True: try: x = float(input("Please enter a number: ")) y = 14 / x print(y) except ZeroDivisionError: print("Oops! That was no valid number. Try again...") except Exception: print("Oops! That was no number. Try again.....
ff9b85903cb04a1c2c5e7ba54aa911abf127ac37
elikrm/SheCodesPlus_Python
/BooleanIfStatementsExercises.py
1,020
4.03125
4
# moths_in_house = True moths_in_house = False if(moths_in_house): print("Get the moths!") else: print("No threats detected.") ############# Q2 ##################### moths_in_house = True mitch_is_home = True if(moths_in_house and mitch_is_home): print("Hoooman! Help me get the moths!") # moths_in_house = F...
4210ea8481f70980b51e3fcf870cf8b778e75320
Kama-Solutions/sc-projects
/Coding Projects/boggle_game_solver/boggle.py
3,827
3.953125
4
""" File: boggle.py Name: Ilona ---------------------------------------- TODO: This program asks for 4 rows * 4 characters of the alphabet to set up a boggle game, and the program will tell how many words there are in total. """ import time # This is the file name of the dictionary txt file # we will be checking if ...
60e01ca6e310db41b6c5597383d8d4a34f7fef8f
Piotr-Iwanicki/MilestoneProject_MoviesStorage
/movie_storage_app.py
4,762
3.921875
4
from movies_storage import m_storage def search_submenu(): print("_"*48, "\n") print("MOVIE`S SEARCHING - SUBMENU :") print(''' 1 - search by movie title 2 - search by director 3 - search by year of premiere 0 - back to main menu ''') def submenu_search_title(): title = input("En...
f35f8edb1b5c1be45c7d32122687e1210c4a75cb
RashiSafaya/Project1_av
/add_friend.py
948
3.984375
4
# import statements. from globals import friends, spy from spydetails import spy # add new friends. def add_friend(): new_friend = spy() print "Enter your friend's details \n" new_friend.name = raw_input("Enter the name of your friend: ") new_friend.salutation = raw_input("Are they Mr. or Ms.? ") ...
cd4be0c52023401a6f44a4fc68f375406fcb0ed2
bhandarysushruth/GameAI
/Assignment6/GOAP/GOAP.py
12,365
3.765625
4
import pygame #---------- GLOBAL VARIABLES STEP_SIZE = 50 WINDOW_WIDTH = 1110 WINDOW_HEIGHT = 600 BLACK = (0, 0, 0) WHITE = (255, 255, 255) WINDOW_SIZE = [WINDOW_WIDTH, WINDOW_HEIGHT] POTS_WALL = "potswall.png" POTS_EXTENSION = "potsextension.png" KNIFE_WALL = "knifewall.png" EXTINGUISHER_WALL = "extinguis...
03df8042eefa6a1a13a4fd5bcab998dbbded46b8
l-damyanov/Python-OOP---February-2021
/10-Testing-Lab/car_manager.py
6,433
3.75
4
import unittest class CarTests(unittest.TestCase): make = 'make' model = 'model' fuel_consumption = 10 fuel_capacity = 100 def test_car_make_setter__when_None__expect_exception(self): car = Car(self.make, self.model, self.fuel_consumption, self.fuel_capacity) with self.assertRaise...
e81f7ce3eceae277b8fe0b08fda7380f5fcd6b3d
DaveAwoke/Module_1_ProblemSet
/Problem1_3.py
248
3.921875
4
# -*- coding: utf-8 -*- """ Created on Thu Jul 8 10:16:54 2021 @author: dave """ def problem1_3(n): mysum = 0 for number in range(n+1): mysum = mysum + number print (mysum)
0bbda603b8387a5c3602e3456ef0aaf824bb582c
sumara523/cs591_c2_assignment_6
/Problem4/TestFunctions.py
1,000
3.59375
4
import unittest import Problem4 class TestStringMethods(unittest.TestCase): def test1(self): input = 17 expected = 10 actual = Problem4.NumOnes(input) self.assertEqual(expected, actual) def test2(self): input = 8 expected = 1 actual = Problem4.NumOnes(i...
8410405925c511d46665d3552ff4ae4dffa2b8d5
chrispois0n/FibonaccyPython
/fibo1.py
168
4.09375
4
def fibonacci(n): if n==1: return 1 elif n ==2: return 1 elif n > 2: return fibonacci(+1)+ fibonacci(n+2) for n in range (1,20): print(n, ":", fibonacci(n))
5793224853a86313375b8bff5519364b325e65a0
peanutbutterandcrackers/ekaterina
/ekaterina/classes.py
8,270
3.5
4
""" Custom classes to approximate GNUCash objects. Ekaterina takes inputs from non-standard ways (CSV files for now), parses them into an approximation of GNUCash objects (these things here) and writes them to a given .gnucash file. Since ekaterina is taking in transactions written in a certain form, and adding it to...
2bfe8cc66726225d167acc7d14e743fc1fc4da87
tianjinqiujie/algorithm_dp
/chapter03/pyramid_dp.py
256
3.515625
4
#-*- coding:utf-8 -*- pyramid = [ [13], [11,8], [12,7,26], [6,14,15,8], [12,17,13,24,11] ] for j in range(len(pyramid)-1,0,-1): for i in range(j): pyramid[j-1][i] += max(pyramid[j][i],pyramid[j][i+1]) print(pyramid[0][0])
b262730cc3cccdcf43cdfe59aa8ef07b04e126c0
lumpop1/CP1404PRAC
/prac_01/Modify bill estimator.py
633
4.03125
4
TARIFF_11 = 0.244618 TARIFF_31 = 0.136928 chose_Tariff=input('Which tariff?11 or 31?') daily_kWh=float(input('enter daily kWh')) num_Days=float(input('enter number of billing days')) while chose_Tariff != '11' and chose_Tariff != '31': print('error') chose_Tariff = input('Which tariff?11 or 31?') else: ...
0818f6a565f02a534af28494304b21ee396bba13
lumpop1/CP1404PRAC
/prac_02/Files.py
122
3.703125
4
out_file=open('name.txt','w') userName=input('Please enter your name') print(userName,file=out_file) out_file.close()
a0beb7f28b3769f4141b858a1f9f08820f905599
pbednarski/programowanie-obiektowe-1
/lab2_09.py
199
3.875
4
fileToOpen = open("file.txt") textFile = fileToOpen.read() wordsSplit = textFile.split() print('Word count in text file', len(wordsSplit))
424f755e91aaf82b0be9dcb1890581603a4956b2
rrutz/Learning
/Machine Learning(python)/Unsupervised Learning/Association Rules.py
13,993
3.640625
4
# The Apriori Algorithm import pandas as pd import numpy as np from itertools import combinations import matplotlib.pyplot as plt def getDate(): marketingData = pd.read_csv("C:\\Users\\Ruedi\\OneDrive\\Learning\\Learning\\Machine Learning(python)\\Unsupervised Learning\\Marketing.csv" ) marketingData =marketi...
07f5da1e5aaaf3170b484c1917973adabfa9b023
adinath10/Nimap
/p2.py
509
3.765625
4
n = int(input()) value = input()[:n] sp,d,ucase,lcase = 0,0,0,0 for i in range(len(value)): if (ord(string[i]) >= 97 and ord(string[i]) <= 122): lcase += 1 # For upper letters elif (ord(string[i]) >= 65 and ord(string[i]) <= 90): ucase += 1 elif(i.isdigit()):...
b556ded22fa9b378b0352bde27a02cf8ba3d5187
ege-erdogan/comp125-jam-session-01
/11_10/problem_07.py
495
4.15625
4
''' COMP 125 - Programming Jam Session #1 November 9-10-11, 2020 -- Problem 7 -- Given a positive integer n, assign True to is_prime if n has no factors other than 1 and itself. (Remember, m is a factor of n if m divides n evenly.) ''' import math n = 6 is_prime = True if n != 2 and n % 2 == 0: is_prime = False ...
8dc831b049dd861d1cf468b8a971833b6d1659fa
ege-erdogan/comp125-jam-session-01
/solutions/problem_07.py
761
4.21875
4
''' COMP 125 - Programming Jam Session #1 November 9-10-11, 2020 -- Problem 7 -- Given a positive integer n, assign True to is_prime if n has no factors other than 1 and itself. (Remember, m is a factor of n if m divides n evenly.) ''' import math n = 5 is_prime = True # There is a whole literature of primality test...
1f1261bf701a84e85bc5530441ad907955265865
xiajingg/First
/model/demo.py
1,094
3.640625
4
# from model.PowerFunction import power # from model.Factorial import fact # # print("hello") print(100 + 3) # # # # name=input("请输入:") # # print("The name is :",name) # # def abs(num): # if num >= 0: # return num # else: # return ("|a|=", -num) # # # # 转义字符 # # print(r'''我是"shazi"''') # # sum ...
19286597b25416ac2728f0896e7cf0a8b36bdc6a
amanbhal/ImportantQuestions
/ThreeSum.py
1,657
3.890625
4
""" Given an array S of n integers, are there elements a, b, c in S such that a + b + c = 0? Find all unique triplets in the array which gives the sum of zero. Note: Elements in a triplet (a,b,c) must be in non-descending order. (ie, a <= b <= c) The solution set must not contain duplicate triplets. For example,...
1cb1efd306622329b3895df8777b7f5feffb8d61
amanbhal/ImportantQuestions
/InsertionSort.py
319
4.1875
4
""" Implement Insertion Sort on an array. """ def insertionSort(arr): for i in range(1,len(arr)): j = i while(j>0 and arr[j]<arr[j-1]): print i,j, arr[j], arr[j-1] = arr[j-1], arr[j] j -= 1 print arr return arr print insertionSort([6,5,4,3,2,1])
7533159a29677af158f3a9c58a7ea1adcdcf1d87
amanbhal/ImportantQuestions
/BulbSwitcher.py
1,609
4.03125
4
""" There are n bulbs that are initially off. You first turn on all the bulbs. Then, you turn off every second bulb. On the third round, you toggle every third bulb (turning on if it's off or turning off if it's on). For the nth round, you only toggle the last bulb. Find how many bulbs are on after n rounds. Example: ...
d3d54a6b06754720e9675160419df70b62c05668
amanbhal/ImportantQuestions
/LCAofBT.py
2,013
4.09375
4
""" Given a binary tree, find the lowest common ancestor LCA of two given nodes in the tree. According to the definition of LCA on wikipedia: The lowest common ancestor is defined between two nodes v and w as the lowest node in T that has both v and w as descendants (where we allow a node to be a descendant of itself)...
0a82659e29024ceee3fc52b1938f299c1261820f
amanbhal/ImportantQuestions
/LRUcache.py
3,522
3.984375
4
""" Design and implement a data structure for Least Recently Used (LRU) cache. It should support the following operations: get and set. get(key) - Get the value (will always be positive) of the key if the key exists in the cache, otherwise return -1. set(key, value) - Set or insert the value if the key is not already ...
28c5888177e589aa8ce468696186c11888b906fd
amanbhal/ImportantQuestions
/CoinChange.py
1,636
3.890625
4
""" You are given coins of different denominations and a total amount of money amount. Write a function to compute the fewest number of coins that you need to make up that amount. If that amount of money cannot be made up by any combination of the coins, return -1. Example 1: coins = [1, 2, 5], amount = 11 return 3 (1...
ccbcb39ccc949c3f665497c7fc1e0df4eb3396b8
amanbhal/ImportantQuestions
/EncodeDecodeStrings.py
1,701
3.953125
4
""" String encoding-decoding question. Given a digit sequence, return no. of ways it can be decoded. Mapping : A->1, B->2, Z->26 For ex : Given a string "123", based on the mapping it can be decoded to following ways :- (1) 1,2,3 -> A,B,C (2) 12,3 -> L,C (3) 1,23 -> A,W """ #=> Using Dynamic Programming # every ...
8b4b44fc0ff1297d2dfb870ef60d74fdf1e06322
MagnoDavor/Inteligencia-Artificial-2019
/python_basics/python_basics/helloWorld.py
279
3.65625
4
# Comment: This is a fairly simple Python script print('Hello, World!') #& E:/ANACONDA/python.exe -m pip install -U pylin #a = 300 #b = 600 #if a is b: # print('a es b') #else: # print('a no es b') #for i in range (10): # print(i) for i in range(5, 20, 3): print(i)
bea5cd560ac201b60929f926ab9c957e9145503f
toonarmycaptain/aoc2019
/dec_8th/dec_8th_solution_part_1.py
1,141
3.546875
4
"""Advent of Code solution December 8th part 1""" from pathlib import Path from typing import List def parse_puzzle_input(puzzle: str=None, layer_line_length: int = 25, layer_num_lines: int = 6) -> List[List[str]]: problem_folder = Path(__file__).parent if not puzzle: with open(Path(problem_folder, '...
4f50532eb86f02ea3bd84d438471c07e61042db0
taftsanders/PlayLand
/Python/tutorial.py
2,157
3.8125
4
import datetime import requests import json date = datetime.datetime.now() REPEAT = "Would you like to do anything else?" print("What is your name") name = input() print("\nHello " + name + ", welcome to PyMenu") print("Please make your selection from the menu below") def menu(): print(""" 1. Print today's ...
b7f6dfb5b8cff9d58efcdfa21259ff7a35f6231c
OyvindSabo/Ardoq-Coding-Test
/1/HighestProduct.py
2,834
4.40625
4
#Given a list of integers, this method returns the highest product between 3 of those numbers. #If the list has fewer than three integers, the method returns the product of all of the elements in the list. def highestProduct(intList): negativeList = [] positiveList = [] for integer in sorted(intList): if i...
eb85fed448859e906df0baceda09beee9ce16d15
HaNuNa42/pythonDersleri-Izerakademi
/python kamp notları/while.py
344
4.15625
4
# while number = 0 while number < 6: print(number) number += 1 if number == 5: break if number == 3: continue print("hello world") print("************************") for number in range(0,6): if number == 5: break if number == 3: continue ...
0d6bccfe02710b7ab58c4b74eef8dfcae35bba30
HaNuNa42/pythonDersleri-Izerakademi
/python kamp notları/samples/q3.py
206
4.0625
4
limit = int(input("enter number:")) for number in range(1, limit): if number % 2 ==0: print("even number: {0} ".format(number)) else: print("odd number: {0}".format(number))
95bc7e2ca5482232a1225a7c77d5f3bfc449593d
sungis/test-code
/service_examples/radix_tree.py
11,633
3.875
4
from collections import deque class RadixTree: def __init__(self): """ Create a Radix Tree with only the default node root. """ self.root = RadixTreeNode() self.root.key = "" self.size = 0 def insert(self, key, value, node=None): """ ...
d3d5fcec6cd2acd8258233775a145da3f90ce07c
oshkola/python-lecture-notes
/Summary_of_ex_1_21_functions_and_files.py
1,880
3.921875
4
def write_into_file(filename, in_data): file = open(filename, 'a') # 'a' - append file.write(in_data) file.close() def print_all(filename): file = open(filename, 'r') print file.read(), "\n" def print_line_from_file(line_count, filename): file = open(filename, 'r') lines = file.readlines() return lines[line_...
d969af48dce8db2b8a023ee98220c9d4455444a3
IsyankarCoder/PythonEfforts
/tuple-dictionary-küme/tuple.py
1,213
3.59375
4
tuple2= ("Ankara","Samsun","Corum",98,54.0,12) print(tuple2[0]) print(tuple2[4]) a,b,c,d,e,f = tuple2 print(a,b,c,d,e,f) print(d) #kume listitem = [1,2,3,3,4] my_set = set(listitem) print(type(my_set)) set2= {15,35,55} print(type(set2)) alisveris = {'ekmek','sut','yumurta','peynir','yag','yogurt'} alisveris.add('...
fc7f56a0fdb57d4d03f3cbf26ebdbc21af15385d
murtazashabbir53/HakerRank
/Python/DefaultDict.py
759
3.734375
4
from collections import defaultdict n , m =map(int , input().split(' ')) N = list() for i in range(n): N.append(input()) M=list() for i in range(m): M.append(input()) #calculating Output d = defaultdict(list) # Function to return a default values for keys that is not present ...
a01d518ebf69b684987a43d8c0cd24991d864ad9
PzcMist/python-exercise
/ex3.py
1,167
4.65625
5
print("I will now count my chickens:") #在屏幕上打印出I will now count my chickens: print("Hens", 25 + 30 / 6) #在屏幕上打印Hens,同时计算(先除在家,/表示全部除尽)打印 print("Roosters", 100 - 25 * 3 % 4) #打印Roosters,同时计算(先*在 % 最后计算-) print("Now I will count the eggs:") #在屏幕上打印Now I will count the eggs: print(3 + 2 + 1 - 5 + 4 % 2 - 1 / 4 +...
cb11e5ec028a0a5417b9413b6c42379221cac6b2
sophiadavis/algorithms-practice
/quicksort.py
4,181
3.796875
4
import random def quick_sort(int_array): if len(int_array) == 0: return [] if len(int_array) == 1: return int_array else: partitioned, pivot_index = partition(int_array) return quick_sort(partitioned[:pivot_index]) + [int_array[pivot_index]] + quick_sort(partitioned[(pivot_i...
533738d8bcc6e20bebc87bc2f633b9d9293b442b
okkomakkonen/side-channel-attack
/python-demo/check.py
729
3.71875
4
from string import ascii_letters, digits from random import choices, randint characters = ascii_letters + digits CORRECT_PASSWORD = "".join(choices(characters, k=randint(10, 15))) LENGTH = len(CORRECT_PASSWORD) assert all(c in characters for c in CORRECT_PASSWORD) def check_password_vulnerable(password: str) -> bo...
a2188b3d9f9dfa4f9dcd90d5bdcdc34b96634a48
Biwoco-Playground/Learn-Docker_VNL
/Session3/exercise2.py
182
3.71875
4
def pri_all_char(): x = True k = ord('A') while x == True : if k == ord('Z'): x = False print(chr(k)) k += 1 pri_all_char()