blob_id
string
repo_name
string
path
string
length_bytes
int64
score
float64
int_score
int64
text
string
is_english
bool
74f507795fb12a75b0a499f5f302c4252e2ab9f7
leonguevara/WriteSomething_Python
/main.py
887
4.6875
5
# main.py # WriteSomething_Python # # This program will help you get the size of a phrase given by the user, and let you # know if that size is an even or odd number. # # Python interpreter: 3.6 # # Author: León Felipe Guevara Chávez # email: leon.guevara@itesm.mx # date: May 29, 2017 # # We ask t...
true
73dbb32953bc17d70ee927370b1a0a75e0e27e2c
JRRRRRRR/Python
/Comparing(ifelse).py
324
4.4375
4
#Test if a number is even or odd number = int (input("Enter input: ")) if number % 2 == 0: # == means "is equal to" print(number, "is even") else: print(number, "is odd") if number > 5: print("Greater than 5") elif number < 0: print("Number is negative") else: print("Number is relatively small") ...
true
8aa467a97e853048c5836b2e1bcd8cd0ba93bc95
somesh202/Assignments-2021
/Week1/run.py
804
4.15625
4
## This is the most simplest assignment where in you are asked to solve ## the folowing problems, you may use the internet ''' Problem - 0 Print the odd values in the given array ''' arr = [5,99,36,54,88] import array as arr a = arr.array('i', [5, 99, 36,54,88]) for i in a: if i%2 != 0: print(i, end=" ") ...
true
ca0ea374d2777b6f48dabc48935d1e3729a203ff
SherriMaya/CIS189
/validate_input_in_functions.py
989
4.28125
4
"""Takes a test_name, test_score, and invalid_message that validates the test_score, asking the user for a valid test score until it is in the range, then prints valid input as 'Test name: #""" def score_input(test_name, test_score=0, invalid_message='Invalid test score, try again!'): """Returns ...
true
eb1da2a4d6d9afdef681607b88a2ff5fea07d88e
KeetonMartin/HomemadeProgrammingIntro
/Lesson7.py
1,890
4.3125
4
#Lesson 7 topics #Problem 1 """ Write a function taking in a string like "WOW this is REALLY amazing" and returning "Wow this is really amazing". String should be capitalized and properly spaced. Hint: Try using functions like "APPLE".lower() or ourList = "Multiple words in a string".split() ["Multiple", "words", "i...
true
b251b03e61f2ffd2c4af1727b8d399b439ad87c4
KeetonMartin/HomemadeProgrammingIntro
/Lesson17.py
2,084
4.40625
4
#Lesson 17 #Student Name: """ Today's lesson will be mostly work on anticipating the actions of a program. """ teams = ["Warriors", "76ers", "Celtics", "Lakers", "Clippers"] print("Problem 1") for i in range(0, len(teams)): print(i) print(teams[i]) #Group: """ 0 Warriors 1 76ers 2 Celtics 3 Lakers 4 Clippe...
true
ea064efef05364414aa5b1665e42bb362d7a2182
stroudgr/UofT
/CSC148/exercises/ex3/linked_list_test.py
2,302
4.15625
4
# Exercise 3 - More Linked List Practice # # CSC148 Fall 2015, University of Toronto # Instructor: David Liu # --------------------------------------------- """Exercise 3, Task 1 TESTS. Warning: This is an extremely incomplete set of tests! Add your own to practice writing tests, and to be confident your code is corre...
true
310abd3e7b24f02ec4bd5132e482038a1d30184a
yoliskdeveloper/zero_to_hero_bootcamp_udemy
/projects/project3_compilation/hutang_pinjaman.py
817
4.125
4
""" kalkulasi pembayaran bulanan dari nilai tetap dari cicilan rumah berdasarkan bunga yang diberikan, dan butuh berapa lama cicilan rumah itu selesai """ print('CALCULATOR CICILAN RUMAH') print('Masukkan jangka waktu cicilan rumah (dalam bulan, jika 3 tahun = 36 bulan)') bulan = int(input(">>> ")) print('Masukkan bun...
false
e5409030792e51ee91c431312410622389ba1544
matthewmjm/100-days-of-code-days-1-through-10
/day3/leap.py
355
4.125
4
year = int(input("Input a year: ")) if year % 4 == 0: if year % 100 == 0: if year % 400 == 0: print(f"So the year {year} is a leap year") else: print(f"So the year {year} is a not leap year") else: print(f"So the year {year} is a leap year") else: print(f"So t...
false
5fcd0cdd756b4b4e8ee9349a04ec7dfd52efeefd
PratikAmatya/8-bit-adder-Python-Program
/Program Files/NumberValidation.py
1,028
4.40625
4
# function which returns the correct number entered by the user def validate(numberPosition): correctNumberEntered=False while correctNumberEntered == False: # Exception Handling using try except block try: if numberPosition==1: # Converting the entered number to Int datatype number=int(input("\nEnter ...
true
e9649e34baab504cc78572e00e821d4595ae7478
davidrey87/Learn-x-in-y-minutes-Python
/Variables_Colecciones.py
2,500
4.25
4
# Print print "Yo soy Python, gusto en conocerte." # Obtener Datos dato = int(raw_input("Pon algun dato: ")) dato2 = int(input("Pon algun dato: ")) print(dato+dato2) #Variable var = 5 print(var) #Expresiones print("yahoo!" if 3 > 2 else 2) # Lista li = [] # Lista inicializada con datos other_li = [4, 5, 6] print(ot...
false
568ece6291cd4be09f1fb0fbeb8eee9805ee8761
louloz/Python-Crash-Course
/Ch3-4List/for_loop_list_2.py
622
4.8125
5
# Python Crash Course, Eric Matthes, no starch press # Textbook Exercises # Louis Lozano # 3-1-2019 # for_loop_list_2.py # List comprehension used to create a list of odd numbers between 1 and 20 odd_numbers = [odd for odd in range(1, 20, 2)] for num in odd_numbers: print(num) # List comprehension ...
true
6debbb8e40919aca9555ffb135ad494cb7ffcd92
louloz/Python-Crash-Course
/Ch7_User_Input_and_while_Loops/7-2_restaurant_seating.py
477
4.34375
4
# Python Crash Course, Eric Matthes, no starch press # Ch7 User Input and while Loops # Textbook Exercises # Louis Lozano # 3-8-2019 # 7-2_restaurant_seating.py group_num = input("How many people are in your dinner group?") # Converts user input(string value) into an int data type. # Lets you use user inp...
true
bdb446c4ab9e7a52ecd08478eadcc26894bf90c8
louloz/Python-Crash-Course
/Ch5IfStatements/5-11_ordinal_numbers.py
524
4.34375
4
# Python Crash Course, Eric Matthes, no starch press # Ch5 if statements # Textbook Exercises # Louis Lozano # 3-5-2019 # 5-11_ordinal_numbers.py numbers = [1, 2, 3, 4, 5, 6, 7, 8, 9] # A for loop that uses conditional statements to handle certain # items in a list differently. for number in numbers: ...
false
b290a9c28c4a25564238191f84e3737ceccfff5a
louloz/Python-Crash-Course
/Ch11_Testing_Your_Code/Employee.py
876
4.28125
4
# Python Crash Course, Eric Matthes, no starch press # Ch11 Files and Exceptions # Textbook Exercises # Louis Lozano # 07-08-2019 # Try It Yourself: 11-3 'Employee.py' # Python Version: 3.5.3 # Description: Creates an Employee class that takes a first name, last name, # and salary. Has a function to giv...
true
84fb398b4a5f7318ae4e5684e0ab2ddf30d5ccfb
barawalojas/Hacktoberfest2020-1
/Floyd_Warshall.py
1,527
4.28125
4
""" Floyd Warshall Algorithm finds All-pair shortest path for an weighted directed graph. It uses idea that distance to any points(v) must be greater sum of connecting edge weight(u,v) and preceding distance to the point(u). """ V = 4 INT_MAX = 9999 def floydWarshall(graph): dist = [row[:] for row in graph] ...
true
40336426062da448ddb8260af6ea39f82a1218ab
Tarini-Tyagi/TryPython
/Task3.py
490
4.125
4
from datetime import datetime name=input("Enter your name: ") now = datetime.now() current_time = now.strftime("%H:%M:%S") hrs=int(now.strftime("%H")) min=int(now.strftime("%M")) if hrs>4 and hrs<12: print("Good Morning "+name) elif hrs==12: print("Good Afternoon " + name) elif hrs>12 and hrs<15: print("...
true
3c93333318257673bfcad316d2ca573a8e5750e5
runaphasia335/Traveling-Salesman-WGUPS
/Algorithm.py
2,320
4.34375
4
# Carlos Perez # Student ID: 000819792 import heapq # Algorithm to determine the shortest path. # function takes the graph and the starting node. Sets the starting node to 0 distance, and predecessor to none. Since each node # has a minimum distance of MAX. 0 distance for the starting will determine each edge weight...
true
fe2b52ff655e939074dd5c02831ebc62fa4ad309
CrzRabbit/Python
/leetcode/0461_E_汉明距离.py
715
4.15625
4
''' 两个整数之间的汉明距离指的是这两个数字对应二进制位不同的位置的数目。 给出两个整数 x 和 y,计算它们之间的汉明距离。 注意: 0 ≤ x, y < 231. 示例: 输入: x = 1, y = 4 输出: 2 解释: 1 (0 0 0 1) 4 (0 1 0 0) ↑ ↑ 上面的箭头指出了对应二进制位不同的位置。 ''' class Solution: def hammingDistance(self, x: int, y: int) -> int: i = 1 count = 0 IM...
false
76d5e82c7bac3d270856142c7a48490ec0e4fe41
niosus/EasyClangComplete
/plugin/utils/unique_list.py
1,351
4.28125
4
"""Encapsulates set augmented list with unique stored values.""" class UniqueList: """A list that guarantees unique insertion.""" def __init__(self, other=None): """Init with another iterable if it is present.""" self.__values = list() self.__values_set = set() if not other: ...
true
b45fc04bccee35570f32935d6f8425a3974ae0d5
caoxudong/code_practice
/projecteuler/Problem4.py
758
4.15625
4
""" A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 * 99. Find the largest palindrome made from the product of two 3-digit numbers. """ import sys def isPalindrome(number) : palindromeString = str(number) palindromeStringlength...
true
4fa58eab70f8308c2808ba39f8cd351416c0be7d
elisainz/UADE-Best-of-Python
/Sainz_EjContraseña While True.py
2,283
4.28125
4
'''Ejercicio: Contraseñas! En general las contraseñas a crear deben cumplir reglas por seguridad para que sean válidas. Desarrolle un programa que ingrese contraseñas hasta ingresar una contraseña vacía. A medida que se ingresan verifique e informe si cumple con las reglas: No puede comenzar con número. Debe contener ...
false
d05173c139756b13c785c17485651f2cc2904e32
udaykumarbhanu/iq-prep
/ibts364/integer-to-roman.py
855
4.125
4
'''Given an integer, convert it to a roman numeral, and return a string corresponding to its roman numeral version Input is guaranteed to be within the range from 1 to 3999. Example : Input : 5 Return : "V" Input : 14 Return : "XIV" ''' class Solution: # @param A : integer # @return a strings def intTo...
true
b4e348abaf559bbf9cccbfb47397ced7c0c9296f
evansmusomi/python3-101
/design-patterns/abstract_factory.py
1,097
4.65625
5
""" Abstract factory example""" class Dog: """ One of the objects """ def speak(self): """ Implements dog's speech """ return "Woof!" def __str__(self): return "Dog" class DogFactory: """ Concrete factory """ def get_pet(self): """returns a dog object""" ...
true
bdef61984eace5ddecb594e7ee1feacffd329f1d
hrokr/pyknowledge
/short_progs/04.py
533
4.15625
4
#write a program that will print the song "99 bottles of beer on the wall". #for extra credit, do not allow the program to print each loop on a new line. # remove the # in the line above the decriment for extra credit. def bottles_of_beer(bottles): while bottles > 0: print (bottles, "bottles of beer on t...
true
e931ded5802c2206b832bb03f45348b7bd8631a3
akashmg/Python
/google-python-exercises/MyCode/hello.py~
312
4.1875
4
#!/user/bin/python # Using sys """ A program that takes an argument from the terminal and prints it """ import sys def main(): if len(sys.argv) >= 2: name = sys.argv[1] print "Hello" + name + "\nBuenos Dias!\n" else: print "Program is empty!" if __name__ == '__main__': main()
true
a2088d6c6f790c94d09366c961495a9174d76ac5
D0rianGrey/PythonAutomation
/practice/letpy.py
560
4.125
4
# default = input() # default_with_out_space = default.replace(" ", "").lower() # reverse = default_with_out_space[::-1].lower() # if default_with_out_space == reverse: # print("Да") # else: # print("Нет") # print(default_with_out_space) # print(reverse) # a = input() # # if len(a) >= 8 and a.isdigit(...
false
865d8459ec0eaf6292e8aa0193bfc53e8950b447
Jeffmanjones/python-for-everybody
/13_Extract_Data_from_JSON.py
1,567
4.40625
4
""" Extracting Data from JSON In this assignment you will write a Python program somewhat similar to http://www.py4e.com/code3/json2.py. The program will prompt for a URL, read the JSON data from that URL using urllib and then parse and extract the comment counts from the JSON data, compute the sum of the numbers in ...
true
ff5da270e46f7f9a86b121d94837f2da97c133ad
xpxu/learnPython
/decorator/multiple_closing.py
879
4.28125
4
''' Q: what is a decorator? A: input for a decrator is a function and it will return a new function ''' def log1(func): def wrapper(*args, **kwargs): print 'start' func(*args, **kwargs) print 'end' return wrapper def log2(message): # print message def decorator(func): ...
true
30590dc07df4e04943e8239cb01854279ab0b97c
prajaktanarkhede97/Python-Assignments
/Program-3.py
344
4.125
4
#Write a program which contains one function named as Add() which accepts two numbers from user and return addition of that two numbers. def add(num1,num2): ans=(num1 + num2) return ans value1=(int(input("Enter value of num1"))) value2=(int(input("Enter value of num2"))) ret= add(value1,value2) print("Sum of n...
true
82bdbb489d3b5d882be807bebdc7a2496667f38f
Pandeyjidev/All_hail_python
/DSA_MadeEasy/queues/queue_list.py
856
4.125
4
class Queue(object): def __init__(self): self.queue = [] def enqueue(self,data): self.queue.insert(0,data) def dequeue(self): return self.queue.pop() def isEmpty(self): return not bool(self.queue) def size(self): return len(self.queue) def peek...
false
9e6649455475a2943d2b12a22fea1d73e68b4306
Sylk/mit-programming-in-python
/ch-02/finger-exercise-one.py
651
4.4375
4
# Finger exercise: Write a program that examines three variables—x, y, and z—and prints the largest # odd number among them. If none of them are odd, it should print a message to that effect. from random import randint x, y, z = randint(0, 1000), randint(0, 1000), randint(0, 1000) print("X => " + str(x), "\nY => " + ...
true
c5eced1f1879b6c91ebb1c8829c6ca87927b91f6
Tanish74/Code-and-Compile
/meeting late comers.py
945
4.15625
4
""" A certain number of people attended a meeting which was to begin at 10:00 am on a given day. The arrival time in HH:MM format of those who attended the meeting is passed as the input in a single line, with each arrival time by a space. The program must print the count of people who came late (after 10:00 am) to the...
true
308efdd9e0a784de279ef0694f3121f5bae975f6
Tanish74/Code-and-Compile
/odd length string-middle three letters.py
460
4.375
4
"""An odd length string S is passed as the input. The middle three letters of S must be printed as the output. Input Format: First line will contain the string value S Output Format: First line will contain the middle three letters of S. Boundary Conditions: Length of S is from 5 to 100 Example Input/Output 1: Inpu...
true
90214a01620e9429c69d946047cb083b3656cc61
Tanish74/Code-and-Compile
/lowest mileage car.py
800
4.25
4
""" The name and mileage of certain cars is passed as the input. The format is CARNAME@MILEAGE and the input is as a single line, with each car information separated by a space. The program must print the car with the lowest mileage. (Assume no two cars will have the lowest mileage) Input Format: The first line contain...
true
6bc2aca3ca41f654396106ac5c44b44784ed6a22
eruiztech/Python
/Lab 2/bmi.py
858
4.3125
4
#Edgar Ruiz #CS 299 #Lab 2 #September 29th, 2016 #!/usr/bin/python print("Lab 2") print("Calculate your BMI") unitChoice = input("Would you like to use (1) kilograms/meters or (2) pounds/inches as units?\nPlease enter 1 or 2\n") if unitChoice == 1: weight = float(input("Weight in kilograms: ")) height = float(input...
false
3ad41e815a9a8f97c338c1f16ccfaf1438ce3c21
akshya-j31/python_bootcamp
/assignment4.py
945
4.21875
4
import os import os.path from os import path def main(): FileName = input("Please enter the file name: ") if path.exists(FileName): print("file exists") UserInput = input("***Please enter your choice***\na. Read the file\nb. Delete the file and start over\nc. Append the file\n\n") if Us...
true
0cf145c5a1915b268513880e66c448c1cd2f7a41
OkoroKelvin/parsel_tongue_mastered
/kelvin_okoro/chapter_seven/question_43.py
388
4.28125
4
# Write a function that takes a string as an argument, converts the string to a list of # characters, sorts the list, converts the list back to a string, and returns the resulting string. def conversion(strings, ): my_list = [] my_list += strings my_list.sort() my_new_string = "" return my_new_str...
true
12682c6d5d48916663860ba24972ae1ad91d0035
erikagreen7777/HackerRankPython
/capitalize.py
1,127
4.375
4
Capitalize! You are asked to ensure that the first and last names of people begin with a capital letter in their passports. For example, alison heck should be capitalised correctly as Alison Heck. Given a full name, your task is to capitalize the name appropriately. Input Format A single line of input containing t...
true
9bf22058173040b971477e36a5eff206b01d0450
calebajayi/Python_Codes
/OOSD_revision.py
2,537
4.21875
4
# # Exercise 1: Write a Python program that reads a text file and # # prints a list of unique words in the text. # # filename = "input1.txt" # unique_words = [] # try: # fp = open(filename, "r") # lines = fp.readlines() # for line in lines: # line = line.strip() # words = line.spli...
true
ceab9c9cfc0e4327b9b22b71f5f969a9d6b17477
botantantan/pangkui
/hw5/hw5_9.py
480
4.15625
4
""" Input example 1: FONTNAME and FILENAME Output sample 1: FONTAMEIL Input example 2: fontname and filrname Output sample 2: Not Found """ str1 = input() str2 = '' str3 = '' for ch in str1: if ord('A') <= ord(ch) <= ord('Z'): str2 += ch mylist = list(set(str2)) ...
true
e317b5e673f8914253e1dab99412ee407ff10115
markyashar/Python_Scientific_Programming_Book
/looplist/odd.py
454
4.28125
4
""" Generate odd numbers This program generates odd numbers from 1 to n. It sets n in the beginning of the program and uses a while loop to compute the numbers (making sure that if n is an even number, the largest generated odd number is n-1). """ n = 9 # The upper limit odd = 1 # Sta...
true
a4f140176275a52b0febb2f1bd5b56981938674f
thatnerdjoe/violent_python
/week03/lecture/Exp-8.py
936
4.25
4
''' Hash File Functions and usage example ''' from __future__ import print_function import hashlib import sys ''' Determine which version of Python ''' if sys.version_info[0] < 3: PYTHON_2 = True else: PYTHON_2 = False def HashFile(filePath): ''' function takes one input a vali...
true
c63db43c96052601ed5ba6d6bafd4265daeb54db
Stav30/Python
/range.py
209
4.125
4
""" In 3.X range is an iterable, that generates items on demand, so we need to wrap it in a list call to display its results all at once. """ x = list(range(5)), list(range(2,5)), list(range(0,10,2)) print(x)
true
f21eab6cb4090ffdf3aa201a9e685976b7830343
araschermer/python-code
/LeetCode/is-palindrom.py
1,024
4.4375
4
def is_palindrome(x): """ Given an integer x, return true if x is palindrome integer. An integer is a palindrome when it reads the same backward as forward. For example, 121 is palindrome while 123 is not. :type x: int :rtype: bool """ val = str(x) # convert number to string retur...
true
c963229ed1fcbb5dc25dc974c3c98a883960ae7e
araschermer/python-code
/LeetCode/move-zeros.py
963
4.3125
4
def move_zeroes(nums): """Given an array nums, write a function to move all 0's to the end of it while maintaining the relative order of the non-zero elements. :type nums: List[int] :rtype: None Do not return anything, modify nums in-place instead. """ # approach 01 zero_counter = 0 whi...
true
2ebda9a3f3b3c87168eb4263a11f01afbfc9fa67
araschermer/python-code
/algorithms_and_data_structures/arrays/arrays.py
2,137
4.40625
4
#Basic Array operaitons # appending elements to the first unoccupied element in the array array1 = [] for num in range(10): array1.append(num) print(f"array1: {array1}") # Inserting elements at the beginning of the array array3 = [] for num in range(10): array3.insert(0, num) print(f"array3:{array3}") # inser...
true
273846508ef2f7cb6b4fdb979ce61dcff99a7c2c
araschermer/python-code
/LeetCode/count-primes.py
1,104
4.21875
4
def count_primes(n): """Count the number of prime numbers less than a non-negative number, n. # extra: return the prime numbers :type n: int :rtype: int """ prime_numbers = [] if n < 2: return 0 prime = [1] * n # fill a list of length n with 1 for i in range(2, n): i...
true
cbd1a5e0ed518d7ed64684fe0c7dfaad577fcf3a
araschermer/python-code
/LeetCode/reverse-integer.py
1,231
4.34375
4
def reverse_integer(x): """Given a signed 32-bit integer x, return x with its digits reversed. If reversing x causes the value to go outside the signed 32-bit integer range [-2^31, (2^31) - 1], then return 0. :type x: int :rtype: int """ x_string = str(x) if x_string[0] == "-": # in case t...
true
52e4f4dd1af4e34768962cc25132d8ba3a8f07ec
araschermer/python-code
/100 days of code/tip-calculator.py
714
4.3125
4
def calculate_tip(bill, people, tip): """ calculates a tip based on a given percentage of the total bill amount. the functionality can be viewed on repl.it website using the following links https://repl.it/@abdelkha/Tip-calculator?embed=1&output=1#main.py""" tip_percentage = tip / 100 total_tip_amo...
true
e7edf71414e6531335ebed17b5cbbcfe2478d07e
araschermer/python-code
/algorithms_and_data_structures/arrays/largest_range.py
2,138
4.375
4
def find_largest_range(array: [float]): """Returns the largest range of numbers that exist in the array Time complexity: O(NlogN) Space complexity: O(1)""" current_range = 1 max_range = 1 upper_bound = array[0] array.sort() for index, number in enumerate(array): if number == arra...
true
10b8325ef58e419e858c6a85f89feaa354d5197c
araschermer/python-code
/algorithms_and_data_structures/linked_lists/merge_linked_lists.py
2,394
4.3125
4
from linked_lists_util import print_linked_list, insert_list, Node class LinkedList: def __init__(self): self.head = None def merge_linked_lists(self, list_to_merge): """returns a single linked list out of merging two single linked lists with sorted elements.""" pointer1 = self.head ...
true
36ad6e0255aef608a48b16381dd477bed2286a37
kateallison/Python_Learnins
/ex11.py
961
4.40625
4
#ex11.py = Asking Questions #https://learnpythonthehardway.org/book/ex11.html print "How old are you?", age = raw_input() print "How tall are you?", height = raw_input() print "How much do you weigh?", weight = raw_input() print "So, you're %r old, %r tall and %r heavy." % ( age, height, weight) #[Take note of the ...
true
27982ee0b2058e23ff0889c8f2009b94a0ba6358
kateallison/Python_Learnins
/ex14.py
1,833
4.28125
4
#ex14.py = Prompting and Passing #https://learnpythonthehardway.org/book/ex14.html #from sys import argv #script, user_name = argv #prompt = '>' #print "Hi %s, I'm the %s script." % (user_name, script) #print "I'd like to ask you a few questions." #print "Do you like me %s?" % user_name #likes = raw_input(prompt) #...
true
d6c604dfc817b67b8b61240f13c022ff37e8c9f6
VladKli/Lasoft
/2.py
750
4.34375
4
# Користувач вводить рядок і символ. У рядку знайти всі входження цього символу і перевести його в верхній регістр, # а також видалити частину рядка, починаючи з останнього входження цього символу і до кінця. string = input('Print a string, please: ') symbol = input('Print a symbol, please: ') def find_result(text, ...
false
e43da145e964ddf558b202c966eba9e9da8360ad
VladKli/Lasoft
/7.py
886
4.25
4
# Написати функцію, що перетворює дробове або ціле число в рядок. # якщо вводити 1.3 результат текстом -> одна ціла три десятих number = float(input('Print a number from 0 to 10, please: ')) def transform_to_words(num): integer_part = ['zero ', 'one ', 'two ', 'three ', 'four ', 'five ', 'six ', 'seven ', 'eight...
false
05c76e56a74a9a9f4040bed73167e91093022279
LucasSalu/Curso_Python_Basico_Avan-ado
/Orientado_objetos/exercicio_04.py
930
4.125
4
'''Crie uma classe elevador que vc determine a quantidade de andares ''' class Elevador: andar = 0 pessoas = 0 def __init__(self,andares,capacidade): self.__andares = andares self.__capacidade = capacidade def Entra(self): if Elevador.pessoas + 1 > self.__capacidade: ...
false
5dd3d86a7e38261130e3add94570ce807a28aa37
dcheung15/Python
/ecs102/Hw/Distances.py
770
4.1875
4
#Doung Lan Cheung #dcheun01@syr.edu #Assignment 2, problem 2. #February 1, 2019 #Ask the user for how many pairs of points and compute the distances. import math def main(): #Ask for how many pairs of points and for the x and y cooridinates pts = eval(input("Enter how many pairs of points: ")) for ...
true
f01dc8ccdc1f52d98a7615fd02d4d919cd7db156
dcheung15/Python
/ecs102/Hw/DayofYear.py
1,177
4.25
4
#Official Name: Doung Lan Cheung #email: dcheun01@syr.edu #Assignment: Assignment 4, problem 1. #Date:February 18, 2019 #Figuring out what day of the year and week, given the date is through input def main (): monthLengths=[31,28,31,30,31,30,31,31,30,31,30,31] d = input("What is the day of the week in mm...
true
17dab45af402d124d97837816b17ebcf6e7e542e
abdur-razzak2672/Calculate-sgpa-use-tkinter-in-python
/cgpa calculate.py
1,984
4.21875
4
print("Enter Student Information") name = (input("Student Name : ")) id = (input("Student Id : ")) section = (input("Section : ")) semester = (input("Semester : ")) print("\nEnter Course Information") number = int(input("Enter Number Of Course : ")) total_gpa=0 total_credit = 0 course1 = [] grade1 = [] credi...
false
7bf149606d80aa353116f2ec9c81b64a7d0182cc
MangeshSodnar123/python-practice-programs
/factorial_forLoop.py
235
4.3125
4
num = int(input("Enter the number : ")) factorial = 1 if num == 1 or num == 0: print("The factorial is 1. ") else: for i in range( 1, num+1): factorial = factorial * i print("The factorial of the ",num,"is ",factorial)
true
7708db5110dfcb07aa1189c3c230f663c90c25fe
vandanasen/Python-Projects
/May-week4/prob5.py
545
4.125
4
""" Define a class which has at least two methods: getString: to get a string from console input printString: to print the string in upper case. Also please include simple test function to test the class methods. """ class myclass: def __init__(self,str1): self.str1 = str1 def __str__(self): ret...
true
596eb6e59ae078bb2aa4213592002a94aacda38b
harrisont/ProjectEuler
/Common/Prime.py
1,438
4.25
4
from math import sqrt, ceil, floor def is_prime(n): """ >>> is_prime(0) True >>> is_prime(1) False >>> is_prime(2) True >>> is_prime(3) True >>> is_prime(4) False >>> is_prime(7) True >>> is_prime(9) False >>> is_prime(13) True """ if n == 1: return False elif n < 4: return True elif n % 2 == ...
true
8456f0dc64309a6f3778657827d11758d9286475
dsmall3303/portfolio
/Python/largerthan.py
491
4.3125
4
first_number = 0 second_number = 0 user_unput = '' largest = 0 #get the first number from the user user_input = input("Please enter the first number: ") first_number = int(user_input) #get the second number from the user user_input = input("Please enter the second number: ") second_number = int(user_input) #determi...
true
6f98814417f70b385476913d50f571137c35a898
cRYP70n-13/Algorithms
/Data_Structures/python/Linked_lists/swapNodeWithoutSwappingData.py
1,630
4.15625
4
class Node : # constructor def __init__(self, val = None, next1 = None): self.data = val self.next = next1 # print list from this # to last till None def printList(self): node = self while (node != None) : print(node.data, end = " ") node = ...
true
85bfc4e59c8fea3265864c2a26c8d2b8de9ad96f
Bogdan808/mypython
/inherit_abc.py
1,401
4.15625
4
from abc import * class SchoolMembers(metaclass=ABCMeta): '''Представляет любого человека в школе.''' def __init__(self, name, age): self.name = name self.age = age print('(Создан SchoolMember: {0})'.format(self.name)) @abstractmethod def tell(self): '''Вывести информа...
false
f827a70e2dc5ab4490a8f2c3844cc530e5bb07ee
nehamundye/random-python-projects
/03_hangman/main.py
1,430
4.21875
4
import random from words import words # Pick a random word def pick_word(): word = random.choice(words) while '-' in word or ' ' in word: word = random.choice(words) return word word = pick_word() guessed_letter = [] def hide_word(guessed_letter): hide = "" for letter in word: ...
true
49f802161da33233a083944e4c6e9e0bf6c007b8
OreBank/udacity-pds
/python/lesson 6/10-practice-question.py
1,041
4.1875
4
# Create a function that opens the flowers.txt, reads every line in it, and saves it as a dictionary. The main (separate) function should take user input (user's first name and last name) and parse the user input to identify the first letter of the first name. It should then use it to print the flower name with the sam...
true
ac0b857ee83eb6e5c2539181d789dc0d2eaa645a
EthanSargent/python-ml-implementations
/LinReg.py
2,711
4.15625
4
# Author: Ethan Sargent # # The following is an implementation of regularized, multiple linear regression # (for an arbitrary number of parameters) using gradient descent. I learned the # algorithm from Andrew Ng's free online lecture. # # In the example, we predict weight from blood pressure and age, and plot the # de...
true
27c7695fc678229dca277fba603aa6404c64aed6
EL001/GemMine
/gem_enoch2.py
1,492
4.5625
5
#!/usr/bin/env python # coding: utf-8 # """ # Write a python program that does this; # It collects a user’s # - name # - age # - sex # # Prints out a welcome message like below. # “Hi {user’s name}, you are welcome. In 10 years time, you will be {age in 10 years time} years old and very old by then.” # # The python ...
true
5a0ae81921e8d28d618834a583d04ea250a53e2e
Aman-Achotani/Python-Projects
/Library_project.py
2,374
4.21875
4
# My library project class Library: def __init__(self,Book,Library) : self.book_name = Book self.library_name = Library print("\t\t***Welcome to ",self.library_name,"***") def display(self): print() print() print("Books avaiable are : ") for items in...
true
9c40bb8ffccc0817e22e59eaa8c19f2fb8e0fb2f
AdrianMartinezCodes/PythonScripts
/E14.py
585
4.1875
4
def sort(a_list): return set(a_list) def sort_list(a_list): b = [] for i in a_list: if i in a_list and i not in b: #just needed if i not in b: b.append(i) return b #updated soln below, old soln above, not working #return [b.append(i) for i in a_list if i not in b...
true
f30d01eee9940196171497e329da6298774b54bc
IODevelopers/hacktoberfest
/contribution/usmcamgrimm/randomWorld.py
304
4.21875
4
print ("Hello World?") import random helloWorld = random.randint(1,2) randomChoice = 0 while randomChoice < 1 or randomChoice > 2: randomChoice = int(input("Choose 1 or 2: ")) print ("You chose number ", randomChoice) if randomChoice == helloWorld: print ("Hello World!") else: print ("Hi World.")
false
930884982712570afbd534bce6c4734bd8a94fdf
edwardst14/python_homework
/homework5/homework5.1.py
282
4.21875
4
#Homework 5.1 #Sept. 30 2020 #Use generator functions to create your own version of range function, call it my_range. #Do not use the python's range function in the code. def my_range(start, end): x = start while x < end: yield x x=x + 1 for i in my_range(0,10): print(i)
true
50b16653fa7f527117e5f77a5f336268d155c4c1
Saplyng/Hello-World-redux
/Python/chapter 7/rainfall statistics.py
2,108
4.46875
4
initial_dialog = ("""Hello User, you must be an aspiring meteorologist! that's the only reason I can think you would want something like an rainfall statistics calculator. But what would I know, I'm just a robot Anyway, I wont burden you the hassle of converting your units, just be consistent, if you start with Inche...
true
a765639b6211d5a6deed266b376e30364defd3ee
Saplyng/Hello-World-redux
/Python/chapter 3/if else statements.py
1,348
4.21875
4
# library roman_numerals = {'1': 'I', '2': 'II', '3': 'III', '4': 'IV', '5': 'V', '6': 'VI', '7': 'VII', '8': 'VIII', '9': 'IX', '10': 'X'} startup_dialog = ...
true
755196c7dd1c6a50bf33fe8b78d41927c88423d5
davidforero2016/Fundamentals-for-Python
/Lists.py
717
4.375
4
#This file contains fundamental notions about lists. Demolist1=[1, "John", True, 1,8, [1,2,3,4]] print(Demolist1) Demolist2=list((1, "John", True, 1,8, [1,2,3,4])) print(Demolist2) Demolist3=list(range(0,10)) print(Demolist3) print(len(Demolist1)) print(Demolist1[5]) print("John" in Demolist1) Demolist1[4]=False print(...
true
91a3d28deb8541b6403e5f20bc3945fcec0b6817
RobertElias/UdacityDataStructuresAlgorithms
/Python/functions.py
2,657
4.40625
4
# Example function 1: return the sum of two numbers. def sum(a, b): return a+b # Example function 2: return the size of list, and modify the list to now be sorted. my_list = ["Robert", "Cynthia", "Robbie"] def list_sort(my_list): my_list.sort() return len(my_list), my_list print(list_sort(my_list)) ###...
true
ca692034924e7c27287a7ff5524fabdf34e87201
CDinuwan/Py-Advanced
/Dictionary.py
950
4.15625
4
# Dictionary: key-Value pairs,Unordered,Mutable myDic = {"name": "Chanuka", "age": 21, "City": "New York"} print(myDic) myDict2 = dict(name="Dinuwan", age=27, city="Boston") print(myDict2) value = myDic["age"] print(value) myDic["email"] = "hecdinuwan@gmail.com" print(myDic) myDic["email"] = "chanukadinuwan35@gmai...
true
faf30f112f35955e0fa80bedd94fca75f01860ba
GT-rc/udemy-apps
/Section-5/S5L51Ex1.py
921
4.71875
5
""" In one of the previous exercises we created the following function that gets Celsius degrees as input and returns Fahrenheit, or a message if the Celsius input value is less than -273.15. def c_to_f(c): if c< -273.15: return "That temperature doesn't make sense!" else: f=...
true
83e0e6da343274fdc62fdfe1f2c6d56e46c09e9d
GT-rc/udemy-apps
/Section-6/S6L66Ex4.py
1,279
4.40625
4
""" Please take a look at the following code: temperatures=[10,-20,-289,100] def c_to_f(c): if c< -273.15: return "That temperature doesn't make sense!" else: f=c*9/5+32 return f for t in temperatures: print(c_to_f(t)) The code prints out the outp...
true
95845bd4d9d06aedbb036444a790321db23bde55
shubhrock777/Python-basic-code-
/Assignment module 5/py_module05.py
1,912
4.25
4
#############Q1 ## A)list1=[1,5.5,(10+20j),’data science’].. Print default functions and parameters exists in list1. list1=[1, 5.5, (10+20j), 'data science'] print(list1) len(list1) #length of list #Access values in the variable using index numbers print(list1[0]) #### B)How do we create a sequ...
true
91fd7464a4d0d97a4ad4d2fea73e95dc7a2b3b41
cgarcianeal/Owens-Attendance
/src/recording.py
1,773
4.25
4
import csv import sys import datetime from datetime import date more = 'y' # Settingfactor for while loop today = str(date.today()) year = datetime.date.today().year default_option = "current" prev_month = 0 prev_day = 0 file_name = "record_" + today + ".csv" #opening records csv file for writing record = open (file_...
true
1327f24d03c82c4624ce3d59d096afd9fe63e7fe
suchana172/My_python_beginner_level_all_code
/basic1/age_checker.py
250
4.125
4
your_age = input("How old are you?") your_friends_age = input("How old is your friend?") if int(your_age) >=18 or int(your_friends_age) >=18 : print("Congrats, one of you is old enough to vote!") else: print("One of you is too young to vote")
true
092f455f31e6a3ad58ad3fcf735fe93f000a67d1
krhckd93/Data-Structures
/stacks.py
1,854
4.1875
4
def display(s, top): if top == -1: print("Stack is empty!") else: while top != -1: print(s[top]) def push_item(s, top, max_size, value): if top != max_size: top += 1 s.append(value) print("Item added :", s[top]) return top else: print...
true
672dff443335e840fcd1f8e312f980aa09606545
amidoge/Python-2
/ex012.py
502
4.21875
4
from math import * t1 = float(input('What is your first longitude?')) t2 = float(input('What is your first latitude?')) g1 = float(input('What is your second longitude?')) g2 = float(input('What is your second latitude?')) # converting the degrees to radians so that it is able to do the formula radians(t1) radians(t2) ...
false
99d3a263f4286a26e06135d11d930b3f1071b26a
amidoge/Python-2
/ex080.py
1,923
4.21875
4
from random import randint #going to use 1 and 2 to represent heads or tails #for one round of coin flip #variables: flip_count = 0 total_flips = 0 consecutive_count = 0 #this is zero because we don't even have a flip yet. for i in range(10): #doing this 10 times #in the beginning of the line, we should have some...
true
a46c37d955945468272275e925aac5e8a7fb7fdf
amidoge/Python-2
/ex041.py
668
4.21875
4
#find out frequency from a note that the user inputs note = str(input('What note do you want to know the frequency of? ')) C4 = 261.63 D4 = 293.66 E4 = 329.63 F4 = 349.23 G4 = 392.00 A4 = 440.00 B4 = 493.88 if note == 'C4': print(C4) elif note == 'D4': print(D4) elif note == 'E4': print(E4) elif note == 'F4...
true
69579627325bee141245c3b323b5cc7ff71a2ecc
amidoge/Python-2
/ex079.py
1,229
4.25
4
from random import randint random_int = randint(1, 100) #need to get a number to store to maximum_int, so that we can compare it with the next 99 numbers maximum_int = random_int print(maximum_int) #must also print the maximum integer first otherwise I will only have 99 numbers and not 100 update_count = 0 for i in ran...
true
24bdd04f164c63779262bf95209bdfc825343c49
amidoge/Python-2
/ex096b.py
2,642
4.28125
4
#Check a password ''' Write a function that determines whether or not a password is good. We will define a good password to be a one that is at least 8 characters long and contains at least one uppercase letter, at least one lowercase letter, and at least one number. Your function should return true if the password ...
true
ce5b720b688c6c5dd06bf93195309fdaaa8e7e03
amidoge/Python-2
/ex032.py
509
4.3125
4
#read 3 different integers and list them from smallest to largest using the min() and max() functions num_1 = int(input('What is the first integer?')) num_2 = int(input('What is the second integer?')) num_3 = int(input('What is the third integer?')) highest = max(num_1, num_2, num_3) lowest = min(num_1, num_2, num_3) ...
true
01df20571644a961209dbe9966955401a876db09
SimonCWatts/MIT-6.00.1x
/MID TERM Problem 6x.py
762
4.15625
4
def laceStringsRecur(s1, s2): """ s1 and s2 are strings. Returns a new str with elements of s1 and s2 interlaced, beginning with s1. If strings are not of same length, then the extra elements should appear at the end. """ def helpLaceStrings(s1, s2, out): if s1 == '': ...
true
eda62614b41d7f54c66440c601e7d2021ffbaa0c
dansmyers/IntroToCS-2020
/Examples/2-Variables/magic_computer.py
754
4.34375
4
""" The Magic Computer: a Mad Lib CMS 195, Spring 2020 """ # Prompt the user to enter all of the required words noun1 = input('Enter a noun: ') plural_noun1 = input('Enter a plural noun: ') verb1 = input('Enter a present tense verb: ') verb2 = input('Enter a present tense verb: ') part_of_body = input('Ener a plural ...
true
7115080820e3091995c63dac919e5acd358ca45c
dansmyers/IntroToCS-2020
/Examples/3-Conditonals/pos_neg_or_zero.py
715
4.5
4
""" Test if a number is positive, negative, or zero CMS 195, Spring 2020 """ # Read the number number = int(input('Enter a number: ')) # This test block has three outcomes # # Use if-elif-else to test three or more outcomes # If the first test is True, the if block executes and all of the other cases are skipped # ...
true
93b4669fb03a0da0cfe047ec12e09c49621df58b
FrauBoes/aviation_routing
/flightplan.py
1,755
4.125
4
from itertools import permutations class Flightplan: """ Class to store flightplan objects. A Flightplan class defines a container object for a flightplan. Implements flightplan object as a queue using a list Provides methods to access the first and last item in the flightplan Store aircraft as d...
true
a5d68b227850fec5c3c7901791b24208b75d2bec
leiurus17/tp_python
/strings/python_max.py
241
4.4375
4
#The method max() returns the max alphabetical character from the string str. str = "This is really a string example....wow!!! z" print "Max character: " + max(str) str = "This is a string example." print "Max character: " + max(str)
true
7b13905fcc57e2863fcf5b7af5745db5b77b71cb
leiurus17/tp_python
/variables/python_tuple.py
414
4.3125
4
tuplez = ('abcd', 786, 2.23, 'john', 70.2) tinytuple = (123, 'daniel') print tuplez # Prints complete tuple print tuplez[0] # Prints first element of the tuple print tuplez[1:3] # Prints elements starting from 2nd till 3rd print tuplez[2:] # Prints elements starting from 3rd element print tin...
true
586d6eb66995593b922178cb50369521a7025251
leiurus17/tp_python
/operators/python_comparison.py
723
4.125
4
a = 21 b = 10 c = 0 print "a = ", a print "b = ", b print "c = ", c if (a == b): print "a == b is True" else: print "a == b is False" if (a != b): print "a != b is True" else: print "a != b is False" if (a <> b): print "a <> b is True" else: print "a <> b is Fals...
false
8b70021aa4d42681dcf3f766b96111030e367959
myke2424/my-python-learning
/super.py
2,048
4.53125
5
# At a high level, super() gives you access to methods in a parent class from the subclass that inherits from it # super() alone returns a temporary object of the parent class that then allows you call that superclass's methods # A common use case is building classes that extend the functionality of previously built...
true
3aabc19b3d1d49476d0f9b519f1e04c0b4e37f7e
myke2424/my-python-learning
/lambdas.py
1,463
4.46875
4
# Lambdas are just anonymous functions (e.g. js arrow function cb) # Taken literally, an anonymous function is a function without a name. # In Python, an anonymous function is created with the lambda keyword. # We can apply the an argument to the lambda by surrounding the func and its arg with parentheses (lamb...
true