【问题标题】:A problem with output of the program [estimated end of pandemic]. PLEASE HELP ME OUTA problem with output of the program [estimated end of pandemic]. PLEASE HELP ME OUT
【发布时间】:2022-12-02 13:09:08
【问题描述】:

I used mathemetical formula to calculate estimated number of weeks for an end of pandemic with respect to countries\' data. It was supposed to be harmonic sequence that accounts uncertainty, vaccinated people and vaccine per 100 people. The output for all countries is the same which concerns me. I understand that my formula might be wrong, so please help me fixing this problem

def statistica():
    country = input(\'Which country you are from? \')
    infected_per_week = 0

    #infected per day to find the uncertainty for parameters
    infected_per_day = 0 

    #last week average to find difference
    infected_last_week = 0 

    #Total vaccine doses administered per 100 population
    vaccine = 0 

    #Persons fully vaccinated with last dose of primary series per 100 population
    vaccinated = 0 

    #population of the country
    population1 = 0 

    if country == \'Republic of Korea\' or \'Korea\' or \'South Korea\':
        population1 += 52000000
            infected_per_week += 376590
            vaccinated += 87166
            vaccine += 257
            infected_per_day += 71476
            infected_last_week += 373681
        elif country == \'Brazil\':
            population1 = population1 + 527000000
            infected_per_week += 177052
            vaccinated += 78932
            vaccine += 230
            infected_per_day += 39083
            infected_last_week += 153292
    
    
    
    average = int(infected_per_week / 7)
    uncertainty = average - infected_per_day
      difference = (1 - (int(infected_last_week / 7) * int(average))) / (int(average))
      not_vaccinated = 100000 - vaccinated
      all_not_vaccinated = population1 * (not_vaccinated / 100000)
      vaccine_for_all = all_not_vaccinated / (vaccine / 100)
  
    n_term_pos_unc = ((all_not_vaccinated - (infected_last_week/7) + uncertainty + difference) / (-difference))
      n_term_neg_unc = ((all_not_vaccinated - (infected_last_week/7) - uncertainty + difference) / (-difference))
      n_term_neg_unc_vacc = ((all_not_vaccinated - (infected_last_week/7) - uncertainty + difference - vaccine_for_all) / (-difference))
      n_term_pos_unc_vacc = ((all_not_vaccinated - (infected_last_week/7) + uncertainty + difference - vaccine_for_all) / (-difference))
      return n_term_pos_unc, n_term_neg_unc, n_term_pos_unc_vacc, n_term_neg_unc_vacc

a = statistica()
print(a)
  • That\'s not how the or operator works. You need if country in (\"Republic of Korea\", \"Korea\", \"South Korea\"):.

标签: python function formula sequence add


【解决方案1】:
猜你喜欢
  • 2022-12-28
  • 2022-12-02
  • 2022-12-02
  • 2022-12-27
  • 2022-12-02
  • 2022-12-01
  • 1970-01-01
  • 2022-12-02
  • 1970-01-01
相关资源
最近更新 更多