Ú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
- Samsung Galaxy S23 Ultra - non plus ultra
- Milyen asztali (teljes vagy fél-) gépet vegyek?
- Luck Dragon: Asszociációs játék. :)
- Milyen autót vegyek?
- Samsung Galaxy S24 Ultra - ha működik, ne változtass!
- HiFi műszaki szemmel - sztereó hangrendszerek
- Léghűtés topik
- Nintendo Switch 2
- sziku69: Fűzzük össze a szavakat :)
- Vicces képek
- További aktív témák...
- LG 45GS95QX - 45" Ívelt OLED / 2K WQHD / 240Hz 0.03ms / NVIDIA G-Sync / FreeSync Premium / HDMI 2.1
- iPhone 13 mini 128GB Starlight -1 ÉV GARANCIA - Kártyafüggetlen, MS3831
- Eladó Honor 400 5G 8/256GB / 12 hó jótállás / AJÁNDÉK KEMÉNY TOK / CSAK KIPRÓBÁLVA VOLT
- HIBÁTLAN iPhone 11 Pro 256GB Space Grey -1 ÉV GARANCIA - Kártyafüggetlen, MS3173, 100% Akkumulátor
- Samsung Galaxy Watch FE / 16GB / Bluetooth / Wi-fi / GPS / 1 Hónap garancia
Állásajánlatok
Cég: PCMENTOR SZERVIZ KFT.
Város: Budapest
Cég: Laptopszaki Kft.
Város: Budapest

