blob_id stringlengths 40 40 | repo_name stringlengths 5 127 | path stringlengths 2 523 | length_bytes int64 22 545k | score float64 3.5 5.34 | int_score int64 4 5 | text stringlengths 22 545k |
|---|---|---|---|---|---|---|
40eb3e82069f9e582af0a4e9879492e8997783b7 | jao11/curso-em-video | /mundo01/aula007/des014.py | 286 | 4 | 4 | # Crie um programa que leia a temperatura em celsius e a converta para fahrenheit.
print('Nós gostariamos que você nos informasse a sua temperatura em ºC.')
C = float(input('Por favor, digite aqui:'))
F = ((C*9)/5)+32
print('Sua temperatura em fahrenheit é {:.2f}ºF'.format(F)) |
069c187535c0e920adb873161118b2254f20b5fc | jao11/curso-em-video | /mundo01/aula007/des010.py | 408 | 4.03125 | 4 | # Crie um programa que leia quanto dinheiro uma pessoa tem na carteira e mostre quantos
# dolares ela pode comprar.
# considere: US$1,00=R$3,27
print('Por favor nos diga quanto você tem na carteira para que nós possamos converter o\n'
' seu dinheiro de reais para dolares:')
n = float(input('Digite aqui: R$')... |
1bdd5f43e2f869c0c42681b8ade249c89e9258a0 | jao11/curso-em-video | /mundo01/aula006/Aula006.py | 1,280 | 4.1875 | 4 | # AULA 006
# n1=input('digite um número')
# n2=input('digite mais um número')
# s=n1+n2
# print('A soma vale',s)
# Infelizmente o algoritmo não vai funcionar se for escrito dessa forma.
# Para dar certo temos que escrever assim...
n1 = int(input('digite um número'))
n2 = int(input('digite mais um número'))
s =... |
532e37d746386d1593b7ab4d7b48002a9d1e089d | jao11/curso-em-video | /mundo01/aula010/des029.py | 466 | 3.84375 | 4 | '''
Escreva um programa que leia a velocidade de um carro.
Se ele ultrapassar 80 km/h, mostre uma mensagem dizendo que ele foi multado.
A multa vai custar R$ 7,00 por cada km/h acima do limite.
'''
v = float(input('Qual foi a sua velocidade ao passar pelo radar?'
'\n Diga aqui:'))
if v > 80:
... |
1a330e9d4373c2148f913bdad1c68771acdba94c | MiroVatov/Python-SoftUni | /Python Advanced 2021/FUNCTIONS-ADVANCED/Exercise 04.py | 354 | 3.609375 | 4 | nums = list(map(int, input().split()))
sum_positives = sum([n for n in nums if n >= 0])
sum_negatives = sum([n for n in nums if n < 0])
print(sum_negatives)
print(sum_positives)
if abs(sum_negatives) > sum_positives:
print(f'The negatives are stronger than the positives')
else:
print(f'The positives... |
837928b85c16db410eb1845808b2020aab1984ab | MiroVatov/Python-SoftUni | /PYTHON OOP/ATTRIBUTES_AND_METHODS/LABS/project/hotel.py | 1,456 | 3.546875 | 4 | class Hotel:
def __init__(self, name: str):
self.name = name
self.rooms = []
self.guests = 0
@classmethod
def from_stars(cls, stars_count):
return cls(f"{stars_count} stars Hotel")
def add_room(self, room):
if room not in self.rooms:
se... |
a58773eee86ac07ce9fb46e55d89207c286daea5 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/12 - DICTIONARIES/Exercise - 12 - 01.py | 234 | 3.703125 | 4 | chars = input()
my_dict = {}
for i in chars:
if i not in my_dict:
my_dict[i] = 0
my_dict[i] += 1
for key, value in my_dict.items():
if key != ' ' and key != ' ':
print(f"{key} -> {value}")
|
8a7b0b6c8b0ff1d63cc61c4f530ada62f00e4e01 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/MID - Exams/02. The Lift.py | 1,184 | 3.640625 | 4 | people_waiting = int(input())
current_state = [int(p) for p in input().split(" ")]
MAXIMUM_STATE = 4
max_size = len(current_state) * 4
sum_current_people = 0
for people in range(len(current_state)):
current_people = 0
if current_state[people] < MAXIMUM_STATE:
available_places = MAXIMUM_STATE... |
761e85c3e8d516ac23beafcc20c6faa0f7330ee5 | MiroVatov/Python-SoftUni | /Python Basic 2020/More exersices 04 - back to the past.py | 605 | 3.640625 | 4 | inherited_money = float(input())
year_to_live = int(input())
#expense_per_year = 0
total_expenses = 0
age = 18
left_money = 0
for i in range(1800, year_to_live + 1):
if i % 2 == 0:
expense_per_year = 12000
else:
expense_per_year = 12000 + (age * 50)
age += 1
total_expense... |
b46c2c22e07be37da3a3b1275622720535dbf2be | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/13 - TEXT PROCESSING/Exercise 13 - 07 ver 2.py | 296 | 3.703125 | 4 | text = input()
strength = 0
iter = 0
while iter < len(text):
char = text[iter]
if char == ">":
strength += int(text[iter + 1])
elif strength > 0:
text = text[:iter] + text[iter + 1:]
iter -= 1
strength -= 1
iter += 1
print(text) |
9ae767db20f6ee178e08082b1496f1541c9c7855 | MiroVatov/Python-SoftUni | /Python Advanced 2021/TUPLES AND SETS/Exercise 7. Battle of Names.py | 687 | 3.890625 | 4 | num = int(input())
evens_set = set()
odds_set = set()
current_line = 0
for line in range(1, num + 1):
name = input()
name_ascii = 0
for n in name:
name_ascii += ord(n)
name_ascii = name_ascii // line
if name_ascii % 2 == 0:
evens_set.add(name_ascii)
else:
... |
9b1a43d3501a2a0f53fe63bd8c54df7491b7b3b7 | MiroVatov/Python-SoftUni | /PYTHON OOP/TESTING/Labs/Lab_tests/test_worker_test.py | 2,523 | 3.8125 | 4 | import unittest
from test_worker.test_worker import Worker
class WorkerTest(unittest.TestCase):
def setUp(self):
self.worker = Worker('Ivan Ivanov', 20000, 200)
def tearDown(self):
self.worker = None
def test_is_worker_initialized_with_the_correct_name_salary_and_energy(self):
#... |
123a3365a015f1ce2bd77f6d907784e6f7759e18 | MiroVatov/Python-SoftUni | /Python Advanced 2021/EXAMS_PREPARATION/additional_exams/02_presents_delivery.py | 4,758 | 3.671875 | 4 | def nice_kids_count(matrix, NICE_KID_HOUSE):
nice_kids = 0
for row in range(len(matrix)):
for col in range(len(matrix[row])):
if matrix[row][col] == NICE_KID_HOUSE:
nice_kids += 1
return nice_kids
def santa_starting_position(matrix, santa):
for row in ra... |
d28ecdfde3729a2ed21434070b6444fe2baf9ff0 | MiroVatov/Python-SoftUni | /Python Basic 2020/More exercises 01 - 08 - периметър и лице на кръг.py | 141 | 3.578125 | 4 | r = float(input())
p = 3.14159265358979323846
area = p * (r ** 2)
parameter = 2 * p * r
print(f'{area:.2f}')
print(f'{parameter:.2f}') |
0c477c1f9067ed3a8b84b8a36b809fa787ddb4ef | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/02 - Data Types and Variables/More exercises - 02 - 03.py | 194 | 3.859375 | 4 | number = int(input())
is_prime = False
delitel = 0
for x in range(1, number + 1):
if number % x == 0:
delitel += 1
if delitel == 2:
is_prime = True
print(f'{is_prime}') |
781e6322d2e3d57387c8992bee5a914c31cbc358 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam - 03 - Aquapark.py | 1,102 | 4.09375 | 4 | month = input()
hours = int(input())
people = int(input())
time = input()
price = 0
if time == 'day':
if month == 'march' or month == 'april' or month == 'may':
price = 10.50
if people >= 4:
price = price * 0.90
if hours >= 5:
price = price * 0.50
... |
906e1afc3f8e2427abc3aa6a655eb2f794ad0904 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam - 06 - Easter contest.py | 574 | 4.0625 | 4 | number_of_easterbreads = int(input())
max_points = 0
top_shef = ''
for i in range(1, number_of_easterbreads + 1):
baker_name = input()
grade = input()
total_points = 0
while grade != 'Stop':
grade = int(grade)
total_points += grade
grade = input()
print(f'{baker_na... |
a0b6298fefb0b599467b163d0171ba70a675b2db | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/12 - DICTIONARIES/Lab 12 - 03.py | 507 | 4.0625 | 4 |
command = input()
my_dict = {}
while command != "statistics":
tokens = command.split(":")
product = tokens[0]
quantity = int(tokens[1])
if product not in my_dict:
my_dict[product] = 0
my_dict[product] += quantity
command = input()
print(f"Products in stock:")
for (pr... |
a955275d344b679ac08cfcf4d46fae5d61a31600 | MiroVatov/Python-SoftUni | /Python Advanced 2021/MODULES/Labs/create_sequence.py | 407 | 4.09375 | 4 |
def locate(num):
sequence_nums = sequence_creation(num)
if num in sequence_nums:
print(f"The number - {num} is at index {sequence_nums.index(num)}")
else:
print(f"The number {num} is not in the sequence")
def sequence_creation(n):
sequence = [0, 1]
for i in range(2, n):... |
19d055298f173d51d5a2f05a2eb795d6d5102478 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exercise 03 - 03.py | 1,259 | 4.03125 | 4 | flowers = input()
flowers_qty = int(input())
budget = int(input())
roses_price = 5
dahlia_price = 3.80
tulip_price: float = 2.80
narcisus_price = 3
gladiol_price = 2.50
flowers_price = 0
if flowers == 'Roses':
if flowers_qty > 80:
flowers_price = 0.90 * roses_price
else:
flowe... |
e9063abfff6e94f1e7bcecfbd4ce3718d86c1727 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/13 - TEXT PROCESSING/Lab 13 - 03.py | 585 | 4.0625 | 4 | first_str = input()
second_str = input()
while first_str in second_str:
second_str = second_str.replace(first_str,'')
print(second_str)
# first_string = [t.split() for t in input()]
# second_string = [w.split() for w in input()]
#
# third_list = [x for x in second_string if x not in first_string]
#
... |
5fee3755be7c2cf5bd2f454d62ef1fc0712cc518 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam 03 - travel agency ver 2.py | 1,074 | 3.828125 | 4 | town = input()
option = input()
vip = input()
days = int(input())
if days > 7:
days -= 1
if not (town in ("Bansko", "Borovets") and option in ("noEquipment", "withEquipment",)) and not (
town in ("Varna", "Burgas") and option in ("noBreakfast", "withBreakfast")):
print(f'Invalid input!')
... |
27e7c9c2bc894a1b298afa9c6b8b869d880d9c76 | MiroVatov/Python-SoftUni | /Python Advanced 2021/TUPLES AND SETS/Lab 02.py | 701 | 4.21875 | 4 | num_of_grades = int(input())
students_dict = {}
for _ in range(num_of_grades):
student_info = input().split()
student_name = student_info[0]
grade = float(student_info[1])
if student_name not in students_dict:
students_dict[student_name] = [grade]
else:
students_dict[stu... |
73e4fd3a90a300d519c0622627dc212952421c33 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/12 - DICTIONARIES/Exercises - 12 - 09 Feed the animals.py | 1,258 | 3.875 | 4 | animal_dict = {}
areas_dict = {}
command = input().split(":")
while command[0] != "Last Info":
action = command[0]
animal_name = command[1]
food = int(command[2])
area = command[3]
if action == "Add":
if animal_name not in animal_dict:
animal_dict[animal_name] = f... |
320d90573282a16cb108c22e06ca63571cf61307 | MiroVatov/Python-SoftUni | /Python Basic 2020/Time + 15 min.py | 1,556 | 4.03125 | 4 | hours = int(input())
minutes = int(input())
# един час има 60 минути , които се умножават по часовете и след товасе прибавят минутите, за да се получи общият сбор на минутите.
now_in_minutes = hours * 60 + minutes # преобразуване всичко в минути (трябва да работим в една мерна единица - минути)
time_after_15_minute... |
28f71b6cb7062e7491e370f387f598a8de11891b | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam - 04 - oscars ver 2.py | 617 | 3.84375 | 4 | name_actor = input()
total_score = float(input())
commission_cnt = int(input())
for n in range(0, commission_cnt):
name_of_jury = input()
score_from_jury = float(input())
length_of_name = len(name_of_jury)
current_score = (length_of_name * score_from_jury) / 2
total_score += current_sc... |
b000042a1a202995474181781a983b836ae97f14 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/03 - LISTS BASIC/Exercise - 04 - 09.py | 1,361 | 3.78125 | 4 |
items = input().split('|')
budget = float(input())
sum_new_prices = 0
new_budget = 0
sum_old_prices = 0
total_profit = 0
bought_products_list = []
for i in items:
tokens = i.split('->')
cloth_type = tokens[0]
price = float(tokens[1])
if cloth_type == 'Clothes' and price <= 50:
... |
37b6e645e0f6d0c557b5cef71a4968a511376ee0 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/02 - Data Types and Variables/Lab - 02 - 03 ver 3.py | 261 | 4.03125 | 4 | n = int(input())
for number in range(1, n + 1):
sum_of_digits = 0
for num in str(number):
sum_of_digits += int(num)
is_special = sum_of_digits == 5 or sum_of_digits == 7 or sum_of_digits == 11
print(f'{number} -> {is_special}')
|
d46315798f3f551ed1e2c4195619c610447f9d27 | MiroVatov/Python-SoftUni | /Python Basic 2020/exam - 30 08 - 05.py | 853 | 3.859375 | 4 | import sys
racer_name = input()
gold_cards = 0
silver_cards = 0
bronze_cards = 0
best_time = sys.maxsize
winner = ''
while racer_name != 'Finish':
minutes = int(input())
seconds = int(input())
total_minutes = minutes * 60
total_time = total_minutes + seconds
if total_time < 55:
... |
90f84e7741d1dfc56bd06d503d38085c0ed94dfc | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/04 - FUNCTIONS/Lab - 06 - 04.py | 397 | 3.78125 | 4 | coffee = 1.50
water = 1.00
coke = 1.40
snacks = 2.00
drink = input()
qty = int(input())
def orders(drink: str, qty: int):
if drink == 'coffee':
return coffee * qty
elif drink == 'water':
return water * qty
elif drink == 'coke':
return coke * qty
elif drink == '... |
023c9a606bc48a67a8db94be944eff41e63cd666 | MiroVatov/Python-SoftUni | /Python Basic 2020/More exercises 03 - car to go.py | 764 | 3.765625 | 4 | budget = float(input())
season = input()
class_type = ''
car_type = ''
price = 0
car_price = 0
if budget <= 100:
class_type = 'Economy class'
if season == 'Summer':
car_type = 'Cabrio'
car_price = budget * 0.35
elif season == 'Winter':
car_price = budget * 0.65
... |
e832486cbe0a13e88ea2d1e55f289c1fc9c2766a | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/03 - LISTS BASIC/More exercises - 04 - 01.py | 188 | 3.8125 | 4 | numbers = input().split(", ")
for i in numbers:
if int(i) == 0:
numbers.append(i[::-1])
numbers.remove(i)
numbers = [int(n) for n in numbers]
print(numbers) |
1a73133e9612e335b941f723f3084203b4f31def | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/13 - TEXT PROCESSING/More exercises 13. Email Me.py | 262 | 3.875 | 4 | email = input()
token = email.split('@')
text_before = sum([ord(i) for i in token[0]])
text_after = sum([ord(i) for i in token[1]])
final_sum = text_before - text_after
if final_sum >= 0:
print(f'Call her!')
else:
print('She is not the one.') |
adbdda82062536cf51d17d5564688e7f0728ee73 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam 05 - suitcases load ver 5.py | 604 | 3.9375 | 4 | trunk_capacity = float(input())
command = input()
suitcase_count = 0
while command != 'End':
suitcase = float(command)
if suitcase > trunk_capacity:
print('No more space!')
break
suitcase_count += 1
if suitcase_count % 3 == 0:
suitcase = suitcase * 1.10
trunk_cap... |
aa13272c252b02d09781fec7b067fe5cb06d52d3 | MiroVatov/Python-SoftUni | /Python Basic 2020/More exercises 03 - 1 to 10 numbers.py | 130 | 3.71875 | 4 | ''''
for i in range(1, 10 + 1):
print(i, end=' ')
print()
'''
n = 1
while n <= 10:
print(n)
n += 1
|
3062f60f0bf4e9edc22070c6ff46b47b1200cfae | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/01 - Basic Syntax, Conditional Statements and Loops/More exercise - 01 - 04.py | 677 | 3.6875 | 4 | word = input().lower()
final_counter = 0
counter = 0
while "Sand".lower() in word:
counter += 1
if counter == word.count('sand'):
final_counter += counter
break
counter = 0
while "Water".lower() in word:
counter += 1
if counter == word.count('water'):
final_co... |
18e2faad91cbe127a6b2ba65aa51c95dce3543df | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/13 - TEXT PROCESSING/13. Winning Ticket ver 4.py | 2,426 | 3.5 | 4 | import collections
tickets = input().split(", ")
for ticket in tickets:
left_winner = False
right_winner = False
winner = []
left_half = ''
right_half = ''
ticket = [i for i in ticket if i != ' ']
if len(ticket) == 20:
middle = len(ticket) // 2
left_half = tick... |
45bef2bff0ec28f25e6a6c6bffa3ddeda1b61178 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam - 05 - Easter eggs.py | 1,025 | 3.859375 | 4 | number_of_eggs = int(input())
max_eggs = 0
max_color = ''
red_eggs = 0
orange_eggs = 0
blue_eggs = 0
green_eggs = 0
for i in range(1, number_of_eggs + 1):
egg_color = input()
if egg_color == 'red':
red_eggs += 1
if red_eggs >= max_eggs:
max_eggs = red_eggs
... |
564c59d89fe2b769416dd69b83e9c7a9e7e4b45a | MiroVatov/Python-SoftUni | /PYTHON OOP/SOLID/Labs/books/books_2.py | 1,179 | 3.890625 | 4 | class Book:
def __init__(self, title, author):
self.title = title
self.author = author
self.page = 0
def turn_page(self, page):
self.page = page
def __repr__(self):
return f"{self.author}: {self.title}, {self.page}"
class Library:
def __init__(self):
s... |
83d40ca371ffb669c90aa38f79a14d9cf91be8fc | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/Final Exams Practice/03. Nikulden’s meals.py | 1,006 | 3.84375 | 4 | meals_dict = {}
unliked_meals = 0
while True:
command = input()
if command == 'Stop':
break
token = command.split('-')
action = token[0]
guest, meal = token[1].strip(), token[2].strip()
if action == 'Like':
if guest not in meals_dict:
meals_dict[guest] ... |
77e9defb516e48061c5fdf6853a9fbae82975524 | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam - 05 - Toursit shop ver 3.py | 654 | 3.984375 | 4 | budget = float(input())
product_name = input()
product_price = 0
total_price = 0
products_count = 0
while product_name != 'Stop':
product_price = float(input())
products_count += 1
if products_count % 3 == 0:
product_price = product_price / 2
if product_price > budget:
diff ... |
ddfa60e7105b2ef16a3f46af6f312fdf320ea944 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/Final Exams Practice/03. The Pianist version 2.py | 2,071 | 4 | 4 | def piece_checker(piece_dict, piece):
if piece not in piece_dict:
return True
return False
number_of_pieces = int(input())
pieces_dict = {}
for n in range(number_of_pieces):
piece_info = input().split('|')
piece_name = piece_info[0]
composer = piece_info[1]
piece_key = ... |
d8782e88c4890c515d23fd433ec695f9e8da4584 | MiroVatov/Python-SoftUni | /Python Advanced 2021/EXAMS_PREPARATION/Exam 19 Aug 2020/taxi_express.py | 707 | 3.78125 | 4 | from collections import deque
customers = deque(map(int, input().split(', ')))
taxis = deque(map(int, input().split(', ')))
total_time = 0
while True:
if not customers:
print(f'All customers were driven to their destinations')
print(f'Total time: {total_time} minutes')
break
if not ... |
0b8de9ce4f14abab603f629afdb324de285bd2c7 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/14 - Regular Expressions/Exercise 14 - 05.py | 741 | 3.546875 | 4 | import re
import itertools
pattern = r'>>([A-Z|a-z]+)<<?(\d+\.\d+|\d+)!(\d+)'
products_list = []
prices_list = []
quantity = []
while True:
command = input()
if command == "Purchase":
break
matches = re.finditer(pattern, command)
for m in matches:
products_list.append... |
b585795936ae86c43a96ba61e6ce7511f8828fb4 | MiroVatov/Python-SoftUni | /PYTHON OOP/ATTRIBUTES_AND_METHODS/Exercises/gym 2/project/gym.py | 1,541 | 3.65625 | 4 | class Gym:
def __init__(self):
self.customers = []
self.trainers = []
self.equipment = []
self.plans = []
self.subscriptions = []
def add_customer(self, customer):
if customer not in self.customers:
self.customers.append(customer)
d... |
563b83c4e5752974d6e405d49fcc8d934dc3377d | MiroVatov/Python-SoftUni | /Python Basic 2020/Exam - 01 - easter bakery.py | 601 | 3.9375 | 4 | flour_price_per_kg = float(input())
flour_quantity = float(input())
sugar_quantity = float(input())
eggsshells_quantity = int(input())
yeast_qty = int(input())
sugar_price_per_kg = flour_price_per_kg * 0.75
eggshell_price = flour_price_per_kg * 1.10
yeast_price = sugar_price_per_kg * 0.20
total_flour = flou... |
6347b34caecbecf59a49e3f0bf9c62c6ad2c6132 | MiroVatov/Python-SoftUni | /Python Basic 2020/Number wars ver 03.py | 1,444 | 3.796875 | 4 | first_player_name = input()
second_player_name = input()
player1card = input()
player2card = ''
winner = ''
player1_total_points = 0
player2_total_points = 0
Number_wars = False
while player1card != 'End of game':
player2card = input()
player1card = int(player1card)
player2card = int(player2car... |
8e75456b0f69e8acc78e6f33f2ab9c63b1ce17ca | MiroVatov/Python-SoftUni | /Python Basic 2020/04 - exam - 22 08.py | 829 | 3.921875 | 4 | initial_sum = float(input())
months = int(input())
simple_interest = (3 * initial_sum) / 100
simple_interest_amount = initial_sum
complex_interest_amount = initial_sum
for i in range(1, months + 1):
complex_interest = ((2.7 * complex_interest_amount) / 100)
simple_interest_amount = simple_interest_a... |
a7a1ba845437c3ee4c845fcc42422594492d0581 | MiroVatov/Python-SoftUni | /PYTHON OOP/Previous Exams/Python OOP - Exam Preparation - 2 April 2020/skeleton/tests/test_advanced.py | 2,350 | 3.6875 | 4 | import unittest
from project.player.advanced import Advanced
class TestAdvanced(unittest.TestCase):
def test_successful_create_advanced_player(self):
self.advanced_player = Advanced("Miron")
self.assertEqual(self.advanced_player.health, 250)
self.assertEqual(self.advanced_player.username... |
6ceef82e152745944de6dcf95cc8554235c43aa0 | MiroVatov/Python-SoftUni | /Python Basic 2020/03 - exam - 22 08.py | 702 | 4.0625 | 4 | month = input()
hours = int(input())
people_in_group = int(input())
day_or_night = input()
price = 0
if month == 'march' or month == 'april' or month == 'may':
if day_or_night == 'day':
price = 10.50
elif day_or_night == 'night':
price = 8.4
if month == 'june' or month == 'july' or m... |
c0c7854471f06aec35a86a9d09b5549773a22a6a | MiroVatov/Python-SoftUni | /PYTHON OOP/INHERITANCE/Labs/stack_of_strings/stack.py | 610 | 4.15625 | 4 |
class Stack:
def __init__(self):
self.data = []
def push(self, item):
self.data.append(item)
def pop(self):
return self.data.pop()
# peek()method will show us the top value in the Stack
def peek(self):
return self.data[-1]
def is_empty(self... |
ce068d1230f86fdf3a42eb2605664ec262e7bc4a | MiroVatov/Python-SoftUni | /Python Basic 2020/Exercise 05 - 01 - version 2.py | 428 | 3.90625 | 4 | favourite_book = input()
num_books = 0
fav_book = False
while fav_book != True:
book = input()
if book == favourite_book:
fav_book = True
print(f'You checked {num_books} books and found it.')
break
elif book != 'No More Books':
num_books += 1
else:
p... |
9cc4cb2e0a1d541363eb1e9a66127d8714447738 | MiroVatov/Python-SoftUni | /Python Advanced 2021/Workshop/connect_four_game.py | 6,868 | 3.671875 | 4 | def create_play_board():
board = [
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0],
[0, 0, 0, 0, 0, 0, 0]
]
return board
def winning_condition(board, limit, pla... |
b9f000c8ba750643b09186328ac615b63090e63a | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/04 - FUNCTIONS/Exercise - 06 - 04 ver 1.py | 303 | 3.984375 | 4 | number = input()
number = [n for n in number]
def evens_odds():
evens = 0
odds = 0
for i in number :
if int(i) % 2 == 0:
evens += int(i)
else:
odds += int(i)
return f'Odd sum = {odds}, Even sum = {evens}'
print(evens_odds())
|
344b99cac5b4646d9c5c1db218b995d1a80606ec | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/04 - FUNCTIONS/Exercise - 06 - 07 ver 2.py | 298 | 3.890625 | 4 | def perf_num(num):
divisor = 0
for n in range(1, num):
if num % n == 0:
divisor += n
if num == divisor and num > 0:
return f"We have a perfect number!"
else:
return f"It's not so perfect."
num = int(input())
print(perf_num(num)) |
b6ee6e463fc7d643600cdcc1eadfd8ef962378f4 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/Final Exams Practice/02. Registration.py | 530 | 3.75 | 4 | import re
n = int(input())
pattern = r'(U\$)(?P<user>[A-Z][a-z]{2,})\1(P@\$)(?P<pass>[A-Za-z]{5,}\d+)\3'
registrations = 0
for _ in range(n):
username = input()
if re.search(pattern, username):
print(f'Registration was successful')
registrations += 1
for m in re.finditer(patte... |
4d96ce3cbe81a86bd6ae67532d708659c4c4f724 | MiroVatov/Python-SoftUni | /PYTHON OOP/TESTING/Exercises/vehicle/test/test_vehicle.py | 1,800 | 3.828125 | 4 | from vehicle.project.vehicle import Vehicle
import unittest
class VehicleTest(unittest.TestCase):
def setUp(self):
Vehicle.DEFAULT_FUEL_CONSUMPTION = 1.25
self.car = Vehicle(100.0, 120.0)
# self.car.capacity = self.car.fuel
# self.car.fuel_consumption = Vehicle.DEFAULT_FUEL_CONSUM... |
c7a0003d02e4433b84c1e15d9cdda00ba3e6a2d5 | MiroVatov/Python-SoftUni | /Python Advanced 2021/LISTS AS STACKS AND QUEUES/Exercise - 03.py | 578 | 3.609375 | 4 | from collections import deque
success = False
food_qty = int(input())
food_demand = [int(i) for i in input().split()]
food_demand = deque(food_demand)
max_order = max(food_demand)
for elem in range(len(food_demand)):
order = food_demand[0]
if order <= food_qty:
food_demand.popleft()
... |
2d37e76a01803aad96d50500848a43b944e93c91 | MiroVatov/Python-SoftUni | /PYTHON OOP/Previous Exams/Python OOP Retake Exam - 22 Aug 2020/skeleton/project/people/child.py | 457 | 4.0625 | 4 | class Child:
cost: float
def __init__(self, food_cost: int, *toys_cost):
self.food_cost = food_cost # the money that the kid requires for a day
self.toys_cost = toys_cost
self.cost = food_cost + sum(toys_cost) # TODO check if the yys cost is for a day or for a month # Sum the food_... |
a67b5f96e505e4129d270e9708740048ee22f745 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/12 - DICTIONARIES/Problem 4. Supermarket Database.py | 893 | 3.671875 | 4 | goods_info_dict = {}
while True:
products_data = input().split()
if products_data[0] == 'stocked':
break
product = products_data[0]
product_price = float(products_data[1])
quantity = int(products_data[2])
if product not in goods_info_dict:
goods_info_dict[product] = ... |
aa7a877fb5450c27b78fbf7f026991d1e9289c7e | MiroVatov/Python-SoftUni | /Python Advanced 2021/EXAMS_PREPARATION/Exam 27 June 2020/02 snake.py | 2,730 | 4.125 | 4 | field_size = int(input())
snake_field = [list(input()) for _ in range(field_size)]
def check_starting_position(field, start):
for row in range(len(field)):
if start in field[row]:
return row, field[row].index(start)
def is_outside(cur_row, cur_col, size):
if 0 <= cur_row < size and 0 <= ... |
e3bd32b7a49ea1b51e1834ffbda2c9f4fe946ed3 | MiroVatov/Python-SoftUni | /Python Advanced 2021/LISTS AS STACKS AND QUEUES/Exercise - 01.py | 173 | 3.53125 | 4 | numbers = input().split()
reversed_text = []
while numbers:
# pop_chart = numbers.pop()
reversed_text.append(numbers.pop())
print(' '.join(reversed_text)) |
da1bc9037299aabd4f01048542bb93de4d836854 | MiroVatov/Python-SoftUni | /PYTHON OOP/Previous Exams/Python OOP - Exam Preparation - 2 April 2020/skeleton/project/card/card_repository.py | 1,039 | 3.5 | 4 | class CardRepository:
def __init__(self):
self.count: int = 0
self.cards = []
# TODO create method to check the cards by name -->> IF NEEDED !!!
def add(self, card):
card_found = [ca for ca in self.cards if ca.name == card.name]
if card_found:
card = card_foun... |
9031f53d989f59d04ca8ce29acf2522849f07ed2 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/03 - LISTS BASIC/Exercise 04 - 05.py | 456 | 3.578125 | 4 | text = input().split()
shuffles = int(input())
middle = int(len(text) / 2)
final_text = []
counter = 0
for i in range(shuffles):
final_text = []
for a in range(0, middle):
final_text.append(text[a])
for b in range(middle, len(text)):
final_text.append(text[b])
... |
2acfe67a728826ca1273b50bfac10f93222cf986 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/Final Exams Practice/03. Plant Discovery.py | 1,720 | 3.671875 | 4 |
number_of_plants = int(input())
plants_dict = {}
for n in range(number_of_plants):
plants_command = input().split("<->")
plant_name = plants_command[0]
rarity = int(plants_command[1])
if plant_name not in plants_dict:
plants_dict[plant_name] = [[rarity], []]
else:
... |
bc339606a33a1334f77a205753913a98e62d8989 | MiroVatov/Python-SoftUni | /Python Advanced 2021/EXAMS_PREPARATION/additional_exams/03_find_the_eggs.py | 2,779 | 3.6875 | 4 | from collections import deque
def find_strongest_eggs(*args):
eggs_powers, num_sub_lists = args[0], args[1]
eggs_powers = deque(eggs_powers)
new_eggs_list = []
strongest_eggs = []
for n in range(num_sub_lists):
new_eggs_list.append([])
while eggs_powers:
for i in... |
fcdbd167b98929dd2b36c0e269e1b18253bea773 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/14 - Regular Expressions/14 - Lab - 03 ver 2.py | 315 | 4 | 4 | import re
regex = r"\b(?P<day>\d{2})(?P<sep>[-.\/])(?P<month>[A-Z][a-z]{2})\2(?P<year>\d{4})\b"
text = input()
matches = re.finditer(regex, text)
for m in matches:
day = m.group('day')
month = m.group('month')
year = m.group('year')
print(f"Day: {day}, Month: {month}, Year: {year}") |
a29be9ec4675c4bcbdd4e9e3730c3f95fc4b608c | MiroVatov/Python-SoftUni | /Python Advanced 2021/EXAMS_PREPARATION/additional_exams/02_easter_bunny.py | 1,567 | 3.703125 | 4 | def in_range(row, col, size):
if 0 <= row < size and 0 <= col < size:
return True
return False
def print_directions(best_dir):
for direction in best_dir:
print(direction)
size = int(input())
matrix = [[] for _ in range(size)]
BUNNY = 'B'
TRAP = 'X'
MAX_EGGS_SUM = -1_000_... |
2b848aa6d37c8204d5b837a4cfff00751f23035d | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/MID - Exams/01. Spring Vacation Trip.py | 1,364 | 4 | 4 | days_of_vacation = int(input())
budget = float(input())
number_of_people = int(input())
price_per_km = float(input())
food_per_person_per_day = float(input())
hotel_room_per_person_per_night = float(input())
food_expenses = (days_of_vacation * number_of_people * food_per_person_per_day)
hotel_all_nights_price ... |
1129c8a025043c64ede34b2ed139756a72d2fb68 | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/12 - DICTIONARIES/Exercise 12 - 05.py | 915 | 3.84375 | 4 | n = int(input())
registered = {}
# unregistered = []
for i in range(n):
command = input().split(" ")
if command[0] == "register":
username = command[1]
license_nr = command[2]
if username not in registered:
registered[username] = license_nr
print(f... |
be6138a33eeb58f20d0f9e88567a473891ccb52e | MiroVatov/Python-SoftUni | /Python Fundamentals 2020 - 2021/Final Exams Practice/03. On the Way to Annapurna.py | 800 | 3.8125 | 4 |
stores_dict = {}
while True:
command = input()
if command == "END":
break
token = command.split("->")
action = token[0]
if action == "Add":
store_name = token[1]
items_lst = token[2].split(",")
if store_name not in stores_dict:
stores_dict... |
bac0a74b282630d032faeb647b74e2b0b275d286 | mrojaCtah/DS-APracticeWithPython | /factorial.py | 192 | 4.09375 | 4 | def factorial(num):
if(num == 1):
return num
return num * factorial(num - 1)
num1 = factorial(3)
num2 = factorial(4)
print('num 1: ' + str(num1))
print('num 2: ' + str(num2))
|
ada3af1ded9269e2d69c7d903c12451da41f6a7c | LiaoJJ/LeetCode | /239. Sliding Window Maximum .py | 817 | 3.640625 | 4 | '''
Monotonic Queue O(n)
store index in the queue, if an older element in the queue is smaller than a newer element, then it's impossible to be result.
be careful to distinguish index and nums[index]
'''
class Solution:
def maxSlidingWindow(self, nums: List[int], k: int) -> List[int]:
if not nums or len(n... |
0ee16ba46e44a1c3654a066e7c4526fef0efe852 | LiaoJJ/LeetCode | /56. Merge Intervals .py | 766 | 3.796875 | 4 | '''
O(n)
sort by 1st element
set the last one of res as compare,
get the rightest most end each time
another idea O(nlgn)
sort begin and end respectly
and then constrct the res
https://leetcode.com/problems/merge-intervals/discuss/21223/Beat-98-Java.-Sort-start-and-end-respectively.
'''
class Solution:
def merg... |
9f743e7f9006ae237bf7971cf5fc8946905305bd | vjohnk/mycode | /nameage.py | 169 | 3.875 | 4 | #!/usr/bin/python3
name=input("Enter name ")
age=input("Enter age ")
print("Hi" , name)
print("You are",age,"years old")
print("in 5 years u will be ",(int(age)+5))
|
b9107beb60d030e328a51c956c69e901ffc1bb12 | vjohnk/mycode | /loop.py | 285 | 3.734375 | 4 | #!/usr/bin/python3
#count=0
#while(count<5):
# print(count)
# count=count+1
#print("good bye")
#rank=1
#while(rank!=12):
# print("rank is" , rank)
# rank+=1
#for i in range(100):
# print(i)
while day == 'Thursday':
for i in [1,2,3,4]:
print("somthing")
|
36cb097297688089507c27050fc399acb6e16040 | DumbAbstraction/DumbPanel | /threaded/radio_buttons3/radio_buttons3_gui.py | 1,834 | 3.609375 | 4 | #import tkinter as tk # Python 3
import Tkinter as tk # Python 2
import threading
class App(threading.Thread):
def __init__(self):
threading.Thread.__init__(self)
self.start()
def callback(self):
self.window.quit()
def run(self):
self.windowWidth = 260
self.windowH... |
d4eb863d441ae9a67d333784662b3aa35f4cc745 | xd-lpc/sharemylove | /ex39.py | 1,060 | 4.125 | 4 | #create a mapping of status to abbreviation
states = {
'Oregon':'OR',
'Florida': 'FL',
'California':'NY',
'Michigan':'MI'
}
#create a basic set of status and some cities in them
cities = {
'CA':'San Francisco',
'MI':'Detroit',
'FL':'Jacksonville'
}
#add more cities
cities['NY'] = 'New Yo... |
6bcdb23587171691e25cd375ea30f5356487dcc9 | vensder/codeacademy_python | /shout.py | 289 | 4.15625 | 4 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
def shout(phrase):
if phrase == phrase.upper():
return "YOU'RE SHOUTING!"
print phrase
else:
return "Can you speak up?"
print "Hello!"
phrase = raw_input("Enter yours phrase:\n")
print shout(phrase)
|
0e974ce4baadbd3a7dab5dc1eadcbd0a641545f4 | Yohoa/Exercises | /max_list_element_of_list.py | 992 | 3.8125 | 4 | #Input a list contains some lists and output the largest SUM with continual list-elements
#Please run it in terminal
from sys import argv
script, list_file = argv
lists = open(list_file)
lists_len = len(lists)
SUM = 0
single_amount = 0
def SUM_ALL(a,b):
return a+b
amount_list = []
for i in range(0,lists_len):
... |
82eaae10645f295019d0c2752ee382ca032e99d8 | EmielThomaes/5WWIPython | /05_EenvoundigeFuncties/test.py | 797 | 3.734375 | 4 | uitvoer = '{} + {} = {}'
print(uitvoer.format(3, 4, 7))
print(uitvoer.format(-1, 3, 10))
uitvoer = '{0} + {0} = {1}'
print(uitvoer.format(3, 6))
uitvoer = '{:d} + {:f} = {:d}'
print(uitvoer.format(1, 1, 2))
uitvoer = '{0:d} + {0:f} = {1:d}'
print(uitvoer.format(1, 2))
uitvoer = '{0:d} + {0:.2f} = {1:d}'
print(uitvo... |
20b7b1257e0c3a2ceae1b4bd7aae54b05a071959 | EmielThomaes/5WWIPython | /06+Condities/Atoommodel van Bohr.py | 549 | 3.6875 | 4 | # invoer
aantal_elektronen = int(input('aantal elektronen = '))
# berekening
if aantal_elektronen >= 156:
schil = 'Q-schil'
elif aantal_elektronen >= 124:
schil = 'P-schil'
elif aantal_elektronen >= 92:
schil = 'O-schil'
elif aantal_elektronen >= 60:
schil = 'N-schil'
elif aantal_elektronen >= 28:
... |
2553fbc7a7a0c3408c72a6338d9ee456b7857bc5 | EmielThomaes/5WWIPython | /10_Strings/Geen twee na elkaar.py | 230 | 3.5625 | 4 | def ontdubbelen(woord):
nieuw_woord = ''
vorige_letter = ''
for i in range(len(woord)):
if woord[i] != vorige_letter:
nieuw_woord += woord[i]
vorige_letter = woord[i]
return nieuw_woord
|
be99c22e2523b16328800716bb7d07efba7e7c20 | sipakhti/code-with-mosh-python | /Lab_Excercises/Lab_07/task_3.py | 2,190 | 3.875 | 4 | import time
from array import array
prime = 6700417
temp = True
temp_list = list(range(2, prime))
temp_array = array("I", temp_list)
for_start = time.time_ns()
# NORMAL FOR LOOP
for number in temp_list:
if prime % number == 0:
print(f"{prime} is not a prime number")
temp = False
break
fo... |
9a21672e4ff1339f1ead29ff5b9b0a2d31c17485 | sipakhti/code-with-mosh-python | /Data Structure/Swapping Variables.py | 240 | 3.84375 | 4 | x = 10
y = 11
# z = x
# x = y
# y = z
# exactly the same as above
x, y = y, x
x, y = (y, x)
print("x", x)
print("y", y)
one = 1
two = 2
three = 3
one, two, three = three, two, one
print("One", one)
print("two", two)
print("three",three) |
c5a1581e0a12626914417577f283e7c261db8c91 | sipakhti/code-with-mosh-python | /Lab_Excercises/Lab_13/List_Mutator.py | 421 | 3.703125 | 4 | from array import array
from random import choice , choices
numbers = [1,568468,2,6841,458,1284,3,84,1,84,48,3,68,184,1986]
place = True
temp = 0
print(numbers)
for i in range(1, len(numbers), 2):
place = True
while not (numbers[i] > numbers[i - 1] and numbers[i] > numbers[i + 1]):
temp = choices([... |
fe0402f0d0ad518780195d6abdedb964b664ef78 | sipakhti/code-with-mosh-python | /Data Structure/Generator Expressions.py | 418 | 3.84375 | 4 | from sys import getsizeof
# when we use parenthesis around a comprehension expression we create a generator object which in way way easy on the memory instead of list and is iterable
values = (x * 2 for x in range(100000))
print("generator", getsizeof(values))
# however we cannot find the length of the generator obje... |
55bcd257344c493e0eea72c9104802de5cba7a22 | sipakhti/code-with-mosh-python | /Projects/Project1/test_project1.py | 1,170 | 3.59375 | 4 | import unittest
from project1 import add, subtract, divide, multiply
class TestProject1(unittest.TestCase):
def test_add_1(self):
self.assertEqual(add(10, 10), 20)
def test_add_2(self):
self.assertEqual(add(-10, 10), 0)
def test_add_3(self):
self.assertEqual(add(10, -10), 0)
... |
2bb4c43c58c24f07a6b0a2e30ae5e3a1593e1ef6 | sipakhti/code-with-mosh-python | /Data Structure/Dictionaries.py | 1,002 | 4.25 | 4 | point = {"x": 1, "y": 2}
point = dict(x=1, y=2)
point["x"] = 10 # index are names of key
point["z"] = 20
print(point)
# to make sure the program doesnt crash due to invalid dict key
if "a" in point:
print(point["a"])
# Alternative approach using .get function and it makes the code cleaner
print(point.get("a", 0... |
28f55ac6d90431d79b36817414aca1f2ff9a52b8 | sipakhti/code-with-mosh-python | /test folder/int.py | 1,509 | 4 | 4 |
class Length:
__metric = {"mm": 0.001, "cm": 0.01, "m": 1, "km": 1000,
"in": 0.0245, "ft": 0.3048, "yd": 0.9144, "mi": 1609.344}
def __init__(self,value,unit):
self.value = float(value)
self.unit = unit
@classmethod
def from_string(cls,string):
value, unit = ... |
b5fc18297b318ff88610adf0cb3d3448de671d31 | sipakhti/code-with-mosh-python | /Data Structure/Unpacking Operator.py | 440 | 4.21875 | 4 | numbers = [1, 2, 3]
print(*numbers)
print(1, 2, 3)
values = list(range(5))
print(values)
print(*range(5), *"Hello")
values = [*range(5), * "Hello"]
first = [1, 2]
second = [3]
values = [*first, *second]
print(*values)
first = dict(x=1)
second = dict(x=10, y=2)
# incase of multiple values with similar keys, the last... |
a4e3fcec8a5470cc0f137c8621b7814a281d3465 | sipakhti/code-with-mosh-python | /Lab_Excercises/Lab_11/string_permutation.py | 437 | 3.984375 | 4 | user_input = input("Enter String:\n")
def str_permutation(string: str = ...):
"""
break any string into every possible substring
"""
temp_list = []
for x in range(1,len(string)+1):
for y in range(len(string)):
temp = string[y:x]
if temp != "":
temp_... |
307eccd04d95e8e169f1b1cf743b10fb42686268 | sipakhti/code-with-mosh-python | /Control Flow/Ternary_Operator.py | 240 | 4.15625 | 4 | age = 22
if (age >= 18):
message = "Eligible"
else:
message = "Not Eligible"
print(message)
# more clearner way to do the same thing
age = 17
message = "Eligible" if age >= 18 else "Not Eligible" # ternary Operator
print(message) |
22794f46cf44676ac875b7b898df9dc23e18e6a9 | sipakhti/code-with-mosh-python | /Classes/comparing objects.py | 431 | 3.6875 | 4 | class Umer:
def __init__(self, x, y):
self.x = x
self.y = y
def __eq__(self, other):
return self.x == other.x and self.y == other.y
def __gt__(self, other):
return self.x == other.x and self.y == other.y
def __add__(self, other):
return Umer(self.x + other.x, s... |
789057bd5c3175aa9babc6d44c0d7e62a5f146e3 | sipakhti/code-with-mosh-python | /Projects/Battle/assorted.py | 11,901 | 4 | 4 | import math as m
from json import load
import pickle
from array import array
def grader(subject_marks, total_marks=150):
if 50 <= ((subject_marks * 100) / total_marks) < 60:
return "E"
if 60 <= ((subject_marks * 100) / total_marks) < 70:
return "D"
if 70 <= ((subject_marks * 100) / total_m... |
f02b79f7e24f5ef02e7cedcbe4cdc352881d78f7 | sipakhti/code-with-mosh-python | /Lab_Excercises/Lab_12/nCr_nPr.py | 1,481 | 3.859375 | 4 |
def factorial(number: int):
for n in range(1, number):
number *= n
return number
def combination(n: int, r: int):
if n < 0 or r < 0:
raise ValueError("\033[1;31m!!!Value of 'n' or 'r' cannot be less than '0'!!!\033[0m")
if r > n:
raise ValueError("\033[1;31m!!!Value of 'r' cann... |
821bf0c2f4f5f9e039b276a9ef257fdbd804fe3e | sipakhti/code-with-mosh-python | /Lab_Excercises/Lab_12/Hailstone_Sequence.py | 524 | 3.828125 | 4 |
def hailstone(number, step=1):
if isinstance(number, str):
number = int(number)
# HAILSTONE SEQUENCE PRINTING
newline = " "
if step % 10 == 0:
newline = f"[{step}]\n"
print(number, end=f"{newline}")
# RECURSION LIMITER
if number == 1:
print(f"\rSteps : {step} ")
retu... |
d2e5ff5c1eaf24c9fdb6d75ae8ca173394f3fe07 | sipakhti/code-with-mosh-python | /Projects/Battle/main.py | 13,913 | 3.6875 | 4 | import random
from os import path
import pickle
from Classes.game import *
def input_name(players):
length = 0
for player in players:
player_name = input("Enter Player name: ")
player.name = player_name
if len(player_name) > length:
length = len(player_name)
return len... |
d61f9541bdf0e1903164905b10adf9906fd65d14 | epangar/learn-python-the-hard-way | /31-40/34.py | 442 | 3.75 | 4 | animals = ['bear', 'python', 'peacock', 'kangaroo', 'whale', 'platypus']
print "1. The animal at 1 is %s." % 'python'
print "2. The third animal is %s." % 'peacock'
print "3. The first animal is %s." % 'bear'
print "4. The animal at 3 is %s." % 'kangaroo'
print "5. The fifth animal is %s." % 'platypus'
print "6. The a... |
0ca58f1327821ba5c7b1f090d1287b27076e6d9c | jaideepsingh08/Udacity-iSDC-Projects | /2. P2 - Implement Matrix Class_Python/matrix.py | 7,215 | 4 | 4 | import math
from math import sqrt
import numbers
def zeroes(height, width):
"""
Creates a matrix of zeroes.
"""
g = [[0.0 for i in range(width)] for j in range(height)]
return Matrix(g)
def identity(n):
"""
Creates a n x n identity matrix.
"""
I ... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.