Tutor profile: Stefan P.
Subject: Python Programming
How would you recognize a Python 2.7 program from a Python 3.x program? What would be the easiest way to transform the following list a=["1","3","4","7","10"] into a list of integers, where each integer is doubled compared to the original list.
1st question: The common difference is that the print function, which is now called like `print(args)` instead of `print args` which was previously acceptable in 2.7. In addition, reading from standard input is now done through input() instead of raw_input(). The shebang line might also tell you if it's a Python3 or Python2.7 program. There are other many differences too, but these are the most common. 2nd question: list(map(lambda x: int(x)*2,a))
Subject: Perl Programming
How do you use the concept of namespace in Perl5 ? What main operations can be done with a package in Perl5?
You would use the package keyword in a separate file and all functions in that file will be addressed using that package. The main operations that a namespace in Perl5 supports are exporting symbols (a function for example). Programs can import these symbols from a package, in order to use them without writing the package name, instead only writing the symbol name when calling that symbol.
You're trying to store in a database students and courses. You also want to store in your database which student is enrolled in which courses. What tables would you need, and what relationships are needed between them?
You'd want three tables: - students - courses - enrollment While the first two would contain information about the students and the courses, the enrollment table should contain at least two columns, one column being the student_id, and another with the course_id. A row present in the enrollment table will mean that the student with id equal to student_id is enrolled in the course with the id equal to course_id.
needs and Stefan will reply soon.