Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
a coding challenge
#1
this is my coding challenge for July 2019. it qualifies to work if it runs correctly on at least one of the following versions of Python: 2.6.x, 2.7.x, 3.4.x, 3.5.x, 3.6.x, 3.7.x

code the smallest possible script that prints an exact copy of its own source code without reading any files.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
Got it:


Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#3
I could only get my version down to two lines which is twice the size of ichabod801's
 
 
Reply
#4
SyntaxError: invalid syntax
Output:
SyntaxError: invalid syntax
Reply
#5
  File "foo.py", line 1
    File "foo.py", line 1
    ^
IndentationError: unexpected indent
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#6
I tested mine in 2.7 and it worked.
Craig "Ichabod" O'Brien - xenomind.com
I wish you happiness.
Recommended Tutorials: BBCode, functions, classes, text adventures
Reply
#7
i'm sure many of them work. i was trying to make a larger file. i osed the method of replacing the code with the output after it was run and did that a few times, checking that it wasn't alternating (a outputs b, b outputs a) and was the same each cycle. i posted what it converged to. i could change the file name in it.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#8
a more difficult problem: your code should output "BREAKING NEWS! WORLD ENDS!" at the end of the source it outputs.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need a challenge? sparkz_alot 5 5,133 Nov-06-2016, 04:06 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020