blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
ae35bfc0d8c5057a7d70cf79a272a353a0f15cf4 | pwgraham91/Python-Exercises | /shortest_word.py | 918 | 4.34375 | 4 | """
Given a string of words, return the length of the shortest word(s).
String will never be empty and you do not need to account for different data types.
"""
def find_short_first_attempt(string):
shortest_word_length = None
for word in string.split(' '):
len_word = len(word)
if shortest_wor... | true |
dc9a10c8f8f1cd1c46f78c475ed1ca57cc381ee1 | pwgraham91/Python-Exercises | /process_binary.py | 494 | 4.15625 | 4 | """
Given an array of one's and zero's convert the equivalent binary value to an integer.
Eg: [0, 0, 0, 1] is treated as 0001 which is the binary representation of 1
"""
def binary_array_to_number(array):
output = ''
for i in array:
output += str(i)
return int(output, 2)
assert binary_array_to_... | true |
9b8ee1df25e986a9ad3abd9134abda3f6d3970f5 | pwgraham91/Python-Exercises | /sock_merchant.py | 990 | 4.71875 | 5 | """
John works at a clothing store. He has a large pile of socks that he must pair by color for sale. Given an array of integers representing the color of each sock, determine how many pairs of socks with matching colors there are.
For example, there are socks with colors . There is one pair of color and one of colo... | true |
7c9c234858d6903b255c291661ae61787f7c8a4f | victorcwyu/python-playground | /learn-python/functions.py | 1,273 | 4.375 | 4 | # divide code into useful blocks
# allows us to order code, make it more readable, reuse it and save time
# a key way to define interfaces to share code
# defined using the block keyword "def", followed by the function name as the block name
def my_function():
print("Yolo")
# may receive arguments (variables pass... | true |
f515c806b5240f92a077dd7ded268eaa19e8edd2 | victorcwyu/python-playground | /python-crash-course/string-replacement.py | 512 | 4.125 | 4 | # exercise: use Python's string replace method to fix this string up and print the new version out to the console
journey = """Just a small tone girl
Leaving in a lonely whirl
She took the midnight tray going anywhere
Just a seedy boy
Bored and raised in South Detroit or something
He took the midnight tray going anywhe... | true |
84bd0d4db2706319680706e1cd0621ed313fa034 | Utkarshkakadey/Assignment-solutions | /Assignment 1.py | 1,053 | 4.40625 | 4 | # solution 1
# Python program to find largest
# number in a list
# list of numbers
list1 = [10, 20, 4, 45, 99]
# sorting the list
list1.sort()
# printing the last element
print("Largest element is:", list1[-1])
#solution 2
a=[]
c=[]
n1=int(input("Enter number of elements:"))
for i in range(1,n1+1... | true |
36ca26358ff16d783d4b7bc0b24e2768879ef9b4 | NadezhdaBzhilyanskaya/PythonProjects | /Quadratic/src/Bzhilyanskaya_Nadja_Qudratic.py | 2,751 | 4.125 | 4 | import math
class Qudratic:
def __init__(self, a,b,c):
"""Creates a qudratic using the formula: ax^2+bx+c=0"""
self.a = a
self.b = b
self.c = c
self.d = (b**2)-(4*a*c)
def __str__(self):
a = str(self.a) + "x^2 + " + str(self.b) + "x + " + str(se... | true |
68202e160654a74f879656915b632679e51ccb89 | lmaywy/Examples | /Examples/Examples.PythonApplication/listDemo.py | 1,041 | 4.25 | 4 | lst=[1,2,3,4,5,6,7]
# 1.access element by index in order
print 'access element by index in order';
print lst[0];
print 'traverse element by index in order '
for x in lst:
print x;
# 2.access element by index in inverse order
print 'access element by index in inverse order'
print lst[-1];
length=len(lst... | true |
62d8c229f14671d1ffacfcd65a667a1bce570b9b | aguynamedryan/challenge_solutions | /set1/prob4.py | 2,219 | 4.28125 | 4 | # -*- coding: utf-8 -*-
"""
Question:
Complete the function getEqualSumSubstring, which takes a single argument. The single argument is a string s, which contains only non-zero digits.
This function should print the length of longest contiguous substring of s, such that the length of the substring is2*N digits and the... | true |
e443a8469abd8dd648d3919ba5122505f9ae0ee7 | ozturkaslii/GuessNumber | /Py_GuessNumber/Py_GuessNumber/Py_GuessNumber.py | 1,214 | 4.25 | 4 | low = 0;
high =100;
isGuessed = False
print('Please think of a number between 0 and 100!');
#loop till guess is true.
while not isGuessed:
#Checking your answer with Bisection Search Algorithm. It allows you to divide the search space in half at each step.
ans = (low + high)/2;
print('Is your secret number '... | true |
3b72cf3f9878c6a37ba0274f31df18f4f3a5ad69 | khusheimeda/Big-Data | /Assignment1 - Map Reduce/reducer.py | 789 | 4.125 | 4 | #!/usr/bin/python3
import sys
# current_word will be used to keep track of either recognized or unrecognized tuples
current_word = None
# current_count will contain the number of tuples of word = current_word seen till now
current_count = 0
word = None
for line in sys.stdin:
line = line.strip()
word,... | true |
9ce6d36ed817b6029a056e3dbd9e6581a00853e5 | KirthanaRamesh/MyPythonPrograms | /decimal_To_Binary.py | 1,577 | 4.53125 | 5 |
# Function for separating the integer and fraction part from the input decimal number.
def separation_of_integer_and_fraction():
global decimal_number, decimal_integer, decimal_fraction
decimal_integer = int(decimal_number)
decimal_fraction = decimal_integer - decimal_number
# Function to convert integer... | true |
6b8bf1fd5506f086a1367c35f416315b8cc8b8bb | jeffder/legends | /main/utils/misc.py | 621 | 4.3125 | 4 | # Miscellaneous utilities
from itertools import zip_longest
def chunks(values, size=2, fill=None):
"""
Split a list of values into chunks of equal size.
For example chunks([1, 2, 3, 4]) returns [(1, 2), (3, 4)].
The default size is 2.
:param values: the iterable to be split into chunks
:param... | true |
0649d4edfd70e8836a98437b1860c7f7709adaae | mihaivalentistoica/Algorithms_Data_Structures | /01-recursion/example-01.py | 319 | 4.34375 | 4 | def factorial(n):
"""Factorial of a number is the product of multiplication of
all integers from 1 to that number. Factorial of 0 equals 1.
e.g. 6! = 1 * 2 * 3 * 4 * 5 * 6
"""
print(f"Calculating {n}!")
if n == 0:
return 1
return n * factorial(n - 1)
print(f"6! = {factorial(6)}")
| true |
187269a9d58a66513d8bdda626b909f8c62ef928 | mosesokemwa/bank-code | /darts.py | 1,113 | 4.375 | 4 | OUTER_CIRCLE_RADIUS = 10
MIDDLE_CIRCLE_RADIUS = 5
INNER_CIRCLE_RADIUS = 1
CENTRE = (0, 0)
def score(x: float, y: float):
"""Returns the points earned given location (x, y) by
finding the distance to the centre defined at (0, 0).
Parameters
----------
x : float,
The cartesian x-coordinate ... | true |
e52d775f79831414f58c5ceeef965f1306b27293 | OsamaOracle/python | /Class/Players V1.0 .py | 1,294 | 4.3125 | 4 | '''
In the third exercise we make one final adjustment to the class by adding initialization data and a docstring. First add a docstring "Player-class: stores data on team colors and points.". After this, add an initializing method __init__ to the class, and make it prompt the user for a new player color with the messa... | true |
87c6013053de3c1b0cdddff68e64ea6b76e5040f | lihaoranharry/INFO-W18 | /week 2/Unit 2/sq.py | 316 | 4.25 | 4 | x = int(input("Enter an integer: "))
ans = 0
while ans ** 2 <= x:
if ans **2 != x:
print(ans, "is not the square root of" ,x)
ans = ans + 1
else:
print("the square root is ", ans)
break
if ans **2 == x:
print("we found the answer")
else:
print("no answer discovered")
| true |
055abc0aa8a0fe307d3b1dda6ec697c908e61e44 | RelayAstro/Python | /ejercicio29.py | 962 | 4.5625 | 5 | #The is_palindrome function checks if a string is a palindrome. A palindrome is a string that can be equally read from left to right or right to left, omitting blank spaces, and ignoring capitalization. Examples of palindromes are words like kayak and radar, and phrases like "Never Odd or Even". Fill in the blanks in t... | true |
5c84f84a9e1816751630c17bb1acb9b3301459a3 | dbrooks83/PythonBasics | /Grades.py | 711 | 4.5 | 4 | #Write a program to prompt for a score between 0.0 and 1.0.
#If the score is out of range, print an error. If the score is between
#0.0 and 1.0, print a grade using the following table:
#Score Grade
#>= 0.9 A
#>= 0.8 B
#>= 0.7 C
#>= 0.6 D
#< 0.6 F
#If the user enters a value out of range, print a suitable error messa... | true |
91fa15b2c4ae7d49ff66f69e13a921aed349f63e | TranshumanSoft/Repeat-a-word | /repeataword.py | 205 | 4.1875 | 4 | word = str(input("What word do you want to repeat?"))
times = int(input(f"How many times do you want to repeat '{word}'?"))
counter = 0
while counter < times:
counter = counter + 1
print(word) | true |
8c855c41046f03888b12b957cfb66ac866144ca7 | fandres70/Python1 | /functiondefaults.py | 575 | 4.34375 | 4 | # Learning how Python deals with default values of
# function parameters
def f(a, L=[]):
'''This function appends new values to the list'''
L.append(a)
return L
# not specifying a list input
print(f(1))
print(f(2))
print(f(3))
# specifying a list input
print(f(1, []))
print(f(2, []))
prin... | true |
39b12a36d1c809b5b64250ac4543c95d26f5912b | fandres70/Python1 | /factorial.py | 426 | 4.34375 | 4 | #!/usr/bin/env python
# Returns the factorial of the argument "number"
def factorial(number):
if number <= 1: #base case
return 1
else:
return number*factorial(number-1)
# product = 1
# for i in range(number):
# product = product * (i+1)
# return product
user_input = int(raw_... | true |
a4034f4c5a30994a6b8568eb369a8a4df8610c46 | Saskia-vB/eng-57-pyodbc | /error_file.py | 1,338 | 4.5 | 4 | # Reading a text file
# f = open ('text_file.txt', 'r')
#
# print(f.name)
#
# f.close()
# to use a text within a block of code without worrying about closing it:
# read and print out contents of txt file
# with open('text_file.txt', 'r') as f:
# f_contents = f.read()
# print(f_contents)
# reading a txt file ... | true |
5f62cb78547b5a4152223c2a9c55789768d87b21 | bhumphris/Chapter-Practice-Tuples | /Chapter Practice Tuples.py | 2,234 | 4.46875 | 4 | # 12.1
# Create a tuple filled with 5 numbers assign it to the variable n
n = (3,5,15,6,12)
# the ( ) are optional
# Create a tuple named tup using the tuple function
tup = tuple()
# Create a tuple named first and pass it your first name
first = tuple("Ben")
# print the first letter of the first tup... | true |
03ef1ea5a2c991e7a597f40b06aac37890dde380 | knobay/jempython | /exercise08/h01.py | 593 | 4.1875 | 4 | """Uniit 8 H01, week2"""
# Gets an input from the user works
# out if it is an Armstrong number
def armstrong_check():
"Works out if the user has entered an Armstrong number"
userinput = input("Enter a 3 digit number")
evaluation = int(userinput[0])**3 + int(userinput[1])**3 + int(userinput[2])**3
i... | true |
688fa627915adf73bf41bc04d0636d41fb0d349d | knobay/jempython | /exercise08/e03.py | 581 | 4.125 | 4 |
"""Uniit 8 E03, week2"""
# Gets an input from the user works
# out if it contains a voul
PI = [3.14, 2]
def voul_or_not():
"Works out if the user has entered a voul or consonant"
userinput = input("Enter a letter")
if (userinput == 'a' or userinput == 'e'
or userinput == 'i' or userinput == ... | true |
2d766aea3921242f98860cc272bbfda43fb38efe | knobay/jempython | /exercise08/e02.py | 720 | 4.28125 | 4 | import math
#
print("\n--------------------------------------------------------------")
print("------------------------ E02 -------------------------")
x = True
while x:
numStr = input("Please enter a whole number:- ")
if numStr.isdigit():
num = int(numStr)
break
elif numStr.replace(... | true |
378e0b3f129230aae31b144ab00fe46aa123b537 | Habits11/Python-Programs | /name_order.py | 953 | 4.15625 | 4 | # name_order.py
# A program to reorder a person's name
# Author: Tyler McCreary
def main():
name = input("Input the name to be reordered: ")
spaces = name.find(" ")
if spaces <= 0:
print("invalid name")
else:
first = name[:spaces]
name = name[spaces + 1:]
spaces = name.f... | true |
4be0db806d1d5c32ec0cd72121bf8cc9d7244de2 | jlh040/Python-data-structures-exercise | /25_sum_pairs/sum_pairs.py | 1,221 | 4.1875 | 4 | def sum_pairs(nums, goal):
"""Return tuple of first pair of nums that sum to goal.
For example:
>>> sum_pairs([1, 2, 2, 10], 4)
(2, 2)
(4, 2) sum to 6, and come before (5, 1):
>>> sum_pairs([4, 2, 10, 5, 1], 6) # (4, 2)
(4, 2)
(4, 3) sum to 7, and finish before (5, 2... | true |
31a7fa16633f116e153c16ac3c4f588786976335 | annjose/LearningPython | /intro/user_inputs.py | 1,072 | 4.15625 | 4 |
students = []
def add_student(name, age=15):
student = {
"name": name,
"age": age
}
students.append(student)
print(f"Added new student with name '{name}' and age '{age}'")
def my_print(name, age, *args):
print("name =", name, "age =", age)
print(args)
my_print("Liza", 14, "a"... | true |
30d6f3239d45955065ac72e17493067cd6bae523 | KilnDR/Python-2021 | /hello.py | 1,170 | 4.625 | 5 | #################################
# Learn Python Coding in 2021
# By Dave Roberts
# Codemy.com
#################################
import os
os.system('clear')
# Print Hello World to screen comment note hashtag to identity comment
#print ("Hello World!") # This is another comment
''' 3 single quotation marks allows mul... | true |
1d5317da7e87f3e9b4a1241a532b1d04ea932ac7 | nathanlo99/dmoj_archive | /done/ccc12j1.py | 342 | 4.15625 | 4 | limit = int(input())
speed = int(input())
if speed - limit >= 31:
print("You are speeding and your fine is $500.")
elif speed - limit >= 21:
print("You are speeding and your fine is $270.")
elif speed - limit >= 1:
print("You are speeding and your fine is $100.")
else:
print("Congratulations, you are wit... | true |
81f79215a0eb1e822e2bec641c6f5603e0e75dcc | kwakinator/DojoAssignments | /Python/Basic_Python/multsumavg.py | 684 | 4.4375 | 4 | ##Multiples
##Part I - Write code that prints all the odd numbers from 1 to 1000. Use the for loop and don't use a list to do this exercise.
for num in range(0,1001):
if num %2 != 0:
print num
num +=1
##Part II - Create another program that prints all the multiples of 5 from 5 to 1,000,000.
for num... | true |
5652e61cf8c50f36e5361ac5c87d0b466aea7f4c | kuljotbiring/Python | /pythonlearn/nameCases.py | 202 | 4.15625 | 4 | # Use a variable to represent a person’s name, and then print
# that person’s name in lowercase, uppercase, and title case.
name = "kuljot biring"
print(f"{name.lower()}\n{name.upper()}\n{name.title()}")
| true |
d49bace7590233647b762d83d4e9da6ef4f38296 | kuljotbiring/Python | /pythonlearn/dice_import.py | 899 | 4.125 | 4 | # Make a class Die with one attribute called sides, which has a default
# value of 6. Write a method called roll_die() that prints a random number
# between 1 and the number of sides the die has. Make a 6-sided die and roll it
# 10 times.
from random import randint
class Dice:
""" create a dice object and insta... | true |
28c139b9c1d115115ed01f6395abc373b672051b | kuljotbiring/Python | /pythonlearn/gradeWithFunction.py | 886 | 4.59375 | 5 | # Rewrite the grade program from the previous chapter using
# a function called computegrade that takes a score as its parameter and
# returns a grade as a string.
# Write a program to prompt for a score between 0.0 and
# 1.0. If the score is out of range, print an error message. If the score is
# between 0.0 and 1.0, ... | true |
a8ce3b82c6b689f58ad53a7fe9b73569b81745fa | kuljotbiring/Python | /pythonlearn/whilesandwich.py | 805 | 4.34375 | 4 | # Make a list called sandwich_orders and fill it with the names of various
# sandwiches.
sandwich_orders = ['BLT', 'chicken', 'pastrami', 'veggie', 'tuna', 'california', 'turkey']
# Then make an empty list called finished_sandwiches.
finished_sandwiches = []
# Loop through the list of sandwich orders and print a mess... | true |
5cced076bde9478592432ad305fa6ea00bda7797 | csduarte/FunPy | /kboparai1/ex15/sd01.py | 594 | 4.15625 | 4 | # Importing module argv from sys
from sys import argv
# Taking in script name and file name for argv
script, filename = argv
# Opening filename, which was named when invoking the script.
txt = open(filename)
# Printing filename through format variable.
print "Here's your file %r:" % filename
# prints the content of the... | true |
8c240b4602fbdd0d064af941dc3ced8441d169cf | csduarte/FunPy | /kboparai1/ex03/sd05.py | 750 | 4.375 | 4 | print "I will now count my chickens:"
# dividing two numbers then adding 25
print "Hens", float(25+30/6)
# 100 - percentage
print "Roosters", float(100 - 25 * 3 % 4)
print "Now I will count the eggs:"
# Addition subtraction percentage division addition.
print float(3+2+1-5+4%2-1/4+6)
print "Is it true that 3+2<5... | true |
1a9e42255b8574ce236cf67c14769d7e8245830c | csduarte/FunPy | /kboparai1/ex03/sd01.py | 686 | 4.15625 | 4 | print "I will now count my chickens:"
# dividing two numbers then adding 25
print "Hens", 25+30/6
# 100 - percentage
print "Roosters", 100 - 25 * 3 % 4
print "Now I will count the eggs:"
# Addition subtraction percentage division addition.
print 3+2+1-5+4%2-1/4+6
print "Is it true that 3+2<5-7?"
# Running thru ... | true |
9fd4dd421b659260bdd30f0934880c2c1996898f | tomilashy/using-lists-in-python | /list comprehension.py | 552 | 4.15625 | 4 |
name = [1,2,3,4,5,6,7,8,9];
odd=[x for x in name if x%2!=0 ];
even=[x for x in name if x%2==0 ];
print (odd,even);
edit=[x if x%2==0 else x*2 for x in name ];
print (edit);
mixed="This is jesutomi";
vowels=', '.join(v for v in mixed if v in "aeiou");
print (vowels);
nested_list=[[1,2,3],[4,5,6],[7,8,9]];
print(... | true |
8119a571523a8cf2bb146033c274677ad94e2311 | malhotraguy/Finding-the-specific-letter | /Code.py | 435 | 4.1875 | 4 | cities = ["New York", "Shanghai", "Munich", "Tokyo", "Dubai", "Mexico City", "São Paulo", "Hyderabad"]
search_letter = input("Enter the letter you want to search: ")
total = 0
for city_name in cities:
total += city_name.lower().count(search_letter)
print("In",city_name,"there are:",city_name.lower().count(sear... | true |
34f3214dbc2f0e0c38b5a46972a9832782ee7b1f | Mat4wrk/Object-Oriented-Programming-in-Python-Datacamp | /1.OOP Fundamentals/Create your first class.py | 785 | 4.46875 | 4 | # Create an empty class Employee
class Employee:
pass
# Create an object emp of class Employee
emp = Employee()
# Include a set_name method
class Employee:
def set_name(self, new_name):
self.name = new_name
# Create an object emp of class Employee
emp = Employee()
# Use set_name() on emp to set ... | true |
e0504710ea499bd394004095ba27d8b0a24b5c46 | ajay0006/madPythonLabs | /Lab5/verticalDisplay.py | 815 | 4.15625 | 4 | # this code displays a vertical line across the gfx hat screen
from gfxhat import lcd
lcd.clear()
lcd.show()
# this is a function that takes the user input for the X coordinate and validates it, making sure it isnt above 127
# it also returns the users input
def verticalDisplayInput():
x = int(input("please ent... | true |
4a10a7ac84a121e134505038b4c4dbf00b7df0e4 | ericzacharia/MarkovSpeakerRecognition | /map.py | 2,162 | 4.625 | 5 | from abc import ABC, ABCMeta, abstractmethod
class Map(ABC):
"""
Map is an Abstract Base class that represents an symbol table
"""
@abstractmethod
def __getitem__(self,key):
"""
Similar to the __getitem__ method for a Python dictionary, this will
return the ... | true |
43d0a944eb575744d2010b5c7fba39af7e9d96c9 | Tiagosf00/sudoku-solver | /sudoku.py | 1,775 | 4.21875 | 4 | # Sudoku solver using backtrack recursion
# Example with an unique solution.
sudoku = [[5,3,0, 0,7,0, 0,0,0],
[6,0,0, 1,9,5, 0,0,0],
[0,9,8, 0,0,0, 0,6,0],
[8,0,0, 0,6,0, 0,0,3],
[4,0,0, 8,0,3, 0,0,1],
[7,0,0, 0,2,0, 0,0,6],
[0,6,0, 0,0,0, 2,8,0],
... | true |
c3928c896f07c49824ff603f33c236ce4be212da | nsridatta/SeleniumFrameworks | /DinoBot/src/test/stringfunctions.py | 871 | 4.40625 | 4 | from string import capwords
course = "Python for Programmers"
# capitalize method will capitalize only first letter in the sentence
print(course.capitalize())
for word in course.split():
print(word.capitalize(), sep=" ")
# capwords method of string library will capitalize first letter of the words in the sentenc... | true |
51f1b6efac3506ef4a9e4eaf5555f1074b1f21a9 | Fatmahmh/100daysofCodewithPython | /Day058.py | 563 | 4.40625 | 4 | #Python RegEx 2
#The findall() function returns a list containing all matches.
import re
txt = "the rain in spain"
x = re.findall("ai",txt)
print(x)
txt = "the rain in spain"
x = re.findall("pro",txt)
print(x)
if (x):
print("yes we have match")
else:
print("no match")
#The search() function sea... | true |
f2e342a56bb38695f1c3ce963a021259a0afe425 | Fatmahmh/100daysofCodewithPython | /Day017.py | 701 | 4.59375 | 5 | thistuple = ('apple ', 'bannana', 'orange', 'cherry')
print(thistuple)
#Check if Item Exists
if "orange" in thistuple:
print('yes , apple in this tuple')
#repeat an item in a tuple, use the * operator.
thistuple = ('python' , )*3
print(thistuple)
#+ Operator in Tuple uesd To add 2 tuples or more ... | true |
1a91c62922e98e6333eeff93d4202125096d7117 | Fatmahmh/100daysofCodewithPython | /Day011.py | 516 | 4.25 | 4 | # Logical Operators
x = 5
print(x > 5 or x < 4)
print(x > 5 and x < 4)
print(not x < 4)
#Identity Operators
''' if they are actually the same object, with the same memory location.'''
x = 5
y = 5
z = x
print(" ")
print(x is z )
print(x is not z )
print(x is y)
print(x != z )
print(x == z )
... | true |
4c99f91d6c7d84f01d4428665924c7c1c61d9697 | Fatmahmh/100daysofCodewithPython | /Day022.py | 732 | 4.71875 | 5 | #Dictionary
#Empty dictionary.
thisdict = {}
thisdict = {
"brand" : 'ford',
"model": "mustang",
"year" : 1996
}
print(thisdict)
print(thisdict["model"])
#Get the value of the key.
print(thisdict.get('model'))
#You can change the value of a specific item by referring to its key name.
th... | true |
eda1d6ef2c68ead27256742ce59d27fef1d71673 | Fatmahmh/100daysofCodewithPython | /Day020.py | 372 | 4.4375 | 4 | thisset = {}
print(thisset)
#Create a Set.
thisset = {'apple', 'cherry', ' banana'}
print(thisset)
#//
thisset = {'apple',1,2,1,5}
print(thisset)
for x in thisset:
print(x)
print("apple" in thisset)
#Add an item to a set, using the add() method.
thisset.add("orange")
print(thisset)
thisset... | true |
c6f5f3657072bbdce3289326fc9d1b50031e8f8e | Fatmahmh/100daysofCodewithPython | /Day030.py | 1,338 | 4.9375 | 5 | #Python Loops3 For Loop
'''The range() Function To loop through a set of code a specified number of times, we can use the range() function,
The range() function returns a sequence of numbers, starting from 0 by default, and increments by 1 (by default), and ends at a specified number.'''
for x in range(6):
pr... | true |
b09b258af455cf1bb4113e47b35de12055951f72 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_235.py | 673 | 4.1875 | 4 | def main():
temp = int(input("Please enter in the temperature: "))
scale = input("Please enter what the temperature is measured in (use K or C): ")
if scale == "K":
if temp >= 373:
print("At this temperature, water is a gas")
elif temp <= 273:
print("At this temperat... | true |
a3b656dbacb035a707afa9a4c917bc40f13f3275 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_440.py | 674 | 4.125 | 4 | def main():
temp = float(input("please enter the temperature: "))
form = input("please enter 'C' for celsius or 'K' for kelvin: ")
if(temp > 0) and ( temp < 100) and (form == "C"):
print("the water is a liquid.")
if(temp <= 0) and (form == "C"):
print("the water is frozen sol... | true |
25d878c1cd851bdaaddcf45b486b01685b0034b9 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_149.py | 312 | 4.15625 | 4 | def main():
height= int(input("Please enter the starting height of the hailstone "))
while height >1:
if height % 2==0:
height = height//2
else:
height=(height*3) +1
print("Hail is currently at height", height)
print("Hail is stopped a height 1")
main()
| true |
6cca26f7f33f8153a78c53e83a1a578a02d1f37c | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_345.py | 717 | 4.125 | 4 | def main():
temp = float(input("Please enter the temperature: "))
tempType = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
if (tempType == 'C'):
if (temp >= 100):
print("The water is gas at this temperature")
elif (temp >= 0):
print("The water is liquid a... | true |
863f0fe84be66041fef6e6038fbc8a3b2a64c85a | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_379.py | 584 | 4.25 | 4 | def main():
STOP = 1
height = int(input("Please enter the starting height of the hailstone: "))
while (height <=0):
print("The starting height must be a positive number greater than 0")
height = int(input(" Please enter the starting height of the hailstone: "))
while (height != STOP):
... | true |
d01b3b97b6cb07c3332001b023c128da8a1452c6 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_229.py | 518 | 4.15625 | 4 | def main():
width = input("Please enter the width of the box: ")
width = int(width)
height = input("Please enter the height of the box: ")
height = int(height)
outline = input("Please enter a symbol for the box outline: ")
fill = input("Please enter symbol for the box to be filled with: ")
p... | true |
ebc0aed659e66bcee2937d0655a6102d87e680c8 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_288.py | 665 | 4.125 | 4 | def main():
temp=float(input("Please enter the temperature: "))
unit=input("Please enter 'C' for Celcius, or 'K' for Kelvin: ")
if unit=="C":
if temp<=0:
print("At this temperature, water is a solid.")
elif temp>=100:
print("At this temperature, water is a gas.")
... | true |
c13e7fa212cadac8a9e8490e02947e335a3efb80 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_267.py | 396 | 4.1875 | 4 | def main():
width = int(input("Please enter a width: "))
height = int(input("Please enter a height: "))
symbol1 = input("Please enter a symbol: ")
symbol2 = input("Please enter a different symbol: ")
length = 0
print(symbol1*width)
for n in range(height - 2):
print(symbol1+(symbol2*(... | true |
8d66c21863dca0efbba1981f8958b208c0830359 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_010.py | 1,039 | 4.125 | 4 | def main():
temp = float(input("Pleas enter the temperature:"))
scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin:")
if scale == "C":
if temp <= 0:
print("At this temperature, water is a(frozen) solid.")
elif temp >= 100:
print("At this temperature, water... | true |
de0e4572ab2d9a4c45f884d3f7fa1dca8f71308c | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_016.py | 431 | 4.15625 | 4 | def main():
width = int(input("enter width of box "))
height = int(input("enter height of box "))
outline = input("enter a symbol for the outline of the box ")
fill = input("enter a symbol for the fill of the bod")
top = outline * width
print(top)
for i in range (0, height -2):
ins... | true |
04023bc7cb609f7b7f9078ebadae64321c80ed97 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_264.py | 604 | 4.1875 | 4 | def main():
temp = float(input("What temperature would you like to test:"))
tempMode = input("Is this temperature in Kelvin or Celcius? Enter K or C:")
if temp <= 0 and tempMode == "C" or temp <= 273 and tempMode == "K":
print("At", str(temp) + tempMode, "water would be freezing.")
if 0 < temp <... | true |
90f7d12687698cfdd78085f0324bcca630cba0dc | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_119.py | 570 | 4.125 | 4 | temp = float(input("Please enter the temperature: "))
SI = input("Please enter 'C' for Celcius, or 'K' for Kelvin: ")
if SI == 'C' and temp > 100:
print("At this temperature, water is gas. ")
elif SI == 'C' and temp > 0:
print("At this temperature, water is liquid")
elif SI == 'C' and temp <= 0:
print("At t... | true |
32d08976d85268fcfeda8cc6bab3279a51445ef0 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_019.py | 542 | 4.28125 | 4 | def main():
height=int(input("Please enter the height of the hail: "))
if height <= 1:
print("OOPS! You quit the program, gotta be greater than 1")
while height > 1:
even = height % 2
if even == 0:
if height >= 1:
print("The current height is ",height)
... | true |
eb7164e404106b0f9526a171840a92b9b4d52743 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_379.py | 621 | 4.1875 | 4 | def main():
temp = float(input("What is the temperature? "))
scale = input("Enter C for Celsius or K for Kelvin: ")
if scale == "K" and temp <= 273:
print("The water is frozen solid")
elif scale == "K" and temp >= 273 and temp <=373:
print("The water is a liquid")
elif scale == "K" a... | true |
8130491334db1ab5f6248f14e76e943fe204d846 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_357.py | 882 | 4.125 | 4 | def main():
FREEZE_C = 0
BOIL_C = 100
FREEZE_K = 273
BOIL_K = 373
tempNum = float(input("Please enter the temperature: "))
tempMes = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
if tempMes == "C" or tempMes == "c":
if tempNum <= FREEZE_C:
print("At this temp... | true |
f67cca03dedd3fabb5a608307249f2c99fbdde95 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_065.py | 397 | 4.25 | 4 | def main():
startingHeight = int(input("Please enter the starting height of the hailstone:"))
while startingHeight != 1 :
if startingHeight % 2 == 0 :
startingHeight = startingHeight / 2
else :
startingHeight = (startingHeight * 3) + 1
print("Hail is currently at"... | true |
b4a99812a7f88d70e240e4b0e8d0b5e7d1c1fdf5 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_182.py | 748 | 4.15625 | 4 | def main():
userTemp = float(input("Please enter the temperature:"))
userScale = input("Please enter 'C' for Celsius, or 'K' for Kelvin:")
a = userTemp
if userScale == "C":
if a > 0 and a < 100:
print("At this temperature, water is a liquid.")
elif a <= 0:
print(... | true |
7fb3c53caf031fb4a7580440acbfc8f8811d65b7 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_246.py | 581 | 4.375 | 4 | def main ():
inpTemp=float(input("What is the temperature?"))
unit=input("What is the unit? (you may either enter C for Celcius or K for Kelvin)")
if unit == "C":
temp=inpTemp
elif unit == "K":
temp=inpTemp-273
else:
print ("You did not enter a correct unit. Please either en... | true |
c443537f08867bc6ac762e6794ed4f2d6158635b | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_287.py | 479 | 4.15625 | 4 | def main():
width = int(input("Please enter the width of the box:"))
height= int(input("Please enter the height of the box:"))
outline_symbol = input("Please enter a symbol for the box outline:")
box_fill_symbol= input("Please enter a symbol for the box fill:")
print(outline_symbol* width)
for i... | true |
82b5935a8d2440bff62d12a0e950755951b034c8 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_025.py | 404 | 4.21875 | 4 | def main():
hail=float(input("Please enter the starting height of the hailstone:"))
while hail!=1:
if (hail % 2)== 0:
hail= int(hail/2)
print("Hail is currently at height", hail)
elif (hail % 2)!=0:
hail= (hail*3)+1
print("Hail is currently a... | true |
9b6c849522778de47640b1e71dc28f13a81a6176 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_356.py | 504 | 4.125 | 4 | def main():
width = int(input("Pease enter the width of the box: "))
height = int(input("Please enter the height of the box: "))
outline = input("Please enter the symbol for the box outline: ")
fill = input("Pease enter a symbol for the box fill: ")
if height != 1:
print(width *outline)
... | true |
5bafe79e853a4f1faf96a70b31f85709b0c3eba9 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_391.py | 449 | 4.15625 | 4 | def main():
print()
temp = float(input("Please enter the temperature: "))
scale = input("Please enter the scale, C for Celsius or K for Kelvin: ")
if scale == "K":
temp = temp - 273.15
if temp <= 0:
print("At this temperature, water is frozen solid.")
elif temp < 100:
pr... | true |
0d8bec79312aa7cd3f9d43f5c607d0ab256f53d4 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_290.py | 532 | 4.1875 | 4 | def main ():
width = int(input("What is the width of the box: "))
height = int(input("What is the height of the box: "))
boxOutline = input("What symbol do you want to use for the box's outline: ")
boxFill = input("What symbol do you want to use to fill the box: ")
upperLimit = height - 1
fillWi... | true |
9164491697c9054aa77cd4dbc5b848897cfb1ef3 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_111.py | 466 | 4.125 | 4 | def main():
width = int(input("Please enter the width of the box: "))
height = int(input("Please enter the height of the box: "))
symbolOut = input("Please enter the symbol for the box outline: ")
symbolIn = input("Please enter a symbol for the box fill: ")
width2 = (width - 2)
symbol1 = (width ... | true |
09c091612e8ff7d2f1abcfa9f0f2cbac911ef224 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_109.py | 740 | 4.25 | 4 | def main():
startingHeight = (int(input("Please enter the starting height of the hailstone:")))
if (startingHeight == 1):
print ("Hail stopped at height",startingHeight)
else:
print("Hail is currently at height",startingHeight)
while (startingHeight != 1):
if (startingHeight % 2)... | true |
b3a9e187faac24d060d635a3cf5601e11c1a95bf | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_237.py | 1,010 | 4.15625 | 4 | def main():
temperature = float(input("Please enter the temperature: "))
scaleType = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
C_FROZEN = 0
C_BOIL = 100
K_FROZEN = 273
K_BOIL = 373
if scaleType == 'C':
if temperature <= C_FROZEN:
print("At this temperatu... | true |
cdaf91d26893dc124174bc5b9e919c9065f1f593 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_315.py | 538 | 4.21875 | 4 | def main():
starting_height = int(input("Please enter the starting height of the hailstone: "))
print("Hail is currently at height",starting_height)
while starting_height != 1:
if starting_height % 2 == 0:
starting_height = int(starting_height / 2)
if starting_height != 1:
print("Hail is currently at hei... | true |
a114f24c69db097c663703ae32a90c51ac5b6d14 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_196.py | 747 | 4.125 | 4 | def main():
user_temp = float(input("Please enter the temperature: "))
user_scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
if user_scale == 'K':
if user_temp < 273.15:
print("At this temperature, water is a (frozen) solid.")
elif user_temp > 373.15:
... | true |
c4df35c8a0b8dab68815c048f3487c7f243e7d75 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_415.py | 452 | 4.1875 | 4 | def main():
Temp = float(input("Enter the temperature: "))
Type = input("Enter 'C' for Celsius, or 'K' for Kelvin: ")
if Temp <= 273.15 and Type == "K" or Temp <= 0 and Type == "C":
print("At this temperature, water is a solid.")
elif Temp >= 373.15 and Type == "K" or Temp >= 100 and Type == "C... | true |
987cdb70436033ed5d8253f83c2ca4286aee9d73 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_290.py | 288 | 4.125 | 4 | def main():
a = int(input("Please enter the starting height of the hailstone: "))
while a !=1:
print("Hail is currently at height",int(a))
if a %2== 0:
a/=2
else:
a = a*3+1
print("Hail stopped at height 1")
main()
| true |
f3fc99aa58bb857b66fe794eb9da3bcc09e62253 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_254.py | 462 | 4.125 | 4 | def main():
width = int(float(input("Please enter the width of the box: ")))
height = int(float(input("Please enter the hieght of the box: ")))
outline = input("Please enter a symbol for the box outline: ")
fill = input("Please enter a symbol for the box fill: ")
EDGE = 2
height=height-EDGE
... | true |
41669cf282bd4afa08e42abaef9651e42d94f6dc | MAPLE-Robot-Subgoaling/IPT | /src/web/hw3_69.py | 573 | 4.15625 | 4 |
def main():
FREEZE = 0
BOIL = 100
CONVERT = 273.15
temp = float(input("Please enter the temperature: "))
print("Please enter the units...")
units = str(input("Either 'K' for Kelvin or 'C' for Celcius: "))
if units == 'K' :
tempCel = temp - CONVERT
else :
tempCel = t... | true |
e8fae662feeb6aa590fe33becf210da929c7a8ad | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_348.py | 460 | 4.15625 | 4 | def main():
width = int(input("Please enter the width of the box: "))
height = int(input("Please enter the height of the box: "))
symb1 = input("Please enter a symbol for the box outline: ")
symb2 = input("Please enter a symbol for the box fill: ")
width1 = width - 2
fill = symb2 *width1
out... | true |
afeafa3b4267e96a9be0539abfaa626da21f9455 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_174.py | 558 | 4.3125 | 4 | def main():
userHeight = int(input("Please enter a positive integer that will serve as the starting height for the hailstone: "))
print("Hail height starts at", userHeight)
while userHeight != 1:
if userHeight % 2 == 1:
userHeight = int((userHeight * 3) + 1)
print("Hail heigh... | true |
83dfbf3cbd2f80f48c06dd7763f886026f23ac2d | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_135.py | 794 | 4.125 | 4 | def main():
width = int(input("What do you want the width of the box to be? "))
height = int(input("What do you want the height of the box to be? "))
outline = str(input("Enter the symbol you want the outline to be: "))
fill = str(input("Enter the symbol you want the filling of the box to be: "))
pr... | true |
8a4dfd706d16db0a3a5d148d11ba2399def19641 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_118.py | 940 | 4.1875 | 4 | def main():
SOLID_TEMP_CELSIUS = 0
GAS_TEMP_CELSIUS = 100
SOLID_TEMP_KELVIN = 273.15
GAS_TEMP_KELVIN = 373.15
tempNum = float(input("Please enter the temperature: "))
degreeType = input("Please enter 'C' for Celsius or 'K' for Kelvin: ")
if (degreeType == "C"):
if (tempNum <= SOLID_TE... | true |
31c4258373d73681e8d1021fb4fac4d42105c0ca | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_421.py | 743 | 4.15625 | 4 | def main():
temp=float(input("Please enter the temperature: "))
scale=input("Please enter 'C' for Celcius, or 'K' for Kelvin: ")
if temp <= 0 and scale == "C":
print("At this temperature, water is a solid.")
elif temp > 0 and temp < 100 and scale == "C":
print("At this temperature, water... | true |
6dfe0293e894534bf993ae70f3a1f3a78e7e9d15 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_222.py | 399 | 4.3125 | 4 | def main():
height = input("Please enter the current height of the hailstone: ")
height = int(height)
while(height > 1):
height = int(height)
print("The hailstone is at height",height)
if(height % 2 == 0):
height /= 2
elif(height % 2 != 0):
height *= 3... | true |
dae3c37bca2ad430eabd80d5f763b520b214ab5e | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_158.py | 679 | 4.125 | 4 | def main():
temp =float(input("please enter a temperature "))
unit = input("please enter 'C' for celsius or 'K' for kelvin ")
if unit=="C":
if temp <0:
print("At this temperature, water is a solid")
elif temp >100:
print("At this temperature, water is a gas")
elif temp >0 ... | true |
71bc91e8c4ed40169539728b97f99fc0b18170d1 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_062.py | 516 | 4.28125 | 4 | def main():
hailStormNum = int(input("Please insert a positive integer, which is the starting height of the hailstorm: "))
while hailStormNum != 1:
if hailStormNum % 2 == 0:
hailStormNum = hailStormNum / 2
hailStormNum = int(hailStormNum)
print (hailStormNum)
... | true |
c2865ffd41f13fe9025094fdf6b7a0de4b384e04 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_207.py | 697 | 4.125 | 4 | def main():
userTemp = float(input("Please enter the temperature: "))
unitScale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
if unitScale == "C":
if userTemp <= 0:
print("At this temperature, water is a solid.")
elif userTemp >= 100:
print("At this tem... | true |
6d99ddfa0e550e40ed5332c54493d4f5a6dc49b4 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_337.py | 807 | 4.125 | 4 | def main():
temperature = float(input('Please enter the temperature: '))
scale = input('Please enter C for Celsius, or K for Kelvin: ')
if (temperature <= 0) and (scale == 'C'):
print ('At this tmeperature, water is a (frozen) solid.')
elif (temperature >= 100) and (scale == 'C'):
print ... | true |
60050fbfe1d39a9e0ad38e9908a0f8fcba491fe1 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_233.py | 834 | 4.15625 | 4 | FREEZING_POINT_OF_CELSIUS= 0
BOILING_POINT_OF_CELSIUS = 100
FREEZING_POINT_KELVIN = 373.16
BOILING_POINT_KELVIN= 273.16
def main():
temp= float(input("Please enter the temperature:"))
temp1= (input("Please enter 'C' for Celsius, or 'K' for Kelvin:"))
if temp1 =="C":
if temp > 0 and temp < 100:
... | true |
2c92980b2b3d805d6227c49c796507ce79b88b81 | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_374.py | 486 | 4.125 | 4 | def main():
width = int(input("Please enter the width of the box: "))
height = int(input("Please enter the height of the box: "))
symbol = input("Please enter the symbol for the box outline: ")
filling = input("Please enter the symbol for the box filling: ")
fillWidth = width - 2
for box in rang... | true |
fdf6fbdf2f21fe305e544a367b705a2eead1d2dc | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_123.py | 598 | 4.125 | 4 | def main():
index = 0
widthPrompt = int(input("What is the width of the box? "))
heightPrompt = int(input("What is the height of the box? "))
outsideSymbol = str(input("What character is the outside of the box made of? "))
insideSymbol = str(input("What character is the inside of the box made of? ")... | true |
fa2c9b4e50d08505b1992c319c2fff86781a5d26 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_179.py | 756 | 4.15625 | 4 | def main():
GAS_C = 100
LIQUID_C = 60
GAS_K = 373.15
LIQUID_K = 333.15
temp = float(input("Please enter the temperature "))
unit = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
if unit == 'C':
if temp > GAS_C:
print("At this temperature, water is a gas")
... | true |
95d8cc3d61617d2bdae5c8339d0963acac2bc1b8 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_447.py | 417 | 4.25 | 4 | def main():
startingHeight=int(input("Please enter the starting height of the hailstone:"))
while startingHeight>1:
print("Hail is currently at Height",startingHeight)
if startingHeight % 2==0:
startingHeight=startingHeight/2
elif startingHeight % 2==1:
startingHe... | true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.