SlideServe
Menu
Préférences
© SlideServe · v2026

C# and Python

ray avatar
7 diapositives · 338 Views · Jul 26, 2014

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

C# and Python - slide 1
01 / 7C# and Python
1 / 17

Télécharger la présentation

C# and Python
Une image / un lien ci-dessous est fourni (tel quel) pour télécharger la présentation

Politique de téléchargement : le contenu du site vous est fourni TEL QUEL pour votre information et votre usage personnel ; il ne peut être vendu, concédé sous licence ni partagé sur d’autres sites sans l’accord de son auteur.Le contenu vous est fourni TEL QUEL, pour votre information et votre usage personnel uniquement. Téléchargez la présentation en cliquant sur ce lien. Lors du téléchargement, si vous ne parvenez pas à télécharger une présentation, l’éditeur a peut-être supprimé le fichier de son serveur.Pendant le téléchargement, si vous ne parvenez pas à obtenir une présentation, le fichier a peut-être été supprimé par l’éditeur.

F I N

Plus de contenu associé

Transcription de la présentation
  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