1 / 7

C# and Python

CS Final Project 2010 Rohan Paramesh. C# and Python. The Programs. Implementing 3 programs each in C# and Python Student Scheduler Assigns courses and students, sorts according to different criteria Twenty Questions

ray
Download Presentation

C# and Python

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. CS Final Project 2010 Rohan Paramesh C# and Python

  2. The Programs • Implementing 3 programs each in C# and Python • Student Scheduler • Assigns courses and students, sorts according to different criteria • Twenty Questions • A binary tree of QuestionNodes that writes out to and reads from a text file • Towers of Hanoi • Recursively provides a solution to the puzzle

  3. C# • Microsoft’s current language • Compiled • Java-like • Syntax • Logic • An atmosphere of whatever Java got wrong is fixed in C#

  4. Python • Guido van Rossum • Emphasis on readability • Significant differences • Logic • Style • Syntax • Very popular nowadays with amateur developers and some large companies • Google

  5. Towers of Hanoi Java C# public static void solveHanoi(int disks, int from, int other, int to) { if (disks <= 0) return; solveHanoi(disks-1, from, to, other); System.out.println("Move disk " + disks + " from pole " + from + " to pole " + to + "."); moves++; solveHanoi(disks-1, other, from, to); } public static void SolveHanoi(int disks, int from, int other, int to) { if (disks <= 0) return; SolveHanoi(disks - 1, from, to, other); Console.WriteLine("Move disk " + disks + " from pole " + from + " to pole " + to + "."); moves++; SolveHanoi(disks - 1, other, from, to); }

  6. Towers of Hanoi Java Python public static void solveHanoi(int disks, int from, int other, int to) { if (disks <= 0) return; solveHanoi(disks-1, from, to, other); System.out.println("Move disk " + disks + " from pole " + from + " to pole " + to + "."); moves++; solveHanoi(disks-1, other, from, to); } def solve_hanoi(disks, start, other, dest): '''The main recursive method that solves the Tower of Hanoi puzzle. This method calls itself and also increments the number of moves. disks -- the number of disks (integer) start -- the starting peg (determined by class constant) other -- the intermediate peg dest -- the destination peg ''' if (disks <= 0): return solve_hanoi(disks-1, start, dest, other) print "Move disk ", disks, " from pole ", start, " to pole ", dest, "." global moves moves += 1 solve_hanoi(disks-1, other, start, dest)

  7. Comparison • Scope • Methods and Parameters • Types • Compiled vs. Interpreted • I/O • Freedom/Restrictions • Accuracy • Readability

More Related