![]() |
|
![]() |
|
|
Thread Tools | Display Modes |
|
|
#1 |
|
Programming Guru
![]() |
Python Contest #2
- Hall of Fame -
sykkn - 76 Points - Gold Medal thechristelegacy - 72 Points - Silver Medal al1986 - 68 Points - Bronze Medal Sane - 64 Points Ooble - 51 Points - Rules - Contest closes next Sunday. Use whatever resources you want, just don't post the answers here. PM them to me and I'll update the standings ASAP. You can send in as many submissions as you wish. - Challenge - This is a bit trickier, as I want a definitely replicated result, no room for fluxuations on the output. The winner will be the one with the least amount of lines, but a tie breaker will be decided by the number of characters. (1) 6 Even (2) 0 Even (3) 5 Odd (4) 0 Even (5) 4 Even (6) 9 Odd (7) 8 Even (8) 9 Odd (9) 4 Even (10) 4 Even Average: 4.9 Odd You have to be able to change the length of outputs with a single variable change (to prevent making a manual loop into one line of code). Just for clarification, the program outputs x amount of random integer values between 1 and 10. Lists if it is even/odd. Prints the average at the end in 1 decimal place float, and if it is even or odd (rounded up if >.4, rounded down if <.5). This time, include declaring the variables as part of the program. Good Luck Last edited by Sane; Apr 17th, 2005 at 4:54 PM. |
|
|
|
|
|
#2 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Can we say no semicolons - every statement must be on a separate line?
|
|
|
|
|
|
#3 |
|
Programming Guru
![]() |
We might try that later, but for now it's still challenging enough to get it minimal with semi-colons.
|
|
|
|
|
|
#4 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
What about whitespace? Does x = x + 1 count as 5 characters, or 3?
|
|
|
|
|
|
#5 |
|
Expert Programmer
|
Could someone clarify what's being asked here? I'm a bit confused on what we're suposed to do.
|
|
|
|
|
|
#6 |
|
Programming Guru
![]() |
Nope spaces don't count.
Legacy, I said already: The output of the program will be: (1) 6 Even (2) 0 Even (3) 5 Odd (4) 0 Even (5) 4 Even (6) 9 Odd (7) 8 Even (8) 9 Odd (9) 4 Even (10) 4 Even Average: 4.9 Odd Where: The program outputs x amount of random integer values between 1 and 10. Lists if it is even/odd. Then at the end, prints the average in 1 decimal place float, and if it is even or odd (rounded up if >.4, rounded down if <.5). You have to be able to change the length of outputs with a single variable change (to prevent making a manual loop into one line of code). |
|
|
|
|
|
#7 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Oh, and one more thing - about line breaks: if I replace every line break I can with a semicolon, I remove around three-quarters of them. Does this mean I get more points?
|
|
|
|
|
|
#8 |
|
Programming Guru
![]() |
Semi-colons are equivelent to line breaks. So if you take a 20 line print program, and change it to 1 line with semicolons dividing all the print lines, it's still worth the same. However, for this challenge lines are the only thing that matters unless a tie.
|
|
|
|
|
|
#9 |
|
Programmer
Join Date: Feb 2005
Posts: 54
Rep Power: 4
![]() |
I know that counting lines is an easy way to compare programs, but shouldn't a program be judged by something a little more meaningful? How about we try to come up with a program that does not swallow all my memory, that doesn't crash at the first sign of trouble, and doesn't take ten years to come up with an answer. Then, all things being equal, the simplest program wins!
|
|
|
|
|
|
#10 |
|
I eat cake for breakfast.
![]() ![]() ![]() ![]() Join Date: Jul 2004
Location: In my box.
Posts: 4,434
Rep Power: 9
![]() |
Heh. I would say the number of clock cycles the program takes would be an accurate method of measuring it. Or perhaps the number of instructions it contains?
|
|
|
|
![]() |
| Bookmarks |
| Currently Active Users Viewing This Thread: 1 (0 members and 1 guests) | |
| Thread Tools | |
| Display Modes | |
|
|