blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
f5bef46daa56f9dbf9a18ddedb786bb7b982fd22
rohini-nubolab/Python-Learning
/swaplist.py
280
4.1875
4
# Python3 program to swap first and last element of a list def swaplist(newlist): size = len(newlist) temp = newlist[0] newlist[0] = newlist[size-1] newlist[size-1] = temp return newlist newlist = [12, 15, 30, 56, 100] print(swaplist(newlist))
true
a997569eb3036d6acca7e9e4152511878bd4ed1c
rohini-nubolab/Python-Learning
/length_k.py
294
4.28125
4
# Python program to find all string which are greater than given length k def length_k(k, str): string = [] text = str.split(" ") for i in text: if len(i) > k: string.append(i) return string k = 4 str = "Python is a programming" print(length_k(k, str))
true
4b0c89c828134415e4ad1da02a50c6dbf49c664e
rohini-nubolab/Python-Learning
/str_palindrome.py
254
4.4375
4
#Python program to check given string is Palindrome or not def isPalindrome(s): return s == s[::-1] s = "MADAM" result = isPalindrome(s) if result: print("Yes. Given string is Palindrome") else: print("No. Given string is not Palindrome")
true
5eeb7cec2d6ca5a9f2478fe7286f23de9a185114
jedzej/tietopythontraining-basic
/students/Glogowska_Joanna/lesson_02_flow_control/adding_factorials.py
269
4.28125
4
print('For a given integer, \ print the sum of factorials') number = int(input('Enter a number: ')) sumoffact = 0 factorial = 1 for i in range(1, number + 1): factorial = factorial * i sumoffact += factorial print('The sum of factorials is: ' + str(sumoffact))
true
973669615a36fdb152cd81f14b51f6908c7f121b
jedzej/tietopythontraining-basic
/students/biegon_piotr/lesson_02_flow_control/the_number_of_zeros.py
260
4.1875
4
print("The number of zeros\n") N = int(input("Enter the number of numbers: ")) result = 0 for i in range(1, N + 1): a = int(input("Enter a number: ")) if a == 0: result += 1 print("\nYou have entered {:d} numbers equal to 0".format(result))
true
65ffa0dbf7bc4a6e052fa5cf4f235ad36c55caec
jedzej/tietopythontraining-basic
/students/Glogowska_Joanna/lesson_01_basics/lesson_01.py
2,688
4.125
4
import math # Lesson 1.Input, print and numbers # Sum of three numbers print('Input three numbers in different rows') first = int(input()) second = int(input()) third = int(input()) sum = first + second + third print(sum) # Area of right-angled triangle print('Input the length of the triangle') base = int(input()) pr...
true
4355f566a32a6c866219f64a5725f1be10bc2b43
jedzej/tietopythontraining-basic
/students/kosarzewski_maciej/lesson_04_unit_testing/collatz/collatz_sequence.py
434
4.3125
4
def collatz(number): if number <= 0: raise ValueError elif number % 2 == 0: half_even = number / 2 print(half_even) return half_even elif number % 2 == 1: some_odd = (3 * number) + 1 print(some_odd) return some_odd if __name__ == "__main__": valu...
true
f4833bbfde29d3ebcd266957c9c4adc1855ea9a4
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_06_dicts_tuples_sets_args_kwargs/Uppercase.py
459
4.375
4
# Function capitalize(lower_case_word) that takes the lower case word # and returns the word with the first letter capitalized def capitalize(lower_case_word): lst = [word[0].upper() + word[1:] for word in lower_case_word.split()] capital_case_word = " ".join(lst) print(capital_case_word) return capit...
true
1378aaf0c29ff0a9aa1062890506ceb7885e002a
jedzej/tietopythontraining-basic
/students/urtnowski_daniel/lesson_10_organizing_files/selective_copy.py
2,443
4.21875
4
#!/usr/bin/env python3 """ selective_copy.py: a practice project "Selective Copy" from: https://automatetheboringstuff.com/chapter9/ The program walks through a folder tree and searches for files with a given file extension. Then it copies these files from the source location to a destination folder. Usage: ./select...
true
f406f56d29ee2683f6caefe267c06a0be06139fd
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_01_basic/total_cost.py
625
4.15625
4
# Problem «Total cost» (Medium) # Statement # A cupcake costs A dollars and B cents. Determine, how many dollars and cents # should one pay for N cupcakes. A program gets three numbers: A, B, N. # It should print two numbers: total cost in dollars and cents. print('Please input cost of 1 piece in dollars part:') dolla...
true
dea8bde4d91c6cb0c446a0a0899da9df3d077c14
jedzej/tietopythontraining-basic
/students/urtnowski_daniel/lesson_08_regular_expressions/automate_the_boring_stuff.py
2,422
4.1875
4
#!/usr/bin/env python3 """ automate_the_boring_stuff.py: a practice projects: "Regex version of strip" and "Strong Password Detection" from: https://automatetheboringstuff.com/chapter7/ """ __author__ = "Daniel Urtnowski" __version__ = "0.1" import re def regex_strip(input_str, chars=' '): """ This functi...
true
bf0ff9aaa89d6b411a58785e8d12becbc3adcc60
jedzej/tietopythontraining-basic
/students/piatkowska_anna/lesson_01_basics/Lesson2/ex02_07.py
599
4.34375
4
#Statement #Given the integer N - the number of minutes that is passed since midnight - how many hours and minutes are displayed on the 24h digital clock? #The program should print two numbers: the number of hours (between 0 and 23) and the number of minutes (between 0 and 59). #For example, if N = 150, then 150 minute...
true
558046852a5d20e15639a0c8244e1518ee776bf4
jedzej/tietopythontraining-basic
/students/arkadiusz_kasprzyk/lesson_01_basics/previous_and_next.py
488
4.15625
4
''' title: prevous_and_next author: arkadiusz.kasprzyk@tieto.com date: 2018-03-05 description: Write a program that reads an integer number and prints its previous and next numbers. There shouldn't be a space before the period. ''' print('''Reads an integer number and prints its previous and next numbers. ''' ...
true
769a73aa4e312c861c0eb9b54ca793f6121f5c89
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_05_lists/comma_code.py
968
4.53125
5
""" Say you have a list value like this: spam = ['apples', 'bananas', 'tofu', 'cats'] Write a function that takes a list value as an argument and returns a string with all the items separated by a comma and a space, with and inserted before the last item. For example, passing the previous spam list to the function wo...
true
a465ed16d43516dda5d529acb4d4e7f0ded681e2
jedzej/tietopythontraining-basic
/students/kaczmarek_katarzyna/lesson_03_functions/the_length_of_the_segment.py
706
4.15625
4
from math import sqrt def distance(x1, y1, x2, y2): return sqrt((x1 - x2) ** 2 + (y1 - y2) ** 2) def main(): while True: try: x1coordinate = float(input("Type x1 coordinate: ")) y1coordinate = float(input("Type y1 coordinate: ")) x2coordinate = float(input("Type x...
true
1db7a306d1c531fdce7503e61024bf24f3b9ea29
jedzej/tietopythontraining-basic
/students/lakatorz_izaak/lesson_07_string_datetime/date_calculator.py
657
4.15625
4
# Date calculator - write a script that adds custom number of years, # days and hours and minutes to current date and displays the result in # human readable format. import time import datetime def main(): print('Enter years, days, hours and minutes you want to add.') years, days, hours, mins = [int(x) for x...
true
9f34d8aba1c553781e6866d34b623f25685d49c4
jedzej/tietopythontraining-basic
/students/zelichowski_michal/lesson_02_flow_control/the_number_of_zeroes.py
414
4.125
4
"""Given N numbers: the first number in the input is N, after that N integers are given. Count the number of zeros among the given integers and print it. You need to count the number of numbers that are equal to zero, not the number of zero digits. """ # Read an integer: a = int(input()) zeroes = 0 for x in range(1, ...
true
d6647eeab421b36b3a5f985071184e5d36a7fe9c
jedzej/tietopythontraining-basic
/students/pietrewicz_bartosz/lesson_03_functions/the_collatz_sequence.py
758
4.40625
4
def collatz(number): """Calculates and prints the next element of Collatz sequence""" if number % 2 == 0: number //= 2 else: number = number * 3 + 1 print(number) return number def read_number(): number = 0 # read integer from user until it is positive while number < 1:...
true
45026f81aa56c85fb70b6f60f60d24b8172605d0
jedzej/tietopythontraining-basic
/students/jemielity_kamil/lesson_01_basics/area_of_right_angled_traingle.py
208
4.28125
4
length_of_base = float(input("Write a length of the base: ")) height = float(input("Write a height of triangle: ")) area = (length_of_base * height)/2 print("Area of right-angled triangle is: %s" % area)
true
c33eb58a3e743b1bcb66e7be1ce1649126092894
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_06_dictionaries/the_number_of_distinct_words.py
544
4.21875
4
""" Given a number n, followed by n lines of text, print the number of distinct words that appear in the text. For this, we define a word to be a sequence of non-whitespace characters, seperated by one or more whitespace or newline characters. Punctuation marks are part of a word, in this definition. """ def main(): ...
true
12de4d9871dee7d1bf3bcec9c672832d2f374f2f
jedzej/tietopythontraining-basic
/students/baker_glenn/lesson_3_scripts/exponentiation_recursion.py
615
4.25
4
def exponentiation_recursion(num, exp, calculated_number): if exp > 1: exp -= 1 calculated_number = calculated_number * num exponentiation_recursion(num, exp, calculated_number) else: print(str(calculated_number).rstrip('0').rstrip('.')) while True: try: print("Plea...
true
bea6cd3642874532f071326c5ddb2e6f7c9eff5c
jedzej/tietopythontraining-basic
/students/serek_wojciech/lesson_02_flow_control/elements_equal_maximum.py
425
4.125
4
#!/usr/bin/env python3 """The number of elements equal to the maximum""" def main(): """Main function""" max_value = -1 max_count = -1 number = -1 while number: number = int(input()) if number > max_value: max_value = number max_count = 1 elif numbe...
true
8f1b4f06ac87cc4d8bd5a968b8ade41d78ccd877
jedzej/tietopythontraining-basic
/students/baker_glenn/snakify_lesson_4/factorials_added.py
210
4.1875
4
# script to calculate the factorial print("enter a number") number = int(input()) result = 1 results_added = 0 for i in range(number): result *= (i+1) results_added += result print(str(results_added))
true
ca92c30e1ed48ad6404ea25fb6ac2aa5710dbc2a
jedzej/tietopythontraining-basic
/students/piatkowska_anna/lesson_02_flow_control/Snakify_Lesson6__2problems/the_second_maximum.py
697
4.34375
4
# Statement # The sequence consists of distinct positive integer numbers # and ends with the number 0. # Determine the value of the second largest element in this sequence. # It is guaranteed that the sequence has at least two elements. def second_maximum(): second = 0 print("Enter positive integer number:") ...
true
f0e4d4266a40a28a83c6a92f25da009a8b3b281a
jedzej/tietopythontraining-basic
/students/bedkowska_julita/lesson_03_functions/the_collatz_sequence.py
283
4.28125
4
def collatz(number): if number % 2 == 0: result = number // 2 print(result) return result else: result = 3 * number + 1 print(result) return result num = int(input('Give the number: ')) while num != 1: num = collatz(num)
true
d57e8619470c765eeedac5d4281d1f9b92748a62
jedzej/tietopythontraining-basic
/students/arkadiusz_kasprzyk/lesson_02_flow_control/ladder.py
591
4.3125
4
""" description: For given integer n ≤ 9 print a ladder of n steps. The k-th step consists of the integers from 1 to k without spaces between them. To do that, you can use the sep and end arguments for the function print(). """ print(""" For given integer n ≤ 9 prints a ladder of n steps. The k-th...
true
67c1553add8841549f017b90a6815e9c65d9a8fa
jedzej/tietopythontraining-basic
/students/mariusz_michalczyk/lesson_07_strings/delta_time_calculator.py
594
4.1875
4
from datetime import date, datetime def get_user_input(): print("Enter future date: ") entered_y = int(input("Enter year: ")) entered_m = int(input("Enter month: ")) entered_d = int(input("Enter day: ")) return date(entered_y, entered_m, entered_d) def current_date(): return date(datetime.no...
true
55ba081b6820d5a6e5e871c41cdcb2b339954456
jedzej/tietopythontraining-basic
/students/piatkowska_anna/lesson_01_basics/Lesson1/ex01_05.py
511
4.21875
4
#Statement #Write a program that reads an integer number #and prints its previous and next numbers. #See the examples below for the exact format your answers should take. # There shouldn't be a space before the period. #Remember that you can convert the numbers to strings using the function str. print("Enter an int...
true
204037e5dd7a1ef15c58f2063150c72f1995b424
jedzej/tietopythontraining-basic
/students/biegon_piotr/lesson_02_flow_control/chocolate_bar.py
473
4.21875
4
print("Chocolate bar\n") n = int(input("Enter the number of portions along the chocolate bar: ")) m = int(input("Enter the number of portions across the chocolate bar: ")) k = int(input("Enter the number of portions you want to divide the chocolate bar into: ")) print("\nIs it possible to divide the chocolate bar so ...
true
adb1d13da8f60604a0643d325404d5de692fea9b
jedzej/tietopythontraining-basic
/students/swietczak_monika/lesson_02_flow_control/the_number_of_elements_equal_to_maximum.py
293
4.21875
4
the_highest = 0 count = 0 number = int(input("Enter a number: ")) while number != 0: if number > the_highest: the_highest = number count = 1 elif number == the_highest: count += 1 number = int(input("Enter another number: ")) # Print a value: print(count)
true
47f9e146863f7aba249c6c5893c18f3023ee6a1b
jedzej/tietopythontraining-basic
/students/arkadiusz_kasprzyk/lesson_05_lists/swap_min_and_max.py
605
4.28125
4
def swap_min_max(numbers): """ Parameters ---------- numbers: int[] Returns ------- numbers with maximum and minimum swapped. Only the first occurences of min and max are taken into account. Examples -------- print(swap_min_max([3, 0, 1, 4, 7, 2, 6])) print(swap_min_max...
true
4f66840fcd80f91a7a5689b8c39e75525640723d
jedzej/tietopythontraining-basic
/students/urtnowski_daniel/lesson_06_dicts_tuples_sets_args_kwargs/snakify_lesson_10.py
1,787
4.125
4
#!/usr/bin/env python3 """ snakify_lesson_10.py: Solutions for 3 of problems defined in: Lesson 10. Sets (https://snakify.org/lessons/sets/) """ __author__ = "Daniel Urtnowski" __version__ = "0.1" def read_set_of_integers(items_count): new_set = set() for i in range(items_count): new_set.add(int(in...
true
7e4ae48b861867e6abbc7ff17617701644e364d7
jedzej/tietopythontraining-basic
/students/piatkowska_anna/lesson_03_functions/negative_exponent.py
562
4.34375
4
""" Statement Given a positive real number a and integer n. Compute an. Write a function power(a, n) to calculate the results using the function and print the result of the expression. Don't use the same function from the standard library. """ def power(a, n): if (n < 0): return (1 / (a ** abs(n))) e...
true
f6ef5524112318c4507e64dd7c24bec374c71e06
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_09_reading_and_writing_files/mad_libs.py
730
4.1875
4
""" Create a Mad Libs program that reads in text files and lets the user add their own text anywhere the word ADJECTIVE, NOUN, ADVERB, or VERB appears in the text file. """ import re REPLACE_WORDS = ["ADJECTIVE", "NOUN", "ADVERB", "VERB"] def main(): input_file = open("text_file_input.txt") output_file = op...
true
e9fdbb006ba374972ff68b0b62f83ff578a8c8cf
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_08_regular_expressions/regex_version_of_strip.py
818
4.5625
5
""" Write a function that takes a string and does the same thing as the strip() string method. If no other arguments are passed other than the string to strip, then whitespace characters will be removed from the beginning and end of the string. Otherwise, the characters specified in the second argument to the function ...
true
411c81ea9bc2c6cb7083f38c68f05f7f9e373e10
jedzej/tietopythontraining-basic
/students/grzegorz_bajorski/lesson_03_functions/input_validation.py
366
4.15625
4
def collatz(number): if number % 2 == 0: return number // 2 else: return 3 * number + 1 print('Enter number') number = 0 while 1: try: number = int(input()) if collatz(number) != 1: print(collatz(number)) else: break except: prin...
true
f50a67ca0fb86a594847ff090cedafd1d8631ac1
jedzej/tietopythontraining-basic
/students/myszko_pawel/lesson_01_basics/15_Clock face - 1.py
450
4.125
4
# H hours, M minutes and S seconds are passed since the midnight (0 ≤ H < 12, 0 ≤ M < 60, 0 ≤ S < 60). # Determine the angle (in degrees) of the hour hand on the clock face right now. # Read an integer: H = int(input()) M = int(input()) S = int(input()) sec_in_h = 3600 sec_in_m = 60 sec_in_half_day = 43200 #12 * 3...
true
11dfb2125ddb76cd84df120a4295dc52fe619a27
jedzej/tietopythontraining-basic
/students/piatkowska_anna/lesson_01_basics/Lesson2/ex02_06.py
396
4.15625
4
#Statement #A car can cover distance of N kilometers per day. How many days will it take to cover a route of length M kilometers? The program gets two numbers: N and M. print("Please enter how many kilometers per day your car can cover:") a = int(input()) print("Please enter length of a route:") b = int(input()) import...
true
3095e5ec9ebe36b871411033596b3741754a3fe9
jedzej/tietopythontraining-basic
/students/pietrewicz_bartosz/lesson_03_functions/the_length_of_the_segment.py
699
4.3125
4
from math import sqrt def distance(x1, y1, x2, y2): """Calculates distance between points. Arguments: x1 -- horizontal coordinate of first point y1 -- vertical coordinate of first point x2 -- horizontal coordinate of second point y2 -- vertical coordinate of second point """ horiz_len...
true
82bf7346994efd7061d730228942cf0bc3db4e43
jedzej/tietopythontraining-basic
/students/zelichowski_michal/lesson_02_flow_control/the_second_maximum.py
454
4.21875
4
"""The sequence consists of distinct positive integer numbers and ends with the number 0. Determine the value of the second largest element in this sequence. It is guaranteed that the sequence has at least two elements. """ a = int(input()) maxi = 0 second_max = 0 while a != 0: if a > maxi: second_max = ma...
true
ef537ad5a6899505feab95649248519b313092ef
jedzej/tietopythontraining-basic
/students/sendecki_andrzej/lesson_01_basics/digital_clock.py
494
4.40625
4
# lesson_01_basics # Digital clock # # Statement # Given the integer N - the number of minutes that is passed since midnight - # how many hours and minutes are displayed on the 24h digital clock? # The program should print two numbers: the number of hours (between 0 and 23) # and the number of minutes (between 0 and 59...
true
ef365efc8266522c0dd521d9cd57dbbf1cab1c3b
jedzej/tietopythontraining-basic
/students/medrek_tomasz/lesson_01_basics/fractional_part.py
322
4.15625
4
#!/usr/bin/env python3 try: given_number = float(input("Please enter a number:\n")) except ValueError: print('That was not a valid number, please try again') exit() real_part, fractional_part = str(given_number).split(".") if (fractional_part == "0"): print("0") else: print("0." + fractional_part...
true
39307299087bd61598c27d2af3dd1aa8f04d3be5
jedzej/tietopythontraining-basic
/students/wachulec_maria/lesson_03_functions/the_collatz_sequence_and_input_validation.py
298
4.1875
4
def collatz(number): if number % 2 == 0: return number // 2 elif number % 2 == 1: return 3 * number + 1 try: n = int(input('Take me number: ')) while n != 1: n = collatz(n) print(n) except ValueError: print('Error: I need integer, not string')
true
d131c1b41d71cf1ce66624f81b3c105cb64e4bdb
jedzej/tietopythontraining-basic
/students/serek_wojciech/lesson_06_dict/uppercase.py
349
4.1875
4
#!/usr/bin/env python3 """Uppercase""" def capitalize(lower_case_word): """Change the first letter to uppercase""" return lower_case_word[0].upper() + lower_case_word[1:] def main(): """Main function""" text = input().split() for word in text: print(capitalize(word), end=' ') if __name...
true
549edc4edb0ed0667b8cbe4eff8e56b398843897
jedzej/tietopythontraining-basic
/students/BRACH_Jakub/lesson_01_basics/L01P01_Three_Numbers.py
230
4.15625
4
#!/usr/bin/env python3 number_of_factors = 3 summ = 0 for x in range(0, number_of_factors): #print('Enter the number {0:d} of {1:d}:'.format(x, number_of_factors)) summ = summ + int(input()) print ("{0:d}".format(summ))
true
ffdd1515810c94ca20ac8f3e61c5cd339b181e1c
jedzej/tietopythontraining-basic
/students/piechowski_michal/lesson_05_lists/comma_code.py
348
4.25
4
#!/usr/bin/env python3 def join_list(strings_list): if not strings_list: return "List is empty" elif len(strings_list) == 1: return str(strings_list[0]) else: return ", ".join(strings_list[:-1]) + " and " + strings_list[-1] strings_list = ['apples', 'bananas', 'tofu', 'cats'] pri...
true
57b4d4e7572261d52016a6079ff900ed100db4a4
jedzej/tietopythontraining-basic
/students/arkadiusz_kasprzyk/lesson_01_basics/area_of_right-angled_triangle.py
589
4.25
4
''' title: area_of_right-angled_triangle author: arkadiusz.kasprzyk@tieto.com date: 2018-03-05 description: Write a program that reads the length of the base and the height of a right-angled triangle and prints the area. Every number is given on a separate line. ''' print("Reads the length of the base and the ...
true
6fafbc30d64f641d0f4766207dc5a348604ead0c
jedzej/tietopythontraining-basic
/students/baker_glenn/lesson_1_scripts/previous_next.py
279
4.3125
4
# Script to print the previous and next number of a given number print("enter a number") number = int(input()) print("The next number for the number " + str(number) + " is " + str(number + 1)) print("The previous number for the number " + str(number) + " is " + str(number - 1))
true
423f23d1bce7d52dd7382fc64edc1ef64527c649
jedzej/tietopythontraining-basic
/students/piatkowska_anna/lesson_03_functions/exponentiation.py
589
4.3125
4
""" Statement Given a positive real number a and a non-negative integer n. Calculate an without using loops, ** operator or the built in function math.pow(). Instead, use recursion and the relation an=a⋅an−1. Print the result. Form the function power(a, n). """ def power(a, n): if (n == 0): return 1 e...
true
4c4aeb55d10a94f8c8db6d4ceb5f73f02aa0fc0f
jedzej/tietopythontraining-basic
/students/urtnowski_daniel/lesson_05_lists/snakify_lesson_7.py
2,308
4.40625
4
#!/usr/bin/env python3 """ snakify_lesson_7.py: Solutions for 3 of problems defined in: Lesson 7. Lists (https://snakify.org/lessons/lists/problems/) """ __author__ = "Daniel Urtnowski" __version__ = "0.1" def greater_than_neighbours(): """ This function reads a list of numbers and prints the quantity of el...
true
0f1ea0541aced96c8e2fe19571752af04fdf488d
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_01_basic/area_of_right-angled_triangle.py
408
4.1875
4
# Problem «Area of right-angled triangle» (Easy) # Statement # Write a program that reads the length of the base and the height of a right-angled triangle and prints the area. # Every number is given on a separate line. print('Please input triangle\'s base:') base = int(input()) print('Please input height of the trian...
true
15720a0a5e835375b857d2efd3f58b305c0d162f
jedzej/tietopythontraining-basic
/students/sendecki_andrzej/lesson_01_basics/hello_harry.py
262
4.53125
5
# lesson_01_basics # Hello, Harry! # # Statement # Write a program that greets the user by printing the word "Hello", # a comma, the name of the user and an exclamation mark after it. print("Enter your name:") my_name = input() print("Hello, " + my_name + "!")
true
782275fee4250e4a33a7ec8dc3cb46c9074976d5
jedzej/tietopythontraining-basic
/students/semko_krzysztof/lesson_01_basic/car_route.py
404
4.125
4
# Problem «Car route» (Easy) # Statement # A car can cover distance of N kilometers per day. # How many days will it take to cover a route of length M kilometers? The program gets two numbers: N and M. import math print('Please input km/day:') speed = int(input()) print('Please input length:') length = int(input()) p...
true
9ad0674a05315b989d111ffec5557c847582c540
jedzej/tietopythontraining-basic
/students/myszko_pawel/lesson_02_flow_control/14_The number of zeros.py
405
4.125
4
# Given N numbers: the first number in the input is N, after that N integers are given. # Count the number of zeros among the given integers and print it. # You need to count the number of numbers that are equal to zero, not the number of zero digits. # Read an integer: N = int(input()) # Print a value: zeroes = 0 for...
true
c8c1963bad864b383a77727973232b4e3b7c392b
danserboi/Marketplace
/tema/consumer.py
2,594
4.34375
4
""" This module represents the Consumer. Computer Systems Architecture Course Assignment 1 March 2021 """ import time from threading import Thread class Consumer(Thread): """ Class that represents a consumer. """ def __init__(self, carts, marketplace, retry_wait_time, **kwargs): """ ...
true
35d8e0f70cfd155ab513ed9b405903a140164f19
rkp872/Python
/6)Functions/TypesOfArgument.py
2,926
4.65625
5
# Information can be passed into functions as arguments. # Arguments are specified after the function name, inside # the parentheses. #In python we have different types of agruments: # 1 : Position Argument # 2 : Keyword Argument # 3 : Default Argument # 4 : Variable length Argument # 5 : Keyworded Variable...
true
e87320897e3f5dfaf10564b9f79b6487649dfcc4
rkp872/Python
/3)Conditional/SquareCheck.py
272
4.34375
4
#Take values of length and breadth of a rectangle from user and check if it is square or not. len=int(input("Enter length : ")) bre=int(input("Enter breadth : ")) if(len==bre): print("Given rectangle is square") else: print("Given rectangle is not a square")
true
1af02fa80c544f52c1f2e4a2f0c767c96b14a4b6
rkp872/Python
/2)Data Types/Set.py
726
4.21875
4
# Set: Set are the collection of hetrogeneous elements enclosed within {} # Sets does not allows duplicates and insertion order is not preserved #Elements are inserted according to the order of their hash value set1={10,20,20,30,50,40,60} print(set1) print(type(set1)) set1.add(36) print(set1) s...
true
d85c3e867c8d10f6b71231e9c581d0f4274ec9c3
Randy760/Dice-rolling-sim
/Dicerollingsimulator.py
694
4.1875
4
import random # making a dice rolling simulator youranswer = ' ' print('Would you like to roll the dice?') #asks if they want to roll the dice while True: youranswer = input() if youranswer == 'yes': diceroll = random.randint(1,6) #picks a random number between 1 and 6 print(...
true
3591366d9968bf42380c2f40c55f8db2ae34052a
keshav1245/Learn-Python-The-Hard-Way
/exercise11/ex11.py
729
4.40625
4
print "How old are you ?", age = raw_input() print "How tall are you ?", height = raw_input() print "How much do you weight ? ", weight = raw_input() #raw_input([prompt]) #If the prompt argument is present, it is written to standard output without a trailing newline. The #function then reads a line from input, conver...
true
2f1bd009c20a51bab241ad3c31528b0f0664ed93
rohan-khurana/MyProgs-1
/SockMerchantHR.py
1,687
4.625
5
""" John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are. For example, there are socks with colors . There is one pair of color and one of c...
true
9f6ee9426e3bd6c017e82c317f0800236cd2dc13
rohan-khurana/MyProgs-1
/TestingHR.py
2,987
4.28125
4
""" This problem is all about unit testing. Your company needs a function that meets the following requirements: For a given array of integers, the function returns the index of the element with the minimum value in the array. If there is more than one element with the minimum value, the returned index should be the...
true
8e07f7fdba8ee6adae646070615b9b8d756462bc
rohan-khurana/MyProgs-1
/TheXORProblemHR.py
1,865
4.25
4
""" Given an integer, your task is to find another integer such that their bitwise XOR is maximum. More specifically, given the binary representation of an integer of length , your task is to find another binary number of length with at most set bits such that their bitwise XOR is maximum. For example, let's say ...
true
f7e30fb9549c6e8c88792ac40d5c59ef0a86edf6
tonyvillegas91/python-deployment-example
/Python Statements/list_comprehension2.py
205
4.34375
4
# Use a List Comprehension to create a list of the first letters of every word in the string below: st = 'Create a list of the first letters of every word in this string' [word[0] for word in st.split()]
true
79aa8a94a6c3953ea852f3a087f1f0a89dbd0af7
hamanovich/py-100days
/01-03-datetimes/program2.py
1,197
4.25
4
from datetime import datetime THIS_YEAR = 2018 def main(): years_ago('8 Aug, 2015') convert_eu_to_us_date('11/03/2002') def years_ago(date): """Receives a date string of 'DD MMM, YYYY', for example: 8 Aug, 2015 Convert this date str to a datetime object (use strptime). Then extract the yea...
true
d1db24e49d5698c3d9f2b6db4794fa94aebb3e5f
inest-us/python
/algorithms/c1/tuple.py
642
4.15625
4
# Tuples are very similar to lists in that they are heterogeneous sequences of data. # The difference is that a tuple is immutable, like a string. # A tuple cannot be changed. # Tuples are written as comma-delimited values enclosed in parentheses. my_tuple = (2,True,4.96) print(my_tuple) # (2, True, 4.96) print(len...
true
42d484424e2bb30b0bae4e3ea9a9f3cb668d8f8c
jsburckhardt/pythw
/ex3.py
693
4.15625
4
# details print("I will now count my chickens:") # counts hens print("Hens", float(25 + 30 / 6)) # counts roosters print("Roosters", float(100 - 25 *3 % 4)) # inform print("Now I will count the eggs:") # eggs print(float(3 + 2 + 1 + - 5 + 4 % 2 - 1 / 4 + 6)) # question 5 < -2 print("Is it true that 3 + 2 < 5 - 7?") # ...
true
0081ea28bee4c8b24910c6a3a8b3d559431efde5
lima-BEAN/python-workbook
/programming-exercises/ch7/larger_than_n.py
1,565
4.40625
4
# Larger Than n # In a program, write a function that accepts two arguments: # a list and a number, n. Assume that the list contains numbers. # The function should display all of the numbers in the list that # are greater than the number n. import random def main(): numbers = Numbers() user_num = UserNum() ...
true
43dc28165ec22f719d9e594091c82366cc574384
lima-BEAN/python-workbook
/programming-exercises/ch2/distance-traveled.py
618
4.34375
4
## Assuming there are no accidents or delays, the distance that a car ## travels down the interstate can be calculated with the following formula: ## Distance = Speed * Time ## A car is traveling at 70mph. Write a program that displays the following: ## The distance a car will travel in 6 hours ## The distance a car wi...
true
a913e26be57a7dcad82df5ddf127b85933c4c0c0
lima-BEAN/python-workbook
/programming-exercises/ch5/kinetic_energy.py
983
4.53125
5
# Kinetic Energy # In physics, an object that is in motion is said to have kinetic energy. # The following formula can be used to determine a moving object's kinetic # energy: KE = 1/2 mv**2 # KE = Kinetic Energy # m = object's mass (kg) # v = velocity (m/s) # Write a program that asks the user to enter values for ma...
true
44ecf7731cf113a646f9fbfb9358a09f5dead62a
lima-BEAN/python-workbook
/programming-exercises/ch8/date_printer.py
933
4.375
4
# Date Printer # Write a program that reads a string from the user containing a date in # the form mm/dd/yyyy. It should print the date in the form # March 12, 2014 def main(): user_date = UserDate() date_form = DateForm(user_date) Results(date_form) def UserDate(): date = input('Enter a date in the f...
true
e8404b90ca40907cfca6018ce0c4bebf8752caec
lima-BEAN/python-workbook
/programming-exercises/ch2/ingredient-adjuster.py
832
4.40625
4
## A cookie recipe calls for the following ingredients: ## - 1.5 cups of sugar ## - 1 cup of butter ## - 2.75 cups of flour ## The recipe produces 48 cookies with this amount of the ingredients. ## Write a program that asks the user how many cookies he or she wants to ## make, and then displays the number of cups o...
true
cbae1470e46184c8a3b830ff5ad9076fe0f1864f
lima-BEAN/python-workbook
/programming-exercises/ch4/population.py
720
4.46875
4
# Write a program that predicts the approximate size of a population of organisms # The application should use text boxes to allow the user to enter the starting # number of organisms, the average daily population increase (as percentage), # and the number of days the organisms will be left to multiply. number_organis...
true
27eda59c433dd226459b8966720505f2c78d0cd1
lima-BEAN/python-workbook
/programming-exercises/ch10/Information/my_info.py
794
4.46875
4
# Also, write a program that creates three instances of the class. One # instance should hold your information, and the other two should hold # your friends' or family members' information. import information def main(): my_info = information.Information('LimaBean', '123 Beanstalk St.', ...
true
8d62cbef5cbe028c9a8d83ddd18c5e52106d9c6b
lima-BEAN/python-workbook
/programming-exercises/ch3/roman-numerals.py
982
4.34375
4
# Write a program that prompts the user to enter a number within the range of 1 # through 10. The program should display the Roman numeral version of that # number. If the number is outside the range of 1 through 10, # the program should display an error message. number = int(input("What number do you want to convert ...
true
f9500fd6cfdd6d846ed4b6fa2b034bd681d3d637
lima-BEAN/python-workbook
/algorithm-workbench/ch2/favorite-color.py
220
4.21875
4
## Write Python code that prompts the user to enter his/her favorite ## color and assigns the user's input to a variale named color color = input("What is your favorite color? ") print("Your favorite color is", color)
true
54b6e4930811ab19c5c64d37afc05fb0a8d69270
lima-BEAN/python-workbook
/programming-exercises/ch10/Retail/item_in_register.py
1,023
4.25
4
# Demonstrate the CashRegister class in a program that allows the user to # select several items for purchase. When the user is ready to check # out, the program should display a list of all the items he/she has # selected for a purchase, as well as total price. import retail_item import cash_register def main(): ...
true
14abd73ae4d52d04bfa9c06e700d9191d194f6b3
lima-BEAN/python-workbook
/programming-exercises/ch5/sales_tax_program_refactor.py
1,702
4.1875
4
# Program exercise #6 in Chapter 2 was a Sales Tax Program. # Redesign solution so subtasks are in functions. ## purchase_amount = int(input("What is the purchasing amount? ")) ## state_tax = 0.05 ## county_tax = 0.025 ## total_tax = state_tax + county_tax ## total_sale = format(purchase_amount + (purchase_amount * t...
true
3d9deda751cdfa233cdf0c711f3432be950980d3
tejastank/allmightyspiff.github.io
/CS/Day6/linkedList01.py
1,399
4.21875
4
""" @author Christopher Gallo Linked List Example """ from pprint import pprint as pp class Node(): def __init__(self, data=None, next_node=None): self.data = data self.next = next_node def __str__(self): return str(self.data) class linked_list(): def __init__(self): self.he...
true
611d3db5bf36c987bb459ff19b7ab0a215cfec83
laurenwheat/ICS3U-Assignment-5B-Python
/lcm.py
753
4.25
4
#!/usr/bin/env python3 # Created by: Lauren Wheatley # Created on: May 2021 # This program displays the LCM of 2 numbers def main(): a = input("Please enter the first value: ") b = input("Please enter the second value: ") try: a_int = int(a) b_int = int(b) if (a_int > b_int): ...
true
722c9fef00cc8c68bda1a32eb5964413311f1a2d
smtorres/python-washu-2014
/Assignment01/school.py
1,042
4.21875
4
from collections import OrderedDict class School(): def __init__(self, school_name): self.school_name = school_name self.db = {} # Function that adds values and keys to a dictionary. Keys are school grades and each can take as value the name of a kid belonging to that grade. # It returns a dictionary with th...
true
8a199663c4dc2228104bbab583fd9ecaddcac34d
amitopu/ProblemSet-1
/NonConstructibleChange/nonConstructibleChange.py
1,728
4.40625
4
def nonConstructibleChangePrimary(coins): """ Takes an arrary of coin values and find the minimum change that can't be made by the coins available in the array. solution complexity : O(nlogn) time complexity and O(1) space complexity args: ----------- coins (array): an array contains available coin values....
true
e874e83c5936a8dcd28f2f04dde6de4d604c5980
amitopu/ProblemSet-1
/ValidateSubsequence/validate_subsequence.py
795
4.3125
4
def isValidSubsequence(array, sequence): """ Takes one array and a sequence(another array) and checks if the sequence is the subsequence of the array. solution complexity : O(n) time complexity and O(1) space complexity args: ----------- array : an array of numbers sequence : an array of numbers output...
true
610395c1c0a55d4f8b7099bea152e4feb27dec23
Patryk9201/CodeWars
/Python/6kyu/one_plus_array.py
693
4.1875
4
""" Given an array of integers of any length, return an array that has 1 added to the value represented by the array. the array can't be empty only non-negative, single digit integers are allowed Return nil (or your language's equivalent) for invalid inputs. Examples For example the array [2, 3, 9] equals 239, addin...
true
a03d3d86b25f8f132efb169ad8bd8174a9152ddb
Patryk9201/CodeWars
/Python/8kyu/temperature_in_bali.py
1,092
4.1875
4
""" So it turns out the weather in Indonesia is beautiful... but also far too hot most of the time. Given two variables: heat (0 - 50 degrees centigrade) and humidity (scored from 0.0 - 1.0), your job is to test whether the weather is bareable (according to my personal preferences :D) Rules for my personal preference...
true
6151cf5dbcf387ec524efa0e39cf400c69ca1ee7
yurjeuna/teachmaskills_hw
/anketa.py
1,580
4.25
4
name = input("Hi! What's your name, friend? ") year_birth = int(input("Ok, do you remember when you were born? \ Let's start with the year of birth - ")) month_birth = int(input("The month of your birth - ")) day_birth = int(input("And the day of your birth, please,- ")) experience = int(input("Have you studied pr...
true
9d569685b0d8d137b9ee7a23180289cfdd10488e
ErickaBermudez/exercises
/python/gas_station.py
1,752
4.3125
4
def canCompleteCircuit(gas, cost): numberOfStations = len(gas) # checking where it is possible to start for currentStartStation in range(numberOfStations): currentGas = gas[currentStartStation] canStart = True # with the current starting point, we can reach all the points # go thr...
true
b2ee470fd49b2af6f975b9571c5f7579082da359
mhkoehl0829/sept-19-flow-control
/Grade Program.py
515
4.125
4
print('Welcome to my grading program.') print('This program will determine which letter grade you get depending on your score.') print('What grade did you make?') myGrade = input('') if myGrade >= '90': print('You made an A.') else: if myGrade >= '80' and myGrade < '90': print('You get a B.') if my...
true
ec7c0d69a9e98853f063fd32ef431f4f28448d76
Alleinx/Notes
/Python/Book_Learning_python/fluent_python/cp8/var.py
875
4.5625
5
# This program demonstrate the difference between shallow copy and deep copy import copy class Bus: def __init__(self, passengers=None): if passengers is None: self.passengers = [] else: self.passengers = list(passengers) # Defensive programming style, won't mod...
true
6fd363f6a639b159cc6594901c716fd3415a5402
023Sparrow/Projects
/Classic_Algorithms/Collatz_Conjecture.py
420
4.28125
4
#**Collatz Conjecture** - Start with a number *n > 1*. Find the number of steps it takes to reach one using the following process: If *n* is even, divide it by 2. If *n* is odd, multiply it by 3 and add 1. def collatz(n): k = 0 while n != 1: if n%2 == 0: n = n/2 else: n ...
true
8e5103a6f4fbae5ce65bcd0fed09a9ea0ad16fbe
JohnFoolish/DocumentationDemo
/src/basic_code.py
1,426
4.4375
4
# -*- coding: utf-8 -*- """ This first one is a basic function that includes the code you would need to add two numbers together! Why is this function useful? ---------------------------- * It can replace the '+' key! * It can cause you to bill more hours for less work since the import takes extra time to type! * It...
true
bf8a718b87bd57002dfd3037c1ea6ceda4ab0261
TommyThai-02/Python-HW
/hw04.py
512
4.1875
4
#Author: Tommy Thai #Filename: hw04.py #Assignment: hw04 #Prompt User for number of rows rows = int(input("Enter the number of rows:")) #input validation while rows < 1: #Error message print("Number of rows must be positive.") #Prompt again rows = int(input("Enter the number of rows:")) ...
true
ef3b8d624346cfbc6516b8d44e8cc22001e88ce9
damodharn/Python_Week1
/Week1_Algo/Temp_Conversion.py
755
4.25
4
# ********************************************************************************************* # Purpose: Program for checking if two strings are Anagram or not. # Author: Damodhar D. Nirgude. # ************************************************************************************************ from Week1_Algo.Utility2 ...
true
c93849ff244e494864be212fa94d97a591233291
damodharn/Python_Week1
/Week1_Functional/StopWatch.py
868
4.28125
4
# ********************************************************************************************* # Purpose: Program for measuring the time that elapses between # the start and end clicks. # Author: Damodhar D. Nirgude. # ****************************************************************************************...
true
a1808e94fd51c61a549a7131cf032eb3aa90c8f5
jsimonton020/Python_Class
/lab9_lab10/lab9-10_q1.py
642
4.125
4
list1 = input("Enter integers between 1 and 100: ").split() # Get user input, and put is in a list list2 = [] # Make an empty list for i in list1: # Iterate over list1 if i not in list2: # If the element is not in list2 list2.append(i) # Add the element to list2 (so we don't have to count it again) ...
true
0dbdddafe5f0a2fad6b8778c78ec913561218eea
AndriyPolukhin/Python
/learn/ex02/pinetree.py
1,500
4.21875
4
''' how tall is the tree : 5 # ### ##### ####### ######### # ''' # TIPS to breakdown the problem: # I. Use 1 while loop and 3 for loops # II. Analyse the tree rules: # 4 spaces _ : # 1 hash # 3 spaces _ : # 3 hashes # 2 spaces _ : # 5 hashes # 1 space _ : # 7 hashes # 0 spaces _ :...
true
a2b98b45cc022cabeb8dd82c582fd1c2f37356fb
AndriyPolukhin/Python
/learn/ex01/checkage.py
805
4.5
4
# We'll provide diferent output based on age # 1- 18 -> Important # 21,50, >65 -> Important # All others -> Not Important # List # 1. Receive age and store in age age = eval(input("Enter age: ")) # and: If Both are true it return true # or : If either condition is true then it return true # not : Convert a true cond...
true
06a522784b6f26abb7be62f6bfd8486ffd425db0
AndriyPolukhin/Python
/learn/ex01/gradeans.py
437
4.15625
4
# Ask fro the age age = eval(input("Enter age: ")) # Handle if age < 5 if age < 5: print("Too young for school") # Special output just for age 5 elif age == 5: print("Go to Kindergarden") # Since a number is the result for age 6 - 17 we can check them all with 1 condition elif (age > 5) and (age <= 17): ...
true
25d6aada9d0ae475343ca02fa79a5969565a4b7b
RehamDeghady/python
/task 2.py
753
4.3125
4
print("1.check palindrome") print("2.check if prime") print("3.Exit") operation = int (input ("choose an operation:")) if operation == 1 : word = str(input("enter the word")) revword = word[::-1] print("reversed word is" ,revword) if word == revword : print("yes it is palindro...
true
971f5ec8bb222bbfc91123e24bcccdaf3caece28
sidsharma1990/Python-OOP
/Inheritance.py
1,519
4.65625
5
######### Inheritance ###### #####Single inheritance###### ###### to inherit from only 1 class#### class fruits: def __init__(self): print ('I am a Fruit!!') class citrus(fruits): def __init__(self): super().__init__() print ('I am citrus and a part of fruit class!') ...
true