from otree.api import ( models, widgets, BaseConstants, BaseSubsession, BaseGroup, BasePlayer, Currency as c, currency_range ) doc = 'Survey' class Constants(BaseConstants): name_in_url = 'ABE' players_per_group = None num_rounds = 1 class Subsession(BaseSubsession): def my_method(self): pass class Group(BaseGroup): pass class Player(BasePlayer): Age = models.IntegerField(label='Age') Question_2 = models.StringField(choices=[["BYJU'S", "BYJU'S"], ['Dream 11', 'Dream 11'], ['VIVO', 'VIVO'], ['Paytm', 'Paytm']], label='Which country is the title sponsor of Indian Cricket Team?', widget=widgets.RadioSelect) Question_3 = models.StringField(choices=[['The United States of America', 'The United States of America'], ['Japan', 'Japan'], ['Germany', 'Germany'], ['Italy', 'Italy']], label='Volkswagen is a company based in:', widget=widgets.RadioSelect) Question_4 = models.StringField(choices=[['Xiaomi', 'Xiaomi'], ['Nokia', 'Nokia'], ['Asus', 'Asus'], ['Lenovo', 'Lenovo']], label='Redmi is a model of smartphone manufactured by:', widget=widgets.RadioSelect) Question_5 = models.StringField(choices=[['The United States of America', 'The United States of America'], ['India', 'India'], ['Brazil', 'Brazil'], ['Mexico', 'Mexico']], label='Which country is second worst hit by COVID-19?', widget=widgets.RadioSelect) Randomization = models.StringField(choices=[['Yes', 'Red'], ['No', 'Blue']], label='Choose one color between the following two:', widget=widgets.RadioSelectHorizontal) treatment_group = models.StringField() Preference1 = models.StringField(label='Rank the luxury SUVs in order of your buying preference. A) Hyundai Tucson B) Toyota Fortuner C) Mitsubishi Outlander D) Chevrolet Captiva') Preference2 = models.StringField(label='Rank the Air Conditions in order of your buying preference. A) Lloyd B) General Electric C) Voltas D) Videocon ') Preference3 = models.StringField(label='Rank the Toy making companies in order of your buying preference. A) Funskool B)\tMasoom Playmates C) MT Toys D) Fisher Price ') Preference4 = models.StringField(label='Rank the E-commerce site from which you buy in order of preference. A) Myntra B) Shopclues C) Club Factory ( D) TATA cliq ') color = models.StringField() Code = models.StringField(label='Please enter your code here:') def my_method2(self): import itertools treatment_groups = itertools.cycle(['R','B']) for p in self.get_players(): p.Randomization = next(treatment_groups)