The last challenge had more entries fail than succeed, which shows that the challenge was harder than it looks. User input is a pain. I recommend everyone go try that just for the experience of the hell of dealing with users. Interestingly, the best user is a programmer, so it was actually unfair for me to test. I am sure I could find an average person to crash each one of the "working" versions and take the entire operating system with it, however, I cannot be that clueless.
Here is the last challenge: http://ubuntuforums.org/showthread.php?t=881152
For this one, I ask non beginners to not give solutions that give away too many hints to those trying.
Now that we dealt with user input, lets deal with program output. All put output to a prompt or in one case a GUI. Lets put somethings out to files. While we are at it, lets read from files also.
This is important! Follow the following instructions to the letter
Make a file named "bhaarat.text" with this content:
Write a program that reads this file, and takes the languages that begin with "H" or "S" and writes them to another file, named "out.text". The output can be more flexible. It can be one line (with spaces between names) or on a new line. I don't want the original numbers, but extra credit goes to those who number the lines correctly (begin with 0, if you are a geek)Code:1. Assamese/Asomiya 2. Bengali/Bangla 3. Bodo 4. Dogri 5. Gujarati 6. Hindi 7. Kannada 8. Kashmiri 9. Konkani 10. Maithili 11. Malayalam 12. Manipuri 13. Marathi 14. Nepali 15. Oriya 16. Punjabi 17. Sanskrit 18. Santhali 19. Sindhi 20. Tamil 21. Telugu 22. Urdu
Then have this program write "23. English" to the end to continue the list in bhaarat.text.
- Read bhaarat.text and read the language names beginning with an "S" or "H", and write them (only the language names!) to a file named out.text
- Output can be flexible, however, it cannot include the original numbers and some sort of whitespace should separate the words (newlines if you are going for extra credit). Extra credit for correctly numbered lines.
- The language "English" and its number and period is then added to the original file in continuation of the list.
- Line numbers in output
- Use of the native script for (any) languages (shows unicode support). You can get the script for Hindi from its wikipedia page. Either version will work. I will be using gedit, unicode enabled for reading with standard packages.
Do not copy code, but you can obviously read it
Try not to comment on other submissions. It will be hard to judge changing entries. If you edit your code, post the new version and make it clear there is a new code.
How it will be judged
This task is very technical. There is no user input to deal with, and I will be using the correct file, so feel free to exclude error handling, unless you forsee errors.
- It has to do what it is specified.
As before, try to follow the following (although I think it won't come down to judging on this, as the challenge will be tricky for beginners):
- Clean code. Readable code is a must for being a programmer who wishes to possibly interact with others. Some languages can be more readable than others, so it will be judged on the effort of writing clean code, not which language is easier to read by design.
- Logical code. Be a programmer, not a code monkey
- Commented code. If something is possibly unclear (like an obscure use of math), let the readers know. Do not over comment, and let the code speak for itself whenever you can. Have logical variable names and function names. (Excessive commenting is a minus factor)
- Working code. It has to work as it is posted. The codw will be read on the forum, so remember to use this guide to paste code if you don't know how: http://ubuntuforums.org/showthread.php?t=606009
- Most languages have all the functions you need to do this, so explore standard libraries.
- You will have to readlines (hint, that is the name of the function you may be using in the std lib), and writelines. Also, you will be getting rid of line numbers, so you'll have to deal with string functions or regular expressions (Python users, split() will do this for you with no problem, explore it)
- Using this challenge to try out a new language brings you bonus points, so please state when you are using the language for the first time if you are.