我想將下面的Java代碼片段轉換爲Python。有人能幫我解決這個問題嗎?我是Python的新手。在Python中實現Java對象創建
Java代碼:
public class Person
{
public static Random r = new Random();
public static final int numFriends = 5;
public static final int numPeople = 100000;
public static final double probInfection = 0.3;
public static int numInfected = 0;
/* Multiple experiments will be conducted the average used to
compute the expected percentage of people who are infected. */
private static final int numExperiments = 1000;
/* friends of this Person object */
private Person[] friend = new Person[numFriends]; ----- NEED TO REPLICATE THIS IN PYTHON
private boolean infected;
private int id;
我試圖複製在上面的標記線成Python同樣的想法。有人可以轉換「私人人物[]朋友=新人[numFriends];」實現成python。我正在尋找一個代碼片段...謝謝
你的問題是什麼?這是一個問答網站。 – 2013-01-13 20:15:13
你能告訴我什麼是java代碼中標記行的Python中聲明的等效語法。 – CarbonD1225