blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
4f9b344063339fec622fae3a4ac18ceff57d10be
AlexandreCassilhas/W3schoolsExamples
/Dictionaries.py
1,370
4.3125
4
thisdict = { "brand": "Ford", "model": "Mustang", "year": "1964" } print (thisdict) x = thisdict["model"] print(x) # Acessando o valor de um elemento do dicionário z = thisdict.get("brand") print(z) # Alterando o valor de um elemento do dicionário thisdict["year"] = 2018 print (thisdict) # Varrendo as c...
false
2e2821bc842d2b6c16a6e9a5f5252b64c4f2d097
ngenter/lnorth
/guessreverse.py
631
4.125
4
# Nate Genter # 1-9-16 # Guess my number reversed # In this program the computer will try and guess your number import random print("\nWelcome to Liberty North.") print("Lets play a game.") print("\nPlease select a number, from 1-100 and I will guess it.") number = int(input("Please enter your number: ")) if num...
true
342d4b53dc20b586b697bc002c78c2539722fb70
LeandrorFaria/Phyton---Curso-em-Video-1
/Script-Python/Desafio/Desafio-035.py
486
4.21875
4
# Desenvolva um programa que leia o comprimento de três retas e diga ao usuário se elas podem ou não formar um triângulo. print('--=--' * 7) print('Analisador de triângulo') print('--=--' * 7) a = float(input('Primeiro segmento:')) b = float(input('Segundo segmento: ')) c = float(input('Terceiro segmento: ')) if a < b ...
false
fe297a22342a92f9b3617b827367e60cb7b68f20
jpallavi23/Smart-Interviews
/03_Code_Forces/08_cAPS lOCK.py
1,119
4.125
4
''' wHAT DO WE NEED cAPS LOCK FOR? Caps lock is a computer keyboard key. Pressing it sets an input mode in which typed letters are capital by default. If it is pressed by accident, it leads to accidents like the one we had in the first passage. Let's consider that a word has been typed with the Caps lock key accident...
true
4344f818cad8fd3759bab9e914dafb31171782f8
jpallavi23/Smart-Interviews
/06_SI_Basic-Hackerrank/40_Hollow rectangle pattern.py
628
4.21875
4
''' Print hollow rectangle pattern using '*'. See example for more details. Input Format Input contains two integers W and L. W - width of the rectangle, L - length of the rectangle. Constraints 2 <= W <= 50 2 <= L <= 50 Output Format For the given integers W and L, print the hollow rectangle pattern. Sample Input ...
true
5510d31f40b640c9a702d7580d1d434715469ba9
smzapp/pyexers
/01-hello.py
882
4.46875
4
one = 1 two = 2 three = one + two # print(three) # print(type(three)) # comp = 3.43j # print(type(comp)) #Complex mylist = ['Rhino', 'Grasshopper', 'Flamingo', 'Bongo'] B = len(mylist) # This will return the length of the list which is 3. The index is 0, 1, 2, 3. print(mylist[1]) # This will return the value at...
true
5da5f3b2063362046288b6370ff541a13552f9c8
adamyajain/PRO-C97
/countingWords.py
279
4.28125
4
introString = input("Enter String") charCount = 0 wordCount = 1 for i in introString: charCount = charCount+1 if(i==' '): wordCount = wordCount+1 print("Number Of Words in a String: ") print(wordCount) print("Number Of Characters in a String: ") print(charCount)
true
80240cb2d0d6c060e516fd44946fd7c57f1a3b06
hungnv132/algorithm
/recursion/draw_english_ruler.py
1,689
4.5
4
""" + Describe: - Place a tick with a numeric label - The length of the tick designating a whole inch as th 'major tick length' - Between the marks of whole inches, the ruler contains a series of 'minor sticks', placed at intervals of 1/2 inch, 1/4 inch, and so on - As the size of the interval dec...
true
7240fb816fb1beba9bf76eaf89579a7d87d46d67
hungnv132/algorithm
/books/python_cookbook_3rd/ch01_data_structures_and_algorithms/07_most_frequently_occurring_items.py
1,516
4.28125
4
from collections import Counter def most_frequently_occurring_items(): """ - Problem: You have a sequence of items and you'd like determine the most frequently occurring items in the sequence. - Solution: Use the collections.Counter """ words = [ 'look', 'into', 'my', 'eyes', 'look', ...
true
d5004f19368c1db3f570771b70d9bd82f94f1a3b
hungnv132/algorithm
/design_patterns/decorator.py
1,029
4.3125
4
def decorator(func): def inner(n): return func(n) + 1 return inner def first(n): return n + 1 first = decorator(first) @decorator def second(n): return n + 1 print(first(1)) # print 3 print(second(1)) # print 3 # =============================================== def wrap_with_prints(fun...
true
10bdaba3ac48babdc769cb838e1f7f4cdef66ae9
nikitaagarwala16/-100DaysofCodingInPython
/MonotonicArray.py
705
4.34375
4
''' Write a function that takes in an array of integers and returns a boolean representing whether the array is monotonic. An array is said to be monotonic if its elements, from left to right, are entirely non-increasing or entirely non -decreasing. ''' def monoArray(array): arraylen=len(array) increasing=True ...
true
0915b352ed93be7c1fe19f751d021b7b74cafbc2
alexthotse/data_explorer
/Data-Engineering/Part 07_(Elective):Intro_to_Python /Lesson_04.control_flow/control_flow.py
1,798
4.28125
4
# #1. IF Statement # # #2. IF, ELIF, ELSE # #n = str(input("Favourite_number: " )) # n = 25 # if n % 2 == 0: # print("The value of " + str(n) + " is even") # else: # print("The value of " + str(n) + " is odd") # # print(n) # # ######################## # # # season = 'spring' # # season = 'summer' # # season = '...
false
433ad06ffcf65021a07f380078ddf7be5a14bc0d
senorpatricio/python-exercizes
/warmup4-15.py
1,020
4.46875
4
""" Creating two classes, an employee and a job, where the employee class has-a job class. When printing an instance of the employee object the output should look something like this: My name is Morgan Williams, I am 24 years old and I am a Software Developer. """ class Job(object): def __init__(self, title, sal...
true
41fdc8a89fb3e7ecdcfaec78e5c668fc0e6e4e80
JoshuaShin/A01056181_1510_assignments
/A1/random_game.py
2,173
4.28125
4
""" random_game.py. Play a game of rock paper scissors with the computer. """ # Joshua Shin # A01056181 # Jan 25 2019 import doctest import random def computer_choice_translator(choice_computer): """ Translate computer choice (int between 0 - 2 inclusive) to "rock", "paper", or "scissors". PARAM choic...
true
0ca8c1dc04f5e98a3d08b588e2a4c5903e7f61da
amit-kr-debug/CP
/Geeks for geeks/Heap/Sorting Elements of an Array by Frequency.py
2,697
4.125
4
""" Given an array A[] of integers, sort the array according to frequency of elements. That is elements that have higher frequency come first. If frequencies of two elements are same, then smaller number comes first. Input: The first line of input contains an integer T denoting the number of test cases. The descriptio...
true
e2fb43f0392cd69430a3604c6ddcf3b06425b671
amit-kr-debug/CP
/Geeks for geeks/array/sorting 0 1 2.py
1,329
4.1875
4
""" 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[] = {0 1 0} Output: 0 0 1 Explanation: 0s 1s and 2s are segregated i...
true
6069283e9388e6d1704f649d14b84e4a288f8d86
amit-kr-debug/CP
/Cryptography and network security/lab - 2/Vigenere Cipher encrypt.py
669
4.21875
4
def encrypt(plain_text, key): cipher_text = "" # Encrypting plain text for i in range(len(plain_text)): cipher_text += chr(((ord(plain_text[i]) + ord(key[i]) - 130) % 26) + 65) return cipher_text if __name__ == "__main__": # Taking key as input key = input("Enter the key:") # Taki...
true
4602c2628ae813e68f997f36b18d270316e42a43
amit-kr-debug/CP
/hackerrank/Merge the Tools!.py
1,835
4.25
4
""" https://www.hackerrank.com/challenges/merge-the-tools/problem Consider the following: A string, , of length where . An integer, , where is a factor of . We can split into subsegments where each subsegment, , consists of a contiguous block of characters in . Then, use each to create string such that: The c...
true
efa3c5294a1274ba4c2133c34b6aaa32fb3ad590
ayatullah-ayat/py4e_assigns_quizzes
/chapter-10_assignment-10.2.py
921
4.125
4
# 10.2 Write a program to read through the mbox-short.txt and figure out the distribution by hour of the day for each of the messages. You can pull the hour out from the 'From ' line by finding the time and then splitting the string a second time using a colon. # From stephen.marquard@uct.ac.za Sat Jan 5 09:14:16 2008...
true
2836445a3619bd8f3a5554d962f079cc0de9cd9a
sooty1/Javascript
/main.py
1,240
4.1875
4
names = ['Jenny', 'Alexus', 'Sam', 'Grace'] dogs_names = ['Elphonse', 'Dr. Doggy DDS', 'Carter', 'Ralph'] names_and_dogs_names = zip(names, dogs_names) print(list(names_and_dogs_names)) # class PlayerCharacter: # #class object attribute not dynamic # membership = True # def __init__(self, name="anonymou...
true
f7f585f584f0a6b4ccdb708608640d9ba154673c
matherique/trabalhos-edd
/lista_2/test.py
2,095
4.15625
4
#!/usr/bin/env python3 import unittest from Fraction import * class TestFractionClass(unittest.TestCase): def testNumeradorCorreto(self): """ Numerador correto """ n, d = 1, 2 fr = Fraction(n, d) self.assertEqual(fr.num, n) def testDenominadorCorreto(self): """ Denominador correto """ ...
false
5b2267600ac663d2493599080b5bf482511015d3
nehaDeshp/Python
/Tests/setImitation.py
623
4.25
4
''' In this exercise, you will create a program that reads words from the user until the user enters a blank line. After the user enters a blank line your program should display each word entered by the user exactly once. The words should be displayed in the same order that they were entered. For example, if the user e...
true
a15d13da749137921a636eb4acf2d56a4681131a
nehaDeshp/Python
/Tests/Assignment1.py
559
4.28125
4
''' Write a program that reads integers from the user and stores them in a list. Your program should continue reading values until the user enters 0. Then it should display all of the values entered by the user (except for the 0) in order from smallest to largest, with one value appearing on each line. Use either the s...
true
8a61b80b3b96c4559149609d9630323a05f3a134
tanviredu/DATACAMPOOP
/first.py
292
4.34375
4
# Create function that returns the average of an integer list def average_numbers(num_list): avg = sum(num_list)/float(len(num_list)) # divide by length of list return avg # Take the average of a list: my_avg my_avg = average_numbers([1,2,3,4,5,6]) # Print out my_avg print(my_avg)
true
caaf2c8cf85b91b74b917523796029eda659131f
samithaj/COPDGene
/utils/compute_missingness.py
976
4.21875
4
def compute_missingness(data): """This function compute the number of missing values for every feature in the given dataset Parameters ---------- data: array, shape(n_instances,n_features) array containing the dataset, which might contain missing values Returns ------- n_missin...
true
31116f0e83ba9681303f5540d51b28e8d7d0c1c3
kellyseeme/pythonexample
/220/str.py
228
4.3125
4
#!/usr/bin/env python import string a = raw_input("enter a string:").strip() b = raw_input("enter another string:").strip() a = a.upper() if a.find(b) == -1: print "this is not in the string" else: print "sucecess"
true
d66a2b7006d3bbcede5387ed1a56df930862bccb
kellyseeme/pythonexample
/221/stringsText.py
945
4.21875
4
#!/usr/bin/env python """this is to test the strings and the text %r is used to debugging %s,%d is used to display + is used to contact two strings when used strings,there can used single-quotes,double-quotes if there have a TypeError,there must be some format parameter is not suit """ #this is use %d to set the valu...
true
5a2b8b97398fce8041886ad4920b5f7acd092ef7
kellyseeme/pythonexample
/323/stringL.py
693
4.15625
4
#!/usr/bin/env python #-*coding:utf-8 -*- #this is use the string method to format the strins #1.use the ljust is add more space after the string #2.use the rjust is add more space below the string #3.use the center is add more space below of after the string print "|","kel".ljust(20),"|","kel".rjust(20),"|","kel".cen...
true
bbb41f0db54a2a443f15cc6855cfa9a2d8a0e3ab
kellyseeme/pythonexample
/323/opString.py
1,007
4.125
4
#!/usr/bin/env python #-*- coding:utf-8 -*- """ this file is to concatenate the strings """ #this is use join to add the list of string pieces = ["kel","is","the best"] print "".join(pieces) #use for to add string other = "" for i in pieces: other = other + i print other #use %s to change the string print "%s %s...
false
0db7502613ff0c05461e17509d9b8b6abb1be3d2
kellyseeme/pythonexample
/33/using_list.py
1,053
4.34375
4
#!/usr/bin/env python """ this is for test the list function """ #this is define the shoplist of a list shoplist = ["apple","mango","carrot","banana"] #get the shoplist length,using len(shoplist) print "Ihave",len(shoplist),"items to pruchase." #this is iteration of the list,the list is iterable print "These items ar...
true
a2861764344d6b0302e21b4d670addd638b13e38
CorinaaaC08/lps_compsci
/class_samples/3-2_logicaloperators/college_acceptance.py
271
4.125
4
print('How many miles do you live from Richmond?') miles = int(raw_input()) print('What is your GPA?') GPA = float(raw_input()) if GPA > 3.0 and miles > 30: print('Congrats, welcome to Columbia!') if GPA <= 3.0 or miles <= 30: print('Sorry, good luck at Harvard.')
true
1d9dba5c3c23f35a906c2527a8fa557e74460d02
hasandawood112/python-practice
/Task-5.py
432
4.15625
4
from datetime import date year1 = int(input("Enter year of date 1 : ")) month1 = int(input("Enter month of date 1 : ")) day1 = int(input("Enter day of date 1 : ")) year2 = int(input("Enter year of date 2 : ")) month2 = int(input("Enter month of date 2 : ")) day2 = int(input("Enter day of date 2 : ")) date1= date(ye...
false
06366e956623f3305dbb737d6f91ddcea542daf4
dataneer/dataquestioprojects
/dqiousbirths.py
2,146
4.125
4
# Guided Project in dataquest.io # Explore U.S. Births # Read in the file and split by line f = open("US_births_1994-2003_CDC_NCHS.csv", "r") read = f.read() split_data = read.split("\n") # Refine reading the file by creating a function instead def read_csv(file_input): file = open(file_input, "r") read = fil...
true
fb9b299eff93179ac097d797c7e5ce59bc20f63a
yugin96/cpy5python
/practical04/q5_count_letter.py
796
4.1875
4
#name: q5_count_letter.py #author: YuGin, 5C23 #created: 26/02/13 #modified: 26/02/13 #objective: Write a recursive function count_letter(str, ch) that finds the # number of occurences of a specified leter, ch, in a string, str. #main #function def count_letter(str, ch): #terminating case when string is...
true
599df5c53d26902da3f2f16cb892a0ae6501be78
yugin96/cpy5python
/practical04/q6_sum_digits.py
482
4.28125
4
#name: q6_sum_digits.py #author: YuGin, 5C23 #created: 26/02/13 #modified: 26/02/13 #objective: Write a recursive function sum_digits(n) that computes the sum of # the digits in an integer n. #main #function def sum_digits(n): #terminating case when integer is 0 if len(str(n)) == 0: return 0...
true
78baf00a600d84297b1f2abac7d09470fce0638f
hechtermach/ML
/untitled2.py
218
4.3125
4
# -*- coding: utf-8 -*- """ Created on Tue Jan 22 01:27:35 2019 @author: mach0 """ import itertools list_step=['R','L','U','D'] list_all=[] for item in itertools.product(list_step,repeat=3): print (item)
false
fbd7624f47d4e14b47722923fd568c31e082d91d
Monsieurvishal/Peers-learning-python-3
/programs/for loop.py
236
4.59375
5
>>for Loops #The for loop is commonly used to repeat some code a certain number of times. This is done by combining for loops with range objects. for i in range(5): print("hello!") Output: hello! hello! hello! hello! hello!
true
c56cc5a285093da9ca9cc2265e344bfdbf03f929
Monsieurvishal/Peers-learning-python-3
/programs/for loop_p3.py
282
4.3125
4
>>Write a python script to take input from the user and print till that number. #Ex: if input is 10 print from 1 till 10. n=int(input("enter the number:")) i=0 for i in range(n): print(i) i=i+1 print("finished") #output: enter the number: 0 1 2 3 4 5 6 7 8 9 finished
true
24b146a3e423fd413124b988150d4e1ee01b4204
dell-ai-engineering/BigDL4CDSW
/1_sparkbasics/1_rdd.py
1,467
4.25
4
# In this tutorial, we are going to introduce the resilient distributed datasets (RDDs) # which is Spark's core abstraction when working with data. An RDD is a distributed collection # of elements which can be operated on in parallel. Users can create RDD in two ways: # parallelizing an existing collection in you...
true
c767555ee9c73ae671ed7d37c5951dbe943c3635
hoangqwe159/DoVietHoang-C4T5
/Homework 2/session 2.py
258
4.21875
4
from turtle import * shape("turtle") speed(0) # draw circles circle(50) for i in range(4): for i in range (360): forward(2) left(1) left(90) #draw triangle # = ctrl + / for i in range (3): forward(100) left(120) mainloop()
true
fe892de04ecbf1e806c4669f14b582fd1a801564
qodzero/icsv
/icsv/csv
578
4.15625
4
#!/usr/bin/env python3 import csv class reader(obj): ''' A simple class used to perform read operations on a csv file. ''' def read(self, csv_file): ''' simply read a csv file and return its contents ''' with open(csv_file, 'r') as f: cs = csv.reader(f) ...
true
8b9059649cbaad48bb6b53fa8a4624eb9b5819a9
aha1464/lpthw
/ex21.py
2,137
4.15625
4
# LPTHW EX21 # defining the function of add with 2 arguments. I add a and b then return them def add(a, b): print(f"ADDING {a} + {b}") return a + b # defining the function of subtract def subtract(a, b): print(f"SUBTRACKTING {a} - {b}") return a - b # defining the function of multiply def multiply(a,...
true
6345bac40a37f7811ffd2cf6b011e339bdd072f7
aha1464/lpthw
/ex16.py
1,371
4.25
4
# import = the feature argv = argument variables sys = package from sys import argv # script, filename = argv # printed text that is shown to the user when running the program print(f"We're going to erase (filename).") print("If you don't want that, hit CTRL-C (^c).") print("If you do want that, hit RETURN.") # input =...
true
3af1f947862099145d100d986ad158586368d47b
thetrashprogrammer/StartingOutWPython-Chapter3
/fat_and_carbs.py
1,491
4.375
4
# Programming Exercise 3.7 Calories from Fat and Carbohydrates # May 3rd, 2010 # CS110 # Amanda L. Moen # 7. Calories from Fat and Carbohydrates # A nutritionist who works for a fitness club helps members by # evaluating their diets. As part of her evaluation, she asks # members for the number of fat grams and carbohy...
true
7dcc48ffebb1ae534fa973cab9d70c77e7b7a610
wade-sam/variables
/Second program.py
245
4.15625
4
#Sam Wade #09/09/2014 #this is a vaiable that is storing th value entered by the user first_name = input("please enter your first name: ") print(first_name) #this ouputs the name in the format"Hi Sam!" print("Hi {0}!".format(first_name))
true
d490e1f73448f32eb150b3994f359cffb155acc4
pankhurisri21/100-days-of-Python
/variables_and_datatypes.py
548
4.125
4
#variables and datatypes #python variables are case sensitive print("\n\nPython variables are case sensitive") a=20 A=45 print("a =",a) print("A =",A) a=20#integer b=3.33 #float c="hello" #string d=True #bool #type of value print("Type of different values") print("Type of :",str(a)+" =",type(a)) print("Type of :",s...
true
d9f185d9097e1341c3769d693c9976e25eea6d23
HeWei-imagineer/Algorithms
/Leetcode/hanoi.py
591
4.15625
4
#关于递归函数问题: def move_one(num,init,des): print('move '+str(num)+' from '+init+' to '+des) print('---------------------------------') def hanoi(num,init,temp,des): if num==1: move_one(num,init,des) else: hanoi(num-1,init,des,temp) move_one(num,init,des) hanoi(num-1,temp,init...
false
b2eb51f1c07dc6b03bd49499e392191e4578a2ed
rbk2145/DataScience
/9_Manipulating DataFrames with pandas/2_Advanced indexing/1_Index objects and labeled data.py
814
4.4375
4
####Index values and names sales.index = range(len(sales)) ####Changing index of a DataFrame # Create the list of new indexes: new_idx new_idx = [month.upper() for month in sales.index] # Assign new_idx to sales.index sales.index = new_idx # Print the sales DataFrame print(sales) ######Changing index name labels ...
true
c31cfdfc797c4f40d719d1ef28549059c291c76f
SandjayRJ28/Python
/Python Ep 03 Strings.py
1,539
4.21875
4
#Variablen defineren gaat heel makkelijk heeft het een naam en waarde het its done Voor_naam = "Sandjay" print(Voor_naam) #Je kan stringe combineren met + Achter_naam = "Jethoe" print(Voor_naam + Achter_naam) print("Hallo" + Voor_naam + "" + Achter_naam) #Je kan functies gebruiken om je string aan te passen zin = "Ik...
false
a991555e799064d6a89f9c0c1cc460fcf41ce8ea
TazoFocus/UWF_2014_spring_COP3990C-2507
/notebooks/scripts/cli.py
664
4.21875
4
# this scripts demonstrates the command line input # this works under all os'es # this allows us to interact with the system import sys # the argument list that is passed to the code is stored # in a list called sys.argv # this list is just like any list in python so you should treat it as such cli_list = sys.argv ...
true
f68f8aaf53e834b5b3297a2852518edba06ebbe0
denrahydnas/SL9_TreePy
/tree_while.py
1,470
4.34375
4
# Problem 1: Warm the oven # Write a while loop that checks to see if the oven # is 350 degrees. If it is, print "The oven is ready!" # If it's not, increase current_oven_temp by 25 and print # out the current temperature. current_oven_temp = 75 # Solution 1 here while current_oven_temp < 350: print("The oven is...
true
78c6cd735ab26eabf91d6888118f9e5ec1320ccf
denrahydnas/SL9_TreePy
/tree_calc.py
746
4.28125
4
# Step 1 # Ask the user for their name and the year they were born. name = input("What is your name? ") ages = [25, 50, 75, 100] from datetime import date current_year = (date.today().year) while True: birth_year = input("What year were you born? ") try: birth_year = int(birth_year) except Valu...
true
528a622f441ed7ac306bc073548ebdf1e399271e
prabhus489/Python_Bestway
/Length_of_a_String.py
509
4.34375
4
def len_string(): length = 0 flag = 1 while flag: flag = 0 try: string = input("Enter the string: ") if string.isspace()or string.isnumeric(): print("Enter a valid string") flag = 1 except ValueError: prin...
true
b0a74a6e2ce7d3392643479ebbd4280ec9ce554e
HelloYeew/helloyeew-computer-programming-i
/Fibonacci Loop.py
611
4.125
4
def fib(n): """This function prints a Fibonacci sequence up to the nth Fibonacci """ for loop in range(1,n+1): a = 1 b = 1 print(1,end=" ") if loop % 2 != 0: for i in range(loop // 2): print(a,end=" ") b = b + a pr...
false
3dd5303392fe607aa21e7cefce97426d59b90e49
HelloYeew/helloyeew-computer-programming-i
/OOP_Inclass/Inclass_Code.py
1,881
4.21875
4
class Point2D: """Point class represents and operate on x, y coordinate """ def __init__(self,x=0,y=0): self.x = x self.y = y def disance_from_origin(self): return (self.x*self.x + self.y*self.y)**0.5 def halfway(self, other): halfway_x = (other.x - self.x) / 2 ...
false
6c43b0598523c3590ba54dfc962af52baa71074f
thevindur/Python-Basics
/w1790135 - ICT/Q1A.py
459
4.125
4
n1=int(input("Enter the first number: ")) n2=int(input("Enter the second number: ")) n3=int(input("Enter the third number: ")) #finding the square values s1=n1*n1 s2=n2*n2 s3=n3*n3 #finding the cube values c1=n1*n1*n1 c2=n2*n2*n2 c3=n3*n3*n3 #calculating the required spaces for the given example x=" "*5 x1=" "*4 y="...
false
604a599edc09ff277520aadd1bb79fb8157272ee
pallu182/practise_python
/fibonacci_sup.py
250
4.125
4
#!/usr/bin/python num = int(raw_input("Enter the number of fibonacci numbers to generate")) if num == 1: print 1 elif num == 2: print 1,"\n", 1 else: print 1 print 1 a = b = 1 for i in range(2,num): c = a + b a = b b = c print c
true
ca5d8a47171f6b1fbc2d53f6648da8f0a6b9e900
km1414/Courses
/Computer-Science-50-Harward-University-edX/pset6/vigenere.py
1,324
4.28125
4
import sys import cs50 def main(): # checking whether number of arguments is correct if len(sys.argv) != 2: print("Wrong number of arguments!") exit(1) # extracts integer from input key = sys.argv[1] if not key.isalpha(): print("Wrong key!") exit(...
true
5885ab9f922b74f75ae0ef3af2f1f0d00d2cd087
sheilapaiva/LabProg1
/Unidade8/agenda_ordenada/agenda_ordenada.py
621
4.125
4
#coding: utf-8 #UFCG - Ciência da Computação #Programação I e laboratório de Programação I #Aluna: Sheila Maria Mendes Paiva #Unidade: 8 Questão: Agenda Ordenada def ordenar(lista): ta_ordenado = True while ta_ordenado == True: ta_ordenado = False for i in range(len(lista) -1): if lista[i] > lista[i + 1]:...
false
b87e9b3fa5910c2f521321d84830411b624e0c39
SDSS-Computing-Studies/005a-tuples-vs-lists-AlexFoxall
/task2.py
569
4.15625
4
#!python3 """ Create a variable that contains an empy list. Ask a user to enter 5 words. Add the words into the list. Print the list inputs: string string string string string outputs: string example: Enter a word: apple Enter a word: worm Enter a word: dollar Enter a word: shingle Enter a word: virus ['apple', '...
true
25e432397ff5acb6a55406866813d141dc3ba2c2
jyu001/New-Leetcode-Solution
/solved/248_strobogrammatic_number_III.py
1,518
4.15625
4
''' 248. Strobogrammatic Number III DescriptionHintsSubmissionsDiscussSolution A strobogrammatic number is a number that looks the same when rotated 180 degrees (looked at upside down). Write a function to count the total strobogrammatic numbers that exist in the range of low <= num <= high. Example: Input: low = "5...
true
f73472838e6ab97b564a1a0a179b7b2f0667a007
Namrata-Choudhari/FUNCTION
/Q3.Sum and Average.py
228
4.125
4
def sum_average(a,b,c): d=(a+b+c) e=d/3 print("Sum of Numbers",d) print("Average of Number",e) a=int(input("Enter the Number")) b=int(input("Enter the Number")) c=int(input("Enter the Number")) sum_average(a,b,c)
true
b6c0dc8523111386006a29074b02d1691cf1e054
shivigupta3/Python
/pythonsimpleprogram.py
1,709
4.15625
4
#!/usr/bin/python2 x=input("press 1 for addition, press 2 to print hello world, press 3 to check whether a number is prime or not, press 4 for calculator, press 5 to find factorial of a number ") if x==1: a=input("enter first number: ") b=input("enter second number: ") c=a+b print ("sum is ",c) if x==2: print(...
true
9aa1b81bcb80494ea9b0c0b4a728a3981723fa43
eecs110/winter2019
/course-files/practice_exams/final/dictionaries/01_keys.py
337
4.40625
4
translations = {'uno': 'one', 'dos': 'two', 'tres': 'three'} ''' Problem: Given the dictionary above, write a program to print each Spanish word (the key) to the screen. The output should look like this: uno dos tres ''' # option 1: for key in translations: print(key) # option 2: for key in translations.keys(...
true
0fa9fae44540b84cb863749c8307b805e3a8d817
eecs110/winter2019
/course-files/lectures/lecture_03/demo00_operators_data_types.py
327
4.25
4
# example 1: result = 2 * '22' print('The result is:', result) # example 2: result = '2' * 22 print('The result is:', result) # example 3: result = 2 * 22 print('The result is:', result) # example 4: result = max(1, 3, 4 + 8, 9, 3 * 33) # example 5: from operator import add, sub, mul result = sub(100, mul(7, add(8...
true
b485405967c080034bd232685ee94e6b7cc84b4f
eecs110/winter2019
/course-files/practice_exams/final/strings/11_find.py
1,027
4.28125
4
# write a function called sentence that takes a sentence # and a word as positional arguments and returns a boolean # value indicating whether or not the word is in the sentence. # Ensure that your function is case in-sensitive. It does not # have to match on a whole word -- just part of a word. # Below, I show how I w...
true
40c91a64b489ecc92af2ee651c0ec3b48eba031e
amandameganchan/advent-of-code-2020
/day15/day15code.py
1,999
4.1875
4
#!/bin/env python3 """ following the rules of the game, determine the nth number spoken by the players rules: -begin by taking turns reading from a list of starting numbers (puzzle input) -then, each turn consists of considering the most recently spoken number: -if that was the first time the number has been spoke...
true
1321c47e1ea033a5668e940bc87c8916f27055e3
Tejjy624/PythonIntro
/ftoc.py
605
4.375
4
#Homework 1 #Tejvir Sohi #ECS 36A Winter 2019 #The problem in the original code is that 1st: The user input must be changed #into int or float. Float would be the best choice since there are decimals to #work with. The 2nd problem arised due to an extra slash when defining ctemp. #Instead of 5//9, it should be ...
true
44d18b17cdd57a20036f12ec231ce8d9ec1f7157
Mgomelya/Study
/Алгоритмы/Очередь.py
2,073
4.1875
4
# Очередь основана на концепции FIFO - First in First out class Queue: # Очередь на кольцевом буфере, Сложность: O(1) def __init__(self, n): self.queue = [None] * n self.max_n = n self.head = 0 self.tail = 0 self.size = 0 # В пустой очереди и голова, и хвост указываю...
false
169a92be719041be83c4a446467626148d4ca1d2
Mgomelya/Study
/Алгоритмы/Связный_список.py
1,794
4.28125
4
class Node: def __init__(self, value=None, next=None): self.value = value self.next = next def print_linked_list(node): while node: print(node.value, end=" -> ") node = node.next print("None") # У каждого элемента есть значение и ссылка на следующий элемент списка n3 = No...
false
eb0494758c0e4976095ade36025341d9cb3a7131
melnikovay/U2
/u2_z8.py
692
4.15625
4
#Посчитать, сколько раз встречается определенная цифра в #введенной последовательности чисел. Количество вводимых чисел и цифра, #которую необходимо посчитать, задаются вводом с клавиатуры. n = int(input('Введите последовательность натуральных чисел ')) c = int (input ('Введите цифру от 0 до 9 ')) k = 0 while n >...
false
a1dd8790cc6d7ed8a519d9cb009616e3897760d7
wlizama/python-training
/decoradores/decorator_sample02.py
651
4.15625
4
""" Decorador con parametros """ def sum_decorator(exec_func_before=True): def fun_decorator(func): def before_func(): print("Ejecutando acciones ANTES de llamar a función") def after_func(): print("Ejecutando acciones DESPUES de llamar a función") def wrapper(*a...
false
4b11d8d1ea2586e08828e69e9759da9cd60dda23
petermooney/datamining
/plotExample1.py
1,798
4.3125
4
### This is source code used for an invited lecture on Data Mining using Python for ### the Institute of Technology at Blanchardstown, Dublin, Ireland ### Lecturer and presenter: Dr. Peter Mooney ### email: peter.mooney@nuim.ie ### Date: November 2013 ### ### The purpose of this lecture is to provide students with an ...
true
6187d788dd3f6fc9b049ded6d08189e6bb8923ed
lflores0214/Sorting
/src/iterative_sorting/iterative_sorting.py
1,583
4.34375
4
# TO-DO: Complete the selection_sort() function below def selection_sort(arr): # loop through n-1 elements print(arr) for i in range(0, len(arr) - 1): # print(f"I: {i}") cur_index = i smallest_index = cur_index # TO-DO: find next smallest element # (hint, can do in 3 ...
true
168a9554f9d16b23e68dac5a254354c0c9e4be10
vinodhinia/CompetitiveCodingChallengeInPython
/Stacks/MinStackOptimal.py
1,172
4.15625
4
class MinStack(object): def __init__(self): """ initialize your data structure here. """ self.stack = [] self.min_stack = [] def push(self, x): """ :type x: int :rtype: void """ if len(self.stack) == 0 and len(self.min_stack) == ...
false
34517c82223ec7e295f5139488687615eef77d56
devineni-nani/Nani_python_lerning
/Takung input/input.py
1,162
4.375
4
'''This function first takes the input from the user and then evaluates the expression, which means Python automatically identifies whether user entered a string or a number or list. If the input provided is not correct then either syntax error or exception is raised by python.''' #input() use roll_num= input("enter ...
true
75b4292c4e85d8edd136e7bf469c60e9222e383f
Dragonriser/DSA_Practice
/Binary Search/OrderAgnostic.py
847
4.125
4
""" Given a sorted array of numbers, find if a given number ‘key’ is present in the array. Though we know that the array is sorted, we don’t know if it’s sorted in ascending or descending order. You should assume that the array can have duplicates. Write a function to return the index of the ‘key’ if it is present in ...
true
d6b9c248126e6027e39f3f61d17d8a1a73f687b0
Dragonriser/DSA_Practice
/LinkedLists/MergeSortedLists.py
877
4.1875
4
#QUESTION: #Merge two sorted linked lists and return it as a new sorted list. The new list should be made by splicing together the nodes of the first two lists. #APPROACH: #Naive: Merge the linked Lists and sort them. #Optimised: Traverse through lists and add elements to new list according to value, since both lists...
true
f0438d1379df6974702dc34ef108073385a3877e
Nightzxfx/Pyton
/function.py
1,069
4.1875
4
def square(n): """Returns the square of a number.""" squared = n ** 2 print "%d squared is %d." % (n, squared) <--%d because is comming from def (function) return squared # Call the square function on line 10! Make sure to # include the number 10 between the parentheses. square(10) ------------------------...
true
12188e81219abc09fc9e995f00ec54a52b605166
Wasylus/lessons
/lesson12.py
1,117
4.4375
4
# print(int(bmi)) # # 1. What if bmi is 13 # # 2. What if bmi is 33 # if bmi <= 18: # print("Your BMI is 18, you are underweight.") # elif bmi >= 22: # print("Your BMI is 22, you have a normal weight.") # elif bmi >= 28: # print("Your BMI is 28, you are slightly overweight.") # elif bmi >= 33: ...
false
553e1903b680207d1c0e956b7b881692609834a3
OJ13/Python
/Udemy/Iniciantes/condicionais.py
400
4.1875
4
numero = 1 if(numero == 1): print("Numero é igual a um") if(numero == 2) : print("Número é igual a Dois") numero = 3 if(numero == 1): print("Numero é igual a um") else: print("Número não é igual a um") nome = "Junior" if("z" in nome) : print("Contém 'Z' no nome") elif("o" in nome) : print(...
false
c7eed0a9bee1a87a3164f81700d282d1370cebdb
philuu12/PYTHON_4_NTWK_ENGRS
/wk1_hw/Solution_wk1/ex7_yaml_json_read.py
835
4.3125
4
#!/usr/bin/env python ''' Write a Python program that reads both the YAML file and the JSON file created in exercise6 and pretty prints the data structure that is returned. ''' import yaml import json from pprint import pprint def output_format(my_list, my_str): ''' Make the output format easier to read ...
true
96d7d761a9593d39c6d389de8c1dc506d61ef9b4
AASHMAN111/Addition-using-python
/Development/to_run_module.py
1,800
4.125
4
#This module takes two input from the user. The input can be numbers between 0 and 255. #This module keeps on executing until the user wishes. #This module can also be called as a main module. #addition_module.py is imported in this module for the addition #conversion_module.py is imported in this module for the co...
true
868ad4369cd64f877f4ea35f1a85c941aa9c7409
SaketJNU/software_engineering
/rcdu_2750_practicals/rcdu_2750_strings.py
2,923
4.40625
4
""" Strings are amongst the most popular types in Python. We can create them simply by enclosing characters in quotes. Python treats single quotes the same as double quotes. Creating strings is as simple as assigning a value to a variable. """ import string name = "shubham" print("Data in upper case : ",name.upper(...
true
7bbe18daf81dabb7aa2ddb7f20bca261734a17d8
dodooh/python
/Sine_Cosine_Plot.py
858
4.3125
4
# Generating a sine vs cosine curve # For this project, you will have a generate a sine vs cosine curve. # You will need to use the numpy library to access the sine and cosine functions. # You will also need to use the matplotlib library to draw the curve. # To make this more difficult, make the graph go from...
true
68d606253d377862c11b0eaf52f942f6b6155f56
DimaSapsay/py_shift
/shift.py
349
4.15625
4
"""" function to perform a circular shift of a list to the left by a given number of elements """ from typing import List def shift(final_list: List[int], num: int) -> List[int]: """perform a circular shift""" if len(final_list) < num: raise ValueError final_list = final_list[num:] + final_list[...
true
630d6de3258bef33cfb9b4a79a276d002d56c39c
VictoryWekwa/program-gig
/Victory/PythonTask1.py
205
4.53125
5
# A PROGRAM TO COMPUTE THE AREA OF A CIRCLE ## # import math radius=float(input("Enter the Radius of the Circle= ")) area_of_circle=math.pi*(radius**2) print("The Area of the circle is", area_of_circle)
true
5503ffdae3e28c9bc81f7b536fc986bf46913d34
jocogum10/learning_data_structures_and_algorithms
/doubly_linkedlist.py
1,940
4.21875
4
class Node: def __init__(self, data): self.data = data self.next_node = None self.previous_node = None class DoublyLinkedList: def __init__(self, first_node=None, last_node=None): self.first_node = first_node self.last_node = last_node def insert_at_end(self...
true
f9b9480cc340d3b79f06e49aa31a53dbea5379f5
abilash2574/FindingPhoneNumber
/regexes.py
377
4.1875
4
#! python3 # Creating the same program using re package import re indian_pattern = re.compile(r'\d\d\d\d\d \d\d\d\d\d') text = "This is my number 76833 12142." search = indian_pattern.search(text) val = lambda x: None if(search==None) else search.group() if val(search) != None: print ("The phone number is "+val(s...
true
ddf2124551bc9a6c08f4e1d4b4347c6cd1a3cb91
gogoamy/repository1
/type.py
2,561
4.125
4
# -*- coding: utf-8 -*- # Number类型(int, float, boolean, complex) print('Number类型(int, float, boolean, complex)') a = 10 print('整形(int) a = ',a) b = 20.00 print('浮点型(float) b = ',b) c = 1.5e11 print('浮点型,科学计数法(float) c = ',c) d = True ...
false
d8e66b7676addfb742698f8057a2dbe59d9991c5
DamirKozhagulov/python_basics_homework
/home_tasks_1/practical_work_1_4.py
571
4.15625
4
# 4) # Пользователь вводит целое положительное число. Найдите самую большую цифру в числе. # Для решения используйте цикл while и арифметические операции. number = input('Введите целое положительное число: ') print(len(number)) result = [] i = 0 while i < len(number): num = number[i] result.append(num) i +...
false
be8b2ea14326e64425af9ee13478ec8c97890804
beajmnz/IEDSbootcamp
/pre-work/pre-work-python.py
1,135
4.3125
4
#! /usr/bin/python3 # -*- coding: utf-8 -*- """ Created on Fri Apr 23 17:39:23 2021 @author: Bea Jimenez <bea.jimenez@alumni.ie.edu> """ #Complete the following exercises using Spyder or Google Collab (your choice): #1. Print your name print('Bea Jimenez') #2. Print your name, your nationality and your job in 3 di...
true
28e93fcc30fca3c0adec041efd4fbeb6a467724e
beajmnz/IEDSbootcamp
/theory/03-Data Structures/DS6.py
452
4.34375
4
#! /usr/bin/python3 # -*- coding: utf-8 -*- """ Created on Wed May 5 18:24:27 2021 @author: Bea Jimenez <bea.jimenez@alumni.ie.edu> """ """ Write a Python program to count the elements in a list until an element is a tuple. Input: [10,20,30,(10,20),40] Output: 3 """ Input = [10,20,30,(10,20),40] counter = 0 for ...
true
e29dcf2e71f5f207a18e22067c0b26b530399225
beajmnz/IEDSbootcamp
/theory/02b-Flow Control Elements/FLOW3.py
468
4.125
4
#! /usr/bin/python3 # -*- coding: utf-8 -*- """ Created on Wed May 5 13:03:37 2021 @author: Bea Jimenez <bea.jimenez@alumni.ie.edu> """ """ Write a Python program that asks for a name to the user. If that name is your name, give congratulations. If not, let him know that is not your name Mark: be careful because the...
true
37b2d8a716c5e5a130cf1761e92a65ea3a517ab7
JovieMs/dp
/behavioral/strategy.py
1,003
4.28125
4
#!/usr/bin/env python # http://stackoverflow.com/questions/963965/how-is-this-strategy-pattern # -written-in-python-the-sample-in-wikipedia """ In most of other languages Strategy pattern is implemented via creating some base strategy interface/abstract class and subclassing it with a number of concrete strategies (as ...
true
ac896f90c9213c8bee169ffd3fbc74a6b4dc15e3
ICS3U-Programming-JonathanK/Unit4-01-Python
/sum_of_numbers.py
1,257
4.40625
4
#!/usr/bin/env python3 # Created by: Mr. Coxall # Created on: Sept 2019 # Modified by: Jonathan # Modified on: May 20, 2021 # This program asks the user to enter a positive number # and then uses a loop to calculate and display the sum # of all numbers from 0 until that number. def main(): # initialize the loop c...
true
e811211d279510195df3bbdf28645579c8b9f6de
megler/Day8-Caesar-Cipher
/main.py
1,497
4.1875
4
# caesarCipher.py # # Python Bootcamp Day 8 - Caesar Cipher # Usage: # Encrypt and decrypt code with caesar cipher. Day 8 Python Bootcamp # # Marceia Egler Sept 30, 2021 from art import logo from replit import clear alphabet = ['a', 'b', 'c', 'd', 'e', 'f', 'g', 'h', 'i', 'j', 'k', 'l', 'm', 'n', 'o', 'p', 'q',...
true
03839c78723e70f763d8009fea4217f18c3eff42
agustinaguero97/curso_python_udemy_omar
/ex4.py
1,624
4.15625
4
""""Your teacher asked from you to write a program that allows her to enter student 4 exam result and then the program calculates the average and displays whether student passed the semester or no.in order to pass the semester, the average score must be 50 or more""" def amount_of_results(): while True: t...
true
7be5665d75207fd063846d31adfc0012aaeee891
vlad-bezden/data_structures_and_algorithms
/data_structures_and_algorithms/quick_sort.py
512
4.21875
4
"""Example of quick sort using recursion""" import random from typing import List def quick_sort(data: List[int]) -> List[int]: if len(data) < 2: return data pivot, left, right = data.pop(), [], [] for item in data: if item < pivot: left.append(item) else: ...
true
4059405985761b3ae72fff1d6d06169cc35b1823
lakshay-saini-au8/PY_playground
/random/day03.py
678
4.46875
4
#question ''' 1.Create a variable “string” which contains any string value of length > 15 2. Print the length of the string variable. 3. Print the type of variable “string” 4. Convert the variable “string” to lowercase and print it. 5. Convert the variable “string” to uppercase and print it. 6. Use colon(:) operator to...
true