blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
ea3ab35f3898ef36af6e484bafae5a243dabdf29
kameshkotwani/python_assignment
/Assignment_1/grade.py
1,138
4.34375
4
''' Exercise 1 Test Score Grades Problem Statement Reboot Academy This solution is created in python 3.6.4 CAUTION: MAY NOT WORK IN OLDER VERSION Solved by: Kamesh Kotwani ''' print("Welcome to Test Score Grade System! This System will help you find out your grade!") #To take input from user about his test score s...
true
3e82ff08a0730088a2f7e6a172bc7aef913a021d
kameshkotwani/python_assignment
/Assignment_1/primes.py
867
4.15625
4
''' Python Assignment 1 : Reboot Academy To print the prime numbers in given range Created using Python 3.6.4 CAUTION: MAY NOT WORK IN OLDER Solved by: Kamesh Kotwani ''' print("***Welcome to prime series!***") n = int(input("Please enter upto which number primes should be displayed : ")) #Making sure if the user...
true
3d755a8f1806e3d400fba196f694c5c9b08af718
BradyBallmann/program-arcade-games
/Lab 04 - Camel/main_program.py
2,558
4.25
4
import random print("Welcome to Camel!") print("You have stolen a camel to make your way across the great Mobie desert.") print("The natives want their camel back and are chasing you down! Survive your") print("desert trek and out run the natives.") done = False camel_thirst = 0 camel_tired = 0 miles_traveled = 0 dis...
true
eb4fa5d36aac209cfb4dab7657a2d63a2f336999
BradyBallmann/program-arcade-games
/Lab 03 - Create a Quiz/main_program.py
1,411
4.28125
4
#!/usr/bin/env python3 # Creating a quiz # Brady Ballmann # 11/03/2017 percentage = 0 print('Ready for a quiz? :)') question_one = input('Who won the 2017 World Series? ') if question_one.lower() == "astros": print("Correct!") percentage += 1 else: print('Incorrect!') question_two = int(input("What is ...
false
b6cc6853e89b552fcf879332a2cf2384b2675738
mikelopez/experimental-labs
/algorithms/heapsort/Python/heapsort_verbose.py
2,536
4.1875
4
""" Heapsort implementation Timing complexity Best/worse/average: O(n log n) Each parent node is greater than its child Given n as the index number in question, find the left/right children using the following: - left: 2n + 1 - right: 2n + 2 Check to see if an element is greater than its children. If not, the val...
true
e7572d9c14c53c4ea50d2d2206d4710819de753a
jjerry-k/learning_data_structure
/Tree/Priority_queue.py
1,961
4.28125
4
# Priority queue # Abstract data type # Using heap def swap(tree, index_1, index_2): temp = tree[index_1] tree[index_1] = tree[index_2] tree[index_2] = temp def heapify(tree, index, tree_size): left_child_index = 2 * index right_child_index = 2 * index + 1 largest = index if (0 < le...
true
6ddc98e49f12be54ad29d6ef0a70a6a9d4e75b49
Minal2179/NLP-programs
/src/utils.py
1,567
4.1875
4
import sqlite3 # initialize the connection to the database def db_connection(): connection = sqlite3.connect('chatdata.sqlite') cursor = connection.cursor() # create the tables needed by the program create_table_request_list = [ 'CREATE TABLE words(word TEXT UNIQUE)', 'CREATE TABLE sentences(sentence ...
true
5ccff8703e594071092bf05fb3f7a2055e06f4b8
mr-c/george_murray
/python_tutorials/sentdex_introduction/dna_complement.py
328
4.15625
4
sequenceInput = input("Find the reverse complement of this sequence: ") def reverseComplement(sequenceInput): complement = {'A':'T', 'C':'G', 'G':'C', 'T':'A'} reverseComplement = [] for in sequenceInput: reverseComplement = complement[base] + t return reverseComplement: print(reverseCompl...
true
c767575b68cbebef0b28f58d1eb202cead6b5248
subiksharaman1/Rock-Paper-Scissors-Python
/Rock Paper Scissors.py
1,127
4.1875
4
import random yourCount, computerCount = 0, 0 while True: userin = input("Rock, paper or scissors? ").upper() randNum = random.randint(0,2) #to generate computer's play myList = ["ROCK", "PAPER", "SCISSORS"] if userin == "ROCK": uservalue = 0 elif userin == "PAPER": userva...
true
929b51ad32bcbd56b6a330abea6076ccead0fbda
rumen89/programming_101_python
/week_1/sum_numbers.py
639
4.125
4
# Implement a Python script, called sum_numbers.py that takes one argument - a # filename which has integers, separated by " ". # # The script should print the sum of all integers in that file. import sys def sum_numbers(string): result = 0 number = '0' for char in string: if '0' <= char <= '9':...
true
1fc8d328c2c6a67ca1098d958deb9f2320ed5ac1
oliiiiiiiiiiiii/HowToFixPythonErrors
/Examples/RecursionErrorSolve.py
568
4.15625
4
# So lets create a function def func(x): return func(x) # this would immediately raise RecursionError since calling this function will go on forever and ever # you can see the maximum recurstion limit by printing sys.getrecursionlimit() like this import sys print(sys.getrecursionlimit()) # to fix a recursion er...
true
87aa8ea053bb765dfeeaf9c0bf29c1b9928cd355
LinnierGames/Core-Data-Structures
/source/search.py
2,760
4.28125
4
#!python def linear_search(array, item): """return the first index of item in array or None if item is not found""" # implement linear_search_iterative and linear_search_recursive below, then # change this to call your implementation to verify it passes all tests return linear_search_recursive(array, i...
true
772e631557fd8381e2201e98ea0008b55d82dcb3
jjack94/python-code-samples
/day-calc-jj.py
422
4.375
4
# James Jack # 1/28/21 # this program takes the starting weekday/number of days gone and gives the weekday of the return start = input("what day of the week did you leave? please input between 0-6 (0=sunday/6=saturday") start = int(start) days_gone = input(" how many days were you gone for?") days_gone = int(da...
true
3b8d44aa019ceb6ef2fc545ffde159c57d6ed00b
SL-0305/Assignment-1
/Assignment1_7.py
334
4.25
4
# Write a program which contains one function that accept one number from user and returns true # if number is divisible by 5 otherwise return false. def num(x): if(x%5 ==0): print("Number is divisible by 5") else: print("Number is not divisible by 5") x=(int(input("Enter the numb...
true
20e3b3cf9239e32b7a4783dad33830ddd09c28b9
lraynes/cheat_sheets
/5.5-Saturday/comprehension.py
1,633
4.25
4
prices= ["24", "13", "16000", "1400"] #convert string to integer within all of list by looping through price_nums = [int(price) for price in prices] print(prices) print(price_nums) dog = "poodle" letters = [letter for letter in dog] print(letters) print(f"we iterate over a string into a list: {letters}") #capitalize...
true
66c5876716099ac5bc870032a5f4a98815b43717
lraynes/cheat_sheets
/5.1-Tuesday/basic_variables.py
351
4.15625
4
my_name = input("What is your name?") neighbor_name = input("what is your neighbor's name?") my_coding = int(input("How many months have you been coding?")) neighbor_coding = int(input("How many months has your neighbor been coding?")) print(my_name + ", " + str(my_coding) + " months") print (neighbor_name + ", " + st...
true
9a75cb732c37aec181ec1b3573ed9ae46d55b9ed
Dheerajkg/py-4-everybody
/wk03/Assign 3.1.py
676
4.21875
4
#3.1 Write a program to prompt the user for hours and rate per hour using input to compute gross pay. Pay the hourly rate for the hours up to 40 and 1.5 times the hourly rate for all hours worked above 40 hours. Use 45 hours and a rate of 10.50 per hour to test the program (the pay should be 498.75). You should use inp...
true
edf13334d1dbccb818dcd8714d52456ec91d8a0f
unblest/python
/ex35-2.py
536
4.15625
4
# a little 'what happens if' scenario # basically, what happens if I have an 'if' function with an elif, but no else and something happens not covered by the 'if' function? # turns out that nothing at all happens # like actually nothing, so if you're expecting the if to return something (value, variable, function kick-...
true
43f8d2211cf92bdf6f63f1644987ac57a3fa8ab4
unblest/python
/ex4.py
1,116
4.25
4
# variable test file # defines number of cars cars = 100 # defines available space in a car space_in_a_car = 4.0 # defines number of drivers drivers = 30 # defines number of passengers passengers = 90 # defines cars_not_driven as the number of cars minus the number of drivers lets see what happens if we scoot past this...
true
d8a8d80cb0aa64c09cfb783dfcf78f8a41151a12
anderfernandes/COSC1315
/chapter3/Fernandes_Chapter_3_3.py
556
4.15625
4
# Name: Anderson Fernandes # Date: September 13, 2017 # Description: Exercise 3, Chapter 3 grade = input("Enter a grade: ") try: grade = float(grade) # Check if grade is out of range if (grade < 0.0 or grade > 1.0): print("Bad score") else: # Find letter grade if (grade >= 0.9):...
true
17a7e013bb93ed7e5f1694dc21d72abcb6cdc445
bmk15897/Prerequisite-Assignments
/frequencyApp.py
1,236
4.25
4
''' Assignment 2 - Write a program to find frequency of each distinct word in a given text file ‘input.txt’. Your Output should be stored in a different file named ‘output.txt’ in alphanumeric order. Each line should contain the word and its frequency separated by a comma. (if numeric values are present in file they sh...
true
e63d5be51fa356483a51acc355914e8450f46c19
RhysLewingdon/COM404
/2-Decisions/beeppainting.py
573
4.21875
4
def directioncode(): direction = input("Which direction should I paint in? ") if direction == "up": print("I am painting in the upward direction!") elif direction =="down": print("I am painting in the downward direction!") elif direction =="left": print("I am painting in the lef...
true
907c4b7450d11eeccc3a5a356faf5a3ddb4a46f9
RhysLewingdon/COM404
/2-Decisions/NestedDecisions.py
750
4.125
4
firstlook = input("Where should I look? ") if firstlook == "in the bedroom": secondlook = input("Where in the bedroom should I look? ") if secondlook == "in the cupboard": print("Found some mess but no battery.") else: print("---------") elif firstlook == "in the bathroom": secondlook = ...
true
b1476310b78859982e2c1c2f3c45f6aacd958a20
PallabPandaOwn/python101
/variables/venv/src/Assignment-6/assignment-6-solution-2.py
981
4.46875
4
# Assignment 6 # Create a function that takes in two parameters: rows, and columns, both of which are integers. # The function should then proceed to draw a playing board (as in the examples from the lectures) the same number of rows and columns as specified. # After drawing the board, your function should return True....
true
fb40d5c8310767bfde315a33f45a355a9ee19703
pitzcritter/CodingDojo--Python
/16 Dictionary in, tuples out.py
802
4.21875
4
#Assignment: Dictionary in, tuples out #Write a function that takes in a dictionary and returns a list of tuples where the first tuple item is the key and the second is the value. Here's an example: ### function input #my_dict = { # "Speros": "(555) 555-5555", ## "Michael": "(999) 999-9999", ## "Jay": "(777) 777-77...
true
93a79d4b7a6e850940f4273dd7acf56f1f9eeb0b
mattalhamilton-zz/Python-and-Bash-Scripts
/Mod02Tutorial.py
2,562
4.21875
4
##Matthew Hamilton ##Mod 02 Tutorial import random def rando_insert(thing_being_inserted): position = random.randint(0,9) my_list.insert(position, thing_being_inserted) counter = 0 my_list = [] while counter < 10: list_item = input('Please enter a word or a number: ') my_list.app...
true
e45f96adbf1b1e13f47a1038100542f5089c3174
minhld99/Data-Structure-and-Algorithms-in-Python
/SelectionSort/SelectionSort.py
626
4.15625
4
# Selection Sort def selectionSort(array): for i in range(len(array)): index = i for j in range(i+1, len(array)): if array[j] < array[index]: # Ascending Order index = j # Find smallest element if index != i: swap(array, index, i) ...
true
db311282123ef6391f78de33be38a30fcf1ae0ac
piyush09/LeetCode
/Valid Parentheses.py
1,672
4.15625
4
""" Algo: An input string is valid if: Open brackets must be closed by the same type of brackets. Open brackets must be closed in the correct order. An empty string is also considered valid. If opening bracket, push it onto the stack If closing bracket, then check the element on top of the stack. ...
true
a62d37fd43ffb0159ed660d559dfbaa900b25328
piyush09/LeetCode
/Climbing Stairs.py
636
4.15625
4
""" Algo: Use concept of Fibonacci number Fib(N) = Fib(N-1) + Fib(N-2) Find nth number of the fibonacci series with Fib(1)=1 and Fib(2)=2. T.C. - O(N) - Single loop upto n to calculate nth fibonacci number. S.C.- O(1) - Constant space is used. """ def climbStairs(n): if (n == 1): return 1 first...
true
7d6f74a667a6d43df0f8cbb77f11279ac64056ee
piyush09/LeetCode
/Invert Binary Tree.py
1,566
4.21875
4
""" Algo: Call invert of left subtree, call invert of right subtree. Swap left and right subtrees. Time and Space complexities similar to Tree traversal time and space complexities. T.C. - O(N) - 'N' is the number of nodes as calculated by Master theorem. S.C. - O(N) - Explained below - When tree is completely s...
true
3cc47b4b74284b03e3fee038af7a71adb3ade386
piyush09/LeetCode
/Product of Array Except Self.py
1,008
4.53125
5
""" Algo: Initialise output array corresponding to each element. Calculate the product of numbers to the left of each array element Calculate the product of numbers to right of each array element T.C. - O(N), 'N' number of items in nums list, as two for loops to iterate through the numbers S.C. - O(N), Out...
true
b83d7216748e58b73d8b344a8f29f3b1ff39ac82
vtphan/Graph
/example.py
872
4.25
4
from graph import Graph, DGraph print("Example of unweighted undirected graph") G = Graph() G.add(2,3) # add edge (2,3); (3,2) is automatically addeded. G.add(3,5) # add edge (3,5); (5,3) is automatically addeded. G.add(3,10) # add edge (3,10); (10,3) is automatically addeded. print(...
true
185ed6725b9da7a6f3e3b0d3a1448378d688d835
rramosaveros/CursoPythonCisco
/Ejercicios/EjemploIfElseElif.py
251
4.1875
4
n = input("Ingres el nombre: ") if n == "Espatifilo": print("Si, ¡El Espatifilo es la mejor planta de todos los tiempos!") elif n == "pelargonio": print("!Espatifilo! ¡No pelargonio!") else: print("No, ¡quiero un gran Espatifilo!")
false
f8a266e34c14259927ddc819901b9043f1630559
lamwilton/DSCI-553-Data-Mining
/HW4/test.py
2,359
4.34375
4
# Python3 Program to print BFS traversal # from a given source vertex. BFS(int s) # traverses vertices reachable from s. from collections import defaultdict import networkx as nx import matplotlib.pyplot as plt # This class represents a directed graph # using adjacency list representation class Graph: # Construc...
true
d71078dc702fc51e10036779ab14e796e5af64bf
arnav13081994/python-deepdive
/python-problems/main.py
1,540
4.40625
4
# Implement a class Rectangle class Rectangle: def __init__(self, height, width): """ Initialises an instance of the Rectangle Class""" # _width and _height are internal (private) Rectangle Instance's attributes. This is something # We keep to ourselves to make sure the User can't just update these attrs rando...
true
a97cad540333cf0c7095454117b8453fa5ff3e63
srikanthpragada/PYTHON_17_JUN_2021
/demo/oop/sum_of_numbers.py
299
4.15625
4
# Accept 5 numbers and display total # Make sure invalid numbers are ignored total = 0 count = 1 while count <= 5: try: num = int(input(f"Enter Number {count} :")) total += num count += 1 except ValueError: print("Invalid Number!") print("Total :", total)
true
c8ef8ba64d8eaf418bb2964df54e47defe394860
gdeep141/Small-projects
/recursion.py
1,162
4.1875
4
""" """ Solve a maze using recursive backtracking """ string = """\ ################# # ### ## # #### #### ## ## # #### ## ## # ############ ## # * ## # # #### #### ## ################# """ # get height and width of maze height = 0 width = 0 for i in string: if i == "\n": break else: w...
false
78918e02e1d80ecb19c4956e4f81a992f828204a
krishnasairam/sairam
/cspp1-assignments/m22/assignment1/read_input.py
288
4.34375
4
''' Write a python program to read multiple lines of text input and store the input into a string. ''' def main(): '''printing string''' int_input = int(input()) for _ in range(int_input): string = input() print(string) if __name__ == '__main__': main()
true
eba393633d02982f36662cf070b6cb8ccff695be
krishnasairam/sairam
/cspp1-assignments/m7/Functions - Assignment-1/assignment1.py
859
4.1875
4
'''credit card company each month.''' def paying_debtoff(previous_balance, annual_interest, monthly_payment_rate): '''updated_balance''' monthly_interest = (annual_interest) / 12.0 updated_balance = previous_balance i_temp = 1 while i_temp <= 12: monthly_payment = monthly_payment_rate * upd...
true
628f709ae0400b44a40d7d62f362f8f13a5c7f3f
Abhinav-Bala/ICS3U
/problem_set_1/hypotenuse_calculator.py
892
4.4375
4
# Abhinav Balasubramanian # Feb. 18, 2021 # ICS3UO-C # This program will output the length of the hypotenuse given the two other sides of a triangle import math # imports the math library print('Hello, this program will calculate the legnth of the hypotenuse of a right-triangle.') # prints welcome message # INPUT si...
true
d99a4e06de6a02d7862be368a3e16e4872ef5aee
Abhinav-Bala/ICS3U
/problem_set_2/leap_year_checker.py
815
4.1875
4
# Abhinav Balasubramanian # March 1, 2021 # ICS3UO-C # This program will check whether an inputted year is a leap year or not #INPUT print("This program will check to see whether a given year is a leap year.") # displays welcome message year = int(input("Please enter a year: ")) # gets user input for year and then cas...
true
857bd453c9a11176d797fd4f288ca4300869782a
Abhinav-Bala/ICS3U
/problem_set_2/integer_classifier.py
1,275
4.21875
4
# Abhinav Balasubramanian # March 1, 2021 # ICS3UO-C # This program will check whether an inputted integer is even or odd and positive, negative or zero #INPUT print("This program will determine whether an integer is even or odd.\nIt will also determine if the integer is positive, negative or zero") # displays welcome...
true
c1f8ff78272f8ed6b31bcc67d213abc124aba27d
patchen/battleship
/src/queue.py
1,063
4.15625
4
class EmptyQueueError(Exception): '''Raised when pop is called on an empty Queue.''' pass class Queue(object): '''A First-in, first-out (FIFO) Queue of items''' def __init__(self): '''(Queue) -> None A new empty Queue. ''' self.contents = [] def __st...
true
3f408c1c2d8d338e47358196c085d7cdfcb83d4c
TimLatham/Udacity_Projects
/Intro_to_Programming/Stage2/productList.py
666
4.125
4
# -*- coding: utf-8 -*- """ Created on Wed Feb 08 11:42:46 2017 @author: tim.latham """ # Define a procedure, product_list, # that takes as input a list of numbers, # and returns a number that is # the result of multiplying all # those numbers together. def product_list(list_of_numbers): product = ...
true
10049e0cc0a8c73474b69b91920513ba703c77d2
KeeReal/cpsmi_python
/task01.py
512
4.125
4
# coding=utf-8 # Введенную с клавиатуры строку вывести на экран наоборот (использовать цикл). def reverse_string(string): result = "" length = len(string) for i in range(length): result += string[length - i - 1] return result if __name__ == '__main__': print 'type q to quit' string =...
false
b0968020e5522d050502bbce3e560f89daaa8c84
shiningflash/Competitive-Programming-Resources
/Sorting-Algorithms/insertion_sort.py
578
4.1875
4
""" Insertion Sort Time Complexity 1. Best case: O(N) 2. Avg. case: O(N^2) 3. Worst case: O(N^2) Space Complexity: O(1) Stable: Yes Useage: 1. small array 2. few elements left unsorted """ def insertion_sort(arr): for i in range(len(arr)): for j in range(i, 0, -1): if arr[j] < arr[j-1]: ...
false
232ff848d0862b4b0a3565c34e1d22bf16428806
MRichardN/Palindromes
/palindrome.py
807
4.15625
4
#string = input("Please enter a word:") #string = [n for n in input('Enter numbers: ').split()] #def palin(word1): def palindrome(word): word = input("Please enter a word:") word = word.lower().replace(' ', '') if not word.isalpha(): return '{} is not a string. Enter srings only'.format(word) ...
false
480c91a41ef1908fa06bea190e258477d28ca7d7
SuperMartinYang/learning_algorithm
/leetcode/easy/Balanced_Binary_Tree.py
1,215
4.15625
4
# Definition for a binary tree node. # class TreeNode(object): # def __init__(self, x): # self.val = x # self.left = None # self.right = None class Solution(object): def isBalanced(self, root): """ a height-balanced binary tree is defined as a binary tree in which the de...
true
155032d5e5c60b31d7c9ee313a3d27161cbb5f6e
lindaduong25/PythonChooseYourOwnAdventureGame
/FirstGame.py
1,667
4.1875
4
print("Welcome to Random Guessing!") name = input("What is your name? ") age = int(input("What is your age? ")) points = 20 if age >= 15: print("You are old enough to play!") wants_to_play = input("Do you want to play? ").lower() if wants_to_play == "yes": print("Let's begin then!") print...
true
902571ea8243955347359783adc96ff2a611c83d
pildurr/indexing
/indexing.py
316
4.34375
4
"""Given a string of any length named s. Extract and then print the first and last characters of the string (with one space between them). For example, given s = 'abcdef' the output will be a f""" s = input("Input a string: ") s_first = s[0] s_last = s[-1] s_modified = s_first + " " + s_last print(s_modified)
true
a859edb41cd4e5781e9e677f9a083eb38d802483
giosermon/holbertonschool-higher_level_programming
/0x0B-python-input_output/2-append_write.py
400
4.40625
4
#!/usr/bin/python3 """ Append to a file """ def append_write(filename="", text=""): """Function to append a text in a file Args: filename (str): Name of the file to append to. text (str): Text to append to the file. Return: The numbers of characters written. """ with o...
true
dafb603481281b3abbbe04ee96a308dfccce51c8
gbmikhail/pyalg
/lesson_2/task_3.py
481
4.15625
4
# 3. Сформировать из введенного числа обратное по порядку входящих в него цифр и вывести на экран. # Например, если введено число 3486, надо вывести 6843. n = int(input("Введите число: ")) m = 0 while n > 0: m = (m * 10) + (n % 10) n = n // 10 print(f"Обратное по порядку входящих в него цифр число: {m}")
false
f6c81a96ef98a1d413ba85ab89209ef920b894bf
MaunikQ/Sample
/Assesment Python/Q14.py
229
4.125
4
def power_of_two(n): if(n==1): return True if(n%2==0): return power_of_two(n/2) else: return False if __name__ == '__main__': num = int(input('Enter the number to be checked: ')) power = power_of_two(num) print power
true
6ebd58bb8157899588ca6376671ac33f40919007
sunil2982/python_core
/story.py
1,299
4.375
4
#initializing variables girlname = " " boyname = " " girl_desc = " " boy_desc = " " walk_desc = " " animal = " " gift = " " answer = " " #taking input from user girlname=input("enter a girl name") girlname=girlname.capitalize() boyname = input("input a boy name") boyname = boyname.capitalize() girl_desc= input("enter...
true
71171fbe056a8efc0134caee636e0abcb1a86e5c
sunil2982/python_core
/forloop_turtle.py
279
4.15625
4
import turtle numsides = int(input("how many sides you want ??")) tut=turtle.Turtle() for step in range(numsides): tut.forward(step+100) tut.right(360/numsides) for step in range(numsides): tut.forward(step+70) tut.right(360/numsides) turtle.done()
true
32d5718ae55bee81b9617efb2a96506c28280ecd
WangYangLau/learnpython
/dict.py
509
4.125
4
# -*- coding:utf-8 -*- #dict index = False print('dict') d = {'Michael':80,'Lisa':95,'Jack':72,'Bart':0} d['Bart'] = 98 while index==False: print('enter the name you find:') name = input() index = name in d if index==False: print('Without this guy,Do you want to insert one?(yes/no)') a = input() if a=='yes':...
true
7b33c4306d1b85d58244af8db01481bac45cd763
ceirius/teaching-python
/rectangle 1.py
738
4.15625
4
#!/usr/bin/env python # -*- coding: utf-8 -*- """ write a program to compute area of a rectangle """ class Rectangle: length = 0 breadth = 0 def __init__(self, length, breadth): self.breadth = breadth self.length = length # print(self.length, self.br...
true
097c4751288031f243ddbabb730d0320f900fddb
ALittleRunaway/Data_Visualisation
/Random walk/random_walk.py
1,403
4.3125
4
"""random walk""" from random import choice class RandomWalk(): """Класс для генерирования случайных блужданий""" def __init__(self, num_points=5000): """Инициализирует атрибуты блуждания""" self.num_points = num_points # Все блуждающиеся точки начинаются с (0, 0) self.x_value...
false
ac23cdb1ea2110040c84fdccbc435fef2a27becf
carlosalbertoestrela/Lista-de-exercios-Python
/01 Estrutura_Sequencial/07.py
272
4.15625
4
# 7) Faça um Programa que calcule a área de um quadrado, # em seguida mostre o dobro desta área para o usuário. lado = float(input('Digite um lado do quadrado: ')) area = lado**2 print(f'A area do quadrado de {lado}x{lado} é {area:.2f} eseu dobor é {area*2:.2f}')
false
49056292713787d81f6fc41c3a5b82743a3ad38f
carlosalbertoestrela/Lista-de-exercios-Python
/02 Estrutura_de_Decisão/07.py
479
4.15625
4
""" 07) Faça um Programa que leia três números e mostre o maior e o menor deles. """ num1 = int(input('Digite o primeiro número: ')) menor = maior = num1 num2 = int(input('Digite o segundo número: ')) if num2 < menor: menor = num2 if num2 > maior: maior = num2 num3 = int(input('Digite o terceito número: ')) if...
false
f091044a71ad01668f3f49011c42e6e0662e2a20
carlosalbertoestrela/Lista-de-exercios-Python
/03 Estrutura_de_repetição/13.py
437
4.1875
4
""" 13) Faça um programa que peça dois números, base e expoente, calcule e mostre o primeiro número elevado ao segundo número. Não utilize a função de potência da linguagem """ base = int(input('Digite a BASE: ')) expo = int(input('Digite o EXPOENTE: ')) result = int() for n in range(1, expo): if n == 1: ...
false
f798ed52493f88698c93a21d0fc352b4b9494a9a
carlosalbertoestrela/Lista-de-exercios-Python
/02 Estrutura_de_Decisão/04.py
287
4.21875
4
""" 04) Faça um Programa que verifique se uma letra digitada é vogal ou consoante. """ letra = str(input('Digite uma letra: ')).strip().upper()[0] if letra in 'AÀÁÂÃEÈÉÊIÌÍÎOÒÓÔÕUÚÙÛ': print(f'{letra} é uma VOGAL!') else: print(f'{letra} é uma CONSOANTE!')
false
9cc5fdb85ad8fe2e4e78b09c3fd7a08e44d581b1
carlosalbertoestrela/Lista-de-exercios-Python
/05 Funções/02.py
411
4.125
4
""" 02) Faça um programa para imprimir: 1 1 2 1 2 3 ..... 1 2 3 ... n para um n informado pelo usuário. Use uma função que receba um valor n inteiro imprima até a n-ésima linha. """ def print_cont_seq(num): for n in range(num+1): for i in range(1, n+1): print(...
false
305a69c20bddb73dc4e8c13f162a251c065e0c2e
carlosalbertoestrela/Lista-de-exercios-Python
/03 Estrutura_de_repetição/18.py
555
4.15625
4
""" 18) Faça um programa que, dado um conjunto de N números, determine o menor valor, o maior valor e a soma dos valores. """ maior = menor = soma = cont = 0 while True: num = int(input('Digite um número: (0 para parar) ')) if soma == 0: maior = menor = num if num == 0: break elif num >...
false
a584d51da5e3146246ab96cbb8c46dd1c6e54cad
lisboaxd/exercicios-python-brasil
/estrutura-sequencial/ex06.py
224
4.125
4
#Faça um Programa que peça o raio de um círculo, calcule e mostre sua área. from math import pi raio = float(input(u"Insira o raio do círculo: ")) area = pi*(raio**2) print("A área do cícurlo é : {0}".format(area))
false
1e2e1fec71c9fc5657d9b4931d0d825741280711
joselufb/Sudoku_Solver
/200914_Sudoku_Solver.py
1,877
4.15625
4
''' Python array Sudoku solver References: https://towardsdatascience.com/solve-sudokus-automatically-4032b2203b64 ''' # Example of sudoky board # Gaps are represented with number 0 board_test = [ [0, 0, 9, 8, 0, 0, 7, 6, 0], [5, 0, 3, 6, 0, 7, 0, 0, 0], [0, 0, 0, 0, 0, 0, 3, 0, 5], [2, 5, 0, 0, 8, 0, 6, 0, 0], [0, 9...
true
715347f5a6fb822fda4119b97d948b99d0976a06
akadi/TDD
/romain_numerals.py
1,550
4.25
4
# -*- coding: utf-8 -*- # Author: Abdelhalim Kadi <kadi.halim@gmail.com> # Convert arabic numbers into roman numbers. # Constst DICT_NUMS = { 1: u'I', 2: u'II', 3: u'III', 4: u'IV', 5: u'V', 6: u'VI', 7: u'VII', 8: u'VIII...
false
5365eb7c3d8b6e9bef15361f0006c2b80405795a
luanquanghuy/Python-Projects
/bai2/list.py
894
4.15625
4
numbers = [1, 2, 3, 4, 5] names = ['Quang', 'Huy', 'Luan'] print('nhap: ') # index = int(input()) # print(type(index)) # print(numbers[1]) # try: # print('dung', numbers[index]) # except IndexError: # print('Nhap sai') print(3 in numbers) print(2 not in numbers) print('huy' in names) print('Huy' in names) prin...
false
cd64ee861ad81f45fad453c188e83e46fad005b7
soberoy1112/Lintcode
/my_answer/454.py
787
4.125
4
#/usr/bin/env python3 # -*- coding: utf-8 -*- class Rectangle(object): def __init__(self, width, height): self.__width = width self.__height = height def setArea(self, width, height): if width > 0 and height > 0: self.__width = width self.__height = height else: print('Sorry, we don\'t acc...
true
e6e31b042637bc7745abd2b269e09ad83f57adab
tarcisiovale/Pyquest
/envExemplo/Lista01/Lista01Ex07.py
541
4.125
4
""" Escreva um programam que calcule o índice de massa corpórea (IMC) de uma pessoa, sendo o peso e a altura fornecidos pelo teclado. Apresentar na tela o peso, a altura e o IMC calculado. Exemplo: Valores fornecidos pelo teclado: Peso = 60kg e Altura = 1,67m Cálculo do IMC = 60 / (1,67)² = 60 / 2,78 = 21,5 """ peso= f...
false
77c3c90343834f3bf77f54d5951e385f985da7b9
tarcisiovale/Pyquest
/envExemplo/Lista04/Lista04Ex07.py
228
4.25
4
# Programa para converter temperatura de Fahrenheit para Celsius temp_celsius = lambda f: (5/9) * (f - 32) f = float(input('Entre com a temperatura em Fahrenheit:')) print(f'A temperatura em Celsius é: {temp_celsius(f):0.2f}')
false
78c45bfb60be63747dcbed7872731067edf76d4f
ravenusmc/flask_weather
/basic.py
1,718
4.15625
4
#This file will contain information to display basic information. import pandas as pd import numpy as np #This class will be used to pull weather information for me class Weather(): #I was using this method to set up the initial attribute but I needed #to reset the attribute each time I used it. # def __...
true
f8b40ee65abf9adb5187079836a9e5cd6b3be4d3
sudonitin/dsa
/sorting/algorithms/selection_sort.py
1,316
4.21875
4
''' selection_sort.py ############### NOTES ############### => From GFG The selection sort algorithm sorts an array by repeatedly finding the minimum element (considering ascending order) from unsorted part and putting it at the beginning. The algorithm maintains two subarrays in a given array. 1) The subarray whi...
true
1e77ca5042a4c3093dfe60ed40777c1fbab53b98
branhoff/automation_class
/1.FilenamesAndFilepaths/rename_files.py
1,464
4.25
4
# import modules we'll need import datetime import os def get_curr_month_name(): """ Pulls current month as long form name i.e. "January" """ today = datetime.date.today() curr_month = today.strftime("%B") return curr_month # Function to rename multiple files def main(): print(os.getc...
true
9f8bf1d75c990ffe082f866e9284e66ec70face2
blakexcosta/Unit3_Python_Chapter10
/main.py
557
4.15625
4
import turtle # defining a method and default value def add_list_numbers(list_name=[1, 2]): total = 0 for number in list_name: total = total + number return total # palindrome checker def is_palindrome(orig_string): letters_list = list(orig_string) letters_list.reverse() rev_string...
true
26308787dd7f1c240868fbc8d93f3886a2c320f0
parthcode/PythonMorningBatch
/caseAndOperators.py
847
4.15625
4
""" 1.If else statement These are the case statement in python which executes a block of code based on a condition 2.operators comp : > , < , == , !=, >= , <= """ # x = 90 # y = 10 # print("sum", x + y) # print("difference", x - y) # print("product", x * y) # print("Divide", x/y) # print("reminder", x % y) """ check if...
true
5e5017d97146b53314768b0e266c0ec145148956
luiscssza/LeWa
/Pre_Work/LeWa_4_OOP.py
2,346
4.5
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Mon Sep 13 10:18:39 2021 @author: luis """ # REAL PYTHON_OOP in Python 3 ############################################################################## # class Dog(): # # Class atribute # species = "Canis familiaris" # # DUNDER METHODS # #IN...
false
dee38444d6f8a2f8c2aa551cb4eea9bdaa497743
nathanvanderleest/python
/while.py
314
4.1875
4
# while loops #use Ctrl+C to terminate the program. import random num1 = random.randint(1,6) print("Guess the number:", end=" ") guess = int(input()) count = 1 while guess != num1: guess = int(input("Guess again: ")) count += 1 print("Your Right! It took you", count, "guesses")
true
25b43575af8086bb90db7271aecf7476668771af
nyy7/supermarket_register
/scripts/register.py
904
4.125
4
#!/usr/bin/python ######### # author: Yanyan Ni # date: 12/15/17 # description: a function to run calculator and print proper output ######### from calculator import Calculator import sys, os def run(sku): register = Calculator(sku) if register.input_validation(): total_price = register.price_calculator() #print...
true
c71c06e09a7ceae228dc30158aef6f5af69c504a
Jokerzhai/python-files
/module_exercise/directionary.py
791
4.4375
4
""" 字典(dictionary)是除列表以外python之中最灵活的内置数据结构类型。 列表是有序的对象集合,字典是无序的对象集合。 两者之间的区别在于:字典当中的元素是通过键来存取的,而不是通过偏移存取。 字典用"{ }"标识。字典由索引(key)和它对应的值value组成。 字典的输出是无序的 键与值分离 """ dict = {} dict['one'] = "This is one" dict[2] = "This is two" tinydict = {'name':'joker','code': '6734','dept':'sales'} #这里的:是用来分开键与值 print...
false
d4e829315440537e1934c6650fe835b8d9216555
srane96/Data-Structure-and-Algorithms-Using-Cpp-and-Python
/Python/linked_list.py
2,976
4.28125
4
class Element(object): """ Element object represents each element in the linked list.""" def __init__(self, value=None, next=None): self.value = value self.next = next class LinkedList(object): """ Linked list manages all the Element objects. """ def __init__(self, head=None): s...
true
8fad61fa51fa6835a34e3abc8f3d0cba86b90229
srane96/Data-Structure-and-Algorithms-Using-Cpp-and-Python
/Python/selection_sort.py
583
4.1875
4
def selection_sort(input_array): """ Get the smallest element and put it in the front. """ for i in range(len(input_array)): smallest = input_array[i] smallest_ind = i for j in range(i+1,len(input_array)): if input_array[j] < smallest: smallest = input_array[j...
true
adf32b219f9121da3445ad7e34316fae972d79d3
illusionist99/Python_BootCamp_42
/module00/ex01/exec.py
365
4.15625
4
import sys args = sys.argv[1:] args.reverse() displayed = "" for word in args: for letter in word[::-1]: if letter.islower(): displayed += letter.upper() elif letter.isupper(): displayed += letter.lower() else: displayed += letter if word != args[-1]...
true
6888d2e97d55e36f5483bac4682ba1231c4a29c3
isaackrementsov/led-circuit
/Blinking_LED.py
1,307
4.1875
4
# Isaac Krementsov # 3/8/2020 # Introduction to Systems Engineering # Blinking LED - Controls two blinking LED lights import RPi.GPIO as GPIO import time # GPIO pin numbers where the red and yellow LED circuits are connected RED_PIN = 18 YELLOW_PIN = 24 # Set the GPIO header board to Broadcom Model setup GPIO.setm...
true
514acdf2ac68d64a26b1f913e4e5bbed05b6a495
cpm205/ML_algorithm
/python/data_normalization/data_normalization.py
1,182
4.1875
4
# -*- coding: utf-8 -*- """ Created on Tue Aug 27 12:23:07 2019 @author: derekh """ """ It is a technique we use in Machine Learning and Deep Learning is to normalize our data. It often leads to a better performance because gradient descent converges faster after normalization. """ """ Implement normalizeRows() to ...
true
b2785d0c67d2de85f4674cb5263b3e0599505a07
rahulshivsharan/LearnPython01
/ex27.py
879
4.28125
4
def fun01(): nList = [2,4,3,7] print("Original List ",nList) # printing original list # looping through list 'nList' and multiple each element by 2 newList = [x*2 for x in nList] print("Mulitply each element by 2") print("Product of 2 ",newList) nList = [12,45,15,67,28,19] print("...
true
05078c86bcc8680eef50048f60759c3052f33617
acirederf/freddie-learns-python
/ex3.py
1,283
4.5
4
# This will print the thing it says. print "I will now count my chickens:" # This will print "Hens" and then calculate 25 plus 30 divided by 6 print "Hens", 25 + 30 / 6 # This will print "Roosters" and calculate the remainder of 100 minus the remainder of 75 divided by 4, which is 3. print "Roosters", 100 - 25 * 3 % 4...
true
0431197032b26c56e24d73e5ea7d48cce4cff33f
FrancescoSRende/Year9DesignCS-PythonFR
/AbusiveSovietCalculator.py
1,244
4.3125
4
import math import os os.system("say -v Milena Привет! I do addition for you, yes?") input("Привет! I do addition for you, yes? ") os.system("say -v Milena Too late, I do anyway!") print("Too late, I do anyway!") os.system("say -v Milena Give me number") add_1 = input("Give me number: ") os.system("say -v Milena One mo...
true
40a107b297d30796397f97d0a4613944a69fca23
gup-abhi/translation
/translator.py
2,013
4.15625
4
# importing all from tkinter from tkinter import * # importing Translator from googletrans from googletrans import Translator # creating window win = Tk() # giving title to the window win.title('translator') # specifying size of our window win.geometry('500x100') select = "" # creating a function to get language def ...
true
e3766dac92febd9712b1dc2c3712502064e4075b
cindylopez662/Mad-Libs
/mad_libs.py
2,391
4.1875
4
#creating a mad libs game - ask for words and add them to the correct places - use append??? ''' Strings Variables Concatenation Print ''' if __name__ == '__main__': adjective1 = input("Tell me an adjective ") adjective2 = input("Tell me an another adjective ") adjective3 = input("Tell me an another adjecti...
false
db38d88c3a38e9322d95f87fc18333af881a3f74
akkharin1/6230405347-oop-labs
/6230405347-oop-lab03 (1)/lab3_extra.py
1,813
4.1875
4
def lab3_special(): while True: try: first_number = check_quit("Enter the first number:") second_number = check_quit("Enter the second number:") operator = str(input("Enter the operator")) except ValueError: break if operator == "+": ...
true
a3826ef86713d169b853922a0ae98fffd80043cb
akkharin1/6230405347-oop-labs
/6230405347-oop-lab2/list_tuble.py
450
4.15625
4
tuple_1 = 1 tuple_2 = (2, 2) tuple_3 = (3, 3, 3) list_a = [tuple_1, tuple_2, tuple_3] second_element_a = list_a[1] second_sequence_a = second_element_a[1] list_1 = list(range(0, 10)) list_2 = list(range(10, 20)) list_3 = list(range(20, 30)) list_4 = list(range(30, 40)) list_b = [list_1, list_2, list_3, list...
false
a34b5049b40d1707a784aa4635f1a68ce9256642
AbdulMalik-Marikar/COMP-1405
/Guntha-Board.py
1,775
4.28125
4
#Abdul-Malik Marikar #101042166 #Key Reference: Starting out with python 3rd edition #---next 2 lines from Abdul Siddiqui. used to clear screen import os os.system("cls") #one guntha is equal to 101.7 square meters guntha = 101.17 #one board is equal to 0.007742 square meters board = 0.007742 #function concept from ...
true
2e28bb64b19882bb513ed62667bbadd3aa459c5f
K9Wan/oldcodes
/prog-py3-start/factorial.py
336
4.125
4
def factorial_recur(n): if(n<=0): return 1 else: return n*factorial_recur(n-1) def factorial_iter(n): if(n<=0): return 1 else: x=1 while(n>0): x*=n n-=1 return x n=float(input('''number ''')) print(factorial_iter(n)) print(fac...
false
731e965139d80cde23cf1a3dc9f95f6995d1a566
li-poltorak/code_guild_labs
/dec_11/cars/car.py
1,061
4.28125
4
# Create a Car class with some attributes typical of automobiles, then use it to # create some instances of different cars. # # Create a new directory called cars # Create the following 2 files inside the cars directory: main.py and car.py # In car.py, create a class called Car with the following characteristics: # A s...
true
bc65b9eb05b8e1eefb7be206cee4d664a3e0ef8a
glock3/Learning-
/Misha/Numbers/fast_exponentation.py
360
4.375
4
def pow(value, power): result=1 if power != 0: for index in range(power): result *= value return result if __name__=="__main__": print('This program requires two integers and returns value in power\n') value=int(input('Enter value: ')) power=int(input('Enter power: ')) ...
true
44b78ad97be4843b6ad8b1078a86271b1ffcc536
zabimaru1000/holbertonschool-higher_level_programming
/0x01-python-if_else_loops_functions/9-print_last_digit.py
242
4.125
4
#!/usr/bin/python3 def print_last_digit(number): if number >= 0: result = number % 10 elif number < 0: result = number % -10 if result < 0: result = result * -1 print(result, end="") return result
false
35d1e730a7dd63f902a154a8b8e49e656610cdc3
pawarspeaks/HacktoberFest_2021
/python/Phone-Directory/main.py
2,160
4.40625
4
# Python program to implement a phone directory using arrays # Array to store Contacts directory = [] # To create a contact def create_contact(): contact = [] name = input("Enter Name: ") phone = int(input("Enter phone number: ")) contact.append(name) contact.append(phone) directory.append(con...
true
586872568e78be78907e1d761c90af565d494b7c
pawarspeaks/HacktoberFest_2021
/python/Python-cipher-program/cipher.py
2,932
4.15625
4
#program with different cipher algorithms import base64 def rot13(): ch='y' while ch=='y' or ch=='Y': print("Menu:") #menu for asking choice print("1.Cipher a message") print("2.Decipher a message") choice=int(input("Enter your choice: ")) i...
true
5f205ba2255ff3f19a1b39dc92b2365a73a6267d
pawarspeaks/HacktoberFest_2021
/python/insertion_sort.py
796
4.4375
4
# A program to implement insertion sort def insertionSort(arr): for i in range(1, len(arr)): key = arr[i] j = i-1 # j = index no of sorted element while j >=0 and key < arr[j] : # if element of unsorted list is less than sorted one, it will swap arr[j+1] = arr[j] ...
true