Ú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
- Kingston Fury Beast 2x8GB ddr4 2666mhz KF426C16BBK2
- OHH ! Dell Latitude 9430 Üzleti Profi Prémium Ultrabook 14" -80% i7-1265U 32/1TB IRIS Xe FHD+
- Canon EOS 200D +kit objektív és táska ( 6100 expo )
- Chieftec Eco Series 600W táp eladó!
- Szinte Új Razer Kraken 2019 Fekete/Fehér/Zöld Bolti ár:20k INGYEN FOXPOST
- 5G LTE! Microsoft Surface Pro 8 i7-1185G7 16GB 512GB 1 év garancia
- Samsung Galaxy Z Fold4 Graygreen Duplakijelzős produktivitás, 120 Hz, Garancia 2026. 03. 22-ig
- LG 55C4 - 55" OLED evo - 4K 144Hz - 0.1ms - NVIDIA G-Sync - FreeSync - HDMI 2.1 - A9 Gen7 CPU
- Apple MacBook Air 15" 2025 100%(1év Garancia)
- LG 27GS95QE - 27" OLED / QHD 2K / 240Hz & 0.03ms / 1000 Nits / NVIDIA G-Sync / AMD FreeSync
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Central PC számítógép és laptop szerviz - Pécs
Város: Pécs

