answersLogoWhite

0


Best Answer

try using a never ending looping statement

(I know that I need a while/for loop, but I don't know how to assign variables to a randomly generated string)

User Avatar

Wiki User

βˆ™ 13y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How can you create infinite instances of the same class using Python?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

What are factory methods in java?

A factory class is any class which is used to create instances of other classes. The methods which create those classes are the factory methods. For example, the BorderFactory class has a variety of methods for creating instances of the different types of the Border classes. BorderFactory.createEmptyBorder(); BorderFactory.createEtchedBorder(); ...


Is python a case sensitive language?

Yes. For instance, you can write: x=2 X='a string' If you now print each of these variables you will find that they have retained the values that you assigned to them. Very often programmers create classes with uppercase names then use the lowercase version of the same name for instances of the class. This is possible because Python is case sensitive.


What is need for static method?

Static methods are methods that can be invoked without creating an instance of the class that contains them. They are needed in cases where the programmer would not want to create multiple instances of a class to execute a method.


What is class variable?

Class Variables or Instances variables are variables that are declared inside a class and are available for the whole class. They are available for all instances of that class and are not specific to any method. Ex: public class Test { private String name = "Rocky"; } Here name is a class variable.


How you declare class scoped variables and member functions?

To scope class members to the class (rather than to instances of the class), declare them as static members of the class. Static members are accessible even when no instances of the class exist. As such, static member functions do not have access to a 'this' pointer, unlike ordinary (nonstatic) member functions.

Related questions

What are factory methods in java?

A factory class is any class which is used to create instances of other classes. The methods which create those classes are the factory methods. For example, the BorderFactory class has a variety of methods for creating instances of the different types of the Border classes. BorderFactory.createEmptyBorder(); BorderFactory.createEtchedBorder(); ...


Is python a case sensitive language?

Yes. For instance, you can write: x=2 X='a string' If you now print each of these variables you will find that they have retained the values that you assigned to them. Very often programmers create classes with uppercase names then use the lowercase version of the same name for instances of the class. This is possible because Python is case sensitive.


What is the purpose of a class attribute?

A class attribute is a variable that is shared by all instances of the class. It is used to store data that is common to all instances of the class, rather than specific to each instance. This can help avoid redundancy and ensure consistency across all instances.


What is need for static method?

Static methods are methods that can be invoked without creating an instance of the class that contains them. They are needed in cases where the programmer would not want to create multiple instances of a class to execute a method.


Is String are instances of the class string?

yes


What is factory methods?

Factory methods are merely a convention whereby static methods in a class return an instance of that class. The InetAddress class has no visible constructors. In InetAddress the 3 factory methods getLocalHost, getByName, getAllByName can be used to create instances of InetAddress.


What class or family does a python belong to?

Reptiles. I promise this is the correct answer.


What is class variable?

Class Variables or Instances variables are variables that are declared inside a class and are available for the whole class. They are available for all instances of that class and are not specific to any method. Ex: public class Test { private String name = "Rocky"; } Here name is a class variable.


How you declare class scoped variables and member functions?

To scope class members to the class (rather than to instances of the class), declare them as static members of the class. Static members are accessible even when no instances of the class exist. As such, static member functions do not have access to a 'this' pointer, unlike ordinary (nonstatic) member functions.


What is the application of static?

Static can be used in programming to define variables or methods that belong to the class itself, rather than to instances of the class. This allows for shared data among all instances of the class. Static variables and methods can be accessed without creating an instance of the class.


Why do you need a constructor as a class member?

A constructor is not a mandatory member that we need to code specifically for a class. While creating a class, even if we miss out coding the constructor, Java would create a default constructor all by itself. The constructor is usually the place where we initialize things that are required by the class. Hence it is a good practice to code the constructor for our class. Tip: If you do not want anyone to instantiate your class, you can declare the constructor as private. In that way no other class can instantiate your class.


What is difference between an instance variable and a class variable?

An instance variable is typically associated with an object instance of the class whereas class variable is not associated with any object instance. Static variables are referred to as class variables while non-static regular variables are called instance variables. Simply put, you will have as many instances of the instance variable as there are object instances. i.e., if there are 10 instances of an object, you will have 10 instances of that instance variable as well. But, there will be only one instance of the static or class variable. Instance variables are accessed as follows: objname.variableName; Class variables are accessed as follows: ClassName.variableName;