id stringlengths 16 16 | language stringclasses 3
values | category stringclasses 38
values | question stringlengths 2 1.96k | answer stringlengths 1 1.46k | messages listlengths 2 2 | teacher stringclasses 5
values | batch stringclasses 20
values | source stringclasses 677
values | used_in_chat stringclasses 3
values | tokens int64 8 849 |
|---|---|---|---|---|---|---|---|---|---|---|
77e58d367d1522cf | en | code_ortho | spellcheck: can someone exlpain why the battery draains so fast overnight? | Can someone explain why the battery drains so fast overnight? | [
{
"role": "user",
"content": "spellcheck: can someone exlpain why the battery draains so fast overnight?"
},
{
"role": "assistant",
"content": "Can someone explain why the battery drains so fast overnight?"
}
] | code | qa-v1 | train | 30 | |
982f95a21b8625ca | en | code_ortho | spellcheck: I am sorry for the confusion aovut the address, and I have sent the right one now | I am sorry for the confusion about the address, and I have sent the right one now. | [
{
"role": "user",
"content": "spellcheck: I am sorry for the confusion aovut the address, and I have sent the right one now"
},
{
"role": "assistant",
"content": "I am sorry for the confusion about the address, and I have sent the right one now."
}
] | code | qa-v1 | train | 44 | |
b4bba4a61e5a40d0 | en | code_ortho | fix my spelling: I krrep humming tht tune from the trailer. | I keep humming that tune from the trailer. | [
{
"role": "user",
"content": "fix my spelling: I krrep humming tht tune from the trailer."
},
{
"role": "assistant",
"content": "I keep humming that tune from the trailer."
}
] | code | qa-v1 | validation | 25 | |
dbbac65bfa19c9e6 | en | code_ortho | we had snow last night, and the roads are sippery today.
fix the spelling pls | We had snow last night, and the roads are slippery today. | [
{
"role": "user",
"content": "we had snow last night, and the roads are sippery today.\n\nfix the spelling pls"
},
{
"role": "assistant",
"content": "We had snow last night, and the roads are slippery today."
}
] | code | qa-v1 | train | 34 | |
03e1c4725acb32b3 | en | code_ortho | The train from Paris to Lyon takes about two hours.
fix the spelling pls | That sentence is already correct, there is nothing to fix. | [
{
"role": "user",
"content": "The train from Paris to Lyon takes about two hours.\n\nfix the spelling pls"
},
{
"role": "assistant",
"content": "That sentence is already correct, there is nothing to fix."
}
] | code | qa-v1 | train | 30 | |
7ebf7221cfb2d209 | en | code_ortho | correct this: I am sorry I missed yuour call this morning, and I will cll you back after lunch. | I am sorry I missed your call this morning, and I will call you back after lunch. | [
{
"role": "user",
"content": "correct this: I am sorry I missed yuour call this morning, and I will cll you back after lunch."
},
{
"role": "assistant",
"content": "I am sorry I missed your call this morning, and I will call you back after lunch."
}
] | code | qa-v1 | train | 44 | |
b3d446a573ed1a34 | en | code_ortho | can you fix the typos? My grandmother takes her medicine with breakfast every morning wiyhout fail | My grandmother takes her medicine with breakfast every morning without fail. | [
{
"role": "user",
"content": "can you fix the typos? My grandmother takes her medicine with breakfast every morning wiyhout fail"
},
{
"role": "assistant",
"content": "My grandmother takes her medicine with breakfast every morning without fail."
}
] | code | qa-v1 | train | 34 | |
b2c2b0a8513f2c37 | en | code_ortho | spellcheck: thank you for considering my application for the office manager posittion at your firm | Thank you for considering my application for the office manager position at your firm. | [
{
"role": "user",
"content": "spellcheck: thank you for considering my application for the office manager posittion at your firm"
},
{
"role": "assistant",
"content": "Thank you for considering my application for the office manager position at your firm."
}
] | code | qa-v1 | train | 35 | |
b987bcfa5b5ab9ef | en | code_ortho | can you fix the typos? i have strong skiills in Excel, teamwork and clear communication. | I have strong skills in Excel, teamwork and clear communication. | [
{
"role": "user",
"content": "can you fix the typos? i have strong skiills in Excel, teamwork and clear communication."
},
{
"role": "assistant",
"content": "I have strong skills in Excel, teamwork and clear communication."
}
] | code | qa-v1 | train | 32 | |
877ad59b672f1e30 | en | code_ortho | correct this: this phone case is on sale, so I will buy two of them. | This phone case is on sale, so I will buy two of them. | [
{
"role": "user",
"content": "correct this: this phone case is on sale, so I will buy two of them."
},
{
"role": "assistant",
"content": "This phone case is on sale, so I will buy two of them."
}
] | code | qa-v1 | train | 33 | |
ff05bed17f807ee3 | en | code_ortho | spellcheck: Hey Maya, are we stiill meeting at the cafe around noon? | Hey Maya, are we still meeting at the cafe around noon? | [
{
"role": "user",
"content": "spellcheck: Hey Maya, are we stiill meeting at the cafe around noon?"
},
{
"role": "assistant",
"content": "Hey Maya, are we still meeting at the cafe around noon?"
}
] | code | qa-v1 | train | 34 | |
8274ad61a87be15b | en | code_ortho | correct this: my sisteer and I visited the museum on Sunday afternoon. | My sister and I visited the museum on Sunday afternoon. | [
{
"role": "user",
"content": "correct this: my sisteer and I visited the museum on Sunday afternoon."
},
{
"role": "assistant",
"content": "My sister and I visited the museum on Sunday afternoon."
}
] | code | qa-v1 | train | 27 | |
cce411e8fa1d0223 | en | code_ortho | spellcheck: I need to buy milk, bread, eggs and fresh fruit today. | That sentence is already correct, there is nothing to fix. | [
{
"role": "user",
"content": "spellcheck: I need to buy milk, bread, eggs and fresh fruit today."
},
{
"role": "assistant",
"content": "That sentence is already correct, there is nothing to fix."
}
] | code | qa-v1 | train | 30 | |
626546e6b79819fe | en | code_ortho | can you fix the typos? tom repaiired his old bicycle insetad of buying a new one | Tom repaired his old bicycle instead of buying a new one. | [
{
"role": "user",
"content": "can you fix the typos? tom repaiired his old bicycle insetad of buying a new one"
},
{
"role": "assistant",
"content": "Tom repaired his old bicycle instead of buying a new one."
}
] | code | qa-v1 | train | 36 | |
5244de2f5f613beb | en | code_ortho | spellcheck: my suitcase wihgs 23 kilograms and feels heavy. | My suitcase weighs 23 kilograms and feels heavy. | [
{
"role": "user",
"content": "spellcheck: my suitcase wihgs 23 kilograms and feels heavy."
},
{
"role": "assistant",
"content": "My suitcase weighs 23 kilograms and feels heavy."
}
] | code | qa-v1 | train | 32 | |
9c78268632ffd869 | en | code_ortho | please don't spoil the ending, becuuase I am only halfway through the story.
fix the spelling pls | Please don't spoil the ending, because I am only halfway through the story. | [
{
"role": "user",
"content": "please don't spoil the ending, becuuase I am only halfway through the story.\n\nfix the spelling pls"
},
{
"role": "assistant",
"content": "Please don't spoil the ending, because I am only halfway through the story."
}
] | code | qa-v1 | train | 40 | |
4551fbb1d15c24ec | en | code_ortho | fix my spelling: The scteen is bright and the colors look very natural. | The screen is bright and the colors look very natural. | [
{
"role": "user",
"content": "fix my spelling: The scteen is bright and the colors look very natural."
},
{
"role": "assistant",
"content": "The screen is bright and the colors look very natural."
}
] | code | qa-v1 | train | 28 | |
0a48bc112abcaa69 | en | code_ortho | correct this: We landed in Romme at six in the morning local time. | We landed in Rome at six in the morning local time. | [
{
"role": "user",
"content": "correct this: We landed in Romme at six in the morning local time."
},
{
"role": "assistant",
"content": "We landed in Rome at six in the morning local time."
}
] | code | qa-v1 | train | 28 | |
fb62d49ec6ba7fe2 | en | code_ortho | fix my spelling: the concert tickets cost forty dollars each, wicch seemed fair. | The concert tickets cost forty dollars each, which seemed fair. | [
{
"role": "user",
"content": "fix my spelling: the concert tickets cost forty dollars each, wicch seemed fair."
},
{
"role": "assistant",
"content": "The concert tickets cost forty dollars each, which seemed fair."
}
] | code | qa-v1 | train | 30 | |
d03a35af9b9f1c49 | en | code_ortho | fix my spelling: The shoes are comfortable, but the sooles wore out quickly. | The shoes are comfortable, but the soles wore out quickly. | [
{
"role": "user",
"content": "fix my spelling: The shoes are comfortable, but the sooles wore out quickly."
},
{
"role": "assistant",
"content": "The shoes are comfortable, but the soles wore out quickly."
}
] | code | qa-v1 | train | 30 | |
678f4facd99e2448 | en | code_ortho | can you fix the typos? Hey, did you finish reading that book I recommended? | That sentence is already correct, there is nothing to fix. | [
{
"role": "user",
"content": "can you fix the typos? Hey, did you finish reading that book I recommended?"
},
{
"role": "assistant",
"content": "That sentence is already correct, there is nothing to fix."
}
] | code | qa-v1 | train | 30 | |
2473aae834ead6fd | en | code_ortho | can you fix the typos? Which player scored the winning point in the basketball final yesterday? | That sentence is already correct, there is nothing to fix. | [
{
"role": "user",
"content": "can you fix the typos? Which player scored the winning point in the basketball final yesterday?"
},
{
"role": "assistant",
"content": "That sentence is already correct, there is nothing to fix."
}
] | code | qa-v1 | train | 31 | |
af4561cbc3549ed2 | en | code_ortho | can you fix the typos? Pleae tll Aunt Clara that I love her new coat. | Please tell Aunt Clara that I love her new coat. | [
{
"role": "user",
"content": "can you fix the typos? Pleae tll Aunt Clara that I love her new coat."
},
{
"role": "assistant",
"content": "Please tell Aunt Clara that I love her new coat."
}
] | code | qa-v1 | train | 33 | |
30cdcbcfb6c31511 | en | code_ortho | fix my spelling: I filly fixed the bug by clearing the cache | I finally fixed the bug by clearing the cache. | [
{
"role": "user",
"content": "fix my spelling: I filly fixed the bug by clearing the cache"
},
{
"role": "assistant",
"content": "I finally fixed the bug by clearing the cache."
}
] | code | qa-v1 | train | 25 | |
57ec3bc5d02dd323 | en | code_python | python countdown from 5 to 1 pls | This counts down from 5 to 1 and prints a final message.
```python
for n in range(5, 0, -1):
print(n)
print("Go!")
```
Save it as countdown.py and run it with "python3 countdown.py". It prints 5, 4, 3, 2, 1 and then "Go!", one per line. | [
{
"role": "user",
"content": "python countdown from 5 to 1 pls"
},
{
"role": "assistant",
"content": "This counts down from 5 to 1 and prints a final message.\n```python\nfor n in range(5, 0, -1):\n print(n)\n\nprint(\"Go!\")\n```\nSave it as countdown.py and run it with \"python3 countdown.p... | hy4-preview | qa-v1 | train | 99 | |
afa17834921da075 | en | code_python | how do i sum the digits of a number in python? like 123 -> 6 | This program adds up the digits of any whole number you type.
```python
# add up the digits of a whole number
number = abs(int(input("Enter a number: ")))
total = 0
for d in str(number):
total = total + int(d)
print("Sum of digits:", total)
```
Run it with "python3 digits.py". Typing 12345 prints "Sum of digits: 15... | [
{
"role": "user",
"content": "how do i sum the digits of a number in python? like 123 -> 6"
},
{
"role": "assistant",
"content": "This program adds up the digits of any whole number you type.\n```python\n# add up the digits of a whole number\nnumber = abs(int(input(\"Enter a number: \")))\ntotal... | glm-5.3-flash | qa-v1 | train | 130 | |
0e0f09c17d0f0afe | en | code_python | helo can u write me a palindrome checker in python | This program checks if a word reads the same forwards and backwards.
```python
# check if a word is a palindrome
word = input("word: ").lower()
if word == word[::-1]:
print(word, "is a palindrome")
else:
print(word, "is not a palindrome")
```
Run it with "python3 palindrome.py" and type a word. For "Racecar" it... | [
{
"role": "user",
"content": "helo can u write me a palindrome checker in python"
},
{
"role": "assistant",
"content": "This program checks if a word reads the same forwards and backwards.\n```python\n# check if a word is a palindrome\nword = input(\"word: \").lower()\nif word == word[::-1]:\n ... | glm-5.3-flash | qa-v1 | train | 109 | |
365b9a0e4c0bff1e | en | code_python | how do i count letters with a dictionary in python | This program counts how often each letter appears in a word, using a dictionary.
```python
# count how often each letter appears
word = "banana"
counts = {}
for letter in word:
counts[letter] = counts.get(letter, 0) + 1
print(counts)
```
Save it as letters.py and run it with "python3 letters.py". It prints {'b': 1,... | [
{
"role": "user",
"content": "how do i count letters with a dictionary in python"
},
{
"role": "assistant",
"content": "This program counts how often each letter appears in a word, using a dictionary.\n```python\n# count how often each letter appears\nword = \"banana\"\ncounts = {}\nfor letter i... | glm-5.3-flash | qa-v1 | train | 122 | |
e22f8321c46d5fa1 | en | code_python | print a multiplication table in python | This program asks for a number and prints its times table from 1 to 10.
```python
# print the times table for one number
n = int(input("which times table? "))
for i in range(1, 11):
print(n, "x", i, "=", n * i)
```
Run it with python3 table.py. Tested with 7: it prints lines from 7 x 1 = 7 up to 7 x 10 = 70. | [
{
"role": "user",
"content": "print a multiplication table in python"
},
{
"role": "assistant",
"content": "This program asks for a number and prints its times table from 1 to 10.\n```python\n# print the times table for one number\nn = int(input(\"which times table? \"))\nfor i in range(1, 11):\... | glm-5.3-flash | qa-v1 | train | 121 | |
c645c7a8be09fdda | en | code_python | bmi calculator in python please weight in kg height in meters | This program takes your weight in kilograms and your height in meters, then prints your BMI.
```python
weight = float(input("Weight in kg: "))
height = float(input("Height in m: "))
# BMI is weight divided by height squared
bmi = weight / (height * height)
print("Your BMI is", round(bmi, 1))
```
Run it with "python3... | [
{
"role": "user",
"content": "bmi calculator in python please weight in kg height in meters"
},
{
"role": "assistant",
"content": "This program takes your weight in kilograms and your height in meters, then prints your BMI.\n\n```python\nweight = float(input(\"Weight in kg: \"))\nheight = float(... | hy4-preview | qa-v1 | train | 131 | |
f12740cbde38be4c | en | code_python | write a simple Dog class in python with a bark method | This program defines a Dog class with a bark method and makes one dog bark.
```python
# a very small dog class
class Dog:
def __init__(self, name):
self.name = name
def bark(self):
print(self.name + " says Woof!")
my_dog = Dog("Rex")
my_dog.bark()
```
Run it with python3 dog.py and Rex barks o... | [
{
"role": "user",
"content": "write a simple Dog class in python with a bark method"
},
{
"role": "assistant",
"content": "This program defines a Dog class with a bark method and makes one dog bark.\n```python\n# a very small dog class\nclass Dog:\n def __init__(self, name):\n self.nam... | glm-5.3-flash | qa-v1 | train | 108 | |
5da925e774928dcd | en | code_python | could you do a little phone book in python? just a dictionary, add some people and look one up | A dictionary does the whole job here: the demo adds one person, looks one up and prints the whole book.
```python
# a little phone book using a dictionary
phone_book = {"alice": "555-0134", "ben": "555-0192", "clara": "555-0117"}
# add a new person
phone_book["david"] = "555-0163"
# look someone up
name = "ben"
if na... | [
{
"role": "user",
"content": "could you do a little phone book in python? just a dictionary, add some people and look one up"
},
{
"role": "assistant",
"content": "A dictionary does the whole job here: the demo adds one person, looks one up and prints the whole book.\n```python\n# a little phone... | glm-5.3-flash | qa-v1 | train | 254 | |
08570d4db2f0be19 | en | code_python | make me a simple to-do list in python pls | This little to-do list keeps its tasks in memory while the program runs, with add, done, show and quit commands.
```python
# tiny to-do list, lives in memory while the program runs
todo = []
while True:
cmd = input("add / done / show / quit: ").strip().lower()
if cmd == "add":
todo.append(input("New tas... | [
{
"role": "user",
"content": "make me a simple to-do list in python pls"
},
{
"role": "assistant",
"content": "This little to-do list keeps its tasks in memory while the program runs, with add, done, show and quit commands.\n```python\n# tiny to-do list, lives in memory while the program runs\nt... | glm-5.3-flash | qa-v1 | train | 249 | |
9e4b625b56beee76 | en | code_python | i need a little bmi calculator in python, it should ask for weight and height | This BMI calculator asks for your weight in kilograms and your height in meters, then prints the result rounded to one decimal.
```python
weight = float(input('Weight in kg: '))
height = float(input('Height in m: '))
bmi = weight / height ** 2
print('Your BMI is', round(bmi, 1))
```
Run it and type the two numbers, on... | [
{
"role": "user",
"content": "i need a little bmi calculator in python, it should ask for weight and height"
},
{
"role": "assistant",
"content": "This BMI calculator asks for your weight in kilograms and your height in meters, then prints the result rounded to one decimal.\n```python\nweight = ... | hy4-preview | qa-v1 | train | 130 | |
44cdd27703578dca | en | code_python | hey can u write a temperature table from 0 to 100 celsius in python | This program prints a Celsius to Fahrenheit table from 0 to 100 in steps of 10.
```python
# table from 0 to 100 Celsius, steps of 10
for c in range(0, 101, 10):
f = c * 9 / 5 + 32
print(f"{c:3d} C = {f:6.1f} F")
```
Run it with "python3 table.py". The first line is " 0 C = 32.0 F" and the last is "100 C = 2... | [
{
"role": "user",
"content": "hey can u write a temperature table from 0 to 100 celsius in python"
},
{
"role": "assistant",
"content": "This program prints a Celsius to Fahrenheit table from 0 to 100 in steps of 10.\n```python\n# table from 0 to 100 Celsius, steps of 10\nfor c in range(0, 101, ... | glm-5.3-flash | qa-v1 | train | 175 | |
df30c4e5c3c34474 | en | code_python | i need a celsius to fahrenheit converter, thanks | This program turns a temperature in Celsius into Fahrenheit.
```python
# convert Celsius to Fahrenheit
celsius = float(input())
fahrenheit = celsius * 9 / 5 + 32
print(celsius, "C =", fahrenheit, "F")
```
Run it with "python3 convert.py" and type a number like 25.5. It prints "25.5 C = 77.9 F". | [
{
"role": "user",
"content": "i need a celsius to fahrenheit converter, thanks"
},
{
"role": "assistant",
"content": "This program turns a temperature in Celsius into Fahrenheit.\n```python\n# convert Celsius to Fahrenheit\ncelsius = float(input())\nfahrenheit = celsius * 9 / 5 + 32\nprint(celsi... | glm-5.3-flash | qa-v1 | train | 116 | |
37f8cee4464d361d | en | code_python | make me a bmi calculator in python | This program asks for your weight in kilograms and your height in meters, then prints your BMI.
```python
# body mass index from weight in kg and height in meters
weight = float(input())
height = float(input())
bmi = weight / (height * height)
print("your bmi is", round(bmi, 1))
```
Save it as bmi.py and run it with "p... | [
{
"role": "user",
"content": "make me a bmi calculator in python"
},
{
"role": "assistant",
"content": "This program asks for your weight in kilograms and your height in meters, then prints your BMI.\n```python\n# body mass index from weight in kg and height in meters\nweight = float(input())\nh... | glm-5.3-flash | qa-v1 | train | 130 | |
d220783173245569 | en | code_python | write a bmi calculator in python, i give weight and height and it says my bmi | This program asks for your weight and height and prints your BMI.
```python
# BMI calculator
weight = float(input("Weight in kg: "))
height = float(input("Height in meters: "))
bmi = weight / (height ** 2)
print(f"Your BMI is {bmi:.1f}")
```
Save it as bmi.py and run it with python3 bmi.py. With 70 kg and 1.75 m it pri... | [
{
"role": "user",
"content": "write a bmi calculator in python, i give weight and height and it says my bmi"
},
{
"role": "assistant",
"content": "This program asks for your weight and height and prints your BMI.\n```python\n# BMI calculator\nweight = float(input(\"Weight in kg: \"))\nheight = f... | glm-5.3-flash | qa-v1 | train | 132 | |
e17e19ccc20ec60b | en | code_python | write something that checks if two words are anagrams, pyhton pls | This program asks for two words and tells you if they are anagrams.
```python
# check if two words are anagrams
word1 = input("First word: ")
word2 = input("Second word: ")
if sorted(word1.lower()) == sorted(word2.lower()):
print("Anagrams")
else:
print("Not anagrams")
```
I tested it with "listen" and "silent... | [
{
"role": "user",
"content": "write something that checks if two words are anagrams, pyhton pls"
},
{
"role": "assistant",
"content": "This program asks for two words and tells you if they are anagrams.\n```python\n# check if two words are anagrams\nword1 = input(\"First word: \")\nword2 = input... | glm-5.3-flash | qa-v1 | train | 117 | |
a6bea661c4f6c919 | en | code_python | make me a simple calculator in python that reads two numbers and an operator | This calculator asks for two numbers and an operator, then prints the result.
```python
# simple calculator
a = float(input("First number: "))
op = input("Operator (+ - * /): ")
b = float(input("Second number: "))
if op == "+":
print(a + b)
elif op == "-":
print(a - b)
elif op == "*":
print(a * b)
elif op =... | [
{
"role": "user",
"content": "make me a simple calculator in python that reads two numbers and an operator"
},
{
"role": "assistant",
"content": "This calculator asks for two numbers and an operator, then prints the result.\n```python\n# simple calculator\na = float(input(\"First number: \"))\no... | glm-5.3-flash | qa-v1 | train | 192 | |
70119e56cb093826 | en | code_python | need a python script to add up the digits of a number, like 47382 should give 24 | This script reads a number and adds up its digits.
```python
# add up all digits of a number
number = input().strip()
total = 0
for digit in number:
total += int(digit)
print("Digit sum:", total)
```
Run it with "python3 digits.py" and type your number. With 47382 it prints "Digit sum: 24". | [
{
"role": "user",
"content": "need a python script to add up the digits of a number, like 47382 should give 24"
},
{
"role": "assistant",
"content": "This script reads a number and adds up its digits.\n```python\n# add up all digits of a number\nnumber = input().strip()\ntotal = 0\nfor digit in ... | glm-5.3-flash | qa-v1 | train | 118 | |
2ffe9cf8d45e2b2b | en | code_python | make me a number guessing game in python where i type my guesses | This game asks for guesses and says whether the secret number is higher or lower until you find it.
```python
# guess the secret number
secret = 42
tries = 0
while True:
guess = int(input("Your guess: "))
tries += 1
if guess < secret:
print("Higher")
elif guess > secret:
print("Lower")
... | [
{
"role": "user",
"content": "make me a number guessing game in python where i type my guesses"
},
{
"role": "assistant",
"content": "This game asks for guesses and says whether the secret number is higher or lower until you find it.\n```python\n# guess the secret number\nsecret = 42\ntries = 0\... | glm-5.3-flash | qa-v1 | train | 170 | |
1ff240cfa1726f96 | en | code_python | python print a triangle of stars | This prints a small triangle of stars, five rows high.
```python
# triangle of stars
for row in range(1, 6):
print("*" * row)
```
Save it as stars.py and run it with "python3 stars.py". It prints one star on the first line, then two, up to five on the last line. | [
{
"role": "user",
"content": "python print a triangle of stars"
},
{
"role": "assistant",
"content": "This prints a small triangle of stars, five rows high.\n```python\n# triangle of stars\nfor row in range(1, 6):\n print(\"*\" * row)\n```\nSave it as stars.py and run it with \"python3 stars.... | hy4-preview | qa-v1 | train | 83 | |
7ed5fac91232b1f8 | en | code_python | python: count how often each letter appears in a word using a dictionary | This program counts how often each letter appears in a word using a dictionary.
```python
# count how often each letter appears in a word
word = "mississippi"
counts = {}
for letter in word:
counts[letter] = counts.get(letter, 0) + 1
for letter, count in counts.items():
print(letter, count)
```
For "mississippi... | [
{
"role": "user",
"content": "python: count how often each letter appears in a word using a dictionary"
},
{
"role": "assistant",
"content": "This program counts how often each letter appears in a word using a dictionary.\n```python\n# count how often each letter appears in a word\nword = \"miss... | glm-5.3-flash | qa-v1 | train | 128 | |
9995d411f1761049 | en | code_python | write me a rock paper scissors game vs the computer in python | This plays one round of rock paper scissors against the computer.
```python
import random
choices = ["rock", "paper", "scissors"]
beats = {"rock": "scissors", "paper": "rock", "scissors": "paper"}
player = input("rock, paper or scissors? ").lower()
computer = random.choice(choices)
print("Computer picked", computer)
... | [
{
"role": "user",
"content": "write me a rock paper scissors game vs the computer in python"
},
{
"role": "assistant",
"content": "This plays one round of rock paper scissors against the computer.\n```python\nimport random\n\nchoices = [\"rock\", \"paper\", \"scissors\"]\nbeats = {\"rock\": \"sc... | hy4-preview | qa-v1 | train | 173 | |
1984c0424088f3c9 | en | code_python | write me python code for the greatest common divisor of 2 nums | This program reads two whole numbers and prints their greatest common divisor.
```python
def gcd(a, b):
# keep taking remainders until one is 0
while b:
a, b = b, a % b
return a
x = int(input("First number: "))
y = int(input("Second number: "))
print("GCD:", gcd(x, y))
```
Run it with "python3 gc... | [
{
"role": "user",
"content": "write me python code for the greatest common divisor of 2 nums"
},
{
"role": "assistant",
"content": "This program reads two whole numbers and prints their greatest common divisor.\n\n```python\ndef gcd(a, b):\n # keep taking remainders until one is 0\n while ... | hy4-preview | qa-v1 | train | 148 | |
2d9b7f67062de31a | en | code_python | i want a small phone book using a dictionary in python | This program keeps names and numbers in a dictionary, adds one new entry, and looks up a name you type.
```python
phone_book = {"Ana": "555-1234", "Ben": "555-5678"}
phone_book["Cara"] = "555-9012"
print("Ben:", phone_book["Ben"])
name = input("Who are you looking for? ")
print(phone_book.get(name, "Not in the phone... | [
{
"role": "user",
"content": "i want a small phone book using a dictionary in python"
},
{
"role": "assistant",
"content": "This program keeps names and numbers in a dictionary, adds one new entry, and looks up a name you type.\n\n```python\nphone_book = {\"Ana\": \"555-1234\", \"Ben\": \"555-56... | hy4-preview | qa-v1 | train | 183 | |
2b99831701c6d60f | en | code_python | hey can u make me a python thing that adds up the digits of a number | This asks for a number, then adds its digits one by one.
```python
number = input("Enter a number: ")
total = 0
for char in number:
if char.isdigit(): # skip minus signs and dots
total += int(char)
print("Sum of the digits:", total)
```
Save it as digits.py and run it with "python3 digits.py". Typed 404... | [
{
"role": "user",
"content": "hey can u make me a python thing that adds up the digits of a number"
},
{
"role": "assistant",
"content": "This asks for a number, then adds its digits one by one.\n```python\nnumber = input(\"Enter a number: \")\n\ntotal = 0\nfor char in number:\n if char.isdig... | hy4-preview | qa-v1 | train | 126 | |
2e8c0ea1a84c3b88 | en | code_python | make me a little program that prints the squares of 1 to 10 with a list comprehension | This program builds the squares of 1 to 10 with a list comprehension and prints the list.
```python
# squares of 1 to 10 with a list comprehension
squares = [n ** 2 for n in range(1, 11)]
print(squares)
```
Run it with "python3 squares.py" and it prints [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. | [
{
"role": "user",
"content": "make me a little program that prints the squares of 1 to 10 with a list comprehension"
},
{
"role": "assistant",
"content": "This program builds the squares of 1 to 10 with a list comprehension and prints the list.\n```python\n# squares of 1 to 10 with a list compre... | glm-5.3-flash | qa-v1 | train | 138 | |
da7e7abc3ac39c50 | en | code_python | hi can u print the even numbers from 1 to 20 in a loop | This program prints every even number from 1 to 20.
```python
# print the even numbers from 1 to 20
for n in range(1, 21):
if n % 2 == 0:
print(n)
```
Save it as evens.py and run it with "python3 evens.py". It prints 2, 4, 6, 8, 10, 12, 14, 16, 18 and 20, one per line. | [
{
"role": "user",
"content": "hi can u print the even numbers from 1 to 20 in a loop"
},
{
"role": "assistant",
"content": "This program prints every even number from 1 to 20.\n```python\n# print the even numbers from 1 to 20\nfor n in range(1, 21):\n if n % 2 == 0:\n print(n)\n```\nSa... | glm-5.3-flash | qa-v1 | train | 137 | |
7009691b66167fb7 | en | code_python | can u make a countdown from 5 to 1 in python | This program counts down from 5 to 1 and then prints Go!
```python
# countdown from 5 to 1
for n in range(5, 0, -1):
print(n)
print("Go!")
```
Run it with python3 countdown.py. It prints 5, 4, 3, 2 and 1, one per line, then Go! | [
{
"role": "user",
"content": "can u make a countdown from 5 to 1 in python"
},
{
"role": "assistant",
"content": "This program counts down from 5 to 1 and then prints Go!\n```python\n# countdown from 5 to 1\nfor n in range(5, 0, -1):\n print(n)\nprint(\"Go!\")\n```\nRun it with python3 countd... | glm-5.3-flash | qa-v1 | train | 100 | |
c91d431d438a70d7 | en | code_python | build me a number guessing game in python that reads guesses with input() | This program picks a secret number from 1 to 20 and tells you if each guess is too low, too high or correct.
```python
# guess the secret number from 1 to 20
import random
secret = random.randint(1, 20)
tries = 0
while True:
guess = int(input("Your guess (1-20): "))
tries += 1
if guess < secret:
... | [
{
"role": "user",
"content": "build me a number guessing game in python that reads guesses with input()"
},
{
"role": "assistant",
"content": "This program picks a secret number from 1 to 20 and tells you if each guess is too low, too high or correct.\n```python\n# guess the secret number from 1... | glm-5.3-flash | qa-v1 | train | 197 | |
78bbae824a833c75 | en | code_python | i need a script that finds the longest word in a sentence | This program reads a sentence and prints its longest word.
```python
# find the longest word in a sentence
sentence = input("Enter a sentence: ")
words = sentence.split()
longest = ""
for word in words:
if len(word) > len(longest):
longest = word
print("Longest word:", longest)
```
Run it with "python3 lo... | [
{
"role": "user",
"content": "i need a script that finds the longest word in a sentence"
},
{
"role": "assistant",
"content": "This program reads a sentence and prints its longest word.\n```python\n# find the longest word in a sentence\nsentence = input(\"Enter a sentence: \")\nwords = sentence.... | glm-5.3-flash | qa-v1 | train | 126 | |
769c589a15327952 | en | code_python | code me a multiplication table in python, like the 7 times table | This program prints the 7 times table from 7 x 1 to 7 x 10.
```python
n = 7
for i in range(1, 11):
print(n, "x", i, "=", n * i)
```
Save it as table.py and run it with "python3 table.py". It prints lines like "7 x 1 = 7" up to "7 x 10 = 70". | [
{
"role": "user",
"content": "code me a multiplication table in python, like the 7 times table"
},
{
"role": "assistant",
"content": "This program prints the 7 times table from 7 x 1 to 7 x 10.\n```python\nn = 7\nfor i in range(1, 11):\n print(n, \"x\", i, \"=\", n * i)\n```\nSave it as table... | glm-5.3-flash | qa-v1 | train | 122 | |
277ccc496cc6480e | en | code_python | make me a python script that writes a few lines to a file and reads them back | This program writes three lines to note.txt and then prints what is in the file.
```python
# write a few lines to a file, then read them back
with open("note.txt", "w") as f:
f.write("hello\n")
f.write("this is a test\n")
f.write("goodbye\n")
with open("note.txt") as f:
print(f.read())
```
Save it as n... | [
{
"role": "user",
"content": "make me a python script that writes a few lines to a file and reads them back"
},
{
"role": "assistant",
"content": "This program writes three lines to note.txt and then prints what is in the file.\n```python\n# write a few lines to a file, then read them back\nwith... | glm-5.3-flash | qa-v1 | train | 135 | |
50e622cf6a3242a7 | en | code_python | write a program that checks if a number is prime | This program asks for a number and tells you if it is prime by testing every smaller number.
```python
# check if a number is prime
n = int(input("Number: "))
prime = n > 1
for i in range(2, n):
if n % i == 0:
prime = False
break
if prime:
print(n, "is prime")
else:
print(n, "is not prime")
... | [
{
"role": "user",
"content": "write a program that checks if a number is prime"
},
{
"role": "assistant",
"content": "This program asks for a number and tells you if it is prime by testing every smaller number.\n```python\n# check if a number is prime\nn = int(input(\"Number: \"))\nprime = n > 1... | glm-5.3-flash | qa-v1 | train | 155 | |
49364cf006469a63 | en | code_python | hi, whats the python code for finding the longest word in a sentence | This program reads a sentence and prints its longest word.
```python
# find the longest word in a sentence
sentence = input("Enter a sentence: ")
words = sentence.split()
longest = max(words, key=len)
print("Longest word:", longest)
```
Run it with "python3 longest.py". With the sentence "I love programming in python" ... | [
{
"role": "user",
"content": "hi, whats the python code for finding the longest word in a sentence"
},
{
"role": "assistant",
"content": "This program reads a sentence and prints its longest word.\n```python\n# find the longest word in a sentence\nsentence = input(\"Enter a sentence: \")\nwords ... | glm-5.3-flash | qa-v1 | train | 108 | |
a41c374da0da5ae6 | en | code_python | count the vowels in a sentence for me, python | This program counts the vowels a, e, i, o and u in a sentence you type.
```python
# count the vowels in a sentence
text = input("Type a sentence: ").lower()
vowels = 0
for ch in text:
if ch in "aeiou":
vowels = vowels + 1
print("Vowel count:", vowels)
```
Save it as vowels.py and run it with "python3 vowels... | [
{
"role": "user",
"content": "count the vowels in a sentence for me, python"
},
{
"role": "assistant",
"content": "This program counts the vowels a, e, i, o and u in a sentence you type.\n```python\n# count the vowels in a sentence\ntext = input(\"Type a sentence: \").lower()\nvowels = 0\nfor ch... | glm-5.3-flash | qa-v1 | train | 137 | |
fb04a5db18226370 | en | code_python | how do i write a python program that adds up the digits of a number | This program adds up all the digits of the number you type.
```python
number = input("Type a whole number: ")
total = 0
for digit in number:
total += int(digit)
print("The sum of the digits is", total)
```
Save it as digits.py and run it with "python3 digits.py". With "4729" it prints "The sum of the digits is 22". | [
{
"role": "user",
"content": "how do i write a python program that adds up the digits of a number"
},
{
"role": "assistant",
"content": "This program adds up all the digits of the number you type.\n```python\nnumber = input(\"Type a whole number: \")\ntotal = 0\nfor digit in number:\n total +... | glm-5.3-flash | qa-v1 | train | 113 | |
4d101dc41d08c36c | en | code_python | how do i remove duplicates from a list in python, keep the original order | This drops duplicates by adding an item to a new list only if it is not there yet, so each first occurrence keeps its place.
```python
items = [1, 2, 2, 3, 1, 4]
unique = []
for item in items:
if item not in unique:
unique.append(item)
print(unique)
```
Run it with python3 nodupes.py. It prints [1, 2, 3, ... | [
{
"role": "user",
"content": "how do i remove duplicates from a list in python, keep the original order"
},
{
"role": "assistant",
"content": "This drops duplicates by adding an item to a new list only if it is not there yet, so each first occurrence keeps its place.\n```python\nitems = [1, 2, 2... | hy4-preview | qa-v1 | train | 122 | |
30881dd5f3aa8759 | en | code_python | small python script to write a few lines to a file and read them back | This program writes three lines to a file and prints the file contents.
```python
# write three lines to a file and read them back
lines = ["apples", "bananas", "cherries"]
with open("fruits.txt", "w") as f:
for line in lines:
f.write(line + "\n")
with open("fruits.txt") as f:
print(f.read())
```
It cre... | [
{
"role": "user",
"content": "small python script to write a few lines to a file and read them back"
},
{
"role": "assistant",
"content": "This program writes three lines to a file and prints the file contents.\n```python\n# write three lines to a file and read them back\nlines = [\"apples\", \"... | glm-5.3-flash | qa-v1 | train | 130 | |
d1de7354fae6609e | en | code_python | quick one how do i reverse a string in python | This one flips a string backwards using a slice.
```python
text = input("text: ")
# [::-1] walks through the string backwards
print(text[::-1])
```
Save it as reverse.py and run it with python3 reverse.py. Typing hello world prints dlrow olleh. | [
{
"role": "user",
"content": "quick one how do i reverse a string in python"
},
{
"role": "assistant",
"content": "This one flips a string backwards using a slice.\n```python\ntext = input(\"text: \")\n# [::-1] walks through the string backwards\nprint(text[::-1])\n```\nSave it as reverse.py and... | hy4-preview | qa-v1 | train | 78 | |
90ad0f380a1e181c | en | code_python | check if a number is prime, python script please | This program reads a number and prints whether it is prime.
```python
n = int(input("Enter a number: "))
# a prime has no divisors from 2 up to its square root
if n < 2:
print(n, "is not prime")
else:
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
print(n, "is not prime")
b... | [
{
"role": "user",
"content": "check if a number is prime, python script please"
},
{
"role": "assistant",
"content": "This program reads a number and prints whether it is prime.\n```python\nn = int(input(\"Enter a number: \"))\n# a prime has no divisors from 2 up to its square root\nif n < 2:\n ... | glm-5.3-flash | qa-v1 | train | 152 | |
7bded81df2486dcd | en | code_python | python program that checks if a number is prime plz | This program asks for a number and tells you if it is prime.
```python
# check if a number is prime
n = int(input("Enter a number: "))
is_prime = n > 1
for i in range(2, int(n ** 0.5) + 1):
if n % i == 0:
is_prime = False
break
if is_prime:
print("prime")
else:
print("not prime")
```
Run i... | [
{
"role": "user",
"content": "python program that checks if a number is prime plz"
},
{
"role": "assistant",
"content": "This program asks for a number and tells you if it is prime.\n```python\n# check if a number is prime\nn = int(input(\"Enter a number: \"))\n\nis_prime = n > 1\nfor i in range... | glm-5.3-flash | qa-v1 | train | 159 | |
1ffe06bc98c642de | en | code_python | convert a binary string to a decimal number, python | This program reads a binary string and prints its decimal value.
```python
# turn a binary string like 1011 into a decimal number
bits = input("enter a binary string: ")
decimal = 0
for digit in bits:
decimal = decimal * 2 + int(digit)
print("decimal:", decimal)
```
Run it with python3 bin2dec.py. Tested with 1011:... | [
{
"role": "user",
"content": "convert a binary string to a decimal number, python"
},
{
"role": "assistant",
"content": "This program reads a binary string and prints its decimal value.\n```python\n# turn a binary string like 1011 into a decimal number\nbits = input(\"enter a binary string: \")\... | glm-5.3-flash | qa-v1 | train | 118 | |
d56371fe6d6b489a | en | code_python | python program for the sum of the digits of a number pls | This script adds up every digit of the number you type.
```python
# add up the digits of a number
number = abs(int(input("Type a number: ")))
total = 0
while number > 0:
total = total + number % 10
number = number // 10
print("Digit sum:", total)
```
Run it with "python3 digitsum.py" and type a number like 1234... | [
{
"role": "user",
"content": "python program for the sum of the digits of a number pls"
},
{
"role": "assistant",
"content": "This script adds up every digit of the number you type.\n```python\n# add up the digits of a number\nnumber = abs(int(input(\"Type a number: \")))\ntotal = 0\nwhile numbe... | glm-5.3-flash | qa-v1 | train | 134 | |
fada7bd3fc6dcfaa | en | code_python | swap two variables in python, how do u do that | It reads two values and swaps them in one line, so there is no need for a temporary variable.
```python
a = input("First value: ")
b = input("Second value: ")
print("Before:", a, b)
a, b = b, a
print("After:", a, b)
```
Run it and type two values. With "cat" and "dog" it prints "Before: cat dog" and then "After: dog ... | [
{
"role": "user",
"content": "swap two variables in python, how do u do that"
},
{
"role": "assistant",
"content": "It reads two values and swaps them in one line, so there is no need for a temporary variable.\n```python\na = input(\"First value: \")\nb = input(\"Second value: \")\nprint(\"Befor... | hy4-preview | qa-v1 | train | 120 | |
10450996252b578e | en | code_python | can u write a palindrome checker, it should ask for a word | This program asks for a word and says if it reads the same backwards.
```python
# palindrome check, ignoring capital letters
word = input("Type a word: ")
if word.lower() == word.lower()[::-1]:
print(word, "is a palindrome")
else:
print(word, "is not a palindrome")
```
Run it with "python3 palindrome.py" and t... | [
{
"role": "user",
"content": "can u write a palindrome checker, it should ask for a word"
},
{
"role": "assistant",
"content": "This program asks for a word and says if it reads the same backwards.\n```python\n# palindrome check, ignoring capital letters\nword = input(\"Type a word: \")\n\nif wo... | glm-5.3-flash | qa-v1 | train | 116 | |
bd14960a8e793045 | en | code_python | can u show me squares of numbers 1 to 10 using list comprehension | This builds the squares of 1 to 10 with a single list comprehension.
```python
squares = [n * n for n in range(1, 11)]
print(squares)
```
Run it with python3 squares.py. It prints [1, 4, 9, 16, 25, 36, 49, 64, 81, 100]. | [
{
"role": "user",
"content": "can u show me squares of numbers 1 to 10 using list comprehension"
},
{
"role": "assistant",
"content": "This builds the squares of 1 to 10 with a single list comprehension.\n```python\nsquares = [n * n for n in range(1, 11)]\nprint(squares)\n```\nRun it with python... | hy4-preview | qa-v1 | train | 112 | |
e4fafeab159367e5 | en | code_python | list all primes up to 50 in python pls | This program prints every prime number up to 50.
```python
# check every number from 2 to 50
for n in range(2, 51):
prime = True
for d in range(2, n):
if n % d == 0:
prime = False
break
if prime:
print(n)
```
Save it as primes.py and run it with python3 primes.py. It ... | [
{
"role": "user",
"content": "list all primes up to 50 in python pls"
},
{
"role": "assistant",
"content": "This program prints every prime number up to 50.\n```python\n# check every number from 2 to 50\nfor n in range(2, 51):\n prime = True\n for d in range(2, n):\n if n % d == 0:\... | glm-5.3-flash | qa-v1 | train | 130 | |
4b600d889758047a | en | code_python | make a python calculater that reads two numbers and an operator | This calculator reads two numbers and an operator, then prints the result.
```python
# simple calculator
a = float(input("First number: "))
b = float(input("Second number: "))
op = input("Operator (+ - * /): ")
if op == "+":
print(a + b)
elif op == "-":
print(a - b)
elif op == "*":
print(a * b)
elif op == ... | [
{
"role": "user",
"content": "make a python calculater that reads two numbers and an operator"
},
{
"role": "assistant",
"content": "This calculator reads two numbers and an operator, then prints the result.\n```python\n# simple calculator\na = float(input(\"First number: \"))\nb = float(input(\... | glm-5.3-flash | qa-v1 | train | 193 | |
164f45118eb2682a | en | code_python | write a python program that computes factorial using recursion | This program computes the factorial of 5 with a recursive function.
```python
def factorial(n):
# base case: 0! is 1
if n == 0:
return 1
# n! = n times (n-1)!
return n * factorial(n - 1)
print(factorial(5))
```
Save it as fact.py and run it with python3 fact.py. It prints 120, because 5 × 4 × ... | [
{
"role": "user",
"content": "write a python program that computes factorial using recursion"
},
{
"role": "assistant",
"content": "This program computes the factorial of 5 with a recursive function.\n```python\ndef factorial(n):\n # base case: 0! is 1\n if n == 0:\n return 1\n #... | glm-5.3-flash | qa-v1 | train | 139 | |
8da9317e6a5a0199 | en | code_python | code me a simple calculator that asks for two numbers and an operator, like + or - | This calculator asks for two numbers and an operator, then prints the result.
```python
# tiny calculator: two numbers and one operator
a = float(input("First number: "))
op = input("Operator (+ - * /): ")
b = float(input("Second number: "))
result = None
if op == "+":
result = a + b
elif op == "-":
result = a ... | [
{
"role": "user",
"content": "code me a simple calculator that asks for two numbers and an operator, like + or -"
},
{
"role": "assistant",
"content": "This calculator asks for two numbers and an operator, then prints the result.\n```python\n# tiny calculator: two numbers and one operator\na = f... | glm-5.3-flash | qa-v1 | train | 254 | |
599006957dcbec2a | en | code_python | sum and average of a list of numbers in python please | This takes a list of numbers and prints both its sum and its average.
```python
numbers = [4, 7, 2, 9, 5]
total = sum(numbers)
average = total / len(numbers)
print("Sum:", total)
print("Average:", average)
```
Save it as stats.py and run it with "python3 stats.py". For this list it prints "Sum: 27" and "Average: 5.4"... | [
{
"role": "user",
"content": "sum and average of a list of numbers in python please"
},
{
"role": "assistant",
"content": "This takes a list of numbers and prints both its sum and its average.\n```python\nnumbers = [4, 7, 2, 9, 5]\n\ntotal = sum(numbers)\naverage = total / len(numbers)\n\nprint(... | hy4-preview | qa-v1 | train | 118 | |
ba39adb044d9fd42 | en | code_python | print a multiplication table python | This program prints the times table for whatever number you type, from 1 to 10.
```python
# multiplication table for any number
n = int(input("Table for: "))
for i in range(1, 11):
print(i, "x", n, "=", i * n)
```
Save it as table.py and run "python3 table.py". With 7 it prints ten lines, from "1 x 7 = 7" to "10... | [
{
"role": "user",
"content": "print a multiplication table python"
},
{
"role": "assistant",
"content": "This program prints the times table for whatever number you type, from 1 to 10.\n\n```python\n# multiplication table for any number\nn = int(input(\"Table for: \"))\n\nfor i in range(1, 11):\... | hy4-preview | qa-v1 | train | 125 | |
f602749e8853c78c | en | code_python | hey i need a script to convert a binary string like 1011 into a decimal number | This script turns a binary string into a decimal number.
```python
# binary string to decimal
binary = input("binary number: ")
decimal = 0
for digit in binary:
decimal = decimal * 2 + int(digit)
print("decimal:", decimal)
```
Run it, type 1011 and it prints decimal: 11. | [
{
"role": "user",
"content": "hey i need a script to convert a binary string like 1011 into a decimal number"
},
{
"role": "assistant",
"content": "This script turns a binary string into a decimal number.\n```python\n# binary string to decimal\nbinary = input(\"binary number: \")\ndecimal = 0\nf... | glm-5.3-flash | qa-v1 | train | 107 | |
b3c40f0b69f03bb9 | en | code_python | how do i check if a word is a palindrome in python | This program tells you if a word reads the same forwards and backwards.
```python
# check if a word reads the same backwards
word = input("Enter a word: ")
if word.lower() == word[::-1].lower():
print(word, "is a palindrome.")
else:
print(word, "is not a palindrome.")
```
Save it as palindrome.py and run it wi... | [
{
"role": "user",
"content": "how do i check if a word is a palindrome in python"
},
{
"role": "assistant",
"content": "This program tells you if a word reads the same forwards and backwards.\n```python\n# check if a word reads the same backwards\nword = input(\"Enter a word: \")\n\nif word.lowe... | glm-5.3-flash | qa-v1 | train | 123 | |
ec1b3e2e20791665 | en | code_python | capitalize every word in a sentence for me in python | This program capitalizes the first letter of every word in a sentence you type.
```python
# capitalize the first letter of every word
sentence = input()
words = sentence.split()
result = []
for word in words:
result.append(word[0].upper() + word[1:])
print(" ".join(result))
```
Run it with the input "the quick brow... | [
{
"role": "user",
"content": "capitalize every word in a sentence for me in python"
},
{
"role": "assistant",
"content": "This program capitalizes the first letter of every word in a sentence you type.\n```python\n# capitalize the first letter of every word\nsentence = input()\nwords = sentence.... | glm-5.3-flash | qa-v1 | train | 110 | |
a29aafef08c199e2 | en | code_python | write a program that finds the biggest number in a list but without using max() | This program finds the largest number in a list by comparing each value by hand.
```python
# find the biggest number by comparing by hand
numbers = [12, 7, 33, 5, 28, 9]
largest = numbers[0]
for n in numbers[1:]:
if n > largest:
largest = n
print("Largest:", largest)
```
Run it with python3 largest.py and i... | [
{
"role": "user",
"content": "write a program that finds the biggest number in a list but without using max()"
},
{
"role": "assistant",
"content": "This program finds the largest number in a list by comparing each value by hand.\n```python\n# find the biggest number by comparing by hand\nnumber... | glm-5.3-flash | qa-v1 | train | 125 | |
f6bf1ca39d13a804 | en | code_python | i need a shopping list program where i can add and remove stuff | This program keeps a shopping list, and you can add, remove, show items or quit.
```python
# small shopping list program
items = []
while True:
command = input("Type add, remove, show or quit: ").strip().lower()
if command == "quit":
break
elif command == "add":
items.append(input("What sh... | [
{
"role": "user",
"content": "i need a shopping list program where i can add and remove stuff"
},
{
"role": "assistant",
"content": "This program keeps a shopping list, and you can add, remove, show items or quit.\n```python\n# small shopping list program\nitems = []\n\nwhile True:\n command ... | glm-5.3-flash | qa-v1 | train | 236 | |
7cbb3abb6829ac62 | en | code_python | python program that capitalizes every word in a sentence pls | This program reads a sentence and prints it with every word starting with a capital letter.
```python
# read a sentence and print it with every word capitalized
sentence = input("Type a sentence: ")
words = sentence.split()
capitalized = " ".join(word.capitalize() for word in words)
print(capitalized)
```
Save it as wo... | [
{
"role": "user",
"content": "python program that capitalizes every word in a sentence pls"
},
{
"role": "assistant",
"content": "This program reads a sentence and prints it with every word starting with a capital letter.\n```python\n# read a sentence and print it with every word capitalized\nse... | glm-5.3-flash | qa-v1 | train | 121 | |
87c6226ac8ee1056 | en | code_python | write python code to find the longest word in a sentance i type in | This program prints the longest word in the sentence you type.
```python
sentence = input("Type a sentence: ")
longest = ""
for word in sentence.split():
if len(word) > len(longest):
longest = word
print("The longest word is", longest)
```
Save it as longest.py and run it with "python3 longest.py". With "I ... | [
{
"role": "user",
"content": "write python code to find the longest word in a sentance i type in"
},
{
"role": "assistant",
"content": "This program prints the longest word in the sentence you type.\n```python\nsentence = input(\"Type a sentence: \")\nlongest = \"\"\nfor word in sentence.split()... | glm-5.3-flash | qa-v1 | train | 116 | |
f6213cf3db30b197 | en | code_python | python program that adds up all the digits of a number pls | This program asks for a number and prints the sum of its digits.
```python
# sum of the digits of a number
n = input("Number: ")
total = 0
for ch in n:
if ch.isdigit(): # ignore the minus sign
total += int(ch)
print("Digit sum:", total)
```
Save it as digits.py and run it with "python3 digits.py"... | [
{
"role": "user",
"content": "python program that adds up all the digits of a number pls"
},
{
"role": "assistant",
"content": "This program asks for a number and prints the sum of its digits.\n\n```python\n# sum of the digits of a number\nn = input(\"Number: \")\ntotal = 0\nfor ch in n:\n if... | hy4-preview | qa-v1 | train | 130 | |
b4e42a8f1bd7dfd8 | en | code_python | how do i convert a binary string like 1011 to a normal number | This converts a binary string into a plain decimal number.
```python
binary = input("Binary number: ")
print(int(binary, 2))
```
The 2 in int(binary, 2) means base 2. With the input "1011" it prints 11, since 8 + 2 + 1 = 11. | [
{
"role": "user",
"content": "how do i convert a binary string like 1011 to a normal number"
},
{
"role": "assistant",
"content": "This converts a binary string into a plain decimal number.\n```python\nbinary = input(\"Binary number: \")\nprint(int(binary, 2))\n```\nThe 2 in int(binary, 2) means... | hy4-preview | qa-v1 | train | 101 | |
7bd890c8b467513b | en | code_python | python program to add up the digits of a number i type in | This program reads a number and adds up its digits.
```python
# add up the digits of a number
number = input("Type a number: ")
total = 0
for digit in number:
total += int(digit)
print("Digit sum:", total)
```
Save it as digits.py and run it with "python3 digits.py", then type a number like 1234. It prints "Digit s... | [
{
"role": "user",
"content": "python program to add up the digits of a number i type in"
},
{
"role": "assistant",
"content": "This program reads a number and adds up its digits.\n```python\n# add up the digits of a number\nnumber = input(\"Type a number: \")\ntotal = 0\nfor digit in number:\n ... | glm-5.3-flash | qa-v1 | train | 115 | |
99dd3fa8b3dc8157 | en | code_python | how do i check if a year is a leap year in python? small program pls | This program reads a year and prints whether it is a leap year.
```python
# check if a year is a leap year
year = int(input())
if year % 400 == 0:
print(year, "is a leap year")
elif year % 100 == 0:
print(year, "is not a leap year")
elif year % 4 == 0:
print(year, "is a leap year")
else:
print(year, "is... | [
{
"role": "user",
"content": "how do i check if a year is a leap year in python? small program pls"
},
{
"role": "assistant",
"content": "This program reads a year and prints whether it is a leap year.\n```python\n# check if a year is a leap year\nyear = int(input())\nif year % 400 == 0:\n pr... | glm-5.3-flash | qa-v1 | train | 202 | |
ff94fa8db258d986 | en | code_python | hey write me a python script that prints the fibonaci sequence, ask me how many numbers first | This program prints as many Fibonacci numbers as you ask for.
```python
n = int(input("How many Fibonacci numbers? "))
a, b = 0, 1
for _ in range(n):
print(a)
a, b = b, a + b
```
Save it as fib.py and run it with "python3 fib.py". With "7" it prints 0, 1, 1, 2, 3, 5 and 8, one per line. | [
{
"role": "user",
"content": "hey write me a python script that prints the fibonaci sequence, ask me how many numbers first"
},
{
"role": "assistant",
"content": "This program prints as many Fibonacci numbers as you ask for.\n```python\nn = int(input(\"How many Fibonacci numbers? \"))\na, b = 0,... | glm-5.3-flash | qa-v1 | train | 135 | |
12ab2ec8779501bc | en | code_python | make me a simple todo list in python, just in memory | This program is a to-do list that lives in memory, with add, list, done and quit commands.
```python
# a to-do list kept in memory, no files
tasks = []
while True:
command = input("add/list/done/quit: ")
if command == "add":
tasks.append(input("new task: "))
elif command == "list":
for i, ta... | [
{
"role": "user",
"content": "make me a simple todo list in python, just in memory"
},
{
"role": "assistant",
"content": "This program is a to-do list that lives in memory, with add, list, done and quit commands.\n```python\n# a to-do list kept in memory, no files\ntasks = []\nwhile True:\n c... | glm-5.3-flash | qa-v1 | train | 200 | |
b00b4432b5f19896 | en | code_python | code fizzbuzz from 1 to 100 in python please | This program plays FizzBuzz for every number from 1 to 100.
```python
for n in range(1, 101):
if n % 15 == 0:
print("FizzBuzz")
elif n % 3 == 0:
print("Fizz")
elif n % 5 == 0:
print("Buzz")
else:
print(n)
```
Save it as fizz.py and run it with "python3 fizz.py". It prints... | [
{
"role": "user",
"content": "code fizzbuzz from 1 to 100 in python please"
},
{
"role": "assistant",
"content": "This program plays FizzBuzz for every number from 1 to 100.\n```python\nfor n in range(1, 101):\n if n % 15 == 0:\n print(\"FizzBuzz\")\n elif n % 3 == 0:\n print... | glm-5.3-flash | qa-v1 | train | 170 | |
905b4cd6d1e194ea | en | code_python | make me a temperature table in python from 0 to 100 celsius pls | It prints a Celsius to Fahrenheit table from 0 to 100 degrees in steps of 10.
```python
# print a Celsius to Fahrenheit table from 0 to 100
print("Celsius Fahrenheit")
for c in range(0, 101, 10):
f = c * 9 / 5 + 32
print(f"{c:<8}{f:.1f}")
```
Run it with "python3 table.py". The last row shows 100 degrees Celsiu... | [
{
"role": "user",
"content": "make me a temperature table in python from 0 to 100 celsius pls"
},
{
"role": "assistant",
"content": "It prints a Celsius to Fahrenheit table from 0 to 100 degrees in steps of 10.\n```python\n# print a Celsius to Fahrenheit table from 0 to 100\nprint(\"Celsius Fahr... | glm-5.3-flash | qa-v1 | train | 149 | |
20df607fef5a1b24 | en | code_python | make me a python script that turns a binary string like 1011 into a normal number | This program turns a binary string into a decimal number.
```python
binary = input("Type a binary number: ")
value = 0
# each digit doubles what came before, then adds the digit
for digit in binary:
value = value * 2 + int(digit)
print(binary, "is", value, "in decimal")
```
Save it as binary.py and run it with "pyt... | [
{
"role": "user",
"content": "make me a python script that turns a binary string like 1011 into a normal number"
},
{
"role": "assistant",
"content": "This program turns a binary string into a decimal number.\n```python\nbinary = input(\"Type a binary number: \")\nvalue = 0\n# each digit doubles... | glm-5.3-flash | qa-v1 | train | 141 | |
b82437d4537c128c | en | code_python | how do i count how many times each word appears in a sentence in python | This program reads a line and prints each word with how many times it appears.
```python
# count how many times each word appears
words = input("type some words: ").lower().split()
counts = {}
for word in words:
counts[word] = counts.get(word, 0) + 1
for word, count in counts.items():
print(word, count)
```
Run... | [
{
"role": "user",
"content": "how do i count how many times each word appears in a sentence in python"
},
{
"role": "assistant",
"content": "This program reads a line and prints each word with how many times it appears.\n```python\n# count how many times each word appears\nwords = input(\"type s... | glm-5.3-flash | qa-v1 | train | 138 | |
bf4a04b191a2ec1c | en | code_python | need a python program that finds the longest word in a sentence | This program prints the longest word in a sentence you type.
```python
# print the longest word in a sentence
sentence = input()
words = sentence.split()
longest = max(words, key=len)
print(longest)
```
Run it with "python3 longest.py" and type a sentence when asked. For "The quick brown fox jumps over the lazy dog" it... | [
{
"role": "user",
"content": "need a python program that finds the longest word in a sentence"
},
{
"role": "assistant",
"content": "This program prints the longest word in a sentence you type.\n```python\n# print the longest word in a sentence\nsentence = input()\nwords = sentence.split()\nlong... | glm-5.3-flash | qa-v1 | train | 99 | |
a12a52dd4aa80013 | en | code_python | i need a simple Dog class in python with a bark method | This defines a Dog class with a name and a bark method, then makes one dog bark.
```python
# a simple dog
class Dog:
def __init__(self, name):
self.name = name
def bark(self):
print(self.name, "says: Woof, woof!")
my_dog = Dog("Rex")
my_dog.bark()
```
Run it with "python3 dog.py" and it prints... | [
{
"role": "user",
"content": "i need a simple Dog class in python with a bark method"
},
{
"role": "assistant",
"content": "This defines a Dog class with a name and a bark method, then makes one dog bark.\n```python\n# a simple dog\nclass Dog:\n def __init__(self, name):\n self.name = ... | glm-5.3-flash | qa-v1 | train | 122 | |
e923d759ffc44a11 | en | code_python | need a python program for greatest common divisor of 2 numbers | This asks for two numbers and prints their greatest common divisor.
```python
a = int(input("First number: "))
b = int(input("Second number: "))
while b:
a, b = b, a % b
print("GCD:", a)
```
It uses Euclid's algorithm, which keeps replacing the pair with the smaller number and the remainder. With 48 and 18 it pri... | [
{
"role": "user",
"content": "need a python program for greatest common divisor of 2 numbers"
},
{
"role": "assistant",
"content": "This asks for two numbers and prints their greatest common divisor.\n```python\na = int(input(\"First number: \"))\nb = int(input(\"Second number: \"))\n\nwhile b:\... | hy4-preview | qa-v1 | train | 110 | |
b1a14c35ab325354 | en | code_python | check if a year is a leap year python | This program checks whether a year is a leap year.
```python
year = int(input('Year: '))
is_leap = year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)
print('Leap year' if is_leap else 'Not a leap year')
```
Run it and type a year. It printed "Leap year" for 2024. | [
{
"role": "user",
"content": "check if a year is a leap year python"
},
{
"role": "assistant",
"content": "This program checks whether a year is a leap year.\n```python\nyear = int(input('Year: '))\nis_leap = year % 4 == 0 and (year % 100 != 0 or year % 400 == 0)\nprint('Leap year' if is_leap el... | beam-free | qa-v1 | train | 118 | |
be45b3e160a4489b | en | code_python | can u list all the prime numbers up to 50 for me in python | This program checks every number from 2 to 50 and prints the primes.
```python
# all primes up to 50
for n in range(2, 51):
prime = True
for d in range(2, int(n ** 0.5) + 1):
if n % d == 0:
prime = False
break
if prime:
print(n, end=" ")
print()
```
Run it with "pyt... | [
{
"role": "user",
"content": "can u list all the prime numbers up to 50 for me in python"
},
{
"role": "assistant",
"content": "This program checks every number from 2 to 50 and prints the primes.\n\n```python\n# all primes up to 50\nfor n in range(2, 51):\n prime = True\n for d in range(2... | hy4-preview | qa-v1 | train | 197 | |
cffa5cf8574155ce | en | code_python | can u make a program that counts letters in a word with a dictionary | This program counts how often each letter appears and keeps the totals in a dictionary.
```python
# count letters with a dictionary
word = input("Type a word: ").lower()
counts = {}
for letter in word:
counts[letter] = counts.get(letter, 0) + 1
print(counts)
```
Run it with "python3 count.py" and type a word. For "... | [
{
"role": "user",
"content": "can u make a program that counts letters in a word with a dictionary"
},
{
"role": "assistant",
"content": "This program counts how often each letter appears and keeps the totals in a dictionary.\n```python\n# count letters with a dictionary\nword = input(\"Type a w... | glm-5.3-flash | qa-v1 | train | 132 | |
8c03516ed302682b | en | code_python | can u write a program that prints the 7 times table | This program prints the 7 times table from 1 to 10.
```python
# print the 7 times table
n = 7
for i in range(1, 11):
print(n, "x", i, "=", n * i)
```
Save it as table.py and run it with "python3 table.py". It prints lines like "7 x 1 = 7" up to "7 x 10 = 70". | [
{
"role": "user",
"content": "can u write a program that prints the 7 times table"
},
{
"role": "assistant",
"content": "This program prints the 7 times table from 1 to 10.\n```python\n# print the 7 times table\nn = 7\nfor i in range(1, 11):\n print(n, \"x\", i, \"=\", n * i)\n```\nSave it as... | glm-5.3-flash | qa-v1 | train | 122 | |
ef0f657c0167dd77 | en | code_python | can you write me a python phonebook that stores names and numbers in a dictionary | This phone book saves names and numbers in a dictionary until you type quit.
```python
# tiny phone book kept in a dictionary
book = {}
while True:
cmd = input("add / find / quit: ").strip().lower()
if cmd == "quit":
break
if cmd == "add":
name = input("Name: ")
number = input("Numb... | [
{
"role": "user",
"content": "can you write me a python phonebook that stores names and numbers in a dictionary"
},
{
"role": "assistant",
"content": "This phone book saves names and numbers in a dictionary until you type quit.\n\n```python\n# tiny phone book kept in a dictionary\nbook = {}\nwhi... | glm-5.3-flash | qa-v1 | train | 227 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.