Created
February 18, 2025 07:45
-
-
Save allanj/04b57e1e2c56b24429ca8cae6dc5f5c4 to your computer and use it in GitHub Desktop.
ReFT_GSM8K_convert_prompt
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
MATH_PROMPT = '''Question: Riku has 25 times more stickers than Kristoff. If Kristoff has 85 stickers, how many stickers does Riku have? | |
Answer: | |
If Kristoff has 85 stickers, Riku has 25 * 85 stickers = <<85*25=2125>>2125 more stickers. | |
The total number of stickers Riku has is 2125 stickers + 85 stickers = <<2125+85=2210>>2210 stickers. | |
# solution in Python: | |
def solution(): | |
"""Riku has 25 times more stickers than Kristoff. If Kristoff has 85 stickers, how many stickers does Riku have?""" | |
ratio = 25 | |
kristoff_stickers = 85 | |
riku_more_than_kristoff = kristoff_stickers * ratio | |
riku_stickers = riku_more_than_kristoff + kristoff_stickers | |
result = riku_stickers | |
return result | |
Question: Eustace is twice as old as Milford. In 3 years, he will be 39. How old will Milford be? | |
Answer: | |
Eustace’s current age must be 39 years old – 3 years = <<39-3=36>>36 years old. | |
So Milford’s current age must be 36 years old / 2 = <<36/2=18>>18 years old. | |
So in 3 years, Milford will be 18 years old + 3 years = <<18+3=21>>21 years old. | |
# solution in Python: | |
def solution(): | |
"""Eustace is twice as old as Milford. In 3 years, he will be 39. How old will Milford be?""" | |
eustace_age_later = 39 | |
time_later = 3 | |
eustace_age_now = eustace_age_later - time_later | |
milford_age_now = eustace_age_now / 2 | |
milford_age_later = milford_age_now + time_later | |
result = milford_age_later | |
return result | |
Question: Tim buys 3 dozen eggs. Eggs cost $.50 each. How much did he pay for eggs? | |
Answer: | |
He bought 3*12=<<3*12=36>>36 eggs | |
So they cost 36*.5=$<<36*.5=18>>18 | |
# solution in Python: | |
def solution(): | |
"""Tim buys 3 dozen eggs. Eggs cost $.50 each. How much did he pay for eggs?""" | |
eggs_per_dozen = 12 | |
eggs_bought = 3 * eggs_per_dozen | |
egg_cost = 0.5 | |
total_cost = eggs_bought * egg_cost | |
result = total_cost | |
return result | |
Question: In the engineering department, 70% of the students are men and 180 are women. How many men are there? | |
Answer: | |
The percentage for women is 100% - 70% = 30%. | |
Since 180 represents 30%, then 180/30 = 6 students represent 1%. | |
Hence, 6 x 70 = <<6*70=420>>420 students are men. | |
# solution in Python: | |
def solution(): | |
"""In the engineering department, 70% of the students are men and 180 are women. How many men are there?""" | |
women = 180 | |
percent_men = 70 | |
percent_women = 100 - percent_men | |
men = women * percent_men / percent_women | |
result = men | |
return result | |
Question: Yuan is 7 years older than his brother David and twice his age. How old is David? | |
Answer: | |
Let x be David's age. Yuan is seven years older than David, 7 + x = Y years. | |
Yuan is also twice David's age, 2 * x = Y years. | |
Since these two equations equal the same thing, we can write: 7 + x = 2 * x. | |
Subtracting x from both sides we get 7 = x, so David is 7 years old. | |
# solution in Python: | |
def solution(): | |
"""Yuan is 7 years older than his brother David and twice his age. How old is David?""" | |
import sympy | |
yuan_age = sympy.Symbol('yuan_age') | |
david_age = sympy.Symbol('david_age') | |
eq1 = sympy.Eq(yuan_age, david_age + 7) | |
eq2 = sympy.Eq(yuan_age, 2 * david_age) | |
sol = sympy.solve([eq1, eq2], [yuan_age, david_age]) | |
result = sol[david_age] | |
return result | |
Question: Adlai has 2 dogs and 1 chicken. How many animal legs are there in all? | |
Answer: | |
Since dogs have 4 legs, then 2 dogs have a total of 2 x 4 = <<2*4=8>>8 legs. | |
So, there are 8 dog legs + 2 chicken legs = <<8+2=10>>10 legs in all. | |
# solution in Python: | |
def solution(): | |
"""Adlai has 2 dogs and 1 chicken. How many animal legs are there in all?""" | |
dogs = 2 | |
chicken = 1 | |
dog_legs = 4 | |
chicken_legs = 2 | |
total_legs = dogs * dog_legs + chicken * chicken_legs | |
result = total_legs | |
return result | |
''' | |
MATH_CONVERT_PYTHON_CDP_PROMPT = '''Question: Riku has 25 times more stickers than Kristoff. If Kristoff has 85 stickers, how many stickers does Riku have? | |
Answer: | |
If Kristoff has 85 stickers, Riku has 25 * 85 stickers = <<85*25=2125>>2125 more stickers. | |
The total number of stickers Riku has is 2125 stickers + 85 stickers = <<2125+85=2210>>2210 stickers. | |
# solution in Python: | |
def solution(): | |
"""Riku has 25 times more stickers than Kristoff. If Kristoff has 85 stickers, how many stickers does Riku have?""" | |
v1 = 85 # If Kristoff has 85 stickers | |
v2 = 25 # Riku has 25 times more stickers than Kristoff | |
v3 = v2 * v1 # Step 1: Find the number of stickers Riku has more than Kristoff | |
v4 = v1 + v3 # Step 2: Find the total number of stickers Riku has | |
result = v4 | |
return result | |
Question: Eustace is twice as old as Milford. In 3 years, he will be 39. How old will Milford be? | |
Answer: | |
Eustace’s current age must be 39 years old – 3 years = <<39-3=36>>36 years old. | |
So Milford’s current age must be 36 years old / 2 = <<36/2=18>>18 years old. | |
So in 3 years, Milford will be 18 years old + 3 years = <<18+3=21>>21 years old. | |
# solution in Python: | |
def solution(): | |
"""Eustace is twice as old as Milford. In 3 years, he will be 39. How old will Milford be?""" | |
v1 = 2 # Eustace is twice as old as Milford | |
v2 = 3 ; v3 = 39 # In 3 years, Eustace will be 39 | |
v4 = v3 - v2 # Step 1: Find Eustace's age now | |
v5 = v4 / v1 # Step 2: Find Milford's age now | |
v6 = v5 + v2 # Step 3: Find Milford's age in 3 years | |
result = v6 | |
return result | |
Question: Tim buys 3 dozen eggs. Eggs cost $.50 each. How much did he pay for eggs? | |
Answer: | |
He bought 3*12=<<3*12=36>>36 eggs | |
So they cost 36*.5=$<<36*.5=18>>18 | |
# solution in Python: | |
def solution(): | |
"""Tim buys 3 dozen eggs. Eggs cost $.50 each. How much did he pay for eggs?""" | |
v1 = 3 # Tim buys 3 dozen eggs | |
v2 = 0.5 # Eggs cost $.50 each | |
v3 = v1 * 12 # Step 1: Find the number of eggs bought | |
v4 = v3 * v2 # Step 2: Find the total cost of the eggs | |
result = v4 | |
return result | |
Question: In the engineering department, 70% of the students are men and 180 are women. How many men are there? | |
Answer: | |
The percentage for women is 100% - 70% = 30%. | |
Since 180 represents 30%, then 180/30 = 6 students represent 1%. | |
Hence, 6 x 70 = <<6*70=420>>420 students are men. | |
# solution in Python: | |
def solution(): | |
"""In the engineering department, 70% of the students are men and 180 are women. How many men are there?""" | |
v1 = 70 # 70% of the students are men | |
v2 = 180 # 180 are women | |
v3 = 100 - v1 # Step 1: Find the percentage of men | |
v4 = v2 / (v3/100) # Step 2: Find the number of students represented by 1% | |
v5 = v4 * (v1/100) # Step 3: Find the number of men | |
result = v5 | |
return result | |
Question: Yuan is 7 years older than his brother David and twice his age. How old is David? | |
Answer: | |
Let x be David's age. Yuan is seven years older than David, 7 + x = Y years. | |
Yuan is also twice David's age, 2 * x = Y years. | |
Since these two equations equal the same thing, we can write: 7 + x = 2 * x. | |
Subtracting x from both sides we get 7 = x, so David is 7 years old. | |
# solution in Python: | |
def solution(): | |
"""Yuan is 7 years older than his brother David and twice his age. How old is David?""" | |
import sympy | |
v1 = 7 # Yuan is 7 years older than his brother David | |
v2 = 2 # and twice his age | |
v3 = sympy.Symbol('v3') # Step 1: Let v3 be David's age | |
v4 = sympy.Symbol('v4') # Step 2: let v4 be Yuan's age | |
v5 = sympy.Eq(v4, v3 + v1) # Step 3: Write an equation based on Yuan is [v1] years older than David | |
v6 = sympy.Eq(v4, v2 * v3) # Step 4: Write an equation based on Yuan is [v2] times David's age | |
v7 = sympy.solve([v5, v6], [v3, v4]) # Step 5: Solve the equations | |
result = v7[v3] # So the answer is | |
return result | |
Question: Adlai has 2 dogs and 1 chicken. How many animal legs are there in all? | |
Answer: | |
Since dogs have 4 legs, then 2 dogs have a total of 2 x 4 = <<2*4=8>>8 legs. | |
So, there are 8 dog legs + 2 chicken legs = <<8+2=10>>10 legs in all. | |
# solution in Python: | |
def solution(): | |
"""Adlai has 2 dogs and 1 chicken. How many animal legs are there in all?""" | |
v1 = 2 # Adlai has 2 dogs | |
v2 = 1 # Adlai has 1 chicken | |
v3 = 4 # Dogs have 4 legs | |
v4 = 2 # Chicken have 2 legs | |
v5 = v1 * v3 # Step 1: Find the total number of dog legs | |
v6 = v2 * v4 # Step 2: Find the total number of chicken legs | |
v7 = v5 + v6 # Step 3: Find the total number of animal legs | |
result = v7 | |
return result | |
''' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment