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
df1e5c64b56f422885ecc3766032fbe465167226
ravi4all/PythonOnlineJan_2021
/Functions/13_map_solution_1.py
504
3.609375
4
def temp_convert(c): return 9/5 * c + 32 def hr_to_mins(hr): return hr * 60 def mins_to_sec(mins): return mins * 60 def min_to_hrs(mins): return mins / 60 temp = [30.44,35.55,30.23,28.77,24.5,32.4] mins = [15,50,200,340,210] hrs = [3.5, 2.8, 3, 5] def my_map(func, iter): data =...
db61f434c1e13b2268014e55c94e85399dbff470
ravi4all/PythonOnlineJan_2021
/Functions/12_need_of_map.py
457
3.703125
4
def temp_convert(c): return 9/5 * c + 32 def hr_to_mins(hr): return hr * 60 def mins_to_sec(mins): return mins * 60 def min_to_hrs(mins): return mins / 60 # f = temp_convert(30.55) # print("Temperature is",f) temp = [30.44,35.55,30.23,28.77,24.5,32.4] f = [] for t in temp: f.a...
e64aa911e4d3da729a348575b48602f3dd880c92
ravi4all/PythonOnlineJan_2021
/FileHandling/06-csv_read_write.py
492
3.703125
4
# csv - comma seperated values import csv # data = [ # {"name" : 'Tom', "dept" : 'IT'}, # {"name" : 'John', "dept" : 'HR'}, # {"name" : 'Shawn', "dept" : 'IT'}, # {"name" : 'Harry', "dept" : 'HR'}, # ] # # with open('data.csv','w', newline='') as file: # writer = csv.writer(file) # ...
37231c042f58804f1015c23920f2ede05e9fc500
Onkar7798/Undefeated-TicTacToe
/UndefeatedTicTacToe.py
3,901
3.71875
4
from random import * # Type Error Handling and Board Checking remaining def show_board(gboard): print(f' {gboard[0]} | {gboard[1]} | {gboard[2]}') print(r'-----------') print(f' {gboard[3]} | {gboard[4]} | {gboard[5]}') print(r'-----------') print(f' {gboard[6]} | {gboard[7]} | {gboard[8]...
28a35a47178cc0eab6c5eec397669992229cf500
huwanping001/Python
/chapter13/demo6.py
815
3.796875
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/10/6 16:59 '''• object类是所有类的父类,因此所有类都有object类的属性和方法。 • 内置函数dir()可以查看指定对象所有属性 • Object有一个 str()方法,用于返回一个对于“对象的描述”, 对应于内置函数str()经常用于print()方法,帮我们查看对象的信息,所以我们经常会对 str ()进行重写''' class Student: def __init__(self, name, age): self.name = name self...
3bec2c25aea418c8cf25cfbd5073c8d50a587c0f
huwanping001/Python
/chapter3/add.py
237
3.71875
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/17 19:40 a=input('请输入一个加数:') b=input('请输入另一个加数:') print(type(a), type(b)) print(int(a)+int(b))
1526d0dce289f22ece006a1aadc832d4a996c6dc
huwanping001/Python
/chapter5/demo14.py
504
3.59375
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/18 16:57 '''流程控制语句break与continue在二重循环中的使用''' for i in range(5): #代表外层循环需要执行5次 for j in range(1, 11): if j % 2 == 0: break print(j) for i in range(5): #代表外层循环需要执行5次 for j in range(1, 11): if j % 2 == 0: ...
e682fe8f6f10a5c2890cfa81bfa5467a5cd32d30
huwanping001/Python
/chapter6/demo3.py
472
4.0625
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/22 9:47 #列表的查询操作 '''list.index(obj) 从列表中找出某个值第一个匹配项的索引位置''' lst = ['xiaohu', 'tongxue', 99, 'xiaohu'] print(lst.index('xiaohu')) #print(lst.index('python')) #ValueError: 'python' is not in list #print(lst.index('xiaohu', 1, 3)) #ValueError: 'xiaohu' is not i...
65e6712f8d577dadf50fe5baffa7d09156f21d2b
huwanping001/Python
/chapter5/demo9.py
492
3.703125
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/18 16:14 #continue 语句 #要求输入1-50之间所有5的倍数,5,10,15,20... #5的倍数的共同点:和5的余数为0的数都是5的倍数 #什么样的数不是5的倍数:和5的余数不为0的数都是不是5的倍数 for i in range(1, 51): if i % 5 == 0: print(i) for i in range(1, 51): if i % 5 != 0: continue print(i)
08fdcd7074f5295c10af068dc47f2fcbe1896449
huwanping001/Python
/pycharm code/myone.py
489
3.59375
4
#输出函数print #输出数字 print(520) print(98.50) #输出字符串 print("xiaohu") #输出表达式 print(3+1) #上面三种均为输出目的地可以为控制台和文件中 #输出到文件中 注意 1所指定盘符存在 2.使用file = fp fp = open('D:/text.txt','a+') # a+ 如果文件不存在就创建,存在就在文件内容后面进行追加 print('woaixiaohu',file=fp) fp.close() #不进行换行输出 print('hello','xiao','hu')
c32c8707d669aaf4ab406edf5a63ca5a0dd84319
huwanping001/Python
/chapter5/demo4.py
376
3.71875
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/18 15:44 #计算1-100之间的偶数和 sum = 0 a = 1 while a <= 100: if a % 2 == 0: #if a%2 sum += a a += 1 else: a += 1 print(sum) #另一种写法 sum = 0 a = 2 while a <= 100: sum += a a += 2 print(sum)
f3899b78bbb3997a640bf0a98b3e91f817c57dc1
huwanping001/Python
/chapter6/demo6.py
818
4.03125
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/22 10:25 #向列表的末尾添加一个元素 ''' list.append(obj) 在列表末尾添加新的对象''' lst = [1, 2, 3] print('添加元素之前:', lst, id(lst)) lst.append(4) print('添加元素后:', lst, id(lst)) lst2 = ['xiaohu', 'tongxue'] lst.append(lst2) #将lst2作为一个元素添加到列表的末尾 print(lst) ''' list.extend(seq) 在列表末尾一...
3d7327f749af1d87491b05335b7799d59fc12e5b
huwanping001/Python
/chapter5/demo11.py
406
3.765625
4
# 学校:四川轻化工大学 # 学院:自信学院 # 学生:胡万平 # 开发时间:2021/9/18 16:25 #else 与 while使用 a = 0 while a < 3: pwd = input('请输入密码:') if pwd == '888888': print('密码正确') break else: print('密码不正确,请重新输入') a += 1 else: print('对不起,三次密码输入错误')
fed90c574c944ac4a4c5b2ca99c6ae7e1a97bd93
vinaynv3/Data-analysis-visulization-using-calculus
/projectile motion of ball.py
983
4.09375
4
from matplotlib import pyplot as vin import math def draw_graph(x,y): vin.plot(x,y) vin.xlabel('x Cordinate') vin.ylabel('y cordinate') vin.title('Projectile motion of ball') def f_range(start,last,interval): numbers=[] while start<last: numbers.append(start) start=s...
ff97c20b05af96e9c5c1c57895fe9babe72035fd
colinsongf/redis-grep
/redisgrep.py
2,115
3.5
4
"""Perform regex searches through Redis values""" import sys import re from redis import Redis __version__ = "0.1.2" __author__ = "Ionut G. Stan" class RedisString(object): def __init__(self, name, value): self.name = name self.value = value def __repr__(self): return '<RedisString:...
0ec2e9f2fcb36f32ae4220b6f35fa96529a2af30
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/sum_2_binary_numbers_without_converting_to_integer.py
1,784
4.21875
4
# Task: # # Given two binary numbers represented as strings, return the sum of the two binary numbers as a new binary represented # as a string. Do this without converting the whole binary string into an integer. # # Here's an example and some starter code. # # def sum_binary(bin1, bin2): # # Fill this in. # # print(...
480dd41bb1dfde38741970333c6442df17dd944a
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/sort_array_with_three_values_in_place.py
2,376
4.25
4
# Task: # # Given an array with n objects colored red, white or blue, sort them in-place so that objects of the same color are # adjacent, with the colors in the order red, white and blue. # # Here, we will use the integers 0, 1, and 2 to represent the color red, white, and blue respectively. # # Note: You are not supp...
b3685e1fdf9fea6b0b6063f1c0532d3f4ea72973
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_check_if_number_is_sum_of_all_its_positive_divisors.py
1,361
3.9375
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.check_if_number_is_sum_of_all_its_positive_divisors import \ Solution class TestSolution(TestCase): def test_check_if_number_is_sum_of_all_its_positive_divisors__when_input_is_smaller_than_2__then_result_is_false( ...
ad605bc7e838c84f93220f42d165db8562a12723
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/find_longest_palindromic_substring.py
2,326
4.0625
4
# Task: # # A palindrome is a sequence of characters that reads the same backwards and forwards. Given a string, s, find # the longest palindromic substring in s. # # Example: # Input: "banana" # Output: "anana" # # Input: "million" # Output: "illi" # # class Solution: # @staticmethod # def find_longest_palindr...
96002e94186bdfef6a04951c5b99d55e21bb9d00
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/find_first_recurring_character.py
1,231
4.125
4
# Task: # # Given a string, return the first recurring letter that appears. If there are no recurring letters, return None. # # Example: # # Input: qwertty # Output: t # # Input: qwerty # Output: None # # Here's some starter code: # # def first_recurring_char(s): # # Fill this in. # # print(first_recurring_char('qwer...
3442a6981523d9129315bf2f21d73ec4b4e7efad
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_find_common_ancestor_in_binary_tree.py
2,024
3.8125
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.find_common_ancestor_in_binary_tree import TreeNode, \ find_common_ancestor_in_binary_tree class Test(TestCase): def test_find_common_ancestor_in_binary_tree__when_common_ancestor_is_parent__then_parent_is_returned(self):...
52e163e341a86e19a8424a684d450691a2313d04
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/find_number_of_graphs.py
2,332
3.9375
4
# Task: # # Given a list of undirected edges which represents a graph, find out the number of connected components. # # def num_connected_components(edges): # # Fill this in. # # print(num_connected_components([(1, 2), (2, 3), (4, 1), (5, 6)])) # # 2 # # # In the above example, vertices 1, 2, 3, 4 are all connected, a...
5c1da094b6a0df602618de195b38e0cf6078bda1
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/remove_consecutive_linked_list_items_which_sum_to_0.py
2,940
3.71875
4
# Task: # # Given a linked list of integers, remove all consecutive nodes that sum up to 0. # # Example: # Input: 10 -> 5 -> -3 -> -3 -> 1 -> 4 -> -4 # Output: 10 # # The consecutive nodes 5 -> -3 -> -3 -> 1 sums up to 0 so that sequence should be removed. 4 -> -4 also sums up to 0 # too so that sequence should also be...
a0e2c9352a30e37a9e2b0a696a491d9242b588b0
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/filter_leaves_with_certain_value_in_binary_tree.py
2,959
4.03125
4
# Task: # # Given a binary tree and an integer k, filter the binary tree such that its leaves don't contain the value k. Here are the rules: # # - If a leaf node has a value of k, remove it. # - If a parent node has a value of k, and all of its children are removed, remove it. # # Here's an example and some starter cod...
36bd26b3f6ffde5e9b6f39b95913fb963da1d38b
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_rotate_2d_nxn_matrix_by_90_degree_clockwise.py
1,321
3.890625
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.rotate_2d_nxn_matrix_by_90_degree_clockwise import \ rotate_2d_nxn_matrix_by_90_degree_clockwise class Test(TestCase): # Input: # 1 2 3 # 4 5 6 # 7 8 9 # # Expected output: # 7 4 1 # 8 5 2 ...
88866890b8b34594bc9d03a6044af12b30666af2
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_generate_all_subsets.py
1,024
3.65625
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.generate_all_subsets import generate_all_subsets class Test(TestCase): def test_generate_all_subsets__when_list_is_empty__then_output_contains_only_empty_set(self): self.assertListEqual([set()], generate_all_subsets([...
0aaddae51f3bcbaa047ea18f9189c86398cbe6bb
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/compress_array_of_characters_with_repeats.py
1,560
3.828125
4
# Task: # # Given an array of characters with repeats, compress it in place. The length after compression should be less than or # equal to the original array. # # Example: # Input: ['a', 'a', 'b', 'c', 'c', 'c'] # Output: ['a', '2', 'b', 'c', '3'] # Here's a starting point: # # class Solution(object): # def compress...
507af745553533609c9947660af705d0f1561399
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/delete_nodes_of_binary_tree_to_make_tree_full.py
3,779
3.828125
4
# Task: # # Given a binary tree, remove the nodes in which there is only 1 child, so that the binary tree is a full binary tree. # # So leaf nodes with no children should be kept, and nodes with 2 children should be kept as well. # # Here's a starting point: # # from collections import deque # # class Node(object): # ...
c3df034df51bde42781c46334861f27a722ce9cd
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_find_longest_substring_with_k_distinct_characters.py
1,010
3.53125
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.find_longest_substring_with_k_distinct_characters import \ find_longest_substring_with_k_distinct_characters class Test(TestCase): def test_find_longest_substring_with_k_distinct_characters__when_input_is_aabcdefff_and_3_...
3bc100a666f97667e971e8f2bd0a8869c6406e8b
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_remove_recursively_2_same_adjacent_characters.py
939
3.890625
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.remove_recursively_2_same_adjacent_characters import \ remove_recursively_2_same_adjacent_characters class Test(TestCase): def test_remove_recursively_2_same_adjacent_characters__when_input_is_cabba__then_there_are_two_re...
04269da9800ce546e8c89a5d9cba8b74b102e05d
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/swap_every_two_nodes_in_linked_list.py
1,632
4.15625
4
# Task: # # Given a linked list, swap the position of the 1st and 2nd node, then swap the position of the 3rd and 4th node etc. # # Here's some starter code: # # class Node: # def __init__(self, value, next=None): # self.value = value # self.next = next # # def __repr__(self): # return f"{self.value}, (...
153e50234bebc929e16c4de4b84b1bb613df6bf7
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/serialize_and_deserialize_binary_tree.py
4,182
4.0625
4
# Task: # # You are given the root of a binary tree. You need to implement 2 functions: # # 1. serialize(root) which serializes the tree into a string representation # 2. deserialize(s) which deserializes the string back to the original tree that it represents # # For this problem, often you will be asked to design you...
17202bd7805cdea8aad53c14c9959600720b8464
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_reshape_matrix.py
746
3.578125
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.reshape_matrix import reshape_matrix class Test(TestCase): def test_reshape_matrix__when_number_of_elements_in_new_matrix_would_be_different__then_result_is_none(self): self.assertIsNone(reshape_matrix([[1, 2], [3, 4]...
9bc2a6d6e17d9fbaed6d1452d4ca90771e85d431
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_add_two_integers_stored_reversed_in_linked_lists.py
1,186
3.921875
4
from typing import List, Optional from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.add_two_integers_stored_reversed_in_linked_lists import \ ListNode, Solution class TestSolution(TestCase): def test_add_two_numbers__when_742_plus_24465__then_reversed_25207_is_returned(s...
c9efaa7b93fe39753d9e6ea86d40494b8d4f6750
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_calculate_xth_fibonacci_number.py
798
3.609375
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.calculate_xth_fibonacci_number import Solution class TestSolution(TestCase): def test_calculate_xth_fibonacci_number__when_n_is_0__then_result_is_0(self): self.assertEqual(0, Solution.calculate_xth_fibonacci_number(0)...
f68cbbaf24c0077f298bc55d966fd96c21e2435f
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/check_if_there_are_two_items_in_list_resulting_with_target_number.py
1,171
4.03125
4
# Task: # # You are given a list of numbers, and a target number k. Return whether or not there are two numbers in the list that # add up to k. # # Example: # Given [4, 7, 1 , -3, 2] and k = 5, # return true since 4 + 1 = 5. # # Try to do it in a single pass of the list. # # def two_sum(list, k): # # Fill this in. # ...
86f5d1e53721b9b7c83202c8900681d4d2ac3150
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_convert_string_to_integer_with_ord_function.py
1,074
3.875
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.convert_string_to_integer_with_ord_function import \ convert_string_to_integer_with_ord_function class Test(TestCase): def test_convert_string_to_integer_with_ord_function__when_input_is_negative_integer__then_conversion_...
cc2d33ae78495714b158947820c819a25734ed64
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/find_shortest_distance_of_characters_to_given_character.py
1,560
4.15625
4
# Task: # # Given a string s and a character c, find the distance for all characters in the string to the character c in # the string s. You can assume that the character c will appear at least once in the string. # # Here's an example and some starter code: # # def shortest_dist(s, c): # # Fill this in. # # print(sh...
1dc29418a4324e658afdddbabd372c2dbe9ae97c
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/find_characters_appearing_in_all_strings.py
862
4.15625
4
# Task: # # Given a list of strings, find the list of characters that appear in all strings. # # Here's an example and some starter code: # # def common_characters(strs): # # Fill this in. # # print(common_characters(['google', 'facebook', 'youtube'])) # # ['e', 'o'] from typing import List, Set def find_characters...
41074fb77e7aca0c9056dc9259249be9a14bdc3a
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_find_sublist_of_non_adjacent_numbers_with_largest_sum.py
1,735
4.0625
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.find_sublist_of_non_adjacent_numbers_with_largest_sum import \ find_sublist_of_non_adjacent_numbers_with_largest_sum class Test(TestCase): def test_find_sublist_of_non_adjacent_numbers_with_largest_sum__when_input_is_empt...
f060ec4f285dc5f6bf43a4c8f00ca0f77a161afd
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_convert_to_binary_representation.py
875
3.640625
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.convert_to_binary_representation import \ convert_to_binary_representation class Test(TestCase): def test_convert_to_binary_representation__when_123__then_1111011(self): # 2^6 + 2^5 + 2^4 + 2^3 + 2^1 + 2^0 = 123 ...
9e6ca28b0657297cd3223daef3a3fb6eee2e0ec9
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/reverse_integer_without_converting_it_to_string.py
677
4.3125
4
# Task: # # Given an integer, reverse the digits. Do not convert the integer into a string and reverse it. # # Here's some examples and some starter code. # # def reverse_integer(num): # # Fill this in. # # print(reverse_integer(135)) # # 531 # # print(reverse_integer(-321)) # # -123 from math import floor def reve...
d720bec8f8a39a08d7eba61fb7006042e54394e8
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/reverse_binary_representation_of_integer.py
980
4.15625
4
# Task: # # Given a 32 bit integer, reverse the bits and return that number. # # Example: # # Input: 1234 # # In bits this would be 0000 0000 0000 0000 0000 0100 1101 0010 # Output: 1260388352 # # Reversed bits is 0100 1011 0010 0000 0000 0000 0000 0000 # # Here's some starter code: # # def to_bits(n): # return '{0:0...
9e1f8ae86d4092c5105f8ab43ff0356c00777fea
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/search_in_matrix_with_sorted_elements.py
2,075
4.25
4
# Task: # # Given a matrix that is organized such that the numbers will always be sorted left to right, and the first number of # each row will always be greater than the last element of the last row (mat[i][0] > mat[i - 1][-1]), search for # a specific value in the matrix and return whether it exists. # # Here's an ex...
72d36ea3bdcc954261e0f655eaca016646d5419c
Sandeep8447/interview_puzzles
/src/main/python/com/skalicky/python/interviewpuzzles/calculate_rainwater_in_puddles.py
3,715
3.96875
4
# Task: # # You have a landscape, in which puddles can form. You are given an array of non-negative integers representing # the elevation at each location. Return the amount of water that would accumulate if it rains. # # For example: [0,1,0,2,1,0,1,3,2,1,2,1] should return 6 because 6 units of water can get trapped he...
50a9cdba6096337b40932777b4d3f05cb3c569b3
Sandeep8447/interview_puzzles
/src/test/python/com/skalicky/python/interviewpuzzles/test_find_k_closest_elements_to_pivot.py
1,037
3.6875
4
from unittest import TestCase from src.main.python.com.skalicky.python.interviewpuzzles.find_k_closest_elements_to_pivot import \ find_k_closest_elements_to_pivot class Test(TestCase): def test_find_k_closest_elements_to_pivot__when_there_are_not_too_many_numbers_in_same_distance_from_x_which_will_be_selecte...
c16dcb1c70b593e586a35585387d290658d2593e
guangxiong/python
/python蟒蛇绘制.py
565
3.828125
4
import turtle def drawsnake(rad, angle, len, neckrad): for i in range(len): turtle.circle(rad,angle) turtle.circle(-rad,angle) turtle.circle(rad, angle/2) turtle.fd(rad) turtle.circle(neckrad+1, 180) turtle.fd(rad*2/3) def main(): turtle.setup(1300, 800, 0, 0) #启动窗体的大小 py...
7eea73f2f3b4bf4e59ab003e3b24e04ab49df94b
pedrorpmoura/behavior-trees
/example/game2.py
11,518
3.5625
4
import pygame import random import sys import math import out width = 512 height = 512 FREE = 0 WALL = 1 PLAYER = 2 BALL = 3 LEFT = "left" RIGHT = "right" UP = "up" DOWN = "down" def position_inside_borders(p, board): if p[0] < 0 or p[0] > board.size - 1 or p[1] < 0 or p[1] > board.size - 1: return F...
c23397f208ba2d46ae74126c8c0ec627b5e8b892
riccardoscheda/Bologna-Against-COVID
/pipeline/plot.py
4,957
3.625
4
import pandas as pd from bokeh.plotting import figure from bokeh.models import ColumnDataSource, CustomJS, CDSView, Select, IndexFilter from bokeh.io import save from bokeh.layouts import column from datetime import timedelta from utils import create_dataset def covid_plot(cases_file, preds_file): """ Makes an inte...
081ce9b1a3246ce5ef3d35c21fc2640957716222
choiseoungho/ssafy
/Day2/2장/ex4.py
815
3.65625
4
# 단어어 해당 단어의 빈도수를 담은 리스트를 선언합니다. 수정하지 마세요. pairs = [ ('time', 8), ('the', 15), ('turbo', 1), ] def get_freq(pair): ''' (단어, 빈도수) 쌍으로 이루어진 튜플을 받아, 빈도수를 리턴합니다. >>> get_freq(('time', 8)) 8 ''' return pair[1] def sort_by_frequency(...
bbcec8fa806744721cb23e60c109905cb27d4127
choiseoungho/ssafy
/Day2/2장/ex3.py
554
3.953125
4
# 단어 모음을 선언합니다. 수정하지 마세요. words = [ 'apple', 'banana', 'alpha', 'bravo', 'cherry', 'charlie', ] def filter_by_prefix(words, prefix): ''' prefix로 시작하는 word를 린턴합니다. >>> filter_by_prefix(words, 'a') 'apple' ''' ...
2e8fc55767fbd0a67da48545b20a16133e48fa55
YoucefBenAli/ITI1120-Assignments
/Assignment 5/a5_part1_XXXXXXXX.py
3,159
4
4
# Course: IT1 1120 # Assignment number 5 # Youcef Ben Ali # XXXXXXXX # Part 1 import string def printing(coexistance, query): '''(Set, String) -> None Prints the lines in the set ''' query = query.strip() coexistance = list(coexistance) if len(coexistance) == 0: print(f"The word...
b7068ab6e802d303ad7520f9df16c5d8017f1bd8
yakovkoshkin/python-basics
/examples_2/05_string.py
1,280
3.734375
4
# -*- coding: utf-8 -*- from examples_2.utils import print_stars single_line_byte_string = "single line byte string" print(single_line_byte_string) print_stars() multi_line_byte_string = """Multi Line Byte String""" print(multi_line_byte_string) print_stars() single_line_unicode_string = u"single line unicode string...
f642fa02100c9f84619a64987cf7160b51b50cd0
yakovkoshkin/python-basics
/practice_1/simeon.py
259
3.796875
4
import sha name = raw_input("What's your first name? > ") name = name.lower() file_name = '{}.txt'.format(name) with open(file_name, 'w') as f: name_hash = sha.new(name).hexdigest() f.write(name_hash) print('Hash saved to {}.'.format(file_name))
32288e1107441da4664c2444c9a51336a80df936
PerryHuan9/LearnPython
/vs develop/AlienInvasion.py/Bullet.py
889
3.59375
4
import pygame from pygame.sprite import Sprite class Bullet(Sprite): """description of class""" def __init__(self,settings,screen,ship,image): super(Bullet,self).__init__() self.screen=screen self.image=pygame.image.load(image) #self.rect=pygame.Rect(0,0,settings.bullet_width,se...
b27403e16bbfd7accae3fe1a046aee05e4dc6d41
jessicagamio/robot_in_grid
/robot.py
1,051
3.6875
4
def get_path(grid): """return the path clear of any block""" if grid == None or len(grid)==0: return None path =[] block = [] if eval_grid(grid, len(grid)-1, len(grid[0])-1, path, block): return path def eval_grid(grid, row, col, path, block): """return true if path is not bl...
47232703e4a8fad77febca6d514b246c14788dc1
JeSaisPaz/PasswordCreator
/PCreator.py
226
3.859375
4
import random import string charnum = int(input("How many characters in your password ? > ")) strg = "" acceptedstrings = string.printable[:-5] for x in range(0, charnum): strg += random.choice(acceptedstrings) print(strg)
77b46c3a496f3a8e7c3865192d0d5fc83724b225
MyCuteGuineaPig/coursera
/RNN/week1/Building a RNN - Step by Step.py
26,137
3.59375
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Created on Wed Feb 17 10:47:39 2021 @author: beckswu """ import numpy as np from rnn_utils import * def rnn_cell_forward(xt, a_prev, parameters): """ Implements a single forward step of the RNN-cell as described in Figure (2) Arguments: xt -- you...
8a5fcc17e24a57d5783b8f91a7a41f480171d9c3
ksu-is/Hotel-Python
/hotelpython2.py
1,949
4.125
4
print("Welcome to Hotel Python!") print("\t\t 1 Booking") print("\t\t 2 Payment") print("\t\t 3 Guest Requests") print("\t\t 4 Exit") reservation=" " payment=" " payment_method=" " requests=" " def guest_info(reservation="A"): print("Please collect guest information such as name, phone number, and dates of stay")...
9858236a4daf5ae0adf79442fd661d588d611887
JohnnyB95/LearnPython
/ex6.py
503
3.75
4
#Variable Declaration x = "There are %d types of people." %10 binary = "binary" do_not = "don't" y = "Those who know %s and those who %s" % (binary, do_not) #Print strings print x print y print "I said: %r." % x print "I also said: '%s'." % y #Set Boolean and new string hilarious = False joke_evaluation = "Isn't t...
d8b531f9849e39315fdcf3253736745a69b24517
AnnaBernakevich/infa_2021_solovev
/2_draw_refact.py
3,725
3.546875
4
import pygame from pygame.draw import * pygame.init() # просто задача частоты и ширины/высоты открываемого экрана картинки fps = 30 width = 600 high = 600 # задаю цвета black = (0, 0, 0) blue = (0, 20, 140) rama = (150, 150, 150) grey = (192, 192, 192) brown = (153, 76, 0) green = (0, 204, 0) dark...
dffc9614b035d5ff6205f1958a74687f350e2f9b
OctavioMaia/PLC_SPLN
/spln2018/aulas/a8/chatbot.py
629
3.6875
4
#!/usr/bin/python3 import re import random def resp(inp): for (patt,resps) in regras: r = re.findall(patt,inp) if r : res = random.choice(resps) if callable(res) : return res(r[0]) else: return res return "Não entendi" inp = ...
68033b74825ff885f9c7a3ce2d05e487c5fc430c
snehithraj27/KNN-Implementation-Python
/kNN.py
4,473
3.609375
4
# Snehith Raj Bada import pandas as pd import numpy as np import math import operator #Calculate neighbours ans sort based on euclidean distance def getNeighbors(training, testing, k): distances = [] length = testing.shape[0] - 1 # Find distance between each object of training dataset with every object o...
b6275bfda0a07584df970bc4ae4bca1bfb73af31
whatisakeagan/learnin
/introtoprogrammingudacity/week3/secretmessage.py
617
3.90625
4
import os def rename_files(): # Get filename from a folder file_list = os.listdir("/Users/Keagan/Dropbox/Udacity/IPND/Stage_3/alphabet") print (file_list) saved_path = os.getcwd() print("Current working directory is " + saved_path) os.chdir("/Users/Keagan/Dropbox/Udacity/IPND/Stage_3/alphabet") # for each file...
2f06454fe78f2eaafa3b2f637dc984890de593cc
ewong11/ai
/pqueue_heap.py
1,059
3.59375
4
#! /usr/bin/python import sys def OrdinaryComparison(a,b): if a < b: return -1 if a == b: return 0 else: return 1 def my_cmp(a,b): if len(a) < len(b): return -1 if len(a) == len(b): return 0 return 1 class Node(): def __init__(self, data): self.data=data self.parent=None self.L...
864b49d01956c5cb927a2fce01d1fd9a3018754e
twesigomwedavid/coding-challenges
/mod_fib_2.py
1,082
3.859375
4
#run for n months, rabbits die after m months. n, m = input("Enter months to run, and how many months rabbits live, separated by a space ").split() n, m = int(n), int(m) generations = [1, 1] #Seed the sequence with the 1 pair, then in their reproductive month. def fib(i, j): count = 2 while (count < i): ...
f1302aa00c55f2be9f1bd4a9370f3c21d0073396
hahsuu/python-learning
/day01/guess_lucky_number_v2.py
558
3.859375
4
luckyNumber = 13 inputNum = int(input("请输入你的幸运数字:")) guess_count = 0 print(guess_count) while luckyNumber != inputNum: if inputNum < luckyNumber: print("请再输入大一点的数。") elif inputNum > luckyNumber: print("请再输入小一点的数。") #print("****************") guess_count += 1 #print(guess_count) ...
249e29b8f8c63d2b59939b0304e2069c77f3b830
SauryStand/FakeNewsDetection
/tools/clean_data.py
696
3.59375
4
def clean_data(dataframe): # Drop duplicate rows dataframe.drop_duplicates(subset='tweetText', inplace=True) # Remove punctation dataframe['tweetText'] = dataframe['tweetText'].str.replace('[^\w\s]', ' ') # Remove numbers dataframe['tweetText'] = dataframe['tweetText'].str.replace('[^A-Za-z]...
b29fae2cf2532e4d6a3e613021ec0ed77c05ae28
MuhammadAliQureshi93/Chaos-System-Python-Code-Amalgamated-Image-Encryption-Electronic-Circuit
/Ruthz Howritz Criterion.py
2,785
3.5
4
# -*- coding: utf-8 -*- """ Created on Fri Aug 26 11:02:09 2022 @author: Muhammad Ali Qureshi """ import numpy as np a=1;b=.7;c=-100;r=1.5; bb=4; alp=20; bet=.02 ; q=.98 a0=1; a1=2*a+b+1 a2=a**2 + 2*a*b**2 -a*c + 2*a + b - 80*c + r a3= a**2*b - a**2*c + a**2 -a*b*c +2*a*b -80*a*c -80*b*c +b*r +r a4= -...
0d2f9fa44698c15514d603423ddac7a205bb0e53
hirsiAbdollahi/NLP-Youtube-Comments-Analysis
/database/db.py
1,955
3.84375
4
import sqlite3 class Database: def __init__(self,db_name='./database/sqlite.db'): self.db_name = db_name self.db = sqlite3.connect(db_name) # self.table = table #Add table def add_table(self,table_name): # self.db.execute("CREATE TABLE IF NOT EXISTS self.table (commentId VARCHAR PRIMARY KEY,t...
e513f6dd2b210ddcbc1b4143eed90de3a32cad43
liuweiming1997/tools-for-work
/parse-csv-to-json.py
1,933
3.515625
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- import argparse import csv import random import string parser = argparse.ArgumentParser(description='manual to this script') parser.add_argument('--file', type=str, default='xxx.csv', help="The file you want to parse") args = parser.parse_args() data = {} secret_key = '...
4def48797339ea9dbe02cd4328164651983cd5fd
DaVaHa/ScriptsLibrary
/library_matplotlib.py
795
3.953125
4
''' PYTHON LIBRARY : matplotlib ''' # visualize linear relationship import matplotlib.pyplot as plt ## black round points & red model line fig, axis = plt.subplots() # Create figure and axis objects and call axis.plot() twice to plot data and model distances versus times axis.plot(times, measured_distances, linesty...
e335b2cdd37c0c816a60d3b0a41d188c0be5c2d3
nara15/rit
/EXAMPLES/file_create/dict_safe.py
438
3.546875
4
import pickle ## I am making up a dictionary here to show you how this works... ## Because I want to store this outside of this single run, it could be that this ## dictionary is dynamic and user based - so persistance beyond this run has ## meaning for me. myMadeUpDictionary = {"one": "banana", "two": "banana", "th...
f1b617b1877862c249e630cb21f5dd456ff59dc2
michaeljulianwang/Polygon-Proposal-Algo
/linestringProposals.py
15,982
3.5
4
import geopandas as gpd import matplotlib.pyplot as plt from shapely.geometry import Point import math as m from descartes import PolygonPatch from matplotlib.ticker import FormatStrFormatter import numpy as np import pandas as pd def newPoint(lat, lon, direction, distance): ''' Inputs: initial lat, lon pair,...
02c761847472187355dc52401b1e8b1158ac0871
ahmnouira/getting_started_with_micropython
/src/fading_led_pot.py
428
3.515625
4
# Fading LED every 0.5 by reading data from Potentiometer import machine from time import sleep led_pin = 5 # led pin pot_pin = 0 # ADC0 pin LED = machine.PIN(led_pin) # create LED object LED_pwm = machine.PWM(LED, freq=500) # create LED_pwm object and set frequency to 500Hz while True: LED_pwm.d...
33b01093545978d42a23df235f743370cde7bf4b
Avinash711/leetcode-problem-solving-avinash
/problem-solving/longestCommonPrefix.py
1,642
3.75
4
strs = ["flower","flow","flight"] #strs = ["dog","racecar","car"] #strs = ["ab", "a"] #strs =['a'] def longestCommonPrefix(strs): """ :type strs: List[str] :rtype: str """ if not strs: return "" shortest = min(strs,key=len) #print(shortest) fo...
5ba0eb0652b48f3314a0c77d9dc69740d8af7384
Avinash711/leetcode-problem-solving-avinash
/problem-solving/consecutiveOccur.py
704
3.921875
4
''' count the consecutive occurrence when consecutive occurrence is more than 2 included 00100 o/p 00, 00 ip 01100011 o/p 11,000,11 (3 consecutive terms) ''' str = '000110000111000' # 000 11 0000 111 000 count = 0 for i in range(len(str)-1-1): # for ist and middle element occurrence if str[i] != str[i+1]: ...
ce28d62c572c8d4c6cf82aca1cfc478215dfe14d
RaulAranovich/SpanishCorpusXIX
/ocr-post-processing/ocr-post-processing-draft.py
3,042
3.5
4
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ Author: Nicole Dodd (ncdodd@ucdavis.edu) Purpose of this script: Process OCR output and generate suggestions for error correction Step 1: Check words against Spanish dictionary for misspellings Step 2: Extract trigrams of misspelled words Step 3: Find candidates for...
4f6238a88538e032f553b15a0f11834ee516c812
kalyansikdar/ctci-linkedlist
/sumLists.py
2,828
3.796875
4
class node(): def __init__(self, data): self.data = data self.next = None def print_node(head): current = head while current!=None: print(current.data) current = current.next def sumLists(ll1, ll2): cur1 = ll1 cur2 = ll2 count1=0 count2=0 result = [] ...
b4c0000ba82fb41bd6f2ec43fe68fd2e3053d242
lancha41/python_base
/hw_0_2.py
230
4.09375
4
import math a=int(input('Enter first side of triangle: ')) b=int(input('Enter second side of triangle: ')) c=int(input('Enter third side of triangle: ')) p=(a+b+c)/2 s=math.sqrt(p*(p-a)*(p-b)*(p-c)) print('Area of triangle:',s)
ce09f1c9ebded1b1b2716f017583dea3d4cf5a23
rfaroul/Activities
/Week03/3/lists.py
1,601
4.28125
4
prices = ["24","13","16000","1400"] price_nums = [int(price) for price in prices] print(prices) print(price_nums) dog = "poodle" letters = [letter for letter in dog] print(letters) print(f"We iterate over a string into a list: {letters}") capital_letters = [letter.upper() for letter in letters] print(capital_letters)...
1c1c3ee4a4a221cecb14e4367447520a66e63dfc
chaitanyakrishnateja/pythonProject
/practice/weightconv.py
313
3.96875
4
weight = input("Enter weight >>>") units = input("(L)bs or (K)g") if units.upper() == "K" : value = float(weight) * 2.20462262185 print("your " + str(value) + "Lbs") elif units.upper() == "L" : value = float(weight) * 0.45359237 print("your " + str(value) + "Kgs") else: print("try later....")
9a1ac895be7f7dd8267d66e322865df3d7195adc
vetlesolgaard/OpenCVSudokuSolver
/Layout.py
1,265
3.59375
4
from Square import * class Layout(object): def __init__(self, length): self.squares = [0 for x in range(0,length)] def addsquare(self, square): for x in range(0, len(self.squares)): if self.squares[x] is 0: self.squares[x] = square #print square.numbe...
668cc81752cacd4862c20a062567466b0be0c6df
ShinjiKatoA16/mcpc2018ucsy
/prob_f.py
657
3.71875
4
#!/usr/bin/python3 # -*- coding: utf-8 -*- import sys symmetry = {'A':1, 'B':1, 'C':1, 'D':1, 'E':1, 'F':0, 'G':0, 'H':2, 'I':2, 'J':0, 'K':0, 'L':0, 'M':1, 'N':0, 'O':2, 'P':0, 'Q':0, 'R':0, 'S':0, 'T':1, 'U':1, 'V':1, 'W':1, 'X':2, 'Y':1, 'Z':0} def value(s): worth = 0 ...
aa1f64170a197d8de3da50673c26019f0cf183e7
patmaneg/pythonTests
/ahorcado.py
4,331
3.5625
4
# -*- coding: utf-8 -*- """ Created on Fri Apr 10 10:59:52 2020 @author: patri """ import random ahorcado = [''' +---+ | | | | | | =========''', ''' +---+ | | O | | | | =========''...
d13ea6ce63d341b21d44457b31bc6d7905da75c3
C-TAM-TC1028-001-2113/tarea-1-Andresperalta01
/assignments/09Telefono/excercise09.py
321
3.78125
4
def main(): # escribe tu código abajo de esta línea msjs = int(input('dame el numero de mensajes')) megs = float(input('dame el numero de megas')) min = int(input('dame el numero de minutos')) m = (msjs+megs+min) * 0.8 print('el costo mensual es de:', m) if __name__ == '__main__': main()
6ce9f63a3278f868f64ff8b2d24601b1b8b34819
samnewga/statistical_ai_track_2
/linear_search.py
3,640
4.25
4
import turtle print("Welcome to the Searching AI Track Robot" "\nThis bot will run in three different modes to find a stationary object in a 10x10 grid" "\n\n Modes: " "\n-Linear Search(Increases the position by one place)" "\n-Binary Search(Uses a binary equation)" "\n-Random Search(Rand...
6d7f799327a5a6d1ab192bda60868584736959f6
tasneemfarag/holbertonschool-higher_level_programming
/divide_and_rule/h_sum.py
1,701
3.65625
4
import threading class Sum(): '''Class attribute''' sum_of_ints = 0 '''Constructor''' def __init__(self, nb_threads, numbers): if not isinstance(nb_threads, int): raise Exception("nb_threads is not an integer") self.__nb_threads = nb_threads if not all(isinstance(n, int) for n in numbers): raise Exce...
bc2dd400c060024e0205b86d8d14979908499430
Nate-Zbacnik/Text-Alignment
/text_alignment.py
6,278
3.671875
4
# -*- coding: utf-8 -*- """ Created on Thu Mar 7 12:32:39 2019 @author: NATE This program implements a text search algorithm via local alignment, using a scoring method and dynamic programming implementation to find good matches in a long piece of text to an input string given by the user. The comparison be...
31d95774e4bb83f0af7bd0b272b4ea4a34e7ec99
maxthyron/Encryption
/encryption1/functions.py
1,425
3.671875
4
def create_matrix(size): matrix = [] for i in range(size): line = [] for j in range(size): line.append(size * i + j + 1) matrix.append(line) return matrix def create_null_matrix(size): null_matrix = [] for i in range(size): null_matrix.append([0] * si...
a9a126c09ea31fd436771775cee74a487a2cd528
keyasu/30DaysOfPython
/30DaysOfPython/06_days_ Tuples.py
2,705
4.34375
4
print('days-06-Tuples') """ 元组是有序且不可更改(不可变)的不同数据类型的集合。 元组用圆括号 () 书写。 一旦创建了一个元组,我们就不能改变它的值。 我们不能在元组中使用 add、insert、remove 方法,因为它不可修改(可变)。 与列表不同,元组的方法很少。 与元组相关的方法: tuple(): 创建一个空元组 count():计算元组中指定项的个数 index():在元组中查找指定项的索引 运算符:连接两个或多个元组并创建一个新元组 """ # syntax """ tpl = ('item1', 'item2','item3') pr...
0c807b1d964ed951c53c43bf8f2919502d7556ef
ernie/rubyconf_2013_keynote
/person.py
256
3.5625
4
#!/usr/bin/env python class Person: def __init__(self, name, age): self.name = name self.age = age person = Person('Ernie', 36) print person.name print person.age person.nonexistent_attribute = 'Seriously?' print person.nonexistent_attribute
8c3e51f656c307af2f1167dc1fa0d0f907b27d2c
guillempuigcomerma/Exercise.github.io
/goldenspear-backend/caesarEncrypt.py
711
4.375
4
import sys def caesarEncrypt(text,s): alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q', 'r', 's', 't', 'u', 'v', 'w', 'x', 'y', 'z'] result = "" text = text.lower() # transverse the plain text for i in range(len(text)): char = text[i] # Encrypt ...
b9581be1446623abef853ed660a0d7e908393aeb
WilsonKinyua/beautiful-soup
/main.py
826
3.765625
4
from bs4 import BeautifulSoup # with open('website.html') as file: # contents = file.read() # soup = BeautifulSoup(contents, 'html.parser') # # print(soup.title) # all_achor_tags = soup.find_all(name='p') # # print(all_achor_tags) # # for tags in all_achor_tags: # # print(tags.text) # the_heading_with_id ...
5d6003b3f4395ea287ac5787a4ada8bbf5a17a02
edsonvalher/ibm-machinelearning
/practice.py
213
3.84375
4
class Points(object): def __init__(self, x, y): self.x = x self.y = y def print_point(self): print('x=', self.x, ' y=', self.y) p2 = Points(1, 2) p2.x = 2 p2.print_point()
821f9a0d094f177d3a7b2c2cbf8ed3fee0967e3e
Jayden-Liang/mypractice
/Algorithem/栈和队列/stack.py
568
4.28125
4
# 因为Stack是存和取最后位置的数据 # 非常简单,就是利用list的append, remove, 和索引查询, class Stack(object): def __init__(self): self.data = [] self.size = 0 def add(self, data): self.data.append(data) self.size +=1 def pop(self): self.data.remove(self.data[-1]) self.size -=1 de...
316b0d1b6eb5c3e6408783d8ac930f3b5a0baf67
Jayden-Liang/mypractice
/Algorithem/二叉树/binary_search_tree.py
5,310
3.75
4
def _check_add(ins, t_root): if ins.data < t_root.data: if t_root.left_node is not None: _check_add(ins, t_root.left_node) else: t_root.left_node = ins else: if t_root.right_node is not None: _check_add(ins, t_root.right_node) else: ...
792ba25d3d1709c5c548e44a1ff5aa5c1a285b06
sfischer13/python-stringmetric
/stringmetric/distance/hamming.py
210
3.671875
4
def compare(this, that): if not this or not that or len(this) != len(that): return None elif this == that: return 0 else: return sum(1 for a, b in zip(this, that) if a != b)
131f1147267852294f9674c7b6883c1f5f580d7d
minhazalam/py
/data_collectn_and_processing/week_1/nested_iteration.py
443
4.5
4
# In this program we'll implement the nested iteration concepts using # * two for loops # * one loop and a square bracket(indexing) # * indexing(square bracket) and a for loop # nested list nested1 = [1, 2, ['a', 'b', 'c'],['d', 'e'],['f', 'g', 'h']] # iterate for x in nested1: # outer loop print("level1: ")...
4448b46aeb6c9ba1ea874f52aa7a0a8a10c761d7
minhazalam/py
/class_inheritance/inheritance/inheritance.py
827
4.28125
4
# Intro : Inheritance in python 3 # current year CURRENT_YEAR = 2020 # base class class Person: # constructor def __init__(self, name, year_born): self.name= name self.year_born = year_born # def methods def get_age(self): return CURRENT_YEAR - self.year_born # def _...