blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
72385e51495ed17597e19bd13f49992ef96df332
karlmanalo/cs-module-project-recursive-sorting
/src/searching/searching.py
1,243
4.5
4
# TO-DO: Implement a recursive implementation of binary search def binary_search(arr, target, start, end): # Handling empty arrays if len(arr) == 0: return -1 # Setting midpoint midpoint = (start + end) // 2 if target == arr[midpoint]: return midpoint # Recursion if target i...
true
fbb99279410300d18b04e4206e9c9b043a4c0866
egbea123/Math
/Test_REMOTE_389.py
281
4.1875
4
#!/usr/bin/env python def main (): num1 = 10.5 num2 = 6.3 # Subtract two numbers sum = float(num1) - float(num2) # Display the result print('The sum of {0} and {1} is {2}',num1, num2, sum ) #division of two numbers result = 10.5 / 6.3 print ("Result :",result)
true
e0334e857bed3460736a05791dcd7469ac2fdeab
jakelorah/highschoolprojects
/Senior(2018-2019)/Python/Chapter 2/P2.8.py
781
4.25
4
#Name: Jake Lorah #Date: 09/14/2018 #Program Number: P2.8 #Program Description: This program finds the area and perimeter of the rectangle, and the length of the diagonal #Declaring the sides of a rectangle Side1 = 24 Side2 = 13 Side3 = 24 Side4 = 13 print("The 4 sides of the rectangle are 24 inches, 13 in...
true
cdf0b54074aa96db6c30c21d0aaf9026ca250317
jakelorah/highschoolprojects
/Senior(2018-2019)/Python/Tkinter GUI/3by3grid _ Window Project/7.Button_Event_handler.py
815
4.125
4
#Name: Jake Lorah #Date: 11/26/2018 #Program Number: 7.Button_Event_handler #Program Description: This program adds a button event handler. from tkinter import * window = Tk() window.title("Welcome To Computer Science 4") window.geometry('1100x500') addtext= Label(window, text="Hello How are you tod...
true
afec42e00509bc8ae26cf9f73bde35d5b47d2ee7
jakelorah/highschoolprojects
/Senior(2018-2019)/Python/Chapter 4/average.py
317
4.15625
4
#Find the average total = 0.0 count = 0 inputStr = input("Enter value: ") while inputStr != "" : value = float(inputStr) total = total + value count = count + 1 inputStr = input("Enter value: ") if count > 0 : average = total / count else : average = 0.0 print (average)
true
939412528610843959ee52b2b4fbd620083c5cb9
T-D-Wasowski/Small-Projects
/Turtle Artist/Prototype.py
473
4.15625
4
import random import turtle turtle.stamp() moveAmount = int(input("Enter the amount of moves \ you would like your Turtle Artist to make: ")) for i in range(moveAmount): turtle.right(random.randint(1,51)) #<-- For circles. turtle.forward(random.randint(1,101)) turtle.stamp() #Do you collec...
true
bd940f09734b661d4902b0f304f1d38d1530fa44
MichaelAlonso/MyCSSI2019Lab
/WeLearn/M3-Python/L1-Python_Intro/hello.py
1,107
4.21875
4
print("Hello world!") print("Bye world!") num1 = int(raw_input("Enter number #1: ")) num2 = int(raw_input("Enter number #2: ")) total = num1 + num2 print("The sum is " + str(total)) num = int(raw_input("Enter a number: ")) if num > 0: print("That's a positive number!") print("Do cherries come from cherry bloss...
true
ab631a8f16be070bb556ed662c1af5931cd9cbe7
vishalagg/Using_pandas
/bar_plot.py
1,829
4.625
5
import matplotlib.pyplot as plt ''' In line charts, we simply pass the the x_values,y_values to plt.plot() and rest of wprk is done by the function itself. In case of bar graph, we have to take care of three things: 1.position of bars(ie. starting position of each bar) 2.position of axis labels. 3.width o...
true
3cb86970951a4c592edf191fb44af65aca41e321
rachelprisock/python_hard_way
/ex3.py
1,014
4.21875
4
from __future__ import division print "I will now count my chickens:" # PEMDAS so 30 / 6 = 5 and 25 + 5 = 30 print "Hens", 25 + 30 / 6 # 25 * 3 = 75, 75 % 4 = 3, so 100 - 3 = 97 print "Roosters", 100 - 25 * 3 % 4 print "Now I will count the eggs:" # 4 % 2 = 0, 1 / 4 (no floats with /) = 0 # so 3 + 2 + 1 - 5 + 0 - 0...
true
34a8d045b8b194670396993143d998ff0ffc8605
Kyle-Everett10/cp_1404_pracs
/practical_3/oddName.py
562
4.125
4
"""Kyle""" def main(): name = input("Enter your name here: ") while name == "": print("Not a valid name") name = input("Enter your name here: ") frequency = int(input("How frequent do you want the names to be taken?: ")) print(extract_characters(name, frequency)) def extract_characters...
true
5536d5bf0689156156e257522381bc2122351be7
thinpyai/python-assignments
/python_small_exercises/sum_matix_crosses.py
745
4.28125
4
def sum_all_cross(matrix): """ Sum all cross direction of matrix. matrix: input integer value in list. """ sum = sum_cross(matrix) reversed_matrix = list(reversed(matrix)) sum += sum_cross(reversed_matrix) return sum def sum_cross(matrix): """ Sum matrix in one cross direction....
true
de9325d80d1942fec3c7298d01dedc2bd4b864d5
thinpyai/python-assignments
/python_small_exercises/flatten.py
1,566
4.375
4
# Approximate 1 ~ 1.5h # For this exercise you will create a global flatten method. The method takes in any number of arguments and flattens them into a single array. If any of the arguments passed in are an array then the individual objects within the array will be flattened so that they exist at the same level as the...
true
f4291c2cc1fb648f6cb11ceb8dd5de3fb8d078ed
CarlosArro2001/Little-Book-of-Programming-Problems-Python-Edition
/cards.py
1,100
4.375
4
#... #Aim : Write a program that will generate a random playing cards , when the return return is pressed. # Rather than generate a random number from 1 to 52 . Create two random numbers - one for the suit and one for the card. #Author : Carlos Raniel Ariate Arro #Date : 09-09-2019 #... #...
true
266b63afbc2a3739423616db5fc2dd395c6977f5
shiyuan1118/Leetcode-in-Python
/Leetcode in Python/double index/merge sorted array(88).py
585
4.21875
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Fri May 8 13:09:50 2020 @author: baoshiyuan """ #Merge Sorted Array class Solution: def merge(nums1, m, nums2, n): while m>0 and n>0: if nums2[n-1]>nums1[m-1]: nums1[m+n-1]=nums2[n-1] ...
true
86686597a2fd83e42237aa24e038a360d9227d8c
Faithlmy/Python_base
/P_base/faith_class/class_inherite.py
926
4.15625
4
#!/usr/bin/env python # # -*- coding:utf-8 -*- # fileName : class_inherite.py """ python的单继承 """ class book(object): __author = '' __name = '' __page = '' def __check(self, item): if item == '': return 0 else: return 1 def show(self): if self.__check...
false
67de285c1a6768c8a3b004bfb5364cdf88acdfc6
ianevangelista/Python3
/Ranges.py
336
4.1875
4
for n in range(3, 10, 2): # går fra 3-9 med hopp på 2 print(n) burgere = ['cheese', 'big mac', 'double cheese', 'chicken salsa'] for n in range(len(burgere)): #lengden på lista print(n, burgere[n]) for n in range(len(burgere) -1, -1, -1): # starte på siste, avslutte på første og hopp baklengs print(n, b...
false
cb4846cfca090647945f8966ff89163050e15e31
akhi1212/pythonpracticse
/StringTask_2_only_first_three_character_of_string.py
525
4.1875
4
## Compare only first three character of string def comparisonFirstThreeChars(s1_inp,s2_inp): a = len(s1_inp) b = len(s2_inp) c_newa = s1_inp[0:3] print(c_newa) d_newb = s2_inp[0:3] print(d_newb) if c_newa == d_newb: print("first three chars matched enjoy your are become code in coding") else: print("Chage ...
false
786fb08e27d3c8a4e79b3525b6169200b081be7a
oceanpad/python-tutorial
/code/basic/if/if.py
242
4.15625
4
age = input('please input your age(int):') try: age = int(age) if age > 18 : print("adult") elif age < 6 : print("children") else : print("teenage") except ValueError: print("'" + age + "' is not an int!")
false
65e075c9b4d051a8308b590626a0828cdbc9c695
StefanDimitrovDimitrov/Python_Basic
/01. First-Steps in Codding Lab+Exr/07.time_to_complete_projects.py
1,071
4.1875
4
""" Напишете програма, която изчислява колко часове ще са необходими на един архитект, за да изготви проектите на няколко строителни обекта. Изготвянето на един проект отнема три часа. Вход От конзолата се четат 2 реда: 1. Името на архитекта - текст; 2. Брой на проектите - цяло число. Изход На конзолата се отпечатва: •...
false
53ab52140f9e10ff5670353d9a2296034046a01c
StefanDimitrovDimitrov/Python_Basic
/01. First-Steps in Codding Lab+Exr/08.zoo_food_math_challenge.py
1,045
4.125
4
""" Напишете програма, която пресмята нужните разходи за закупуването на храна за кучета и други животни. Една опаковка храна за кучета е на цена 2.50лв., а всяка останала, която не е за тях струва 4лв. Вход От конзолата се четат 2 реда: 1. Броят на кучетата - цяло число; 2. Броят на останалите животни - цяло число. ...
false
cf35a1461dde6e392ef6318378bbe892819e1e20
StefanDimitrovDimitrov/Python_Basic
/01. First-Steps in Codding Lab+Exr/12.deposits.py
756
4.34375
4
""" Напишете програма, която изчислява каква сума ще получите в края на депозитния период при определен лихвен процент. Използвайте следната формула: сума = депозирана сума + срок на депозита * ((депозирана сума * годишен лихвен процент ) / 12) Вход Изход 200 3 5.7 202.85 Вход Изход 2350 6 7 2432.25 """ def de...
false
c7a9f186a03d699cfb4c205e0d4012f637d9963b
carden-code/python
/stepik/third_digit.py
356
4.15625
4
# A natural number n is given, (n> 99). Write a program that determines its third (from the beginning) digit. # # Input data format # The input to the program is one natural number, consisting of at least three digits. # # Output data format # The program should display its third (from the beginning) digit. num = input...
true
74446a287ad4ff8721c0a882051cd13971e88ba4
carden-code/python
/stepik/removing_a_fragment.py
504
4.1875
4
# The input to the program is a line of text in which the letter "h" occurs at least twice. # Write a program that removes the first and # last occurrences of the letter "h" from this string, as well as any characters in between. # # Input data format # The input to the program is a line of text. # # Output data format...
true
69b16d9c547d2c153d686af7d849138a64ca1bd1
carden-code/python
/stepik/simple_cipher.py
424
4.3125
4
# The input to the program is a line of text. # Write a program that translates each of its characters into their corresponding code # from the Unicode character table. # # Input data format # The input to the program is a line of text. # # Output data format # The program should output the code values of the string ch...
true
69fd35f3faed85dd3ccc5a9a5c1fd5943b52623f
carden-code/python
/stepik/replace_me_completely.py
360
4.21875
4
# The input to the program is a line of text. # Write a program that replaces all occurrences of the number 1 with the word "one". # # Input data format # The input to the program is a line of text. # # Output data format # The program should display the text in accordance with the condition of the problem. string = in...
true
e0268220615c83737c7a823fd3195ed76188ab85
carden-code/python
/stepik/word_count.py
468
4.40625
4
# The input to the program is a line of text consisting of words separated by exactly one space. # Write a program that counts the number of words in it. # # Input data format # The input to the program is a line of text. # # Output data format # The program should output the word count. # # Note 1. A line of text does...
true
6be2286fe9476c8ee964976e14b3de72d4228609
carden-code/python
/stepik/fractional_part.py
342
4.375
4
# A positive real number is given. Output its fractional part. # # Input data format # The input to the program is a positive real number. # # Output data format # The program should output the fractional part of the number in accordance with the condition of the problem. num = float(input()) fractional = num - (int(nu...
true
10ccf77bd405de979d859da5f0d2489cecfb845e
carden-code/python
/stepik/prime_numbers.py
583
4.1875
4
# The input to the program is two natural numbers a and b (a < b). # Write a program that finds all prime numbers from a to b, inclusive. # # Input data format # The program receives two numbers as input, each on a separate line. # # Output data format # The program should print all prime numbers from a to b inclusive,...
true
98c21ee3a49b5420d1f74200a2b2c097c5c49a7a
carden-code/python
/stepik/same_numbers.py
483
4.15625
4
# A natural number is given. Write a program that determines if a specified number consists of the same digits. # # Input data format # One natural number is fed into the program. # # Output data format # The program should print "YES" if the number consists of the same digits and "NO" otherwise. num = int(input()) las...
true
bd2ee920b3b63169a741adedb5fc6c37fad8931f
carden-code/python
/stepik/diagram.py
469
4.21875
4
# The input to the program is a string of text containing integers. # Write a program that plots a bar chart for given numbers. # # Input data format # The input to the program is a text string containing integers separated by a space character. # # Output data format # The program should output a bar chart. # Sample I...
true
d74b3a0f209a35e82e1061370ea268d36cb3f1b4
carden-code/python
/stepik/reverse_number.py
558
4.53125
5
# Write a program that reads one number from the keyboard and prints the inverse of it. # If at the same time the number entered from the keyboard is zero, # then output "The reverse number does not exist" (without quotes). # # Input data format # The input to the program is one real number. # # Output data format # Th...
true
8c678c8d77d22a603a84c0434d459197f6eadf6f
carden-code/python
/stepik/number_of_members.py
630
4.375
4
# The program receives a sequence of words as input, each word on a separate line. # The end of the sequence is one of three words: "stop", "enough", "sufficiently" (in small letters, no quotes). # Write a program that prints the total number of members in a given sequence. # # Input data format # The program receives ...
true
b06660bcc21e0142f6cdb78adb357b8df1953fb5
carden-code/python
/stepik/characters_in_range.py
500
4.3125
4
# The input to the program is two numbers a and b. # Write a program that, for each code value in the range a through b (inclusive), # outputs its corresponding character from the Unicode character table. # # Input data format # The input to the program is two natural numbers, each on a separate line. # # Output data f...
true
84342c5f534b935c231e13a9836c4af83e840fe2
carden-code/python
/stepik/sum_of_digits.py
218
4.125
4
# Write a function print_digit_sum () that takes a single integer num and prints the sum of its digits. def print_digit_sum(_num): print(sum([int(i) for i in str(_num)])) num = int(input()) print_digit_sum(num)
true
0291ba0bf851212409f7ac5f928153ba0fda249f
carden-code/python
/stepik/line_by_line_output.py
347
4.4375
4
# The input to the program is a line of text. Write a program that displays the words of the entered line in a column. # # Input data format # The input to the program is a line of text. # # Output data format # The program should display the text in accordance with the condition of the problem. string = input() print(...
true
f3e5e2a96224b5ad2133b5683b8803a654141797
carden-code/python
/stepik/sum_num_while.py
497
4.28125
4
# The program is fed a sequence of integers, each number on a separate line. # The end of the sequence is any negative number. # Write a program that outputs the sum of all the members of a given sequence. # # Input data format # The program is fed with a sequence of numbers, each number on a separate line. # # Output ...
true
ce3399dcdfc212a588de430f21cb81735264b258
Mario-D93/habit_tracker
/t_backend.py
1,885
4.21875
4
import sqlite3 class Database(): ''' The Database object contains functions to handle operations such as adding, viewing, searching, updating, & deleting values from the sqlite3 database The object takes one argument: name of sqlite3 database Class is imported to the frontend script (t_fronted.py) ''' def _...
true
c93ea29aafd03ee6e05efb2a460b9f93fa017107
dfkigs/helloworld
/python/basic/generator/generator.py
1,114
4.1875
4
#!/usr/bin/python # keyword : yield def flatten(nested): for sublist in nested: for element in sublist: yield element def flatten_recursion(nested): try: try: nested + '' except TypeError: pass else: raise TypeError for sublist in nested: for element in flatten_recursion(sublist): yie...
false
89fafeb66a04184fb1f8fe490ecde074c68ae4bc
0n1udra/Learning
/Python/Python_Problems/Rosalind-master/Algorithmic_009_BFS.py
1,705
4.21875
4
#!/usr/bin/env python ''' A solution to a ROSALIND problem from the Algorithmic Heights problem area. Algorithmic Heights focuses on teaching algorithms and data structures commonly used in computer science. Problem Title: Breadth-First Search Rosalind ID: BFS Algorithmic Heights #: 012 URL: http://rosalind.info/probl...
true
7bc496f3183da034730fad98d0b6bc26b27573c2
0n1udra/Learning
/Python/Python_Problems/Rosalind-master/001_DNA.py
934
4.1875
4
#!/usr/bin/env python ''' A solution to a ROSALIND bioinformatics problem. Problem Title: Counting DNA Nucleotides Rosalind ID: DNA Rosalind #: 001 URL: http://rosalind.info/problems/dna/ ''' from collections import Counter def base_count_dna(dna): '''Returns the count of each base appearing in the given DNA se...
true
c8508b6bba66b1052ca57cc2b9b31af313f805da
0n1udra/Learning
/Python/Python_Problems/Interview_Problems-master/python/logarithm.py
732
4.1875
4
''' Compute Logarithm x: a positive integer b: a positive integer; b >= 2 returns: log_b(x), or, the logarithm of x relative to a base b. Assumes: It should only return integer value and solution is recursive. ''' def myLog(x, b): if x < b: return 0 else: return myLog(x/b, b) + 1 if __nam...
true
6fb3874538b010fa6367cfd1ef6ed6fd392e91c3
TheJoeCollier/cpsc128
/code/python2/tmpcnvrt.py
1,242
4.5
4
########################################################### ## tmpcnvrt.py -- allows the user to convert a temperature ## in Fahrenheit to Celsius or vice versa. ## ## CPSC 128 Example program: a simple usage of 'if' statement ## ## S. Bulut Spring 2018-19 ## Tim Topper, Winter 2013 #############################...
true
0048afa92e4b1d09b35e2d7ae5c1dbe074f0b60e
shraddhaagrawal563/learning_python
/numpy_itemsize.py
705
4.28125
4
# -*- coding: utf-8 -*- #https://www.tutorialspoint.com/numpy/numpy_array_attributes.htm import numpy as np x = np.array([1,2,3,4,5]) print ("item size" , x.itemsize) #prints size of an individual element x = np.array([1,2,3,4,5,4.2,3.6]) print ("item size" , x.itemsize) #converts every element to the largest of si...
true
1e0b7b0aed95cfb2db8b1f382bd898fef6c5e595
hyetigran/Sorting
/src/recursive_sorting/recursive_sorting.py
1,465
4.125
4
# TO-DO: complete the helpe function below to merge 2 sorted arrays def merge(arr, arrA, arrB): # TO-DO left_counter = 0 right_counter = 0 sorted_counter = 0 while left_counter < len(arrA) and right_counter < len(arrB): if arrA[left_counter] < arrB[right_counter]: arr[sorted_co...
true
5b4b1cea5e01a539d288bde1bbc1ae264434f962
farooqbutt548/Python-Path-Repo
/strings.py
1,303
4.34375
4
# Strings # Simple String '''string1 = ' this is 1st string, ' string2 = "this is 2nd string" print(type(string1)) connect_string = string1+ " "+string2 print(connect_string) # print("errer"+3) erreor print('this is not error'+' ' + str(3)) print('this will print 3 ti...
true
8b8f9374e4084d763f3b4195f5be59c95deeea50
Khepanha/Python_Bootcamp
/week01/ex/e07_calcul.py
287
4.125
4
total = 0 while True: number = input("Enter a number: \n>> ") if number == "exit": break else: try: number = int(number) total += number print("TOTAL: ",total) except: print("TOTAL: ",total)
true
faa5907d95f8ab25764f7dd6b0a05ef44f5e7f9b
rp764/untitled4
/Python Object Orientation /OrientationCode.py
1,348
4.40625
4
# OBJECT ORIENTED PROGRAMMING # INHERITANCE EXAMPLE CODE class Polygon: width_ = None height_ = None def set_values(self, width, height): self.width_ = width self.height_ = height class Rectangle(Polygon): def area(self): return self.width_ * self.height_ class Triangle(...
true
1a057628c822895bf6e506846fb5fc7de0e10184
giovannyortegon/holbertonschool-machine_learning
/supervised_learning/0x07-cnn/1-pool_forward.py
1,717
4.125
4
#!/usr/bin/env python3 """ Pooling """ import numpy as np def pool_forward(A_prev, kernel_shape, stride=(1, 1), mode='max'): """ pool - performs pooling on images Args: A_prev is a numpy.ndarray of shape (m, h_prev, w_prev, c_prev) containing the output of the previous layer. ...
true
e97603a1bf321aaede95c36998fe3c780b94ef84
giovannyortegon/holbertonschool-machine_learning
/math/0x00-linear_algebra/3-flip_me_over.py
551
4.25
4
#!/usr/bin/env python3 """ the transpose of a 2D matrix """ matrix_shape = __import__("2-size_me_please").matrix_shape def matrix_transpose(matrix): """ matrix_transpose - the transpose of a 2D matrix mat1: Input first matrix mat2: Input second matrix Return: New matrix """ m_length = matrix_s...
true
9c0a6af5710db5a8921f02a6420006081eb802fd
santoshr1016/WeekendMasala
/itsybitsy/MyDP_Quest/stair_case_to_heaven_with_fee.py
843
4.125
4
""" You can take at max 2 steps if _ ways 1, you are already there 1 _1 if _| ways needed from Ground 1, G->1 _2 _| if _| ways needed from Ground 2, G->1, 1->1 G->2 _3 _|2 _|1 if _| steps needed from Ground will be Ways to reach from seco...
false
7d19eb3f453acd08dc5ac3a415c51f6e3a01afdc
santoshr1016/WeekendMasala
/itsybitsy/collections_DS/most_occuring_items.py
657
4.4375
4
words = [ 'look', 'into', 'my', 'eyes', 'look', 'into', 'my', 'eyes', 'the', 'eyes', 'the', 'eyes', 'the', 'eyes', 'not', 'around', 'the', 'eyes', "don't", 'look', 'around', 'the', 'eyes', 'look', 'into', 'my', 'eyes', "you're", 'under' ] from collections import Counter word_counts = Count...
false
192d8c2fa81b0f8469deb319622e8962d4e1273a
EachenKuang/LeetCode
/code/202#Happy Number.py
2,457
4.125
4
# First of all, it is easy to argue that starting from a number I, if some value - say a - appears again during the process after k steps, the initial number I cannot be a happy number. Because a will continuously become a after every k steps. # Therefore, as long as we can show that there is a loop after running the ...
true
4c599c9f902ed403eb88fa39b61657003917751d
Billoncho/EncoderDecoder
/EncoderDecoder.py
1,469
4.5625
5
# EncoderDecoder.py # Billy Ridgeway # Encode or decode your messages by shifting the ASCII characters. message = input("Enter a message to encode or decode: ") # Prompt the user for a message to encode/decode. message = message.upper() # Convert the string of letters to upper...
true
66ca9d86e2fc88d1402c31fbc1078c4cf9b262b3
Sophon96/2021-software-general-homework
/lesson_2_1.py
1,443
4.21875
4
# A student has taken 3 tests in a class, and wants to know their current grade # (which is only calculated by these tests). # Ask the user to input all three of the test scores for the student, one by one. # The program should then calculate the average test score (average is adding all three # test scores toget...
true
a2a18544685a691a7b072d14b04f7b2f1e6ddca7
SebastianoFazzino/Python-for-Everybody-Specialization-by-University-of-Michigan
/Word_coutnter_using_dictionaries.py
461
4.125
4
#how to find the most common word in a text: openfile = input("Enter file name: ") file = open(openfile) counts = dict() for line in file: words = line.split() for word in words: counts[word] = counts.get(word,0) + 1 bigcount = None bigword = None for word, count in counts.items(): ...
true
5cd45a7e4fee6f5440f4126b64ae8e80730e9ae9
SebastianoFazzino/Python-for-Everybody-Specialization-by-University-of-Michigan
/Conditional Statements.py
907
4.25
4
#Calculating the score score = input("Enter Score: ") try: score = float(score) if score > 0.0 and score < 0.6: print ("F") elif score >= 0.6 and score <= 0.69: print("D") elif score >= 0.7 and score <= 0.79: print ("C") elif score >= 0.8 and score <= 0.89: ...
true
96dd5264ff38d0fd2c97413156397cea4da742d9
JLockleyASC/jaymond_ASC3
/mash.py
1,132
4.15625
4
house =["Mansion", "Apartment", "igloo", "House" ,"tent", "tree house"] spouse =["peewee herman", "Snookie", "Oprah", "kylie jennner"] car =["horse", "bugatti with one wooden wheel", "DeLorean DMC-12", "Scooter"] kids =["0", "1", "2", "5"] print ("Enter the name of three people you could marry: ") name1 = input("Name1:...
false
e3e14d6b50222fddaea52f6a1a9012daf1654cdb
NakonechnyiMykhail/PyGameStart
/lesson26/repeat.py
505
4.1875
4
# functions without args without return # 0. import random # library # 1. create a function with name "randomizer" # 2. create a varieble with name "data" = 'your text at 6-10 words' # or "lorem ipsum..." # 3. select var "data" with text and with random method print # with for-loop 20 times only ONE character data = ...
true
e128dc2672cbf6b6b4dee1c1537884ffcc9dc86a
ridhim-art/practice_list2.py
/tuple_set_dictionary/example_contacts.py
707
4.1875
4
#program where user can add contacta for contact book contacts = {'help': 100} print('your temp contact book') while True: name = input("=> enter contact name :") if name: if name in contacts: print('=> contact found') print(f'=> {name} :{contacts[name]}') else: ...
true
c504e5e4f9433cea90d3a95157a7424ab9a74f25
ridhim-art/practice_list2.py
/prime_number.py
287
4.15625
4
# 7 -> 7/2,7/3,7/4,7/5,7/6 prime # 20 -> 20/2 non prime # program to find if number is prime num = int(input('enter a number : ')) for i in range(2,num): print(num,'%',i,'=',num % i) if num % i ==0: print('non prime') break else: print('prime')
false
ad5fdda33ea752ed77936eba34e371562ed868bc
ridhim-art/practice_list2.py
/condition_1.py
264
4.21875
4
a = 10 if a > 5: print('this is a greater than 5') if a > 15: print ('this is also bigger than 15') if a == 10: print ('thisis equal to 10 ') if a == 5 or a < 15: print ('so this condition is true ') print('any one of them is true')
false
d9e76d1f7a25dfa8d4e160ce4a1f89fcd8eaf704
subbuinti/python_practice
/loopControlSystem/HallowDaimond.py
865
4.25
4
# Python 3 program to print a hallow diamond pattern given N number of rows alphabets = ['A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J', 'K', 'L', 'M', 'N', 'O', 'P', 'Q', 'R', 'S', 'T', 'U','V', 'W', 'X', 'Y', 'Z'] # Diamond array diamond = [] rows = -1 # Prompt user to enter number of rows while rows ...
true
f6ef587277e59d1568fad4072db790627afc6657
jaewHong/myappsample
/jae_week1hw.py
251
4.125
4
#!/usr/bin/env python3 import datetime if __name__ == '__main__': print("user name:",end='') username = input() date = datetime.datetime.now() print("Hello {0}! Today is [{1}/{2}/{3}].".format(username,date.month,date.day,date.year))
false
915ca9bbea032f07b0adc06a94f3409c6d7e3bad
lokeshsharma596/Base_Code
/Pyhton/Lambda_Map_Filter.py
2,346
4.375
4
# Lambda Function # any no of arguments but only one statement # single line ,anoymous,no def,no return # example-1 def sum(a, b, c): return a+b+c print(sum(4, 5, 1)) add=lambda a,b,c: a+b+c print(add(4, 5, 1)) # example-2 cube=lambda n:n**3 print(cube(4)) # Map Function # Atleast Two arguments :function and ...
true
7c1c8e21773cf05be04e25f2cc42f9b947929f39
andrezzadede/Curso-de-Python-POO
/decorators.py
743
4.28125
4
''' Decorator = Função que recebe outra função como parametro, gera uma nova função que adiciona algumas funcionalidades à função original e a retorna essa nova funçao ''' ''' def modificar(funcao): def subtrair(a, b): return a - b return subtrair @modificar def soma(a, b): return a + b print(som...
false
b201d29f539242f9295b7826df8cd4834b173a02
gillc0045/CTI110
/Module3/CTI110_M3HW2_bodyMassIndex_gillc0045.py
502
4.4375
4
# Write a program to calculate a person's body mass index (BMI). # 12 Jun 2017 # CTI 110 - M3HW2 -- Body Mass Index # Calvin Gill weight = float(input("Enter the person's weight (pounds): ")) height = float(input("Enter the person's height (inches): ")) bmi = weight*(703/height**2) print("The person's BMI va...
true
f74f8032c81b88479718b6bd9e861f1bb04c77c1
HussainWaseem/Learning-Python-for-Data-Analysis
/NewtonRaphson.py
1,625
4.1875
4
''' Newton Raphson ''' # Exhaustive Enum = In this we were using guesses but we were going all the way from beginning to end. # And we were only looking for correct or wrong answers. No approximation. # Approximation = It was an improvement over Exhaustive Enum in a way that now we can make more correct guesses # a...
true
026139b2e0beed35054a503d4c308c5450e6684b
HussainWaseem/Learning-Python-for-Data-Analysis
/FractionsToBinary.py
1,695
4.3125
4
''' Fractions to Binary ''' # Method ->> Fractions -> decimals using 2**x multiplication -> Then converting decimal to binary. # -> Then dividing the resultant binary by 2**x (Or right shift x times) to get the outcome. num = float(input("Give your fraction : ")) # we have to take a float. x = ...
true
346c05201be6379aea4801d2ad28d3b495258b4a
HussainWaseem/Learning-Python-for-Data-Analysis
/Tuples.py
2,673
4.40625
4
''' Tuples ''' # Immutables. # defining tuples = With braces or without braces t = (1,2,'l',True) print(t) g = 1,2,'l',False print(g) # Tuples are Squences (just like Strings and lists) = So they have 6 properties = len(),indexing,slicing, concatenation, # iterable and membership test (in and not in) # Range objec...
true
85bdb20c063b623b3ba8b576096318804c70b212
sakar123/Python-Assignments
/Question24.py
261
4.3125
4
"""24. Write a Python program to clone or copy a list.""" def clone_list(given_list): new_list = [] for i in given_list: new_list.append(i) return new_list print(clone_list([1, 2, 3, 4, 5])) print(clone_list([(1, 2), ('hello', 'ji')]))
true
cc02f947a004d1c929d2a1ca6a79808909ed7d02
sakar123/Python-Assignments
/Question37.py
410
4.1875
4
"""37. Write a Python program to multiply all the items in a dictionary.""" def prod_dicts(dict1): list_of_values = dict1.values() product_of_values = 1 for i in list_of_values: product_of_values = i * product_of_values return product_of_values print(prod_dicts({1: 1, 2: 4, 3: 9, 4: 16, 5: 2...
true
69c3484772644518a3245f6a925858232fa066ab
ngongongongo/Python-for-beginners
/Chapter 1 - Python Basics/1.8-Practice.py
2,669
4.4375
4
#1.8 Practice #---------------------------------------- #Question 1 #Prompt the computer to print from 1 to 10 using loop #Ask user if he/she wants to do it again using loop #Question 2 #Write a rock-paper-scissor game #The winning condition is either the player or the computer win 3 times first #Hint: import random...
true
d4caf8442473e71d624651bb9a8ccc67384ef05d
Bua0823/python_clases
/clase_2/imprimir_opcion.py
1,470
4.1875
4
# mensaje =""" # hola # como estas? # elige una de estas opciones por favor # 1 # 2 # 3 # 4""" #print(mensaje) opcion = int(input('ingrese una opcion: ')) #if opcion == 1: #print(f'la opcion que elegiste es {opcion}') #print('adios!') #elif opcion == 2: #print(f'la opcion que elegiste es {opcion}') #pri...
false
0c5c216e024271752c5cf2cebddfa5d2e70d846c
jingyi-stats/-python-
/python_syntax.py
865
4.1875
4
# Python syntax 语法 # print absolute value of an integer a = 100 if a >= 0: print(a) else: print(-a) # print if the input age is adult or not year = input("Please enter your birth year: ") print(2020 - int(year)) a = int(2020 - int(year)) if a >= 18: print("Adult") else: print("underage") # print wh...
true
b0866402b38328d8070e078a7acef16b8e9fb7eb
Dhiraj-tech/Python-Lab-Exercise
/greater,smallest and odd number among them in list (user input in a list).py
400
4.21875
4
#WAP to take a user input of a list consist of ten numbers and find (1)greater no among the list (2)smaller no among the list (3) list of a odd number list=[] odd=0 for i in range(10): num=int(input("enter a number")) list.append(num) print("minimum no among them:",min(list)) print("maximum no among them:",max(...
true
b96f2252a44943ccef0b5cd6950479cf67241857
Dhiraj-tech/Python-Lab-Exercise
/(4) define a function and show the multiples of 3 and 5.py
231
4.34375
4
#write a function that returns a sum of multiples of 3 and 5 between 0 and limit(parameter) def function(): for i in range(21): sum=0 if i%3==0 or i%5==0: sum=sum+i print (sum) function()
true
e9eee3acec1e30befcc951b356fb81f2302a4e56
Dhiraj-tech/Python-Lab-Exercise
/calculator by using def.py
709
4.125
4
print("enter a choice") print("1 for addition") print("2 for substraction") print("3 for multiplication") print("4 for division") choice=int(input()) def add(): x=int(input("first number")) y=int(input("second number")) z=x+y print(z) def substraction(): a=int(input("first number")) b=int(input(...
false
a443b4acf86964757b39b1b912c93259629ca1b4
ButtonWalker/Crash_Course
/4_Exercise2.py
455
4.125
4
for value in range(1, 21): print(value) numbers = [] for value in range(1,1001): numbers = value print(numbers) digits = range(1, 1000001) print(min(digits)) print(max(digits)) print(sum(digits)) # odd numbers for value in range(1,21,2): print(value) for value in range(3, 30, 3): print(value) c...
true
74bff2e14dc504862c597880f6aeec91e3406fde
abhikot1996/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-
/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-/PracticeWebExersicesProgram.py
965
4.21875
4
# 1) Program to print twinkle twinkle little star poem #print("""Twinkle, twinkle, little star,\n\t #How I wonder what you are!\n #\t\tUp above the world so high,\n #\t\tLike a diamond in the sky.\n #Twinkle, twinkle, little star,\n #\tHow I wonder what you are!) #""") # 2) Program to print version of python installed...
true
62f570056a533dd8152b2139b28614486a79b7e1
abhikot1996/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-
/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-/star_args_in_function.py
514
4.28125
4
''' *args in Function * '*args' is used in function when we want to assign argument as many as we want then *args is used in function definition. * '*ola' same as '*args' ''' # E.g , # *args def greet(*args): print("Hello " +args[0]+" how are you") print("Hello " + args[1] + " I don...
false
07c1ed5ed93ba79ecedb4ba9aa85a6f66ed24cee
abhikot1996/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-
/Python-Python-All-In-One-Mastery-From-Beginner-to-AdvanceEasy-Way-/Prime_no.py
304
4.125
4
''' Prime no * Number which can divide only itself ''' num = int(input("Enter no: ")) if num>1: for i in range(2,num): if num%i==0: print(f"{num} is not a prime no") break else: print(f"{num} is prime no") else: print(f"{num} is not prime no")
false
fc243f4ddc5a2da7b2385e7a09a2780f1f964d2a
carmelobuglisi/programming-basics
/projects/m1/005-units-of-time-again/solutions/pietrorosano/solution_005-againUnitsOfTime.py
998
4.40625
4
# In this exercise you will reverse the process described in Exercise 24. Develop a program that begins by reading a number of seconds from the user. Then your program should display the equivalent amount of time in the form D:HH:MM:SS, where D, HH, MM, and SS represent days, hours, minutes and seconds respectively. Th...
true
cac250740ee4e25dee623c499b6654bcf234a831
daniocen777/Proyectos-python
/programacion_de_funciones/funciones_recursivas.py
749
4.125
4
def cuenta_atras(num): num -= 1 if num > 0: print(num) cuenta_atras(num) else: print('Boooooooom!') print('Fin de la función', num) cuenta_atras(5) ''' result: 4 3 2 1 Boooooooom! Fin de la función 0 Fin de la función 1 Fin de la función 2 Fin de la función 3 Fin de la función 4...
false
363bea7a6b63e651138099e4a455cad66b0eeee3
daniocen777/Proyectos-python
/colecciones_de_datos/pilas_colas_con_listas.py
897
4.21875
4
''' En python, se emulan las pilas con listas ''' # pila => sólo añadir o quitar (LIFO) from collections import deque pila = [3, 4, 5] pila.append(6) pila.append(7) print(pila) # result => [3, 4, 5, 6, 7] # Sacar el último elemento pila.pop() print(pila) # result => [3, 4, 5, 6] ''' Error si se quita el último elemen...
false
90f62a8ec5f6cee9e9d88f5bfb8f36599ca33616
a3X3k/Competitive-programing-hacktoberfest-2021
/CodeWars/Calculating with Functions.py
1,540
4.34375
4
''' 5 kyu Calculating with Functions https://www.codewars.com/kata/525f3eda17c7cd9f9e000b39/train/python This time we want to write calculations using functions and get the results. Let's have a look at some examples: seven(times(five())) # must return 35 four(plus(nine())) # must return 13 eight(minus(three())) # mu...
true
481537d5d715298b4f112158bf257dd23967c5d5
a3X3k/Competitive-programing-hacktoberfest-2021
/CodeWars/Build Tower.py
939
4.125
4
''' 6 kyu Build Tower https://www.codewars.com/kata/576757b1df89ecf5bd00073b/train/python Build Tower Build Tower by the following given argument: number of floors (integer and always greater than 0). Tower block is represented as * Python: return a list; JavaScript: returns an Array; C#: returns a stri...
true
cb1a541b30cec2a374ec146c53fcab3b074fbfdd
Jsmalriat/python_projects
/dice_roll_gen/dice_roll.py
2,683
4.25
4
# __author__ = Jonah Malriat # __contact__ = tuf73590@gmail.com # __date__ = 10/11/2019 # __descript__ = This program takes user-input to determine the amount of times two dice are rolled. # The program then adds these two dice rolls for every time they were rolled and outputs how many # times each number 2 - ...
true
d9630b46886066ea9c30426a08e2edb4f4c41bd3
tomekregulski/python-practice
/logic/bouncer.py
276
4.125
4
age = input("How old are you: ") if age: age = int(age) if age >= 21: print("You are good to enter and you can drink!") elif age >= 18: print("You can entger, but you need a wristband!") else: print("Sorry, you can't come in :(") else: print("Please enter an age!")
true
29e7b459ca79807dc28ea3919a14347de30e5a34
vanceb/STEM_Python_Crypto
/Session3/decrypt.py
1,127
4.15625
4
############################## # Caesar Cypher - Decrypt ############################## # Define the alphabet that we are going to encode LETTERS = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ' # Define variables to hold our message, the key and the translated message message = 'This is secret' key = 20 translated = '' # Change the ...
true
dc3ddb3005f68fe2dd862b2cc70cdd2ba5c4fbbc
Stunt-Business/Py-BasicQ_As_Challenges
/Day10_oued.py
1,267
4.21875
4
# --------------------------------------------------- # Author : Erwan Ouedraogo # Community : Stunt Business # Community website : www.stuntbusiness.com # # 30 Days - Q&A Python Basic # Day 10 : 31-05-2020 # Day 10 | IG : https://www.instagram.com/stuntbusiness/ # Subject : Challenges II - Basic Calculator #-----...
false
5eb82c0b75ecd9125a10149ac70f7e9facbbf5c8
carlhinderer/python-exercises
/reddit-beginner-exercises/ex03.py
1,357
4.59375
5
# Exercise 3 # # # [PROJECT] Pythagorean Triples Checker # # BACKGROUND INFORMATION # # If you do not know how basic right triangles work, read this article on wikipedia. # # MAIN GOAL # # Create a program that allows the user to input the sides of any triangle, and then return whether the triangle is a Pythagorean # ...
true
81b6f41cf4da9ba055fa5b1efd3ba7b6993f04d0
carlhinderer/python-exercises
/daily-coding-problems/problem057.py
729
4.125
4
# Problem 57 # Medium # Asked by Amazon # # Given a string s and an integer k, break up the string into multiple lines such that # each line has a length of k or less. You must break it up so that words don't break across # lines. Each line has to have the maximum possible amount of words. If there's no way t...
true
e8ec7c1c8e7edd373c1a2dd59a98cb8444317c3a
carlhinderer/python-exercises
/ctci/code/chapter01/src/palindrome_permutation.py
769
4.3125
4
# # 1.4 Palindrome Permutation: # # Given a string, write a function to check if it is a permutation of a palindrome. # A palindrome is a word or phrase that is the same forwards and backwards. A # permutation is a rearrangement of letters. The palindrome does not need to be # limited to just dictionary word...
true
8bc07815ab7a29e1aa5b472bddaff588fc405cfa
carlhinderer/python-exercises
/zhiwehu/src/ex007.py
1,033
4.21875
4
# Question 7 # Level 2 # # Question: # Write a program which takes 2 digits, X,Y as input and generates a 2-dimensional array. The element value in # the i-th row and j-th column of the array should be i*j. # # Note: i=0,1.., X-1; j=0,1,¡­Y-1. # # Example: # Suppose the following inputs are given to the program...
true
069c09ec5a3bf11a00480ef3de0207f7161c0263
suprajaarthi/DSA
/19 Day8 CheckPalindRec.py
656
4.3125
4
# Recursive function to check if `str[low…high]` is a palindrome or not def isPalindrome(str, low, high): # base case if low >= high: return True # return false if mismatch happens if str[low] != str[high]: return False # move to the next pair else: ret...
false
322db8f52f43c93c7ee36440e6355b62f1054166
schase15/Sprint-Challenge--Data-Structures-Python
/names/binary_search_tree.py
2,965
4.4375
4
# Utilize the BST from the hw assignment # Only need contains and insert methods class BSTNode: def __init__(self, value): self.value = value self.left = None self.right = None # Insert the given value into the tree # Compare the input value against the node's value # Check if ...
true
198ce51002296c632ee5522b2ab4f5dec317727d
wangtaodd/LeetCodeSolutions
/069. Sqrt.py
586
4.25
4
""" Implement int sqrt(int x). Compute and return the square root of x. x is guaranteed to be a non-negative integer. Example 1: Input: 4 Output: 2 Example 2: Input: 8 Output: 2 Explanation: The square root of 8 is 2.82842..., and since we want to return an integer, the decimal part will be truncated. """ class...
true
44327cd41d09d206b171781dd89aae73376e2dec
wangtaodd/LeetCodeSolutions
/693. Binary Number with Alternating Bits.py
770
4.25
4
""" Given a positive integer, check whether it has alternating bits: namely, if two adjacent bits will always have different values. Example 1: Input: 5 Output: True Explanation: The binary representation of 5 is: 101 Example 2: Input: 7 Output: False Explanation: The binary representation of 7 is: 111. Example 3: Inp...
true
42b522c5d47b3f31c12398ee1304a62814dec748
wangtaodd/LeetCodeSolutions
/530. Minimum Absolute Difference in BST.py
902
4.1875
4
""" Given a binary search tree with non-negative values, find the minimum absolute difference between values of any two nodes. Example: Input: 1 \ 3 / 2 Output: 1 Explanation: The minimum absolute difference is 1, which is the difference between 2 and 1 (or between 2 and 3). Note: There are at l...
true
ea0ce1b541e74ca38790a66990d809be4ce825af
wangtaodd/LeetCodeSolutions
/107. Binary Tree Level Order Traversal II.py
1,190
4.125
4
""" Given a binary tree, return the bottom-up level order traversal of its nodes' values. (ie, from left to right, level by level from leaf to root). For example: Given binary tree [3,9,20,null,null,15,7], 3 / \ 9 20 / \ 15 7 return its bottom-up level order traversal as: [ [15,7], [9,20], [3...
true