blob_id
stringlengths
40
40
repo_name
stringlengths
5
127
path
stringlengths
2
523
length_bytes
int64
22
3.06M
score
float64
3.5
5.34
int_score
int64
4
5
text
stringlengths
22
3.06M
43cf6714ce65b32157c73ba04c4b4cb4fed88778
jedzej/tietopythontraining-basic
/students/kaczmarek_katarzyna/lesson_10_organizing_files/deleting_unneeded_files.py
574
3.71875
4
import os def main(): for folder_name, _, file_names in os.walk(input("Type a folder path: ")): for filename in file_names: file_path = os.path.join(folder_name, filename) # Instead of a size divisor of 1024 * 1024 # I used the << bitwise shifting operator #...
0580d2f1a38023bef6f8fdf2c42d558d79519a35
jedzej/tietopythontraining-basic
/students/bedkowska_julita/lesson_08_regex/postal_code_validator.py
323
3.8125
4
import re def check_postal_code(postal_code): if re.compile(r'^\d{2}-\d{3}$').match(postal_code): return True return False def main(): postal_code = '54-123' print('Postal code: ' + postal_code) print('Result: ' + str(check_postal_code(postal_code))) if __name__ == '__main__': main...
f1f45b92ec00d30f335ccf1f877652cb4c4114d7
jedzej/tietopythontraining-basic
/students/grzegorz_kowalik/lesson_03_functions/collatz.py
365
4.03125
4
def collatz(number): print(number) if number == 1: return 1 elif number % 2 == 0: return number // 2 else: return 3 * number + 1 if __name__ == '__main__': number = 1 try: number = int(input()) except ValueError: print("To nie liczba!") while n...
526ccb1eb9e1c677930b410c35386ff72d179f1b
jedzej/tietopythontraining-basic
/students/medrek_tomasz/lesson_02_flow_control/adding_factorials.py
418
3.96875
4
#!/usr/bin/env python3 try: n = int(input('Please enter a number:\n')) if (n < 0): raise ValueError except ValueError: print('Given number is not valid, try again') exit() sum_of_factorials = 1 factorial = 1 m = n while (m > 1): factorial *= n n -= 1 if (n == 1): m -= 1 ...
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:...
e6d5cd34976eedf9d71a949e99669d180a90dcb6
jedzej/tietopythontraining-basic
/students/mariusz_michalczyk/lesson_01_basics/Digital_clock.py
168
3.65625
4
from math import * passed_minutes = int(input("Enter minutes: ")) day_minutes = passed_minutes % 1440 print (str(day_minutes // 60) + " " + str(day_minutes % 60))
2199e4c6721f54ad6dbc60d01a842b14870e44b0
jedzej/tietopythontraining-basic
/students/barecki_andrzej/lesson_10_organizing_files/deleting_unneeded_files.py
568
3.703125
4
import os def show_big_files(path, param_file_size): for folder_name, _, file_names in os.walk(path): for file_name in file_names: file_name_path = os.path.join(folder_name, file_name) current_file_size = os.path.getsize(file_name_path) if current_file_size > param_file...
57c8c318f343bdd774b9d45ab1b9968ffadb9c90
jedzej/tietopythontraining-basic
/students/marta_herezo/lesson_01/lesson_02/digital_clock.py
118
3.78125
4
print('Give minutes: ') N = int(input()) h = N // 60 second = N % 60 print('Now is: ' + str(h) + ':' + str(second))
6d58e0f7f5857453f333be877543c27b1000d169
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_05_ Lists_list_comprehensions/SwapTheColumns.py
487
4.09375
4
# Function return/print array after swap columns from create_lists import array_2dem_random def swap_columns(mylist): i = int((input("First column to swap: "))) j = int((input("Second column to swap: "))) for elem in range(len(mylist)): temp = mylist[elem][i] mylist[elem][i] = mylist[elem]...
af861341c812a4a9bd6073dfe8741beb14d8ecf4
jedzej/tietopythontraining-basic
/students/kula_marta/lesson_01_basics/lesson2_Digital_clock.py
160
3.953125
4
#!/usr/bin/env python n = int(input("set minutes: ")) h = int(n / 60) m = n - h * 60 print("how much hours and minutes show a digital clock %d : %d" % (h, m))
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)
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(): ...
3cc65c000861028f72ccd0d642a632f42136079f
jedzej/tietopythontraining-basic
/students/skowronski_rafal/lesson_01_basics/lesson_02/problem_02.py
240
4.0625
4
# Solves problem 02 - Tens digit def print_last_integer_digit(): number = int(input('Enter integer number: ')) print('\nTens digit is: {0}'.format((number % 100) // 10)) if __name__ == '__main__': print_last_integer_digit()
f4d36b4de49b66d9fa456b92bd3dda500223027d
jedzej/tietopythontraining-basic
/students/jakielczyk_miroslaw/lesson_13_objects_and_classes/circle.py
2,942
4.03125
4
import math class Point: def __init__(self, x, y): self.x = x self.y = y class Circle: def __init__(self, center, radius): self.center = center self.radius = radius class Rectangle: def __init__(self, corner, width, height): self.corner = corner self....
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...
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...
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))
7bb1bd93e3d9d2114bd18825fbcfb12029333cd5
jedzej/tietopythontraining-basic
/students/saleta_sebastian/lesson_01_basics/fractional_part.py
208
3.890625
4
def get_fractional_part_of_num(): num = float(input()) fractional = num - int(num) print('Fractional part is {}'.format(fractional)) if __name__ == '__main__': get_fractional_part_of_num()
39b7e1e4cdadabe02219deef1e9232fdbf5f806e
jedzej/tietopythontraining-basic
/students/ryba_paula/lesson_02_flow_control/lost_card.py
174
3.734375
4
cards = int(input()) sum_of_cards = 0 for i in range(1, cards + 1): sum_of_cards += i for i in range(cards - 1): sum_of_cards -= int(input()) print(sum_of_cards)
3b65750a0c9a113eede65d17670da1dca7d365e2
jedzej/tietopythontraining-basic
/students/serek_wojciech/lesson_01_basics/area_of_triangle.py
219
3.5625
4
#!/usr/bin/env python3 """Area of right-angled triangle""" def main(): """Main function""" var_a = int(input()) var_h = int(input()) print(0.5 * var_a * var_h) if __name__ == '__main__': main()
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:") ...
aab352a62348e401c76c5497f5a576ddb9b5589a
jedzej/tietopythontraining-basic
/students/lakatorz_izaak/lesson_05_lists/swap_min_max.py
575
4.09375
4
# Given a list of unique numbers, swap the minimal and maximal elements of # this list. Print the resulting list. def swap_min_max(list_value): max_idx = list_value.index(max(list_value)) min_idx = list_value.index(min(list_value)) list_value[max_idx], list_value[min_idx] = \ list_value[min_idx],...
7e069fe2d72481c8d4d31bc38bcdc61448c6a915
jedzej/tietopythontraining-basic
/students/jarosz_natalia/lesson_04/test_the_collatz_sequence.py
355
3.546875
4
import unittest from lesson_03.the_collatz_sequence import collatz class MyTest(unittest.TestCase): def test_1(self): self.assertRaises(TypeError, collatz, 'aoeu') def test_2(self): self.assertEqual(collatz(8), 4) def test_3(self): self.assertEqual(collatz(5), 16) if __name__ ...
6e1e357fb34b9e7d1e8c7308626a01f4da683c33
jedzej/tietopythontraining-basic
/students/kulon_aleksander/lesson_05/swap_the_columns.py
464
3.859375
4
def swap_columns(a, i, j): for y in range(len(a)): a[y][i], a[y][j] = a[y][j], a[y][i] for y in range(len(a)): for x in range(len(a[0])): print(str(a[y][x]) + ' ', end='') print('') def main(): n, m = [int(i) for i in input().split()] a = [[int(j) for j in inpu...
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)
fb47dea9f5a9bf9f1bd581a6dd34d4147a0e49ad
jedzej/tietopythontraining-basic
/students/jemielity_kamil/lesson_01_basics/last_digit_of_integer.py
67
3.625
4
integer = int(input("Write an integer: ")) print(str(integer)[-1])
bc789904e22451af45a9b88086ae8e10127b692a
jedzej/tietopythontraining-basic
/students/jemielity_kamil/lesson_07_string_datetime/to_swap_the_two_words.py
148
3.859375
4
string = input('String: ') first_word = string[:string.find(' ')] second_word = string[string.find(' ') + 1:] print(second_word + " " + first_word)
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...
94baf126b51b4a554e8bba8b5f131e25e31d097a
jedzej/tietopythontraining-basic
/students/mielczarek_szymon/lesson_01_basics/clock_face_1.py
202
3.875
4
hours = int(input()) minutes = int(input()) seconds = int(input()) hour_div = 12 min_div = hour_div * 60 sec_div = min_div * 60 print((hours / hour_div + minutes / min_div + seconds / sec_div) * 360)
07e29275bed340dfcc2d245a4c30e17ecc859e7f
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_03_functions/Collatz_Sequence.py
323
4.28125
4
# The Collatz Sequence def collatz(number): if (number % 2) == 0: m = number // 2 print(number, "\\", "2 =", m) return m else: m = 3 * number + 1 print("3 *", number, "+ 1 =", m) return m n = (int(input("put number to check:"))) while n != 1: n = collatz(...
2d9dffd2441f94adf162a33fc12fb7970061ef1f
jedzej/tietopythontraining-basic
/students/serek_wojciech/lesson_03_functions/length_of_the_segment.py
434
4.09375
4
#!/usr/bin/env python3 """The length of segment""" import math def distance(x_1, y_1, x_2, y_2): """Compute distance between two points""" return math.sqrt(math.pow(x_2 - x_1, 2) + math.pow(y_2 - y_1, 2)) def main(): """Main function""" x_1 = float(input()) y_1 = float(input()) x_2 = float(i...
bce973ee814a9d32c09e46c64c6d83c59894e7e8
jedzej/tietopythontraining-basic
/students/jemielity_kamil/lesson_06_dicts_tuples_sets_args_kwargs/reverse_the_sequence.py
157
4.1875
4
def reverse_the_sequence(): number = int(input('Value: ')) if number != 0: reverse_the_sequence() print(number) reverse_the_sequence()
592328aa14e246e5dd9b8bcdfb36ac3bd8a9d604
jedzej/tietopythontraining-basic
/students/barecki_andrzej/lesson_06_dicts_tuples_sets_args_kwargs/frequency_analysis.py
724
3.890625
4
def main(): """"Create empty dictionary of files""" text_dict = dict() """"set number of lines in text""" number_of_lines_in_text = int(input()) """"Add words to dictionary""" for _ in range(number_of_lines_in_text): single_line = [x for x in input().split(' ')] for word in sin...
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...
3b12f631af5105613b6fb2582b18e1d62036b341
jedzej/tietopythontraining-basic
/students/Hebdowska_Grazyna/lesson_02_flow_control/LostCard.py
236
3.859375
4
number = int(input('Number of card: ')) card = [] for i in range(0, number - 1): n = int(input('n: ')) if (0 < n) and (n <= number): card.append(n) for i in range(1, number + 1): if i not in card: print(i)
4fb2bd65c3679133626eba57f6bfaf25c3c214ce
jedzej/tietopythontraining-basic
/students/swietczak_monika/lesson_06_dicts_tuples_sets_args_kwargs/access_rights.py
470
3.53125
4
n = int(input()) files_dict = dict() OPERATIONS_DICT = {"read": "R", "write": "W", "execute": "X"} for i in range(n): rights = "" file_rights = input().split() file = file_rights[0] for val in file_rights[1:]: rights += val files_dict[file] = rights m = int(input()) for _ in range(m): ...
0a728bc1fbb918acc00fbb791bd1e03ad92baee6
jedzej/tietopythontraining-basic
/students/slawinski_amadeusz/lesson_01_basics/2.01_last_digit_of_integer.py
76
3.75
4
# prints last number of digit (a) number = int(input()) print(number % 10)
4b712dc06589d541562aaf88b41613ae83d8ccb3
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_06_dicts_tuples_sets_args_kwargs/functions_lesson06.py
2,857
3.890625
4
import random # function draws n numbers for set range def list_random(n, range_min, range_max): # my_list = [int(randint(range_min, range_max)) for i in range(n)] my_list = random.sample(range(range_min, range_max), n) print(' '.join(map(str, my_list))) return my_list # function to create dictionar...
1b558132c11a93eb36a6f4f59e115c59813427ec
jedzej/tietopythontraining-basic
/students/swietczak_monika/lesson_02_flow_control/chocolate_bar.py
303
4.03125
4
# Read an integer: n = int(input("Length of the chocolate bar: ")) m = int(input("Width of the chocolate bar: ")) k = int(input("How many squares should be after breaking the bar: ")) # Print a value: # print(a) if ((k % m == 0) or (k % n == 0)) and (k < m * n): print("YES") else: print("NO")
9291397bbf5d7a9accfdcb1b841201585a430969
jedzej/tietopythontraining-basic
/students/olszewski_bartosz/lesson_04_unit_testing/collatz_test.py
499
3.8125
4
import unittest def collatz(number): if number % 2 == 0: value = number // 2 else: value = 3 * number + 1 return value class TestCollatzFunction(unittest.TestCase): def test_collatz_string(self): self.assertRaises(TypeError, collatz, 'aeou') def test_collatz_of_number_8(...
19e872f1296d19d2398bd60d7aed1e488f067f01
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_06_dicts_tuples_sets_args_kwargs/AccessRights.py
1,127
3.703125
4
# function to check that file has access rights from functions_lesson06 import list_elements_str, change_to_dict def access_rights(inventory): rights_definition = {'read': 'r', 'write': 'w', 'execute': 'x'} n = int((input('How many access rights do you want check?:'))) for i in range(n): command =...
366ef801631f257ca541cf9a92c03132d4c99ce9
jedzej/tietopythontraining-basic
/students/mitek_michal/lesson_03_functions/collatz_sequence.py
321
4
4
def collatz(number): try: if number % 2 == 0: result = number // 2 print(result) return result elif number % 2 == 1: result = 3 * number + 1 print(result) return result except TypeError: print("Wrong input :(")...
7f8024ff2ebd43bcbc05e2c4ac77ab98272515de
jedzej/tietopythontraining-basic
/students/nartowska_karina/lesson_07_string_datetime/table_printer.py
759
3.703125
4
def print_table(table_data): col_widths = [] for i in range(len(table_data)): max_len = 0 for j in range(len(table_data[0])): if len(table_data[i][j]) > max_len: max_len = len(table_data[i][j]) col_widths.append(max_len) for j in range(len(table_data[0]))...
05c1420470944b52389a4d4a5862f7464d03593a
jedzej/tietopythontraining-basic
/students/BRACH_Jakub/lesson_03_Functions/negative_exponent.py
360
3.859375
4
def power(a, n): counter = 0 result = 1 sign = 1 if n == 0: return 1 if n < 0: sign = -1 n = n * -1 for counter in range(1, n + 1): if sign > 0: result = result * a else: result = result / a return result a = float(input()) n ...
944f600102235dd66490f57cfc0aa368d577ddca
jedzej/tietopythontraining-basic
/students/Hebdowska_Grazyna/lesson_01_basic/sum_of_three_numbers.py
177
3.71875
4
print("Podaj pierwszą liczbę") x = int(input("Give first number: ")) y = int(input("Give second number: ")) z = int(input("Give third number: ")) sum = x + y + z print (sum)
b7400dd049baf6f900881badca909b0f58ebf2f8
jedzej/tietopythontraining-basic
/students/jarosz_natalia/lesson_13/inspector_1.py
445
3.625
4
from lesson_13.exercise_1 import Rectangle def object_inspector(obj, attributes): attr_dict = {} for attribute in attributes: value = getattr(obj, attribute) attr_dict[attribute] = value return attr_dict def main(): rectangle = Rectangle(1, 2, 3) attributes = ['width', 'height', ...
3a27d9898b3890651ac3fa41f46f50450251e420
jedzej/tietopythontraining-basic
/students/bedkowska_julita/lesson_06_doctionaries/frequency_analysis.py
446
4
4
num_of_lines = int(input('Give the number of lines: ')) print('Give ' + str(num_of_lines) + ' lines of words: ') words_frequency = dict() for _ in range(num_of_lines): words = input().split() for word in words: words_frequency[word] = words_frequency.get(word, 0) + 1 print('Sorted list of words:') word...
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...
7dfbd0f17f53a89b3d7e91e48c514d3e45a067bc
jedzej/tietopythontraining-basic
/students/bedkowska_julita/lesson_02_flow_control/bishop_move.py
460
3.84375
4
import math startX = int(input('Give the start column: ')) startY = int(input('Give the start row: ')) endX = int(input('Give the end column: ')) endY = int(input('Give the end row: ')) moveX = startX - endX moveY = startY - endY result = 'NO' if math.fabs(moveX) == math.fabs(moveY): result = 'YES' if startX ==...
2e9d015e9838c529c1b4f447a5fa96fa56fd0763
jedzej/tietopythontraining-basic
/students/serek_wojciech/lesson_03_functions/negative_exponent.py
366
4.125
4
#!/usr/bin/env python3 """Negative exponent""" def power(a_value, n_value): """Compute a^n""" result = 1 for _ in range(abs(n_value)): result *= a_value if n_value > 0: return result return 1 / result def main(): """Main function""" print(power(float(input()), int(input...
ade141d3690ee12e67ff07ade75a391a9af9d1bd
jedzej/tietopythontraining-basic
/students/biegon_piotr/lesson_01_basics/Tens_digit.py
123
3.984375
4
print("Tens digit\n") number = int(input("Enter an integer: ")) print ("\nTens digit of integer:", str(number // 10)[-1])
1f5c2befad94785fc07ff00bfe13998d1c82b370
jedzej/tietopythontraining-basic
/students/arkadiusz_kasprzyk/lesson_08_regular_expressions/valid_phone_number.py
800
3.9375
4
# valid_phone_number.py import re def valid_phone_number(phone): """ Examples -------- valid_phone_number('123-456-789') valid_phone_number('+48 123-456-789') valid_phone_number('0048 123-456-789') valid_phone_number('123 456 789') valid_phone_number('+48 123 456 789') valid_phone_...
929e103b208cc105297cd1dab3b946c27efbba0d
jedzej/tietopythontraining-basic
/students/grzegorz_bajorski/lesson_02_flow_control/the_second_maximum.py
222
4.09375
4
maximum = 0 max_second = 0 x = 1 while x != 0: x = int(input()) if x > maximum: max_second = maximum maximum = x elif x < maximum and x > max_second: max_second = x print(max_second)
2b15f0cf6d1836113f1fde66bca3b709c4322722
jedzej/tietopythontraining-basic
/students/piechowski_michal/lesson_08_regular_expressions/email_validator.py
965
3.625
4
#!/usr/bin/env python3 import re def is_valid(email): try: local_part, domain = email.split("@") except ValueError: return False if (len(local_part) < 0 or len(local_part) > 64 or len(domain) < 0 or len(domain) > 255): return False if (re.compile(r'.*\.\.').match...
0caa727fb0d611f93916061e80772ac331c36224
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_07_manipulating_strings_datetime_formatting/DatePrinter.py
941
4.28125
4
# Date printer - script that displays current date in human-readable format import datetime now = datetime.datetime.now() print('Full current date and time' 'using str method of datetime object: ', str(now)) print(str(now.day) + '.' + str(now.month) + '.' + str(now.year)) print(str(now.day) + '.' + str(now.mont...
dc540c717cc1c5439844b0a23bb49f526adcb608
jedzej/tietopythontraining-basic
/students/lakatorz_izaak/lesson_09_reading_and_writing_files/mad_libs.py
699
3.90625
4
text_file = open('../lesson_09_reading_and_writing_files/file.txt') text_to_work = text_file.read() # text_to_work = text_to_work.split() print(text_to_work) adj = input('Enter an adjective: ') # silly noun = input('Enter a noun: ') # chandelier verb = input('Enter a verb: ') # screamed adv = input('E...
6fcecdb59f650f143b8a0ab170ea6f9a3ed2faf0
jedzej/tietopythontraining-basic
/students/skowronski_rafal/lesson_01_basics/lesson_01/problem_06.py
799
3.859375
4
# Solves problem 06 - School desks def ceil_division(dividend, divisor): return -(-dividend // divisor) def solve_school_desks_problem(): STUDENTS_PER_DESK = 2 students_first_group = int( input('Enter number of students in first classroom: ')) students_second_group = int( input('Ent...
afefe57638a536032b8f87cf887c5d5099171483
jedzej/tietopythontraining-basic
/students/mielczarek_szymon/lesson_06_dicts_tuples_sets_args_kwargs/countries_and_cities.py
285
3.984375
4
country_dict = {} for _ in range(int(input())): country, *cities = input().split() country_dict[country] = ' '.join(cities) for _ in range(int(input())): city = input() for country, cities in country_dict.items(): if city in cities: print(country)
d7a7005fbb99116a2581edc5cfbb35a9917b67d4
jedzej/tietopythontraining-basic
/students/chylak_malgorzata/lesson_08_regular_expressions/postal_code_validator.py
312
3.921875
4
import re def main(): postal_code = input("Insert postal code: ") if valid(postal_code): print("Correct") else: print("Invalid postal code") def valid(postal_code): regex = re.compile(r'\d{2}-\d{3}') return regex.match(postal_code) if __name__ == "__main__": main()
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 ...
7e9d1d4b781d18a15b3bc7e515cbcad8a40c36d7
jedzej/tietopythontraining-basic
/students/skowronski_rafal/lesson_02_flow_control/lesson_04/problem_08.py
389
3.984375
4
# Solves problem 07 - Adding factorials def _main(): number = int(input('Enter an integer number (n): ')) last_factorial = 1 sum_of_factorials = last_factorial for i in range(2, number + 1): last_factorial *= i sum_of_factorials += last_factorial print('\nSum of factorials = {0}'...
d7fded0eab2422f88a1d87939e9075988990722b
jedzej/tietopythontraining-basic
/students/kosarzewski_maciej/lesson_02_flow_control/adding_factorials.py
137
3.953125
4
total = 0 factorial = 1 a = int(input()) # Print a value: for i in range(1, a+1): factorial *= i total += factorial print(total)
8cf507534d131724ee76aa9be85fe94ccadb67b0
jedzej/tietopythontraining-basic
/students/lakatorz_izaak/lesson_04_unit_testing/practice_projects_three.py
547
3.71875
4
# Test your code from Fibonacci numbers from previous lesson. You can use # pytest or unittest. import fibonacci_numbers import pytest def test_if_raises_type_error_for_none(): with pytest.raises(TypeError): fibonacci_numbers.fib(None) def test_if_raises_recursion_error_for_negative(): with pytest....
d776359786ad7b38ed3a9a23244250edd304db5d
jedzej/tietopythontraining-basic
/students/chylak_malgorzata/lesson_03_functions/the_length_of_the_segment.py
265
4
4
from math import sqrt def distance(a1, b1, a2, b2): return sqrt((a1 - a2) ** 2 + (b1 - b2) ** 2) if __name__ == "__main__": x1 = float(input()) y1 = float(input()) x2 = float(input()) y2 = float(input()) print(distance(x1, y1, x2, y2))
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)
b59dbdd496cca375352eb53543db0055e217d17c
jedzej/tietopythontraining-basic
/students/grzegorz_bajorski/lesson_01_python_basic/clock_face.py
244
4.0625
4
print('Enter hour') hour = int(input()) print('Enter minutes') minutes = int(input()) print('Enter seconds') seconds = int(input()) angle = float(hour *30) + float(minutes * 0.5) + float(seconds * (30/3600)) print('Angle is ' + str(angle))
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...
7a5cd7355991dfb896a67516d90e57a4ae0c06aa
jedzej/tietopythontraining-basic
/students/kaczmarek_katarzyna/lesson_01_basics/carRoute.py
126
3.796875
4
import math dayKm = int(input("Kilometers per day: ")) length = int(input("Route (km): ")) print(math.ceil(length / dayKm))
55c5bc6e25f483aef59ea15526a912fa1b14c01e
jedzej/tietopythontraining-basic
/students/mariusz_michalczyk/lesson_07_strings/table_printer.py
690
3.6875
4
table_data = [['apples', 'oranges', 'cherries', 'banana'], ['Alice', 'Bob', 'Carol', 'David'], ['dogs', 'cats', 'moose', 'goose']] def print_table(table_data): col_width, max_word_len = get_maxs(table_data) for i in range(col_width): for col in table_data: print...
bb8af2423d2fc0c3031570005588e531e38c95f6
jedzej/tietopythontraining-basic
/students/bedkowska_julita/lesson_01_basics/last_digit_of_integer.py
94
4.09375
4
num = int(input("Input the number: ")) print("Last digit of "+str(num)+" is "+str(num % 10))
bc69ff4cae55e6fe17e853e3248e6cdb939fb8de
jedzej/tietopythontraining-basic
/students/slawinski_amadeusz/lesson_03_functions/8.02_negative_exponent.py
540
4.25
4
#!/usr/bin/env python3 def power(a, n): return a**n while True: try: print("Calculate a**n:") print("a = ", end='') a = float(input()) if a < 0: print("a needs to be positive!") raise ValueError print("n = ", end='') n = int(input()) ...
0c0971b7c59c2efc9991d5d8b779e712cf066bc9
jedzej/tietopythontraining-basic
/students/skowronski_rafal/lesson_10_organizing_files/deleting_unneeded_files.py
1,113
3.53125
4
import os def get_search_directory(): return os.path.abspath(os.sep) def find_files(search_directory, predicate): matched_files = [] for current_dir, sub_dirs, file_names in os.walk(search_directory): files_portion = [ file_path for file_path in [ os.path.join(current...
2d640c9c5edd97b388fa475ceb8cf9db99c02b61
jedzej/tietopythontraining-basic
/students/BRACH_Jakub/lesson_02_Flow_Control/Year.py
128
3.609375
4
yyyy = int(input()) if (yyyy % 400 == 0) or (yyyy % 100 != 0) and (yyyy % 4 == 0): print("LEAP") else: print("COMMON")
350769fcc55a75e35e1c082ac17ad42dd0bae66b
jedzej/tietopythontraining-basic
/students/piotrowski_stanislaw/lesson_01_basics/L1_IPN_02.py
209
3.9375
4
#https://snakify.org/lessons/print_input_numbers/problems/area_of_right_triangle/ #piotrsta b = float(input('Podaj b: ')) h = float(input('Podaj h: ')) area = (b * h) / 2 print('Pole wynosi :' + str(area))
8b89e6159141449e527521a0f657e1e4d355e82a
jedzej/tietopythontraining-basic
/students/wachulec_maria/lesson_01_basics/last_digit_of_integer.py
59
3.546875
4
number = input("Give me some number: ") print(number[-1])
14018b5d4187a574e268bed00103a52d0ea33463
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_12_Debugging/validators.py
2,650
3.5
4
import re import logging def password_check(password): length_error = len(password) < 8 uppercase_error = re.search(r"[A-Z]", password) is None lowercase_error = re.search(r"[a-z]", password) is None digit_error = re.search(r"\d", password) is None password_ok = not (length_error or digit_error or...
4b12a57aef40155ffc91c732deb05efe54aabf36
jedzej/tietopythontraining-basic
/students/slawinski_amadeusz/lesson_07_string_datetime/delta_time_calculator.py
595
3.734375
4
#!/usr/bin/env python3 import datetime import time def delta_time(deltatime): now = datetime.datetime.now() now_unixtime = int(now.strftime("%s")) time_unixtime = int(deltatime.strftime("%s")) if now_unixtime >= time_unixtime: print("Podaj datę w przyszłości") else: print("Różni...
48724839d5b956a26012ce1cef6ecb612fd2395a
jedzej/tietopythontraining-basic
/students/urtnowski_daniel/lesson_14_decorators/sort.py
564
3.96875
4
#!/usr/bin/env python3 """ sort.py: a practice project number 1 from: Lesson 14 - Decorators """ __author__ = "Daniel Urtnowski" __version__ = "0.1" def sort(fun): """ This function is a decorator that when applied to a function that returns a list, sorts this list :param fun: reference to a funct...
14ed92c4d0de7b78ea24e0011a18ede44ced8dac
jedzej/tietopythontraining-basic
/students/kaczmarek_katarzyna/lesson_06_dicts_tuples_sets_args_kwargs/args_sum.py
177
3.578125
4
def sum_all(*args): total = 0 for x in args: total += x return total def main(): print(sum_all(1, 2, 3, 4, 5)) if __name__ == '__main__': main()
38fc777181dfa8c0fc17cb7d3e133cf80282366d
jedzej/tietopythontraining-basic
/students/chylak_malgorzata/lesson_13_objects_and_classes/object_inspector_1.py
484
3.734375
4
class Cat: def __init__(self, name, color, age, weight): self.name = name self.color = color self.age = age self.weight = weight def dictionary_of_object(obj): dictionary = {} for attr, value in obj.__dict__.items(): dictionary[attr] = value return dictionary...
d25fcec94c301a79010571571451fd9f4a80abcb
jedzej/tietopythontraining-basic
/students/hyska_monika/lesson_05_ Lists_list_comprehensions/TheDiagonalParallelToTheMain.py
515
4.03125
4
# Program print the diagonal parallel array array_size = int((input("Size of array: "))) diagonal_list = [[0] * array_size for i in range(array_size)] for i in range(array_size): for j in range(array_size): if i == j: diagonal_list[i][j] = 0 elif j > i: diagonal_list[i][j] ...
486cbb52558622de9026d631145adf936c42ede7
jedzej/tietopythontraining-basic
/students/marta_herezo/lesson_01/lesson_01/Area_of_right_angled_triangle.py
232
3.90625
4
# enter the length of the base print('enter length of the base') c = int(input()) # enter the height print('enter the height') h = int(input()) P = 0.5 * c * h print('c = ' + str(c)) print('h = ' + str(h)) print('P = ' + str(P))
958044e60cda0848f930d87d4602cee1da91fa38
jedzej/tietopythontraining-basic
/students/Hebdowska_Grazyna/lesson_06/guess_the_number.py
379
3.875
4
import random def guess_the_number(guess, number): if number in guess: return "YES" else: return "NO" data = int(input()) number = str(random.randint(0, data)) guess = [] while "HELP" not in guess: guess = input().split(' ') if "HELP" in guess: break print(guess_the_numb...
7459a7144acc61fade6de4171b62d7805a438837
jedzej/tietopythontraining-basic
/students/kula_marta/lesson_02_flow_control/lesson4.7_The_number_of_zeros.py
175
3.90625
4
#!/usr/bin/env python list = [] x = int(input("enter the number of variables to verify: ")) for i in range(x): e = int(input()) list.append(e) print list.count(0)
980c37991c41f2243c58f4ad19b62274a4944460
jedzej/tietopythontraining-basic
/students/medrek_tomasz/lesson_01_basics/school_desks.py
439
3.9375
4
#!/usr/bin/env python3 given_numbers = [] number_of_desks = 0 for i in range(3): try: given_numbers.append(int(input( "Please enter number of desks in {0} class:\n".format(i + 1)))) except ValueError: print('That was not a valid number, please try again') exit() number...
4292a5365544441e81c69f14ca2235a6a4e85bc8
jedzej/tietopythontraining-basic
/students/grzegorz_bajorski/lesson_08_regular_expressions/postal_code.py
200
3.765625
4
import re print("Enter post code") post_code = input(str()) code = re.compile(r'^\d{2}-\d{3}$') if code.match(post_code) is not None: print("Post code is OK") else: print("Invalid syntex")
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...
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...
f376d5cc4d9a33aa108d4216462f1867f482cfa7
jedzej/tietopythontraining-basic
/students/medrek_tomasz/lesson_06_dicts_tuples_sets_args_kwargs/the_number_of_distinct_words_in_some_text.py
534
4.03125
4
#!/usr/bin/env python3 def number_of_distinct_words(message): words_set = set(message.split()) return len(words_set) def main(): try: number_of_lines = int(input("Please enter integer number of lines\n")) except ValueError: print("It was wrong number, try again\n") exit ...
a304a8e9794e9749c72b1617ba6d590683e27509
jedzej/tietopythontraining-basic
/students/skowronski_rafal/lesson_06_dicts_tuples_sets_args_kwargs/project_03_snakify_lesson_08/reverse_the_sequence.py
467
3.921875
4
def print_sequence_reverse(sequence): if len(sequence) > 1: print_sequence_reverse(sequence[1:]) print(sequence[0], end='') def _is_int(char): try: int(char) return True except ValueError: return False if __name__ == '__main__': sequence = [int(i) ...
f3a45812b4e042fca5941cd328e6a62e67e1cfe9
jedzej/tietopythontraining-basic
/students/piechowski_michal/lesson_05_lists/maximum.py
596
3.796875
4
#!/usr/bin/env python3 rows, columns = [int(x) for x in input().split()] table = [] for row in range(0, rows): table.append([int(x) for x in input().split()]) maximum_row_number = 0 maximum_column_number = 0 maximum = table[maximum_row_number][maximum_column_number] for row in range(0, rows): for column in ...
90022f0476f757931f88639d479b8adb50e95902
jedzej/tietopythontraining-basic
/students/burko_szymon/lesson_01_basics/school_desks.py
370
3.625
4
import math a = int(input("Number of students in class a: ")) b = int(input("Number of students in class b: ")) c = int(input("Number of students in class c: ")) desks_in_a = math.ceil(a / 2) desks_in_b = math.ceil(b / 2) desks_in_c = math.ceil(c / 2) all_desks = desks_in_a + desks_in_b + desks_in_c print("The small...
968e145d1e2db95482444440364f2a63fd896e99
jedzej/tietopythontraining-basic
/students/grzegorz_bajorski/lesson_01_python_basic/school_desks.py
473
4.03125
4
print('Enter number of students in first class') class1 = int(input()) print('Enter number of students in second class') class2 = int(input()) print('Enter number of students in third class') class3 = int(input()) desk_in_class1 = (class1 // 2) + (class1 % 2) desk_in_class2 = (class2 // 2) + (class2 % 2) desk_in_cla...
14c9f250b66a2dc4578fc30104d03b6914165d4e
jedzej/tietopythontraining-basic
/students/myszko_pawel/lesson_02_flow_control/18_The second maximum.py
399
4.03125
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. lista = [] while True: a = int(input()) if a !=0: lista.append(a) else: ...
1376eca1d587350c3352d5f13d4a7326b02c65c6
jedzej/tietopythontraining-basic
/students/burko_szymon/lesson_01_basics/total_cost.py
228
3.828125
4
A = int(input("Dollars: ")) B = int(input("Cents:")) N = int(input("Number of cupcakes: ")) totalcost = (100 * A + B) * N print("Total cost for delicious cupcakes; " + str(totalcost // 100) + " " + str(totalcost % 100))
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...
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 ...
781fe3541e751f90f67782ea7cabc0ade618914b
jedzej/tietopythontraining-basic
/students/olszewski_bartosz/lesson_01_python_basics/clock_face_1.py
129
3.796875
4
h = int(input()) m = int(input()) s = int(input()) angle = float(0.5 * (60 * h + m + s / 60)) print('angle = ', round(angle, 3))
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...
41dc4aa0ac4b88bbb59c91226020cc4b774db8a6
jedzej/tietopythontraining-basic
/students/mitek_michal/lesson_01_basics/sum_of_digits.py
182
3.984375
4
def print_sum_of_digits(): number = int(input("Provide a number ")) list_of_digits = [int(d) for d in str(number)] print(sum(list_of_digits)) print_sum_of_digits()