Ú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
- ASRock P4i65PE Socket 478 Retro alaplap
- Lenovo ThinkPad T14 Gen 2, i5-1145G7 CPU, 16GB DDR4, 512GB SSD, AAM SZÁMLA, 1ÉV GARANCIA!
- Dell Latitude 5490 FHD, i5-8350U, 8GB DDR4,256GB SSD, AAM SZÁMLA(Vállalkozásoknak is!), 1ÉV GARANCIA
- Dell Latitude 7490 FHD, TOUCH, i5-8350U, 8GB DDR4, 256GB SSD, AAM SZÁMLA, 1ÉV GARANCIA!
- Acer Predator Helios Neo 18 újszerű, garanciás erőgép
- Telefon felvásárlás!! Honor 90 Lite/Honor 90/Honor Magic5 Lite/Honor Magic6 Lite/Honor Magic5 Pro
- iPhone 13 128GB Red-1 ÉV GARANCIA - Kártyafüggetlen, MS4593, 100% Akkumulátor
- Alienware 17r4 olvass
- ÁRGARANCIA!Épített KomPhone Ryzen 5 7600X 32/64GB RAM RTX 5060 Ti 16GB GAMER PC termékbeszámítással
- Dell Latitude 7390 13,3" FHD IPS, i5-i7, 8-16GB RAM, SSD, jó akku, számla, 6 hó gar
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest
