Jump to content

1 to 10 challenge

When I was learning php I was trying some for-loop constructions to make the computer write "1 2 3 4 5 6 7 8 9 10", then I thought, what is the most difficult and clumsy way to make a computer write "1 2 3 4 5 6 7 8 9 10"? Challenge for you guys: write some very clumsy code to make the computer say "1 2 3 4 5 6 7 8 9 10" as in the first picture, only using html, javascript and/or php!

 

you can see my try in the second image

1to10.png

1to10code.png

 "Aeneas troianus est."

I'm allergic to social interaction in real life, don't talk to me in real life please.

don't forget to quote or tag (@marten.aap2.0) me when you reply!

Link to comment
Share on other sites

Link to post
Share on other sites

You could just use echo inside the for loop.

PC: Case: Cooler Master CM690 II - PSU: Cooler Master G650M - RAM: Transcend 4x 8Gb DDR3 1333Mhz - MoBo: Gigabyte Z87x-D3H - CPU: i5 4670K @ 4.5Ghz - GPU: MSI GTX1060 ARMOR OC - Hard disks: 4x 500Gb Seagate enterprise in RAID 0 - SSD: Crucial M4 128Gb

Phone: Samsung Galaxy S6

Link to comment
Share on other sites

Link to post
Share on other sites

<html>
  <body>
    <p>
        <?php
	for($i = 0; $i<10;$i++) 
	    echo ($i . " ");
        ?>
    </p>
  </body>
</html>

 

PC: Case: Cooler Master CM690 II - PSU: Cooler Master G650M - RAM: Transcend 4x 8Gb DDR3 1333Mhz - MoBo: Gigabyte Z87x-D3H - CPU: i5 4670K @ 4.5Ghz - GPU: MSI GTX1060 ARMOR OC - Hard disks: 4x 500Gb Seagate enterprise in RAID 0 - SSD: Crucial M4 128Gb

Phone: Samsung Galaxy S6

Link to comment
Share on other sites

Link to post
Share on other sites

Just now, LUUD18 said:

<html>
  <body>
    <p>
      <?php
		for($i = 0; $i<10;$i++) 
			echo ($i . " ");
		?>
    </p>
  </body>
</html>

 

that should work too indeed, but is less clumsy, I want to find the most clumsy way of doing it. (I'll post my javascript try in just a minute)

 "Aeneas troianus est."

I'm allergic to social interaction in real life, don't talk to me in real life please.

don't forget to quote or tag (@marten.aap2.0) me when you reply!

Link to comment
Share on other sites

Link to post
Share on other sites

Oh allright I thought the most smallest :)

 

PC: Case: Cooler Master CM690 II - PSU: Cooler Master G650M - RAM: Transcend 4x 8Gb DDR3 1333Mhz - MoBo: Gigabyte Z87x-D3H - CPU: i5 4670K @ 4.5Ghz - GPU: MSI GTX1060 ARMOR OC - Hard disks: 4x 500Gb Seagate enterprise in RAID 0 - SSD: Crucial M4 128Gb

Phone: Samsung Galaxy S6

Link to comment
Share on other sites

Link to post
Share on other sites

I reject your languages and substitute best language.

 

print((lambda s: f"{' '.join(s[:-2])} {s[-2:]}")(__import__('pytesseract').image_to_string(__import__('PIL').Image.open(__import__('io').BytesIO(__import__('requests').get('https://linustechtips.com/main/uploads/monthly_2017_08/1to10.png.e49e4e83ff2a738a8fc08eddde33e9dc.png').content)))))

 

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

I reject your languages and substitute adequate language:

(loop for i from 1 to 10 do (format t "~D " i))

"Smallest", you say?

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

^ That would be just

"1 2 3 4 5 6 7 8 9 10"

in that adequate language. Your language is bloat.

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

2 minutes ago, Dat Guy said:

 


"1 2 3 4 5 6 7 8 9 10"

 

Ha, quotes?

1 2 3 4 5 6 7 8 9 10

compiled with g++. Whos language is bloated now?

1474412270.2748842

Link to comment
Share on other sites

Link to post
Share on other sites

2 hours ago, marten.aap2.0 said:

(I'll post my javascript try in just a minute)

got interrupted and can't get my idea to work, maybe I'll post something in javascript later

 "Aeneas troianus est."

I'm allergic to social interaction in real life, don't talk to me in real life please.

don't forget to quote or tag (@marten.aap2.0) me when you reply!

Link to comment
Share on other sites

Link to post
Share on other sites

Pretty sure Javascript has a "CountFromOneToTen" module in npm. 9_9

Write in C.

Link to comment
Share on other sites

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×