blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
2044a3f44b9af55830532e836ddd2505dd5346b3
gmastorg/CTI110
/M6T2_FeetToInchesConverter_Canjura.py
500
4.25
4
#Gabriela Canjura #CTI110 #10/30/2017 #M6T2: feet to inches converter def main(): #calls a funtions that converts feet to inches and prints answer feet = float(0) inches = float(0) feet = float(input("Enter a distance in feet: ")) print('\t') inches = feet_to_inches(f...
false
dfd38f505944aeb4fee6fa57bda110fa84952084
ajorve/pdxcodeguild
/json-reader/main.py
1,131
4.5
4
""" Objective Write a simple program that reads in a file containing some JSON and prints out some of the data. 1. Create a new directory called json-reader 2. In your new directory, create a new file called main.py The output to the screen when the program is run should be the following: The Latitude/Longi...
true
dbfe81b01a012a936086b78b5344682238e88ea5
ajorve/pdxcodeguild
/puzzles/fizzbuzz.py
1,145
4.375
4
""" Here are the rules for the FizzBuzz problem: Given the length of the output of numbers from 1 - n: If a number is divisible by 3, append "Fizz" to a list. If a number is divisible by 5, append "Buzz" to that same list. If a number is divisible by both 3 and 5, append "FizzBuzz" to the list. If a number meets none ...
true
5733f941bb23cec0470a41d4bb6ab1f78d86bd73
ajorve/pdxcodeguild
/warm-ups/pop_sim.py
2,021
4.375
4
""" Population Sim In a small town the population is 1000 at the beginning of a year. The population regularly increases by 2 percent per year and moreover 50 new inhabitants per year come to live in the town. How many years does the town need to see its population greater or equal to 1200 inhabitants? Write a fun...
true
8b4fcea87d0a7ac318a2f9c0b0ae019175d7e291
juan6630/MTIC-Practice
/Python/clase11.py
1,273
4.15625
4
def dos_numeros(): num1 = float(input('Ingrese el primer nรบmero')) num2 = float(input('Ingrese el segundo nรบmero')) if num1 == num2: print(num1 * num2) elif num1 > num2: print(num1 - num2) else: print(num1 + num2) def tres_numeros(): num1 = float(input('Ingrese el prime...
false
24442d594ecf27a0df3058aff922011d6953e8dc
YoungWoongJoo/Learning-Python
/bool/bool2.py
733
4.46875
4
""" or์—ฐ์‚ฐ์˜ ๊ฒฐ๊ณผ๋Š” ์•ž์˜ ๊ฐ’์ด True์ด๋ฉด ์•ž์˜ ๊ฐ’์„, ์•ž์˜ ๊ฐ’์ด False์ด๋ฉด ๋’ค์˜ ๊ฐ’์„ ๋”ฐ๋ฆ…๋‹ˆ๋‹ค. ๋‹ค์Œ ์ฝ”๋“œ๋ฅผ ์‹คํ–‰ํ•ด์„œ ๊ฐ๊ฐ a์™€ b์— ์–ด๋–ค ๊ฐ’์ด ๋“ค์–ด๊ฐ€๋Š”์ง€ ํ™•์ธํ•ด ๋ณด์„ธ์š”. a = 1 or 10 # 1์˜ bool ๊ฐ’์€ True์ž…๋‹ˆ๋‹ค. b = 0 or 10 # 0์˜ bool ๊ฐ’์€ False์ž…๋‹ˆ๋‹ค. print("a:{}, b:{}".format(a, b)) """ a = 1 or 10 # 1์˜ bool ๊ฐ’์€ True์ž…๋‹ˆ๋‹ค. b = 0 or 10 # 0์˜ bool ๊ฐ’์€ False์ž…๋‹ˆ๋‹ค. print("a:{}, b:{}".format...
false
f7b72f1287d5a2b3c61390235c41b2fd81681a5b
YoungWoongJoo/Learning-Python
/function/function2.py
705
4.3125
4
""" ํ•จ์ˆ˜ add๋Š” ๋งค๊ฐœ๋ณ€์ˆ˜๋กœ a์™€ b๋ฅผ ๋ฐ›๊ณ  ์žˆ์Šต๋‹ˆ๋‹ค. ์ฝ”๋“œ์˜ 3๋ฒˆ์งธ ์ค„์„ ์ˆ˜์ •ํ•ด์„œ result์— a์™€ b๋ฅผ ๋”ํ•œ ๊ฐ’์„ ์ €์žฅํ•˜๊ณ  ์ถœ๋ ฅ๋˜๋„๋ก ๋งŒ๋“ค์–ด ๋ณด์„ธ์š”. def add(a,b): #ํ•จ์ˆ˜ add์—์„œ a์™€ b๋ฅผ ์ž…๋ ฅ๋ฐ›์•„์„œ ๋‘ ๊ฐ’์„ ๋”ํ•œ ๊ฐ’์„ result์— ์ €์žฅํ•˜๊ณ  ์ถœ๋ ฅํ•˜๋„๋ก ๋งŒ๋“ค์–ด ๋ณด์„ธ์š”. result = print( "{} + {} = {}".format(a,b,result) )#print๋ฌธ์€ ์ˆ˜์ •ํ•˜์ง€ ๋งˆ์„ธ์š”. add(10,5) """ def add(a,b): #ํ•จ์ˆ˜ add์—์„œ a์™€ b๋ฅผ ์ž…๋ ฅ๋ฐ›์•„์„œ ๋‘ ๊ฐ’์„ ๋”ํ•œ ๊ฐ’์„ resul...
false
8523f0d7a6dd5773e2b947e5302906f1f385187d
kevinwei666/python-projects
/hw1/solution1/Q4.py
634
4.625
5
""" Asks the user to input an integer. The program checks if the user entered an integer, then checks to see if the integer is within 10 (10 is included) of 100 or 200. If that is the case, prints โ€˜Yesโ€™, else prints โ€˜Noโ€™. Examples: 90 should print 'Yes' 209 should also print 'Yes' 189 should print 'No' """ #Get use...
true
e19fc7953dc495fef5987d49d2a6febb41042ef5
igorsobreira/playground
/problems/notifications.py
1,151
4.1875
4
''' Eu tenho um objeto da classe A que muda muito de estado e objetos das classes B e C que devem ser notificados quando o objeto da classe A muda de estado. Como devo projetar essas classes? ''' class Publisher(object): def __init__(self): self.status = "FOO" self._subscribers = [] ...
false
e095d54de54855fbf5c006b6fe47ee93e51fd5ba
DinakarBijili/Data-structures-and-Algorithms
/BINARY TREE/11.Top View of Binary Tree .py
1,394
4.28125
4
""" Top View of Binary Tree Given below is a binary tree. The task is to print the top view of binary tree. Top view of a binary tree is the set of nodes visible when the tree is viewed from the top. For the given below tree 1 / \ 2 3 / \ / \ 4 5 6 7 Top view will be: 4 2 1 ...
true
7629f38b20e5dd43ceda19cceb9e68a7386adee0
DinakarBijili/Data-structures-and-Algorithms
/SORTING AND SEARCHING/18.K-th element of two sorted Arrays.py
1,027
4.25
4
""" K-th element of two sorted Arrays Given two sorted arrays arr1 and arr2 of size M and N respectively and an element K. The task is to find the element that would be at the kโ€™th position of the final sorted array. Example 1: Input: arr1[] = {2, 3, 6, 7, 9} arr2[] = {1, 4, 8, 10} k = 5 Output: 6 Explanation: The...
true
6d66d78b7774086fa047257b28fd2d3d83c7d7ca
DinakarBijili/Data-structures-and-Algorithms
/ARRAY/10.min_no._of_jumps_to_reach_end_of_arr.py
1,639
4.1875
4
""" Minimum number of jumps Given an array of integers where each element represents the max number of steps that can be made forward from that element. Find the minimum number of jumps to reach the end of the array (starting from the first element). If an element is 0, then you cannot move through that element. Exa...
true
4bd049da90d733d69710804afaa9b5352667caf3
DinakarBijili/Data-structures-and-Algorithms
/SORTING AND SEARCHING/7.Majority Element.py
900
4.40625
4
""" Majority Element Given an array A of N elements. Find the majority element in the array. A majority element in an array A of size N is an element that appears more than N/2 times in the array. Example 1: Input: N = 3 A[] = {1,2,3} Output: -1 Explanation: Since, each element in {1,2,3} appears only once so t...
true
a6b70b95e2abd954adf5c0ef7884792630fc1e5e
DinakarBijili/Data-structures-and-Algorithms
/LINKED_LIST/Rotate Doubly linked list by N nodes.py
2,692
4.1875
4
""" Rotate Doubly linked list by N nodes Given a doubly linked list, rotate the linked list counter-clockwise by N nodes. Here N is a given positive integer and is smaller than the count of nodes in linked list. N = 2 Rotated List: Examples: Input : a b c d e N = 2 Output : c d e a b Input : a b c ...
true
6fc2e1d949f0bfaa8b60947c38faf8e435a41a73
DinakarBijili/Data-structures-and-Algorithms
/BINARY TREE/1.Level order traversal.py
1,352
4.125
4
""" Level order traversal Given a binary tree, find its level order traversal. Level order traversal of a tree is breadth-first traversal for the tree. Example 1: Input: 1 / \ 3 2 Output:1 3 2 Example 2: Input: 10 / \ 20 30 / \ 40 60 Output:10 20 30 40 60 N N """ c...
true
1c32e5e226de7d4f2d1e3711911554730b406f9a
DinakarBijili/Data-structures-and-Algorithms
/LINKED_LIST/Check if Linked List is Palindrome.py
2,064
4.21875
4
""" Check if Linked List is Palindrome Given a singly linked list of size N of integers. The task is to check if the given linked list is palindrome or not. Example 1: Input: N = 3 value[] = {1,2,1} Output: 1 Explanation: The given linked list is 1 2 1 , which is a palindrome and Hence, the output is 1. Example 2: ...
true
dcd5db7c301734d0b7406153043d6e89ece94997
DinakarBijili/Data-structures-and-Algorithms
/LINKED_LIST/Reverse a Linked List in groups of given size.py
2,665
4.3125
4
""" Reverse a Linked List in groups of given size Given a linked list of size N. The task is to reverse every k nodes (where k is an input to the function) in the linked list. Example 1: Input: LinkedList: 1->2->2->4->5->6->7->8 K = 4 Output: 4 2 2 1 8 7 6 5 Explanation: The first 4 elements 1,2,2,4 are reversed f...
true
da2f6f83dca1a4776eba5777e39cb41676e29f2a
DinakarBijili/Data-structures-and-Algorithms
/ARRAY/4.Sort_arr-of_0s,1s,and,2s.without_using_any_sortMethod.py
971
4.375
4
# Sort an array of 0s, 1s and 2s # Given an array of size N containing only 0s, 1s, and 2s; sort the array in ascending order. # Example 1: # Input: # N = 5 # arr[]= {0 2 1 2 0} # Output: # 0 0 1 2 2 # Explanation: # 0s 1s and 2s are segregated # into ascending order. # Example 2: # Input: # N = 3 # arr[] = {...
true
11960b0f8caeafeda8c4cffcfa4d90bf087ad4bd
DinakarBijili/Data-structures-and-Algorithms
/BINARY TREE/5.Create a mirror tree from the given binary tree.py
1,605
4.375
4
""" Create a mirror tree from the given binary tree Given a binary tree, the task is to create a new binary tree which is a mirror image of the given binary tree. Examples: Input: 5 / \ 3 6 / \ 2 4 Output: Inorder of original tree: 2 3 4 5 6 Inorder of mirror tree: 6 5 4 3 2 Mirro...
true
1665a5752794a64a0de7e505e172a814c9b32e8f
andrewsanc/pythonFunctionalProgramming
/exerciseLambda.py
282
4.15625
4
''' Python Jupyter - Exercise: Lambda expressions. ''' # Using Lambda, return squared numbers. #%% nums = [5,4,3] print(list(map(lambda num: num**2, nums))) # List sorting. Sort by the second element. #%% a = [(0,2), (4,3), (9,9), (10,-1)] a.sort(key=lambda x: x[1]) print(a) #%%
true
3a6fa89d2f42f9b264fc509e02c13c8222e8d76c
DandyCV/SoftServeITAcademy
/L07/L07_HW1_3.py
321
4.15625
4
def square(size): """Function returns tuple with float {[perimeter], [area], [diagonal]} Argument - integer/float (side of square)""" perimeter = 4 * size area = size ** 2 diagonal = round((2 * area) ** 0.5, 2) square_tuple = (perimeter, area, diagonal) return square_tuple print(square(3))...
true
97d0ccc3d5c0bd1f9d84c1201695309d49c09fb9
DandyCV/SoftServeITAcademy
/L07/L07_HW1_1.py
473
4.5
4
def arithmetic(value_1, value_2, operation): """Function makes mathematical operations with 2 numbers. First and second arguments - int/float numbers Third argument - string operator(+, -, *, /)""" if operation == "+": return value_1 + value_2 if operation == "-": return value_1 - value_2 if ope...
true
b7f773a51b49ad7512c4dee4a860c49d2e600ba7
ramalho/modernoopy
/examples/tombola/ibingo.py
814
4.34375
4
""" Class ``IBingo`` is an iterable that yields items at random from a collection of items, like to a bingo cage. To create an ``IBingo`` instance, provide an iterable with the items:: >>> balls = set(range(3)) >>> cage = IBingo(balls) The instance is iterable:: >>> results = [item for item in cage] ...
true
53bd12eb151b9514575a8958560352ddb44bd941
SLongofono/Python-Misc
/python2/properties.py
1,250
4.125
4
""" This demonstrates the use of object properties as a way to give the illusion of private members and getters/setters per object oriented programming. Variables prefixed by underscore are a signal to other programmers that they should be changing them directly, but there really isn't any enforcement. There are still...
true
3aa2076bc76d17d5cb2c903e5089f9dc6c913a13
acemourya/D_S
/C_1/Chatper-01 DataScience Modules-stats-Example/Module-numpy-example.py
1,100
4.15625
4
#numpy: numerical python which provides function to manage multiple dimenssion array #array : collection of similar type data or values import numpy as np #create array from given range x = np.arange(1,10) print(x) y = x*2 print(y) #show data type print(type(x)) print(type(y)) #convert list to array d = [11,22,4...
true
b9b836dffee50eea89374a9978eeb48a86431187
vladosed/PY_LABS_1
/3-4/3-4.py
730
4.3125
4
#create random string with lower and upper case and with numbers str_var = "asdjhJVYGHV42315gvghvHGV214HVhjjJK" print(str_var) #find first symbol of string first_symbol = str_var[0] print(first_symbol) #find the last symbol of string last_symbol = str_var[-1] print(last_symbol) #slice first 8 symbols print(str_var[s...
true
bc21452d6fe5e22f5580c172737d2cecea07dee5
DimaLevchenko/intro_python
/homework_5/task_7.py
739
4.15625
4
# ะะฐะฟะธัะฐั‚ัŒ ั„ัƒะฝะบั†ะธัŽ `is_date`, ะฟั€ะธะฝะธะผะฐัŽั‰ัƒัŽ 3 ะฐั€ะณัƒะผะตะฝั‚ะฐ โ€” ะดะตะฝัŒ, ะผะตััั† ะธ ะณะพะด. # ะ’ะตั€ะฝัƒั‚ัŒ `True`, ะตัะปะธ ะดะฐั‚ะฐ ะบะพั€ั€ะตะบั‚ะฝะฐั (ะฝะฐะดะพ ัƒั‡ะธั‚ั‹ะฒะฐั‚ัŒ ั‡ะธัะปะพ ะผะตััั†ะฐ. ะะฐะฟั€ะธะผะตั€ 30.02 - ะดะฐั‚ะฐ ะฝะต ะบะพั€ั€ะตะบั‚ะฝะฐั, # ั‚ะฐะบ ะถะต 31.06 ะธะปะธ 32.07 ะธ ั‚.ะด.), ะธ `False` ะธะฝะฐั‡ะต. # (ะผะพะถะฝะพ ะธัะฟะพะปัŒะทะพะฒะฐั‚ัŒ ะผะพะดัƒะปัŒ calendar ะธะปะธ datetime) from datetime import datetime d = ...
false
3d773a08b8a163465cc06cfccb597a47e809a17d
vnikhila/PythonClass
/listexamples.py
1,797
4.1875
4
# --------Basic Addition of two matrices------- a = [[1,2],[3,4]] b = [[5,6],[7,8]] c= [[0,0],[0,0]] for i in range(len(a)): for j in range(len(a[0])): c[i][j] = a[i][j]+b[i][j] print(c) # -------Taking values of nested lists from user-------- n = int(input('Enter no of row and column: ')) a = [[0 for i in range(n)...
false
9a0ceda7765af0638ec2a3c31f2665b7b7d7075a
vnikhila/PythonClass
/conditional.py
207
4.34375
4
#if else ODD EVEN EXAMPLE a = int(input('Enter a number\n')) if a%2==0: print('Even') else: print('Odd') # if elif else example if a>0: print('Positive') elif a<0: print('Negative') else: print('Zero')
false
b5418dbfb626ef9a83a73a5de00da17e8e3822b5
Kristjamar/Verklegt-namskei-
/Breki/Add_to_dict.py
233
4.1875
4
x = {} def add_to_dict(x): key = input("Key: ") value = input("Value: ") if key in x: print("Error. Key already exists.") return x else: x[key] = value return x add_to_dict(x) print(x)
true
bdc16e91fac7d1045b84f248b0fbb929e44bff0e
RoncoGit/Uniquindio
/CondicionalesMultiples.py
571
4.1875
4
print("===================================") print("ยกยกConvertidor de nรบmeros a letras!!") print("===================================") num = int(input("Cuรกl es el nรบmero que deseas convertit?:")) if num == 4 : print("El nรบmero es 'Cuatro'") elif num == 1 : print("El nรบmero es 'Cinco'") elif num == 2...
false
df86c8f38f511f08aa08938abba0c79875727eb9
green-fox-academy/hanzs_solo
/Foundation/week_02-week_04/PythonBasicsProject/week_02/expressions_and_control_flow/conditionals/odd_even.py
234
4.46875
4
# Write a program that reads a number from the standard input, # then prints "Odd" if the number is odd, or "Even" if it is even. number = int(input("enter an integer: ")) if number % 2 == 0: print("Even") else: print("Odd")
true
39147e634f16988b71a0aee7d825d8e93def5359
green-fox-academy/hanzs_solo
/Foundation/week_02-week_04/PythonBasicsProject/week_02/expressions_and_control_flow/user_input/average_of_input.py
316
4.34375
4
# Write a program that asks for 5 integers in a row, # then it should print the sum and the average of these numbers like: # # Sum: 22, Average: 4.4 sum = 0 number_of_numbers = 5 for x in range(number_of_numbers): sum += int(input("enter an integer: ")) print("sum:", sum, "average:", sum / number_of_numbers)
true
a314a1eef3981612f213986b9d261adaf2ff85ce
green-fox-academy/hanzs_solo
/Foundation/week_02-week_04/PythonBasicsProject/week_02/arrays/reverse_list.py
327
4.46875
4
# - Create a variable named `numbers` # with the following content: `[3, 4, 5, 6, 7]` # - Reverse the order of the elements of `numbers` # - Print the elements of the reversed `numbers` numbers = [3, 4, 5, 6, 7] temp = [] for i in range(len(numbers)): temp.append(numbers[len(numbers)-i-1]) numbers = temp print(n...
true
31170eab6926b9a475fe8fb1b7258571d762b96e
green-fox-academy/hanzs_solo
/Foundation/week_02-week_04/PythonBasicsProject/week_02/data_structures/list_introduction_1.py
1,247
4.78125
5
# # List introduction 1 # # We are going to play with lists. Feel free to use the built-in methods where # possible. # # - Create an empty list which will contain names (strings) # - Print out the number of elements in the list # - Add William to the list # - Print out whether the list is empty or not # - Add John to t...
true
238f272124f13645a7e58e8de1aaee8d9a433967
green-fox-academy/hanzs_solo
/Foundation/week_02-week_04/PythonBasicsProject/week_02/expressions_and_control_flow/loops/count_from_to.py
634
4.28125
4
# Create a program that asks for two numbers # If the second number is not bigger than the first one it should print: # "The second number should be bigger" # # If it is bigger it should count from the first number to the second by one # # example: # # first number: 3, second number: 6, should print: # # 3 # 4 # 5 a = ...
true
27a458c5355a32cf2bc9eb53cef586a8120e9e36
hr4official/python-basic
/td.py
840
4.53125
5
# nested list #my_list = ["mouse", [8, 4, 6], ['a']] #print(my_list[1]) # empty list my_list1 = [] # list of integers my_list2 = [1, 2, 3] # list with mixed datatypes my_list3 = [1, "Hello", 3.4] #slice lists my_list = ['p','r','o','g','r','a','m','i','z'] # elements 3rd to 5th print(my_list[2:5]) ...
true
c0355b2269c01bed993270e4472d1771ffab9527
sharikgrg/week3.Python-Theory
/104_data_type_casting.py
316
4.25
4
# casting # casting is when you change an object data type to a specific data type #string to integer my_var = '10' print(type(my_var)) my_casted_var = int(my_var) print(type(my_casted_var)) # Integer/Floats to string my_int_vaar = 14 my_casted_str = str(my_int_vaar) print('my_casted_str:', type(my_casted_str))
false
cff7d4a762f14e761f3c3c46c2e656f74cb19403
sharikgrg/week3.Python-Theory
/exercises/exercise1.py
745
4.375
4
# Define the following variable # name, last name, age, eye_colour, hair_colour # Prompt user for input and reassign these # Print them back to the user as conversation # Eg: Hello Jack! Welcome, your age is 26, you eyes are green and your hair_colour are grey name = input('What is your name?') last_name = input('Wh...
true
cda99da103298b6c26c29b9083038a732826be11
sharikgrg/week3.Python-Theory
/102_data_types.py
1,736
4.5
4
# Numerical Data Types # - Int, long, float, complex # These are numerical data types which we can use numerical operators. # Complex and long we don't use as much # complex brings an imaginary type of number # long - are integers of unlimited size # Floats # int - stmads for integers # Whole numbers my_int = 20 prin...
true
5cba492f9034b07ca9bc7d266dca716ea684ba3c
sdhanendra/coding_practice
/DataStructures/linkedlist/linkedlist_classtest.py
1,647
4.5
4
# This program is to test the LinkedList class from DataStructures.linkedlist.linkedlist_class import LinkedList def main(): ll = LinkedList() # Insert 10 nodes in linked list print('linked list with 10 elements') for i in range(10): ll.insert_node_at_end(i) ll.print_list() # delete...
true
41c20076d3e9ba1433191c4f267605ccb6b351bf
zha0/punch_card_daily
/็ฌฌไบŒๆœŸ-python30ๅคฉ/day2 ๅ˜้‡/ๅŸบ็ก€.py
554
4.15625
4
#coding: utf-8 #pring print("hello,world") print("hello,world","my name is liangcheng") #len #่พ“ๅ‡บ5 print(len("hello")) #่พ“ๅ‡บ0 a = "" print(len(a)) #่พ“ๅ‡บ3,tuple b = ("a","b","c") print(len(b)) # list ่พ“ๅ‡บ5 c = [1,2,3,4,5] print(len(c)) # range ่พ“ๅ‡บ9 d = range(1,10) print(len(d)) # dict ๅญ—ๅ…ธ ่พ“ๅ‡บ1 e = {"name":"liangcheng"} pr...
false
9446b95ea3cb2f71014a9197aa934f03dbb12c5a
JiaoPengJob/PythonPro
/src/_instance_.py
2,780
4.15625
4
#!/usr/bin/python3 # ๅฎžไพ‹ไปฃ็  # Hello World ๅฎžไพ‹ print("Hello World!") # ๆ•ฐๅญ—ๆฑ‚ๅ’Œ def _filter_numbers(): str1 = input("่พ“ๅ…ฅ็ฌฌไธ€ไธชๆ•ฐๅญ—๏ผš\n") str2 = input("่พ“ๅ…ฅ็ฌฌไบŒไธชๆ•ฐๅญ—๏ผš\n") try: num1 = float(str1) try: num2 = float(str2) sum = num1 + num2 print("็›ธๅŠ ็š„็ป“ๆžœไธบ๏ผš%f" % sum) exce...
false
fd1257e7e33b27e828b1b67d1aac686b4fd1ef9b
Coohx/python_work
/python_base/python_class/car_old.py
2,288
4.34375
4
# -*- coding: utf-8 -*- # ไฝฟ็”จ็ฑปๆจกๆ‹Ÿ็Žฐๅฎžๆƒ…ๆ™ฏ # Car็ฑป class Car(): """ๆจกๆ‹Ÿๆฑฝ่ฝฆ็š„ไธ€ไธช็ฑป""" def __init__(self, test_make, test_model, test_year): """ๅˆๅง‹ๅŒ–ๆฑฝ่ฝฆๅฑžๆ€ง""" self.make = test_make self.model = test_model self.year = test_year # ๅˆ›ๅปบๅฑžๆ€งodometer_reading,ๅนถ่ฎพ็ฝฎๅˆๅง‹ๅ€ผไธบ0 # ๆŒ‡ๅฎšไบ†ๅˆๅง‹ๅ€ผ็š„ๅฑžๆ€ง๏ผŒไธ้œ€่ฆไธบๅฎƒๆไพ›...
false
79bd1b686f72927ad2c94a8c27449e78e4a0fde9
Coohx/python_work
/python_base/python_class/dog.py
2,117
4.125
4
# -*- coding: utf-8 -*- # Date: 2016-12-16 r""" python class ้ขๅ‘ๅฏน่ฑก็ผ–็จ‹ ็ฑป:ๆจกๆ‹Ÿ็Žฐๅฎžไธ–็•Œไธญ็š„ไบ‹็‰ฉๅ’Œๆƒ…ๆ™ฏ,ๅฎšไน‰ไธ€ๅคง็ฑปๅฏน่ฑก้ƒฝๆœ‰็š„้€š็”จ่กŒไธบ ๅฏน่ฑก:ๅŸบไบŽ็ฑปๅˆ›ๅปบ๏ผŒ่‡ชๅŠจๅ…ทๅค‡็ฑปไธญ็š„้€š็”จ่กŒไธบ ๅฎžไพ‹:ๆ นๆฎ็ฑปๅˆ›ๅปบๅฏน่ฑก่ขซ็งฐไธบๅฎžไพ‹ๅŒ– ็จ‹ๅบไธญไฝฟ็”จ็ฑป็š„ๅฎžไพ‹ """ # ๅˆ›ๅปบDog็ฑป # ็ฑปๅ้ฆ–ๅญ—ๆฏๅคงๅ†™ class Dog(): # Python2.7ไธญ็š„็ฑปๅˆ›ๅปบ๏ผšclass Dog(object): """ไธ€ๆฌกๆจกๆ‹Ÿๅฐ็‹—็š„็ฎ€ๅ•ๅฐ่ฏ•""" # ๅˆ›ๅปบๅฎžไพ‹ๆ—ถๆ–นๆณ•__init__()ไผš่‡ชๅŠจ่ฟ่กŒ # self ๅฝขๅ‚ๅฟ…้กปไฝไบŽๆœ€ๅ‰...
false
428b6201575083154aed82d01c1d7e5825d26745
Coohx/python_work
/python_base/python_if&for&while/do_if.py
2,123
4.3125
4
# -*- coding: utf-8 -*- # if ่ฏญๅฅ่ฟ›่กŒๆกไปถๅˆคๆ–ญ # Python็”จๅ†’ๅท(:)็ป„็ป‡็ผฉ่ฟ›๏ผŒๅŽ้ขๆ˜ฏไธ€ไธชไปฃ็ ๅ—๏ผŒไธ€ๆฌกๆ€งๆ‰ง่กŒๅฎŒ # if/else ็ฎ€ๅ•ๅˆคๆ–ญ age = 17 if age >= 18: print('you are a adult.') print('Welcome!') else: print('You should not stay here, Go home!') # if/elif/else ๅคšๅ€ผๆกไปถๅˆคๆ–ญ age = 3 if age >= 18: print('adult!') elif age > 6: print('teenager!')...
false
eca11f026deccf03ba63fbd946be4219101d4395
dashuncel/gb_algorithm
/byankina1_7.py
1,042
4.1875
4
#7. ะŸะพ ะดะปะธะฝะฐะผ ั‚ั€ะตั… ะพั‚ั€ะตะทะบะพะฒ, ะฒะฒะตะดะตะฝะฝั‹ั… ะฟะพะปัŒะทะพะฒะฐั‚ะตะปะตะผ, ะพะฟั€ะตะดะตะปะธั‚ัŒ ะฒะพะทะผะพะถะฝะพัั‚ัŒ ััƒั‰ะตัั‚ะฒะพะฒะฐะฝะธั ั‚ั€ะตัƒะณะพะปัŒะฝะธะบะฐ, # ัะพัั‚ะฐะฒะปะตะฝะฝะพะณะพ ะธะท ัั‚ะธั… ะพั‚ั€ะตะทะบะพะฒ. ะ•ัะปะธ ั‚ะฐะบะพะน ั‚ั€ะตัƒะณะพะปัŒะฝะธะบ ััƒั‰ะตัั‚ะฒัƒะตั‚, ั‚ะพ ะพะฟั€ะตะดะตะปะธั‚ัŒ, ัะฒะปัะตั‚ัั ะปะธ ะพะฝ ั€ะฐะทะฝะพัั‚ะพั€ะพะฝะฝะธะผ, # ั€ะฐะฒะฝะพะฑะตะดั€ะตะฝะฝั‹ะผ ะธะปะธ ั€ะฐะฒะฝะพัั‚ะพั€ะพะฝะฝะธะผ. len1 = float(input("ะ”ะปะธะฝะฐ 1: ")) len2 = float(input("ะ”ะปะธะฝะฐ 2: ...
false
f37a3a22ad3f2272e65ba5077308a6bfb5364429
ItaloPerez2019/UnitTestSample
/mymath.py
695
4.15625
4
# make a list of integer values from 1 to 100. # create a function to return max value from the list # create a function that return min value from the list # create a function that return averaga value from the list. # create unit test cases to test all the above functions. # [ dont use python built in min function, ...
true
f289bd52b2eaf19d4e34ec72b37345af0f747d05
AErenzo/Python_course_programs
/acronym.py
640
4.21875
4
phrase = input('Please enter a phrase: ') # strip white spacing from the phrase phrase = phrase.strip() # change the phrase to upper case phrase = phrase.upper() # create new variable containing the phrase split into seperate items words = phrase.split() # create empty list for first letter of each it...
true
f028bde75c24f7d2eec83ee24a638d0240b5628c
julianalvarezcaro/holbertonschool-higher_level_programming
/0x06-python-classes/6-square.py
1,780
4.40625
4
#!/usr/bin/python3 """6-square module""" class Square: """Square class""" def __init__(self, size=0, position=(0, 0)): """Class constructor""" self.size = size self.position = position def area(self): """Returns the area of the square""" return self.__size * self._...
true
dc4b0a658270447c6907b32b892c3965402a1fcb
DhavalLalitChheda/class_work
/Programs/ConvertCelsiusToFahreneit.py
211
4.1875
4
def convertToFahreneit(temp_Celsius): return temp_Celsius * 9 / 5 + 32 temp_Celsius = float(input("Please enter temp in celsius: ")) print("The temperature in Fahreneit is: ", convertToFahreneit(temp_Celsius))
false
b0bea18fc3d48dd1bda2e83ff52e589c7f54d1bf
kshitijgupta/all-code
/python/A_Byte_Of_Python/objvar.py
1,130
4.375
4
#!/usr/bin/python #coding=UTF-8 class Person: '''Represents a person.''' population = 0 def __init__(self, name): '''Initializes the person's data.''' self.name = name print '(Initializing %s)' % self.name Person.population += 1 def __del__(self): '''I am dying''' print '%s syas bye.' % self.name ...
false
d72f79ad097f5eace2fcb22d0471c0d3424290ac
elYaro/Codewars-Katas-Python
/8 kyu/Convert_number_to_reversed_array_of_digits.py
320
4.21875
4
''' Convert number to reversed array of digits Given a random number: C#: long; C++: unsigned long; You have to return the digits of this number within an array in reverse order. Example: 348597 => [7,9,5,8,4,3] ''' def digitize(n): nstr = str(n) l=[int(nstr[i]) for i in range(len(nstr)-1,-1,-1)] return l
true
ae32fe698d8afb7b31a70999c9875af162c2dbe6
elYaro/Codewars-Katas-Python
/8 kyu/Is_it_a_number.py
582
4.28125
4
''' Given a string s, write a method (function) that will return true if its a valid single integer or floating number or false if its not. Valid examples, should return true: isDigit("3") isDigit(" 3 ") isDigit("-3.23") should return false: isDigit("3-4") isDigit(" 3 5") isDigit("3 5") isDigit("zero") ''' def i...
true
ba06a43362449d7f90a447537840c42b591b8adf
elYaro/Codewars-Katas-Python
/8 kyu/String_cleaning.py
955
4.125
4
''' Your boss decided to save money by purchasing some cut-rate optical character recognition software for scanning in the text of old novels to your database. At first it seems to capture words okay, but you quickly notice that it throws in a lot of numbers at random places in the text. For example: string_clean('! !...
true
ca9334b0325fdbe0e9d4505dd4ab89649d0628f3
elYaro/Codewars-Katas-Python
/8 kyu/Find_Multiples_of_a_Number.py
708
4.59375
5
''' In this simple exercise, you will build a program that takes a value, integer, and returns a list of its multiples up to another value, limit. If limit is a multiple of integer, it should be included as well. There will only ever be positive integers passed into the function, not consisting of 0. The limit will a...
true
79d418430029288067984d7573880866b3e43328
elYaro/Codewars-Katas-Python
/7 kyu/KISS_Keep_It_Simple_Stupid.py
1,093
4.34375
4
''' KISS stands for Keep It Simple Stupid. It is a design principle for keeping things simple rather than complex. You are the boss of Joe. Joe is submitting words to you to publish to a blog. He likes to complicate things. Define a function that determines if Joe's work is simple or complex. Input will be non emtpy st...
true
c35fc57fec26636282eba11ea122628c8a07c0a3
ericaschwa/code_challenges
/LexmaxReplace.py
1,192
4.34375
4
""" LexmaxReplace By: Erica Schwartz (ericaschwa) Solves problem as articulated here: https://community.topcoder.com/stat?c=problem_statement&pm=14631&rd=16932 Problem Statement: Alice has a string s of lowercase letters. The string is written on a wall. Alice also has a set of cards. Each card contains a single let...
true
a10242f6ed3268cad16740d2a072e5851cff7816
Bhaney44/Intro_to_Python_Problems
/Problem_1_B.py
1,975
4.28125
4
#Part B: Saving, with a raise #Write a program that asks the user to enter the following variables #The starting annual salary #The semi-annual raise #The portion of the salary to be saved #The total cost of the dream home #Return the number of months to pay for the down payment. starting_annual_salar...
true
54d13bef355f59710b0b6f7a314d86a6daf8af68
TroyJJeffery/troyjjeffery.github.io
/Computer Science/Data Structures/Week 4/CH5_EX3.py
2,347
4.5
4
""" Modify the recursive tree program using one or all of the following ideas: Modify the thickness of the branches so that as the branchLen gets smaller, the line gets thinner. Modify the color of the branches so that as the branchLen gets very short it is colored like a leaf. Modify the angle used in turnin...
true
1d2f84f2f3a4a22172a30392f5ac8a146555cd0d
lopezjronald/Python-Crash-Course
/part-1-basics/Ch_2/name_cases.py
1,968
4.625
5
""" 2-3. Personal Message: Use a variable to represent a personโ€™s name, and print a message to that person. Your message should be simple, such as, โ€œHello Eric, would you like to learn some Python today?โ€ 2-4. Name Cases: Use a variable to represent a personโ€™s name, and then print that personโ€™s name in lowercase, uppe...
true
483ea8da418c872b647da5d004054f590052f568
srohit619/Assignments_LetsUpgrade
/Day_2/Assignment_1.py
1,667
4.53125
5
# Assignment of Python for LetsUpgrade Python Course ##### Question 1 # Experiment with Five list's Built in Function students = ["Rohit Shetty","Ram Mishra", "Pari Yadav","Shubam Mishra", "Kanta Bhai", "Urvi Kanade"] print(students) students.append("Raakhi Singh") #1 Adds a value to the end of the List ...
false
97858f535d9217878a0b36a2ad612d443027a750
NitinSingh1071/DS
/Practical3d.py
793
4.21875
4
def factorial(num): fact = 1 while (num>0): fact = fact * num num = num - 1 return fact def factorial_recursion(num): if num == 1: return num else : return num*factorial_recursion(num-1) def factors_num(num): for i in range(1,num+1): if ...
false
ad352e5ef77e961e39356333fc2e6808b27481ad
Alegarse/Python-Exercises
/Ejercicio4_1.py
917
4.3125
4
#! /usr/bin/python3 # Ejercicio 4_1. Pig Latin es un lenguaje creado en el que se toma la primera letra de una palabra # y se pone al final de la misma y se le agrega tambiรฉn el sonido vocรกlico โ€œeiโ€. Por ejemplo, la # palabra perro serรญa "erropei". ยฟCuรกles pasos debemos seguir? # Pedir al usuario que ingrese una pa...
false
8c384ed7883af590b02e00adcec98390d4462458
Alegarse/Python-Exercises
/Ejercicio7_1.py
542
4.15625
4
#! /usr/bin/python3 # Ejercicio 7_1. Escribir un programa que guarde en una variable el diccionario # {'Euro':'โ‚ฌ', 'Dollar':'$', 'Yen':'ยฅ'}, pregunte al usuario por una divisa y # muestre su sรญmbolo o un mensaje de aviso si la divisa no estรก en el diccionario. divisas = {'Euro':'โ‚ฌ', 'Dollar':'$', 'Yen':'ยฅ'} divP = ...
false
bc60019b0405e20006ce7e73a4e44910818d3bab
Alegarse/Python-Exercises
/EjemploRecusividad-Factorial.py
401
4.21875
4
#! /usr/bin/python3 # Ejercicio Recursividad. Resulver el factorial de un nรบmero. print("Resolucion del factorial de un nรบmero.") print("======================================") n = int(input("Introduzca el nรบmero al que calcular el factorial: ")) resultado = 0 def factN(n): if (n == 0 or n == 1): return 1...
false
26d4c7b0708fab0a34f64a0446a488ca6aafc6b4
baharaysel/python-study-from-giraffeAcademy
/tryexcept.py
719
4.1875
4
try: number = int(input("Enter a number: ")) print(number) except: print("Invalid Input") # trying to catch different type of errors try: value = 10 / 0 number = int(input("Enter a number: ")) print(number) except ZeroDivisionError: print("Divide by zero") except ValueError: print("Invalid ...
true
2929641de43ee29ccaa86d1f5864203c6ec8e5c9
baharaysel/python-study-from-giraffeAcademy
/for_Loops.py
693
4.1875
4
for letter in "Giraffe Academy": print(letter) friends = ["Figen", "Birgul", "Esra"] for friend in friends: print(friend) # Figen # Birgul # Esra friends = ["Figen", "Birgul", "Esra"] for index in range(10): # 10 is not included print(index) #0 #1 #2 #3 #4 #5 #6 #7 #8 #9 friends = ["Fi...
false
fc831d3a4869ab1084622ec1cdee10b43d11203d
Diamoon18/grafika
/burning_flower.py
1,106
4.1875
4
import turtle from turtle import Turtle, Screen ANGLE = 2 color = 'blue' color1 = 'black' color2 = 'red' color3 = 'yellow' def circles(t, size, small): for i in range(10): t.circle(size) size=size-small def circle_direction(t, size, repeat, small): for i in range (repeat): ...
true
5d0371c886729ffd8070088321fe21381c2d3487
xiaowuc2/Code-in-Place-2021-Assignment-Solution
/Assignment-2/4. Random Numbers.py
864
4.59375
5
""" Write a program in the file random_numbers.py that prints 10 random integers (each random integer should have a value between 0 and 100, inclusive). Your program should use a constant named NUM_RANDOM, which determines the number of random numbers to print (with a value of 10). It should also use constants named ...
true
cf695905d4d217da034247bf4bd9d5b4ab3b0c76
xiaowuc2/Code-in-Place-2021-Assignment-Solution
/Assignment-3/2. Finding Forest Flames.py
1,630
4.1875
4
""" This program highlights fires in an image by identifying pixels whose red intensity is more than INTENSITY_THRESHOLD times the average of the red, green, and blue values at a pixel. Those "sufficiently red" pixels are then highlighted in the image and other pixels are turned grey, by setting the pixel red, green, a...
true
13b15323e2cca29ee326a58a7b7a74bf997f3ecd
Graey/pythoncharmers
/Die_Roller.py
322
4.1875
4
#Using Random Number Generator import random min_value = 1 max_value = 6 again = True while again: print(random.randint(min_value, max_value)) another_roll = input('Want to roll the dice again? ') if another_roll == 'yes' or another_roll == 'y': again = True else: again = Fals...
true
6fc58e11d2549dc50f66e4b2107424a40071a32e
Graey/pythoncharmers
/arrayrotation.py
532
4.125
4
#Function to left rotate arr[] of size n by d*/ def leftRotate(arr, d, n): for i in range(d): leftRotatebyOne(arr, n) #Function to left Rotate arr[] of size n by 1*/ def leftRotatebyOne(arr, n): temp = arr[0] for i in range(n-1): arr[i] = arr[i+1] arr[n-1] = temp # utility function to print an ar...
false
09a05fdb4236cebffaa44ae9b71b734e6b0d82b2
SMinTexas/multiply_a_list
/mult_list.py
349
4.1875
4
# Given a list of numbers, and a single factor (also a number), create a # new list consisting of each of the numbers in the first list multiplied by # the factor. Print this list. mult_factor = 2 numbers = [2,4,6,8,10] new_numbers = [] for number in numbers: product = number * mult_factor new_numbers.append...
true
8a1bab3272fd58fe4999fe571fa7eb58f1cac9e4
Souravvk18/Python-Project
/dice_roll.py
1,204
5
5
''' The Dice Roll Simulation can be done by choosing a random integer between 1 and 6 for which we can use the random module in the Python programming language. The smallest value of a dice roll is 1 and the largest is 6, this logic can be used to simulate a dice roll. This gives us the start and end values to use i...
true
b836b5f8ee930033348291d83be460e57ef5fd0d
Souravvk18/Python-Project
/text_based.py
861
4.34375
4
''' you will learn how to create a very basic text-based game with Python. Here I will show you the basic idea of how you can create this game and then you can modify or increase the size of this game with more situations and user inputs to suit you. ''' name = str(input("Enter Your Name: ")) print(f"{name} you are...
true
8b1370186269880ea804974642cc8f7df23a74e8
csrm/python_basics
/element_at_last_index.py
214
4.1875
4
fruits = ['Apple', 'Banana', 'Orange', 'Sapota'] print(f'Original List: {fruits}') print(f'Element at index -1: {fruits[-1]}') print(f'Element at index -2: {fruits[-2]}') print(f'Element at index -5: {fruits[-5]}')
false
f5ca18d328871f5c41309175725414389239376d
csrm/python_basics
/copy_list.py
664
4.15625
4
#Define a list of food items regular_food = ['Annam', 'Pappu', 'Kura', 'Pacchadi', 'Charu', 'Curd'] #Assign the list regular_food to my_fav_food my_fav_food = regular_food #Copy list regular food to mom_fav_food mom_fav_food = regular_food[:] print(f'Regular Food : {regular_food}\nMy Favourite Food: {my_fav_food}\nMom...
false
a4626ca589be214fc375c7c0fe005807cf4f9291
rosekay/data_structures
/lists.py
1,232
4.34375
4
#list methods applied list_a = [15, 13.56, 200.0, -34,-1] list_b = ['a', 'b', 'g',"henry", 7] def list_max_min(price): #list comprehension return [num for num in price if num == min(price) or num == max(price)] def list_reverse(price): #reverse the list price.reverse() return price def list_count(price, num)...
true
6983b9b8ad8737a418c59ed38256630d3ed7b598
SbSharK/PYTHON
/PYTHON/whileelse.py
246
4.1875
4
num = int(input("Enter a no.: ")) if num<0: print("Enter a positive number!") else: while num>0: if num==6: break print(num) num-=1 else: print("Loop is not terminated with break")
true
0ecddbc90aaf35f0fb28351b096deb152ebd0e44
tuhiniris/Python-ShortCodes-Applications
/patterns1/hollow inverted right triangle star pattern.py
374
4.1875
4
''' Pattern Hollow inverted right triangle star pattern Enter number of rows: 5 ***** * * * * ** * ''' print('Hollow inverted right triangle star pattern: ') rows=int(input('Enter number of rows: ')) for i in range(1,rows+1): for j in range(i,rows+1): if i==1 or i==j or j==rows: print('*',end=' '...
true
0215399d8173998139d327bfd73917982e9a4e7a
tuhiniris/Python-ShortCodes-Applications
/array/right rotate an array.py
797
4.3125
4
from array import * arr=array("i",[]) n=int(input("Enter the length of the array: ")) for i in range(n): x=int(input(f"Enter the elements into array at position {i}: ")) arr.append(x) print("Origianl elements of the array: ",end=" ") for i in range(n): print(arr[i],end=" ") print() #Rotate the given array ...
true
6a157dd21d9cdff8fbd373649f1a5dead92151ac
tuhiniris/Python-ShortCodes-Applications
/basic program/print the sum of negative numbers, positive even numbers and positive odd numbers in a given list.py
779
4.125
4
n= int(input("Enter the number of elements to be in the list: ")) even=[] odd=[] negative=[] b=[] for i in range(0,n): a=int(input("Enter the element: ")) b.append(a) print("Element in the list are: {}".format(b)) sum_negative = 0 sum_positive_even = 0 sum_positive_odd = 0 for j in b: if j > 0: if j%...
true
987fdb176bd3aba61e03f288233d20db427e47df
tuhiniris/Python-ShortCodes-Applications
/array/print the number of elements of an array.py
611
4.40625
4
""" In this program, we need to count and print the number of elements present in the array. Some elements present in the array can be found by calculating the length of the array. """ from array import * arr=array("i",[]) n=int(input("Enter the length of the array: ")) for i in range(n): x=int(input(f"Enter t...
true
7139cde7a49d54db3883ae161d1acecf942489ed
tuhiniris/Python-ShortCodes-Applications
/list/Reversing a List.py
1,808
5.03125
5
print("-------------METHOD 1------------------") """ Using the reversed() built-in function. In this method, we neither reverse a list in-place (modify the original list), nor we create any copy of the list. Instead, we get a reverse iterator which we use to cycle through the list. """ def reverse(list): retur...
true
584171438444fc7001b68698651b725933f58b26
tuhiniris/Python-ShortCodes-Applications
/patterns2/program to print 0 or 1 square number pattern.py
390
4.1875
4
''' Pattern Square number pattern: Enter number of rows: 5 Enter number of column: 5 11111 11111 11111 11111 11111 ''' print('Square number pattern: ') number_rows=int(input('Enter number of rows: ')) number_columns=int(input('Enter number of columns:')) for row in range(1,number_rows+1): for column in ...
true
7166cac047616cf383f96c4584f7cf8a756ede9e
tuhiniris/Python-ShortCodes-Applications
/patterns1/alphabet pattern_29.py
327
4.25
4
""" Example: Enter number: 5 A B C D E A B C D A B C A B A """ print('Alphabet Pattern: ') number_rows = int(input("Enter number of rows: ")) for row in range(1,number_rows+1): print(" "*(row-1),end="") for column in range(1,number_rows+2-row): print(chr(64+column),end=" ") ...
true
3f868bcc92790acb85e72e8033d29bde05db17a1
tuhiniris/Python-ShortCodes-Applications
/patterns1/alphabet pattern_12.py
302
4.15625
4
''' Alphabet Pattern: Enter number of rows: 5 A A A A A B B B B B C C C C C D D D D D E E E E E ''' print('Alphabet Pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(1,number_rows+1): for column in range(1,number_rows+1): print(chr(64+row),end=' ') print()
false
05245453d39856168dbc249ebf5de56d659b338c
tuhiniris/Python-ShortCodes-Applications
/number programs/determine whether a given number is a happy number.py
1,573
4.25
4
""" Happy number: The happy number can be defined as a number which will yield 1 when it is replaced by the sum of the square of its digits repeatedly. If this process results in an endless cycle of numbers containing 4,then the number is called an unhappy number. For example, 32 is a happy number as the process ...
true
091a210b5cc80d42ce28a35b80b7186e808ae101
tuhiniris/Python-ShortCodes-Applications
/strings/find the frequency of characters.py
1,095
4.3125
4
""" To accomplish this task, we will maintain an array called freq with same size of the length of the string. Freq will be used to maintain the count of each character present in the string. Now, iterate through the string to compare each character with rest of the string. Increment the count of corresponding element...
true
a92e1513deea941b6d84b8c6bfdac8a5accb8715
tuhiniris/Python-ShortCodes-Applications
/tuples/Access Tuple Item.py
367
4.21875
4
''' To access tuple item need to refer it by it's the index number, inside square brackets: ''' a=[] n=int(input('Enter size of tuple: ')) for i in range(n): data=input('Enter elements of tuple: ') a.append(data) tuple_a=tuple(a) print(f'Tuple elements: {tuple_a}') for i in range(n): print(f'\nElement...
true
f3ff7b22352de6864f57eb3c9b52e4643215de8c
tuhiniris/Python-ShortCodes-Applications
/file handling/Read a File and Capitalize the First Letter of Every Word in the File.py
346
4.28125
4
''' Problem Description: ------------------- The program reads a file and capitalizes the first letter of every word in the file. ''' print(__doc__,end="") print('-'*25) fileName=input('Enter file name: ') print('-'*35) print(f'Contents of the file are : ') with open(fileName,'r') as f: for line in f: ...
true
edf144c53cc3cb95eb5a10cbdb08c8a7fc249868
tuhiniris/Python-ShortCodes-Applications
/patterns1/mirrored rhombus or parallelogram star.py
895
4.21875
4
''' Pattern 6 Mirrored rhombus star Enter number of rows: 5 ***** ***** ***** ***** ***** ''' print('Mirrored rhombus star pattern:') rows=int(input('Enter number of rows: ')) for i in range(1,rows+1): for j in range(1, i): print(' ',end=' ') for j in range(1,rows+1): print('*',end=' ') ...
false
3fc0f4902507d2fab0a8d3b597ab87dd24981a13
tuhiniris/Python-ShortCodes-Applications
/list/Find the Union of two Lists.py
1,136
4.4375
4
""" Problem Description The program takes two lists and finds the unions of the two lists. Problem Solution 1. Define a function which accepts two lists and returns the union of them. 2. Declare two empty lists and initialise to an empty list. 3. Consider a for loop to accept values for two lists. 4. Take the nu...
true
5bffa97dee1d35e4f0901c7fa8ca8bb4b7d59d9e
tuhiniris/Python-ShortCodes-Applications
/basic program/test Collatz Conjecture for a Given Number.py
897
4.5625
5
# a Python program to test Collatz conjecture for a given number """The Collatz conjecture is a conjecture that a particular sequence always reaches 1. The sequence is defined as start with a number n. The next number in the sequence is n/2 if n is even and 3n + 1 if n is odd. Problem Solution 1. Create a f...
true
47d85156bab21b683fd7b8314b2e5e5a4a9872cc
tuhiniris/Python-ShortCodes-Applications
/patterns1/alphabet pattern_3.py
281
4.25
4
""" Example: Enter the number of rows: 5 A A A A A B B B B C C C D D E """ print('Alphabet Pattern: ') number_rows=int(input('Enter number of rows: ')) for row in range(1,number_rows+1): for column in range(1,number_rows+2-row): print(chr(64+row),end=' ') print()
true
4961def023e1e2fb805239116cd8785ea4b09b74
tuhiniris/Python-ShortCodes-Applications
/list/Put Even and Odd elements in a List into Two Different Lists.py
826
4.46875
4
""" Problem Description The program takes a list and puts the even and odd elements in it into two separate lists. Problem Solution 1. Take in the number of elements and store it in a variable. 2. Take in the elements of the list one by one. 3. Use a for loop to traverse through the elements of the list and an if...
true
377813d90508ffa5402d90d7a288c078d9fa3786
tuhiniris/Python-ShortCodes-Applications
/strings/replace the spaces of a string with a specific character.py
208
4.15625
4
string=input('Enter string here: ') character='_' #replace space with specific character string=string.replace(' ',character) print(f'String after replacing spaces with given character: \" {string} \" ')
true
454c5b13b7079f428bd1b04b3a243a9c4c05bdcd
tuhiniris/Python-ShortCodes-Applications
/list/Ways to find length of list.py
1,584
4.46875
4
#naive method print("----------METHOD 1--------------------------") list=[] n=int(input("Enter the size of the list: ")) for i in range(n): data=int(input("Enter elements of the array: ")) list.append(data) print(f"elements in the list: {list}",end=" ") # for i in range(n): # print(list[i],end=" ") print()...
true
7c9bef892156d20b357d5855820d8b7e79c316af
tuhiniris/Python-ShortCodes-Applications
/dictionary/Check if a Given Key Exists in a Dictionary or Not.py
731
4.21875
4
''' Problem Description The program takes a dictionary and checks if a given key exists in a dictionary or not. Problem Solution 1. Declare and initialize a dictionary to have some key-value pairs. 2. Take a key from the user and store it in a variable. 3. Using an if statement and the in operator, check if...
true