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
d6c8b62d75d43f23f079223c80a3869e3c10a6b6
SyuW/phys_363_classical_mech
/restricted_3BP_motion.py
2,238
3.59375
4
import numpy as np import matplotlib.pyplot as plt ''' Plot test mass trajectories in the restricted three-body problem ''' # Constants a = 1 G = 1 m = 1 M_2 = 1 delta_t = 0.001 mass_ratios = {"i": 1, "ii": 0.041, "iii": 0.039, "iv": 19/20000} def determine_mass_of_M_1(mass_ratio, M_2): return ma...
258a26f57623ce51cd70dd66295ce40993ddc481
iCeterisParibus/analytics-vidhya-essentials-of-machine-learning-algorithms
/AV_gradient_boost.py
1,265
3.71875
4
# Python code for Gradient Boosting & AdaBoost provided by Analytics Vidhya print '-' * 85 print """ Gradient Boosting & AdaBoost GBM & AdaBoost are boosting algorithms used when we deal with plenty of data to make a prediction with high prediction power. Boosting is an ensemble learning algorithm which combi...
a65178b09ef727b96992dc3d20820e07afcc9bfc
bingx1/python-examples
/lru_cache.py
947
3.859375
4
#Lru Cache implemented using python's built-in OrderedDict # OrderedDict stores the order keys were added to the dictionary class LruCache: def __init__(self, capacity) -> None: self.capacity = capacity self.price_table = {} def lookup(self, isbn): if isbn not in self.price_tabl...
43716fe322cd9e307b98cefa32a1e35a1d387b87
omvikram/python-ds-algo
/dynamic-programming/longest_increasing_subsequence.py
2,346
4.28125
4
# Dynamic programming Python implementation of LIS problem # lis returns length of the longest increasing subsequence in arr of size n def maxLIS(arr): n = len(arr) # Declare the list (array) for LIS and # initialize LIS values for all indexes lis = [1]*n # Compute optimized LIS values in bottom up manne...
b4c01ca063d09ba24aff1bfe44c719043d24d1c3
omvikram/python-ds-algo
/dynamic-programming/pattern_search_typo.py
1,035
4.28125
4
# Input is read from the standard input. On the first line will be the word W. # On the second line will be the text to search. # The result is written to the standard output. It must consist of one integer - # the number of occurrences of W in the text including the typos as defined above. # SAMPLE INPUT # banana...
a3ca34db407b81382afc3e61e6abbc74eed86c3a
omvikram/python-ds-algo
/dynamic-programming/bit_count.py
568
4.3125
4
# Function to get no of bits in binary representation of positive integer def countBits(n): count = 0 # using right shift operator while (n): count += 1 n >>= 1 return count # Driver program i = 65 print(countBits(i)) ########################################################################## # Pytho...
5fff518a9ffe783632b8d28920772fbc7ab54467
omvikram/python-ds-algo
/data-strucutres/linked_list.py
1,483
4.4375
4
# Python program to create linked list and its main functionality # push, pop and print the linked list # Node class class Node: # Constructor to initialize # the node object def __init__(self, data): self.data = data self.next = None # LinkedList class class LinkedList: # Function ...
6b4f8c75cf2425bac0d93784b1ceb53707af7db8
omvikram/python-ds-algo
/dynamic-programming/jump_over_numbers.py
1,191
3.984375
4
# You are given a list of non-negative integers and you start at the left-most integer in this list. # After that you need to perform the following step: # Given that the number at the position where you are now is P you need to jump P positions to the right in the list. # For example, if you are at position 6 and t...
8ac6c88830679c6fb29732e283ec1884d30fdaa8
omvikram/python-ds-algo
/data-strucutres/heap.py
742
4.125
4
import heapq ## heapify - This function converts a regular list to a heap. In the resulting heap the smallest element ## gets pushed to the index position 0. But rest of the data elements are not necessarily sorted. ## heappush – This function adds an element to the heap without altering the current heap. ## heappop ...
dd09b6396367705c2bb81a94711f220d212e94af
vipulyadav150/Python-OOP
/src/closureFunctions.py
252
3.53125
4
def outer_function(): message = 'Hi' def inner_function(): print(message) return inner_function #removed Paranthesis my_func = outer_function() #MY func is = inner_function(){ready to be executed} my_func() my_func() my_func()
ecdabecb200fb8066e266509c39ab0fa4307b580
Deo-07/python-work
/deo10.py
633
4.09375
4
#Pyhon IF , Else and Elif statements age=int(input("Enter Your Age:")) if(age>28): print("Yes U can Drink Alcohol") elif( age>15): print("You can take Only soft Drinks") else: print("You can only drink Water") #Sort Hand If OR Else it is Also known as ternary operaters if(12>6):print("hello ") #Ne...
0ac2e2f67a2ccd09efcb2375af529d5758732cd9
Deo-07/python-work
/prac5.py
186
3.671875
4
#Make ATM concept print("Welcome To Deovano Bank\n") chanses=3 balance=900 while chanses>=0: pin=int(input("Plese Enter your Pin\n")) if (pin==1234): print("Welcome") break
759c43ae5db67cb5badfa6eded41722aa3cf218c
theod0sis/AFDEmp
/Maze/mazeprob.py
8,862
3.75
4
import random import sys sys.version n = input('Enter the size of the graph :') n= int(n) i=0 walls=[] while i==0 : wall_x = input ('Enter the walls of the graph(x)[if you want to stop enter "exit"] :') if (wall_x=="exit"): i=1 else: wall_y = input ('Enter the walls of the graph(y):')...
f667d642e7b5d4d23665265c5d82301503ef43e5
LinvernSS/daily_assignments
/week1/day4/day10.py
631
3.859375
4
#!/usr/bin/env python # coding: utf-8 # Lucas Invernizzi Day 10 Assignment # 1) # In[16]: def bmi(in_data): in_data = in_data.split('\n') out = '' for i in range(1, int(in_data[0]) + 1): person = in_data[i].split() weight = int(person[0]) height = float(person[1]) bmi = ...
1aa3316e636bfcc2f6880ebb8f910e85d6913fa3
MandilKarki/RabbitMQ
/Python/Hello world /receive.py
978
3.765625
4
""" Receiver which receives the message from the queue. """ import pika """Create a connection to the RabbitMQ server and establish a channel""" connection = pika.BlockingConnection(pika.ConnectionParameters(host="localhost", port=5672)) channel = connection.channel() """ - Create or get the existing chann...
ae3ea608877c02a2c481bc3c43c8f9bbaa423ba2
MandilKarki/RabbitMQ
/Python/Hello world /send.py
954
3.71875
4
""" A producer to send the message to the RabbitMQ server. """ import pika """Create a connection to the RabbitMQ server and channel""" connection = pika.BlockingConnection(pika.ConnectionParameters(host='localhost',port=5672)) channel = connection.channel() """Create a queue named 'hello'. If no queue name is def...
cd638f4db8cfb8a929fe2461230f6ac8949655ce
Swetapadma94/simple-linear-regression
/simple linear regression-udemy.py
1,733
3.984375
4
#!/usr/bin/env python # coding: utf-8 # # Importing Libraries # In[1]: import numpy as np import pandas as pd import matplotlib.pyplot as plt # # Importing the dataseet # In[2]: df=pd.read_csv(r'E:\Udemy\Machine Learning A-Z (Codes and Datasets)\Part 2 - Regression\Section 4 - Simple Linear Regression\Python\S...
8f183f613c8faee3b9cc680a4649e0a27a854c44
tjhoward/Discord-Quiz-Bot
/quizbot.py
7,646
3.703125
4
import discord #discord.py library #import os #from replit import db client = discord.Client() #create client instance to discord class quiz(discord.Client): def __init__(self, user_name): self.user_name = user_name #self.quizzes = [["1$quizname", "Question ***", "Answer *** "], ["2$qui...
ae02115fe8dcf8601be35b9eb282d7a2088bd67e
recaedo/CTFs
/picoCTF/picoCTF_2019/Cryptography/The_Numbers/analysis.py
192
3.65625
4
flag = [16, 9, 3, 15, 3, 20, 6, 20, 8, 5, 14, 21, 13, 2, 5, 18, 19, 13, 1, 19, 15, 14] result = [] for n in flag: result.append(n % 26) if flag == result: print("Hello, world!")
c4871ea3c60a561260b3dcdf807fcf29d8739dd6
recaedo/CTFs
/picoCTF/picoCTF_2018/Cryptography/Crypto_Warmup_1/solve.py
1,734
3.875
4
text = "llkjmlmpadkkc" key = "thisisalilkey" def encrypt(plain, key): plain = list(plain) j = 0 for i in range(len(plain)): j %= len(key) if plain[i].islower(): if key[j].islower(): plain[i] = (ord(plain[i]) - 97 + ord(key[j]) - 97) % 26 elif key[j].i...
c578023e68884af5ba50f88161e1d4f7c06ac81d
recaedo/CTFs
/picoCTF/picoCTF_2018/Cryptography/caesar_cipher_1/solve.py
1,018
3.875
4
text = "vgefmsaapaxpomqemdoubtqdxoaxypeo" def encrypt(plain, key): plain = list(plain) for i in range(len(plain)): if plain[i].islower(): plain[i] = (ord(plain[i]) - 97 + key) % 26 + 97 elif plain[i].isupper(): plain[i] = (ord(plain[i]) - 65 + key) % 26 + 65 else...
5b09f190c2d6abad62be8ce900bddd9cf9103087
YovieYulian/aassdw
/class atribute.py
333
3.578125
4
class persons(): def __init__ (self,nama,umur): self.nama = nama self.umur = umur def setname(self,namabaru) : self.nama=namabaru def getnama(self) : return self.nama orang1=persons('aki',17) print(orang1.nama) print(orang1.umur) orang1.setname('sujo') print(oran...
7c26da8af224c3c6452198be5a2228fac2a84117
ezequielfrias20/exam-mutant
/src/mutant.py
3,210
3.796875
4
''' Funcion que permite ver si una persona es mutante o no, tiene como parametro una lista y devuelve True si es mutante o False si no lo es ''' def Mutant(adn): try: ''' Funcion que permite verificar si la matriz es correcta siendo NxN y que solo tenga las letras A T C G...
291ce4c80a528eebc116dee6feff782222c5ecef
444aman/Nmd_vpn-Automatic-Update
/Nmd_vpn.py
1,302
3.59375
4
import urllib2 import os response = urllib2.urlopen('https://twitter.com/vpnbook') html = response.read() #reads whole page in html format and save it to html variable def blank_lines(): #for removing blank lines Lines1=open("Data.txt").readlines() Lines=[x for x in Lines1 if x.strip()] open("Data.txt",...
e136f84abb4f0e9070fb7ae254ec1390ee53ef22
RuzannaKusikyan/Intro-to-Python
/Lecture 1/Practical/Problem4.py
106
3.890625
4
AB = 3 AC = 4 import math BC = int(math.sqrt(AB**2+AC**2)) print("The hypotenuse of the triangle ABC:",BC)
43486f405621613de5d973ecfa3dfed21356969f
Adil-Anzarul/VSC-codes-c-cpp-python
/python_language/W11p2.py
1,257
4.75
5
# Give a string, remove all the punctuations in it and print only the words # in it. # Input format : # the input string with punctuations # Output format : # the output string without punctuations # Example # input # “Wow!!! It’s a beautiful morning” # output # Wow Its a beautiful morning # # Pytho...
ddce169af5d2b344a2d3ce1e4e90a8c381f767af
Adil-Anzarul/VSC-codes-c-cpp-python
/python_language/W9p2.py
949
4.1875
4
# Panagrams # Given an English sentence, check whether it is a panagram or not. # A panagram is a sentence containing all 26 letters in the English alphabet. # Input Format # A single line of the input contains a stirng s. # Output Format # Print Yes or No # Example: # Input: # The quick brown fox jumps over a lazy ...
d7303089dc5042589ae42bd13cb1d726dadff9c3
Adil-Anzarul/VSC-codes-c-cpp-python
/python_language/W6p1.py
822
3.875
4
# Number Triangle-2 # Given an integer input 'n', print a palindromic number triangle # of n lines as # shown in the example. # Input Format # The input contains a number n (n < 10) # Output Format # Print n lines corresponding to the number triangle # Example: # Input: # 5 # Output: # 1 # 121 # 12321 # 1234321 # 12...
0bb8e4550ae5e032beb28daceb741bbe6834bfda
Adil-Anzarul/VSC-codes-c-cpp-python
/python_language/W4p1.py
1,000
3.84375
4
#Two friends Suresh and Ramesh have m red candies and n green candies #respectively. They want to arrange the candies in such a way that each #row contains equal number of candies and also each row should have only red #candies or green candies. Help them to arrange the candies in such a way # that there are maximum...
fbc33061f8d425faf946cd9cf51b1fce77e52c5f
ahmed-abdulaal/docstr-md
/docstr_md/src_href/github.py
1,439
3.578125
4
class Github(): """ Compiles a hyperlink for source code stored in a Github repository. Parameters ---------- root : str Path to the root directory of the source code. e.g. `'https://github.com/<username>/blob/master'`. Attributes ---------- root : str Set from the `roo...
b17e385011d88d48869af98706b12b924d46fca4
jachsu/Tower-of-Hanoi
/tour.py
4,589
3.734375
4
""" functions to run TOAH tours. """ # Copyright 2013, 2014, 2017 Gary Baumgartner, Danny Heap, Dustin Wehr, # Bogdan Simion, Jacqueline Smith, Dan Zingaro # Distributed under the terms of the GNU General Public License. # # This file is part of Assignment 1, CSC148, Winter 2017. # # This is free software: you can re...
cb5dfa15e842564de905077495ef235aa2393145
Prudhvi-raj/embl
/Coding_python_Q_1.py
2,119
3.953125
4
# Online Python compiler (interpreter) to run Python online. # Write Python 3 code in this online editor and run it. import xml.etree.ElementTree as ET import pandas as pd import numpy as np xml = '''<?xml version="1.0" encoding="UTF-8"?> <MedlineCitationSet> <Article> <ArticleTitle>Title 1</ArticleTitle> ...
13d065bf569f9e553556c9372059031d044cf713
mattkjames7/FieldTracing
/FieldTracing/RK4/RK4Step.py
777
3.625
4
import numpy as np def RK4Step(x0,dt,fv,direction=1.0): ''' This Function returns the step taken along the field provided by the function 'fv' using the Runge-Kutta 4th order method. Inputs ====== x0 : float Initial location vector. dt : float Step size. fv : callable Callable function which provides ...
525d09b9016cef48b3a332c19759ce116dcd4121
chokpisit/pist
/month2016.py
443
3.515625
4
import pandas as pd data = pd.read_csv("bakery_update.csv") dictmonth = {} for i in range(len(data)): check = data['Date'][i] if '2016' in check: if len(check) == 10: month = check[3:5] if month not in dictmonth: dictmonth[month] = 1 else: dictmonth[month] += 1 else: month = c...
bd9c25fa4e68dbe602ea0dd62ac339ef8568c96f
simvisage/bmcs
/simulator/demo/interaction_scripts.py
766
3.65625
4
''' Created on Jan 9, 2019 @author: rch ''' import time def run_rerun_test(s): # Start calculation in a thread print('\nRUN the calculation thread from t = 0.0') s.run_thread() print('\nWAIT in main thread for 3 secs') time.sleep(3) print('\nPAUSE the calculation thread') s.pause() pr...
5152604c575032c3175edd9cfdd719eff002acdb
ArpanMahatra1999/NewsAnalysis
/news/emotion_counter/remove_special_characters.py
208
3.953125
4
import re # input: string of characters # output: string of characters without special characters def remove_special_characters(text): new_text = re.sub(r"[^a-zA-Z0-9\s]", "", text) return new_text
60f5ab2d39a8249b25f74e0e10601a05aaa09b7d
adamrodger/google-foobar
/4-1.py
1,195
3.75
4
from itertools import combinations def solution(num_buns, num_required): """ approach: - you have n bunnies - you require exactly r bunnies in order to open the doors (i.e. there are that many consoles) - r choose k is combinatorics - learned that in Project Euler :) - so, k = n-r+1 - e.g. ...
24759baf978403b0711b4e45834bd24cd8d2be13
okorchevaya/infa_2020_okorchevaya
/catch_the_ball_2.py
2,990
3.65625
4
import pygame from pygame.draw import * from random import randint pygame.init() FPS = 40 screen = pygame.display.set_mode((1200, 800)) length=1200 height=800 change = [-4, -3, -2, -1, 1, 2, 3, 4] RED = (255, 0, 0) BLUE = (0, 0, 255) YELLOW = (255, 255, 0) GREEN = (0, 255, 0) MAGENTA = (255, 0, 255) CYAN = (0, 25...
880f5e82814c5b2bf94504b3cfd787178392c591
okorchevaya/infa_2020_okorchevaya
/labs_1-3/lesson2.12.py
283
3.6875
4
import turtle as tur import numpy as np tur.shape('turtle') tur.speed(9) tur.left(90) def arch(halfr): ag=6 n=(np.pi*halfr**2/180*ag) for i in range(180//ag): tur.left(ag) tur.forward(n) while 2>1: arch(10) arch(5)
188f0afaf07e30c9ae7be8d478babe302eda49b8
sandro272/Data_Structure_with_Python
/03_double_link_list.py
4,238
3.859375
4
#! /usr/bin/env python # _*_coding:utf-8_*_ # project: Data_Structure_with_Algorithm_python # Author: zcj # @Time: 2019/11/12 11:42 class DoubleNode(object): '''双向链表的节点''' def __init__(self, item): self.elem = item self.next = None self.prior = None class DoubleLinkList(object): ''...
b49ba0c8e5015a86efe80a932459d52fb733828f
ashwindasr/Jet-Brains-Academy
/Python/Simple-Chatty-Bot/Stage_3/code.py
870
3.984375
4
# write your code here class SimpleChattyBot: user_name = None user_age = None def __init__(self, name, birth_year): self.name = name self.birth_year = birth_year def greeting(self): print(f"""Hello! My name is {self.name}. I was created in {self.birth_year}.""") def get_u...
d5fad4bc865112b86a3d80e07b06fef4b2dd71c9
ashwindasr/Jet-Brains-Academy
/Python/Coffee-Machine/Stage_4/code.py
1,899
4.0625
4
# Write your code here water_current = 400 milk_current = 540 coffee_current = 120 money_current = 550 cups_current = 9 def take(): global money_current print("I gave you ${}".format(money_current)) money_current = 0 def buy(): global water_current, milk_current, coffee_current, money_current, cups...
336ec37e4eca607217d7d91b9ac4fe0ce89ec079
ashwindasr/Jet-Brains-Academy
/Python/Rock-Paper-Scissors/Stage_2/code.py
589
3.921875
4
# Write your code here import random def check(player_move_): disadvantage = {"paper": "scissors", "rock": "paper", "scissors": "rock"} moves = ["rock", "paper", "scissors"] computer_move = random.choice(moves) if disadvantage[player_move_] == computer_move: print(f"Sorry, but computer chose ...
6f95a955b620917840231a1df936faa9276e5e2d
tamasgal/python_project_template
/foo/tests/test_bar.py
1,339
3.59375
4
#!usr/bin/env python # -*- coding: utf-8 -*- # Filename: test_bar.py from unittest import TestCase from foo.bar import whats_the_meaning_of_life, calculate_mean __author__ = "Your Name" __credits__ = [] __license__ = "MIT" __maintainer__ = "Jürgen" __email__ = "yname@km3net.de" class TestMeaningOfLife(TestCase): ...
f24199e1370b17f6ba250e31db0c817228f1e33d
marysom/stepik
/adaptive python/2_159.py
169
3.78125
4
''' Write a program: input of this program has a single line with integers. The program must output the sum of these numbers. ''' print(sum(map(int, input().split())))
6395703c2fc90856fe635294a7a00467c3221df6
marysom/stepik
/adaptive python/2_4.py
594
3.703125
4
'''MKAD The length of the Moscow Ring Road (MKAD) is 109 kilometers. Biker Vasya starts from the zero kilometer of MKAD and drives with a speed of V kilometers per hour. On which mark will he stop after T hours? Input data format The program gets integers V and T as input. If V > 0, then Vasya moves in a positive di...
60ef604f4946af95f38f5fe00cb47f2d35d1ea77
michal-swiatek/Checkers
/board.py
4,090
3.734375
4
""" Authors: Michal Swiatek, Jan Wasilewski Github: https://github.com/michal-swiatek/Checkers """ import itertools from pieces import Piece, Man class Board: """ Represents current board state Board holds all currently active pieces and generates representation of current game...
e18ff86e0a36fedea4fea3e8079e2c75bd92be40
jfhiguita/Retos-Python
/password_generator.py
780
3.84375
4
import random import string def _pass_generator(n): upper_letters = [random.choice(string.ascii_uppercase) for _ in range(int(n*0.3))] lower_letters = [random.choice(string.ascii_lowercase) for _ in range(int(n*0.3))] digits = [random.choice(string.digits) for _ in range(int(n*0.2))] special = [random...
16e9fea85b75f97f53cdc6a057b527aa80263fcf
jfhiguita/Retos-Python
/ejer23.py
885
3.609375
4
def file_txt(filename): lista = [] with open(filename) as f: line = f.readline() while line: lista.append(int(line)) line = f.readline() return lista def run(): list1 = file_txt('lista1_exe23.txt') list2 = file_txt('lista2_exe23.txt') ...
2b567d87483eee160ca326be15ea086c52ff95a3
jfhiguita/Retos-Python
/ejer6.py
679
4.09375
4
def _palindrome(text): text = text.lower() text = text.replace(' ', '') left, right = 0, len(text)-1 while left < right: if text[left] != text[right]: return False left += 1 right -= 1 return True # reverse_text = text[::-1] # if text == reverse_...
ae8af934709defb6386c1ecc93423fec0d92f3d7
camilacvieira/Sorting-Algorithms-Analysis
/algorithms/bogoSort.py
698
3.921875
4
import random # Sorts array a[0..n-1] using Bogo sort def bogoSort(arr): count = 0 result, count = isSorted(arr) while (result == False): shuffle(arr) result, comparisons = isSorted(arr) count = count + comparisons return count # To check if array is sorted or not def isSorted(...
aea50fb6f8be9c7e0df30010831eb079ca003fe6
DEEKSHANT-123/Compititive-Coding
/Heackerearth/Basic of IO/Zoos.py
97
3.671875
4
s = input() x = s.count('z') y = s.count('o') if 2*x == y: print("YES") else: print("NO")
d0f779e9a8c0f669d769e6e810e6b0ab033306e2
RaisaAkter/Online_judge_Problem
/python_programming/uri1019.py
209
3.734375
4
N=int(input()) hour=0 minute=int(N/60) if minute>60: hour=int(N/3600) secnd=N%3600 minute=int(secnd/60) secnd=secnd%60 else: secnd=N%60 print(str(hour)+':'+str(minute)+':'+str(secnd))
44d0c33f54ca1e79af869e5ea8d2eab352d9e5d4
RaisaAkter/Online_judge_Problem
/python_programming/py1.py
343
3.96875
4
class ListNode: def __init__(self,data): self.data=data self.next=None Node1=ListNode(11) Node2=ListNode(21) Node3=ListNode(31) head=Node1 Node1.next=Node2 Node2.next=Node3 def traversal(head): fNode=head while fNode is not None: print (fNode,fNode.data) fNode=fNode.next ...
8b56ac366700b926c2b3468b6c4fb9b9811acad2
RaisaAkter/Online_judge_Problem
/python_programming/subeen1.py
229
3.859375
4
def find_fib(n): if n <=2: return 1 fib_x,fib_next=1,1 i=3 while i<=n: i=i+1 fib_x , fib_next=fib_next,(fib_x + fib_next) return fib_next for x in range(1,11): print(find_fib(x))
621f34791ed34311df6cd56e0c53a91e68670da2
Rabeet-Syed/TABLES-using-Loop
/Table of -4 (2 methods).py
205
3.578125
4
print('TABEL OF -ve 4') for A in range(0,-100,-1) : print('4 x ' + str(A) + " = " + str( A * 4)) print('TABEL OF -ve 4') for A in range(100) : print('-4 x ' + str(A) + " = " + str( A * -4))
814601a978204d25789ea9aba8bdb01aeb3286b7
uggi121/Problem-Solving
/Strings/spreadsheet.py
316
3.515625
4
# -*- coding: utf-8 -*- """ Created on Mon Oct 21 20:36:37 2019 @author: Sudharshan """ def spreadsheet_encoding(x): def conv(y): return ord(y) - ord('A') + 1 power, res = 0, 0 for i in reversed(range(len(x))): res += conv(x[i]) * 26 ** power power += 1 return res
49584d54e0c5caf5803ccce17905ed6f87713de5
uggi121/Problem-Solving
/Arrays/plus_one.py
454
3.765625
4
# -*- coding: utf-8 -*- """ Created on Sat Sep 21 21:19:56 2019 @author: Sudharshan """ def plus_one(digits): carry = 0 for i in reversed(range(len(digits))): if carry == 0 and i != len(digits) - 1: break value = digits[i] + 1 if value > 9: carry = 1 ...
1de93371a6aa6b58c47daa9f15377e2e0f7e88ec
yudzhi/001_Drones.Python
/grid.py
10,562
3.96875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Sun Apr 1 12:32:56 2018 @author: yudzhi """ """ create a configuration space given a map of the world and setting a particular altitude for your drone. You'll read in a .csv file containing obstacle data which consists of six columns x, y, z and δx,...
4eab4617d62d9673cdaef3e3054eda88ddd30a10
oeg1n18/learning-python
/Learning-python-Oreilly/Statements.py
433
4
4
#================ if/elif/else/while/for ======================= x = True if (x): print('statement entered') elif (x): print('Statment not printed') else: print('statement not enetered') q=0 while x: print('still true') q += 1 if q==10: x = False print('not true') x = ['ba...
0f460b9585e9fe668cd99117c9dfd9deb2555a22
oeg1n18/learning-python
/Learning-python-Oreilly/Numpy_testing.py
1,873
3.703125
4
import numpy as np a=np.array([0,1,2,3,4]) type(a) #returns numpy.ndarray #as the data in the numpy.ndarry is all of one type then it is a.dtype #returns dtype('int32') a.size #returns 5 a.ndim #returns the number of dimensions or rank of array print(a.shape) # returns a tuple of the size of the array in each dimenti...
7a2bda2ce8776be14af22a7945733902554b56a2
KemengXu/Othello
/othello/board.py
5,843
3.640625
4
class Board: def __init__(self, size): self.occupy = { "black": [], "white": [], "empty": [(i, j)for j in range(size) for i in range(size)] } self.size = size def initial_tile(self): """to put 4 initial tiles in the middle""" center = ...
0f33046da4c87c3f23339de7b7407a217370b62c
AvigailKoll/matala0
/add.py
155
3.8125
4
firstNumber=input('put in first int number') secondNumber=input('put in second int number') sumNumbers=int(firstNumber)+int(secondNumber) print(sumNumbers)
b3afda1168d2fa7d84b1c1bc01405722e7c5ca9d
Shehbab-Kakkar/Waronpython
/arch1/index1.py
310
3.78125
4
#!/usr/bin/python #Filname is index1.py number = [3, 7, 1, 4, 2, 8, 5, 6] print(number.index(5)) number *= 2 # number = number * 2 print(number) print(number.index(5,7)) #start counting index position #of 5 start from the 7 means second 5 print(number.index(7,0, 4)) #index of 7 inbetween 0 and 4 position
cb9cc0d3b499881d0b8798dd39ec38906eeaaf28
Shehbab-Kakkar/Waronpython
/arch1/indexexp.py
305
3.84375
4
#!/usr/bin/python #Filname is indexexp.py list = [67, 12, 46, 43, 13] key1 = 43 key2 = 44 if key1 in list: print(f'{key1} is present at {list.index(key1)}') else: print(f'{key1} not found') if key2 in list: print(f'{key2} is present at {list.index(key2)}') else: print(f'{key2} not found')
b4567494d3606a3c2af0e0fa6f0ab7a8d79f6002
Shehbab-Kakkar/Waronpython
/arch1/dict1.py
205
3.890625
4
#!/usr/bin/python #Filname is dict1.py dict1 = {'A':'aa','B':'bb','C':'cc'} for i in dict1.values(): print(i) for i in dict1.keys(): print(i) for i, j in dict1.items(): print(f'{i} {j}')
7e21b51ec88b79191088614971bbc325fff0fabf
AhhhHmmm/Programming-HTML-and-CSS-Generator
/exampleInput.py
266
4.15625
4
import turtle # This is a comment. turtle = Turtle() inputs = ["thing1", "thing2", "thing3"] for thing in inputs: print(thing) # comment!!! print(3 + 5) # little comment print('Hello world') # commmmmmmm 3 + 5 print("ahhhh") # ahhhh if x > 3: print(x ** 2)
637ae867ecf3e7998e59a27a21d3931b14532927
phyrenight/caesar
/testunit.py
924
3.75
4
from main import shift, convertToList import unittest class testfunctions(unittest.TestCase): def testConvertTolist(self): self.assertEqual(convertToList(None), "No string entered.") self.assertEqual(convertToList(""), "No string entered.") self.assertEqual(convertToList(" "), [" "]) ...
80a36a5d806378611e71176bd3e34097c0b902d5
mahendrathapa/python-basic-ml
/Coursera-ML-AndrewNg/linear-regression/gradiet-descent.py
1,212
3.53125
4
import numpy as np def load_dataset(): dataset = np.genfromtxt('ex1data2.txt', delimiter=',') X = dataset[:,:-1] y = dataset[:, [-1]] X = np.insert(X, 0, 1, axis=1) return X, y def feature_standardization(X): for col in range(1, X.shape[1]): mean = np.mean(X[:, col]) ...
0dff840349408c41a0b51d96577dc4d0b5bd9c32
TSechrist/Codewars
/src/find_missing_letter.py
180
3.71875
4
def find_missing_letter(chars): for i in range(len(chars) - 1): if ord(chars[i]) - ord(chars[i + 1]) != -1: res = chr(ord(chars[i]) + 1) return res
851a08f4d1580cde6c19fb9dbc3dd939d0a7b6f3
vdmitriv15/DZ_Lesson_1
/DZ_5.py
1,604
4.125
4
# Запросите у пользователя значения выручки и издержек фирмы. # Определите, с каким финансовым результатом работает фирма (прибыль — выручка больше издержек, или убыток — издержки больше выручки). # Выведите соответствующее сообщение. Если фирма отработала с прибылью, вычислите рентабельность выручки (соотношение прибы...
df7282d45332baf2d25d9ca1794b55cd802aac6c
evab19/verklegt1
/Source/models/Airplane.py
1,156
4.25
4
class Airplane: '''Module Airplane class Module classes are used by the logic layer classes to create new instances of Airplane gets an instance of a Airplane information list Returns parameters if successful --------------------------------- ''' ...
905df9bcdb837b6e0692e1b2033aff9f72619a45
DrakeDwornik/Data2-2Q1
/quiz1/palindrome.py
280
4.25
4
def palindrome(value: str) -> bool: """ This function determines if a word or phrase is a palindrome :param value: A string :return: A boolean """ result = True value_rev = value[::-1] if value != value_rev: result = False return result
24ce60696eaccae9667d238e13cb3a59d8bcc732
wanf425/MyPython
/com/wt/practice/Collection.py
634
3.921875
4
#!/usr/bin/env python # -*- coding: utf-8 -*- #list alist = [1,'2',['3','4']] print 'alist',alist print 'length',len(alist) print 'index 1 value',alist[1] print 'last value',alist[-1] print 'append',alist.append(5) print 'after append',alist print 'insert',alist.insert(1,6) print 'after insert',alist print 'pop',alist...
2c69df7cf69081ec3e100034c4e7b53c0f01f5e1
NathanKr/pandas-playground
/insert_column.py
278
4.09375
4
import pandas as pd df = pd.DataFrame([] , columns=['col0' , 'col1' , 'col2']) #choose columns df['col0'] = [1,2,3] # set values to existing column df['col1'] = [4,5,6] # set values to existing column df['col2'] = [7,8,9] # set values to existing column print (f'df\n{df}')
b90d2d9aba147a4e71f39610e2ba7ad73f426ede
NathanKr/pandas-playground
/insert_row_at_index.py
717
3.890625
4
from typing import List import pandas as pd def insert_row_to_new_df(i_row : int, df : pd.DataFrame, row : List)->pd.DataFrame: # Slice the upper half of the dataframe # use copy because df[0:i_row] is a view which we update and it is NOT allowed df1 = df[0:i_row].copy() # Store the result of ...
703fe2fe6574d8e38204d238afee5327720345a9
NathanKr/pandas-playground
/compare_dfs.py
598
3.75
4
import pandas as pd df1 = pd.DataFrame([[1, 2, 3, 4], [4, 5, 6 , 7], [7, 8, 9 , 10]], columns=['col1', 'col2', 'col3' , 'col4']) df2 = pd.DataFrame([[1, 2, 3, 4], [4, 5, 6 , 7], [7, 8, 9 , 10]], columns=['col1', 'col2', 'col3' , 'col4']) df3 = pd.DataFrame([[11, 2, 3, 4], [4, 5, 6...
15250c4e99d8133175c5956444b1473f70f194bb
Steven98788/Ch.03_Input_Output
/3.1_Temperature.py
446
4.5
4
''' TEMPERATURE PROGRAM ------------------- Create a program that asks the user for a temperature in Fahrenheit, and then prints the temperature in Celsius. Test with the following: In: 32 Out: 0 In: 212 Out: 100 In: 52 Out: 11.1 In: 25 Out: -3.9 In: -40 Out: -40 ''' print("Welcome to my Fahrenheit to Celsius ...
6fbce57e72e72e2260039c0b9089bc505f3539ad
geekprateek/cs101
/Unit 7/1 Longest repitition.py
1,585
4.03125
4
# Question 8: Longest Repetition # Define a procedure, longest_repetition, that takes as input a # list, and returns the element in the list that has the most # consecutive repetitions. If there are multiple elements that # have the same number of longest repetitions, the result should # be the one that appears fi...
d0131f70c30f32dcca2bab05dd8852d38376e50a
geekprateek/cs101
/Unit 3/Sum list.py
553
3.90625
4
# Define a procedure, sum_list, # that takes as its input a # list of numbers, and returns # the sum of all the elements in # the input list. def sum_list(in_val): v_sum = 0 for test in in_val: v_sum = v_sum + test return v_sum def new_sum_list(p): result = 0 for e in p: result = r...
cc4d9d7f9567124a453c6fb1ae894d5996e20e4f
geekprateek/cs101
/Unit 6/Faster Fibo.py
247
3.875
4
#Define a faster fibonacci procedure that will enable us to computer #fibonacci(36). def fibonacci(n): v_n1 = 0 v_n2 = 1 for i in range(0, n): v_n1, v_n2 = v_n2, v_n1 + v_n2 return v_n1 print fibonacci(36) #>>> 14930352
27963142d7ea42c015716c2b879ac2c049e4afa9
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Ersan/soru6.py
99
3.515625
4
a = int(input("A:")) b = int(input("B:")) c = ((a ** 2 + b ** 2) ** 0.5) print("Hipotenüs:",c)
086827ea32ce78e70e1fa31ab62861b34cb941ae
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Alpertolgadikme/soru15.py
314
3.921875
4
sayi1 = int(input("1. Sayı: ")) sayi2 = int(input("2. Sayı: ")) sayi3 = int(input("3. Sayı: ")) if (sayi1 >= sayi2) and (sayi1 >= sayi3): buyuk = sayi1 elif (sayi2 >= sayi1) and (sayi2 >= sayi3): buyuk = sayi2 else: buyuk = sayi3 print(sayi1,",",sayi2,"ve",sayi3,"içinde büyük olan sayı",buyuk)
d22159d6574cad9ffeb39abfb57fbf4ce4694614
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Haydar/soru4.py
184
4.0625
4
yakıt=float (input ("Aracın ne kadar yaktığını girin:")) km= float (input ("Aracın kaç kilometre yol yaptığını girin:")) print("Toplam ödenmesi gereken ücret:",yakıt*km)
1b3b2de13de22e7829b0715935ef9e7e0df89c4d
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Ersan/mukemmel.py
323
3.921875
4
print("""\nMükemmel Sayıyı Bulma Programı --------------------------------------""") sayi = int(input("Lütfen bir sayı giriniz: ")) toplam = 0 for i in range(1,sayi): if (sayi %i == 0): toplam += i if (sayi == toplam): print("Bu Mükemmel Sayıdır") else: print("Bu Mükemmel Sayı Değildir")
17c5b3c6316bc38c01ed66167428f58b9d05c4b0
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Alpertolgadikme/Ödev1.py
119
3.75
4
km=int(input("Kaç km yol gidildi:")) yakit=float(input("Araç km kaç kuruş yaktı:")) print("Toplam tutar",km*yakit)
47f01032f8856736e2676954ac227c00bd018947
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Alpertolgadikme/soru13h.py
845
3.84375
4
print(""" HESAP MAKİNESİ TOPLAMA İŞLEMİ YAPMAK İÇİN 1 'e BASIN. ÇIKARMA İŞLEMİ YAPMAK İÇİN 2 'e BASIN. ÇARPMA İŞLEMİ YAPMAK İÇİN 3 'e BASIN. BÖLME İŞLEMİ YAPMAK İÇİN 4 'e BASIN. """) islem = input("İşlem seçiniz: ") if islem == "1": sayi1 = int(input("sayi1 giriniz: ")) sayi2 = int(input("sayi2 giriniz:...
3069ea9d425a72d8cdf497a084b6e227fae4ebc6
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Ersan/faktoriyel.py
148
3.921875
4
while(True): sayi = int(input("Bir sayı Giriniz: ")) fak = 1 for i in range(2,sayi+1): fak*= i print("Faktöriyel= ", fak)
50994b599b3c8928274159261d63a727e050bf0d
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Burcu/02DONGULER/dongulerspru6.py
139
3.65625
4
#1'den 100'e kadar olan çift sayıları listeye atalım. even=[] for n in range(1,101): if n%2==0: even.append(n) print(even)
34e8040dfc5102fd1d34f74e25c74424cb80bd14
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Ekrem/kullanıcıgirişi.py
568
3.703125
4
print("-------Kullanıcı Girişi---------") kullaniciAdi="Ekrem" parola="369258" username=input("Kullanıcı Adınızı Giriniz") password=input("Parolanızı Giriniz") if username==kullaniciAdi and password==parola: print("Tebrikler başarılı giriş yaptınız.") elif username!=kullaniciAdi and password==parola: print(...
8d4a16a3b136c2a3180ee6ebdb71a9b8f17ed7b9
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Varol/dongulersoru4.py
164
3.84375
4
toplam=0 while True: sayi=input("Bir sayı giriniz:") if (sayi=="q"): break toplam+=int(sayi) print("Girdiğiniz sayıların toplamı:",toplam)
be691b15a1b6ae664498d24c31017fe143536ab1
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Eren/soru3.py
212
3.578125
4
a=int(input("1. Sayıyı giriniz : ")) b=int(input("2. Sayıyı giriniz : ")) sonuc=a,b = b,a print("----Yeni Hali------") print("a =",a) print("b =",b) print("-----Eski Hali-----") print("a =",b) print("b =",a)
ab9b570ae1bcba6c3f6c6a4d4e1eb98bbbd6d083
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Ersan/armstrong.py
472
3.765625
4
while True: sayi=input("LÜtfen Bir Sayı Giriniz. (Çıkmak için 'q' ya basın.) : ") if sayi.lower()=="q": print("Oyundan çıktınız. Yine bekleriz.") break uzunluk=len(sayi) toplam=0 for i in range(uzunluk): toplam = toplam + int(sayi[i])**uzunluk if(toplam==int(s...
e326533c4fb3975831b1caa28928e996e1c99dcc
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Varol/whiledonugusu.py
56
3.53125
4
x=0 while (x<10): print("x'nin değeri:",x) x+=1
1d0d0313e1a5adcc857596138cd236ed6dd7298e
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Fatih/init.py
850
3.5
4
class Yazilimci(): def __init__(self,isim,soyisim,sicil,maas,diller): self.isim=isim self.soyisim=soyisim self.sicil=sicil self.maas=maas self.diller=diller def bilgileriGoster(self): print(""" Çalışan Bilgisi: İsim: {} So...
9ab10061e29fc0601bda77d55c2686f1644465e6
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Alpertolgadikme/Ödev3.py
101
3.703125
4
a=int(input("a kenarı :")) b=int(input("b kenarı :")) c=(a**2+b**2) print("Hipotenüs Uzunluğu",c)
03e0469f883183238c9ae49103dd5f7a2074c694
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Burcu/02DONGULER/kullaniciadidöngü.py
578
3.734375
4
print(""" -------------KULLANICI GİRİŞ EKRANI---------- """) Kullaciadi_ID = "Kullanici" Kullaciadi_PW= "123" kullanici_adi = input("Kullanıcı Adını Giriniz: ") sifre = input("Şifre'yi Giriniz: ") if (kullanici_adi == Kullaciadi_ID) and (sifre != Kullaciadi_PW): print("Dikkat Şifre Yanlış..!!") elif (kullanic...
97e19b265205e7ef2959534256af4b6c05bac251
ProEgitim/Python-Dersleri-BEM
/Ogrenciler/Eren/soru5.py
331
3.859375
4
print("Kullanıcıdan İstenilen Bilgileri(Ad,SoyAd,Numara) Bilgilerini Alt Alta Yazdırma İşlemi.") print("---------------------------------------------------------------------------------------") a=input("Adınızı Giriniz : ") b=input("Soy Adınızı Giriniz : ") c=int(input("Numaranızı Giriniz : ")) print(a,b,c,sep="\n")
f7612c53c7f064899443a632a91bf62123c37814
jmoehler/CityDistance
/distanceEx.py
932
3.53125
4
from distance import distance, tempDiff def distExample(): from City import City stg = City("Stg", 48.7758459, 9.1829321, 22) #Stuttgart ber = City("Ber", 52.521918, 13.413215, 21) #Berlin ham = City("Ham", 53.551085, 9.993682, 24) #Hamburg nür = City("Nür", 49.452030, 11.076750, 22) ...
d1d750a8f2b2d0ce135a2e35856ca292a48caa6a
akashggupta/Nueral-Networks
/bill_authentication.py
5,240
3.640625
4
import pandas as pd import numpy as np from sklearn.model_selection import train_test_split # 4 layered nueral network (3 hidden layer +1 output layer) # getting the data data = pd.read_csv("bill_authentication.csv") x = data.drop(data.columns[-1], axis=1, inplace=False) y = data.drop(data.columns[range(4)], a...