blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
9a890f9b78d267a5736ee72bcae20c51ac68cbb2
FigX7/digital_defense
/application/core/helpers.py
542
4.375
4
# https://www.geeksforgeeks.org/python-make-a-list-of-intervals-with-sequential-numbers/ # Python3 program to Convert list of # sequential number into intervals import itertools def intervals_extract(iterable): iterable = sorted(set(iterable)) for key, group in itertools.groupby(enumerate(iterable...
true
69fd0de981980ceb937c1de1ff1f5d15e9e9412f
lauralevy111/python_for_programmers
/src/notes/sets.py
803
4.125
4
#Sets #list of singers w a duplicate item #faveSingers = ["Dolly Parton", "Whitney Houston", "Mariah Carey", "Celine Dion","Lady Gaga","Whitney Houston"] #Whitney Houston is two elements, theres a dupe in this list #print(faveSingers) #^tolerates dupe, prints: ['Dolly Parton', 'Whitney Houston', 'Mariah Carey', 'Celin...
false
89a2a8bb4638493f1af993a622a97962cffbef25
uccser/codewof
/codewof/programming/content/en/prime-numbers/solution.py
378
4.25
4
number = int(input("Enter a positive integer: ")) if number < 2: print('No primes.') else: print(2) for possible_prime in range(3, number + 1): prime = True for divisor in range(2, possible_prime): if (possible_prime % divisor) == 0: prime = False ...
true
9f245e8df74b53459c8a0c35cd136707132a6dcd
urvish6119/Python-Algorithms-problem
/Binary Search.py
576
4.125
4
# Binary Search is only useful on ordered list. def binary_search(list1, ele): if len(list1) == 0: return False else: mid = len(list1) / 2 if list1[mid] == ele: return True else: if ele < list1[mid]: return binary_search(list1[:mid], ele) ...
true
2f2878c4e9129f76ab87f5eeb05d5632699a3618
LeakeyMokaya/Leakey_BootCamp_Day_4
/Missing_Number/missing_number.py
885
4.125
4
def find_missing(list1, list2): if isinstance(list1, list) and isinstance(list2, list): list1_length = len(list1) list2_length = len(list2) # return 0 if the lists are empty if list1_length == 0 and list2_length == 0: return 0 else: # Convert lists to...
true
c8cb04f08fda42c79b360e65dc7ba56fd8f0f9f8
pyaephyokyaw15/PythonFreeCourse
/chapter5/tuple_upack2.py
470
4.125
4
my_tuple = "Aung Aung",23,"Description" name,age,_ = my_tuple #name = my_tuple[0], age = my_tuple[1] print("Name ",name, " Age ",age) name = name.upper print("My Tuple ",my_tuple) my_lst = [1,2,2,3] another_tuple = (my_lst,1) another_lst,_= another_tuple another_lst[0] = 100 print("Another list ",another_lst) print(...
false
3ca889f0fbe4b6a823a7cb47d0f4dbfdb4dfccaa
pyaephyokyaw15/PythonFreeCourse
/chapter5/tuple_operator.py
906
4.25
4
one_to_ten = range(0,5) my_tuple = tuple(one_to_ten) print("Tuple constructor from range ",my_tuple) another_tuple = tuple(range(20,25)) print("Another tuple ",another_tuple) third_tuple = my_tuple + another_tuple print("Third tuple ",third_tuple) fruits = ("Orange","Apple","Banaa") fruits_repeated = fruits * 3 prin...
true
3e1d2cad58d37d35dd69a6249dbf1845069cfa97
hendry-ref/python-topic
/references/printing_ref.py
2,319
4.28125
4
from string import Template from helper.printformatter import pt """ Ref: https://pyformat.info/ for all string formatting purposes Topics: - basic printing - format printing ( % , f"..", format, template) - string template - escape character """ @pt def basic_print(): my_var = "hello world" print("Hello ...
true
96ed632e616310f72e043fd16d103e1fe0d8eeab
zdravkob98/Fundamentals-with-Python-May-2020
/Programming Fundamentals Final Exam Retake - 9 August 2019/Username.py
1,199
4.25
4
username = input() data = input() while data != 'Sign up': tolken = data.split() command = tolken[0] if command == 'Case': type = tolken[1] if type == 'lower': username = username.lower() elif type == 'upper': username = username.upper() print(userna...
false
df8fb9f199ff173e30d1b9da11f5c8c24319955d
VCloser/CodingInterview4Python
/chapter_2/section_3/question_3.py
1,648
4.125
4
# -*- coding:utf-8 -*- """ 问题: 在一个长度为n的数组里的所有数字都在0到n-1的范围内。 数组中某些数字是重复的,但不知道有几个数字是重复的。也不知道每个数字重复几次。 请找出数组中任意一个重复的数字。 例如,如果输入长度为7的数组{2,3,1,0,2,5,3},那么对应的输出是重复的数字2或者3。 """ # 这里要特别注意~找到任意重复的一个值并赋值到duplication[0] # 函数返回True/False def duplicate(numbers, duplication): """ :param numbers: [] :param duplication: ...
false
be759543df287c17d99fd51899e6b4025b2a4a5b
VamsiKrishna04/Hacktoberfest-2021
/hill-cipher-encryption.py
2,052
4.3125
4
## cryptography - Hill cipher encryption algorithm implementation ## input - any plaintext and a key(mostly used of size 9) ## Matrix of 3*3 is formed ## Output is a ciphertext generated using hill cipher encryption algorithm ## Characters considered for encryption are A-Z and ".,!" So mod 29 method is used ## eg. Sa...
true
1a0ec0505034f369127272a25f326f437c9ce2c6
kjeelani/YCWCodeFiles
/Basic Warmups/basics1.py
1,012
4.40625
4
#Console is ----> where things are printed print("Hello World") print("----") #variables are defined by one equal sign, and have a certain variable type. For now, you will work with strings and ints #strings(words) #ints(whole numbers) message = "Hello World" print(message) x = 4 print(x) print("----") """Note: Never ...
true
4b1191685db24a1a1b5183b470d26d72681794ed
teachandlearn/dailyWarmups
/switch_two_variables.py
465
4.15625
4
# Super easy, but it might be a good activity for my students. # Ask: show me (on paper, but better on a whiteboard) how you would swap the values of two variables. # https://stackoverflow.com/questions/117812/alternate-fizzbuzz-questions # Variables var_one = 25 var_two = 35 placeholder = 0 # Switch the values place...
true
ad33794460a934c50149f07b36abff6dc5633557
teachandlearn/dailyWarmups
/multiples_of_three_and_five.py
1,074
4.3125
4
# If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. # The sum of these multiples is 23. # Find the sum of all the multiples of 3 or 5 below 1000. # Warm up prompt: https://projecteuler.net/problem=1 # variables sum_of_multiples = 0 multiples_of_three_num = 0 multiples_of_...
true
0e6709c2fb734b287082be951487108f6cb2ee22
andrexburns/DojoProjects
/codingdojo_python/pytonoop/bikeoop.py
589
4.15625
4
class bike(object): def __init__(self, price, max_speed, miles): self.price = price self.max_speed = max_speed self.miles = miles def displayinfo(self): print self.price , self.max_speed, self.miles def ride(self): self.miles += 10 return self def reverse(self): self.miles -= 5 ...
true
d7a16f08027805d5bce4aa3006719027c4902a6f
NelsonDayan/Data-Structures-and-Algorithms
/Stack and Queue/Queue.py
633
4.15625
4
#Implementation of a queue stack=[] tmp_stack=[] top=0 while True: option=input("Choose your option:\n1.enqueue\n2.dequeue\n3.exit") if option=="enqueue" | "2": element=input("Enter element for insertion: ") stack.append(element) top+=1 print(stack) elif option=="dequeue" | "...
true
93c64e96afc91df10f31b256c04585fcb14ea709
cchauve/Callysto-Salish-Baskets
/notebooks/python_scripts/atomic_chevron.py
1,211
4.15625
4
# Function: For Chevron Pattern - Creates a single row of the Chevron Pattern # Input: The height and number of colors used for the Chevron as well as the row number of the row to be created # Output: A string containing a row of a Chevron Pattern def create_row(height, num_colors, row_num): # Each row of the ...
true
91b77d715f14e5c0ce42b811eda03119b5763f22
Malcolm-Tompkins/ICS3U-Unit5-02-Python-Area_Triangle
/area_triangle.py
843
4.1875
4
#!/usr/bin/env python3 # Created by Malcolm Tompkins # Created on May 26, 2021 # Calculates the area of a triangle with functions def area_of_triangle(user_base, user_height): area = user_base * user_height / 2 print("The area of your triangle is: {:.0f}mm²".format(area)) def main(): user_input1 = (inp...
true
09119f0a6e1775a39d3987891a5c8d6e717e63db
akshaygepl1/Python-codes
/Chapter2/Word_count_unique_sorted.py
340
4.1875
4
# Get a list of words with their count in a sentence . # The word should be in a sorted order alphabetically.Word should not be repeated. # Assume space as separator for words. User_input = input("Enter the sentence on which the operation will be performed :") temp = list(set(User_input.split())) t1 = temp t1.s...
true
1b9b8f6ff4f1d41e7dc45049f1a10a6d1d11eb49
akshaygepl1/Python-codes
/Chapter2/Lab1.py
285
4.375
4
# Input a sentence and display the longest word User_Intput = input("Enter a sentence") Longest = "" Length = 0 List_Of_Words = [x for x in User_Intput.split()] print(List_Of_Words) for i in List_Of_Words: if(len(i)>Length): Longest = i print(Longest)
true
e09b59ea41fffe88da96705f2775cb55b2930149
bpl4vv/python-projects
/OddOrEven.py
997
4.375
4
# Ask the user for a number. Depending on whether the number is even or odd, print out an appropriate message to the user. # Hint: how does an even / odd number react differently when divided by 2? # Extras: # 1. If the number is a multiple of 4, print out a different message. # 2. Ask the user for two numbers: one ...
true
0f737d2e2c66a0bce9d4318769d3794e45aad765
fabianomalves/python_introduction
/exerc_307.py
277
4.28125
4
""" Create a code asking two integers. Print the sum of these numbers. """ number1 = int(input('Type the first integer number: ')) number2 = int(input('Type the second integer number: ')) sum_of_numbers = number1 + number2 print('The sum of two numbers are: ', sum_of_numbers)
true
fb4f176453ce41f7cf1447d255850ddc8030b4f6
tashadanner/magic8
/magic8.py
997
4.1875
4
import random name = input('What is your name?') question = input('What is your question?') answer = "" random_number = random.randint(1,11) if random_number == 1: answer = "Yes - definitely." elif random_number == 2: answer = "It is decidely so." elif random_number == 3: answer = "Without a doubt." elif random...
true
e9544452230461195b198545c237d9968785ebe8
davisbradleyj/my-class-repo
/22-ruby-python-break-outs/activities/01-python/06-Ins_List/Demo/lists.py
832
4.3125
4
# Create a variable and set it as an List myList = ["Tony Stark", 25, "Steve Rodgers", 80] print(myList) # Adds an element onto the end of a List myList.append("Thor") myList.append("Thor") myList.append("Thor Nolan") print(myList) # Returns the index of the first object with a matching value print(myList.index("Thor...
true
19c0ac5125a333fe6815e0e31c113e084bba8c10
davisbradleyj/my-class-repo
/22-ruby-python-break-outs/activities/01-python/02-Stu_HelloVariableWorld/Unsolved/HelloVariables.py
784
4.34375
4
# Create a variable called 'name' that holds a string name = "Brad" # Create a variable called 'country' that holds a string country = "USA" # Create a variable called 'age' that holds an integer age = 37 # Create a variable called 'hourly_wage' that holds an integer hourly_wage = 50 # Calculate the daily wage for ...
true
1651dbcf9042bc8ad9ab0cb8eaf0f2811fa91cf2
vichi99/Python
/dictionary.py
1,109
4.15625
4
############################################################################## # The program do not nothing special, only shows formatting dictionary ############################################################################## A = {1: "one", 2: "two"} B = {2: "dva", 3: "three"} def transforms(A): # converts dict ...
false
be6e5c7ccfb3ac5b942a3d5774fcbcd61f8ce15f
JaysonGodbey/ConsoleTicketingSystem
/master_ticket.py
1,142
4.1875
4
SURCHARGE = 2 TICKET_PRICE = 10 tickets_remaining = 100 def calculate_price(number_of_tickets): return (number_of_tickets * TICKET_PRICE) + SURCHARGE while tickets_remaining >= 1: print("There are {} tickets remaining.".format(tickets_remaining)) name = input("What is your name? ") number_of_tickets...
true
8e35e69ca7c1cc201119d28e2f6d5fc531579bf9
ShawnWuzh/algorithms
/heap_sort.py
1,149
4.125
4
# written by HighW # This is the source code for heap sort algorithm class HeapSort: def heapSort(self, A, n): ''' Every time, we swap the root with the last node, the last node is the current largest ''' self.build_max_heap(A, n) while(n > 1): A[0], A[n-1] = A[n-...
false
f5cff0bb472b1a69b31bec58186988d1438af64b
TonyLijcu/Practica
/Prac_04/inte1.py
336
4.125
4
Number = [] for i in range(5): number = int(input("Write a number: ")) Number.append(number) print("The first number is", Number[0]) print("The last number is", Number[-1]) print("The smallest number is", min(Number)) print("The largest number is", max(Number)) print("The average of the numbers is", sum(Number...
true
0e5443af8ea48ffa7887a0e2d18c265dfa0f1d49
liangming168/leetcode
/DFSandBacktracking/Q257_binaryTreePath.py
1,499
4.28125
4
# -*- coding: utf-8 -*- """ Q257 binary tree path Given a binary tree, return all root-to-leaf paths. Note: A leaf is a node with no children. Example: Input: 1 / \ 2 3 \ 5 Output: ["1->2->5", "1->3"] Explanation: All root-to-leaf paths are: 1->2->5, 1->3 """ ''' method dfs ...
true
dbd656bbc0123cd6da290253433f10d7d05e4cf4
liangming168/leetcode
/heap/Q114_flattenBT2SingleList.py
832
4.125
4
# -*- coding: utf-8 -*- """ Q114 flatten BT into a linked lsit Given a binary tree, flatten it to a linked list in-place. For example, given the following tree: 1 / \ 2 5 / \ \ 3 4 6 The flattened tree should look like: 1 \ 2 \ 3 \ 4 \ 5 ...
true
974d05f7d5514d19dcc3ab8038ad3fedd794c321
ashwinchidambaram/PythonCode
/projecteuler/Question3.py
1,696
4.125
4
# Ashwin Chidambaram ## # Task: What is the largest prime factor of the number 600851475143 ## ###################################################################### import math # [1] - Create a list to hold the factors of 600851475143 factorList = [] # Create a variable...
true
e38b587fdfb591b5ef8726e9cd0506bdb97cecf4
KamrulSh/Data-Structure-Practice
/linked list/palindromLinkedList.py
2,991
4.21875
4
# Function to check if a singly linked list is palindrome class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def appendAtHead(self, value): newNode = Node(value) newNode.next = self.hea...
true
69cdb419707c0d1429e6796e5b85569b12e0d321
NAyeshaSulthana/11morning
/conditionalstatements.py
1,986
4.1875
4
#conditional statements-statements will be executed based on conditions.. #3 statements: #1-if statement #2-if else statement #3-if elif else statement #If statement: #block of statement in python is represented using indentation """ Syntax:- #it automatically takes space in next line with 4 spaces after i...
true
1ba8750f36f3187b97c0e6f34785839e4ac56864
NAyeshaSulthana/11morning
/day2.py
842
4.125
4
print("5"+"5") print("aye"+"sha") print(5+5) print(5-3) print(5/2) print(5%2) print(5//2) print(5**3) print(1, 2, 3, "4", 5.0) print(1, 2, 3, "4", 5.0, "hello") print("hello") print("\n") print(3) print("hello", end="\t") print(3) print("hello", end="") print(3, end =" ") print(5) #boolean data type ...
true
93433b16fca42c2f452beae88797b761655770cf
wissenschaftler/PythonChallengeSolutions
/Level 3/charbychar.py
2,445
4.15625
4
# The URL of this level: http://www.pythonchallenge.com/pc/def/equality.html # Character by character processing,without using re module # Written by Wei Xu strFile = open("equality.txt",'r') # equality.txt is where the data is wholeStr = strFile.read() countLeft = 0 # the number of consecutive capital letters on the ...
true
eb6dd48e283948cc5c9965cbf6589ad1bea4b2a9
jitudv/python_programs
/stringTest.py
392
4.15625
4
print("this is String test py ") name ='jitu' sortintro = " hii this jitu yadav from khargone " sumary =""" hhii thi is jitu yadav and jit is a python developer and he is working on java and datascince technologies """ print(name) print(sortintro) print(sumary) sortintro = str.upper(sortintro) print(sortintro) ...
false
18e747d7699378d5b3ac278945484c6ed0f22431
RajendraBhagroo/Algorithmic_Thinking
/Algorithms_Sedgewick_Python/Chapter_1/binary_search.py
2,646
4.4375
4
import unittest # Lists MUST Be Sorted Prior To Use # Name: Binary Search [Iterative] # Runtime Analysis: O(Log N) def binary_search_iterative(list_: "List Of Integers", key: "Value To Find Within List") -> "Index Of Value Within List If Exists, Or -1": """ Searches For Key Within List. If The Search Is ...
true
42654e0f5ceee9de50fed1a4a44617c870d0d6bb
raosindhu/lpth
/Ex16.py
1,111
4.25
4
from sys import argv print len(argv) script, filename = argv print argv[0] print argv[1] print "I'M GOING TO ERASE THE FILE" raw_input("?") print "OPENING THE FILE..." target = open(filename, 'w') print "Now i'm entering three lines" line1 = raw_input("line 1: ") line2 = raw_input("line 2: ") line3 = raw_input...
true
7fdf58c747a7fcf276e9d2c0e51159c2d40c89bf
raosindhu/lpth
/Ex20.py
867
4.25
4
from sys import argv script, input_file = argv def print_file(f): # function to print the file print f.read() def rewind(f): # function to rewind the already read file to first line f.seek(0) def print_line(no_of_lines, f): # print specific number of lines from a file print no_of_lines, f.readline(), #...
true
d2b3371f40e60f971cfcf48c4f60ad990bccbb28
deepprakashp354/python
/python/class/Avengers.py
1,131
4.1875
4
class Avenger: avengersCount=0 def __init__(self, name, power): Avenger.avengersCount +=1 self.name = name self.power = power def howMany(): print("Total Avengers %d" % Avenger.avengersCount) def getName(self): print("Avenger Name : "+self.name+" Have power "+self.power) hulk=Avenger("Hulk","Angryness...
true
008a37d2233d0170b3344dd89a32496549e0ece7
Notch1/Python_courses_H_Augustin
/Course #2 (Python Data Structures)/assignment_8.4_words.py
538
4.4375
4
# Open the file romeo.txt and read it line by line. For each line, split the line into a list of words # using the split() method. The program should build a list of words. For each word on each line check to see # if the word is already in the list and if not append it to the list. When the program completes, # sor...
true
6e2aeb52ebc3c8faf21237f54523fa3c7334a91d
KarlCF/python-challenge
/03-python/for.py
337
4.1875
4
cardapio = ['Carne', 'Queijo', 'Frango', 'Calabresa', 'Pizza', 'Carne Seca'] print ('') print ('---') print ('') for recheio in cardapio: print (f'Recheio de pastel sabor {recheio}') # Code below only to show that letters are "lists" # for letter in recheio: # print (letter) print ('') print...
true
e6550e88fa106027391080eb859e9a1e1302a394
GonzaloBZ/python_teoria
/clase2/c2_12.py
1,075
4.125
4
# Necesitamos procesar las notas de los estudiantes de este curso. Queremos saber: # ¿cuál es el promedio de las notas? # ¿cuántos estudiantes están por debajo del promedio? def menores_al_promedio(prom, lista): """Esta función retorna la cantidad de alumnos con notas por debajo del promedio.""" tot = 0 ...
false
468cdcc5d427ba6633fcabcab2a26b439d348bd6
an5558/csapx-20191-project1-words-an5558-master
/src/letter_freq.py
1,844
4.125
4
""" CSAPX Project 1: Zipf's Law Computes the frequency of each letter across the total occurrences of all words over all years. Author: Ayane Naito """ import argparse import sys import os from src import words_util import numpy as np import matplotlib.pyplot as plt def main(): """ Adds positional and optio...
true
d05438425a192b47b8fdf6edef3bcf6c575d71f5
jason-jz-zhu/dataquest
/Data Scientist/Working With Large Datasets/Spark DataFrames.py
2,886
4.25
4
### Unlike pandas, which can only run on one computer, Spark can use distributed memory (and disk when necessary) ### to handle larger data sets and run computations more quickly. ### Spark DataFrames allow us to modify and reuse our existing pandas code to scale up to much larger data sets. # step1 ### Print the...
true
216e8d088b33babbb87e859c43724aea30baf6d9
jason-jz-zhu/dataquest
/Data Engineer/3.Algorithms And Data Structures/sort alg.py
757
4.15625
4
def swap(array, pos1, pos2): store = array[pos1] array[pos1] = array[pos2] array[pos2] = store def selection_sort(array): for i in range(len(array)): lowest_index = i for z in range(i, len(array)): if array[z] < array[lowest_index]: lowest_index = z s...
false
b36f1a7aa9c1035c6a5291af765138862dcbf9f5
blafuente/Python
/inputFromUsers.py
260
4.375
4
# Getting input from users # For python 3, it will be input("Enter your name") name = input("Enter your name: ") age = input("Enter your age: ") # Python 2, uses raw_input() # name = raw_input("Enter your name: ") print("Hello " + name + ". You are " + age)
true
4f157f649af3d4de3cdcc6b7dc60b27785d68ef4
chrispy124/210CT-Coursework
/Question 6.py
417
4.15625
4
def WordRev (Words) : #defines the function WordsL = len(Words) #variable is equal too length of 'words' if WordsL == 1: return Words #if only one word is given then it will only print that word else: return [Words[-1]]+ WordRev(Words[:-1]) #calls the function to reorder ListInput = ["this"...
true
6c6a9ae9d46a966a8426ec143e186bbad5645976
huang147/STAT598Z
/Lecture_notes/functions.py
1,697
4.625
5
# Usually we want to logically group several statements which solve a # common problem. One way to achieve that in Python is to use # functions. Below we will show several features of functions in Python. # Some examples are from: http://secant.cs.purdue.edu/cs190c:notes09 # A simple function definition begins with ...
true
1f57de85dadeadecc1edb497d4a173c3f7c5a873
huang147/STAT598Z
/HW/HW1/stat598z_HW1_Jiajie_Huang/hw1p3.py
1,138
4.21875
4
#!/opt/epd/bin/python from random import randint print "I have a card in mind. Let's see if you are smart." # randomly generate the sign (an integer in 1-4) and number (an integer in 1-13) sign = randint(1, 4) number = randint(1, 13) # first guess the sign while 1: # make sure the guessing goes on until get to the ...
true
ec54838c3ea396310dedc64b80028450c136e346
jawaff/CollegeCS
/CS111_CS213/SimpleEncryptDecrypt/encrypt-decrypt.py
2,205
4.34375
4
''' program: encryption and decryption author:Jake Waffle Encrypt and decrypt lower and uppercase alphabets 1. Constants none 2. Input filename distance filename2 condition filename3 3. Computations Encrypting a message Decrypting a message 4. Display encrypted message decrypted...
true
3fb0005d04e5c254ee42b9203dd79520a1aaa630
jawaff/CollegeCS
/CS111_CS213/ArtGeneration/Ch7Proj4.py
1,809
4.1875
4
''' Author:Jacob Waffle, Carey Stirling Program:Ch7 project4 Generating a piece of art Constants width height Inputs level Compute pattern() directs the drawing of the squares Display Shows the generated picture ''' from turtlegraphics import Turtle import random def fillSquare(turtle, oldX, oldY,...
true
97ea0884f579e0eb760c7f5a4bca9d6c56fda76c
Alriosa/PythonCodesPractice
/codes/emailValid.py
218
4.375
4
valid_email = False print("Enter your email") email = input() for i in email: if(i=="@" and i=="."): valid_email = True if valid_email == True: print("Valid Email") else: print("Invalid Email")
true
1b364cb1a13f9c5c436de59679579f197ed72808
erickzin10/python
/estrutura-sequencial/calc-inteiro-real.py
720
4.28125
4
# -*- coding: latin1 -*- """Faça um Programa que peça 2 números inteiros e um número real. Calcule e mostre: 1. O produto do dobro do primeiro com metade do segundo . 2. A soma do triplo do primeiro com o terceiro. 3. O terceiro elevado ao cubo.""" int1 = raw_input("Digite o primeiro inteiro: "...
false
ebf5c51d81b55acc43687cb5b5d0cdafe1df460d
ThomasMcDaniel91/cs-module-project-iterative-sorting
/src/searching/searching.py
1,526
4.34375
4
def linear_search(arr, target): # Your code here for i in range(len(arr)): # go through the values in the list one at a time # and check if any of them are the target value if arr[i] == target: return i # once the function has run through all the values return -1 ...
true
9cc019b37f7e338e6b7b6e38b859fe63422dbd57
csusb-005411285/CodeBreakersCode
/caesar-cipher-encryptor.py
721
4.40625
4
def caesarCipherEncryptor(string, key): # Write your code here. # intialize a list to store the results encrypted_str = '' # normalize the key by using the modulo operator key = key % 26 unicode_val = 0 # loop through the string for char in string: # if the unicode value + key is greater than 122 if o...
true
1dc02bedb8ffac742b29dece043b265e3419220e
csusb-005411285/CodeBreakersCode
/find-three-largest-numbers.py
1,228
4.28125
4
def findThreeLargestNumbers(array): # Write your code here. # init a list to store the three largest numbers three_largest_nums = [None, None, None] # loop through the array for num in array: # for each number check # if it is greater than the last element of result list if three_largest_nums[2] is No...
true
1f21d9b77e2eb8e4b26677bef8807b9bf1bf7a97
cvang1231/dicts-word-count
/wordcount.py
825
4.3125
4
from sys import argv from string import punctuation def count_words(filename): """Prints the number of shared words in a text file. Usage: python3 wordcount.py <textfile.txt> """ # Open the file file_data = open(filename) word_dict = {} for line in file_data: # Tokenize data...
true
a122b229a31f80fc64a9beb1421834fbca46f130
vinaygaja/gaja
/sqr root of 3digit number.py
419
4.15625
4
#squareroot of a 3 digitnumber num=625 while num!=0: num=input('enter 3 digit number:') num=int(num) #print(num) if num !=0: if num>=100 and num<1000: sqrt=num**0.5 print(sqrt) num=input('enter the number:') num=int(num) else: ...
true
839b16b73a47c29bfcfbffdd9c8c62f15da2915e
vinaygaja/gaja
/S08Q02findingdigits&adding numbers.py
1,140
4.4375
4
#Question: ##Ask the user to enter a number. ##- If the number is a single digit number, add 7 to it, ## and print the number in its unit’s place ##- If the number is a two digit number, raise the number to the power of 5, ## and print the last 2 digits ##- If the number is a three digit number, ask user to e...
true
1cebc874862b63ff8e528cc3fb2372d2517f7631
python-elective-fall-2019/Lesson-02-Data-structures
/exercises/set.py
1,569
4.3125
4
# Set exercises. ![](https://www.linuxtopia.org/online_books/programming_books/python_programming/images/p2c6-union.png) 1. Write a Python program to create a set. 2. Write a Python program to iteration over sets. 3. Write a Python program to add member(s) in a set. 4. Write a Python program to remove item(s) ...
true
1bb9a0f3f958db4261513a6014c69f39e3b7bc11
mwtichen/Python-Scripts
/Scripts/convert.py
356
4.25
4
# convert.py # A program to convert Celsius temps to Fahrenheit # by: Suzie Programmer def main(): print("This program has been modified for exercise 2.8") fahrenheit = input("What is the Fahrenheit temperature? ") fahrenheit = float(fahrenheit) celsius = 5/9 * (fahrenheit - 32) print("The temperat...
false
a532914fa167397c1814e253bb84fa340f4d168e
mwtichen/Python-Scripts
/Scripts/slope.py
434
4.21875
4
#calculates the slope given two points #by Matthew Tichenor #for exercise 3.10 def main(): print("This program calculates the slope given two points") x1, y1 = input("Enter the first pair of coordinates: ").split(",") x2, y2 = input("Enter the second pair of coordinates: ").split(",") x1, y1, x2, y2 = ...
true
d18c2900fdf811aef8d8544c7feb4abcd87ce1dc
mwtichen/Python-Scripts
/Scripts/wordcount.py
708
4.125
4
#answer to exercise 4.18 #File wordcount.py #by Matthew Tichenor #need to fix number of words import math def main(): print("This program calculates the number of words, characters \ and lines in a file") fileName = input("Enter a file (full file extension): ") infile = open(fileName, 'r') c1 = 0 ...
true
78df2367eac7598bd2625d8ec8a42bea273aee2f
v-blashchuk/ITEA_Lessons
/Lesson 1/lesson_1_task_4.py
1,041
4.28125
4
# Реализовать функцию bank, которая принимает следующие аргументы: # сумма депозита, кол-во лет и процент. # Результатом выполнения должна быть сумма по истечению депозита. #git push 1 try: value_deposit = float(input('Введите сумму депозита:')) value_years = float(input('Введите количество лет:')) ...
false
36ca3751a0d2fbd8a46670aacc78f1a533838032
Michail73/Python_hometask
/palindrom.py
718
4.40625
4
# function which return reverse of a string def reverse(string): return string[::-1] def isPalindrome(stirng): # Calling reverse function rev = reverse(string) # Checking if both string are equal or not if (string== rev): return True return False # Driver code print("'Pls input digi...
false
72d842793cc3ca932114e0aced84f43cee062dbc
COMPPHYS-MESPANOL/comp-phys
/sorted_stars.py
2,240
4.46875
4
'''The function sortList takes the list 'data' and adds the elements in that list to new lists which are sorted by distance, apparent brightness, and absolute brightness. First 'counter' is intialized to 1,and the 'counter' is increased by 1 after every running of the while loop. As the 'counter' is less than 3, the w...
true
906caa3fafe79312bc77c8987936dc6805cb177f
Kiwinesss/100-Days-of-Python
/Day 04/rock-paper-scissors_my_version.py
1,848
4.21875
4
import time import random rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) __________) ...
false
d32d6f7baa8b01678300a6d99bb7d317d6b5e816
Kiwinesss/100-Days-of-Python
/Day 07/hangman_part2.py
647
4.21875
4
#Coding the second part of the hangman game import random word_list = ["aardvark", "baboon", "camel"] chosen_word = random.choice(word_list) #Testing code print(f'Pssst, the solution is {chosen_word}.\n') display = list() #create an empty list for letter in (chosen_word): #create hangman grid to show the use how m...
true
e5b1fede2e5407983602688a614eeccc265a477c
Kiwinesss/100-Days-of-Python
/Day 04/treasure-map.py
1,534
4.15625
4
# 🚨 Don't change the code below 👇 row1 = ["⬜️","⬜️","⬜️"] row2 = ["⬜️","⬜️","⬜️"] row3 = ["⬜️","⬜️","⬜️"] map = [row1, row2, row3] print(f"{row1}\n{row2}\n{row3}") position = input("Where do you want to put the treasure? ") # 🚨 Don't change the code above 👆 #Write your code below this row 👇 row = int(position[0])...
true
91d0e99762217d718ba256b5883c3d01d27c34a8
domspad/hackerrank
/apple_disambiguation/which_apple.py
1,613
4.3125
4
#!/usr/bin/env python """ (Basic explanation) """ def whichApple(text) : """ Predicts whether text refers to apple - the fruit or Apple - the company. Right now only based on last appearance of word "apple" in the text Requires: 'apple' to appear in text (with or without capitals) Returns: 'fruit' or 'computer-c...
true
d1b1369bf7a1c916ea38ad802fd649b49409efb4
DuvanDu/ProgramacionI
/Talleres/TallerClases.py
1,440
4.15625
4
class Torta(): def __init__(self, formaEntrada, saborEntrada, alturaEntrada): self.forma = formaEntrada self.sabor = saborEntrada self.altura = alturaEntrada def mostrarAtributos(self): print(f'''La forma es {self.forma} El sabor es de {self.sabor} ...
false
553135378a12649427ea377e442fd0038ffc4a3b
PanMaster13/Python-Programming
/Week 4/Practice Files/Week 4, Practice 4.py
264
4.21875
4
x = int(input("Input the length of side1:")) y = int(input("Input the length of side2:")) z = int(input("Input the length of side3:")) if x + y > z and x + z > y and y + z > x: print("The triangle is valid") else: print("The triangle is not valid")
false
f5312edb17f4c6ff5b974058bd85deae2e9473c0
PanMaster13/Python-Programming
/Week 6/Sample Files/Sample 7.py
552
4.21875
4
#Tuple - iterating over tuple from decimal import Decimal num = (1,2,3,4,5,6,7,8,21,18,19,54,74) #count Odd and Even numbers c_odd = c_even = t_odd = t_even = 0 for x in num: if x % 2: c_odd += 1 t_odd += x else: c_even += 1 t_even += x print("Number of Even numbers:", c_even...
true
3ba61fff710e1bcae7063c21987ac47b7d2da4c6
Crypto-Dimo/textbook_ex
/favourite_language.py
1,928
4.34375
4
favourite_languages = { 'jen': 'python', 'sarah': 'c', 'edward': 'ruby', 'phil': 'python', } language = favourite_languages['sarah'].title() print(f"Sarah's favourite language is {language}.") # using loop and .items() method for name, language in favourite_languages.items(): print(f"{name.t...
false
58b6e992c7991394f8d8b7289c4e301fccf55996
Andrew-McCormack/DT228-Computer-Science-Year-4-Files
/Advanced Security/Lab 1 - Caesar Cipher/CaesarCipher.py
1,319
4.5
4
import enchant # PyEnchant is a package which uses dictionaries to check whether a string is a specific language # it is used for brute forcing caesar cipher solutions where the key is unknown def main(): while(True): selection = raw_input('\nAre you encrypting or decrypting the message? (Enter e for encr...
true
5a81d14e1ac721143e7d9b258975509aad5e8ec5
brittanyrjones/cs-practice
/postorder_tree_traversal.py
1,022
4.15625
4
# A class that represents an individual node in a # Binary Tree """ Postorder traversal is used to delete the tree. Please see the question for deletion of tree for details. Postorder traversal is also useful to get the postfix expression of an expression tree. Please see http://en.wikipedia.org/wiki/Reverse_Poli...
true
cada8af577da53cf9b2d6175d5c779b48bf4e695
piolad/SudokuSolver
/SudokuSolver.py
1,725
4.125
4
#Made by Piotr Łądkowski def sudoku_empty(sudoku): for row in sudoku: for element in row: if type(element) is not int: return False return True def solve_sudoku(sudoku): initPossibles = [1, 2, 3, 4, 5, 6, 7, 8, 9] sudoku = sudoku[:] solved = False while not...
false
fbbf3273e36c33fcf41c308a514525eb84febb86
majumdarsouryadeepta/python_20-04-21
/Day01/condition.py
444
4.21875
4
# n = int(input("Enter a number: ")) # if n % 2 == 0: # print("number is even") # else: # print("number is odd") # n = int(input("Enter a number: ")) # if n % 2 == 0: # print("number is even") # if n > 10: # print("number is greater 10") # else: # print("nummber is odd") # if # if #...
false
f7347d873755fe0962835c2a99d61a23d4e33b0c
adechan/School
/Undergrad/Third Year/Python 2020/Lab 6/exercise6.py
733
4.28125
4
# Write a function that, for a text given as a parameter, censures # words that begin and end with voices. Censorship means replacing # characters from odd positions with *. import re def function6(text): vowels = "aeiouAEIOU" words = re.findall("[a-zA-Z0-9]+", text) matchedWords = [] for word in wor...
true
e27d4ffc45282bee535c3b3adab0d8d8bb49d6d7
adechan/School
/Undergrad/Third Year/Python 2020/Lab 5/exercise5.py
393
4.15625
4
# Write a function with one parameter which represents a list. # The function will return a new list containing all the numbers # found in the given list. def function5(list): numbers = [] for element in list: if type(element) == int or type(element) == float: numbers.append(element) r...
true
fd0b2dd32ecd4e1b68ece51a610abf69fcaf9fb0
rooslucas/automate-the-boring-stuff
/chapter-10/chapter_project_10b.py
1,248
4.53125
5
# Chapter project chapter 10 # Project: Backing Up a Folder into a ZIP FIle import zipfile import os # Step 1: Figure Out the ZIP File's Name def backup_to_zip(folder): # Back up the entire contents of "folder" into a ZIP file. folder = os.path.abspath(folder) # make sure folder is absolute # Figure o...
true
291d9482b70ad8fbb43a01f84ce797f9dbdb880f
rooslucas/automate-the-boring-stuff
/chapter-3/practice_project_3.py
400
4.5
4
# Practice project from chapter 3 # The Collatz Sequence def collatz(number): if number % 2 == 0: return number // 2 else: return 3 * number + 1 try: print('Enter number: ') number_input = int(input()) while number_input != 1: number_input = collatz(number_input) ...
true
1b3e0e89aa35009306beed2683871768a0e88654
TFernandezsh/Practica-6-python-tfernandez
/P6/P6-E2.py
702
4.15625
4
# Escribe un programa que te pida números y los guarde en una lista. Para terminar de introducir número, # simplemente escribe “Salir”. El programa termina escribiendo la lista de números. # # Escribe un nombre: 14 # Escribe una otro nombre: 123 # Escribe una otro nombre: -25 # Escribe una otro nombre: 123 # E...
false
1ce7f62caadbf660124cadcf016748e6f53ac8e5
RinkuAkash/Basic-Python-And-Data-Structures
/Data_Structures/Dictionary/11_list_to_dictionary.py
250
4.125
4
''' Created on 11/01/2020 @author: B Akash ''' ''' Problem statement: Write a Python program to convert a list into a nested dictionary of keys. ''' List=[1,2,3,4,5,6,7,8,9] Dictionary={} for key in List: Dictionary[key]={key} print(Dictionary)
true
af59163f87a659242b8d4069903056a9a0f63c78
RinkuAkash/Basic-Python-And-Data-Structures
/Data_Structures/Sets/09_symmetric_difference.py
250
4.21875
4
''' Created on 13/01/2020 @author: B Akash ''' ''' Problem statement: Write a Python program to create a symmetric difference ''' Set1={1,2,3,4,5,6} Set2={4,5,6,7,8,9} print("Symmetric difference of Set1 and Set2 : ",Set1.symmetric_difference(Set2))
true
d1f2bcda4a9dbbb59a6b7d576dba6039a4b73029
AzeemShahzad005/Python-Basic-Programs-Practics
/Palindrome.py
231
4.15625
4
num=int(input("Enter the number:")) temp=num rev=0 while(num>0): digit=num%10 rev=rev*10+digit num=num//10 if(temp==rev): print("The number is a Palindrome") else: print("The number is not a palindrome")
true
62d50bdca1c053e8fadb9381e6388cd0b7cc5ac4
eyenpi/Trie
/src/LinkedList.py
1,845
4.21875
4
class Node: def __init__(self, data): self.data = data self.next = None class LinkedList: def __init__(self): self.head = None def pushBack(self, data): """ a method that find end of a linked list and add a Node after it :param data: data that we want to b...
true
f3899af018b0a0f6ab7216feec57d84342cb9d86
Spartabariallali/Pythonprograms
/pythonSparta/tuples.py
382
4.3125
4
# Tuples - same as lists but they are immutable # tuples cant be modified # should be used when data cannot be manipulated # tuples are declared by () date_of_birth = ("name","dob","passport number") print(date_of_birth) #convert the tuple into a string #add your name into the list at 0 index dob = list(date_...
true
af1c28cd78d3ad35a5c7473bfc323900ecc325c6
Spartabariallali/Pythonprograms
/calculatoroop/calc_functions.py
1,059
4.28125
4
# phase 1 - create a simple calculator class Python_Calcalutor: # should have add, divide,multiply,subtract and remainder def number_subtraction(number1,number2): return (number1 - number2) def number_division(number1,number2): return (number1/number2) def number_remainder(number1,numb...
true
ff4fbd4b69001d74a64a11638e188d4434bb62df
Ramnirmal0/python
/palindrome using reveresed number.py
456
4.25
4
def reverse(num): temp=num rev=0 while(num>0): rem=num%10 rev=(rev*10)+rem num=num//10 print("/n Reversed Number is = ",rev) check(temp,rev) def check(num,rev): if(num == rev): print("The number is palindrome") ...
true
e8279cccbd36f1566264f1ce71e3c31a9ed814d9
johntelforduk/deep-racer
/cartesian_coordinates.py
1,765
4.28125
4
# Functions for manipulating cartesian coordinates expressed as [x, y] lists. import math def translation(vertex, delta): """Move, or slide, a coordinate in 2d space.""" [vertex_x, vertex_y] = vertex [delta_x, delta_y] = delta return [vertex_x + delta_x, vertex_y + delta_y] def scale(vertex, scale_...
true
6ca1156c74077f6e194cda11c8971988178d6967
31Sanskrati/Python
/letter.py
273
4.40625
4
letter = ''' Dear <|NAME|>, You are selected! <|DATE|> ''' your = input("Enter your name\n") date = input("Enter date \n") letter = letter.replace("<|NAME|>", your) letter = letter.replace("<|DATE|>", date) print(letter)
false
aa3a94418e579c16e2f7261cb4af75827b0cb139
alaanlimaa/Python_CVM1-2-3
/Aula 10/ex028.py
1,091
4.1875
4
'''Exercício Python 28: Escreva um programa que faça o computador “pensar” em um número inteiro entre 0 e 5 e peça para o usuário tentar descobrir qual foi o número escolhido pelo computador. O programa deverá escrever na tela se o usuário venceu ou perdeu.''' # PROGRAMA ABAIXO DESENVOLVIDO POR MIM''' '''from random ...
false
d967dd15219ff0c45e87ab624706219ee703c73d
alaanlimaa/Python_CVM1-2-3
/Aula 10/aula10.py
896
4.21875
4
# EXEMPLO 1 = TEMPO DE VIDA DO SEU CARRO '''time =int(input('Quantos anos tem seu carro: ')) if time <=3: print('Seu carro é zero bala ainda') else: print('Carro velho em') print('=== FIM ===')''' # USANDO CONDIÇÃO SIMPLIFICADA PARA REDUZIR O Nº DE LINHAS '''time =int(input('Quantos anos tem seu carro ?')) pr...
false
fe2c39e02fa723d98188615551b60cf0b5c8e7ae
chinmoy159/Python-Guide
/Algorithms/Sorting/merge_sort.py
1,523
4.5625
5
# Program in Python to demonstrate Merge Sorting algorithm # Guide: https://www.geeksforgeeks.org/merge-sort/ # # author: shubhojeet # date: Oct 31, 2020: 2000 hrs import random def merge_sort(arr): if len(arr) <= 1: return mid = len(arr) // 2 left_arr = [] right_arr = [] for it in range(...
false
12406ed670cbd6fbceb212e80e297d56a67c2167
chinmoy159/Python-Guide
/Algorithms/Sorting/selection_sort.py
912
4.375
4
# Program in Python to demonstrate Selection Sorting algorithm # Guide: https://www.geeksforgeeks.org/selection-sort/ # # author: shubhojeet # date: Oct 31, 2020: 2000 hrs import random def selection_sort(arr): size_of_array = len(arr) for i in range(0, size_of_array - 1): pos = i for j in ra...
true
dff052ce6e6e448eedfdbfad408cd3591fe78bb0
beckahenryl/Data-Structures-and-Algorithms
/integerbubblesort.py
459
4.28125
4
''' check if an array at one element is greater than the element after it, then move it to check against the next array. If the array is not, then keep it the same ''' array = [4,5,1,20,19,23,21,6,9] def bubbleSort (array): for i in range(len(array)): for j in range(0, len(array)-i-1): if array[j] >...
true
f4baff695988cb5240325a0dbfaac65da03a05e7
soni653/cs-module-project-hash-tables
/applications/word_count/word_count.py
555
4.125
4
def word_count(s): # Your code here dict = {} special_chars = '" : ; , . - + = / \ | [ ] { } ( ) * ^ &'.split() s2 = ''.join(c.lower() for c in s if not c in special_chars) for word in s2.split(): dict[word] = dict[word] + 1 if word in dict else 1 return dict if __name__ == "__main_...
true