blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
2a3d2d00ccba81a596ec9e9b6296c115ac1b583a
woshiZS/Snake-Python-tutorial-
/Chapter3/cube.py
336
4.40625
4
cubes=[value for value in range(1,11)] for cube in cubes: print(cube) print("The first 3 items in the list are : ") for num in cubes[:3]: print(num) print("Three items from the middle of the list are : ") for num in cubes[4:7]: print(num) print("The last 3 items in the list are : ") for num in cubes[-3:]...
true
0d8a2dea4bdafa61851e58509bbf5adc04022818
andres925922/Python-Design-Patterns
/src/3_examples/Structural/adapter.py
829
4.125
4
""" Convert the interface of a class into another interface clients expect. Adapter lets classes work together that couldn't otherwise because of incompatible interfaces. """ from abc import ABC, abstractmethod # ---------------- # Target Interface # ---------------- class Target(ABC): """ Interface for C...
true
d63b47cc028440f91de93b4f2afe0e729bda88fd
Environmental-Informatics/building-more-complex-programs-with-python-Gautam6-asmita
/Second_attempt_Exercise5.2.py
1,180
4.53125
5
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """Created on 2020-01-24 by Asmita Gautam Assignment 01: Python - Learning the Basics Think Python Chapter 5: Exercises 5.2 ##Check fermat equation Modified for resubmission on 2020-03-04 """ """ This function 'check_fermat' takes 4 parameters: a,b,c and d to check th...
true
ea3a06ac165152baade99a551f6fe2d7740ba635
mrsleveto/PythonProgrammingAssignmentSolutions
/Conversation with a computer.py
743
4.1875
4
#Conversation with a computer, by: Mrs. Leveto doing_well=input("Hello, are you doing well today? (y/n): ") if doing_well == "y" or doing_well == "Y": print("Wonderful! I'm so glad!") reason=input("What has you in such a great mood today? (weather/school/friends): ") if reason == "weather": print("...
true
a4134eb61c9d56b6c11d4d993c18b72f92e9fdf3
FilipDuz/CodeEval
/Moderate/ARRAY_ABSURDITY.py
1,495
4.125
4
#ARRAY ABSURDITY """ Imagine we have an immutable array of size N which we know to be filled with integers ranging from 0 to N-2, inclusive. Suppose we know that the array contains exactly one duplicated entry and that duplicate appears exactly twice. Find the duplicated entry. (For bonus points, ensure your solut...
true
5a82cacd4bf322b1200c0f66f89e5a9d950856f9
FilipDuz/CodeEval
/Moderate/REMOVE_CHARACTERS.py
1,393
4.34375
4
#REMOVE CHARACTERS """ Write a program which removes specific characters from a string. INPUT SAMPLE: The first argument is a path to a file. The file contains the source strings and the characters that need to be scrubbed. Each source string and characters you need to scrub are delimited by ...
true
289ad787090b4a6c692fc2088213b73171add2a5
sonalpawar2196/PythonTrainingDecember
/List/ListDemo.py
1,637
4.4375
4
thisList = ['sonal','priya','abc','pqr'] print(thisList) print(thisList[1]) thisList[1] = "jjj" print(thisList) # iterating over list for x in thisList: print(x) if "sonal" in thisList: print("string is in the list") else: print("not present ") print("length of list = ",len(thisList)) #To add an it...
true
525fa2c6b200496b8c9a5a748127f5e4f60a6819
swapnilz30/python
/create-file.py
734
4.4375
4
#!/usr/bin/python3.6 # This script create the file. import os from sys import exit def check_file_dir(file_name): # Check user enter value is dir or file. if os.path.isdir(file_name): print("The ", file_name, "is directory") exit() elif os.path.isfile(file_name): print("The ", fi...
true
6f84b439cc1b1a3b547281c6ef9d05a2c6cd6145
Shubhu0500/Shubhu0500
/ROCK_PAPER_SCISSORS.py
1,072
4.28125
4
rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) __________) (____) ---.__(___) '''...
false
0f9944079b744b6d2074ca765b018fa61a3866e6
olives8109/CTI-110-1001
/M2_HourstoMinutes.py
522
4.28125
4
# Hours to Minutes # with formatting # CTI-110 # Sigrid Olive # 6/7/2017 #convert minutes to hh:mm format #input number of minutes totalMinutes = int(input("Number of minutes: ")) print ("You entered " + str(totalMinutes) + " minutes." ) #calculate hours hours = totalMinutes // 60 #print ("That is ",...
true
6f3db28210ead31da475367df0416c569b69ab04
olives8109/CTI-110-1001
/M5T2_FeetToInches_SigridOlive.py
539
4.46875
4
# Feet to Inches - Converts an input of feet into inches. # CTI-110 # Sigrid Olive # 6/26/2017 # explains what program does print("This program takes a number of feet and gives out the number of inches in that many feet.") # defines the variable "feet_to_inches" which will take an input of feet and convert it...
true
d284f26b04c9f8f44f73bf67150132d79262912a
krupadhruva/CIS41A
/home/unit_c_1.py
2,722
4.46875
4
""" Krupa Dhruva CIS 41A Fall 2020 Unit C take-home assignment """ """ First Script - Working with Lists All print output should include descriptions as shown in the example output below. Create an empty list called list1 Populate list1 with the values 1,3,5 Create list2 and populate it with the values 1,2,3,4 Cre...
true
dad8256f39a3457447851ad0909580611603b8c8
martiinmuriuki/python_projects
/tempconverter.py
2,529
4.28125
4
import math import time # Function def again(): try_again = print() User_Temp = input("your temperature,'C' for celsius, 'F' for fahrenheit 'K' for kelvin: ").upper() convert_Temp = input("The temperature you want to convert to, 'C' for celsius, 'F' for fahrenheit 'K' for kelvin: ").upper() # conve...
true
e206a46f537f4c71479fa063703bef27646c7efc
justgolyw/my-python-scripts
/Interview/code/select_sort.py
560
4.15625
4
#!/usr/bin/env python # -*- coding:utf-8 -*- """ @Author : yangwei.li @Create date : 2019/4/20 @FileName : select_sort.py """ # 选择排序 def select_sort(arr): n = len(arr) if n<=1: return arr for i in range(0,n-1): min_index= i for j in range(i+1,n): if arr[j]<arr[min_index]...
false
382be9db811b8a824a796111e0691aea58b3c4a8
JayT25/30-days-of-code
/arrays.py
757
4.1875
4
""" Task: Given an array, A, of N integers, print A's elements in reverse order as a single line of space-separated numbers. Input Format: The first line contains an integer, N (the size of our array). The second line contains N space-separated integers describing array A's elements. Sample input: 4 1 4 3 2...
true
96ea47c02375e6ec964b9cb198dfcaf87b8f3cd8
danielreedcombs/zoo-python
/zoo.py
703
4.53125
5
#Create a tuple named zoo that contains your favorite animals. zoo = tuple(["Dog","Chicken","Lama","Otter"]) #Find one of your animals using the .index(value) method on the tuple. num_of_chicken = zoo.index("Chicken") print(num_of_chicken) #Determine if an animal is in your tuple by using value in tuple. print("Chick...
true
53261c105ebb6551e5e3a0072d952a67da1d63d6
poofplonker/EffectivePython
/Chapter1/lesson_six.py
1,668
4.15625
4
""" Lesson Six: Don't use start, end and slice in a single Slice """ from itertools import islice A = list(range(10)) #We can use the slice stride syntax like this: print("Even: ", A[::2]) print("Odds: ", A[1::2]) # Seems good right? The problem is that :: can introduce bugs. # Here's a cool idiom for reversing a s...
true
d7c7217a1ce1d50f493ac86eea040675f43d0ad1
agrisjakob/QA-Academy-Work
/Python/Python Exercises and Tasks/Grade calculator.py
1,242
4.40625
4
# Challenge # • Create an application which asks the user for an input for a maths mark, a chemistry mark and a physics mark. # • Add the marks together, then work out the overall percentage. And print it out to the screen. # • If the percentage is below 40%, print “You failed” # • If the percentage is 40% or higher, ...
true
ca9b75d544748d4af11132b84c70d2940e7341f8
ArslanAhmad117/CALCULATOR
/main.py
366
4.25
4
int_1 = int(input("ENTER THE FRIST NUMBER")) int_2 = int(input("ENTER THE SECOND NUMBER")) operator = str(input("ENTER THE OPERATOR")) if operator == '+': print (int_1 + int_2) elif operator == '-': print (int_1 - int_2) elif operator == '*': print (int_1 * int_2) elif operator == '/': print (...
false
a0909ccd877dbd4db33f1c32e965b68b3296aeb7
cubitussonis/WTAMU
/assignment2/program4_table_of_powers.py
1,029
4.15625
4
#! /usr/bin/env python3 #welcome message print("Table of Powers") choice = "y" while choice.lower() == "y": #user input - start number must be lower than stop number startNumber = int(input("\nStart number:\t")) stopNumber = int(input("Stop number:\t")) while startNumber >= stopNumber: ...
false
305faad0957f6d8092c4c4d3a099f2e6ef3ad338
cubitussonis/WTAMU
/assignment4/p5-2_guesses.py
1,574
4.21875
4
#!/usr/bin/env python3 import random def display_title(): print("Guess the number!") print() def get_limit(): limit = int(input("Enter the upper limit for the range of numbers: ")) # limit must be at least 2, otherwise the game makes no sens while limit < 2: print("Smallest po...
true
f4216b05170c13a8363ebe7ad5f37dc2cf23563b
karans5004/Python_Basics
/ClassesAndObjects.py
2,400
4.875
5
""" # Python3 program to # demonstrate instantiating # a class class Dog: # A simple class # attribute attr1 = "mammal" attr2 = "dog" # A sample method def fun(self): print("I'm a", self.attr1) print("I'm a", self.attr2) # Driver code # Object instantiation Rodger ...
true
f0511f12ac8b02f306d5b5f2a5eac9d26d53528e
karans5004/Python_Basics
/day1_solution3.py
600
4.25
4
# Python3 Program to check whether a # given key already exists in a dictionary. # Function to print sum def checkKey(dict, key): if key in dict.keys(): return 1 else: return 0 # Driver Code dict = {'a': 100, 'b':200, 'c':300} key = input('Please Enter the Key : ') flag = checkK...
true
3df6ef4c4be687872ea8f2bb323fd81700ca5f2c
karans5004/Python_Basics
/AnonymousFunctions.py
2,108
4.75
5
""" In Python, anonymous function means that a function is without a name. As we already know that def keyword is used to define the normal functions and the lambda keyword is used to create anonymous functions. It has the following syntax: Syntax lambda arguments : expression This function can have any number o...
true
0add3d75735397e008ddce6dc18c04990428fab1
Cobraderas/LearnPython
/PythonGround/PythonIterators.py
1,880
4.71875
5
# an iterator is an object which implements the iterator protocol, which consists of the methods __iter__() # and __next__() # return an iterator from tuple, and print each value mytuple = ("apple", "banana", "cherry") myit = iter(mytuple) print(next(myit)) print(next(myit)) print(next(myit)) print(" ") mystr = "b...
true
87639ce4dc7891b3b325ec2c5a331c5addf1defb
Cobraderas/LearnPython
/PythonGround/DateTime.py
516
4.25
4
import datetime x = datetime.datetime.now() print(x) print(x.year) print(x.strftime("%A")) # create date object x = datetime.datetime(2020, 5, 17) print(x) # The datetime object has a method for formatting date objects into readable strings. # The method is called strftime(), and takes one parameter, format, to spec...
true
eeb2b2dcee223e8b7808fd88f3c59c01093c3cd9
hkalipaksi/pyton
/week 1/hello_word.py
525
4.125
4
#mencetak string print("hello word") #mencetak angka print(90) #mencetak contanse string "1"+"2" hasilnya 12 print("1"+"2") #mencetak contanse string "hello"+"word" hasilnya 12 print("hello"+"word") #mencetak angka hasil perjumlahan hasil yang dicetak 3 print(1+3) #deklarasi variabel dengan nama var var=12 #Perka...
false
14346136e7119326a97dda86e47bdcbd35aa4cf5
bardia-p/Raspberry-Pi-Projects
/button.py
923
4.1875
4
''' A program demonstrating how to use a button ''' import RPi.GPIO as GPIO import time import lcd_i2c PIN = 25 #Setup and initialization functions of the LCD def printLCD(string1, string2): lcd_i2c.printer(string1, string2) def setup(): lcd_i2c.lcd_init() #General GPIO Setup GPIO.setmode(GPIO.BCM) #sets h...
true
af60ea8239d8ec4755cd6ffafcfd76753c2f4590
VisargD/Problem-Solving
/Day-10/(3-Way Partitioning) Sort-Colors.py
2,748
4.25
4
""" Problem Name: Sort Colors Platform: Leetcode Difficulty: Medium Platform Link: https://leetcode.com/problems/sort-colors/ """ """ APPROACH: In this approach, 3 pointers will be used. Initially zero_index will point to the first index (beginning) of list and two_index will point to the last index (end). In order to...
true
fb163e0d9d66defdc5be489c432da4c9c7459bc8
tolgagolbasi/HomeworkCENG
/algorithm analysis/timeit Presentation-Buket/fibRepeater.py
824
4.1875
4
from timeit import Timer #Iterative method def fibIter(n): if n<=2: return 1 else: a,b,i=1,1,3 while i<=n: a,b=b,a+b i+=1 return b # Recursive method def fibRec(n): if n<=2: return 1 else: return fibRec(n-2)+fibRe...
false
ef047d9fab947eae8cddb4c3a96bc5a9c17edbfd
tj3407/Python-Projects-2
/math_dojo.py
2,282
4.15625
4
import math class MathDojo(object): def __init__(self): self.result = 0 def add(self, arg, *args): # Check the type() of 1st argument # if tuple (which can be a list or another tuple), iterate through values if type(arg) == tuple or type(arg) == list: for i in arg: ...
true
3e3cd7196e617b13fc28175678ec43baee4d941f
janaki-rk/silver_train
/Coding Challenge-5.py
766
4.4375
4
# DAILY CODING CHALLENGE 5 # Question asked by:JANE STREET # cons(a, b) constructs a pair, and car(pair) and cdr(pair) returns the first and last element of that pair. For # example, car(cons(3, 4)) returns 3, and cdr(cons(3, 4)) returns 4.Implement car and cdr. # Step 1: Defining the already implemented cons functio...
true
886dff703a512ddee03210bb0d14d922b315e314
janaki-rk/silver_train
/Coding Challenge_14.py
1,319
4.28125
4
# DAILY CODING CHALLENGE 14 # Question asked by: GOOGLE # The area of a circle is defined as πr^2. Estimate π to 3 decimal places using a Monte Carlo method. from random import uniform from math import pow # Step1: Solving the area of the circle with detailed descriptions # 1--Set r to be 1 (the unit circle) # 2--Ra...
true
fb8228b605e522e35535b2ab06f755a2f7e21677
force1267/num_analysis
/hazvigaos.py
985
4.21875
4
print("""حذفی گاوس برای تبدیل به بالا مثلثی""") def matprint(mat, start = 1): m = len(mat) n = len(mat[0]) s = "" for i in range(start, m): for j in range(start, n): s += str(mat[i][j]) + "\t" s += "\n" print(s) n = int(input("سایز ماتریس : ")) + 1 # 2d n*n matrice...
false
228dca898f80a9175d8d7d612a0a8dc34d9846d7
saurabhgrewal718/python-problems
/factorial of a number.py
288
4.25
4
# Write a program which can compute the factorial of a given numbers. # The results should be printed in a comma-separated sequence on a single line. # Suppose the following input is supplied to the program: # 8 # Then, the output should be: # 40320 num=input() print("num is "+ num)
true
cb96167da7853f9385ead70b54e48d4db0af49fd
varunbelgaonkar/Beginner-Python-projects
/database_gui.py
2,704
4.125
4
from tkinter import * import sqlite3 root = Tk() root.title("Employee Data") root.geometry("400x400") #cxreating a databse #conn = sqlite3.connect("employee.db") #creating curser #c = conn.cursor() #creating table #c.execute("""CREATE TABLE employees( # emp_id integer, # first_name text, # ...
false
35ef3abdfd3f7a7dab0e2cc1a1f2417e830c1bea
ZacharySmith8/Python40
/33_sum_range/sum_range.py
804
4.1875
4
def sum_range(nums, start=0, end=None): """Return sum of numbers from start...end. - start: where to start (if not provided, start at list start) - end: where to stop (include this index) (if not provided, go through end) >>> nums = [1, 2, 3, 4] >>> sum_range(nums) 10 >>>...
true
34e02349a424c11e8e25f72e28dfbfb21bd10501
Frank1126lin/Leecode
/reversenum.py
428
4.125
4
# !/usr/bin/env python3 # -*- coding: utf-8 -*- # @File : reversenum.py # @Author: Frank # @Date : 2018-10-12 def reversenum(x): """ :type x: int :rtype: int """ if x < 0 and x > -2**31 and int(str(-x)[::-1]) < 2**31-1: return -(int(str(-x)[::-1])) elif x >= 0 and x < 2**31-1 and int...
false
da50ea2dbed6771f589867f84304f543dcdb6ae4
sanjiv576/LabExercises
/Lab2/nine_leapYear.py
469
4.1875
4
""" Check whether the given year is leap year or not. If year is leap print ‘LEAP YEAR’ else print ‘COMMON YEAR’. Hint: • a year is a leap year if its number is exactly divisible by 4 and is not exactly divisible by 100 • a year is always a leap year if its number is exactly divisible by 400 """ year = int(input("Pleas...
true
8ccdd26d1ecc5918c9736bb294ebc39b8b344c56
sanjiv576/LabExercises
/Lab4_Data_Structure__And_Iternation/Dictionary/Four_check_keys.py
291
4.46875
4
# Write a Python script to check if a given key already exists in a dictionary. dic1 = {1: 'one', 2: 'two', 3: 'three'} keyOnly = dic1.keys() check = int(input("Input a key : ")) if check in keyOnly: print(f"{check} key already exists.") else: print(f"{check} key is not in {dic1}")
true
9193689da08cab23f2b621569036570ea5d03bc2
sanjiv576/LabExercises
/Conditions/Second.py
330
4.5
4
""" If temperature is greater than 30, it's a hot day other wise if it's less than 10; it's a cold day; otherwise, it's neither hot nor cold. """ temp = float(input("Enter the temperature : ")) if temp > 30: print("It's s hot day ") elif temp < 10: print("It is a cold day") else: print("It is neither hot ...
true
05bc68517729cf3bd4f2463c0b52b87f52799731
sanjiv576/LabExercises
/Lab2/ten_sumOfIntergers.py
456
4.25
4
# Write a Python program to sum of three given integers. However, if two values are equal, sum will be zero num1 = int(input("Enter the first integer number : ")) num2 = int(input("Enter the second integer number : ")) num3 = int(input("Enter the third integer number : ")) if num1 == num2 or num1 == num3 or num2 == n...
true
4b69189aa69becee50a00c534ac15e1cb7814b7f
sanjiv576/LabExercises
/Lab2/eight_sum_of_three-digits.py
279
4.28125
4
""" Given a three-digit number. Find the sum of its digits. 10. """ num = int(input("Enter any three-digits number : ")) copidNum = num sum = 0 for i in range(3): remainder = copidNum % 10 sum += remainder copidNum //= 10 print(f"Sum of each digit of {num} is {sum}")
true
27d6d4a16a3acb9da7f3fc436d77ec1d1433416f
sanjiv576/LabExercises
/Lab4_Data_Structure__And_Iternation/Question_answers/Four_pattern.py
666
4.28125
4
""" Write a Python program to construct the following pattern, using a nested for loop. * ** *** **** ***** **** *** ** * """ for rows1 in range(1,6): for column_increment in range(1,rows1+1): print("*", end=" ") print() for rows2 in range(4,0,-1): for column_decrement in range(1,rows2+1): ...
true
529b127ab15d54aa298124f2721c83d40a3f7aa5
sanjiv576/LabExercises
/Conditions/Five.py
848
4.125
4
""" game finding a secret number within 3 attempts using while loop import random randomNum = random.randint(1, 3) guessNum = int(input("Guess number from 1 to 10 : ")) attempt = 1 while attempt <= 2: if guessNum == randomNum: print("Congratulations! You have have found the secret number.") break ...
true
9f51539430d010667a5c75af4521382f4a565761
sadashiv30/pyPrograms
/rmotr/class1-Datatypes/printNumbersWithStep.py
864
4.28125
4
""" Write a function that receives a starting number, an ending number (not inclusive) and a step number, and print every number in the range separated by that step. Example: print_numbers_with_a_step(1, 10, 2) > 1 > 3 > 5 > 7 > 9 Extra: * Use a while loop * Use a flag to denote if the ending nu...
true
84d9e2001b0c977317c5b8a4b76f7b61f12fac76
sadashiv30/pyPrograms
/rmotr/class2-Lists-Tuples-Comprehensions/factorial.py
671
4.375
4
""" Write a function that produces all the members to compute the factorial of a number. Example: The factorial of the number 5 is defined as: 5! = 5 x 4 x 3 x 2 x 1 The terms o compute the factorial of the number 5 are: [5, 4, 3, 2, 1]. Once you have that function write other function that will compute the factorial...
true
b3525d32194630f56c9fcc3597096be6bf1e4e51
subaroo/HW08
/mimsmind0.py
2,341
4.65625
5
#!/usr/bin/env python # Exercise 1 # the program generates a random number with number of digits equal to length. # If the command line argument length is not provided, the default value is 1. # Then, the program prompts the user to type in a guess, # informing the user of the number of digits expected. # The pro...
true
9afb638ca9a41c3b77c2ec6181f4b3f257c65196
L7907661/21-FunctionalDecomposition
/src/m1_hangman.py
2,152
4.4375
4
""" Hangman. Authors: Zeyu Liao and Chen Li. """ # done: 1. PUT YOUR NAME IN THE ABOVE LINE. # done: 2. Implement Hangman using your Iterative Enhancement Plan. ####### Do NOT attempt this assignment before class! ####### import random def main(): print('I will choose a random secret word from a dictionary.' ...
true
fcc92cf50ac64f94f3fba6983559bc15f095a705
noahnaamad/my-first-python-blog
/Untitled1.py
255
4.15625
4
# print "hello cruel world" #if 3 > 2: # print("it works!") #else: # print("uh oh") # this is a comment def hi(names): for name in names: print('hey ' + name + '!') print('whats up') hi(['noah', 'hoshi', 'spanky', 'mitzi'])
false
11bec9486cb05e5a2957249cb47d750f4a947934
ElficTitious/tarea3-CC4102
/utilities/math_functions.py
848
4.40625
4
from math import * def next_power_of_two(x): """Returns the next power of two after x. """ result = 1 << ceil(log2(x)) return result def is_power_of_two(x): """Returns if x is a power of two or not. """ return log2(x).is_integer() def prev_power_of_ten(x): """Returns the previous powe...
true
d5a2fa6dbe4e5ba184c1ffc6b6d6f513946e6882
jonathanstallings/data-structures
/merge_sort.py
1,850
4.15625
4
"""This module contains the merge_srt method, which performs an in-place merge sort on a passed in list. Merge sort has a best case time complexity of O(n log n) when list is nearly sorted, and also a worst case of O(n log n). Merge sort is a very predictable and stable sort, but it is not adaptive. See the excellent '...
true
51433315d604c4cb973f97a875954c722674aa78
kristinadarroch/django
/Django-Python-Full-Stack-Web-Devloper-master/Python_Level_One/my-notes/lists.py
1,099
4.25
4
# LISTS my_list = ['adfsjkfdkfjdsk',1,2,3,23.2,True,'asd',[1,2,3]] print(my_list) # PRINTS THE LENGTH OF A LIST. this_list = [1,2,3] print(len(this_list)) print(my_list[0]) my_list[0] = 'NEW ITEM' print(my_list) # .append can add something to a list my_list.append('another new item - append') print(my_list) listt...
true
e80183defbc0fadafe7c978157eaff786387f22d
GaikwadHarshad/ML-FellowShip-Program
/WEEK 1/program41.py
831
4.28125
4
""" Write a Python program to convert an integer to binary keep leading zeros. Sample data : 50 Expected output : 00001100, 0000001100 """ def convert_to_binary(num): if num < 0: return 0 else: i = 1 bin1 = 0 # loop for convert integer to binary number while num...
true
cc7a4731ccb33f08769d283c87cf504a2b50be76
GaikwadHarshad/ML-FellowShip-Program
/WEEK_2/Tuple/program1.py
257
4.28125
4
""" Write a Python program to create a tuple. """ class Tuple: # creating tuple tuple1 = (2, 3, 5, 6, 5) def create_tuple(self): print("Tuple : ", self.tuple1) # instance creation Tuple_object = Tuple() Tuple_object.create_tuple()
false
beb2df68eb4747c631909dad5c61ab3b01e5f902
GaikwadHarshad/ML-FellowShip-Program
/WEEK_2/String/program9.py
1,653
4.40625
4
""" Write a Python program to display formatted text (width=50) as output. """ from myprograms.Utility import UtilityDS class String9: string = ''' Python is a widely used high-level, general-purpose, interpreted, dynamic programming language. Its design philosophy emphasizes code readability, and its syntax...
true
533a25953d7f4b983fb28c0895016e3c72231845
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/List/program11.py
1,152
4.125
4
""" Write a Python program to generate all permutations of a list in Python. """ from myprograms.Utility import UtilityDS class List11: create = [] k = 0 @staticmethod # function to perform operations on list def specified_list(): while 1: print("-----------------------------...
true
2de26bfd186e7ff89dc92e968b9db2125039416a
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/Dictionary/program7.py
1,733
4.21875
4
"""Write a Python program to print all unique values in a dictionary. Sample Data : [{"V":"S001"},{"V": "S002"},{"VI": "S001"},{"VI": "S005"},{"VII":"S005"},{"V":"S009"},{"VIII":"S007"}] Expected Output : Unique Values: {'S005', 'S002', 'S007', 'S001', 'S009'}. """ from myprograms.Utility import UtilityDS class Uniq...
false
cdf3c07056e0fa2a6421a02aeefb69e535947ca6
GaikwadHarshad/ML-FellowShip-Program
/WEEK 1/program6.py
360
4.1875
4
""" Write a Python program to calculate number of days between two dates. Sample dates : (2014, 7, 2), (2014, 7, 11) Expected output : 9 days. """ from datetime import date date1 = date(2019, 2, 14) date2 = date(2019, 2, 26) calculatedDays = date2 - date1 delta = calculatedDays print("Total numbers of days be...
true
8bab9aa97d88d37ba0b094f84a1c61c09a9e4e64
GaikwadHarshad/ML-FellowShip-Program
/WEEK 2/Tuple/program5.py
737
4.15625
4
""" Write a Python program to find the repeated items of a tuple. """ from myprograms.Utility import UtilityDS class Tuple5: tuple1 = (3, 5, 6, 5, 4, 3) # function performing on tuple to get items repeat or not def repeat_items(self): try: print("Tuple1 : ", self.tuple1) ...
true
77e973baa87d0c6e53dda194e49c79945f734a61
Oyelowo/Exercise-2
/average_temps.py
1,161
4.5
4
# -*- coding: utf-8 -*- """ Prints information about monthly average temperatures recorded at the Helsinki Malmi airport. Created on Thu Sep 14 21:37:28 2017 @author: oyedayo oyelowo """ #Create a script called average_temps.py that allows users to select a #month and have the monthly average temperatu...
true
cc1fdd0a07c688ee2bf9c5449765ed328f4455e4
udbhavsaxena/pythoncode
/ex1/ex3.py
420
4.1875
4
print "I will now count my chickens:" print "Hens", 25+30/6 print "Roosters", 100-25 * 3%4 print "Now I will count my eggs:" print 3+2+1-5+4%2-1/10 print "Is it true that 3+2<5-7?" print 3+2<5-7 print "What's 3+2?", 3+2 print "What's 5-7?", 5-7 print "Oh that is why it is false" print "How about some more" pri...
true
6a0ddaf8d7fef42fb22e047150e9914dc118efb7
derekb63/ME599
/lab2/sum.py~
683
4.375
4
#! usr/bin/env python # Derek Bean # ME 599 # 1/24/2017 # Find the sum of a list of numbers using a for loop def sum_i(list): list_sum = 0 for i in list: list_sum += i return list_sum # Caclulate the sum of a list of numbers using recursion def sum_r(list): list_sum = 0 return list_sum if __name__ =...
true
c55dfb4e6512462c5d25aefeb533de1fe4579993
derekb63/ME599
/hw1/integrate.py
2,485
4.3125
4
#! usr/bin/env python # Derek Bean # ME 599 # Homework 1 # 1/24/2017 from types import LambdaType import numpy as np import matplotlib.pyplot as plt ''' Integrate uses the right rectangle rule to determine the definite integral of the input function Inputs: f: a lambda function to be inetgrated a:...
true
fd4c56fb77d2bca1b5837022acf9da5ab71d5082
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-19/turtle-race-anne-final/main.py
1,318
4.28125
4
from turtle import Turtle, Screen from random import randint is_race_on = False screen = Screen() # set screen size using setup method screen.setup(width=500,height=400) # set the output of the screen.textinput() to user_bet user_bet =screen.textinput(title="Make your bet", prompt="Who do you think will win the race?...
true
4409d6ef0ae89f509322a9987188386ae484e566
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-25/Day-26-pandas-rows-cols/main.py
1,617
4.21875
4
# # weather_list = open("weather_data.csv", "r") # print(weather_list.readlines()) # # with open("weather_data.csv") as data_file: # data = data_file.readlines() # print(data) # # use pythons csv library https://docs.python.org/3/library/csv.html # import csv # with open("weather_data.csv") as data_file: # ...
true
ebb49e7ace998b22a0c5d71abdd116d0a3463b8d
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-24/Day-24-file-write-with/main.py
709
4.1875
4
# # file= open("my_file.txt") # # contents =file.read() # print(contents) # #also need to close the file # file.close() ####### another way to open a file that dosent require an explice file.close, does it for you #this is read only mode - mode defaluts to "r with open("my_file.txt")as file: contents = file.read()...
true
f79bc79ea4993f59665d55a4e3b5671920e575cf
AR123456/python-deep-dive
/work-from-100-days/Intermediate days 15-100/Day-21/Class-Inheritance/main.py
814
4.40625
4
class Animal: def __init__(self): #defining attributes self.num_eyes = 2 # defining method associated with the animal class def breathe(self): print("Inhale, exhale.") # passing Animal into Fish class so Fish has all the attributes # and methonds from the Animal class, then can have some...
true
fea9c9a4deb9d09218eb3957ed0a74fe7b760609
DenysZakharovGH/Python-works
/HomeWork4/The_Guessing_Game.py
624
4.15625
4
#The Guessing Game. #Write a program that generates a random number between 1 and 10 and let’s #the user guess what number was generated. The result should be sent back #to the user via a print statement. import random RandomVaried = random.randint(0,10) while True: UserGuess = int(input("try to guess the nu...
true
47bcd9f7c97992fc73a6c7df2f318f760ed1a67e
DenysZakharovGH/Python-works
/PythonHomework_6_loops.py
943
4.375
4
#1 #Make a program that generates a list that has all squared values of integers #from 1 to 100, i.e., like this: [1, 4, 9, 16, 25, 36, …, 10000] Squaredlist = [x**2 for x in range(100)] print(Squaredlist) #2 #Make a program that prompts the user to input the name of a car, the program #should save the input in a li...
true
2213d66214f18d0bf2e78837e6de8b2ed5058a9e
vamshidhar-pandrapagada/Data-Structures-Algorithms
/Array_Left_Rotation.py
1,169
4.3125
4
# -*- coding: utf-8 -*- """ Created on Sun Jun 11 04:32:11 2017 @author: Vamshidhar P """ """A left rotation operation on an array of size shifts each of the array's elements unit to the left. For example, if left rotations are performed on array 1 2 3 4 5, then the array would become 3 4 5 1 2 Given an array of ...
true
d533d93ced02eb641961555b90435128c9489dae
rohangoli/PythonAdvanced
/Leetcode/LinkedList/p1215.py
1,863
4.1875
4
## Intersection of Two Linked Lists # Example 1: # Input: intersectVal = 8, listA = [4,1,8,4,5], listB = [5,6,1,8,4,5], skipA = 2, skipB = 3 # Output: Intersected at '8' # Explanation: The intersected node's value is 8 (note that this must not be 0 if the two lists intersect). # From the head of A, it reads as [4,1,8,...
true
010f18a43932a52eb66c529dd57b85243f369b93
rohangoli/PythonAdvanced
/Leetcode/Arrays/p1164.py
672
4.25
4
## Reverse Words in a string # Example 1: # Input: s = "the sky is blue" # Output: "blue is sky the" # Example 2: # Input: s = " hello world " # Output: "world hello" # Explanation: Your reversed string should not contain leading or trailing spaces. # Example 3: # Input: s = "a good example" # Output: "example g...
true
496a7816bc06781a0f66278a8d6998a459e73d29
rohangoli/PythonAdvanced
/Leetcode/Trie/p1047.py
2,071
4.28125
4
## Implement Trie (Prefix Tree) # Example 1: # Input # ["Trie", "insert", "search", "search", "startsWith", "insert", "search"] # [[], ["apple"], ["apple"], ["app"], ["app"], ["app"], ["app"]] # Output # [null, null, true, false, true, null, true] # Explanation # Trie trie = new Trie(); # trie.insert("apple"); # tri...
false
375d845bd8d74cc52a913e2fa0bb47bbab49196d
mosesxie/CS1114
/HW #4/hw4q2a.py
361
4.15625
4
userCharacter = input("Enter a character: ") if userCharacter.isupper(): print(userCharacter + " is a upper case letter.") elif userCharacter.islower(): print(userCharacter + " is a lower case letter.") elif userCharacter.isdigit(): print(userCharacter + " is a digit.") else: print(userCharacte...
false
0573712cf14f4e7fb92107ddee746a70dff5d9e2
mosesxie/CS1114
/Lab #4/q1.py
485
4.125
4
xCoordinate = int(input("Enter a non-zero number for the X-Coordinate: ")) yCoordinate = int(input("Enter a non-zero number for the Y-Coordinate: ")) if xCoordinate > 0 and yCoordinate > 0: print("The point is in the first quadrant") elif xCoordinate < 0 and yCoordinate > 0: print("The point is in the second...
true
98612114f9f90aa761c9a75921703e0b96f78c5f
apaskulin/euler
/problems.py
1,989
4.15625
4
#!/user/bin/env python2 def problem_01(): # 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. sum = 0 for i in range(1, 1000): if i % 3 == 0 or i % 5 == 0: ...
true
6fd9f34ee976576be14c02a6e9aebbd12d504a30
jonathan-durbin/fractal-stuff
/gif.py
1,371
4.125
4
#! /usr/bin/env python3 # gif.py """Function to generate a gif from a numbered list of files in a directory.""" def generate_gif(directory: ("Folder name", "positional"), image_format: ('Image format', 'positional') = '.png', print_file_names=False): """Generate a gif from a numb...
true
010fb9b9923482c36309301fc16ea978fb7cd52c
yunusemree55/PythonBTK
/lists/list-comprehension.py
653
4.1875
4
for x in range(10): print(x) numbers = [x for x in range(10)] print(numbers) for x in range(10): print(x**2) numbers = [x**2 for x in range(10)] print(numbers) numbers = [x*x for x in range(10) if x % 3 == 0] print(numbers) myString = "Hello" myList = [letter for letter in myString] print(myList) yea...
false
c982dd14121836aa11c9aa226a665c5b8cfc80ea
yunusemree55/PythonBTK
/otherss/iterators.py
325
4.21875
4
liste = [1,2,3,4,5] iterator = iter(liste) # try: # print(next(iterator)) # print(next(iterator)) # print(next(iterator)) # print(next(iterator)) # print(next(iterator)) # print(next(iterator)) # except StopIteration: # print("Hata ! İndex dışına çıkıldı") print(next(iterator))
false
bcb9a6a66fa28599294e53248a4e3fc55da636e2
ankawm/NowyProjektSages
/exception_catch_finally.py
1,415
4.46875
4
""" * Assignment: Exception Catch Finally * Required: yes * Complexity: easy * Lines of code: 8 lines * Time: 8 min English: 1. Convert value passed to the function as a `degrees: int` 2. If conversion fails, raise exception `TypeError` with message: 'Invalid type, expected int or float' 3. Use `fi...
false
72cd03a29488ec0cae62134473df244739a548f1
ankawm/NowyProjektSages
/type_int_trueDiv.py
1,740
4.40625
4
""" * Assignment: Type Int Bits * Required: yes * Complexity: easy * Lines of code: 3 lines * Time: 3 min English: 1. Calculate altitude in kilometers: a. Kármán Line Earth: 100_000 m b. Kármán Line Mars: 80_000 m c. Kármán Line Venus: 250_000 m 2. In Calculations use floordiv (`//`) ...
false
1c5790befa09be2072c7e663f8abf862eceb4458
ankawm/NowyProjektSages
/conditional_modulo_operator.py
1,539
4.34375
4
""" * Assignment: Conditional Operator Modulo * Required: yes * Complexity: easy * Lines of code: 3 lines * Time: 3 min English: 1. Read a number from user 2. User will input `int` and will not try to input invalid data 3. Define `result: bool` with parity check of input number 4. Number is even, when ...
false
ba13ea5794eb0940acd21f591f84f13514468452
bsadoski/entra21
/aula11/create-db.py
969
4.28125
4
#sqlite3 já faz parte do python :D import sqlite3 # isso cria o banco, caso não exista! conn = sqlite3.connect('poke.db') # para fazermos nossas operações, sempre precisaremos de um cursor cursor = conn.cursor() # criando a tabela (schema) cursor.executescript(""" CREATE TABLE treinadores( id INTEGER NOT NU...
false
8cc2bcc6aa36aa941b90bb538609c818e6509556
angelmtenor/AIND-deep-learning
/L3_NLP/B_read_text_files.py
1,140
4.25
4
"""Text input functions.""" import os import glob def read_file(filename): """Read a plain text file and return the contents as a string.""" # Open "filename", read text and return it with open(filename, 'r') as f: text = f.read() return text def read_files(path): """Read all files that ...
true
e3c201cfb4a65055a71a83dc8e570fb6db86ef1c
ebinezh/power-of-number
/power of a number.py
221
4.15625
4
# power of a number n=float(input("Enter a number:")) e=int(input("Enter exponent: ")) for i in range(1, e): x=n**e print(n, "^", e, "=", x) # thanks for watching # like, share & subscribe # Dream2code
false
9414f815d96dcbea31a100ce8c005334c0a6afb8
LeBoot/Practice-Code
/Python/number_divis_by_2_and_or_3.py
704
4.3125
4
#Ask for favorite number. favnum = int(input("What is your favorite whole number? ").strip()) #Divisible by 2. if (favnum/2 == int(favnum/2)) and (not(favnum/3 == int(favnum/3))) : print("Divisible by 2 but not by 3.") #Divisible by 3. elif (not(favnum/2 == int(favnum/2))) and (favnum/3 == int(favnum/3)) : pr...
false
705d9deaa4f8bcec1980a6756d2e18cfbf7e955e
LeBoot/Practice-Code
/Python/Udemy-The-Python-Bible/name_program.py
309
4.1875
4
#Ask user for first then last name. namein = input("What is your full name? ").strip() #Reverse order to be last, first. forename = namein[:namein.index(" "):] surname = namein[namein.index(" ") + 1 ::] #Create output. output = "Your name is {}, {}.".format(surname, forename) #Print output. print(output)
true
cc596f40bc8604a4f83499ae2521c2ebf336b734
ericachesley/code-challenges
/zero-matrix/zeromatrix.py
1,293
4.25
4
"""Given an NxM matrix, if a cell is zero, set entire row and column to zeroes. A matrix without zeroes doesn't change: >>> zero_matrix([[1, 2 ,3], [4, 5, 6], [7, 8, 9]]) [[1, 2, 3], [4, 5, 6], [7, 8, 9]] But if there's a zero, zero both that row and column: >>> zero_matrix([[1, 0, 3], [4, 5, 6], [7, 8,...
true
2a32fb6338772f353e2432df396221bc027a6838
MikeyABedneyJr/CodeGuild
/python_basic_exercises/class2(dictionaries).py
519
4.4375
4
dictionary = {'name':'Mikey', 'phone_number': '867-5309'} #python orders in most memory efficient manner so phone # might appear first print dictionary['name'] dictionary['name'] = 'Mykee' #changed value of name print dictionary['name'] dictionary['age'] = 32 print dictionary #just added a key named "age" which is 32 {...
true
32094ffec3b86176f0856be0944f89350d9aad16
newphycoder/USTC_SSE_Python
/练习/练习场1/练习4.py
343
4.3125
4
from tkinter import * # Import all definitions from tkinter window = Tk() label = Label(window , text = "Welcome to Python") # Create a "label button = Button(window , text = "Click Me") # Create a button label.pack() # PI ace the "label in the window button.pack() # Place the button in the window window.mainloop() ...
true
aac6288953cdbc80caf8134621d1309cf7a99666
Luis-Ariel-SM/Modulo-02-Bootcamp0
/P05, La recursividad en funciones.py
1,048
4.15625
4
# La recursividad es un paradigma de programacion basado en funciones solo se necesitan a asi mismas y se invocan a si mismas. Su mayor # problema es que puede ejecutar bucles infinitos ya que no para de llamarse por lo cual su punto mas importante es la condicion de # parada. Es un codigo original y elegante a nivel d...
false
168577bc4d0ba59a9dc1e8dfc19ec2cde1c3c452
lucifer773/100DaysofPythonCode
/Day4 - Rock Paper and Scissor Game/Rock Paper Scissor/main.py
1,191
4.40625
4
"""Using ASCI art for console printing""" rock = ''' _______ ---' ____) (_____) (_____) (____) ---.__(___) ''' paper = ''' _______ ---' ____)____ ______) _______) _______) ---.__________) ''' scissors = ''' _______ ---' ____)____ ______) ...
false
5bfa5c7b40fa5469f5454f7edb00d366dc137000
KyleMcInness/CP1404_Practicals
/prac_02/ascii_table.py
579
4.4375
4
LOWER = 33 UPPER = 127 # 1 character = input("Enter a character: ") ascii_code = ord(character) print("The ASCII code for {} is {}".format(character, ascii_code)) # 2 ascii_code = int(input("Enter a number between 33 and 127: ")) while ascii_code < LOWER or ascii_code > UPPER: print("Enter a number greater than o...
true
0865ce79212062970ef2647f3fa6243b55ce8fde
KyleMcInness/CP1404_Practicals
/prac_04/list_exercises.py
450
4.28125
4
numbers = [] for i in range(5): number = int(input("Number: ")) numbers.append(number) print("The first number is {}".format(numbers[0])) print("The last number is {}".format(numbers[-1])) numbers.sort() print("The smallest numbers is {}".format(numbers[0])) print("The largest number is {}".format(numbers[-1]...
true
fe1ae86c4f9fb4ba800a0c7d478f617a13df498d
A01029961/TC1001-S
/Python/01_turtle.py
663
4.5625
5
#!/usr/bin/python3 """ First example of using the turtle graphics library in Python Drawing the shape of a square of side length 400 Gilberto Echeverria 26/03/2019 """ # Declare the module to use import turtle #Draw a square, around the center side = 400 # Move right turtle.forward(side/2) # Turn to the left turtle...
true
145b7416b4f46ff8fa1b60cf57ac425cfc911fae
mohsinkazmi/Capture-Internet-Dynamics-using-Prediction
/Code/kNN/kNN.py
1,328
4.1875
4
from numpy import * from euclideanDistance import euclideanDistance def kNN(k, X, labels, y): # Assigns to the test instance the label of the majority of the labels of the k closest # training examples using the kNN with euclidean distance. # # Input: k: number of nearest neighbors # X: traini...
true
6122e404e29b3c97b7fe2bdd8705bfc7f7bb202f
Vinay795-rgb/code
/Calendar.py
496
4.3125
4
# Write a program to print the calendar of any given year import calendar y = int(input("Enter the year : ")) m = 1 print("\n***********CALENDAR*******") cal = calendar.TextCalendar(calendar.SUNDAY) # An instance of TextCalendar class is created and calendar. SUNDAY means that you want to start dis[playing t...
true
0fa5f57b1351604b6f1c7d8858d26909637ca57b
dakshitgm/Specialization-Data-structure-and-Algorithm-Coursera
/algorithm on string/week4/kmp.py
827
4.125
4
# python3 import sys def find_pattern(pattern, text): """ Find all the occurrences of the pattern in the text and return a list of all positions in the text where the pattern starts in the text. """ result = [] # Implement this function yourself conc=pattern+'$'+text values=[0]*len(conc) last=0 ...
true
a44fb9384ca70cfc7ea65c57a825efae379e1fc1
wickyou23/python_learning
/python3_learning/class_inheritance.py
1,429
4.34375
4
#####Python inheritance and polymorphism # class Vehicle: # def __init__(self, name, color): # self.__name = name # self.__color = color # def getColor(self): # return self.__color # def setColor(self, color): # self.__color = color # def getName(self): # ret...
false