

Then you'll have pretty much all the knowledge you need to rewrite the program in C#. If you don't already know what each function in the Python code does, look it up, and anything you find that you don't know the C# equivalent for, also look that up. You just need to learn C#'s basic syntax then look up the standard functions for generating random numbers, printing text, and getting user input. Fortunately, this is a decently simple program, so it shouldn't take too long once you have a few things figured out. So your best option is to port the program from Python to C# by hand. Olá, sou um principiante na linguagem Python e estou com dificuldade para converter este código para o Python.

Even if someone did put in the time to do that, the compiler would probably not generate C# code that's very human-friendly. Publicado 6 de Novembro de 2019 às 16:54. Convert code from one programming language to another in just a click of a button. Writing a program to do that automatically for every common Python function would be quite a big undertaking, and there's probably not enough demand for anyone to put in the effort.

The two languages provide different standard functions, so you'd either need to implement the necessary Python functions in C#, or rewrite the code in idiomatic C#. Porting code from Python to C# isn't as simple as changing all the Python syntax to C# syntax. I kinda doubt that anyone's made a good Python to C# compiler.
