blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
398b2c5fc86987fa9332c3b2d4ac23a8d1ff7a1d
ToxicMushroom/bvp-python
/oefenzitting 3/exercise3.py
264
4.15625
4
number = int(input("Enter a number: ")) total = 0 flipper = True while number != 0: if flipper: total += number flipper = False else: total -= number flipper = True number = int(input("Enter a number: ")) print(total)
false
ff983f0996b4abffdfa420f9449f95aa47097011
xXPinguLordXx/py4e
/exer11.py
234
4.125
4
def count (word, char): char_count = 0 for c in word: if c == char: char_count += 1 return char_count # occurences inp_word = input ("Enter word: ") inp_char = input ("Enter char: ") print (count)
true
2b2260baa8a63839a1d3feeabfc645cf52ef7761
xXPinguLordXx/py4e
/exer8.py
768
4.28125
4
#declare this shit outside the loop because if you put it inside it will just get looped forever #declare this outside so that it is accessible by the entire program outside and not just within the loop sum = 0 count = 0 while True: number = input ("Enter a number: ") if number == 'done': break tr...
true
e3d5c813c35e2ba8683d5404fa936e862a7e35f3
mileuc/breakout
/paddle.py
725
4.1875
4
# step 2: create paddle class from turtle import Turtle class Paddle(Turtle): # paddle class is now effectively the same as a Turtle class def __init__(self, paddle_position): super().__init__() # enable Turtle methods to be used in Ball class self.shape("square") self.color("white") ...
true
b5b34dd6187ea0358c49522a15939bfa5a2367a7
karuneshgupta/python-prog
/patterns.py
1,569
4.1875
4
#squares for row in range (1,5): for column in range (1,5): print("*",end=" ") print() #triangle pyramid for row in range (1,5): for column in range(1,row+1): print("*",end=" ") print() # reverse triangle pyramid for row in range(1,5): for column in range(row,5): print("*",en...
false
6ff3d2c4c52c4ed4c0543b81eb97a4e59e6babeb
vishalkmr/Algorithm-And-Data-Structure
/Searching/Binary Search(Ascending Order).py
1,134
4.15625
4
''' Binary Search on Ascending order Lists Assume that list is in Ascending order Note : Binary search is aplicable only when list is sorted ''' def binary_search(list,item): ''' funtion for binary search of element in list synatx: binary_search( list,item) retrun index of element where the item is...
true
edd37b42b381dfc85b5f443b79e151f7225b9201
vishalkmr/Algorithm-And-Data-Structure
/Arrays & Strings/Array Pair Sum.py
2,761
4.40625
4
''' Given an integer array, output all the unique pairs that sum up to a specific value k. Example pair_sum([1,2,3,4,5,6,7],7) Returns: (3, 4), (2, 5), (1, 6) ''' #using Sorting def pair_sum(list,k): ''' Funtion return all the unique pairs of list elements that sum up to k Syntax: insert(list,k) Time Complexity...
true
aba4633ded621a38d9a0dd4a6373a4b70ee335d9
vishalkmr/Algorithm-And-Data-Structure
/Linked Lists/Rotate Right.py
1,755
4.40625
4
''' Rotates the linked-list by k in right side Example: link-list : 1,2,3,4,5,6 after 2 rotation to right it becomes 5,6,1,2,3,4 ''' from LinkedList import LinkedList def rotate_right(linked_list,k): """ Rotates the linked-list by k in right side Syntax: rotate_right(linked_list,k) Time Complex...
true
bac0d9c2b34bf891722e468c11ff0f615faef1fc
vishalkmr/Algorithm-And-Data-Structure
/Arrays & Strings/Missing element.py
1,576
4.28125
4
''' Consider an array of non-negative integers. A second array is formed by shuffling the elements of the first array and deleting a random element. Given these two arrays, find which element is missing in the second array. Example : The first array is shuffled and the number 5 is removed to construct the second ...
true
23ad168cebd9f937871f8ef52f0822387308dbc5
vishalkmr/Algorithm-And-Data-Structure
/Trees/Mirror Image.py
1,639
4.34375
4
''' Find the Mirror Image of a given Binary tree Exapmle : 1 / \ 2 3 / \ / \ 4 5 6 7 Mirror Image : 1 / \ 3 2 / \ / \ 7 6 5 4 ''' from TreeNod...
true
8f8ba9c1a6e13d1527f0c3ac5c2a72dc330a0321
vishalkmr/Algorithm-And-Data-Structure
/Sorting/Bubble Sort.py
2,203
4.5625
5
''' SORT the given array using Bubble Sort Example: Let us take the array of numbers "5 1 4 2 8", and sort the array in ascending order using bubble sort. First Pass ( 5 1 4 2 8 ) -> ( 1 5 4 2 8 ), Here, algorithm compares the first two elements, and swaps since 5 > 1. ( 1 5 4 2 8 ) -> ( 1 4 5 2 8 ), Swap sin...
true
30a98b2f034a60422a2faafbd044628cd1011e43
vishalkmr/Algorithm-And-Data-Structure
/Arrays & Strings/Max and Min(Recursion).py
1,108
4.40625
4
''' Find the maximum and minimum element in the given list using Recursion Example max_min([11,-2,3,6,14,8,16,10]) Returns: (-2, 16) ''' def max_min(list,index,minimum,maximum): ''' Funtion to return maximum and minimum element in the given list Syntax: max_min(list,index,minimum,maximum) Time Complexity: O...
true
4106cc2dccfacb7322a9e00a440321b30d224e30
vishalkmr/Algorithm-And-Data-Structure
/Searching/Ternary Search.py
1,860
4.46875
4
''' Ternary Search on lists Assume that list is already in Ascending order. The number of Recursive Calls and Recisrion Stack Depth is lesser for Ternary Search as compared to Binary Search ''' def ternary_search(list,lower,upper,item): ''' Funtion for binary search of element in list Synatx: ternary_search...
true
29c60efe0b91a9c74c2eebe4d9ce599a8c52ba7f
vishalkmr/Algorithm-And-Data-Structure
/Linked Lists/Cyclic.py
1,733
4.21875
4
''' Check the given limked-list is cyclic or not ''' from LinkedList import LinkedList #using Set def is_cyclic(linked_list): """ Returns True if linked-list is cyclic Syntax: is_cyclic(linked_list) Time Complexity: O(n) """ # if linked-list is empty if not linked_list.hea...
true
ea402428794a71e381266fdac172b0f6a2e5b105
prpratheek/Interview-Problem-Statements-HacktoberFest2020
/Power_Function.py
417
4.34375
4
def power(x, y): res = 1 while (y > 0): # If y is odd, multiply # x with result if ((y & 1) == 1) : res = res * x # n must be even # now y = y/2 y = y >> 1 # Change x to x^2 x = x * x ...
false
967ac148b13a59295b9c16523e6e046ffd000950
PdxCodeGuild/Full-Stack-Day-Class
/practice/solutions/ttt-interface/list_board.py
1,184
4.1875
4
"""Module containing a list of lists tic-tac-toe board implementation.""" class ListListTTTBoard: """Tic-Tac-Toe board that implements storage as a list of rows, each with three slots. The following board results in the following data structure. X| | |X|O | | [ ['X', ' ', ' '],...
true
dcc6eac9a830867df9b8bf1dbc28c592c4458990
priyankamadhwal/MCA-101-OOP
/14- bubbleSort.py
1,139
4.28125
4
def swap(lst, lowerIndex=0, pos=0): ''' OBJECTIVE : To swap the elements of list so that the largest element goes at the lower index. INPUT : lst : A list of numbers. lowerIndex : The lower index upto which swapping is to be performed. OUTPUT : List, with the correct el...
true
16bc2814112b7bd4fad04457af0ba79ccf21e68a
soumilk91/Algorithms-in-Python
/Mathematical_algorithms/calculate_fibo_number.py
1,414
4.21875
4
""" @ Author : Soumil Kulkarni This file contains various methods related to problems on FIBO Series """ import sys # Method to calculate the fibo number recursively def calculate_fibo_number_recursive(num): if num < 0: print "Input incorrect" elif num == 0 : return 0 elif num == 1 : return 1 else : re...
true
8358b7abc87c5062eeb4b676eb1091b5d6d897ba
abhijit-nimbalkar/Python-Assignment-2
/ftoc.py
530
4.125
4
#Author-Abhijit Nimbalkar & Sriman Kolachalam import Functions #importing Functions.py file having multiple functions temp_in_F=Functions.check_temp_input_for_F("Enter the Temperature in Fahrenheit: ") #Calling function check_temp_input_for_F() for accepting the valid input from User ...
true
685d18829d1197fa5471cfed83446b14af65789e
hsuvas/FDP_py_assignments
/Day2/Q6_FibonacciRecursion.py
263
4.25
4
#6. fibonacci series till the Nth term by using a recursive function. def fibo(n): if n<=1: return n else: return (fibo(n-1)+fibo(n-2)) n=int(input("How many numbers: ")) print("Fibonacci series: ") for i in range(n): print(fibo(i))
true
99bb6059454cf462afbe9bfc528b8ea6d9d84ecb
hsuvas/FDP_py_assignments
/Day2/Q3_areaCircumference.py
279
4.5
4
#3.compute and return the area and circumference of a circle. def area(r): area=3.14*r*r return area def circumference(r): c=2*3.14*r return c r=float(input("enter the radius")) a=area(r) print("area is: ",a) cf=circumference(r) print("Circumference is: ",cf)
true
db52166c1da16e74c737522bf01ccbc2e3a5331b
jared0169/Project_Euler_Code
/PE_Problem4.py
563
4.1875
4
# File: PE_Problem4.py # # Finds the largest palindrome that results from the multiplication # of two three digit numbers. import string def main(): i = 100 j = 101 largest_palindrome = 0 for i in range(100,999): for j in range(100,999): ## print "Forwards: " + str(i*j) ## ...
false
edb63793a549bf6bf0e4de33f86a7cefb1718b57
onionmccabbage/python_april2021
/using_logic.py
355
4.28125
4
# determine if a number is larger or smaller than another number a = int(float(input('first number? '))) b = int(float(input('secomd number? '))) # using 'if' logic if a<b: # the colon begins a code block print('first is less than second') elif a>b: print('second is less than first') else: pr...
true
ee715cb90cf4724f65c0f8d256be926b66dc1ddb
onionmccabbage/python_april2021
/fifo.py
1,739
4.1875
4
# reading adnd writing files file-input-file-output # a simple idea is to direct printout to a file # fout is a common name for file output object # 'w' will (over)write the file 'a' will append to the file. 't' is for text (the default) fout = open('log.txt', 'at') print('warning - lots of interesting loggy st...
true
4417ee4d4251854d55dd22522dfef83a0f55d396
VadymGor/michael_dawson
/chapter04/hero's_inventory.py
592
4.40625
4
# Hero's Inventory # Demonstrates tuple creation # create an empty tuple inventory = () # treat the tuple as a condition if not inventory: print("You are empty-handed.") input("\nPress the enter key to continue.") # create a tuple with some items inventory = ("sword", "armor", ...
true
6d19be295873c9c65fcbb19b9adbca57d700cb64
vedk21/data_structure_playground
/Arrays/Rearrangement/Pattern/alternate_positive_negative_numbers_solution.py
1,882
4.125
4
# Rearrange array such that positive and negative elements are alternate to each other, # if positive or negative numbers are more then arrange them all at end # Time Complexity: O(n) # Auxiliary Space Complexity: O(1) # helper functions def swap(arr, a, b): arr[a], arr[b] = arr[b], arr[a] return arr def righ...
true
e149ad4cc8b69c2addbcc4c5070c00885d26726d
KyrillMetalnikov/HelloWorld
/Temperature.py
329
4.21875
4
celsius = 10 fahrenheit = celsius * 9/5 + 32 print("{} degrees celsius is equal to {} degrees fahrenheit!".format(celsius, fahrenheit)) print("Roses are red") print("Violets are blue") print("Sugar is sweet") print("But I have commitment issues") print("So I'd rather just be friends") print("At this point in our relati...
true
c018cea22879247b24084c56731289a2a0f789f5
abhay-jindal/Coding-Problems
/Minimum Path Sum in Matrix.py
1,409
4.25
4
""" MINIMUM PATH SUM IN MATRIX https://leetcode.com/problems/minimum-path-sum/ https://www.geeksforgeeks.org/min-cost-path-dp-6/ Given a m x n grid filled with non-negative numbers, find a path from top left to bottom right, which minimizes the sum of all numbers along its path. Note: You can only move either do...
true
a711681f3168d9f733694126d0487f60f39cdf56
abhay-jindal/Coding-Problems
/Linked List Merge Sort.py
1,275
4.21875
4
""" LINKEDLIST MERGE SORT """ # Class to create an Linked list with an Null head pointer class LinkedList: def __init__(self): self.head = None # sorting of linked list using merge sort in O(nlogn) time complexity def mergeSort(self, head): if head is None or head.next is None: ...
true
c2c19d072b086c899b227646826b7ef168e24a78
abhay-jindal/Coding-Problems
/Array/Zeroes to Left & Right.py
1,239
4.125
4
""" MOVE ZEROES TO LEFT AND RIGHT IN ARRAY https://leetcode.com/problems/move-zeroes/ Given an integer array nums, move all 0's to the end of it while maintaining the relative order of the non-zero elements. Note that you must do this in-place without making a copy of the array. Time complexity: O(n) """ def zeros...
true
952943db49fe23060e99c65a295d35c1aff7c7d5
abhay-jindal/Coding-Problems
/LinkedList/check_palindrome.py
2,523
4.21875
4
""" Palindrome Linked List https://leetcode.com/problems/palindrome-linked-list/ https://www.geeksforgeeks.org/function-to-check-if-a-singly-linked-list-is-palindrome/ Given a singly linked list of characters, write a function that returns true if the given list is a palindrome, else false. """ from...
true
9be41506dd4300748e2b37c19e73cd4e62d107f7
abhay-jindal/Coding-Problems
/LinkedList/last_nth_node.py
1,537
4.28125
4
""" Clockwise rotation of Linked List https://leetcode.com/problems/rotate-list/ https://www.geeksforgeeks.org/clockwise-rotation-of-linked-list/ Given a singly linked list and an integer K, the task is to rotate the linked list clockwise to the right by K places. """ from main import LinkedList #...
true
45eb0065c98e74c6502b973fc234b6a19ffed92a
bakossandor/DataStructures
/Stacks and Queues/single_array_to_implement_3_stacks.py
910
4.28125
4
# describe how would you implement 3 stack in a single array # I would divide the array into 3 spaces and use pointer to mark the end of each stack # [stack1, stack1, stack2, stack2, stack3, stack3] # [None, None, "1", None, "one", "two"] class threeStack: def __init__(self): self.one = 0 self.two...
true
b86d42a1ed8bd87ddae179fda23d234096459e0c
bakossandor/DataStructures
/LinkedLists/linked_list.py
2,278
4.28125
4
# Implementing a Linked List data structure class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def add(self, val): new_node = Node(val) if self.head is not None: new_node.next...
true
0578c44f2473824f40d21139c27241366873de41
AnnaLupica/Election-Analysis
/xArchive/Python-practice.py
1,591
4.34375
4
#Creating list counties=["Arapahoe", "Denver", "Jefferson"] print(counties[2]) for county in counties print(county) #Insert new item in list counties.append("El Paso") counties.insert(2,"El Paso") #Remove item from list counties.remove("El Paso") counties.pop(3) print(counties) #Change item in list counties[2]...
false
97d430a520e681cd8a0db52c1610436583bf9889
raj-rox/Coding-Challenges
/hurdle.py
946
4.125
4
#1st attempt. DONE. bakwaas #https://www.hackerrank.com/challenges/the-hurdle-race/problem #!/bin/python3 import math import os import random import re import sys # # Complete the 'hurdleRace' function below. # # The function is expected to return an INTEGER. # The function accepts following parameters:...
true
8d13f16e031bc71d3456e97ec3f98ce81ffe168f
tanbir6666/test-01
/python inside/python list comps 3h 3m.py
1,336
4.15625
4
names=["tanbir","taohid","tayeb","Robin","Amir"] empty_list=[] def loop(loopItem): for x in loopItem: print(x) for person in names: empty_list.append(person) print(empty_list) empty_list.clear() print(empty_list) print([person for person in names]) empty_list.clear() for person in na...
false
6f134495fa15c220c501a82206a33839d0083079
tanbir6666/test-01
/starting codes/python after 1 hour.py
808
4.21875
4
newString="hello Tanbir"; print(type(newString)); newstring_value= newString[5:] print(newstring_value); print(newstring_value.upper()); print(newstring_value.lower()); print(newstring_value.replace("Tanbir", "Taohid")) print(newstring_value); #replace string whatTosay=newString.replace("hello","how are you"); pri...
true
9c6627692d958ddf64b87aaa495ce7e315dc8e8f
simon-fj-russell/ds_python
/linear_regression.py
2,509
4.1875
4
# Linear Regression model using stats models # First import the modules import pandas as pd import statsmodels.api as sm import seaborn as sns import matplotlib.pyplot as plt sns.set() # User made functions # Use Stats models to train a linear model # Using OLS -> ordinary least squares def train_lr_model(x, y): #...
true
2e8a17d29fd352af98d0cc4b2b53d9d543601f6a
trenton1199/Python-mon-K
/Reminder.py
2,157
4.34375
4
from datetime import date import os def pdf(): pdf = input(f"would you like to turn {file_name} into a pdf file? [y/n] ").lower() if pdf == 'y': pdf_name = input("what would you like the pdf file to be named ") + ".pdf" font_size = int(input("what would you like your font size to be?")) ...
true
2dfad5d7fcf6789c93002064f621691677899758
kraftpunk97-zz/Fundamentals-ML-Algos
/k_means.py
2,338
4.1875
4
#! /usr/local/bin/python3 '''Implementing the k-Means Clustering Algorithm from scratch''' import numpy as np import matplotlib.pyplot as plt import pandas as pd def kmeans(dataset, num_clusters=3, max_iter=10): ''' The k-means implemention ''' m, n = dataset.shape cluster_arr = np.zeros(dtype=in...
true
ab87e9277d7605bb7353c381f192949b40abcc49
rprustagi/EL-Programming-with-Python
/MT-Python-Programming/MT-Programs/hanoi.py
2,368
4.5
4
#!/usr/bin/env python3 """ turtle-example-suite: tdemo_minimal_hanoi.py A minimal 'Towers of Hanoi' animation: A tower of N discs is transferred from the left to the right peg. The value of N is specified by command line argument An imho quite elegant and concise implementation using a tower class, wh...
true
94fd0458b2282379e6e720d07581fd15467d0581
Anirban2404/HackerRank_Stat
/CLT.py
2,013
4.125
4
#!/bin/python import sys ''' A large elevator can transport a maximum of 9800 pounds. Suppose a load of cargo containing 49 boxes must be transported via the elevator. The box weight of this type of cargo follows a distribution with a mean of 205 pounds and a standard deviation of 15 pounds. Based on this in...
true
4aa692633576198ea6580dfd97e2b068d5dbe920
AbhijeetDixit/MyAdventuresWithPython
/OOPython/ClassesExample2.py
1,927
4.34375
4
''' This example shows the use of multiple classes in a single program''' class City: def __init__(self, name): self.name = name self.instituteCount = 0 self.instituteList = [] pass def addInstitute(self, instObj): self.instituteList.append(instObj) self.instituteCount += 1 def displayInstitute(self)...
true
957f18f7ef13a92229a7014300a859319eebae1b
SharukhEqbal/Python
/fibonacci_with_generators.py
483
4.34375
4
# Fibonacci series 1,1,2,3,5,8,... using generators def get_fibonacci(): a = 1 b = 1 for num in range(5): yield a # this will remember the value of a for next iteration a,b = b, a + b [i for i in get_fibonacci()] """ o/p: [1, 1, 2, 3, 5] def get_fibonacci_without_generator(): a = ...
false
8720d528fb634c4a61eeb5b33a3405ee87883ada
Siddhant-Sr/Turtle_race
/main.py
1,006
4.21875
4
from turtle import Turtle, Screen import random race = False screen = Screen() screen.setup(width= 500, height= 400) color = ["red", "yellow", "purple", "pink", "brown", "blue"] y = [-70, -40, -10, 20, 50, 80] bet = screen.textinput(title="make your bet", prompt="Which turtle will win the race? Enter a color") all_tur...
true
3c7665bbadb5ae2903b9b5edfda93d3a78ada475
dgupta3102/python_L1
/PythonL1_Q6.py
916
4.25
4
# Write a program to read string and print each character separately. # a) Slice the string using slice operator [:] slice the portion the strings to create a sub strings. # b) Repeat the string 100 times using repeat operator * # c) Read string 2 and concatenate with other string using + operator. Wo...
true
347ac39407381d1d852124102d38e8e9f746277f
dgupta3102/python_L1
/PythonL1_Q19.py
969
4.21875
4
# Using loop structures print even numbers between 1 to 100. # a) By using For loop, use continue/ break/ pass statement to skip odd numbers. # i) Break the loop if the value is 50 print("part 1a --------------") for j in range(1, 101): if j % 2 != 0: # checks the number is Odd and Pass pass ...
true
ec2ae4d1db1811fcca703d6a35ddf1732e481e2a
riteshrai11786/python-learning
/InsertionSort.py
1,600
4.40625
4
# My python practice programs # function for sorting the list of integers def insertion_sort(L): # Loop over the list and sort it through insertion algo for index in range(1, len(L)): # define key, which is the current element we are using for sorting key = L[index] # Move elements of a...
true
ad2a9e7d7696c0f62a1f989344f98ebcea07abdd
murilonerdx/exercicios-python
/Exercicio_Lista/exercicio_15.py
507
4.25
4
nome = input("Digite o nome: ") nota1 = float(input("Digite a sua primeira nota: ")) nota2 = float(input("Digite a segunda nota: ")) nota3 = float(input("Digite a terceira nota: ")) nf = float(input("Digite o numero de faltas: ")) notaresult = (nota1+nota2+nota3)/3 faltas = 0,25 * nf if (notaresult >= 7 and fa...
false
397a6b557c529b95c4084680b596d8781efd8244
NatalieMiles/shopping_list_project
/shopping_list_project.py
1,833
4.40625
4
# target_list = ["socks", "soap", "detergent", "sponges"] # bi_rite_list = ["butter", "cake", "cookies", "bread"] # berkeley_bowl_list = ["apples", "oranges", "bananas", "milk"] # safeway_list = ["oreos", "brownies", "soda"] shopping_list = { "target": ["socks", "soap", "detergent", "sponges"], "bi_rite": ...
false
93481419afcb5937eca359b323e038e7e29c6ad9
rzfeeser/20200831python
/monty_python3.py
1,075
4.125
4
#!/usr/bin/python3 round = 0 answer = " " while round < 3: round += 1 # increase the round counter by 1 answer = input('Finish the movie title, "Monty Python\'s The Life of ______": ') # transform answer into something "common" to test answer = answer.lower() # Correct Answer if answe...
true
4c5a2f9b26e6d4fa7c3250b3043d1df5865b76c8
g-boy-repo/shoppinglist
/shopping_list_2.py
2,162
4.5
4
# Have a HELP command # Have a SHOW command # clean code up in general #make a list to hold onto our items shopping_list = [] def show_help(): #print out instructions on how to use the app print("What should we pick up at the store?") print(""" Enter 'DONE' to stop addig items. Enter 'HELP' for this help...
true
e5dbac6cd3ba92049b640e62c1bf96fb61b6ca03
sankar-vs/Python-and-MySQL
/Data Structures/Tuple/6_Check_element_exists.py
280
4.1875
4
''' @Author: Sankar @Date: 2021-04-11 09:27:25 @Last Modified by: Sankar @Last Modified time: 2021-04-11 09:32:09 @Title : Tuple_Python-6 ''' ''' Write a Python program to check whether an element exists within a tuple. ''' tuple = ("Heyya", False, 3.2, 1) print("Heyya" in tuple)
false
3edf29f645ecb4af1167359eab4c910d47c40805
sankar-vs/Python-and-MySQL
/Data Structures/Basic Program/41_Convert_to_binary.py
519
4.3125
4
''' @Author: Sankar @Date: 2021-04-08 15:20:25 @Last Modified by: Sankar @Last Modified time: 2021-04-08 15:27:09 @Title : Basic_Python-41 ''' ''' Write a Python program to convert an integer to binary keep leading zeros. Sample data : 50 Expected output : 00001100, 0000001100 ''' decimal = 50 print("Convertion to bin...
true
67bdb85c94a8874623c89d0ac74a9b1464e5c391
sankar-vs/Python-and-MySQL
/Data Structures/List/8_Find_list_of_words.py
739
4.5
4
''' @Author: Sankar @Date: 2021-04-09 12:36:25 @Last Modified by: Sankar @Last Modified time: 2021-04-09 12:42:09 @Title : List_Python-8 ''' ''' Write a Python program to find the list of words that are longer than n from a given list of words. ''' n = 3 list = ['Hi','Sankar','How','are','you',"brotha"] def countWord...
true
1e16341185e46f060a7a50393d5ec47275f6b009
sankar-vs/Python-and-MySQL
/Data Structures/List/3_Smallest_number.py
440
4.15625
4
''' @Author: Sankar @Date: 2021-04-09 12:07:25 @Last Modified by: Sankar @Last Modified time: 2021-04-09 12:13:09 @Title : List_Python-3 ''' ''' Write a Python program to get the smallest number from a list. ''' list = [1,2,3,4,6,10,0] minimum = list[0] for i in list: if (minimum>i): minimum = i print("Min...
true
08a53c3d25d935e95443f1dfa3d2cefdd10237fb
sankar-vs/Python-and-MySQL
/Data Structures/Array/4_Remove_first_element.py
482
4.1875
4
''' @Author: Sankar @Date: 2021-04-09 07:46:25 @Last Modified by: Sankar @Last Modified time: 2021-04-09 07:51:09 @Title : Array_Python-4 ''' ''' Write a Python program to remove the first occurrence of a specified element from an array. ''' array = [] for i in range(5): element = int(input("Enter Element {} in arr...
true
2b3f22bb3fcad13848f40e0c938c603acb2f3959
sankar-vs/Python-and-MySQL
/Functional Programs/Distance.py
1,357
4.28125
4
''' @Author: Sankar @Date: 2021-04-01 09:06:25 @Last Modified by: Sankar @Last Modified time: 2021-04-02 12:25:37 @Title : Euclidean Distance ''' import re def num_regex_int(x): ''' Description: Get input from user, check whether the input is matching with the pattern expression, if True then re...
true
55f9b7cd0aa5a2b10cd819e5e3e6020728e2c670
Dilshodbek23/Python-lessons
/38_4.py
366
4.4375
4
# Python Standard Libraries # The user was asked to enter a phone number. The entered value was checked against the template. import re regex = "^[\+]?[(]?[0-9]{3}[)]?[-\s\.]?[0-9]{3}[-\s\.]?[0-9]{4,6}$" phone = input("Please enter phone number: ") if re.match(regex, phone): print(f"phone: {phone}") el...
true
38c79868e60d20c9a6d5e384b406c3656f565ffb
Haldgerd/Simple_coffee_machine_project
/main.py
2,305
4.5
4
""" An attempt to simulate a simple coffee machine and it's functionality. This version is used as in depth exercise, before writing same program using OOP later within the programming course. The main requirements where: 1. Output a report on resources. 2. Receive user input, referring to type of coffee they want. 3....
true
2370915fa2514143fc56ea1e055b70805d22d170
samaracanjura/Coding-Portfolio
/Python/Shapes.py
996
4.375
4
#Samara Canjura #shapes.py #Finding the area and perimeter of a square, and finding the circumference and area of a circle. import math # Python Library needed for access to math.pi and math.pow def main(): inNum = getInput("Input some number: ") while inNum != 0: #Loop ends when zer...
true
7bd0888085542859d08f395731cbfdfc04d1edf7
evaristofm/curso-de-python
/pythonteste/aula08.py
267
4.15625
4
from math import sqrt import emoji num = int(input('Digite um número: ')) raiz = sqrt(num) print('A raiz de {} é igual a {}'.format(num, raiz)) print(emoji.emojize("Olá, Mundo :alien:", use_aliases=True)) print(emoji.emojize('Python is :cry:', use_aliases=True))
false
74c00f287ec85a3a8ac0b3b9fd8f3d0bd6babe70
psmzakaria/Practical-1-2
/Practical2Q1.py
478
4.125
4
# Question 1 # Write codes for the incomplete program below so that it sums up all the digits in the integer variable num (9+3+2) and displays the output as a sum. num = int(input("Enter your Number Here")) print(num) # Getting the first digit number digit1 = int(num/100) print(digit1) # Getting the second digit n...
true
db25359cb2fb8c20efd6093a0392a5c1dd455abc
ZohanHo/ClonePPZ
/all python/lesson 23.py
1,308
4.28125
4
"""""" """Функция zip - В Pyhon функция zip позволяет пройтись одновременно по нескольким итерируемым объектам (спискам и др.):""" a = [10, 20, 30, 40] b = ['a', 'b', 'c', 'd', 'e'] for i, j in zip(a, b): print(i, j) # 10 a # 20 b # 30 c # 40 d """ Здесь выражение zip(a, b) создает объект-итератор, из которого...
false
a071904bc233e29d20c406bbe5d3305c248a3d5b
ZohanHo/ClonePPZ
/all python/lesson 65.py
2,416
4.4375
4
"""""" """Полиморфизм, когда обьект в разных ситуациях ведет себя по разному""" class VectorClass: def __init__(self, x, y): self.x = x self.y = y #def multiplay(self, v2): # В Функцию прийдет обьект класса как аргумент, но мы будем использовать магичесуий метод def __mul__(self, other): #...
false
c8a4e387883c143f0d2cf6fde6d74f0ef1e17f78
denisinberg/python_task
/if_else_task(name).py
718
4.125
4
a=int(input('Введите возраст Андрея: ')) b=int(input('Введите возраст Борис: ')) c=int(input('Введите возраст Виктор: ')) if a>b and a>c: print('Андрей старше всех') elif b>a and b>c: print('Борис старше всех') elif b<c>a: print('Виктор старше всех') elif a==b>c: print('Андрей и Борис старше В...
false
8da0eff550d0a7ebd436609e472eec25b7a1daa5
JuicyJerry/Python---OOP-Primary_Concepts-
/PythonOOP(SOLID)/03.리스코프_치환_원칙(Liskov_Substitution_Principle)/02.행동_규약을_어기는_자식_클래스.py
1,772
4.125
4
"""자식 클래스가 부모 클래스의 의도와 다르게 메소드를 오버라이딩 하는 경우""" class Rectangle: """직사각형 클래스""" def __init__(self, width, height): """세로와 가로""" self.width = width self.height = height def area(self): """넓이 계산 메소드""" return self.width * self.height @property def width(self)...
false
5de721579c27704e39cf12b1183a1eebea4d22d4
lion137/Python-Algorithms
/shuffling.py
441
4.1875
4
# algorithm for shuffling given subscriptable data structure (Knuth) import random def swap(alist, i, j): """swaps input lists i, j elements""" alist[i], alist[j] = alist[j], alist[i] def shuffle(data): """randomly shuffles element in the input data""" n = len(data) for token in range(n - 1): ...
true
f882f9dcf344950cc893bf1e2fb49ffb103d168e
chenjyr/AlgorithmProblems
/HackerRank/Search/FindTheMedian.py
1,652
4.3125
4
""" In the Quicksort challenges, you sorted an entire array. Sometimes, you just need specific information about a list of numbers, and doing a full sort would be unnecessary. Can you figure out a way to use your partition code to find the median in an array? Challenge Given a list of number...
true
0adf7ed3f2301c043ef269a366a90c3970673b1f
chenjyr/AlgorithmProblems
/HackerRank/Sorting/Quicksort1.py
2,143
4.21875
4
""" The previous challenges covered Insertion Sort, which is a simple and intuitive sorting algorithm. Insertion Sort has a running time of O(N2) which isn’t fast enough for most purposes. Instead, sorting in the real-world is done with faster algorithms like Quicksort, which will be covered in these...
true
248f5308062ddc2b896413a99dc9d5c3f3c29ac6
chenjyr/AlgorithmProblems
/HackerRank/Sorting/InsertionSort2.py
1,852
4.625
5
""" In Insertion Sort Part 1, you sorted one element into an array. Using the same approach repeatedly, can you sort an entire unsorted array? Guideline: You already can place an element into a sorted array. How can you use that code to build up a sorted array, one element at a time? Note that in the first step, wh...
true
c2098e9dd0710577a8bcac533b34b3bbee7b3a19
NishuOberoi1996/IF_ELSE
/num_alph_chatr.py
206
4.15625
4
num=input("enter anything:-") if num>="a" and num<="z" or num>="A" and num<="Z": print("it is a alphabet") elif num>="0" and num<="9": print("it is number") else: print("Special Character")
true
8c8da9e1a61a6d6d78a2535e2b1bbda1a31b8b17
hhoangnguyen/mit_6.00.1x_python
/test.py
508
4.3125
4
def insertion_sort(items): # sort in increasing order for index_unsorted in range(1, len(items)): next = items[index_unsorted] # item that has to be inserted # in the right place # move all larger items to the right i = index_unsorted while i > 0 and items[i - 1] > next...
true
08b1c52901da46b2e7beb41246effc65ed9b4d3f
hhoangnguyen/mit_6.00.1x_python
/week_1/1_1.py
713
4.15625
4
""" Assume s is a string of lower case characters. Write a program that counts up the number of vowels contained in the string s. Valid vowels are: 'a', 'e', 'i', 'o', and 'u'. For example, if s = 'azcbobobegghakl', your program should print: 5 """ string = 'azcbobobegghakl' def is_valid_vowel(char): if char == ...
true
655a5b9cf59b58bde19148bbae7ad6650fe23374
advikchava/python
/learning/ms.py
484
4.21875
4
print("1.Seconds to minutes") print("2.Minutes to seconds") ch=int(input("Choose one option:")) if ch==1: num=int(input("Enter time in seconds:")) minutes=int(num/60) seconds=int(num%60) print("After the Seconds are converted to Minutes, the result is:",minutes,"Minutes", seconds,"Seconds") elif ch==2...
true
f5e06e5f3bbea772294cef61d853415f6cf0dc29
CyanGirl/Automation-scripts
/time_zone_conversion/time_zone.py
1,619
4.1875
4
class InvalidHours(Exception): """Invalid""" pass class InvalidMins(Exception): """Invalid""" pass # Taking user input starting_zone = input("Enter starting zone: ") time = input("Enter time: ") end_zone = input("Enter desired time zone: ") lst = time.split(":") hours1 = int(lst[0]) mins1 = int(lst...
false
d7d67479a3d56bb1187acd1e327c2d6a4430c6a5
JasmineOsti/pythonProject1
/Class.py
813
4.21875
4
#WAP to find the number is negative, positive or 0 that is entered y the user. #num=int(input('enter a number')) #if num<0: # print('number is positive') #elif num>0: # print('number is negative') #else: # print('number is zero') #dstring=input("how far did you travel today(in miles)?") #tstring=input("How lon...
false
156203c9c9a1c80101caf18ba558e1c89f682c42
JasmineOsti/pythonProject1
/Program.py
289
4.3125
4
#Write a program that takes three numbers and prints their sum. Every number is given on a separate line. A = int(input("Enter the first number: ")) B = int(input("Enter the second number: ")) C = int(input("Enter the third number: ")) sum = A+B+C print("the sum of three numbers is", sum)
true
75f90c4b763e1d36e35a2c6e495afa796ca781f1
ZohanHo/untitled
/Задача 27.py
574
4.1875
4
"""Факториалом числа n называется произведение 1 × 2 × ... × n. Обозначение: n!. По данному натуральному n вычислите значение n!. Пользоваться математической библиотекой math в этой задаче запрещено.""" #n = int(input("введите факториал какого числа необходимо вычислить: ")) def fun(n): d = "*".join(str(i) for i...
false
957a0b4055bc67923936088490e9708067ec8e08
Ritakushwaha/Web-Programming
/loops.py
457
4.1875
4
#looping lists for i in [0, 1, 2, 3, 4, 5]: print(i) #looping with range func for i in range(6): print(i) #looping lists of name for i in ["Rita", "Girwar", "Priyanshi", "Pragya", "Vijaya"]: print(i) #loop through each character in name for i in "Rita": print(i) #loop through dictionaries houses = {...
false
df5270ff28213fc89bf0ee436b9855c73e026d9d
Sakshi011/Python_Basics
/set.py
1,190
4.21875
4
# set data type # unordered collection of data # INTRO ---------------------------------------------------------------------------------- s = {1,1.1,2.3,3,'string'} print(s) print("\n") # In set all elemets are unique that's why it is used to remove duplicate elements l = [1,2,4,2,3,6,3,7,6,6] s2 = list(set(l)) print(...
true
25401f5061ccabbded56366310f5e42e910eddd7
gourdcyberlab/pollen-testbed
/scapy-things/varint.py
1,438
4.375
4
#!/usr/bin/env python import itertools ''' Functions for converting between strings (formatted as varints) and integers. ''' class VarintError(ValueError): '''Invalid varint string.''' def __init__(self, message='', string=None): ValueError.__init__(self, message) self.string = string # Can'...
true
2c1699da529112c4820a06bdd0933ae4c6c11032
colinmcnicholl/automate_boring_tasks
/firstWordRegex.py
840
4.25
4
import re """How would you write a regex that matches a sentence where the first word is either Alice, Bob, or Carol; the second word is either eats, pets, or throws; the third word is apples, cats, or baseballs; and the sentence ends with a period? This regex should be case-insensitive.""" firstWordRegex = re...
true
91b9cbfeca6f447427a3008795b05eb40c026163
shakhovm/Classes_Lab5
/Classes_Lab5/triangle.py
1,777
4.25
4
from math import sqrt from Classes_Lab5 import line, point class Triangle: """ Triangle """ def __init__(self, top_a, top_b, top_c): """ :param top_a: Point :param top_b: Point :param top_c: Point >>> triangle = Triangle(point.Point(1,1), point.Point(3,1), poi...
false
901cfcc418c14cbdc3dc6b67440c0bcd22c42a35
bryano13/holbertonschool-interview
/0x09-utf8_validation/0-validate_utf8.py
1,186
4.15625
4
#!/usr/bin/python3 """ This software defines rules to check if an integer combination is a valid UTF-8 Encoding A valid UTF-8 character can be 1 - 4 bytes long. For a 1-byte character, the first bit is a 0, followed by its unicode. For an n-bytes character, the first n-bits are all ones, the n+1 bit is 0, followed by n...
true
ad34250006ebd1305657f4ba94cd7982895f6ddb
sofiarani02/Assigments
/Assignment-1.2.py
2,825
4.5
4
print("***Python code for List operation***\n") # declaring a list of integers myList = [10, 20, 30, 40, 50, 60, 70, 80, 90, 100] # List slicing operations # printing the complete list print('myList: ',myList) # printing first element print('first element: ',myList[0]) # printing fourth element print('f...
true
56cc4deeb8d82fe0a032ea4b0f84feff308315ab
baroquebloke/project_euler
/python/4.py
541
4.125
4
# A palindromic number reads the same both ways. The largest palindrome made # from the product of two 2-digit numbers is 9009 = 91 x 99. # Find the largest palindrome made from the product of two 3-digit numbers. # result: 906609 # time: 0.433s # # *edit: optimized* def palind_num(): is_pal = 0 for x in range...
true
054eaa44d1652eb87ed365839643ee4e76d4bbe7
codejoncode/Sorting
/project/iterative_sorting.py
2,418
4.5
4
# Complete the selection_sort() function below in class with your instructor def selection_sort(arr): # loop through n-1 elements for i in range(0, len(arr) - 1): cur_index = i smallest_index = cur_index # TO-DO: find next smallest element # (hint, can do in 3 loc) for j ...
true
1ced62858071d7ea1ee50ff2bf50760f9ff7b65c
ElenaMBaudrit/OOP_assignments
/Person.py
1,108
4.25
4
#Todd's March 21st 2018 #example of a class. class Person(object): #Always put "object" inside the parentheses of the class def __init__(self, name, age, location): #double underscores in Python: something that is written somewhere else. "Dunder"= double underscores. #constructor: name of the fu...
true
3690ab99200c1c8f36b2537c14ccd338566e4fa2
glissader/Python
/ДЗ Урок 6/main2.py
1,125
4.25
4
# Реализовать класс Road (дорога). # - определить атрибуты: length (длина), width (ширина); # - значения атрибутов должны передаваться при создании экземпляра класса; # - атрибуты сделать защищёнными; # - определить метод расчёта массы асфальта, необходимого для покрытия всей дороги; # - использовать формулу: длина*шир...
false
eceeeb18fb41636815f138b55602cd3956e1ff3b
Jian-Lei/LeetCodeExercise
/example/exercise_9.py
835
4.1875
4
#!/usr/bin/env python # coding=utf-8 """ Auther: jian.lei Email: leijian0907@163.com 给你一个整数 x ,如果 x 是一个回文整数,返回 ture ;否则,返回 false 。 回文数是指正序(从左向右)和倒序(从右向左)读都是一样的整数。例如,121 是回文,而 123 不是。 https://leetcode-cn.com/problems/palindrome-number """ def is_palindrome(x): result = False if -1 < x < 2 ** 31 - 1: ...
false
d07f8d3ae500f5aefc1e03accc48d230ce4b4edd
adibhatnagar/my-github
/NIE Python/Third Code/Further Lists.py
1,629
4.3125
4
list_1=['Apple','Dell','HP','LG','Samsung','Acer','MSI','Asus','Razer'] #declares list containing names of laptop makers as strings list_2=[1,2,3,3,3,4,5,5,6,7,8,8,8,8,9] #declares list containing integers #Remember list elements have index starting from 0 so for list_1 the element 'Apple' has index 0 #If you store an...
true
e5e227509210a211bbbd4c9c4a7e3fcc9dd23a96
gagande90/Data-Structures-Python
/Comprehensions/comprehension_list.py
562
4.25
4
# list with loop loop_numbers = [] # create an empty list for number in range(1, 101): # use for loop loop_numbers.append(number) # append 100 numbers to list print(loop_numbers) # list comprehension comp_numbers = [ number for number in range(1, 101) ] # create a new li...
true
bbd9d9f89619a93c37c79c269f244d899b047394
rebecabramos/Course_Exercises
/Week 6/search_and_replace_per_gone_in_list.py
1,123
4.375
4
# The program create a list containing the integers from (1 to 10) in increasing order, and outputs the list. # Then prompt the user to enter a number between 1 and 10, replace this number by the str object (gone) and output the list. # If the user enters a string that does not represent an integer between 1 and 10, ...
true
23aed0b18c33addf4ed34a8a25f206b826239b9c
rebecabramos/Course_Exercises
/Week 6/split_str_space-separated_and_convert_upper.py
308
4.46875
4
# The program performs space-separated string conversion in a list # and then cycles through each index of the list # and displays the result in capital and capital letters string = input('Enter some words >') list_string = string.split() print(list_string) for x in list_string: print(x, x.upper())
true
0f8cc167c0447ed209bb00b04ebdb2cb3053b2fb
hm06063/OSP_repo
/py_lab/aver_num.py
282
4.28125
4
#!/usr/bin/python3 if __name__ == '__main__': n = int(input("How many numbers do you wanna input?")) sum = 0 for i in range(0,n): num = int(input("number to input: ")) sum += num mean = sum/n print("the mean of numbers is {}".format(mean))
true
fef5d74c772b75ba6e976e83a848233649484fce
yc-xiao/interview
/design/design_pattern/builder.py
1,452
4.1875
4
""" 建造者模式(Builder Pattern)将一个复杂对象分解成多个相对简单的部分,然后根据不同需要分别创建它们,最后构建成该复杂对象。 汽车 = 发动机 + 底盘 + 车身 产品 = 模块A(模块a1, 模块a2, ...) + 模块B(模块b1, 模块b2, ...) + 模块C(模块c1, 模块c2, ...) 组合使用,Python Logging 使用场景: Logging 组合选择 """ class Engine(): def __str__(self): return f'Engine' class E...
false
86b2340e9602b2aa3eab5c4fd4fd3dc1b9b9cf9a
zatserkl/learn
/python/numpy_matrix_solve.py
1,756
4.28125
4
################################################# # See the final solution in the numpy_matrix.py # ################################################# import numpy as np """ Solve equation A*x = b where b is represented by ndarray or matrix NB: use matmul for the multiplication of matrices (or arrays). """ def solv...
true
cf44c9820ab6c0e5c8ae0c270c5f097cd6c79550
zatserkl/learn
/python/class_set.py
1,286
4.15625
4
class Set: """Implementation of set using list """ def __init__(self, list_init=None): """constructor""" self.list = [] if list_init is not None: for element in list_init: self.list.append(element) """From http://stackoverflow.com/questions/1436703/differ...
true