blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
0edcfa5c925d6cff46f7eb48f44a882de410d452
lawellwilhelm-dev/money
/m02_03_charges_list_for_loop.py
356
3.53125
4
balance = 1000.0 name = 'Nelson Olumide' account_no = '01123581231' print('Name:', name, ' account:', account_no, ' original balance:', '$' + str(balance)) charges = [5.99, 12.45, 28.05] for charge in charges: balance = balance - charge print('Name:', name, ' account:', account_no, ' charge:', charge, ...
4ce5c10eaf4a27ff54a1b12c87110659daf3f04a
aubreystevens/image_processing_pipeline
/text_files/Test.py
1,033
4.15625
4
#B.1 def complement(sequence): """This function returns the complement of a DNA sequence. The argument, 'sequence' represents a DNA sequence.""" for base in 'sequence': if 'A' in 'sequence': return 'T' elif 'G' in 'sequence': ...
7e00a5253bc7c9ffedf9bd34f27b158577150aa2
fwang2/ML
/src/ex-layer-3.py
1,732
3.578125
4
import numpy as np np.random.seed(1) def relu(x): ''' this function sets all negative number to 0 ''' return (x > 0) * x def relu2deriv(x): ''' Return 1 for x > 0; return 0 otherwise ''' return x > 0 alpha = 0.2 hidden_size = 4 streetlights = np.array([[1, 0, 1], [0, 1, 1], [0, 0, 1], [1, 1, 1]]) ...
fd35a5def2bc3ff4fa178c6d3033770b1b144b39
fwang2/ML
/src/linear-regression2.py
1,412
3.890625
4
# linear regression gradient descent # datasets/ex1data1.txt # # Best cost: 4.47697137598 after 10000 iterations # Weights: [[-3.89578082] [1.19303364]] # from .gradient import * # ex1data1.txt # column 1: population of a city # column 2: profit of a food truck in that city data = np.loadtxt("../datasets/ex1data2.t...
d7b7b93e17a9ff03b1741598b701ff612857999e
damianKokot/Python
/Lista1/Zad3.py
202
3.65625
4
def filterRepeat(table): output = [] for item in table: if item not in output: output.append(item) return output table = [1,1,2,2,2,3,3,5,5,5,4,4,4,0] print(filterRepeat(table))
df9de1ede3c960dc2b9f472c9fd07d41be3c5fe1
Hemie143/Tic-Tac-Toe
/Problems/Vowels/task.py
96
3.890625
4
vowels = 'aeiou' # create your list here text = input() print([c for c in text if c in vowels])
6925adb236ce9626b85d34055e66aa36bdc40fe7
ValeWasTaken/Project_Euler
/Python_Solutions/Project_Euler_Problem_025.py
293
3.734375
4
def main(): x,y,z = 0,1,0 counter = 1 while len(str(z)) != 1000: z = x + y x = y y = z counter += 1 print("The " + str(counter) + "nd number in the Fibonacci sequence produces the first 1000 digit number.") # Expected output: 4782 main()
60fc8f1ad6540bcfa3e2e0fe3e45ceebd39e542b
tvvoty/PythonLearning
/Recursive_sum.py
1,007
3.8125
4
arr1 = [2, 4, 6] def rec_sum(arr): total = 0 print(arr) if len(arr) == 0: print(total) return 0 else: total = arr1.pop(0) + rec_sum(arr1) def fact(x): if x == 1: return 1 else: return x * fact(x - 1) def sum(numlist): lists_sum = numlist[0] + num...
3c7592aba43830ae963bc5dec0549c5bf5e7bcb3
tvvoty/PythonLearning
/Euler 6.py
367
3.53125
4
def sumofsq(): total1 = 0 for x in range(1, 101): total1 = total1 + x**2 return total1 print(sumofsq()) def sqrofsum(): total2 = 0 for x in range(1, 101): total2 = total2 + x sqrsum1 = total2**2 return sqrsum1 print(sqrofsum()) def sumoftwo(): notsum = sqrofsum() - su...
2e6aa5c1725bf0578901a0d7ca2106c429445056
maneeshapaladugu/Learning-Python
/Basic Concepts/usr_def_function_example.py
1,616
3.921875
4
def hello(): print('Hello !') print('Hello !!!') print('Hello World !!!!!') hello() hello() hello() hello() #****************************************** def hello(name): print('Hello ' + name) hello('Maneesha') hello('Manoj') #********************************************** pri...
f081583af062ff602cac5b23ecdc6e8e4e6f273a
maneeshapaladugu/Learning-Python
/Basic Concepts/Character_Count.py
2,247
4.03125
4
message = 'It was a bright cold day in April, and the clocks were striking thirteen.' count = {} #This dictionary will store the character key and its count. Ex: r:5 for character in message: #here, lower case and upper case counts are seperate count.setdefault(character, 0) #if character doesn't exists ...
8c30efc6efcc16854f6f87a28e7b5b747a267bd3
maneeshapaladugu/Learning-Python
/Basic Concepts/Sample_Program.py
1,212
4.09375
4
#Sample program - This program says hello and prompts for name and age #str(int(age)+1) #age evaluates to '25' #str(int('25')+1) #int('25') evaluates to integer 25 #str(25+1) #str(26) #str(26) evaluates to string '26' #'26' print('Hello! This is Robot') print('What is your name?') myn...
33d73944bf28351346ac72cbee3f910bcf922911
maneeshapaladugu/Learning-Python
/Practice/Armstrong_Number.py
763
4.46875
4
#Python program to check if a number is Armstrong or not #If the given number is 153, and 1^3 + 5 ^ 3 + 3 ^ 3 == 153, then 153 is an Armstrong number def countDigits(num): result = 0 while num > 0: result += 1 num //= 10 print(result) return result def isArmstrong(...
52291cd8dd0ec26b3b4d263a4578a7925821b4d4
hscottharrison/udemy-python
/variables_methods.py
282
3.90625
4
a = 5 b = 10 my_variable = 56 string_variable = "hello" # print(my_variable) ## def my_print_method(par1, par2): print(par1) print(par2) # my_print_method("hello", "world") def my_multiply_method(one, two): return one * two result = my_multiply_method(5, 3) print(result)
35f2bffe77e3ff8a66fa6452cd94793899565879
thoamsxu/Python
/2-22.py
1,078
3.875
4
def capitals(word): return [ index for index in range(len(word)) if word[index] == word[index].upper() ] print("====== CodEWaRs ======") print(capitals("CodEWaRs")) def digital_root(inputNumber): print("====== digital root " + str(inputNumber) + " ======") int_result = inputNumber ...
37bd1683785377afe49b17d3aec9700665e3d3db
MyoMinHtwe/Programming_2_practicals
/Practical 5/Extension_3.py
1,804
4.1875
4
def bill_estimator(): MENU = """11 - TARIFF_11 = 0.244618 31 - TARIFF_31 = 0.136928 41 - TARIFF_41 = 0.156885 51 - TARIFF_51 = 0.244567 61 - TARIFF_61 = 0.304050 """ print(MENU) tariff_cost = {11: 0.244618, 31: 0.136928, 41: 0.156885, 51: 0.244567, 61: 0.304050} choice = int(input("Which tariff?...
6e27d14ec66db99139840586ca72f316717f100b
MyoMinHtwe/Programming_2_practicals
/Practical 3/gopher_population.py
805
4.0625
4
import random STARTING_POPULATION = 1000 print("Welcome to the Gopher Population Simulator") print("Starting population: {}".format(STARTING_POPULATION)) def birth_rate(): for i in range(1, 11): born = int(random.uniform(0.1, 0.2)*STARTING_POPULATION) return born def death_rate(): for i in ran...
8071c3f0f77261cb68e0c36d09a814ba95fdb474
MyoMinHtwe/Programming_2_practicals
/Practical 5/Extension_1.py
248
4.3125
4
name_to_dob = {} for i in range(2): key = input("Enter name: ") value = input("Enter date of birth (dd/mm/yyyy): ") name_to_dob[key] = value for key, value in name_to_dob.items(): print("{} date of birth is {:10}".format(key,value))
cb0c2a4c02c8fee656a94fe659ac0c25115bd4bc
MyoMinHtwe/Programming_2_practicals
/Practical 3/temperatures.py
1,045
4.125
4
MENU = """C - Convert Celsius to Fahreneit F - Convert Fahrenheit to Celsius Q - Quit""" print(MENU) choice = input("Input your choice: ").lower() def main(choice): #choice = input("Input your choice: ").lower() print(choice) i = True while i==True: if choice == "c": celsius = float(...
a288abbab98175fb70e1c1a34c5c6f4eeeed438a
HarshKapadia2/python_sandbox
/python_sandbox_finished_(by_harsh_kapadia)/tuples_sets.py
1,269
4.25
4
# A Tuple is a collection which is ordered and unchangeable. Allows duplicate members. # create tuple fruit_1 = ('mango', 'watermelon', 'strawberry', 'orange', 'dragon fruit') # using constructor fruit_2 = tuple(('mango', 'watermelon', 'strawberry', 'orange', 'dragon fruit')) print(fruit_1, fruit_2) fruit_3 = ('app...
828e176b7aae604d3f4d38a206d4f1cfa5d49197
HarshKapadia2/python_sandbox
/python_sandbox_finished_(by_harsh_kapadia)/loops.py
854
4.1875
4
# A for loop is used for iterating over a sequence (that is either a list, a tuple, a dictionary, a set, or a string). people = ['Selena', 'Lucas', 'Felix', 'Brad'] # for person in people: # print(person) # break # for person in people: # if person == 'Felix': # break # print(person) # cont...
5a7b007836701868c909dd8cdbef18402c546577
Walter64/LyndaPythonApp
/02_bitwise.py
1,018
4
4
#!/usr/bin/env python3 x = 0x0a y = 0x02 z = x & y print('The & operator') print(f'(hex) x is {x:02x}, y is {y:02x}, z is {z:02x}') print(f'(bin) x is {x:08b}, y is {y:08b}, z is {z:08b}') z = x | y print('\nThe | operator') print(f'(hex) x is {x:02x}, y is {y:02x}, z is {z:02x}') print(f'(bin) x is {x:08b}, y is {...
e773e16406755eea6871525ad41dd6157d5ce7fd
ProfLeao/codes_site_pessoal
/shortcirc.py
514
4
4
# Códigos do artigo: # Short Circuiting no Python 3: Fechando curtos-circuitos em seus códigos. # Função para teste lógico de valores def teste_tf(valor): if valor: print(f"{valor} é avaliado como verdadeiro.") else: print(f"{valor} é avaliado como falso.") # Declaração de valores para teste...
3fa6c5c674507c52c1a781f66d7e82601a136052
PARVATHY-S-PRAKASH/PROGRAMMING-LAB
/Write a python program display the given pyramid with the step number accepted from user using function/pattern.py
172
3.828125
4
n = int(input("enter the number of rows :")) x=1 for i in range(x,n+1): for j in range(x, i+1): print(i*j, end=' ') print()
17b6d99d1d01d51382c55e816bf57636954d383b
sd1064/Hackathon
/Player/player.py
1,437
3.65625
4
# current position # known locations # print current board # move import time from Constants.constants import constants class player: currentPosition = [0,0] knownLocations = [] #[[ROW,COL,TYPE]] board=[] DECIDE_TIME = 3 def __init__(self,board,DECIDE_TIME): self.board=board self....
b74747432f07f43859a2adee3aeac1e25ace22a4
c10023596/280201044
/lab08/1.py
168
3.671875
4
def list_sum(a): summation = 0 for x in range(len(a)): summation += a[x] return summation a_list = [12, -7, 5, -89.4, 3, 27, 56, 57.3] print(list_sum(a_list))
42f41d07e0718446e00b78942534fa1e5b38e517
c10023596/280201044
/lab07/3.py
377
4.03125
4
employees = {} pawns_i = input("Names of employees with , between them: ") salaries_i = input("Their payments with , between them: ") pawns = ["pawn1","pawn2","pawn3","pawn4","pawn5"] salaries = [350, 470, 438, 217, 387] for i in range(len(pawns)): employees[salaries[i]]=pawns[i] salaries.sort() print(employees[salar...
06445c460e1c8736aa073573f0fb715369c84296
c10023596/280201044
/lab10/2.py
204
3.609375
4
def hailstone(x, seq=[]): seq.append(str(x)) if x == 1: return ",".join(seq) else: if x % 2 == 1: return hailstone(3*x + 1) else: return hailstone(x//2) print(hailstone(5))
de02d42116a147070605067cce79a3dacd5c6971
c10023596/280201044
/lab07/2.py
257
3.6875
4
books = ["ULYSSES","ANIMAL FARM","BRAVE NEW WORLD","ENDER'S GAME"] book_dict = {} for i in range(len(books)): book_name = books[i] unq_letters = list(set(book_name)) value = len(book_name),len(unq_letters) book_dict[book_name]=value print(book_dict)
0fbe418f86cb8c7b171f3cf66912b2477b6080da
aliev-m/Python
/stepik_python/3.1_1.py
164
3.875
4
x=float(input()) def f(x): if x<=-2: return (1-(x+2)**2) elif -2<x<=2: return (x/2)*-1 elif x>2: return ((x-2)**2)+1 print(f(x))
b2c5eb0a36f0b37826391386cfde161e61c5eeef
avaska/PycharmProjects
/workpy/7모듈과패키지/1_1표준모듈종류.py
8,304
3.71875
4
#표준 모듈 종류 # random모듈 # -> 랜덤값을 생성할떄 사용하는 모듈 #random모듈 불러오기 import random print("#random 모듈") #random모듈의 random()함수는 0.0 <= 랜덤값 < 1.0 랜덤값을 float를 리턴합니다 print(random.random()) #random모듈의 uniform(min,max) 함수는 지정한 범위 사이의 랜덤값을 float를 리턴합니다 print(random.uniform(10,20)) #random모듈의 randranage()함수는 지정한 범위 사이의 랜덤값을 int...
10a8176af5cbba01be295eb892b4b3d7ee1d4dca
avaska/PycharmProjects
/workpy/5예외처리/handle_with_codition.py
1,801
3.859375
4
#주제 :조건문으로 예외 처리하기 # #숫자를 입력받습니다 # user_input_a = input("정수입력>") # # #입력받은 문자열을 숫자로 변환 합니다 # number_input_a = int(user_input_a) # # #출력합니다 # print("원의 반지름 : ", number_input_a) # print("원의 둘레 : ", 2 * 3.14 * number_input_a) # print("원의 넓이 : ", 3.14 * number_input_a * number_input_a) #위 코드는 정수를 입력하지 않으면 문제가 발생합니다 #따라서...
b7fa760a313c7edbaf44ef540037481f66b1b02c
avaska/PycharmProjects
/workpy/5예외처리/file_closed02.py
573
3.734375
4
#try except 구문을 사용합니다 try: #파일을 쓰기모드로 연다 file = open("info.txt","w") #여러가지 처리를 수행합니다 예외.발생해라() except Exception as e: print(e) finally: # 파일을 닫습니다 file.close() print("파일이 제대로 닫혔는지 확인하기") print(file.closed) #코드를 실행 해보면 closed속성의 반환값이 False이므로 파일이 닫히지 않았다는 것을 알수 있습니다 #따라서 반드시 finally구문을 ...
bc1dd0bbe542a976033950c6d48544ecf405bd63
avaska/PycharmProjects
/workpy/1파이썬둘러보기/파이썬 기초 문법 따라 해 보기.py
315
3.96875
4
# 실행 단축키 ctrl + shift + F10 print(1+2) print(3/2.4) print(3 * 9) a = 1 b = 2 print(a + b) a = "Python" print(a) a = 3 if a > 1: print("a is geater than 1") for a in [1,2,3]: print(a) i = 0 while i<3: i = i + 1 print(i) def add(c,d): return c + d print(add(10,100))
1d65b3d06b41868caf13b3629ac6a87a7d72ed44
laurensierra/CSC442-TeamSphinx
/xor.py
831
3.90625
4
########################### #Name: Lauren Gilbert #Date: May 5, 2020 #Version: Python 2 #Notes:this program takes ciphertext and plaintext and changes it to the other using a key that is in the file ########################### from sys import stdin, stdout import sys #read key from file that we open through the pr...
8ef59dc9e39a022a7af161e04abe987b72f271a5
hjfrun/python-learning-course
/intermediate-python/13-decorators.py
1,499
3.578125
4
import functools # def start_end_decorator(func): # @functools.wraps(func) # def wrapper(*args, **kwargs): # print("-----Start-----") # result = func(*args, **kwargs) # print("-----End-----") # return result # return wrapper # @start_end_decorator # def print_name(): # ...
622589e96be15dc7e742ce2a1dc83ea91507b5dc
DeepanshuSarawagi/python
/ModulesAndFunctions/dateAndTime/datecalc.py
354
4.25
4
import time print(time.gmtime(0)) # This will print the epoch time of this system which is usually January 1, 1970 print(time.localtime()) # This will print the local time print(time.time()) # This will print the time in seconds since epoch time time_here = time.localtime() print(time_here) for i in time_here: ...
20a78703d5dde6ad6994c5832e05206da4fa7e79
DeepanshuSarawagi/python
/100DaysOfPython/Day20-21/SnakeGame/snake.py
1,869
3.921875
4
from turtle import Turtle MOVE_DISTANCE = 20 ANGLE = 90 UP = 90 DOWN = 270 RIGHT = 0 LEFT = 180 class Snake: def __init__(self): self.all_snakes = [] self.initialise_snake_body() self.head = self.all_snakes[0] def create_snake_body(self): for _ in range(3): timmy...
91bfc92d73cf257344dc1260e433bdbd9d6cb4d5
DeepanshuSarawagi/python
/freeCodeCamp/ConditionalExecution/conditionalExecution.py
309
4.1875
4
# This is a python exercise on freeCodeCamp's python certification curriculum x = 5 if x < 5: print("X is less than 5") for i in range(5): print(i) if i <= 2: print("i is less than or equal to 2") if i > 2: print("i is now ", i) print("Done with ", i) print("All done!")
bb6210fa257ed3c753101ae8b2502fbb8e21825f
DeepanshuSarawagi/python
/ModulesAndFunctions/dateAndTime/tztest.py
1,109
3.65625
4
import pytz import datetime country = "Europe/Moscow" tz_to_display = pytz.timezone(country) local_time = datetime.datetime.now(tz=tz_to_display) print(f"The time in country {country} is {local_time}") print(f"The UTC time is {datetime.datetime.utcnow()}") for x in pytz.all_timezones: print(x) ...
7384fbb693486ec0f00158292487d6a2086fc2ac
DeepanshuSarawagi/python
/Data Types/numericOperators.py
485
4.34375
4
# In this lesson we are going to learn about the numeric operators in the Python. a = 12 b = 3 print(a + b) print(a - b) print(a * b) print(a / b) print(a // b) print(a % b) # We will learn about the operator precedence in the following example. print(a + b / 3 - 4 * 12) # This should evaluate to -35.0 as per the ...
a2f4d989d9519493126f343e1e613b0c0d1c313d
DeepanshuSarawagi/python
/ModulesAndFunctions/Functions/parabolaFunction.py
832
3.890625
4
import tkinter def parabola(page, size): for x in range(-size, size): y = x*x / size plot(page, x, y) # draw axes in the canvas def draw_axes(page): page.update() x_origin = page.winfo_width() / 2 y_origin = page.winfo_height() / 2 page.configure(scrollregion=(-x_origin, -y_origi...
6d34356e7e6d161aa6e838b8ca588e3dce3b01f4
DeepanshuSarawagi/python
/100DaysOfPython/Day2/DataTypes/typeConversion.py
944
4.25
4
# In this lesson we are going to convert the int data type to string data type num_char = len(input("What is your name?\n")) print("Your name has " + str(num_char) + " characters") # Type conversion happens here. Where we convert # the type integer to string # ...
a9aaf4e426597e6a54aff443fdadefad6e4fb9d6
DeepanshuSarawagi/python
/100DaysOfPython/Day1/main.py
647
4.375
4
print("Print something") print("Hello World!") print("Day 1 - Python Print Function") print("print('what to print')") print("Hello World!\nHello World again!\nHellooo World!!") print() # Day 1. Exercise 2 Uncomment below and debug the errors # print(Day 1 - String Manipulation") # print("String Concatenation is done...
34c3bcf8c09826d88ff52370f8c9ae9735d2f966
DeepanshuSarawagi/python
/100DaysOfPython/Day19/Turtle-GUI-2/main.py
796
4.21875
4
from turtle import Turtle, Screen tim = Turtle() screen = Screen() def move_forward(): tim.forward(10) screen.listen() # In order for our turtle to listen to the screen events, we need to call this screen method screen.onkey(fun=move_forward, key="Up") # The Screen.onkey() method accepts two arguments, 1. F...
3784c046f7d92ea5da937cc8920d75c2d18ed891
DeepanshuSarawagi/python
/100DaysOfPython/Day2/DataTypes/LivesInWeeks.py
168
3.9375
4
age = int(input("Enter your age: ")) print("You have {} days or {} weeks or {} months left to live.". format((90 - age) * 365, (90 - age) * 52, (90 - age) * 12))
e9e42890ea221e41dd51181364f24590d1b0ce6e
DeepanshuSarawagi/python
/whileLoop/whileLoop.py
423
4.125
4
# In this lesson we are going to learn about while loops in Python. # Simple while loop. i = 0 while i < 10: print(f"i is now {i}") i += 1 available_exit =["east", "west", "south"] chosen_exit = "" while chosen_exit not in available_exit: chosen_exit = input("Please enter a direction: ") if chosen_exi...
11bc279d354a5d57bcae0bd9d14b8ed52db97a4b
DeepanshuSarawagi/python
/100DaysOfPython/Day27/ArgsAndKwargs/kwargs_example.py
1,160
4.6875
5
""" In this lesson we are going to learn about unlimited keyword arguments and how it can be used in functions. The general syntax is to define a function with just one parameter **kwargs. We can then loop through the 'many' keyword arguments and perform necessary actions. Syntax: def function(**kwargs): s...
bf93f065e5b1fe4d533137140254a9fa671233c9
DeepanshuSarawagi/python
/DSA/LinkedLists/linked_lists.py
5,363
4.375
4
""" We will be creating singly linked lists with one head, one node and one tail. SLL - is abbreviated as Singly Linked List """ class Node: def __init__(self, value=None): self.value = value self.next = None class SinglyLinkedList: def __init__(self): self.head = None self...
1f369c908a949991be5f732c724851a51732ee1e
DeepanshuSarawagi/python
/100DaysOfPython/Day24/FilesDirectoriesPaths/scoreboard.py
1,279
3.796875
4
from turtle import Turtle FILE_LOCATION = "/Users/deepanshusarawagi/Desktop/Learning/python/100DaysOfPython/Day24/FilesDirectoriesPaths" class Scoreboard(Turtle): def __init__(self): super(Scoreboard, self).__init__() self.score = 0 with open(f"{FILE_LOCATION}/highscore.txt", "r") as fil...
2ddf4c14b370e909c54921dd801a077fab4dba8b
DeepanshuSarawagi/python
/100DaysOfPython/Day22/PongGameProject/paddle.py
577
3.703125
4
from turtle import Turtle class Paddle(Turtle): def __init__(self, x_cor, y_cor): super(Paddle, self).__init__() self.shape("square") self.color("white") self.shapesize(stretch_wid=5.0, stretch_len=1.0) self.penup() self.setposition(x_cor, y_cor) def move_padd...
ad0cf84f3a01da48c32aa7efae44cf3b964d44d1
DeepanshuSarawagi/python
/100DaysOfPython/Day2/DataTypes/BMICalculator.py
209
4.28125
4
height = float(input("Enter your height in meters: ")) weight = float(input("Enter your weight in kilograms: ")) print("Your BMI is {}".format(round(weight / (height * height), 2))) print(8 // 3) print(8 / 3)
31a342ddff6fade8595b45f6127868b7525feca1
DeepanshuSarawagi/python
/DSA/Arrays/TwoDimensionalArrays/main.py
2,074
4.40625
4
import numpy # Creating two dimensional arrays # We will be creating it using a simple for loop two_d_array = [] for i in range(1, 11): two_d_array.append([i * j for j in range(2, 6)]) print(two_d_array) twoDArray = numpy.array([[1, 2, 3, 4, 5], [6, 7, 8, 9, 10], [11, 12, 13, 14, 15], [16, 17, 18, 19, 20]]) pr...
6669908da54e6f1491a5ad8b00abd23e70e35ed5
DeepanshuSarawagi/python
/DecimalComparison/decimalComparison.py
723
3.796875
4
input1 = str(input("Enter a decimal number of your choice: ")) input2 = str(input("Enter a second decimal number of your choice: ")) # input1 = str(3.1567) # input2 = str(3.156) print(input1) print(input2) print(input1[0] == input2[0]) extractedDecimal = [] for char in input1: if char == ".": extractedD...
393fd4a8a5281a36764de18a36fa5b30425f2fc3
DeepanshuSarawagi/python
/100DaysOfPython/Day4/Lists/RockPapersScissors.py
971
4.09375
4
import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) __________) (____) -...
4bde74d331959c0b3ca9002de605e7b39066c22d
DeepanshuSarawagi/python
/100DaysOfPython/Day3/IfElseAndConditionaloperators/BMICalculator.py
575
4.375
4
# BMI calculator 2.0 height = float(input("Please enter your height in meters: ")) weight = float(input("Please enter your weight in kgs: ")) bmi = float(round(weight / (height ** 2), 2)) if bmi < 18.5: print("BMI = {:.2f}. You are underweight".format(bmi)) elif 18.5 <= bmi <= 25: print("BMI = {:.2f}. You are ...
c32944fc92021af6a9aab1d68844287921f5f7dd
DeepanshuSarawagi/python
/100DaysOfPython/Day21/InheritanceBasics/Animal.py
563
4.375
4
class Animal: def __init__(self): self.num_eyes = 2 def breathe(self): print("Inhale, Exhale") # Now we are going to create a class Fish which will inherit properties from the Animal class and also has it's own # properties class Fish(Animal): def __init__(self): super().__init...
1a528576c8f93aaa42a02bc429263c30a970bf32
Qian7L/100-python-examples
/practice.py
33,274
3.546875
4
# -*- coding: utf-8 -*- #案例实战 #1.有1、2、3、4个数字,能组成多少个互不相同且无重复数字的三位数?都是多少? for i in range(1,5): for k in range(1,5): for j in range(1,5): if (i != j) and (i != k) and (j != k): print(i,k,j) #2.企业发放的奖金根据利润提成 i=int(input("输入利润")) if i <= 10: m=0.1*i elif i <= 20: ...
27cf83c0562510abb73ab837edea6d9d59eb1641
MichaelNormandyGavin/Zillow-Apartments
/time_series/analysis.py
3,874
3.640625
4
from math import sqrt import numpy as np import pandas as pd import matplotlib.pyplot as plt from statsmodels.tsa.stattools import adfuller def compute_correlation(x,y,r2=False,auto=False): '''Take two array-like series to calculate the correlation x: numpy.array or pandas.DataFrame: x value for correlat...
686b72c072f4358136a7225bf2effd169a9d4988
AYSE-DUMAN/python-algorithm-exercises
/edabit-problems/matrix_operations.py
1,217
3.953125
4
def add_matrix(a,b): result = [[0,0,0,0],[0,0,0,0],[0,0,0,0]] # iterate through rows for i in range(len(a)): # iterate through columns for j in range(len(a[0])): result[i][j] = a[i][j] + b[i][j] for k in result: print(k) # second solution for matr...
b4562dd899df9bdb93992e1b50f6f82e0792908e
rdrabina/PlotterWithDataFromCsv
/Date.py
2,473
3.953125
4
class Date: def __init__(self, hour, minute, day, month, year): self.hour = hour self.minute = minute self.year = year self.month = month self.day = day @property def hour(self): return self.__hour @hour.setter def hour(self, hour): if not 0 ...
f5c54aa33157cfbefd9c6b9e470a4cd21c978040
navarrovitor/mackenzie-assignments
/Algoritmos/VALÉRIA/matrix.py
559
3.921875
4
answers = ["a", "b", "b", "a", "c", "d", "e", "e", "a", "b"] def grade(tests): grades = [] for i in range(3): # mudar o número 2 para o número de provas singular_grade = 0 for j in range(10): if tests[i][j] == answers[j]: singular_grade += 1 grades.append(s...
8a94d372afb86307c1f92794bb101fc62a533436
navarrovitor/mackenzie-assignments
/Algoritmos/JEAN/Aulas/ex2.py
210
3.8125
4
#ENTRADA NUM1 = int(input("Insira o primeiro número: ")) NUM2 = int(input("Insira o segundo número: ")) #PROCESSAMENTO #SAÍDA print("Seus números em ordem inversa são: " + str(NUM2) + " e " + str(NUM1))
d04ec50bd077ee78cb1328b1fa2a8d8fc1ae33a1
navarrovitor/mackenzie-assignments
/Algoritmos/JEAN/10março/main_2.py
244
3.640625
4
km = float(input("Qual a quantidade de quilômetros percorridos? ")) dias = int(input("Qual a quantidade de dias pelos quais o carro foi alugado? ")) preço = (0.15 * km) + (60 * dias) print("O preço a pagar é igual a: " + str(preço))
656cb91c4a6d870a42caa36fd3f05bd473501b30
navarrovitor/mackenzie-assignments
/Dados/03GASTON/20-09-BP-manual.py
535
3.546875
4
import numpy as np import matplotlib.pyplot as plt import pandas as pd height = [1.52,1.57,1.57,1.63,1.67,1.68,1.68,1.69,1.7,1.7,1.7,1.73,1.74,1.75,1.75,1.75,1.75,1.78,1.78,1.78,1.78,1.82,1.86,1.87,1.9] weight = [52,53,55,60,60,62,62,64,68,72,72,72,72,73,74,75,75,75,76,80,83,85,87,94,94] plt.figure(figsize=(12,6)) p...
8bd23d0b541b4f400b7b48ac74cd37010efa789f
norbiax/Python-training
/Sum of the largest even and odd number from an input.py
1,216
4.09375
4
import random import numpy as np A=[] ans = "Y" while ans == "Y": try: N = int(input("Please enter number of elements: ")) for i in range(0, N): while True: try: elem = int(input("Enter number " + str(i+1) + ": ")) A.append(elem) ...
3f1065b572cc33b71913f8902dc6d2d3de540456
dabaker6/Udacity_Statistics
/Regression.py
448
3.5625
4
# -*- coding: utf-8 -*- """ Created on Sat Mar 11 20:25:59 2017 @author: bakerda """ import numpy as np def xbar(data): return sum(data)/len(data) def reg(x,y): numer = sum(np.multiply([i-xbar(x) for i in x],[i-xbar(y) for i in y])) denom = sum([(i-xbar(x))**2 for i in x]) ...
02b409be559281f65f29dce8b87643c83ba7ce20
victorhslima98/Complexidade_de_Algoritmos
/max_crossing_subarray.py
459
3.515625
4
def max_crossing_subarray(a, low, mid, high): left_sum= float('-inf') sum = 0 for i in range(mid, low-1,-1): sum += a[i] if sum > left_sum: left_sum = sum max_left = i right_sum = float('-inf') sum = 0 for j in range(mid + 1, high+1): sum += a[j...
1117ab86b491eca4f879897af51ccc69112e854b
shaonsust/Algorithms
/sort/bubble_sort.py
1,074
4.40625
4
""" Python 3.8.2 Pure Python Implementation of Bubble sort algorithm Complexity is O(n^2) This algorithm will work on both float and integer type list. Run this file for manual testing by following command: python bubble_sort.py Tutorial link: https://www.geeksforgeeks.org/bubble-sort/ """ def bubble_sort(arr): ...
075834be6723abdf00ba354f7ef8c82b05c90812
cocazzz/Ctf-Library-and-writeups
/cryptography/Crackable/keycrack.py
835
3.5
4
#key must be the length of the flag header #in our case, the header is "h4x0r{" nad the length is 6 #in encryption function we see that the random number is between 1 and 50 KEY="" S="put cipher here" for i in range(50) : K=chr(ord(S[0])-i) if (K == "h") : KEY=KEY+chr(i) break for i in rang...
caef334f181e5054dbd8970b2392ad1daa280287
destinysam/Python
/join and split.py
226
3.8125
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 31/08/2019 # PROGRAM: USING OF JOIN AND SPLIT IN LIST name = input('ENTER THE NAME AND AGE COMMA SEPARATED :').split(",") print(name) name = ["sameer", '21'] print(",".join(name))
3d14c9d32dcf8ddbde76853960bb4f9883f9a77c
destinysam/Python
/variebles.py
333
3.703125
4
# CODED BY SAM@SAMEER # EMAIL:SAMS44802@GMAIL.COM # DATE: 09/08/2019 # PROGRAM: USING OF VARIEBLES IN PYTHON name = "sameer" age = "20" print("hyy my name is " + name) print("i m " + age + " years old") name = "faizan" age = "21" weight = "70.34" print("hyy my name is " + name) print("i m " + age + " years old") print(...
1dab602fe34496eb9795737beec063b8a47cef31
destinysam/Python
/multithreading.py
346
3.59375
4
from threading import Thread import threading import os class thread_class(threading.Thread): def __init__(self,num): threading.Thread._init_(self) self.num = num def run(self): for i in num: print(i) thread1 = thread_class(10) thread2 = thread_class(20) threa...
8a9da88010290617dba5a27ca3f9d61b63820c37
destinysam/Python
/converting float into integer.py
174
4.125
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 18/08/2019 # PROGRAM: CONVERTING OF FLOAT INTO INTEGER float_var = float(input("ENTER THE FLOAT NUMBER")) print(int(float_var))
79867b99116d1b057f1c364c103c249a7aad7081
destinysam/Python
/default parameters.py
445
3.71875
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 29/08/2019 # PROGRAM: WORKING OF DEFAULT PARAMETERS def user_details(first_name="unknown", last_name="unknown", age=12): print(f"FIRST NAME IS :{first_name}") print(f"LAST NAME IS : {last_name}") print(f"AGE IS : {age}") name = input('ENTER THE ...
7e1910b806da8c88a1b6b6ac482ebfc077ae1412
destinysam/Python
/for loop and strings.py
294
4.0625
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 28/08/2019 # PROGRAM: PROGRAM TO ADD THE DIGITS name = input('ENTER THE NUMBER :') total = 0 for i in name: # NEW WAY total += int(i) print(total) name = "sameer" total = 0 for i in range(len(name)): # OLD WAY total += int(i) print(total)
a0118ebfc3e690eb89439727e45ac0c5085c382d
destinysam/Python
/step_argument_slicing.py
769
4.40625
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 15/08/2019 # PROGRAM: STEP ARGUMENT IN STRING SLICING language = "programming language" print("python"[0:6]) print("python"[0:6:1]) # SYNTAX STRING_NAME[START ARGUMENT:STOP ARGUMENT:STEP] print("python"[0:6:2]) # TAKING 2 STEPS TO AHEAD TO PRINT POSITION[2] A...
2f74b43054c8bae7699e92383ac0dfe9bf60fe47
destinysam/Python
/time function.py
311
3.75
4
# CODED BY SAM @SAMEER # EMAIL:SAMS44802@GMAIL.COM # DATE: 21/10/2019 # PROGRAM: USING CLOCK FUNCTION TO FIND THE EXECUTION TIME OF PROGRAM from time import clock sum = 0 start_time = clock() for i in range(1,10000001): sum+= i print(f"YOUR SUM IS {sum}") print(f"YOUR EXECUTION TIME IS {clock() - start_time} SECOND...
62d306a7c98e3e69fd65d56d465c270795b808a2
destinysam/Python
/while_loop.py
264
3.640625
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 20/08/2019 # PROGRAM: TO FIND THE SUM OF N NATURAL NUMBERS number = int(input('ENTER THE NUMBER ')) i = 0 add = 0 while i <= number: add = add + i i = i + 1 print(add) # DON'T CREATE ANY SPACE IN THE PREFIX
81a8bce1fd4ad1426104d8f4b662f0c0ca3c52c5
destinysam/Python
/more inputs in one line.py
435
4.15625
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 12/09/2019 # PROGRAM: TAKING MORE THAN ONE INPUT FROM THE USER name, age, address = "sameer", "23", "tarigam" # ASSIGNING VALUES BY ORDER print("YOUR NAME,AGE AND ADDRESS IS " + name + " " + age + " " + address) x = y = z = 2 print(x+y+z) name, age, address = ...
412104dd50bab7a3adf7bb8cc889be227f162ed4
destinysam/Python
/map function.py
530
4.09375
4
# CODED BY SAM@SAMEER # EMAIL:SAMS44802@GAMIL.COM # DATE:11/09/2019 # PROGRAM: CONVERTING OF LIST NUMBERS INTO NEGATIVE NUMBERS def negative(numbers, rang): return_list = [] temp = 0 counter = 0 for j in range(rang): counter = int(numbers[j]) temp = counter * -1 return_list...
aa1193d1f11a0c3ed765ceebb0075cfbc1ed3b0c
destinysam/Python
/assignment operators.py
310
4.03125
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 17/08/2019 # PROGRAM: USING OF ASSIGNMENT OPERATORS IN PYTHON name = "sameer" print(name + "ahmad") name += "ahmad" print(name) age = 8 print(age) age += 2 # age = 8+2 =10 print(age) age *= 2 # age = 10*2 = 20 print(age) age -= 3 # age = 20-3 = 17 print(age)...
5090e0dc9b0b2af20e1c98a8faefecc9f6e98fe3
destinysam/Python
/if_statement.py
217
4.03125
4
# CODED BY SAM@SAMEER # EMAIL: SAMS44802@GMAIL.COM # DATE: 18/08/2019 # PROGRAM: USING OF IF STATEMENT IN PYTHON age = int(input('ENTER THE AGE')) if age >= 21: print("U ARE SELECTED") else: print("YOUR AGE IS BELOW 21")
d9f27a2de72ad70490a106541336da7e12b3658d
venkatadri123/Python_Programs
/100_Basic_Programs/program_83.py
127
3.75
4
# 83.Please write a program to shuffle and print the list [3,6,7,8]. import random li = [3,6,7,8] random.shuffle(li) print(li)
1e1c08f44e704162f524bcf16e864410fbb81936
venkatadri123/Python_Programs
/core_python_programs/prog24.py
146
4.4375
4
# To accept a string from the keyboard and display individual letters of the string. str=input('enter string values:') for i in str: print(i)
6709221f53da07b735c97eb6701ac100d1c04a0a
venkatadri123/Python_Programs
/Sample_programs/31sum.py
114
3.6875
4
#To display sum of a list. l=[10,20,45] sum=0 i=0 while i<len(l): sum=sum+l[i] i=i+1 print("result=",sum)
76d555e119434b9b681e12c24d766a378a46e335
venkatadri123/Python_Programs
/Sample_programs/7incr.py
116
4.0625
4
#to increase a number by 1. ch=int(input()) x = ch+ 1 print ("The incremented character value is : ",x ) print (x)
6e279577678929165b7e5157ae4fffbdaaec1ccd
venkatadri123/Python_Programs
/core_python_programs/prog72.py
187
3.953125
4
# Write a lambda expression for sum of two number. def sum(a,b): return a+b x=sum(10,20) print('sum=',x) # Converting into lambda expression. f=lambda a,b:a+b print('sum=',f(10,20))
44c554dfeae7565f4d281bd31418a6f95a8beee4
venkatadri123/Python_Programs
/Advanced_python_programs/prog7.py
540
3.796875
4
# Wrte employee class with accessor and mulator methods. class emp: def setid(self,id): self.id=id def getid(self): return self.id def setname(self,name): self.name=name def getname(self): return self.name def setsal(self,sal): self.sal=sal def getsal(self...
0f0ac9cde7b60c38b2b507f099116c2dfa215ede
venkatadri123/Python_Programs
/Sample_programs/6addsub.py
121
3.8125
4
#To find subtraction and addition. x=int(input()) y=int(input()) z=x+y print('addition z=',x+y) z=x-y print('sub z=',x-y)
593d588380891054c09dbdae3303399a2460999a
venkatadri123/Python_Programs
/Advanced_python_programs/student.py
538
3.6875
4
# Import some code from teacher class using Inheritance. from teacher import* class student(teacher): def setmarks(self,marks): self.marks=marks def getmarks(self): return self.marks s=student() s.setid(14) s.setname('venkatadri') s.setage('25 Years') s.setheight('5.11 Inch') s.setaddress('vindu...
2e3e733022370fd080b83b15db16340d75acc2b0
venkatadri123/Python_Programs
/HackerRank_programs/hourglassSum.py
1,200
3.890625
4
"""Given a 2D Array, : 1 1 1 0 0 0 0 1 0 0 0 0 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 We define an hourglass in to be a subset of values with indices falling in this pattern in 's graphical representation: a b c d e f g There are hourglasses in , and an hourglass sum is the sum of an hourglass' values. ...
1e6200636339b88fdfab99dd685b6f6cc11cbc5a
venkatadri123/Python_Programs
/100_Basic_Programs/program_11.py
532
3.953125
4
# 11.Write a program which accepts a sequence of comma separated 4 digit binary numbers as its # input and then check whether they are divisible by 5 or not. The numbers that are divisible # by 5 are to be printed in a comma separated sequence. l=[] x=input() items=x.split(',') for p in items: q=int(p) if q%5...
d0be8e43586ecf7ccb00bb5bb2c1680e1e3cd6f6
venkatadri123/Python_Programs
/HackerRank_programs/repeatedString.py
978
3.890625
4
"""Lilah has a string, , of lowercase English letters that she repeated infinitely many times. Given an integer, , find and print the number of letter a's in the first letters of Lilah's infinite string. For example, if the string and , the substring we consider is , the first characters of her infinite string. Th...
c156d757509443dfe18982519d44481ad0484f3b
venkatadri123/Python_Programs
/Advanced_python_programs/prog21.py
395
3.859375
4
# Creating our own Exception. class MyException(Exception): def __init__(self,str): self.str=str def check(dict): for k,v in dict.items(): print('%-15s %.2f' %(k,v)) if v<2000.00: raise MyException('balence amount is less') bank={'raju':35600,'venkey':25641,'hari':1230,'suri'...
b5edf92d6ac5a62efe88d987bfaf0e080e9b7b2e
venkatadri123/Python_Programs
/core_python_programs/prog7.py
247
4.0625
4
#To display employee Id no,Name,Salory from the keyboard & display them. id_no=int(input('enter id:')) name=input('enter name:') sal=float(input('enter sal:')) print('employee details are:') print('id_no=%d,\nname=%s,\nsal=%f' %(id_no,name,sal))
039a88bcde8a8045d66b502bf2d12c14363c54f9
venkatadri123/Python_Programs
/Advanced_python_programs/prog2.py
473
3.96875
4
# Create a student class with roll number,name,marks in three subjects and total marks. class student: def __init__(self,r,n,m): self.rno=r self.name=n self.marks=m def display(self): print('rno=',self.rno) print('name=',self.name) print('marks=',self.marks) ...
0eaf2afa9cc1c3f161504fc2c9254b92fb3f4262
venkatadri123/Python_Programs
/100_Basic_Programs/program_43.py
280
4.53125
5
# 43. Write a program which accepts a string as input to print "Yes" # if the string is "yes" or "YES" or "Yes", otherwise print "No". def strlogical(): s=input() if s =="Yes" or s=="yes" or s=="YES": return "Yes" else: return "No" print(strlogical())
04fad98db209c75d4ec38471b36a7584fa8d2532
venkatadri123/Python_Programs
/Sample_programs/4prod.py
154
4.34375
4
#To find product of given two numbers. x=int(input('enter first no:')) y=int(input('enter second no:')) product=x*y print("product of two no is:",product)
15f676a5c2184115148f89723a2912283baed3c2
venkatadri123/Python_Programs
/core_python_programs/prog37.py
277
3.96875
4
# To display a given string is found or not and display position no also. lst=['hari','venkey','suri','hello'] n=input('enter a string:') a=len(n) l=len(lst) for i in lst: if i==n: print('found') break else: print('not found') print(a) print('end')