Hirdetés
Új hozzászólás Aktív témák
-
olli
tag
válasz
kovisoft
#4446
üzenetére
import itertools
# Define the range of numbers (1 to 90)
numbers = range(1, 91)
# Define the target sum
target_sum = 225
# Generate all combinations of 5 numbers from the range 1 to 90
combinations = itertools.combinations(numbers, 5)
# Filter combinations whose sum equals the target_sum
valid_combinations = [comb for comb in combinations if sum(comb) == target_sum]
# Format the first 299018 valid combinations for Excel
formatted_combinations = "\n".join([",".join(map(str, comb)) for comb in valid_combinations[:299018]])
# Print the formatted combinations for Excel
print(formatted_combinations)
c:\Work\python>python x.py > x.txt
c:\Work\python>type x.txt | find /c /v ""
299018
hiba:
>>> c:\Work\python>python x.py > x.txt
File "<stdin>", line 1
c:\Work\python>python x.py > x.txt
^
SyntaxError: unexpected character after line continuation character
>>> c:\Work\python>type x.txt | find /c /v ""
File "<stdin>", line 1
c:\Work\python>type x.txt | find /c /v ""
^
SyntaxError: unexpected character after line continuation character
>>> 299018
Új hozzászólás Aktív témák
- Akciós kisWorkstation! Dell Precision 3570 i7-1255U 4.7GHz / 32GB / 1000GB / Quadro T550 4GB FHD 15"
- Ventilátor bazár /NZXT/CORSAIR/LIAN LI/DEEPCOOL/ZALMAN/120MM/140MM/VEZÉRLŐK/LED KIT-ek/
- CTO Bontott 0perces TÜZES EZÜST MacBook Air 13.6" M4 10C/1G 16GB 512GB Gar.: 1 év APPLE világgar
- ÁRGARANCIA!Épített KomPhone Ryzen 7 7800X3D 32/64GB RAM RTX 5070 12GB GAMER PC termékbeszámítással
- Acer Chromebase All-in-One PC 23.8" Touchscreen
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest


