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 |
|---|---|---|---|---|---|---|
68e300f2423b5ca9894980f833f6589368ee8934 | jedzej/tietopythontraining-basic | /students/slawinski_amadeusz/lesson_02_flow_control/4.05_lost_card.py | 191 | 3.796875 | 4 | # find missing card number in set of cards
cards = int(input())
missing_card = int(cards * (cards + 1) / 2)
for c in range(1, cards):
missing_card -= int(input())
print(missing_card)
|
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... |
5d748390f2310bc7d63170b284974d7e315c52c9 | jedzej/tietopythontraining-basic | /students/sendecki_andrzej/lesson_02_flow_control/lesson3-knight_move.py | 1,560 | 3.875 | 4 | #Chess knight moves like the letter L. It can move two cells horizontally and one cell vertically, or two #cells vertically and one cells horizontally. Given two different cells of the chessboard, determine whether #a knight can go from the first cell to the second in one move.
#
#The program receives the input of four... |
1792bffc0e33dfad8453f7452be1e17420642f25 | jedzej/tietopythontraining-basic | /students/kaczmarek_katarzyna/lesson_08_regular_expressions/strong_password_detection.py | 862 | 3.921875 | 4 | import re
def check_password_strength(password):
regex = re.compile(r'.{8,}')
if regex.search(password) is None:
print("The password should be at least 8 characters long")
return False
regex = re.compile(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*[0-9]){8,}')
if regex.search(password) is None:
... |
ef0663238a13569128adcdf4abac02352ca1726c | jedzej/tietopythontraining-basic | /students/BRACH_Jakub/lesson_01_basics/L01P04_Apples.py | 389 | 3.96875 | 4 | #!/usr/bin/env python3
#print('Enter number of students')
students = int(input())
#print('Enter number of apples')
apples = int(input())
if( students>0 and apples> 0):
#print('Every student will get {0:d} apples. {1:d} will stay in the basket.'.format(apples/students, apples%students))
print('{0:d}\n{1:d}'.forma... |
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... |
68a5c3d930b4d5c13f1ce7d7966c07ac14f6ce81 | jedzej/tietopythontraining-basic | /students/medrek_tomasz/lesson_05_lists/the_diagonal_parallel_to_the_main.py | 505 | 3.765625 | 4 | #!/usr/bin/env python3
def populate_symmetric_matrix(m):
array = [[None] * m for y in range(m)]
for x in range(m):
for y in range(m):
array[x][y] = abs(x - y)
return array
def main():
try:
input_number = int(input("Enter integer number\n"))
except ValueError:
... |
943d0798ffdf00a9d0a7c7d165aaf4780b4ea441 | jedzej/tietopythontraining-basic | /students/jemielity_kamil/lesson_02_flow_control/adding_factorials.py | 164 | 4.125 | 4 | number = int(input('Number: '))
total = 1
factorial_sum = 0
for x in range(1, number + 1):
total = total * x
factorial_sum += total
print(factorial_sum)
|
3ccd4ac5ff4735cd8d8f0372219100c0d579b331 | jedzej/tietopythontraining-basic | /students/bedkowska_julita/lesson_03_functions/calculator.py | 1,133 | 4.1875 | 4 | def menu():
return """
a - add
s - subtract
m - multiply
d - divide
p - power
h,? - help
q - QUIT
"""
def get_values():
print("Input 1st operand:")
var_1 = int(input())
print("Input 2nd operand:")
var_2 = int(input())
print("Result:")
return [var_1, var_2]
... |
5f7387139631fe381c606afea5ccac70f118b413 | jedzej/tietopythontraining-basic | /students/myszko_pawel/lesson_01_basics/09_Sum of digits.py | 117 | 4 | 4 | # Given a three-digit number. Find the sum of its digits.
a = int(input())
print( a//100 + (a%100)//10 + (a%10) )
|
0c505f015d8bd23b972ef5fde9e4dea3bb8f2f05 | jedzej/tietopythontraining-basic | /students/nartowska_karina/lesson_08_regular_expressions/email_validator.py | 529 | 3.75 | 4 | import re
def email_validator(email):
r_email = re.compile(r'(^[a-zA-Z0-9_.+-]+@[a-zA-Z0-9-]+\.[a-zA-Z0-9-.]+$)')
if r_email.match(email):
return 1
def main():
set_of_emails = ("karinanartowska",
"karina@nartowska@pl",
".karina@.pl",
... |
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... |
0ffd17532090c6e13d431996fe91865ee21178cb | jedzej/tietopythontraining-basic | /students/kulesza_monika/lesson_01_02/Lesson.py | 2,864 | 3.96875 | 4 | def sum_of_three_numbers():
a = int(input())
b = int(input())
c = int(input())
print(a + b + c)
#####################################################
def area_of_right_angled_triangle():
b = int(input())
h = int(input())
print (0.5 * b * h)
################################################... |
04ffe16ff2593fd902320accd71b0ddec6bf0f95 | jedzej/tietopythontraining-basic | /students/myszko_pawel/lesson_01_basics/10_Fractional part.py | 269 | 3.84375 | 4 | # Given a positive real number, print its fractional part.
# Read an integer:
a = float(input())
a = str(a)
index = 0
for i in a:
index += 1
if(i == '.'):
break
print('0' + a[index-1:])
###**********************###
a = float(input())
print (a-int(a)) |
69a0a2fa03fa6285d2357c669111aa23abc42626 | jedzej/tietopythontraining-basic | /students/lakatorz_izaak/lesson_03_functions/calculator.py | 2,080 | 3.796875 | 4 | # Refactor calculator.py file. Organize code into functions, add proper
# docstrings. Ensure that file is compliant with PEP8.
def get_input():
"""Return two values from input."""
print("Input 1st operand:")
add_var_one = int(input())
print("Input 2nd operand:")
add_var_two = int(input())
retu... |
175ecb2cd46f7e8da465a936048fc4bbc090b241 | jedzej/tietopythontraining-basic | /students/pluciennik_edyta/lesson_01_basics/hello_harry.py | 75 | 3.84375 | 4 | #Read an integer:
a = str(input())
#Print a value:
print("Hello,", a + "!") |
07c5303dc36a236c65944b4be1a62e922e0dcb00 | jedzej/tietopythontraining-basic | /students/serek_wojciech/lesson_02_flow_control/adding_factorials.py | 281 | 4 | 4 | #!/usr/bin/env python3
"""Adding factorials"""
def main():
"""Main function"""
number = int(input())
fact = 1
fact_sum = 0
for i in range(1, number + 1):
fact *= i
fact_sum += fact
print(fact_sum)
if __name__ == '__main__':
main()
|
4d46906ddefb7fdb28d79b25d3cd413d5e1615c3 | jedzej/tietopythontraining-basic | /students/wachulec_maria/lesson_13_objects_and_classes/object_inspector_1.py | 392 | 3.578125 | 4 | class Something:
def __init__(self, dot, point, comma):
self.dot = dot
self.point = point
self.comma = comma
def give_names_and_values_of_object(obj, attributes):
result = {}
for name in attributes:
result[name] = obj.__getattribute__(name)
return result
st = Somethin... |
6adcfad46f5971b53017660ba100ec86108bba5f | jedzej/tietopythontraining-basic | /students/chylak_malgorzata/lesson_06_dictionaries_tuples_and_sets/guess_the_number.py | 352 | 3.734375 | 4 | n = int(input())
guess = set(range(1, n + 1))
while True:
number = input()
if number not in ("YES", "NO", "HELP"):
a = set(int(s) for s in number.split())
elif number == "YES":
guess &= a
elif number == "NO":
guess -= a
elif number == "HELP":
break
for elem in guess... |
59113a7fd1adefa30710b28805cc6a7d52d324a7 | jedzej/tietopythontraining-basic | /students/grzegorz_bajorski/lesson_06/guess_number.py | 387 | 3.59375 | 4 | num_range = int(input())
numbers = wrong_numbers = set(range(1, num_range + 1))
while True:
guess = input()
if guess == 'HELP':
break
guess = set([int(i) for i in guess.split()])
answer = input()
if answer == 'YES':
numbers &= guess
elif answer == 'NO':
numbers &= wrong... |
c346d1631f80ac8672609457f2d5839ceaf2283f | jedzej/tietopythontraining-basic | /students/synowiec_krzysztof/lesson_09_reading_and_writing_files/regex_search.py | 500 | 3.53125 | 4 | import re
import os
import fnmatch
INPUT_FILE = 'input.txt'
def main():
pattern = re.compile(r'{}'.format(input("Provide pattern: ")))
txt_file_list = []
for file in os.listdir(os.curdir):
if fnmatch.fnmatch(file, "*.txt"):
txt_file_list.append(file)
for file in txt_file_list:
... |
2560a81ecad35ae12c4a28361b2dda57a32ecbd2 | jedzej/tietopythontraining-basic | /students/hyska_monika/lesson_01_basics/FractionalPart.py | 155 | 4.1875 | 4 | # The program print fractional part.
from decimal import Decimal
a = Decimal(input("Please put number: "))
fr = a % 1
print("The sum of digits is:", fr)
|
f59404812e94e70d7e6a30eec36491d1275dbe7b | jedzej/tietopythontraining-basic | /students/adam_wulw/lesson_05_lists/numbers_filter.py | 461 | 3.84375 | 4 | list_of_strings = ['2', '0', '8', '3']
to_filter_range = range(3)
def my_filter(data, filter_range):
data = list(map(int, data))
output = []
filter_match = 0
for item in data:
for filter_item in filter_range:
if filter_item == item:
filter_match = 1
if not f... |
90110dac8e19f3eccc28fa7b7a0a5ab7891f9754 | jedzej/tietopythontraining-basic | /students/kulon_aleksander/lesson_04/test_collatz_sequence.py | 421 | 3.703125 | 4 | import unittest
from lesson_03.collatz_sequence import collatz
class TestCollatzFunction(unittest.TestCase):
def test8(self):
self.assertEqual(collatz(8), 4, "problem with 8")
def test16(self):
self.assertEqual(collatz(16), 8, "problem with 16")
def test_input(self):
with self.a... |
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... |
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... |
c09a520c073ab0b914dc8ca32e925d2194381065 | jedzej/tietopythontraining-basic | /students/saleta_sebastian/lesson_02_flow_control/chocolate_bar.py | 326 | 3.984375 | 4 | def check_if_split_is_possible():
wide = int(input())
height = int(input())
square = int(input())
field = wide * height
if square < field and ((square % wide == 0) or (square % height == 0)):
print('YES')
else:
print('NO')
if __name__ == '__main__':
check_if_split_is_possi... |
3ddc617617140ac32af1ecbc0ff218fd0d470edf | jedzej/tietopythontraining-basic | /students/serek_wojciech/lesson_01_basics/apple_sharing.py | 280 | 3.609375 | 4 | #!/usr/bin/env python3
"""Apple sharing"""
def main():
"""Main function"""
students = int(input())
apples = int(input())
print(apples // students) # apples per student
print(apples % students) # remaining apples
if __name__ == '__main__':
main()
|
938ce0d7410063cd8276ef4db5022707b6497712 | jedzej/tietopythontraining-basic | /students/ryba_paula/lesson_05_lists/swap_the_columns.py | 526 | 3.953125 | 4 | def swap_columns(a, i, j):
for n in range(len(a)):
a[n][i], a[n][j] = a[n][j], a[n][i]
def main():
rows, col = [int(i) for i in input("Input rows and columns: ").split()]
a = [[int(j) for j in input("Input " + str(col) + " values: ").split()]
for i in range(rows)]
swap_col, swap_col2 ... |
b586aef350f2110742149629b0162de8fc9aefef | jedzej/tietopythontraining-basic | /students/kaczmarek_katarzyna/lesson_06_dicts_tuples_sets_args_kwargs/list_to_fictionary_function_for_fantasy_game_inventory.py | 505 | 3.578125 | 4 | from fantasy_game_inventory import display_inventory
def add_to_inventory(inventory, added_items):
for item in added_items:
if item not in inventory:
inventory[item] = 1
else:
inventory[item] += 1
return inventory
def main():
inv = {'gold coin': 42, 'rope': 1}
... |
a805b909977d6399953580ed271062b3ccbe840d | jedzej/tietopythontraining-basic | /students/ryba_paula/lesson_13_objects_and_classes/circle.py | 1,851 | 4.21875 | 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, width, height, corner):
self.width = width
self.heigh... |
8de50373683d17fb3ac7b230b45aa137d2d504b0 | jedzej/tietopythontraining-basic | /students/semko_krzysztof/lesson_13_objects_and_classes/selective_shallow_compare.py | 1,128 | 3.765625 | 4 | """
Selective shallow compare - write a function that
for given 2 objects and list of attribute names checks
if objects' attributes are equal.
"""
from exercise_one import Point
from object_inspectors import Person
class Alien:
def __init__(self, last_name, age, weight, point, power_level):
self.last_nam... |
f79c4a4949a8dcbfe1a5e972e8337f12c7fefa21 | jedzej/tietopythontraining-basic | /students/wachulec_maria/lesson_9_reading_and_writing_files/regex_search.py | 637 | 3.625 | 4 | import os
import re
def search_in_file(file, reg):
txt_file = open(os.path.join(os.getcwd(), file))
text = txt_file.read()
regex = (re.findall(reg, text))
txt_file.close()
return regex
def print_result(result):
return '\n'.join([str(i) + ': ' + str(result[i]) for i in result.keys()
... |
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... |
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')
|
e339d59bae7642fd297c4731b914a31a88686f02 | jedzej/tietopythontraining-basic | /students/jarosz_natalia/lesson_10/selective_copy.py | 741 | 3.765625 | 4 | import os
import shutil
def selective_copy(folder_path, new_folder_path):
if not os.path.exists(new_folder_path):
os.makedirs(new_folder_path)
for folder_name, sub_folders, file_names in os.walk(folder_path):
for file_name in file_names:
if file_name.endswith('.pdf') or file_name.e... |
3aca3f0479f8e7a6aa930fc2ff9ff41b5c3d4dea | jedzej/tietopythontraining-basic | /students/nartowska_karina/lesson_05_lists/the_diagonal_parallel_to_the_main.py | 515 | 3.9375 | 4 | def diagonal_parallel(size):
matrix_image = []
for i in range(size):
row = []
for j in range(size):
if i < j:
row.append(j - i)
else:
row.append(i - j)
matrix_image.append(row)
print("Result:")
return matrix_image
def main... |
b2ded46665becf952b5e6b00dc45c4a77d4a2cd7 | jedzej/tietopythontraining-basic | /students/mielczarek_szymon/lesson_13_objects_and_classes/object_inspector_2.py | 943 | 3.75 | 4 | #! python3
import pprint
"""
Task:
Write a function that for a given object returns dictionary with names and
values of all object's attributes that are instances of string, integer or
float.
"""
class TestObject:
def __init__(self, x, y, text, somelist):
self.integer = x
self.float = y
se... |
363823bd2dde521327c7c95e9a921a8d1739dc92 | jedzej/tietopythontraining-basic | /students/hyska_monika/lesson_02_flow_control/LeapYear.py | 251 | 4.09375 | 4 | # The program print that year is leap
y = int(input("Put year: "))
l1 = (y / 400) % 1
l2 = (y / 4) % 1
l3 = (y / 100) % 1
if (l1 == 0) or ((l2 == 0) & (l3 != 0)):
value = "LEAP"
else:
value = "COMMON"
print("\nWhat type is year?:", value)
|
537bcd8872372578440c574c8bcf68ccb8b71353 | jedzej/tietopythontraining-basic | /students/kaczmarek_katarzyna/lesson_01_basics/clockFace1.py | 159 | 4.03125 | 4 | hours = int(input("Hours: "))
minutes = int(input("Minutes: "))
seconds = int(input("Seconds: "))
print(hours * 30 + minutes * 30 / 60 + seconds * 30 / 3600)
|
81937a54b06e26cb98a54a7e8fd3cdeb5f0a01c1 | jedzej/tietopythontraining-basic | /students/Glogowska_Joanna/lesson_02_flow_control/factorial.py | 124 | 3.96875 | 4 | print('Enter a number: ')
givenint = int(input())
factor = 1
for i in range(1, givenint + 1):
factor *= i
print(factor)
|
49b55c6cdaacde879db9d515d94c7f9295fe54bc | jedzej/tietopythontraining-basic | /students/BRACH_Jakub/lesson_02_Flow_Control/Knight.py | 339 | 3.765625 | 4 | x_base = int(input())
y_base = int(input())
x_move = int(input())
y_move = int(input())
x_delta = x_base - x_move
y_delta = y_base - y_move
if x_delta < 0:
x_delta = x_delta * (-1)
if y_delta < 0:
y_delta = y_delta * (-1)
if y_delta == 1 and x_delta == 2 or y_delta == 2 and x_delta == 1:
print("YES")
els... |
3c8b1574d40149ecffcb69224100c215393ffda2 | jedzej/tietopythontraining-basic | /students/nartowska_karina/lesson_02_flow_control/factorial.py | 94 | 3.625 | 4 | value = int(input())
i = 1
tmp = 1
for i in range(2, value + 1):
tmp = tmp * i
print(tmp)
|
045c53e0b89564fc79812474ef933e9929d8437f | jedzej/tietopythontraining-basic | /students/olszewski_bartosz/lesson_01_python_basics/area_of_right-angled_triangle.py | 124 | 3.640625 | 4 | a = int(input())
h = int(input())
p = a * h / 2
print('triangle area''\n''for base', a, '\n''adn high', h, '\n''equals', p)
|
3fc355f6221f89c07e1f0d91de6a4f21cb4d30e9 | jedzej/tietopythontraining-basic | /students/zelichowski_michal/lesson_02_flow_control/factorial.py | 308 | 3.984375 | 4 | """In mathematics, the factorial of an integer n, denoted by n! is
the following product: n!=1×2×…×n
For the given integer n
calculate the value n!. Don't use math module in this exercise. """
# Read an integer:
n = int(input())
f = 1
# Print a value:
for x in range(2, n + 1):
f = f * x
print(f)
|
17ab932dd58ffe47fa1364aa3b5a51b702c38aa6 | jedzej/tietopythontraining-basic | /students/urtnowski_daniel/lesson_11_argparse_and_math/insert_gaps.py | 2,624 | 3.734375 | 4 | #!/usr/bin/env python3
"""
insert_gaps.py: a practice project "Filling in the Gaps - extra challenge"
from: https://automatetheboringstuff.com/chapter9/
The program inserts gaps into numbered files so that a new file can be added
Usage: insert_gaps.py [-h] -p PREFIX -s START -l LEN [-d PATH]
"""
__author__ = "Dani... |
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... |
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))
|
43895777e5d03d8ba42d1892ac4e53101a1656f1 | jedzej/tietopythontraining-basic | /students/skowronski_rafal/lesson_02_flow_control/lesson_04/problem_06.py | 276 | 3.921875 | 4 | # Solves problem 06 - Factorial
def _main():
number = int(input('Enter an integer number (n): '))
factorial = 1
for i in range(2, number + 1):
factorial = factorial * i
print('\nn! = {0}'.format(factorial))
if __name__ == '__main__':
_main()
|
0d71bae692e7bf54897ddbed1ffb2b28977e9962 | jedzej/tietopythontraining-basic | /students/synowiec_krzysztof/lesson_01_basics/total_cost.py | 339 | 3.78125 | 4 | def main():
dolarsPerCupcake = int(input())
centsPerCupcake = int(input())
quantity = int(input())
totalDolars = quantity * dolarsPerCupcake + (centsPerCupcake * quantity) // 100
totalCents = (centsPerCupcake * quantity) % 100
print("{0} {1}".format(totalDolars, totalCents))
if __name__ == '__m... |
d80aeff7e4d0202c6d9f41bf665a6e0aa58c4b51 | jedzej/tietopythontraining-basic | /students/BRACH_Jakub/lesson_02_Flow_Control/Second_maximum.py | 245 | 3.8125 | 4 | maximum = 0
second_best = 0
while 1:
data = int(input())
if data == 0:
break
if data >= maximum:
second_best = maximum
maximum = data
elif data > second_best:
second_best = data
print(second_best)
|
ea83ee11f674981c6fb05bfce88441624ed88b0a | jedzej/tietopythontraining-basic | /students/BRACH_Jakub/lesson_02_Flow_Control/Bishop.py | 295 | 3.734375 | 4 | x_base = int(input())
y_base = int(input())
x_move = int(input())
y_move = int(input())
x_delta = x_base - x_move
y_delta = y_base - y_move
if x_delta < 0:
x_delta = x_delta * (-1)
if y_delta < 0:
y_delta = y_delta * (-1)
if y_delta == x_delta:
print("YES")
else:
print("NO")
|
e078dac9acb21bf5256b23576145d411b49c0ecb | jedzej/tietopythontraining-basic | /students/lakatorz_izaak/lesson_02_flow_control/lost_card.py | 401 | 3.90625 | 4 | # There was a set of cards with numbers from 1 to N. One of the card is now
# lost. Determine the number on that lost card given the numbers for the
# remaining cards.
print("Enter biggest card (N) and cards u already have: ")
biggest_card = int(input())
sum = 0
for i in range(1, biggest_card + 1):
sum += i
for ... |
91a449171832018ed1c5160c564e16409226876f | jedzej/tietopythontraining-basic | /students/jarosz_natalia/lesson_02/the_second_maximum.py | 273 | 3.9375 | 4 | max1 = int(input())
max2 = int(input())
if max1 < max2:
max1, max2 = max2, max1
element = int(input())
while element != 0:
if element > max1:
max2, max1 = max1, element
elif element > max2:
max2 = element
element = int(input())
print(max2)
|
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... |
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 ... |
6b584af58e901754dcfd8f75ad112ef29489f837 | jedzej/tietopythontraining-basic | /students/kaczmarek_katarzyna/lesson_01_basics/firstDigitAfterDecimalPoint.py | 63 | 3.84375 | 4 | number = float(input("Number: "))
print(int(number * 10) % 10)
|
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))
|
e8343f22aabc4b1ff2848d41bfb228435ed6347f | jedzej/tietopythontraining-basic | /students/kosarzewski_maciej/lesson_01_basics/school_desks.py | 321 | 3.84375 | 4 | from math import ceil
# Read an integer:
class1 = int(input("Provide number of students in class 1: "))
class2 = int(input("Provide number of students in class 2: "))
class3 = int(input("Provide number of students in class 3: "))
# Print a value:
a = ceil((class1 / 2)) + ceil((class2 / 2)) + ceil((class3 / 2))
print(a)... |
178a053f5ccd33781bf2e6ad249e9fe38ea8df54 | jedzej/tietopythontraining-basic | /students/synowiec_krzysztof/lesson_07_string_datetime/table_printer.py | 699 | 3.71875 | 4 | def main():
table_data = [['apples', 'oranges', 'cherries', 'banana'],
['Alice', 'Bob', 'Carol', 'David'],
['dogs', 'cats', 'moose', 'goose']]
print_table(table_data)
def print_table(table_data):
col_width = []
for parts in table_data:
longest_string = 0
... |
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... |
51c031e690a67ba2f6604f1a63c1eb3cf4937acb | jedzej/tietopythontraining-basic | /students/bedkowska_julita/lesson_01_basics/sum_of_three_numbers.py | 182 | 4.125 | 4 | num1 = int(input("Input first number: "))
num2 = int(input("Input second number: "))
num3 = int(input("Input third number: "))
sum = num1 + num2 + num3
print("Result: " + str(sum)) |
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... |
35ad782414275e04ed71dc50b47cbfd58f134dbe | jedzej/tietopythontraining-basic | /students/piotrowski_stanislaw/lesson_02_flow_control/lost_card.py | 283 | 3.796875 | 4 | # https://snakify.org/lessons/for_loop_range/problems/lost_card/
# piotrsta
number_of_cards = int(input())
summary_value = 0
for i in range(1, number_of_cards + 1):
summary_value += i
for i in range(number_of_cards - 1):
summary_value -= int(input())
print(summary_value)
|
8d75a41e68ad89a65abc0b2fbf88531610b2f3a9 | jedzej/tietopythontraining-basic | /students/dychowicz_monika/lesson_01_basics/Total_cost.py | 154 | 3.796875 | 4 | a = int(input("Cupcake cost: "))
b = int(input("Dollars: "))
n = int(input("Cents: "))
print(a)
cost = n * (100 * a + b)
print(cost // 100, cost % 100)
|
810b8a53a5975086ef0d1a8974e8477eab4b9cdb | jedzej/tietopythontraining-basic | /students/piechowski_michal/lesson_05_lists/chess_board.py | 365 | 3.59375 | 4 | #!/usr/bin/env python3
rows, columns = [int(x) for x in input().split()]
table = ['.'] * rows
for row in range(0, rows):
table[row] = ['.'] * columns
for row in range(0, rows):
for column in range((row + 1) % 2, columns, 2):
table[row][column] = '*'
for row in table:
for column_item in row:
... |
caf50c440b8fc4c6043204ffd9841e52269b443f | jedzej/tietopythontraining-basic | /students/hyska_monika/lesson_08_regular_expressions/email_validator.py | 794 | 3.921875 | 4 | """
Email validator
- email validator that checks if supplied string is valid e-mail address
correct emails:
anaddd@gmail.com
a@gmail.com
432423@gmail.pl
AnsSisfd.sf78767sa@gmail.coma
anaddd@gmaxxxxxxxxxxil.com
- tests: email_validator_pytest.py
"""
import re
def check_email(email):
email_rege... |
661add9632783c8315d5b81977afe7d482c998a3 | jedzej/tietopythontraining-basic | /students/piechowski_michal/lesson_02_flow_control/ladder.py | 218 | 3.9375 | 4 | #!/usr/bin/env python3
number_of_steps = int(input())
if number_of_steps > 9:
print("Maximum 9 is allowed")
quit()
ladder = ""
for i in range(1, number_of_steps + 1):
ladder += str(i)
print(ladder)
|
f3bdb47979135fea05df11e03122cd0b9baf5832 | jedzej/tietopythontraining-basic | /students/adam_wulw/lesson_01_python_basics/area_of_right_angle_triangle.py | 188 | 4.0625 | 4 | print('Enter length of the triangle base');
b = int(input())
print('Enter length of the triangle height');
h = int(input())
print('The area of right-angled triangle is '+str(b*h/2)+'\n');
|
9602115f1eaf7540f96983adf4a5534e7c3771a3 | jedzej/tietopythontraining-basic | /students/piotrowski_stanislaw/lesson_01_basics/L1_IFN_06.py | 327 | 3.890625 | 4 | #https://snakify.org/lessons/integer_float_numbers/problems/car_route/
#piotrsta
import math
print('Podaj mozliwy kilometraz na dzien: ')
km_per_day = int(input())
print('Podaj dlugosc trasy: ')
route = int(input())
days = math.ceil(route / km_per_day)
print('Liczba dni potrzebnych na przebycie tej trasy to: ')
print... |
a32193a1eba244238f9eea90c930927eae10ac8d | jedzej/tietopythontraining-basic | /students/saleta_sebastian/lesson_02_flow_control/the_number_of_elements_equal_to_the_maximum.py | 416 | 4.25 | 4 | def get_how_many_elements_are_equal_to_largest_element():
maximum = 0
num_maximal = 0
element = -1
while element != 0:
element = int(input())
if element > maximum:
maximum, num_maximal = element, 1
elif element == maximum:
num_maximal += 1
print(num... |
7ce376146b310be108985c89f05f785e27acfa2a | jedzej/tietopythontraining-basic | /students/grzegorz_bajorski/lesson_01_python_basic/total_cost.py | 297 | 3.984375 | 4 | print('Enter dollars cost')
dollars = int(input())
print('Enter cents cost')
cents = int(input())
print('Enter number of cupcakes')
cupcakes = int(input())
total =int((dollars * 100 + cents) * cupcakes)
print('total cost in dollars and cents is ' + str(total// 100) + ' ' + str(total % 100))
|
3e531db171b088db5cca83a4220b01e73900ecf9 | jedzej/tietopythontraining-basic | /students/grzegorz_kowalik/lesson_02_flow_control/second_maximum.py | 225 | 3.921875 | 4 | maximum = 0
second_maximum = 0
n = 1
while n != 0:
n = int(input())
if n > maximum:
second_maximum = maximum
maximum = n
elif n > second_maximum:
second_maximum = n
print(second_maximum)
|
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... |
71db7dd8d51bc7a5daef106f7fccaed7dcce0938 | jedzej/tietopythontraining-basic | /students/semko_krzysztof/lesson_05_lists/the_diagonal_parallel_to_the_main.py | 708 | 4.03125 | 4 | """
Given an integer n, produce a two-dimensional array
of size (n×n) and complete it according to the following
rules, and print with a single space between characters:
On the main diagonal write 0 .
On the diagonals adjacent to the main, write 1 .
On the next adjacent diagonals write 2 and so forth.
Pri... |
1f3b7f46287e477c08c75ad540c4610cb1ba8799 | jedzej/tietopythontraining-basic | /students/arkadiusz_kasprzyk/lesson_03_functions/exponentiation.py | 296 | 4.25 | 4 | def power(a, n):
if n < 0:
a = 1 / a
n = -n
return power(a, n)
elif n > 0:
return a * power(a, n - 1)
else:
return 1
print("Calculates a^n (a to the power of n).")
a = float(input("Give a: "))
n = int(input("Give n: "))
print(power(a, n))
|
5ff9d5ca2590b98235cb87c3ae95c3eb5c3e9c2a | jedzej/tietopythontraining-basic | /students/swietczak_monika/lesson_01_basics/first_digit_after_decimal_point.py | 111 | 3.921875 | 4 | # Read an integer:
a = float(input("enter a positive real number: "))
# Print a value:
print(int(a * 10) % 10)
|
7ab776f08d76a117e4b0e4a1c8ed5964bd7915ea | jedzej/tietopythontraining-basic | /students/piechowski_michal/lesson_08_regular_expressions/strong_password_detection.py | 743 | 3.921875 | 4 | #!/usr/bin/env python3
import re
def is_strong(password):
strong = (len(password) >= 8 and
re.compile(r'.*\d').match(password) and
re.compile(r'.*\W|.*_').match(password) and
re.compile(r'.*[A-Z]').match(password) and
re.compile(r'.*[a-z]').match(password))... |
32ec3a74a30c6cae0e994dc05fda0a1b560b4f34 | jedzej/tietopythontraining-basic | /students/saleta_sebastian/lesson_01_basics/first_digit_after_decimal_point.py | 253 | 3.921875 | 4 | def get_first_digit_of_the_decimal_point():
num = float(input())
first_decimal_digit = int(num * 10) % 10
print('first decimal digit is {}'.format(first_decimal_digit))
if __name__ == '__main__':
get_first_digit_of_the_decimal_point()
|
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 + "!")
|
28fc7c93ede47b89f684cb403cb5dc7dc7930c40 | jedzej/tietopythontraining-basic | /students/pluciennik_edyta/lesson_01_basics/area_of_right_angled_triangle.py | 118 | 3.921875 | 4 | # Read the numbers b and h like this:
b = int(input())
h = int(input())
# Print the result with print()
print(b*h/2)
|
3c49477d2ca4ab7c99322bb13a4785b7fbd07c84 | jedzej/tietopythontraining-basic | /students/jakielczyk_miroslaw/lesson_02_flow_control/Lesson_02_part1.py | 1,304 | 3.765625 | 4 | # Bishop moves
a = int(input())
b = int(input())
c = int(input())
d = int(input())
if a >= 1 and b >= 1 and c >= 1 and d >= 1 and a <= 8 and b <= 8 and c <= 8 and d <= 8:
if c-a == d-b or a-c == d-b :
print ("YES")
else:
print ("NO")
else :
print ("NO")
# Queen move
a = int(input())
b = in... |
ef3fdd7f84a1c546fabdf8b392ad3acdcc4b3a9f | jedzej/tietopythontraining-basic | /students/wachulec_maria/lesson_08_regular_expressions/postal_code_validator.py | 391 | 4.09375 | 4 | import re
def postal_code_validator(text):
postal_code_regex = re.compile(r'(\d{2})(\s|-)(\d{3})')
try:
if text == postal_code_regex.search(text).group(0):
return 'Valid postal code'
except AttributeError:
return 'Invalid postal code'
else:
return 'Invalid postal co... |
314e2b0cf3c1dfee744035b392054895ff8a6b77 | jedzej/tietopythontraining-basic | /students/serek_wojciech/lesson_04_unit_testing/test_distance.py | 1,129 | 3.90625 | 4 | """Unit tests for distance function using pytest"""
import pytest
from lesson_03_functions.length_of_the_segment import distance
def test_none():
"""Test for None value as parameter"""
with pytest.raises(TypeError):
distance(None, 'b', 'c', 'd')
def test_non_integer():
"""Test for no integer as ... |
6c7ccf27119b4f15cda23e20a3cedada7633d623 | jedzej/tietopythontraining-basic | /students/hyska_monika/lesson_11_argparse_math/regex_search.py | 1,591 | 4.0625 | 4 | """
Program that opens all .txt files in a folder and
searches for any line that matches a user-supplied regular expression.
The results should be printed to the screen.
"""
import re
import os
import argparse
import sys
def check_arg(args=None):
parser = argparse.ArgumentParser(description='Search regex on file... |
14d73507e6dc00785bac67b1b33437dba9f86b23 | jedzej/tietopythontraining-basic | /students/ryba_paula/lesson_01_basics/total_cost.py | 160 | 3.796875 | 4 | dollars, cents, cupcakes = int(input()), int(input()), int(input())
total_cost = cupcakes * (dollars * 100 + cents)
print(total_cost // 100, total_cost % 100) |
2ef1ca979c8a1775491bde3f2e22ce6502b30872 | jedzej/tietopythontraining-basic | /students/barecki_andrzej/lesson_06_dicts_tuples_sets_args_kwargs/guess_the_number.py | 1,151 | 4 | 4 | import os
def main():
""""set range of secret number"""
range_for_secret = int(input())
""""Create total secret set"""
total_secret_set = set([int(x) for x in range(1, range_for_secret + 1)])
beatrice_guess = input()
while True:
if beatrice_guess == "HELP":
break
... |
617e60614f0dd4b5e5aa691327b352448dbcc25c | jedzej/tietopythontraining-basic | /students/Hebdowska_Grazyna/lesson_02_flow_control/ChocolateBar.py | 269 | 3.734375 | 4 | n = int(input('n: '))
m = int(input('m: '))
k = int(input('k: '))
if (n * m > k):
if (k >= n or k >= m):
if k % n == 0:
print('yes')
elif k % m == 0:
print('yes')
else:
print('no')
else:
print('no')
|
6c8d712672db65641af29f35c6b418eae1cafb87 | jedzej/tietopythontraining-basic | /students/hyska_monika/lesson_02_flow_control/AddinFactorials.py | 189 | 4.09375 | 4 | # Program print sum for n!
n = int(input("Put number: "))
fact = 1
sum_fact = 0
for i in range(1, n + 1):
fact = fact * i
sum_fact += fact
print("Factorials sum is =", sum_fact)
|
65eb029cee296d221d65caca415045a23379cdb4 | jedzej/tietopythontraining-basic | /students/burko_szymon/lesson_01_basics/last_digit_of_integer.py | 123 | 3.984375 | 4 | def lastdigit(a):
return (a % 10)
a = int(input("Number: "))
print("Last digit of number is: " + str(lastdigit(a)))
|
336fc1d880e0c88bf8ba869a10223d5c3fac22d1 | jedzej/tietopythontraining-basic | /students/zelichowski_michal/lesson_01_python_basics/car_route.py | 232 | 3.765625 | 4 | # 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
N = int(input())
M = int(input())
print(math.ceil(M / N))
|
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... |
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... |
6e1c12789403013eb2fd918e519ffd25944aa89d | jedzej/tietopythontraining-basic | /students/biegon_piotr/lesson_01_basics/Car_route.py | 290 | 4.0625 | 4 | import math
print("Car route\n")
N = int(input("Enter the number of kilometers that a car can drive in one day: "))
M = int(input("Enter the length of the route in kilometers: "))
a = math.ceil(M / N)
print("\nCrossing the route with a length of %d kilometers will take %d days" %(M, a)) |
ca7e83931601fb4ccdb55247baaba0a229b3008d | jedzej/tietopythontraining-basic | /students/jemielity_kamil/lesson_01_basics/hello_harry.py | 70 | 3.984375 | 4 | name = str(input("Write your name: "))
print("Hello, " + name + "!")
|
ee025c9b92d9689e4c459cdceed28510c6642542 | jedzej/tietopythontraining-basic | /students/jarosz_natalia/lesson_01/previous_and_next.py | 209 | 3.90625 | 4 | a = "The previous number for the number"
str1 = "The next number for the number "
val1 = int(input())
print(str1 + str(val1) + " is " + str(val1 + 1) + ".")
print(a + str(val1) + " is " + str(val1 - 1) + ".")
|
b2d742b7e7affd3183fe37526110b6b7f32e1547 | jedzej/tietopythontraining-basic | /students/adam_wulw/lesson_07_manipulating_strings/table_printer.py | 586 | 3.59375 | 4 |
def printTable(table):
tab_len = len(table)
str_num = len(table[0])
colWidths = [0] * tab_len
for i in range(tab_len):
max_val = 0
for _str in table[i]:
max_val = max(len(_str), max_val)
colWidths[i] = max_val
for i in range(str_num):
for j in range(tab... |
9d2f5dc9a7582b91263f42dc152718cabf710e89 | jedzej/tietopythontraining-basic | /students/swietczak_monika/lesson_01_basics/digital_clock.py | 112 | 3.84375 | 4 | # Read an integer:
a = int(input("number of minutes past midnight: "))
print(str(a // 60) + ' ' + str(a % 60))
|
e8b58db6e05583632e0f97a9cbd3c51d1cf7c13b | jedzej/tietopythontraining-basic | /students/semko_krzysztof/lesson_02_flow_control/lost_card.py | 810 | 4.03125 | 4 | """
There was a set of cards with numbers from 1 to N.
One of the card is now lost.
Determine the number on that lost card given the numbers
for the remaining cards.
Given a number N, followed by N − 1 integers -
representing the numbers on the remaining cards
(distinct integers in the range from 1 to N).
Find and pri... |
2ade781f390db529b105e8764fbb002807048438 | jedzej/tietopythontraining-basic | /students/axel_nowaczyk/lesson_02_flow_control/Adding_factorials.py | 238 | 3.953125 | 4 | def factorials():
sum = 0
last_factorial = 1
max_number = int(input())
for i in range(1, max_number+1):
last_factorial *= i
sum += last_factorial
print(sum)
if __name__ == '__main__':
factorials() |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.