Ú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
- Dell Latitude 5330 /i5-1245u/16GB/256GB SSD/13.3" FHD laptop
- HP Omen 15 ( i7 6th, 8 GB, 240 SSD, 4GB Gef960) AkciÓÓ!
- Logitech MX Keys Mini for Mac - német - bontatlan
- 15.gen! Intel Core ULTRA 9 285K (24mag!) +32GB DDR5 kit +ASROCK Z890 PRO-A! GAR/SZÁMLA (Te nevedre)!
- ASUS TUF Gaming GeForce RTX 3080 10GB OC GDDR6X 320bit LHR dobozos, 1 tulajos, 2027.07.04-ig gari
- DELL LATITUDE 7330 /i5-1245U/16GB/256 GB SDD/13.3/FHD/IPS/Garancia/
- GYÁRI TÖLTŐK: USB-C / DELL / LENOVO / HP / FUJITSU / TOSHIBA / Asus / Macbook /// Bp,/MPL/Foxpost
- AKCIÓ! MSI Thin 15 B13UC FHD GAMER notebook - i5 13420H 16GB DDR4 512GB SSD RTX 3050 4GB WIN11
- 261 - Lenovo LOQ (17IRX10) - Intel Core i7-14700HX, RTX 5070
- Steelseries Arctis Nova 1 gamer fejhallgató
Állásajánlatok
Cég: Laptopműhely Bt.
Város: Budapest

