Question: Please help turn this source code into a working python program, I dont want modules, i want the whole program in one file: no functions

 Please help turn this source code into a working python program, I dont want modules, i want the whole program in one file: no functions please?

I was having errors with the indents?

 

 catC_multiplier, catN_multiplier, catI_multiplier = get_multipliers()
      initialize_report()

       more = input("Input 'y' to enter more donations: ")
       while more.lower() == 'y':
      proc_donations(catC_multiplier, catN_multiplier, catI_multiplier)
      more = input("Input 'y' to enter more donations: ")

      calc_avg()
      display_summary()

   initialize_report():
       global donor_count, catC_tot, catN_tot, catI_tot, largest_donation
       donor_count = catC_tot = catN_tot = catI_tot = largest_donation = 0

    get_multipliers():
   catC_multiplier = float(input("Enter the multiplier for category C: "))
   catN_multiplier = float(input("Enter the multiplier for category N: "))
   catI_multiplier = float(input("Enter the multiplier for category I: "))
   return catC_multiplier, catN_multiplier, catI_multiplier

   proc_donations(catC_multiplier, catN_multiplier, catI_multiplier):
   donation_code = input("Enter donation code: ")
   cat_code, pre_match_donation = decode_donation(donation_code)
   category, donation = category_assignments(cat_code, pre_match_donation, catC_multiplier, catN_multiplier, catI_multiplier)
 
  global donor_count
  donor_count += 1
 
  update_largest_donation(category, donation)
  display_details(category, donation)

    decode_donation(donation_code):
  cat_code = donation_code[0]
  pre_match_donation = float(donation_code[1:])
  return cat_code, pre_match_donation

   category_assignments(cat_code, pre_match_donation, catC_multiplier, catN_multiplier, catI_multiplier):
  if cat_code == 'C':
      category = "Classical"
      donation = pre_match_donation * catC_multiplier
      global catC_tot
      catC_tot += donation
  elif cat_code == 'N':
      category = "News"
      donation = pre_match_donation * catN_multiplier
      global catN_tot
      catN_tot += donation
  elif cat_code == 'I':
      category = "Indie"
      donation = pre_match_donation * catI_multiplier
      global catI_tot
      catI_tot += donation
  else:
      print("Error: Unknown category code.")
      category = "Unknown"
      donation = 0
  return category, donation

   update_largest_donation(category, donation):
  global largest_donation, cat_largest_donation
  if donation > largest_donation:
      largest_donation = donation
      cat_largest_donation = category

    display_details(category, donation):
  print(f"Category: {category}, Donation: {donation}")

   calc_avg():
  global avg_donation
  avg_donation = (catC_tot + catN_tot + catI_tot) / donor_count

   display_summary():
  print(f"Average Donation: {avg_donation}")
  print(f"Total Classical Donations: {catC_tot}")
  print(f"Total News Donations: {catN_tot}")
  print(f"Total Indie Donations: {catI_tot}")
  print(f"Largest Donation: {largest_donation} in category: {cat_largest_donation}")

Step by Step Solution

3.27 Rating (153 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Certainly Heres the modified code that combines all the components into a single Python file python catCmultiplier catNmultiplier catImultiplier 0 0 0 ... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!