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 |
|---|---|---|---|---|---|---|
e984ff287328ccca280e2f3e01538f8ffc81b25a | Ontefetse-Ditsele/Intro_python | /week_2/madlibs.py | 211 | 3.609375 | 4 | #madlibs.py
#
colour = input("Enter a colour: ")
plural = input("Enter a plural: ")
celeb = input("Enter the name of a celebrity: ")
print("Roses are "+colour)
print(plural+" are blue")
print("I love "+ celeb) |
cc12ace41f10bfc03fd6fda0bfa7d3d95694768c | Ontefetse-Ditsele/Intro_python | /week_3/cupcake.py | 1,744 | 4.125 | 4 | #Ontefetse Ditsele
#
#19 May 2020
print("Welcome to the 30 second expect rule game--------------------")
print("Answer the following questions by selection from among the options")
ans = input("Did anyone see you(yes/no)\n")
if ans == "yes":
ans = input("Was it a boss/lover/parent?(yes/no)\n")
if ans == "no":
... |
d09b3c2711d9df4ea00c917aabfe2c0f191055ee | Ontefetse-Ditsele/Intro_python | /week_3/pi.py | 356 | 4.28125 | 4 | #Ontefetse Ditsele
#
#21 May 2020
from math import sqrt
denominator = sqrt(2)
next_term = 2/denominator
pi = 2 * 2/denominator
while next_term > 1:
denominator = sqrt(2 + denominator)
next_term = 2/denominator
pi *= next_term
print("Approximation of PI is",round(pi,3))
radius = float(input("Enter the radius:... |
a61ad782abbf9a3c0f2b76a561c1c190474264e0 | rohini-nubolab/Python-Learning | /dictionary.py | 551 | 4.28125 | 4 | # Create a new dictionary
d = dict() # or d = {}
# Add a key - value pairs to dictionary
d['xyz'] = 123
d['abc'] = 345
# print the whole dictionary
print d
# print only the keys
print d.keys()
# print only values
print d.values()
# iterate over dictionary
for i in d :
print "%s %d" %(i,... |
f5f90561f1ca6dd20879080b7344dd606fca404e | rohini-nubolab/Python-Learning | /problem1.py | 192 | 3.5625 | 4 | class Vehicle:
def __init__(self, max_speed, mileage):
self.max_speed = max_speed
self.mileage = mileage
modelX = Vehicle(240, 18)
print(modelX.max_speed, modelX.mileage)
|
572d3e737e17e0d37fb1abf90e587c8983eea842 | rohini-nubolab/Python-Learning | /arr1.py | 176 | 3.796875 | 4 | def sum(arr):
sum = 0
for i in arr:
sum = sum + i
return sum
arr = []
arr = [12, 3, 4, 15]
n = len(arr)
a = sum(arr)
print("Sum of array is", a)
|
1e806b9890954b1584afd0b2cba2a62770b169cb | rohini-nubolab/Python-Learning | /fact.py | 122 | 3.8125 | 4 | import math
num = 6;
def factorial(n):
return(math.factorial(n))
print("Factorial of", num, "is", factorial(num))
|
0e5ec67144f9d6c6f85f1ec3822fc8cdf6f1d4ca | rohini-nubolab/Python-Learning | /monotonic.py | 204 | 3.96875 | 4 | # Python3 program to find sum in Nth group Check if given array is Monotonic.
def monotonic(A):
return (all(A[i] >= A[i + 1] for i in range(len(A) - 1)))
A = [6, 5, 4, 4]
print(monotonic(A))
|
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))
|
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))
|
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")
|
d3fee37ec6edae510e777f8ad4d3d39b776044d7 | rohini-nubolab/Python-Learning | /list_mul.py | 183 | 4.21875 | 4 | # Python program to multiply all values in the list
def list_mul(list):
mul = 1
for i in list:
mul = mul * i
return mul
list1 = [2,3,4]
print(list_mul(list1))
|
67f8dcbdd34103869cbbd15040a056d55f0fc647 | 99004396/pythonlabs | /biggest.py | 201 | 3.921875 | 4 | def biggestnum(a,b,c):
max=0;
if a>b and a>c:
max=a;
elif b>a and b>c:
max=b;
else:
max=c;
return max;
a=input()
b=input()
c=input()
print(biggestnum(a,b,c)) |
3946d61a5c4b0fbc5ae9e26104e37b3acac9d4b4 | 99004396/pythonlabs | /fibonacci.py | 240 | 4.125 | 4 | def fibonacci(n):
if(n==0):
print("Incorrect input")
if(n==1):
print("0")
n1=0
n2=1
c=0
while c<n:
print(n1)
f=n1+n2
n1=n2
n2=f
c+=1
n=int(input())
fibonacci(n) |
0fe4b8391df5fdc52a5e9b358ae10cbce551ce07 | seosuwan/django | /admin/sorting/models_oop.py | 3,037 | 3.796875 | 4 | from dataclasses import dataclass
@dataclass
class Calculator(object):
num1: int
num2: int
@property
def num1(self) -> int: return self._num1
@property
def num2(self) -> int: return self._num2
@num1.setter
def num1(self, num1 :int): self._num1 = num1
@num2.setter
def num2(se... |
32b83974ca58e6ec0092fc17b008581e8beefade | andyandreolli/pysius | /pysius.py | 13,955 | 3.53125 | 4 |
# coding: utf-8
# # Pysius - a Python solver for Blasius equation
# In[1]:
import numpy as np
import math
import matplotlib.pyplot as plt
# Let $f(\eta)$ be the non-dimensional stream function, with $\eta$ being the similarity variable. Blasius equation reads:
#
# $$f''' + \frac{1}{2}ff'' = 0$$
#
# This is a t... |
10d78fe8e8496fe0f8c32fa111f22b4b7f883533 | Aafaaq77/miscellaneous | /bank_copy.py | 7,425 | 4.0625 | 4 | from abc import ABC, abstractmethod
class Konto(ABC):
'''
A class to represent a bank account with some
basic functionalities
'''
# bankname for all accounts
bankname = 'SPK'
def __init__(self, inhaber: str, kontonr: int, kontostand: float = 0.0):
'''
intial... |
6d98a80e475c735695a4f0d9d34171932623a1a1 | hurtlethefrog/python | /big_f.py | 123 | 3.875 | 4 | shape = [5, 2, 5, 2, 2]
for num in shape:
print("X" * num)
for i in range(len(shape)):
print("X" * shape[i])
|
f564904279d40a0c24fa619db4b2728b57a5c057 | jedzej/tietopythontraining-basic | /students/barecki_andrzej/lesson_09_reading_and_writing_files/mad_libs.py | 462 | 3.828125 | 4 | word_keys = ["ADJECTIVE", "NOUN", "ADVERB", "VERB"]
input_user_file = open('user_input_text_file.txt', 'r')
user_content = input_user_file.read()
input_user_file.close()
for elem in word_keys:
while elem in user_content:
print("Enter an {0}:".format(elem.lower()))
user_content = user_content.repla... |
aa88f393ae9b2be8593078216e22b0795589dbfa | jedzej/tietopythontraining-basic | /students/jakielczyk_miroslaw/lesson_10_organizing_files/selective_copy.py | 688 | 3.5625 | 4 | import os
import shutil
root_folder = 'folder_1'
destination_folder = 'target_folder'
def create_empty_folder(folder):
if os.path.exists(folder):
print('Removing', folder)
shutil.rmtree(folder)
print('Creating ', folder)
os.makedirs(folder)
create_empty_folder(destination_folder)
print(... |
0a776890999d60d8105e81f92e4c7bd0ba4be3ee | jedzej/tietopythontraining-basic | /students/barecki_andrzej/lesson_14_decorators/sort.py | 339 | 3.515625 | 4 | def sort(func):
def func_wrapper():
return sorted(func())
return func_wrapper
@sort
def data_feeder():
return [4, 2, 1, 3]
def main():
if data_feeder() == [1, 2, 3, 4]:
print("Decorator @sort works fine")
else:
print("Decorator @sort does not work!")
if __name__ == '__m... |
45e053c4b5e333cee570d85ac70f62bb1d8466e4 | jedzej/tietopythontraining-basic | /students/jemielity_kamil/lesson_06_dicts_tuples_sets_args_kwargs/args_inspector.py | 637 | 3.5625 | 4 | def inspect_args(*args, **kwargs):
print("***** List of arguments: ******")
for counter, arg in enumerate(args, start=1):
print("Argument " + str(counter) + ": " + str(arg))
print()
print("***** List of kwargs: ******")
for counter, (kwarg_key, kwarg_value) in enumerate(kwargs.items(),
... |
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))
|
71fe0e5d8a38e1e033923f348925f53fb41cbea9 | jedzej/tietopythontraining-basic | /students/swietczak_monika/lesson_02_flow_control/bishop_moves.py | 208 | 3.890625 | 4 | # Read an integer:
x1 = int(input("Enter x1 "))
y1 = int(input("Enter y1 "))
x2 = int(input("Enter x2 "))
y2 = int(input("Enter y2 "))
if abs(x1 - x2) == abs(y1 - y2):
print("YES")
else:
print("NO")
|
a0caa39c127009790574486e7a1f8630f769f74b | jedzej/tietopythontraining-basic | /students/jakielczyk_miroslaw/lesson_08_regular_expressions/strong_password_detection.py | 458 | 3.609375 | 4 | import re
def validate_strong_password(password):
strong_password = re.compile(r'^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)([\w!@#$%^&*(),.?]{8,})$')
if strong_password.search(password) is not None:
return True
else:
return False
def main():
password = "34adbrcdfgh1234567834hTg12)(.,"
if va... |
9b34b31c649ab1c09cd705bae38de7b527188289 | jedzej/tietopythontraining-basic | /students/wachulec_maria/lesson_06_dicts_tuples_sets_args_kwargs/frequency_analysis.py | 509 | 3.921875 | 4 | def frequency_analysis():
words_frequency = {}
for i in range(int(input())):
words = input().split()
for j in words:
words_frequency.setdefault(j, 0)
words_frequency[j] += 1
frequency_list = sorted(sorted(list(words_frequency.items()),
key=... |
d811b764e0e6ceb1b36ff9d506846813afea8c89 | jedzej/tietopythontraining-basic | /students/jemielity_kamil/lesson_05_lists/greater_than_neighbours.py | 207 | 3.90625 | 4 | numbers = input('Numbers: ').split()
counter = 0
for loop in range(1, len(numbers) - 1):
if numbers[loop] > numbers[loop - 1] and numbers[loop] > numbers[loop + 1]:
counter += 1
print(counter)
|
2f67301aea771e170130d234fd8b16c811f1741c | jedzej/tietopythontraining-basic | /students/swietczak_monika/lesson_05_lists/comma_code.py | 417 | 3.953125 | 4 | spam = ['apples', 'bananas', 'tofu', 'cats']
def comma_code(some_list):
"""
Converts a list to string containing items separated by commas
:param some_list: list
:return: string containing converted list
"""
converted = ""
for i in range(len(some_list) - 1):
converted += some_list[... |
ecbcf8889252eb36d47c2b968d821f38f1d2fceb | jedzej/tietopythontraining-basic | /students/arkadiusz_kasprzyk/lesson_07_strings/date_calculator.py | 727 | 4.28125 | 4 | #! python
# date_calculator.py
import datetime as dt
def time_from_now(years=0, days=0, hours=0, minutes=0):
"""
Examples
--------
time_from_now()
time_from_now(2, 33, 12, 3)
"""
date0 = dt.datetime.now()
date1 = date0.replace(date0.year + years) + \
dt.timedelta(days=days, ho... |
60b741f496e00eb2f25b4e29f7cf544374f2fb12 | jedzej/tietopythontraining-basic | /students/bec_lukasz/lesson_01_basics/school_desks.py | 267 | 3.828125 | 4 | # Read an integer:
# a = int(input())
# Print a value:
# print(a)
studentsA=int(input())
studentsB=int(input())
studentsC=int(input())
desksA = studentsA//2+studentsA%2
desksB = studentsB//2+studentsB%2
desksC = studentsC//2+studentsC%2
print(desksA+desksB+desksC) |
74cc70bd2510db56445697ac23b22d835afaa999 | jedzej/tietopythontraining-basic | /students/jakielczyk_miroslaw/lesson_13_objects_and_classes/selective_shallow_compare.py | 691 | 3.90625 | 4 | class Person:
def __init__(self, name, surname, age, weight):
self.name = name
self.surname = surname
self.age = age
self.weight = weight
def compare_objects(object1, object2, attributes):
for attribute in attributes:
if getattr(object1, attribute) == getattr(object2, ... |
4b4c122ba7877ffb77a908c888f9f103933b5b23 | jedzej/tietopythontraining-basic | /students/kulon_aleksander/lesson_06/frequency_analysis.py | 711 | 3.8125 | 4 | def func():
n = int(input())
temp_dict = {}
tuples_list = []
for i in range(n):
line = str(input()).split()
for word in line:
if word not in temp_dict:
temp_dict.update({word: 1})
else:
temp_dict[word] += 1
for k, v in temp_di... |
ab84c379453fe643205a08c4cc9fcac033e5a18b | jedzej/tietopythontraining-basic | /students/piotrowski_stanislaw/lesson_05_lists/swap_min_and_max.py | 337 | 3.65625 | 4 | # piotrsta
# Swap min and max
# https://snakify.org/lessons/lists/problems/swap_min_and_max/
spam = [3, 4, 5, 2, 1]
min_value = min(spam)
max_value = max(spam)
min_index = spam.index(min_value)
max_index = spam.index(max_value)
spam[min_index], spam[max_index] = spam[max_index], spam[min_index]
for i in spam:
p... |
965e9c6a25036526777a6f820081537e85456a19 | jedzej/tietopythontraining-basic | /students/slawinski_amadeusz/lesson_08_regular_expressions/postal_code_validator.py | 715 | 3.53125 | 4 | #!/usr/bin/env python3
import re
import unittest
def validate_postal_code(code):
regex = re.compile(r'^(PL )?[0-9]{2}-[0-9]{3}$')
match = regex.search(code)
if match is None:
return False
return True
class ValidatePostalCodeTest(unittest.TestCase):
def testValidPostalCode(self):
... |
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))
|
43d266e6198e60051cf819b367239793205f2ab7 | jedzej/tietopythontraining-basic | /students/kaczmarek_katarzyna/lesson_01_basics/areaOfRightAngledRriangle.py | 92 | 3.859375 | 4 | base = float(input("Base: "))
height = float(input("Height: "))
print(0.5 * base * height)
|
1ed6b5bc24bdec8c0f8577ec5126e0268b838bdd | jedzej/tietopythontraining-basic | /students/arkadiusz_kasprzyk/lesson_05_lists/chess_board.py | 1,174 | 4 | 4 | def rep(x, length=None, times=None):
"""
Replicate sequence (list or tuple) to the given length or times many.
Parameters
----------
x: list or tuple
length: int >= 0
times: int
Returns
-------
x replicated to the given length or times many.
"""
if length is None:
... |
0925afe8bf8a5847bad256af25af292a834a73b2 | jedzej/tietopythontraining-basic | /students/slawinski_amadeusz/lesson_05_lists/07_greater_than_neighbours.py | 271 | 3.71875 | 4 | #!/usr/bin/env python3
count = 0
numbers = input().split()
for i in range(len(numbers)):
numbers[i] = int(numbers[i])
for i in range(1, len(numbers) - 1):
if numbers[i - 1] < numbers[i] and numbers[i] > numbers[i + 1]:
count = count + 1
print(count)
|
7c273f3ee590352cfd264fae150e75a6b0b5dc8d | jedzej/tietopythontraining-basic | /students/adam_wulw/lesson_01_python_basics/sum_of_digits.py | 145 | 4.0625 | 4 | num = int(input('Enter the number\n'))
sum = (num % 10) + ((num % 100) // 10) + ((num % 1000) // 100)
print('The sum of digits is ' + str(sum))
|
fa05affb7a0b2d37d90a647a462873ad8ac6d7ed | jedzej/tietopythontraining-basic | /students/zelichowski_michal/lesson_02_flow_control/queen_move.py | 724 | 3.78125 | 4 | """Chess queen moves horizontally, vertically or diagonally to any number
of cells. Given two different cells of the chessboard, determine whether
a queen can go from the first cell to the second in one move.
The program receives the input of four numbers from 1 to 8, each
specifying the column and row number, first t... |
13d6a16b9cec55e1c9cc960f7633f7a4b92eb391 | jedzej/tietopythontraining-basic | /students/jemielity_kamil/lesson_01_basics/total_cost.py | 328 | 3.96875 | 4 |
price_dollars = int(input('How many dollars: '))
price_cents = int(input('How many cents: '))
number_of_cupcakes = int(input('Number of cupcakes: '))
wallet_in_cents = (price_dollars * 100 + price_cents) * number_of_cupcakes
dollars = wallet_in_cents // 100
cents = wallet_in_cents - (dollars * 100)
print(dollars, c... |
db3bcd828b59a82972311ce732fa39a6d555ea00 | jedzej/tietopythontraining-basic | /students/chylak_malgorzata/lesson_04_unit_testing/unittest_03_fibonnaci.py | 621 | 3.75 | 4 | import unittest
def fib(n):
n = abs(n)
if n == 0:
return 0
elif n == 1:
return 1
else:
return fib(n - 1) + fib(n - 2)
class MyTest(unittest.TestCase):
def test_type_error(self):
self.assertRaises(TypeError, fib, None)
def test_value_error(self):
self.a... |
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... |
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... |
b55471d8b2f16081cab5237a2712f6631af8cc90 | jedzej/tietopythontraining-basic | /students/ryba_paula/lesson_13_objects_and_classes/object_insp.py | 715 | 3.671875 | 4 | class Bunny:
def __init__(self, name, age, colour):
self.name = name
self.age = age
self.colour = colour
def __dir__(self):
return ['name', 'age', 'colour']
def object_inspector1(obj):
attributes = dir(obj)
return dict((key, getattr(obj, key)) for key in attributes)
... |
be304881ca3feb9e4d2a8970437d980d64d0dcb7 | jedzej/tietopythontraining-basic | /students/bedkowska_julita/lesson_07_strings_datetime/to_swap_the_two_words.py | 167 | 3.84375 | 4 | text = input('Input the text: ')
space_index = text.find(' ')
swaped_text = text[space_index + 1:] + ' ' + text[:space_index]
print('The swaped text: ' + swaped_text)
|
6db07ca3e9c589e28bf27ec65ecd9267ece55312 | jedzej/tietopythontraining-basic | /students/grzegorz_bajorski/lesson_01_python_basic/apple_sharing.py | 251 | 3.921875 | 4 | print('Enter number of students')
student = int(input())
print('Enter number of apples')
apple = int(input())
print( str(apple // student) + ' Each single student will get apples')
print( str(apple % student ) + ' Apples will remain in the basket')
|
d1e8cc4aa69d4a743ee375987b6620b4600fddd6 | jedzej/tietopythontraining-basic | /students/kosarzewski_maciej/lesson_02_flow_control/ladder.py | 100 | 3.59375 | 4 | a = int(input())
tmp = 0
multi = 1
for i in range(1, a+1):
tmp = (tmp * 10) + i
print (tmp)
|
e8171e7349f28532c66021986f9ed25a40cea052 | jedzej/tietopythontraining-basic | /students/stachowska_agata/lesson_02_flow_control/lost_card.py | 175 | 3.734375 | 4 | N = int(input())
sum_of_cards = 0
for i in range(1, N + 1):
sum_of_cards += i
for i in range(1, N):
card = int(input())
sum_of_cards -= card
print(sum_of_cards)
|
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... |
6d199df98e011cc79f289a0332149ca7a8da4178 | jedzej/tietopythontraining-basic | /students/piatkowska_anna/lesson_04_unit_testing/01/unit_tests_collatz.py | 981 | 3.890625 | 4 | '''
Using unittest.TestCase write 4 unit tests for collatz() function
(not the whole script, just the function). Base on 26.4.1.
Basic example. Don't focus too much on class keyword in test definition.
Treat this as a code that must be there for tests to be ran.
Implement following tests:
Test that the function raises... |
6207e6d6d2dab838bbeaf60a37d815fee1d29cee | jedzej/tietopythontraining-basic | /students/jakielczyk_miroslaw/lesson_08_regular_expressions/email_validator.py | 506 | 4.21875 | 4 | import re
email_address = input("Enter email address: ")
email_regex = re.compile(r'''(
[a-zA-Z0-9._%+-]+ # username
@ # @ symbol
[a-zA-Z0-9.-]+ # domain name
(\.[a-zA-Z]{2,3}) # dot-something
)''', ... |
ee0672c172b74fd32914bb1acfd7432c29fad46d | jedzej/tietopythontraining-basic | /students/bedkowska_julita/lesson_08_regex/strong_password.py | 688 | 3.890625 | 4 | import re
def check_password(password):
if not re.compile(r'.{8}').search(password):
print('Password is less than 8 characters')
return False
if not re.compile(r'[A-Z]').search(password):
print('No upper case letters')
return False
if not re.compile(r'[a-z]').search(passwor... |
73133308f62fa75a886331cf39e209386eaa3c80 | jedzej/tietopythontraining-basic | /students/slawinski_amadeusz/lesson_01_basics/1.06_school_desks.py | 215 | 4 | 4 | # gets 3 numbers,
# divides them by 2 and adds rest of division to them
# and then sums them all up
a = int(input())
b = int(input())
c = int(input())
print ((a // 2 + a % 2) + (b // 2 + b % 2) + (c // 2 + c % 2))
|
fc8f20bd57bc3e2774e7f558059f2ea2473e9141 | jedzej/tietopythontraining-basic | /students/pietrewicz_bartosz/lesson_01_basics/1_1.py | 153 | 3.90625 | 4 | # Read 3 integer numbers from the user (each on the separate line)
a = int(input())
b = int(input())
c = int(input())
# Print their sum
print(a + b + c)
|
493e3912f779633496c54dc10c394d63e3cb5a83 | jedzej/tietopythontraining-basic | /students/halas_maciek/the_number_of_words.py | 165 | 3.734375 | 4 | def get_number_of_words(user_word):
return user_word.count(' ') + 1
def main():
print(get_number_of_words(input()))
if __name__ == '__main__':
main() |
dd374682b2db9d1d1c04897331c5a0f67972c1b3 | jedzej/tietopythontraining-basic | /students/piechowski_michal/lesson_13_objects_and_classes/circle_class.py | 3,926 | 4.34375 | 4 | #!/usr/bin/env python3
from students.piechowski_michal.lesson_03_functions.the_length_of_the_segment import distance
class Point:
x = 0
y = 0
def __init__(self, x, y):
self.x = x
self.y = y
def __str__(self):
return "<" + str(self.x) + "," + str(self.y) + ">"
class Rectan... |
e7f9267af64d4c832cc00c70baf5294674f2fab7 | jedzej/tietopythontraining-basic | /students/grzegorz_bajorski/lesson_06/the_number_of_distinct.py | 233 | 3.78125 | 4 | n = int(input())
dictionary = {}
for _ in range(n):
for word in input().split():
dictionary[word] = dictionary.get(word, 0) + 1
words_in_order = [(nr, key) for key, nr in dictionary.items()]
print(len(words_in_order))
|
120291b30c9afae4c9479114ef09eb80c9778ddb | jedzej/tietopythontraining-basic | /students/ryba_paula/lesson_01_basics/sum_of_digits.py | 126 | 4 | 4 | number = int(input())
digit1 = number // 100
digit2 = number // 10 % 10
digit3 = number % 10
print(digit1 + digit2 + digit3) |
0bf3eb1764984326742f6525bb97351e3b7d0986 | jedzej/tietopythontraining-basic | /students/bedkowska_julita/lesson_01_basics/first_digit_after_decimal_point.py | 78 | 3.59375 | 4 | num = float(input("Input the number: "))
print(list(str(num - int(num)))[2])
|
e64e2a28fbde9653fe784c787b1b267a8f1423cd | jedzej/tietopythontraining-basic | /students/skowronski_rafal/lesson_02_flow_control/lesson_03/problem_10.py | 474 | 3.640625 | 4 | # Solves problem 10 - knight moves
import chess_game
def _main():
x1 = int(input('Enter knight\'s current X position: '))
y1 = int(input('Enter knight\'s current Y position: '))
x2 = int(input('Enter knight\'s target X position: '))
y2 = int(input('Enter knight\'s target Y position: '))
is_valid... |
25257caa9f637f6c2f86283602b04f68fae91eb0 | jedzej/tietopythontraining-basic | /students/synowiec_krzysztof/lesson_02_flow_control/the_number_of_elements_equal_to_the_maximum.py | 309 | 3.75 | 4 | def main():
max = 0
countOfMaxNumber = 0
n = int(input())
while n != 0:
if n > max:
max = n
countOfMaxNumber = 1
elif n == max:
countOfMaxNumber += 1
n = int(input())
print(countOfMaxNumber)
if __name__ == '__main__':
main() |
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... |
36ae0dbb7525fe80ace6e37c68fe4172c16545ef | jedzej/tietopythontraining-basic | /students/saleta_sebastian/lesson_01_basics/total_cost.py | 404 | 4.03125 | 4 | def get_total_costs():
dollars = int(input())
cents = int(input())
num_of_cupcakes = int(input())
cost = num_of_cupcakes * (100 * dollars + cents)
cost_in_dollars = (cost // 100)
cost_in_cents = (cost % 100)
print('Total cost in dollar is {} and total cost in cents is {}'.
format(... |
e378df9b54fea15bafa5ae8363e0e60c9604ff4e | jedzej/tietopythontraining-basic | /students/biegon_piotr/lesson_03_functions/exponentiation.py | 267 | 4.46875 | 4 | print("Exponentiation\n")
def power(a, n):
if n == 0:
return 1
if n >= 1:
return a * power(a, n-1)
a = float(input("Enter a power base: "))
n = int(input("Enter an exponent exponent: "))
print("\nThe result is: {:f}".format(power(a, n)))
|
39a7cc2b10f9b4f20f2be704586b55770683f99a | jedzej/tietopythontraining-basic | /students/swietczak_monika/lesson_01_basics/clock_face.py | 169 | 4.0625 | 4 | # Read an integer:
h = int(input("enter hours: "))
m = int(input("enter minutes: "))
s = int(input("enter seconds: "))
angle = 0.5 * (60 * h + m + s / 60)
print(angle)
|
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... |
5a78a3f729cc115bfbc89a7066e20be7b54ef901 | jedzej/tietopythontraining-basic | /students/burko_szymon/lesson_01_basics/car_route.py | 146 | 3.71875 | 4 | import math
a = int(input("Car maximum distance: "))
b = int(input("Distance to travel: "))
d = (b / a)
print("Days to go " + str(math.ceil(d)))
|
7b7b33a107ceb0c4054d84049f2998341e1c8380 | jedzej/tietopythontraining-basic | /students/mariusz_michalczyk/lesson_02_flow_control/Knight_move.py | 236 | 3.6875 | 4 | X1 = int(input())
Y1 = int(input())
X2 = int(input())
Y2 = int(input())
cond1 = (abs(X1 - X2)) == 2 and (abs(Y1 - Y2) == 1)
cond2 = (abs(Y1 - Y2)) == 2 and (abs(X1 - X2) == 1)
if cond1 or cond2:
print("YES")
else:
print("NO")
|
046d5553fa467de6c013ff2405a93f7b938a2d7a | jedzej/tietopythontraining-basic | /students/pietrewicz_bartosz/lesson_02_flow_control/Knight_move.py | 326 | 3.65625 | 4 | # Read start (x1,y1) and end (x2,y2) coordinates
x1 = int(input())
y1 = int(input())
x2 = int(input())
y2 = int(input())
# Calculate if knight can go from (x1,y1) to (x2,y2) in one move
if ((abs(x2-x1) == 1) and (abs(y2-y1) == 2)) or\
((abs(x2-x1) == 2) and (abs(y2-y1) == 1)):
print("YES")
else:
print(... |
ba497a7d4e143367a2585d9e138bb4fe4e2f8b54 | jedzej/tietopythontraining-basic | /students/serek_wojciech/lesson_13_objects/insp_2.py | 704 | 3.515625 | 4 | #!/usr/bin/env python3
"""Inspector 2 exercise"""
def obj_insp_2(obj):
"""Object inspector"""
result = {}
obj_attr = dir(obj)
for attr in obj_attr:
val = getattr(obj, attr)
if isinstance(val, (str, int, float)):
result[attr] = val
return result
class TestObject:
"... |
a956e9d7bc2b3bca6edf95dd9f79653867590024 | jedzej/tietopythontraining-basic | /students/baker_glenn/snakify_lesson_3/knight_moves.py | 565 | 4.0625 | 4 | # This program takes a knights current position on the chessboard, and determines
#if it is legal to move to another given position on the chessboard
print("enter current position A")
currentA = int(input())
print("enter current position B")
currentB = int(input())
print("enter next position A")
nextA = int(input())
pr... |
51d589c95b84acfa18d06f202e2da3f7631fd408 | jedzej/tietopythontraining-basic | /students/wachulec_maria/lesson_01_basics/first_digit_after_decimal_point.py | 180 | 3.875 | 4 | from math import floor
number = float(input("Real number: "))
result = number - floor(number)
print("First digit to the right of the decimal point is"
": " + str(result)[2]) |
96989ad57c10d19feaf9fc6c2c4bab7c01da93be | jedzej/tietopythontraining-basic | /students/mitek_michal/lesson_01_basics/car_route.py | 219 | 4.125 | 4 | import math
def calculate_number_of_days():
n = int(input("Provide a distance that can move a day "))
m = int(input("Provide a length in kilometers "))
print(math.ceil(m/n))
calculate_number_of_days()
|
0fe372440cbf12978e88352493f8da3083aa23dc | jedzej/tietopythontraining-basic | /students/Hebdowska_Grazyna/lesson_01_basic/firstDigitAfterDecimalPoint.py | 67 | 3.5 | 4 | num = float(input())
n = int(num)
f = int((num % n) * 10)
print(f)
|
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... |
e1cd655bcb5ed7496d28386f77ddeffd7913e4af | jedzej/tietopythontraining-basic | /students/serek_wojciech/lesson_01_basics/shool_desks.py | 401 | 3.859375 | 4 | #!/usr/bin/env python3
"""School desks"""
def main():
"""Main function"""
group_a = int(input())
group_b = int(input())
group_c = int(input())
desks_for_a = (group_a // 2) + (group_a % 2)
desks_for_b = (group_b // 2) + (group_b % 2)
desks_for_c = (group_c // 2) + (group_c % 2)
print(... |
c8ddd6ab4d373d86000884adbf0b42f1d27e2c1f | jedzej/tietopythontraining-basic | /students/piotrowski_stanislaw/lesson_01_basics/L1_IFN_08.py | 383 | 3.6875 | 4 | #https://snakify.org/lessons/integer_float_numbers/problems/total_cost/
#piotrsta
a = int(input('Cena babeczki - "czesc dolarowa": '))
b = int(input('Cena babeczki - "czesc centowa": '))
n = int(input('Ile babeczek?: '))
total_cents = n * (a * 100 + b)
dollars = total_cents // 100
cents = total_cents % 100
print('Cal... |
329f29d43b0f47a5cb6db356bce578493406d4b3 | jedzej/tietopythontraining-basic | /students/skowronski_rafal/lesson_06_dicts_tuples_sets_args_kwargs/project_04_snakify_lesson_10/cubes.py | 588 | 4.125 | 4 | def print_set(set):
print(len(set))
for element in sorted(set):
print(element)
if __name__ == '__main__':
alice_count, bob_count = \
tuple([int(i) for i in input('Enter two integers separated by space: ')
.split()])
print('Enter Alice\'s set:')
alice_set = set([int(in... |
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... |
9900dd8e96527c367edf93a8b9a584d16b84e7eb | jedzej/tietopythontraining-basic | /students/kaczmarek_katarzyna/lesson_08_regular_expressions/postal_code_validator.py | 647 | 3.75 | 4 | import re
def validate_postal_code_pl(postal_code):
regex = re.compile(r'^\d{2}-\d{3}$')
return regex.match(postal_code) is not None
def main():
postal_codes = ['55-011',
'98-270',
'12345',
'1-234',
'12-3',
... |
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.
'''
... |
e247e17a81903a6f3e56c81c3866f9d2910991fc | jedzej/tietopythontraining-basic | /students/bec_lukasz/lesson_05_lists/chessBoard.py | 389 | 3.625 | 4 | a = input('Enter array dimensions: ').split()
for i in range(int(a[0])):
for j in range(int(a[1])):
if i % 2 == 0:
if j % 2 == 0:
print('. ', end='')
else:
print('* ', end='')
else:
if j % 2 == 0:
print('* ', end='... |
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... |
1deeca7be31cca4174a0c8603eafc3aff81536c0 | jedzej/tietopythontraining-basic | /students/pietrewicz_bartosz/lesson_05_lists/swap_min_and_max.py | 550 | 3.703125 | 4 |
def swap_min_and_max(lst):
if len(lst) < 2:
return lst
max_value = lst[0]
min_value = lst[0]
min_idx = 0
max_idx = 0
for i in range(len(lst)):
if max_value < lst[i]:
max_idx = i
max_value = lst[i]
elif min_value > lst[i]:
min_idx = i
... |
1192334a96b7639e3964affa956a4cefd0110f21 | jedzej/tietopythontraining-basic | /students/semko_krzysztof/lesson_05_lists/the_bowling_alley.py | 1,077 | 3.734375 | 4 | """
In bowling, the player starts wtih 10 pins at the
far end of a lane. The object is to knock all the pins down.
For this exercise, the number of pins and balls will vary.
Given the number of pins N and then the number of balls K
to be rolled, followed by K pairs of numbers
(one for each ball rolled), determine which... |
99aec6f8672a157d9281911400a644c3fd8b9b61 | jedzej/tietopythontraining-basic | /students/barecki_andrzej/lesson_05_lists/greater_than_neighbours.py | 248 | 3.6875 | 4 | input_list = input().split(' ')
greater_counter = 0
for row in range(1, len(input_list) - 1):
if input_list[row - 1] < input_list[row] and\
input_list[row] > input_list[row + 1]:
greater_counter += 1
print(greater_counter)
|
5abeaf1070bb29471a55b93d27e3227d707eb917 | jedzej/tietopythontraining-basic | /students/mitek_michal/lesson_01_basics/previous_and_next.py | 397 | 4.09375 | 4 |
def print_previous_and_next_integer():
input_number = int(input("Provide a number "))
previous_number = input_number - 1
next_number = input_number + 1
print("The next number for the number " + str(input_number) + " is " + str(next_number))
print("The previous number for the number " + str(input_... |
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... |
73fbf39faac2fe88dbe66cbaf28544a350008bdb | jedzej/tietopythontraining-basic | /students/Hebdowska_Grazyna/lesson_05_lists/swap_the_columns.py | 676 | 3.765625 | 4 | def data_input():
data_in = input().split(" ")
result = []
for i in data_in:
result.append(int(i))
return result
def insert_matrix(m):
matrix = []
for i in range(m):
matrix.append(data_input())
return matrix
def swap_columns(a, i, j):
for n in a:
n_new = n[i]
... |
b740257f7ba8ebbfd9573c91ec55719e00361c86 | jedzej/tietopythontraining-basic | /students/kondel_tomasz/lesson_01_basics/Area_of_right_angled_triangle.py | 65 | 3.546875 | 4 | a = int(input())
h = int(input())
area = (a * h) / 2
print(area)
|
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... |
ae61874faf80c8b0279d2802ae7ebff05f320967 | jedzej/tietopythontraining-basic | /students/myszko_pawel/lesson_02_flow_control/10_Knight move.py | 896 | 3.796875 | 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... |
486ddd533bccc67f81eaa1bc3e3beebed7121d34 | jedzej/tietopythontraining-basic | /students/ryba_paula/lesson_03_functions/negative_exponent.py | 530 | 4.03125 | 4 | def power(base, index):
return base ** index
def input_validation():
while True:
base = float(input("Please give the base number: "))
if base <= 0:
print("The base number must be positive")
continue
index = int(input("Please give a power index: "))
print... |
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, ... |
38b805025f435b88648b78b24a6a243d771d5400 | jedzej/tietopythontraining-basic | /students/jemielity_kamil/lesson_06_dicts_tuples_sets_args_kwargs/guess_the_number.py | 437 | 3.859375 | 4 | n = int(input('Number: '))
possible_set = set(range(1, n + 1))
while True:
numbers = input('Set of numbers: ')
if numbers == 'HELP':
break
numbers = set(int(a) for a in numbers.split())
bob_answer = input('Bob answer: ')
if bob_answer == 'YES':
possible_set.intersection_update(numbe... |
a1d3b1c56eb1bb03a36d15088ff8e8459c195007 | jedzej/tietopythontraining-basic | /students/piechowski_michal/lesson_09_reading_and_writing_files/mad_libs.py | 576 | 3.921875 | 4 | #!/usr/bin/env python3
def main():
key_words = ["ADJECTIVE", "NOUN", "ADVERB", "VERB"]
original_file = open("mad_libs_text.txt", "r")
output_file = open("mad_libs_output.txt", "w")
for line in original_file:
for word in line.split(" "):
if word in key_words:
print... |
05ec3d8983f7ac192f48af42d5eb0978d3a74a83 | jedzej/tietopythontraining-basic | /students/skowronski_rafal/lesson_06_dicts_tuples_sets_args_kwargs/project_05_snakify_lesson_11/countries_and_cities.py | 549 | 3.90625 | 4 | if __name__ == '__main__':
countries_and_cities = [input().split() for i in
range(int(input('Enter number of countries: ')))]
cities_and_countries_dict = dict()
for item in countries_and_cities:
for city in item[1:]:
cities_and_countries_dict[city] = item[0]
... |
d7bbbdbf680915a31489375ce9adfd3e71d7ec34 | jedzej/tietopythontraining-basic | /students/pietrewicz_bartosz/lesson_01_basics/2_8.py | 224 | 3.8125 | 4 | # Read the number of dollars (A) and cents (B) the cupcake costs
# and the number of cupcakes (N)
A = int(input())
B = int(input())
N = int(input())
# Print the summarized cost of N cupcakes
print(N*A + N*B//100, N*B % 100)
|
df01e187150f3564ebd47739aab5cb1d29ce9b6a | jedzej/tietopythontraining-basic | /students/swietczak_monika/lesson_01_basics/area_of_right_angled_triangle.py | 182 | 4.0625 | 4 | # Read the numbers b and h like this:
b = int(input("length of a base of a triangle: "))
h = int(input("height of a triangle: "))
# Print the result with print()
print(0.5 * b * h)
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.