我正在尝试将以下 Java 代码片段转换为 Python。有人可以帮我解决这个问题。我是 Python 新手。
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中实现。我正在寻找代码片段...谢谢