blob_id string | repo_name string | path string | length_bytes int64 | score float64 | int_score int64 | text string | is_english bool |
|---|---|---|---|---|---|---|---|
224b5e89e34fd67a481f08faebea9b88e663360d | ZorkinMaxim/Extra_HomeWork | /DZ_Palindrome.py | 487 | 4.15625 | 4 | # Detect Palindrome
# Запросить ввод числа. Определить является ли введенное число полиндромом или нет.
number = int(input('Enter a number'))
reversed_number = 0
tmp_original = number
while tmp_original > 0:
reversed_number = (reversed_number * 10) + tmp_original % 10
tmp_original = tmp_original // 10
if number == reversed_number:
print('Palindrome')
else:
print('No Palindrome')
| false |
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.find(" ")
if spaces == -1:
print("invalid name")
else:
second = name[:spaces]
name = name[spaces + 1:]
spaces = name.find(" ")
if spaces != -1:
print("invalid name")
else:
third = name
comma = first.find(",")
if comma == -1:
transformed = third + ', ' + first + ' ' + second
print(transformed)
else:
transformed = second + ' ' + third + ' ' + first[:-1]
print(transformed)
main()
| 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):
>>> sum_pairs([5, 1, 4, 8, 3, 2], 7)
(4, 3)
No pairs sum to 100, so return empty tuple:
>>> sum_pairs([11, 20, 4, 2, 1, 5], 100)
()
"""
# Make a new list, make a reversed copy of nums
l1 = []
nums_copy = nums.copy()
nums_copy.reverse()
# Loop through the reversed copy of nums and append each pair of sums to l1
for i in range(len(nums_copy)-1):
for j in range(i+1,len(nums_copy)):
l1.append((nums_copy[i], nums_copy[j], nums_copy[i] + nums_copy[j]))
# filter out any sums that are not equal to goal
goal_list = [tup for tup in l1 if tup[2] == goal]
# if there was no pair that summed to goal, return an empty tuple, otherwise return the
# first pair of numbers that summed to goal
if goal_list == []:
return ()
else:
return (goal_list[-1][1], goal_list[-1][0])
| true |
12f3523d3f7a30ff50d9da6df502f8d6b0274417 | BhanuPrakashNani/Competitive_coding | /HackerRank/Intro to Conditional Statements.py | 311 | 4.21875 | 4 | # https://www.hackerrank.com/challenges/30-conditional-statements
# Day 3: Intro to Conditional Statements
N = int(raw_input().strip())
if N%2 != 0:
print "Weird"
else:
if (N>=2 and N<=5):
print "Not Weird"
elif (N>=6 and N<=20):
print "Weird"
else:
print "Not Weird"
| false |
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", 12, "bd")
name = "ann catherine"
print(name.title())
student_name = input("Enter student's name: ")
student_age = input("Enter student's age: ")
add_student(student_name, student_age)
print(students)
print("------------------")
def ask_user_input():
return input("Do you want to add a student? Answer yes or no: ")
add_student = ask_user_input()
while add_student.lower() == "yes" or add_student.lower() == "y":
# ask the user for student name and age
student_name = input("Enter student name: ")
student_age = input("Enter student age: ")
student = {
"name": student_name.title(),
"age": student_age
}
students.append(student)
add_student = ask_user_input()
print("Students ....\n", students)
| true |
12f15e48bea02f0dd5381fd7d87162dda1a74a40 | PaytonPengWang/python-learning | /005_money_challenge_v3.0.py | 851 | 4.125 | 4 | """
作者:王鹏
功能:52周存钱挑战
日期:1/1/2019
v2.0 新增:记录每周的存款数
使用for语句可以便利整个序列的内容
for <x> in <list1>:
<body>
range(n) 返回一个可迭代的对象
list(range(n))将迭代类型转换为list
for i in range(10)
print(i) // 0 ... 9
"""
import math
def main():
INCREASE_MONEY = 10
TOTAL_WEEK = 52
# 每周存入的金额
money_per_week = INCREASE_MONEY
# 第几周
week = 1
account_list = []
for week in range(1,TOTAL_WEEK+1):
account_list.append(money_per_week)
print("第{0}周,存入{1}元,账户累计:{2}".format(week,money_per_week,math.fsum(account_list)))
money_per_week += INCREASE_MONEY
if __name__ == "__main__":
main() | false |
c870a976dc18743a569ce70de71f3128f0ed7339 | ductandev/Tkinter_GUI_tutorial | /may_tinh.py | 2,951 | 4.125 | 4 | from tkinter import *
root = Tk()
root.title("Công cụ tính toán")
def button_click(number):
current=e.get()
e.delete(0,END)
e.insert(0,str(current)+str(number))
def button_clear():
e.delete(0,END)
def button_add():
first_number=e.get()
global f_num
global math
math = "addition"
f_num=int(first_number)
e.delete(0,END)
def button_sub():
first_number=e.get()
global f_num
global math
math = "subtraction"
f_num=int(first_number)
e.delete(0,END)
def button_mul():
first_number=e.get()
global f_num
global math
math="multiplication"
f_num=int(first_number)
e.delete(0,END)
def button_div():
first_number=e.get()
global f_num
global math
math="divison"
f_num=int(first_number)
e.delete(0,END)
def button_equal():
second_num = e.get()
e.delete(0,END)
if(math == "addition"):
e.insert(0, f_num + int(second_num))
if(math == "subtraction"):
e.insert(0, f_num - int(second_num))
if(math == "multiplication"):
e.insert(0, f_num * int(second_num))
if(math == "divison"):
e.insert(0, f_num / int(second_num))
e = Entry(root,width=35,borderwidth=5)
e.grid(row=0,column=0,columnspan=3,padx=20,pady=20)
#e.insert(0,"Enter Your number")
button1 = Button(root,text="1",padx=40,pady=20,command = lambda: button_click(1))
button2 = Button(root,text="2",padx=40,pady=20,command = lambda: button_click(2))
button3 = Button(root,text="3",padx=40,pady=20,command = lambda: button_click(3))
button4 = Button(root,text="4",padx=40,pady=20,command = lambda: button_click(4))
button5 = Button(root,text="5",padx=40,pady=20,command = lambda: button_click(5))
button6 = Button(root,text="6",padx=40,pady=20,command = lambda: button_click(6))
button7 = Button(root,text="7",padx=40,pady=20,command = lambda: button_click(7))
button8 = Button(root,text="8",padx=40,pady=20,command = lambda: button_click(8))
button9 = Button(root,text="9",padx=40,pady=20,command = lambda: button_click(9))
button0 =Button(root,text="0",padx=40,pady=20,command = lambda: button_click(0))
button0_equal =Button(root,text="=",padx=40,pady=20,command = button_equal)
button_add = Button(root,text="+",padx=20,pady=20,command = button_add)
button_sub = Button(root,text="-",padx=20,pady=20,command = button_sub)
button_mul = Button(root,text="x",padx=20,pady=20,command = button_mul)
button_div = Button(root,text="/",padx=20,pady=20,command = button_div)
button_clear = Button(root,text="CLEAR",padx=20,pady=20,command = button_clear)
button1.grid(row=1,column=0)
button2.grid(row=1,column=1)
button3.grid(row=1,column=2)
button4.grid(row=2,column=0)
button5.grid(row=2,column=1)
button6.grid(row=2,column=2)
button7.grid(row=3,column=0)
button8.grid(row=3,column=1)
button9.grid(row=3,column=2)
button0.grid(row=4,column=0)
button0_equal.grid(row=4,column=1)
button_clear.grid(row=4,column=2)
button_add.grid(row=1,column=4)
button_sub.grid(row=2,column=4)
button_mul.grid(row=3,column=4)
button_div.grid(row=4,column=4)
root.mainloop()
| false |
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 multiple line comments
line 2 of comment
line 3 of comment
'''
# Variables in python
'''full_name = "Dave Roberts" # declare variable and assigned string value
print(full_name)
'''
#ata types in python
#Strings - test (wrapped in quotation marks can be single or double quotes)
#Numbers
#Lists
#Tuples - constant, can't be changed use parenthese instead of bracket
#Dictionaries - more complicated list use curly brackets and they have key and value pair
#Boolean
'''age = 41
print(age)
names = [full_name,age]
print(names[0]) #print single item
print(names) #print full list
'''
'''quote_test = 'We "Welcome" you'
print(quote_test)
'''
'''fav_pizza = {
"Dave": "Cheese",
"Bob": "Anchovy",
"Mary": "Pepporoni",
#"Bob": "Hawiian" #note last item in dictionary list is returned!
}
print(fav_pizza["Bob"])
'''
'''
switch = True
print(switch)
'''
| 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 within the speed limit!") | true |
5cad256220ce09a80b48be9a2f583df1d73dfd01 | AmirBalti2/Python-Basic | /test3.py | 570 | 4.21875 | 4 | """Task
Given an integer,n , perform the following conditional actions:
If n is odd, print Weird
If n is even and in the inclusive range of 2 to 5, print Not Weird
If n is even and in the inclusive range of 6 to 20, print Weird
If n is even and greater than 20, print Not Weird"""
import math
import os
import random
import re
import sys
n=int(input("Enter the number "))
if n%2!=0:
print("werid")
elif n%2==0 and 2<= n <=5:
print("not werid")
elif n%2==0 and 6<= n <=20:
print("werid")
elif n%2==0 and n>20:
print("not weird")
| false |
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 num1 in range(5, 1000001,5):
##if num1 %5 == 0:
print num1
## num1 +=1
##Sum List
##Create a program that prints the sum of all the values in the list: a = [1, 2, 5, 10, 255, 3]
a = [1, 2, 5, 10, 255, 3]
print sum(a)
##Average List
##Create a program that prints the average of the values in the list: a = [1, 2, 5, 10, 255, 3]
print sum(a)/len(a)
| 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 instantiate"""
def __init__(self, sides=6):
self.sides = sides
def roll_die(self):
return randint(1, self.sides)
# this function rolls the die passed in 10 times
def roll_dice(dice_type):
print(f"\nYou are rolling a {dice_type.sides} sided die!")
for die_roll in range(10):
print(f"You rolled a: {dice_type.roll_die()}")
# create and roll six sided die
hex_die = Dice()
roll_dice(hex_die)
# Make a 10-sided die and a 20-sided die. Roll each die 10 times.
deca_die = Dice(10)
roll_dice(deca_die)
poly_die = Dice(20)
roll_dice(poly_die)
| 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, print a grade using the following table:
# >= 0.9 A
# >= 0.8 B
# >= 0.7 C
# >= 0.6 D
# < 0.6 F
userGrade = input('Enter a score: ')
userGrade = float(userGrade)
def compute_grade(grade):
if userGrade > 1.0 or userGrade < 0.0:
score = 'Bad score'
elif userGrade >= .9:
score = 'A'
elif float(userGrade) >= .8:
score = 'B'
elif userGrade >= .7:
score = 'C'
elif userGrade >= .6:
score = 'D'
else:
score = 'F'
return score
your_grade = compute_grade(userGrade)
print(your_grade)
| 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 message for each order, such
# as I made your tuna sandwich. As each sandwich is made, move it to the list
# of finished sandwiches.
while sandwich_orders:
sandwich = sandwich_orders.pop()
print(f"I have made your {sandwich} sandwich")
finished_sandwiches.append(sandwich)
print("\n")
# After all the sandwiches have been made, print a
# message listing each sandwich that was made.
for sandwich in finished_sandwiches:
print(f"Your {sandwich} sandwich is ready to eat")
| true |
0804bc2f3e61597193b2181ec42291881dc7249b | kuljotbiring/Python | /pythonlearn/dictionary_in_list.py | 972 | 4.53125 | 5 | # Start with the program you wrote for Exercise 6-1 (page 99).
tesla = {
'first_name': 'elon',
'last_name': 'musk',
'age': 45,
'city': 'los angeles',
}
# Make two new dictionaries representing different people, and store all three
# dictionaries in a list called people. Loop through your list of people. As you
# loop through the list, print everything you know about each person.
microsoft = {
'first_name': 'bill',
'last_name': 'gates',
'age': 70,
'city': 'seattle',
}
apple = {
'first_name': 'steve',
'last_name': 'jobs',
'age': 63,
'city': 'cupertino',
}
ceo_list = []
ceo_list.append(tesla)
ceo_list.append(microsoft)
ceo_list.append(apple)
for founder in ceo_list:
fullname = founder['first_name'].title() + " " + founder['last_name'].title()
years = founder['age']
location = founder['city'].title()
print(f"{fullname} is {years} years old and lives in {location}")
| false |
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 file being read.
print txt.read()
# Collects name of file from user, aka stdin.
print "Type the filename again:"
file_again = raw_input("> ")
# Opens the filename input above.
txt_again = open(file_again)
# Prints the contents of the file being read.
print txt_again.read() | 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-7?"
# Running thru 5 < -2
print float(3+2<5-7)
# Adding
print "What is 3+2?", float(3+2)
# Subtraction
print "what is 5 - 7?", float(5-7)
print "Oh, that's why it's False."
print "How about some more."
# Greater than problem
print "Is it greater?", float(5 > -2)
# Greater than or equal to problem
print "Is it greater or equal?", float(5>=-2)
# Less than or equal to problem
print "Is it less or equal?", float(5 <= -2)
| 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 5 < -2
print 3+2<5-7
# Adding
print "What is 3+2?", 3+2
# Subtraction
print "what is 5 - 7?", 5-7
print "Oh, that's why it's False."
print "How about some more."
# Greater than problem
print "Is it greater?", 5 > -2
# Greater than or equal to problem
print "Is it greater or equal?", 5>=-2
# Less than or equal to problem
print "Is it less or equal?", 5 <= -2
| 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(nested_list[0][-1]);
for first in nested_list:
for second in first:
print (second)
#printing odd values with nested list comprehension
[[print (second) for second in first if second%2 != 0] for first in nested_list ] | 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(search_letter),"no. of",search_letter)
print("The total # of \"" + search_letter + "\" found in the list is", total)
| true |
4cc802d818f40279cae58017e80074eb14effc4c | izzitan/CP1404_practical | /prac_03/password_check.py | 630 | 4.125 | 4 | """
Name: Hafidz Izzi Baihaqi
GitHub: https://github.com/izzitan/CP1404_practical
"""
MIN_LENGTH = 4
def main():
password = get_password()
while not is_valid_password(password):
print("Invalid password")
password = get_password()
print("Password {} is valid".format(print_asterisk(password)))
def get_password():
password = input("Please enter your password: ")
return password
def is_valid_password(password):
return len(password) >= MIN_LENGTH
def print_asterisk(password):
asterisks = ""
for i in range(len(password)):
asterisks = asterisks + "*"
return asterisks
main()
| false |
6dc649fe5d64f037fe4ac0fa8acd49863efbb2ac | chemplife/Python | /python_core/function_args_kargs.py | 1,492 | 4.25 | 4 | # *args scoops the positional arguments into a Tuple.
# **kwargs scoops the Keyword arguments into a Dictionary.
def my_func0(a,b,*args):
print('my_func0')
print(f'a:{a}, b:{b}, args:{args}')
my_func0(10,20,30,40)
print('-------------------------------')
# '*args' takes all the left overs.
# To have anything after'*args', it needs to be Keyword
def my_func1(a,b,*args, d):
print('my_func1')
print(f'a:{a}, b:{b}, args:{args}, d:{d}')
my_func1(10,20,30,40, d=50)
print('-------------------------------')
# To stop any positional arguments, use '*'
# '*' means, no positional arguments after that.
def my_func2(e,f,*, a,b,d):
print('my_func2')
print(f'e:{e}, f:{f}, a:{a}, b:{b}, d:{d}')
my_func2(5,1,a=10,b=20,d=50)
print('-------------------------------')
# No Argument can come after **kwargs
def my_func3(*,a,**kwargs):
print('my_func3')
print(f'a:{a}, kwargs:{kwargs}')
my_func3(a=10,b=20,d=50)
print('-------------------------------')
def my_func4(e,f,*args,a,**kwargs):
print('my_func4')
print(f'e:{e}, f:{f}, args:{args}, a:{a}, kwargs:{kwargs}')
my_func4(5,1,4,5,6,a=10,b=20,d=50)
print('-------------------------------')
def my_func5(*args,**kwargs):
print('my_func5')
print(f'args:{args},kwargs:{kwargs}')
my_func5(5,1,4,5,6,a=10,b=20,d=50)
print('-------------------------------')
# args and kwargs can be empty
def my_func6(*args,**kwargs):
print('my_func6')
print(f'args:{args},kwargs:{kwargs}')
my_func6()
print('-------------------------------') | false |
69f2023e39b5ebfc7c87ba8b0beb524d19512311 | dotnet-tech/python-basics | /Operators/Operator_Overloading.py | 1,368 | 4.3125 | 4 | #Operator Overloading
print(1 + 2)
print("Python"+"is")
print(3 * 4)
print("Python"*4)
#output
'''
3
Pythonis
12
PythonPythonPythonPython
'''
class AddNumbers:
def __init__(self,a):
self.a =a
def __add__(self,b): #magic method (+ overloading)
return self.a + b.a
def addTwoNumbers(self,b): #normal method
return self.a + b
a = AddNumbers(10)
b =AddNumbers(20)
print("Result A + B = {} ".format(a.addTwoNumbers(40)))
print('Overloading result A + B = {}'.format(a+b))
#output
'''
Result A + B = 50
Overloading result A + B = 30
'''
'''
Binary Operators:
OPERATOR MAGIC METHOD
+ __add__(self, other)
– __sub__(self, other)
* __mul__(self, other)
/ __truediv__(self, other)
// __floordiv__(self, other)
% __mod__(self, other)
** __pow__(self, other)
Comparison Operators :
OPERATOR MAGIC METHOD
< __lt__(self, other)
> __gt__(self, other)
<= __le__(self, other)
>= __ge__(self, other)
== __eq__(self, other)
!= __ne__(self, other)
Assignment Operators :
OPERATOR MAGIC METHOD
-= __isub__(self, other)
+= __iadd__(self, other)
*= __imul__(self, other)
/= __idiv__(self, other)
//= __ifloordiv__(self, other)
%= __imod__(self, other)
**= __ipow__(self, other)
Unary Operators :
OPERATOR MAGIC METHOD
– __neg__(self, other)
+ __pos__(self, other)
~ __invert__(self, other)
'''
| false |
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 the name of emp to 'Korel Rossi'
emp.set_name('Korel Rossi')
# Print the name of emp
print(emp.name)
class Employee:
def set_name(self, new_name):
self.name = new_name
# Add set_salary() method
def set_salary(self, new_salary):
self.salary = new_salary
# Create an object emp of class Employee
emp = Employee()
# Use set_name to set the name of emp to 'Korel Rossi'
emp.set_name('Korel Rossi')
# Set the salary of emp to 50000
emp.set_salary(50000)
| 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 enter a value less than 128: "))
if x > 127:
print("you have entered a number greater than 127")
x = int(input("please enter a value less than 128: "))
while x <= 128:
return x
# this function sets the coordinates for the y axis that prints the horizontal line
def verticalDisplay(x=verticalDisplayInput(), y=1):
while y <= 63:
lcd.set_pixel(x, y, 1)
y = y + 1
# the function is called and the line is displayed
verticalDisplay()
lcd.show()
| 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 value associated with key in the map.
"""
pass
@abstractmethod
def __setitem__(self,key,value):
"""
Similar to the __setitem__ method for a Python dictionary, this will
add or update the key-value pairing inside the map.
"""
pass
@abstractmethod
def __delitem__(self,key):
"""
Similar to the __delitem__ method for a Python dictionary, this will
remove the key-value pairing inside the map.
"""
pass
@abstractmethod
def __contains__(self, key):
"""
Similar to the __contains__ method for a Python dictionary, this will
return true if the key-value pairing is inside the map; otherwise, if not
then return false.
"""
pass
@abstractmethod
def keys(self):
"""
Returns an iterable object (of your choosing) with all the keys inside
the map.
"""
pass
@abstractmethod
def values(self):
"""
Returns an iterable object (of your choosing) with all the values inside
the map.
"""
pass
@abstractmethod
def __len__(self):
"""
Returns the number items in the map.
It needs no parameters and returns an integer.
"""
pass
@abstractmethod
def __bool__(self):
"""
Returns whether the map is empty or not.
it needs no parameters and returns a bool.
"""
pass
@abstractmethod
def __iter__(self):
"""
Returns an iterator of the objects inside the map. The iterator returns
the key-value pair as tuple.
"""
pass
| 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],
[0,0,0, 4,1,9, 0,0,5],
[0,0,0, 0,8,0, 0,7,9]]
# Check if a empty cell (x, y) can hold a certain number (value).
def check(x, y, value, board):
# Check vertical line
for i in range(9):
if(board[i][y] == value):
return False
# Check horizontal line
for j in range(9):
if(board[x][j] == value):
return False
# Check box
x0 = 3*(x//3)
y0 = 3*(y//3)
for i in range(3):
for j in range(3):
if(board[x0+i][y0+j] == value):
return False
return True
# Find all the possible solutions recursively.
def solve(board):
# We could do some pruning, maybe pass the last cell changed,
# so we can iterate starting from it.
for i in range(9):
for j in range(9):
if(board[i][j] == 0): # if cell is empty
for k in range(1, 10): # try every possible value
if(check(i, j, k, board)): # solve it recursively
board[i][j] = k
solve(board)
board[i][j] = 0
return
show(board)
input()
# Show the sudoku board.
def show(board):
for i in range(9):
for j in range(9):
print(f'{board[i][j]} ', end='')
if((j+1)%3==0):
print(' ', end='')
print('\n', end='')
if((i+1)%3==0 and i!=8):
print('\n', end='')
solve(sudoku)
| true |
2bba980041b15141739ced6c043ff60f0c0dfd62 | spidyxD/Markov-s_Theorem_Python | /Regla.py | 1,392 | 4.125 | 4 | class Regla:
"""""
def __init__(self,entrada,salida,esFinal,numero):
self.entrada = entrada
self.salida = salida
self.esFinal = esFinal
self.numero = numero
self.etiqueta = None
self.comentario = None
"""""
def __init__(self, entrada="", salida=""):
self.entrada = entrada
self.salida = salida
"""
def __init__(self, entrada="", salida="", esFinal="", numero="",etiqueta=""):
self.entrada = entrada
self.salida = salida
self.esFinal = esFinal
self.numero = numero
self.etiqueta = etiqueta
self.comentario = None
"""
def getEntrada(self):
return self.entrada
def getSalida(self):
return self.salida
def getEsFinal(self):
return self.esFinal
def getNumero(self):
return self.numero
def getEtiqueta(self):
return self.etiqueta
def getComentario(self):
return self.comentario
def setEntrada(self,entrada):
self.entrada = entrada
def setSalida(self,salida):
self.salida = salida
def setEsFinal(self,esFinal):
self.esFinal = esFinal
def setNumero(self,numero):
self.numero = numero
def setEtiqueta(self,etiqueta):
self.etiqueta = etiqueta
def setComentario(self,comentario):
self.comentario = comentario | false |
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 sentence
print("\n" + capwords(course))
print(course.__len__())
print(course.replace("Programmers", "Coders"))
print(len(course))
# Upper case method
print("Upper case of this string is "+course.upper())
# Lower case method
print("Lower case of this string is "+course.lower())
# find the location of string python in the given variable
print(course.find("Python"))
# return a boolean if the given expression is present in the given string
print("for" in course)
# RFind method returns the last index of the string occurrence
print(course.rfind("for"))
| 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 searches the string for a match, and returns a Match object if there is a match.
x = re.search("\s",txt)
print(x.start())
#The split() function returns a list where the string has been split at each match:
x = re.split("\s",txt)
print(x)
| 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 into one tuple.
#example
x = (3,4,5,6)
x = x + (1,2,3)
print(x)
#determine how many items a tuple has, use the len() method
print(len(x))
#It is also possible to use the tuple() constructor to make a tuple.
#Using the tuple() method to make a tuple.
thistuple = tuple((1,2,3,4,5,6,4,4))
print(thistuple)
print(thistuple.count(4))
print(thistuple.index(1))
| 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 )
print(z == y )
# Membership Operators
x = ['apple' , 'orange']
print('orange' in x)
print('orange' not in x)
print('banana' in x)
print('banana' not in x)
#Bitwise Operators
| 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.
thisdict["year"] = 2019
print(thisdict)
#Loop Through a Dictionary
#print keys
for n in thisdict:
print(n)
#print values
for n in thisdict:
print(thisdict[n])
print(thisdict.values())
print(thisdict.keys())
#the items() function.
print(thisdict.items())
#Loop through both keys and values, by using the items() function
for x,y in thisdict.items():
print(x,y)
| 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.update(['cherry','banana'])
print(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):
print(x)
'''The range() function defaults to 0 t is possible to specify the starting value by adding a parameter: range(2, 6), which means values from 2 to 6
(but not including 6)'''
for x in range(2,6):
print(x)
'''The range() function defaults to increment the sequence by 1, however it is possible to specify the increment value by adding a third parameter: range(2, 30, 3)'''
for x in range(2,30,3):
print(x)
#Else in For Loop The else keyword in a for loop specifies a block of code to be executed when loop is finished
#Print all numbers from 0 to 5, and print a message when the loop has ended
for x in range(2,6):
print(x)
else:
print("finally finished")
'''Nested Loops
A nested loop is a loop inside a loop.
The "inner loop" will be executed one time for each iteration of the "outer loop'''
#print each adjective for every fruit.
adj = ['red','big','testy']
fruites = ['apple','cherry','bannana']
for x in adj:
for y in fruites:
print(x,y)
| 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 temperature, water is a solid")
else:
print("At this temperature, water is a liquid")
else:
if temp >= 100:
print("At this temperature, water is a gas")
elif temp <= 0:
print("At this temperature, water is a solid")
else:
print("At this temperature, water is a liquid")
main()
| 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 solid.")
if(temp >=100) and (form == "C"):
print("the water is a gas.")
if(temp > 273) and (temp < 373) and (form == "K"):
print("the water is a liquid")
if(temp <= 273) and (form == "K"):
print("the water is frozen solid")
if(temp >= 373) and (form == "K"):
print("the water is a gas.")
main()
| 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 at this temperature")
else:
print("The water is frozen solid at this temperature")
elif (tempType == 'K'):
if (temp >= 373.16):
print("The water is gas at this temperature")
elif (temp >= 273.16):
print("The water is liquid at this temperature")
else:
print("The water is frozen solid at this temperature")
main()
| 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):
print ("Hail is currently at height", height)
heightMOD = height % 2
if (heightMOD == 0):
height = height // 2
elif (heightMOD == 1):
height = (height * 3) + 1
print ("Hail stopped at height", STOP)
main()
| 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: ")
print(outline*width)
if(height > 1):
if(height > 2):
for i in range(height-2):
print(outline + (fill*(width-2)) + outline)
print(outline*width)
main()
| 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.")
else:
print("At this temperature, water is a liguid.")
elif unit=="K":
if temp<=273.15:
print("At this temperature, water is a solid.")
elif temp>=373.15:
print("At this temperature, water is a gas.")
else:
print("At this temperature, water is a liguid.")
main()
| true |
12c854f625fc3fb346fba5b8999d821b8dcbf2c9 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_133.py | 497 | 4.1875 | 4 | def main():
height = int(input("Enter a height for the hailstorm: "))
evenOdd = height % 2
while height != 1:
while evenOdd == 0:
height = int(height / 2)
evenOdd = height % 2
print("Hail is currently at height",height)
while evenOdd == 1 and height != 1:
height = int((height * 3) + 1)
evenOdd = height % 2
print("Hail is currently at height",height)
print("Hail stopped at height 1")
main()
| false |
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*(width - 2))+symbol1)
if height > 1:
print(symbol1*width)
main()
| 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 is a gas.")
elif temp > 0 and tem < 100:
print("At this temperature, water is a liquid.")
elif scale == "K":
if temp <= 273.15 and temp >= 0:
print("At this temperature, water is a(frozen) solid.")
elif temp >= 373.15:
print("At this temperature, water is a gas.")
elif temp > 273.15 and tem < 373.15:
print("At this temperature, water is a liquid.")
elif temp < 0:
print("You cannot have a temperature below 0 Kelvin,it is the abosulte zero.But you can think this as a solid.")
elif scale != "C" or "K":
print("The answer you type in is invalid, make sure you type in capitalized 'C'or 'K'.")
main()
| 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):
inside = (width -2)*fill
print(outline, inside, outline)
if height >= 2:
print(top)
main()
| 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 < 100 and tempMode =="C" or 273 < temp < 373 and tempMode == "K":
print("At", str(temp) + tempMode, "water would be liquid.")
if temp >= 100 and tempMode == "C" or temp >= 373 and tempMode == "K":
print("At", str(temp) + tempMode, "water would be boiling.")
main()
| 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 this temperature, water is ice")
elif SI == 'K' and temp > 373.15:
print("At this temperature, water is gas")
elif SI == 'K' and temp > 273.15:
print("At this temperature, water is liquid")
else:
print("At this temperature, water is ice")
| 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)
height=height//2
elif even != 0:
if height >= 1:
print("The current height is ", height)
height=height*3+1
print("The hail stopped at " ,height)
main()
| true |
911ed2d52c58f504bb68f5d95ab6b58163252451 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_241.py | 379 | 4.125 | 4 | def main():
num = int(input("Please enter any positive number : "))
while num > 1:
if num == 1:
print ("Hail stopped at 1")
elif num % 2 == 0:
num = int(num/2)
print ("Hail is currently at :", num)
elif num % 2 == 1:
num = int((num * 3)+ 1)
print ("Hail is currently at :",num)
main()
| false |
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" and temp > 373:
print("The water is a gas")
if scale == "C" and temp <= 0:
print("The water is frozen solid")
elif scale == "C" and temp >= 0 and temp <=100:
print("The water is a liquid")
elif scale == "C" and temp > 100:
print("The water is a gas")
main()
| true |
fa46a23d78b2908ac225f08cb51bde2278d97786 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_118.py | 515 | 4.125 | 4 | def main():
posInt = int(input("Please enter a starting positive integer for height of the hailstone: "))
while (posInt != 1):
if (posInt % 2 == 0) and (posInt - 2 != 0):
posInt = posInt // 2
print("Hail is currently at height", posInt)
elif ((posInt % 2 == 1) and (posInt != 1)):
posInt = posInt * 3 + 1
print("Hail is currently at height", posInt)
else:
posInt = posInt // 2
print ("Hail stopped at height 1")
main()
| false |
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 temperature, water is a solid.")
elif tempNum >= BOIL_C:
print("At this temperature, water is a gas.")
else:
print("At this temperature, water is a liquid.")
elif tempMes == "K" or tempMes == "k":
if tempNum <= FREEZE_K:
print("At this temperature, water is a solid.")
elif tempNum >= BOIL_K:
print("At this temperature, water is a gas.")
else:
print("At this temperature, water is a liquid.")
else:
print("Please enter a valid measurement.")
main()
| 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", startingHeight)
print("Hail stopped at height", startingHeight)
main()
| true |
d2cd6298046986955ae30fb1e8ddac575067a41a | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_448.py | 267 | 4.125 | 4 | def main():
hail=int(input("Please enter the starting height of the hailstone: "))
while hail != 1:
if hail % 2 == 0:
hail = (hail/2)
print("",hail)
else:
hail = (hail*3)+1
print("",hail)
main()
| false |
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("At this temperature, water is a (frozen) solid.")
elif a >= 100:
print("At this temperature, water is a gas.")
if userScale == "K":
if a > 273 and a < 373:
print("At this temperature, water is a liquid")
elif a <= 273:
print("At this temperature, water is a (frozen) solid.")
elif a>= 373:
print("At this temperature, water is a gas.")
main()
| 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 enter C for Celcius or K for Kelvin.")
if temp >= 100:
print ("Water is a gas at this temperature.")
elif temp < 0:
print ("Water is a solid at this temperature.")
else:
print ("Water is a liquid at this temperature.")
main ()
| 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 in range(height-2):
print(outline_symbol + box_fill_symbol*(width-2) + outline_symbol)
if height > 1:
print (outline_symbol* width)
main()
| 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 at height",hail)
if (hail)==1:
print("Hail stopped at height 1")
main()
| 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)
for i in range(0, height -2):
print(outline + fill*(width-2) + outline)
print(width * outline)
if width == 1 and height == 1:
print(outline)
main()
| 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:
print("At this temperature, water is a liquid")
else:
print("At this temperature, water is a gas.")
print()
main()
| 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
fillWidth = width - 2
for x in range (height):
if x == 0 or x == upperLimit:
print (boxOutline * width)
else:
print (boxOutline + (boxFill * fillWidth) + boxOutline)
main ()
| true |
99e572c3758032c1ecc165f1a759b2df26fda8cf | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_232.py | 360 | 4.15625 | 4 | def main():
hailNum = int(input("Please enter the starting height of the hailstone: "))
while hailNum != 1 :
print (" Hail is currently at height", int(hailNum) )
if hailNum % 2 == 0:
hailNum = hailNum / 2
elif hailNum % 2 != 0:
hailNum = (hailNum * 3) +1
print("Hail stopped at height 1")
main()
| false |
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 * symbolOut)
print(symbol1)
for i in range(1, height):
print(symbolOut + symbolIn * width2 + symbolOut)
print(symbol1)
main()
| 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) != 0:
startingHeight = int(((startingHeight * 3) + 1))
print("Hail is currently at height",startingHeight)
if (startingHeight % 2) == 0:
startingHeight = int((startingHeight / 2))
if (startingHeight == 1):
print ("Hail stopped at height",startingHeight)
else:
print("Hail is currently at height",startingHeight)
main()
| 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 temperature, water is a (frozen) solid.")
print(" ")
elif (temperature > C_FROZEN) and (temperature < C_BOIL):
print("At this temperature, water is a liquid.")
print(" ")
else:
print("At this temperature, water is a gas.")
print(" ")
else:
if temperature <= K_BOIL:
print("At this temperature, water is a (frozen) solid.")
print(" ")
elif (temperature > K_FROZEN) and (temperature < K_BOIL):
print("At this temperature, water is a liquid.")
print(" ")
else:
print("At this temperature, water is a gas.")
print(" ")
main()
| 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 height",starting_height)
else:
starting_height = int((starting_height * 3) +1)
if starting_height != 1:
print("Hail is currently at height",starting_height)
print("Hail is stopped at",starting_height)
main()
| 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:
print("At this temperature, water is a gas.")
else:
print("At this temperature, water is a liquid.")
if user_scale == 'C':
if user_temp < 0:
print("At this temperature, water is a (frozen) solid.")
elif user_temp > 100:
print("At this temperature, water is a gas.")
else:
print("At this temperature, water is a liquid.")
main()
| 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":
print("At this temperature, water is a gas.")
else:
print("At this temperature, water is a liquid.")
main()
| 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
print(width*outline)
while height > 0:
print(outline,(width-EDGE)*fill,outline)
height-=1
print(width*outline)
main()
| 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 = temp
if tempCel <= FREEZE :
print("At this temperature, water is a (frozen) solid.")
elif tempCel < BOIL :
print("At this temperature, water is a liquid.")
else :
print("At this temperature, water is a gas.")
main()
| 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
outer = symb1 * width
print(symb1 * width)
for a in range(0,height-1):
print(symb1+fill+symb1)
print(symb1 * width)
main()
| 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 height: " + str(userHeight))
elif userHeight % 2 == 0:
userHeight = int(userHeight / 2)
print("Hail height: " + str(userHeight))
if userHeight == 1:
print("Hail has reached the height of 1!")
main()
| 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: "))
print(outline * width)
if width > 2 and height != 1:
filling = outline + fill *(width - 2) + outline
for i in range(0, height - 2):
print(filling)
if width > 1 and height != 1:
if width == 2:
for i in range (0, height - 1):
print(outline * width)
else:
print(outline * width)
if width == 1 and height != 1:
for i in range(0, height - 1):
print(outline)
main()
| 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_TEMP_CELSIUS):
print("At this temperature, water is a (frozen) solid.")
elif (tempNum > SOLID_TEMP_CELSIUS and tempNum < GAS_TEMP_CELSIUS):
print("At this temperature, water is a liquid.")
else:
print("At this temperature, water is a gas.")
else:
if (tempNum <= SOLID_TEMP_KELVIN):
print("At this temperature, water is a (frozen) solid.")
elif (tempNum > SOLID_TEMP_KELVIN and tempNum < GAS_TEMP_KELVIN):
print("At this temperature, water is a liquid.")
else:
print("At this temperature, water is a gas.")
main()
| 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 is a liquid.")
elif temp >= 100 and scale == "C":
print("At this temperature, water is a gas.")
if temp <= 273.16 and scale == "K":
print("At this temperature, water is a solid")
elif temp > 273.16 and temp < 373.16 and scale == "K":
print("At this temperature, water is a liquid.")
elif temp >= 373.16 and scale == "K":
print("At this temperature, water is a gas.")
main()
| 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
height += 1
print("The hailstone stopped at height 1")
main()
| 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 and temp <100:
print("At this temperature, water is a liquid")
elif unit=="K":
if temp <273.16:
print("At this temperature, water is a solid")
elif temp >373.16:
print("At this temperature, water is a gas")
elif temp >273.16 and temp <373.16:
print("At this temperature, water is a liquid")
main()
| 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)
else:
hailStormNum = hailStormNum * 3 + 1
hailStormNum = int(hailStormNum)
print (hailStormNum)
print ("This is the final height of the hailstorm.")
main()
| 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 temperature, water is a gas.")
else:
print("At this temperature, waster is a liquid.")
else:
if userTemp <= 273.2:
print("At this temperature, water is a solid.")
elif userTemp >= 373.2:
print("At this temperature, water is a gas.")
else:
print("At this temperature, waster is a liquid.")
main()
| 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 ('At this temperature, water is a gas.')
elif (0<temperature<100) and (scale== 'C'):
print ('At this temperature, water is a liquid.')
elif (temperature <= 273) and (scale == 'K'):
print ('At this temperature, water is a (frozen) solid.')
elif (temperature >=373) and (scale == 'K'):
print ('At this temperature, water is a gas.')
elif (273<temperature<373) and (scale == 'K'):
print ('At this temperature, water is a liquid.')
main()
| 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:
print("At this temperature, water is a liquid.")
elif temp <=100:
print("At this temperature, water is a (frozen) solid.")
else:
print("At this temperature, water is a gas.")
else:
if temp > 273.16 and temp < 373.16:
print("At this temperature, water is a liquid.")
elif temp <= 273.16:
print("At this temperature, water is a (frozen) solid.")
else:
print("At this temperature, water is a gas.")
main()
| 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 range(1,height):
if box == 1:
print (symbol*width)
else:
print (symbol+(fillWidth*filling)+symbol)
print(symbol*width)
main()
| 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? "))
print(outsideSymbol * widthPrompt)
if heightPrompt > 2:
for index in list(range(heightPrompt - 2)):
print(outsideSymbol + insideSymbol * (widthPrompt - 2) + outsideSymbol)
if heightPrompt != 1:
print(outsideSymbol * widthPrompt)
main()
| 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")
elif temp >= LIQUID_C:
print("At this temperature, water is a liquid")
else:
print("At this temperature, water is a solid")
elif unit == 'K':
if temp >= GAS_K:
print("At this temperature, water is a gas")
elif temp >= LIQUID_K:
print("At this temperature, water is a liquid")
else:
print("At this temperature, water is a solid")
main()
| 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:
startingHeight= (startingHeight*3)+1
print("Hail stopped at height",startingHeight)
main()
| true |
3f7e318da7c059e17a7e31761311b49123d30291 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_425.py | 709 | 4.125 | 4 | def main ():
temp = (float (input ("What is the temperature: ")))
scale = (str (input ("Please enter 'C' for Celsius or 'K' for Kelvin: ")))
if (scale == 'C'):
if (temp >= 100):
print ("At this temperature, water is a gas.")
elif (temp <= 0):
print ("At this temperature, water is a frozen solid.")
else:
print ("At this temperature, water is a liquid.")
else:
if (temp >= 373.15):
print ("At this temperature, water is a gas.")
elif (temp <= 273.15):
print ("At this temperature, water is a frozen solid.")
else:
print ("At this temperature, water is a liquid.")
main ()
| true |
84504ced69b52147fdcc671ce10cd68d71e498f2 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_054.py | 481 | 4.125 | 4 | def main():
EVEN = 0
ODD = 1
height = int(input("Please enter starting height of the hailstorm: "))
print("Hail is currently at height" , height)
while height !=1:
if height % 2 == EVEN:
height = height // 2
print("Hail is currently at height" , height)
elif height % 2 == ODD:
height = height * 3 +1
print("Hail is currently at height" , height)
print("Hail stopped at height 1")
main()
| true |
c7c6cf60781c3541d6d56ba435aa78f8f969edbc | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_029.py | 775 | 4.125 | 4 | def main():
temp = float(input("Please enter the temperature: "))
letter = input("Please enter 'C' for Celsius or 'K' for Kelvin: ")
if temp <= 0 and letter == 'C':
print("At this temperature, water is a (frozen) solid.")
elif temp >= 1 and temp <= 99 and letter == 'C':
print("At this temperature, water is a liquid.")
elif temp >= 100 and letter == 'C':
print("At this temperature, water is a gas.")
elif temp >= 0 and temp <= 273 and letter == 'K':
print("At this temperature, water is a (frozen) solid.")
elif temp > 273 and temp <373 and letter == 'K':
print("At this temperature, water is a liquid.")
elif temp > 373 and letter == 'K':
print("At this temperature, water is a gas.")
main()
| true |
e80b0695f64f733763171768209cb8d15df416dc | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_134.py | 362 | 4.15625 | 4 | def partFour():
stoneHeight = int(input("What is the hailstone's height? \n"))
while stoneHeight != 1:
print("Current stone height: " + str(stoneHeight))
if(stoneHeight % 2 == 0) :
stoneHeight /= 2
else:
stoneHeight = stoneHeight * 3 +1
print("Stone stopped at height: " + str(stoneHeight))
partFour()
| false |
6ee976cc3bab4e98489059e23009ed4f722ecb8f | MAPLE-Robot-Subgoaling/IPT | /data/HW5/hw5_078.py | 427 | 4.1875 | 4 | width = int(input("Please enter width: "))
height = int(input("Please enter height: "))
symbol_outline = input("Please enter a symbol for the outline:")
symbol_fill = input("Please enter a symbol for the fill:")
def main():
forl_row = symbol_outline*width
mid_row = symbol_outline+(symbol_fill*(width-2))+symbol_outline
print(forl_row)
for x in range(height):
print(mid_row)
print(forl_row)
main()
| true |
1c5c9abdc59ed57e5213d37b8e9d541ee5b73de6 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_043.py | 766 | 4.125 | 4 | def main():
enterTemp = float(input("Please enter the temperature: "))
typeTemp = input("Please enter 'C' for Celsisus, or 'K' for Kelvin: ")
if typeTemp == "K" and enterTemp >= 373.16:
print("At this temperature, water is a gas.")
elif typeTemp == "K" and enterTemp <= 273.16:
print("At this temperature, water is a solid.")
elif typeTemp == "K" and (enterTemp < 373.16 and enterTemp > 273.16):
print("At this temperature, water is a liquid.")
elif typeTemp == "C" and enterTemp >= 100:
print("At this temperature, water is a gas.")
elif typeTemp == "C" and enterTemp <= 0:
print("At this temperature, water is a solid.")
else:
print("At this temperature, water is a liquid.")
main()
| true |
dbb76edf02c9c3082671fd89df2bcdd9220a2bb6 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_028.py | 790 | 4.125 | 4 | def main():
unit = input("What unit are you using, enter 'C' for celcius or 'K' for Kelvin")
temp = float(input("What is the temperature?"))
if (temp <= 0) and (unit == "C") :
print("At this temperature, water is a (frozen) solid")
elif (temp >= 100) and (unit == "C") :
print("At this temperature, water is a gas")
elif (temp >0 and temp <100) and (unit == "C"):
print("At this temperature, water is a liquid")
elif (temp <= 273.15) and (unit =="K"):
print ("At this temperature, water is a (frozen) solid.")
elif (temp >= 373.15) and (unit == "K"):
print ("At this temperature, water is a gas")
elif (temp >273.15 and temp <373.15) and (unit == "K"):
print("At this temperature, water is a liquid")
main()
| true |
5991c2fbf4a1a987cde366a7a784d1db12fdffc5 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_431.py | 550 | 4.21875 | 4 | def main():
currentHeight = int(input("Please enter the starting height of the hailstone: "))
print("Hail is currently at height",(currentHeight))
while currentHeight != 1:
if (currentHeight % 2) == 0:
print("Hail is currently at height", currentHeight / 2)
currentHeight = (currentHeight / 2)
elif (currentHeight % 2) == 1:
print("Hail is currently at height", (currentHeight * 3) + 1)
currentHeight = ((currentHeight * 3) + 1)
print("Hail stopped at height 1")
main()
| true |
f6c13e0b0478f843c4ab72ff4689aaad93b24764 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_030.py | 393 | 4.28125 | 4 | STOP_HEIGHT = 1
def main ():
hailHeight = int ( input ("Please enter the starting height of the hailstone: "))
while hailHeight != STOP_HEIGHT:
if hailHeight % 2 == 0:
print ("Hail is currently at", hailHeight)
hailHeight = hailHeight // 2
else:
print ("Hail is currently at", hailHeight)
hailHeight = hailHeight * 3 + 1
print ("Hail stopped at height 1.")
main () | true |
09632cb074fb96b7fd7085474afdddcb5b4c5865 | MAPLE-Robot-Subgoaling/IPT | /data/HW4/hw4_330.py | 249 | 4.125 | 4 | def main():
num = int(input("Enter a positive integer: "))
while (num > 1):
print("Hail is currently at height " + str(num) )
if( num % 2 == 0):
num = num // 2
else:
num = (num * 3) + 1
main()
| false |
f20872e50a04cfe8ecf00603cd58697ca47bda6a | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_037.py | 782 | 4.125 | 4 | def main():
temp = float(input("Please enter your temperature: "))
scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
if scale == "C" and temp >= 100:
print("At this temperature, the water is a gas.")
elif scale == "C" and (temp <100 and temp >0):
print("At this temperature, the water is a liquid.")
elif scale == "C" and temp <0:
print("At this temperature, the water is a solid.")
if scale == "K" and temp >= 373.16:
print("At this temperature, the water is a gas.")
elif scale == "K" and (temp < 373.16 and temp > 273.16):
print("At this temperature, the water is a liquid.")
elif scale == "K" and temp < 273.16:
print("At this temperature, the water is a solid.")
main()
| true |
bab242cced1e1ad5251f1876544fa92f2c8f4c73 | MAPLE-Robot-Subgoaling/IPT | /data/HW3/hw3_359.py | 1,070 | 4.3125 | 4 | temp = float(input("Please enter the temperature: "))
scale = input("Please enter 'C' for Celsius, or 'K' for Kelvin: ")
MELTING_POINT_C = 32
BOILING_POINT_C = 100
MELTING_POINT_K = 273.15
BOILING_POINT_K = 373.15
def main():
if scale == "C":
if temp >= 0 and temp < MELTING_POINT_C:
print("At this temperature, water is a (frozen) solid.")
elif temp >= MELTING_POINT_C and temp < BOILING_POINT_C:
print("At this temperature, water is a liquid.")
elif temp >= BOILING_POINT_C:
print("At this temperature, water is a gas.")
else:
if temp >= 0 and temp < MELTING_POINT_K:
print("At this temperature, water is a (frozen) solid.")
elif temp >= MELTING_POINT_K and temp < BOILING_POINT_K:
print("At this temperature, water is a liquid.")
elif temp >= BOILING_POINT_K:
print("At this temperature, water is a gas.")
main()
| true |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.