title: How To Create A Table in Python
body: <p>I've posted this before, but I'm reposting it with more detailed information. </p>
  
  <p>This is my assignment:
  <a href="https://i.stack.imgur.com/5nNfk.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/5nNfk.png" alt="enter image description here"></a></p>
  
  <p><a href="https://i.stack.imgur.com/ZtfrW.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZtfrW.png" alt="enter image description here"></a></p>
  
  <p>And, so far, this is my code:</p>
  
  <pre><code># Define a function that caculates average test scores
  def calculate_average(score1, score2, score3, score4, score5):
      total = score1 + score2 + score3 + score4 + score5
      average = total % 5
      print(average)
  
  # Define a function that determines a letter grade
  # Based on the given score
  def determine_grade(score):
      if score &lt; 60:
          print 'F'
      elif score =&gt; 60 or score &lt;= 69:
          print 'D'
      elif score =&gt; 70 or score &lt;= 79:
          print 'C'
      elif score =&gt; 80 or score &lt;= 89:
          print 'B'
      elif score =&gt; 90 or score &lt;= 100:
          print 'A'
  # Define a function that prompts the user to input names and test scores
  def input_data():
      score1 = input('Enter score 1:')
      name1 = input('Enter name 1:')
      score2 = input('Enter score 2:')
      name2 = input('Enter name 2:')
      score3 = input('Enter score 3:')
      name3 = input('Enter name 3:')
      score4 = input('Enter score 4:')
      name4 = input('Enter name 4:')
      score5 = input('Enter score 5:')
      name5 = input('Enter name 5:')
  
  
  # Define a function that displays a letter grade for each score
  # followed by the student's name and the average test score
  def display_menu():
  </code></pre>
  
  <p>As I said in the first post, I don't have a real problem with anything except setting up that table. I'm really confused!</p>
  
  <p>I asked my instructor (this is an online course, BTW), and he said: "Its just using the print operator, like you have done in previous modules, your printing text , variables and the return value of a function."</p>
  
  <p>Now I'm just wondering where to start.</p>
  
  <p><strong>EDIT:</strong> I've updated my code this:</p>
  
  <pre><code># Define a function that prompts the user to input names and test scores
  def input_data():
      score1 = input('Enter score 1:')
      name1 = input('Enter name 1:')
      score2 = input('Enter score 2:')
      name2 = input('Enter name 2:')
      score3 = input('Enter score 3:')
      name3 = input('Enter name 3:')
      score4 = input('Enter score 4:')
      name4 = input('Enter name 4:')
      score5 = input('Enter score 5:')
      name5 = input('Enter name 5:')
  
  # Define a function that determines a letter grade
  # Based on the given score
  def determine_grade(score):
      if score &lt; 60:
          print ('F')
      elif 60 &lt;= score &lt;= 69:
          print ('D')
      elif  70 &lt;= score &lt;= 79:
          print ('C')
      elif 80 &lt;= score &lt;= 89:
          print ('B')
      elif 90 &lt;= score &lt;= 100:
          print ('A')
  
  # Define a function that caculates average test scores
  def calculate_average(score1, score2, score3, score4, score5):
      total = score1 + score2 + score3 + score4 + score5
      average = total / 5
      print(average)
  
  # Define a function that displays a letter grade for each score
  # followed by the student's name and the average test score
  def display_menu():
      for x in range(10):
          print("{:&lt;10}".format("{:0.1f}".format(x)), end='')
      print ("Name\t\t\tnumeric grade\t\tletter grade")
  print ("---------------------------------------------------------------")
  print ("%s:\t\t\t%f\t\t%s") % ('name1', 'score1', determine_grade)
  print ("%s:\t\t\t%f\t\t%s") % ('name2', 'score2', determine_grade)
  print ("%s:\t\t\t%f\t\t%s") % ('name3', 'score3', determine_grade)
  print ("%s:\t\t\t%f\t\t%s") % ('name4', 'score4', determine_grade)
  print ("%s:\t\t\t%f\t\t%s") % ('name5', 'score5', determine_grade)
  print ("---------------------------------------------------------------")
  </code></pre>
  
  <p>But when I run it:
  <a href="https://i.stack.imgur.com/ga6o8.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ga6o8.png" alt="enter image description here"></a></p>
  
  <p><strong>EDIT #2:</strong> This is my code currently:</p>
  
  <pre><code># Define a function that prompts the user to input names and test scores
  def input_data():
      score1 = input('Enter score 1:')
      name1 = input('Enter name 1:')
      score2 = input('Enter score 2:')
      name2 = input('Enter name 2:')
      score3 = input('Enter score 3:')
      name3 = input('Enter name 3:')
      score4 = input('Enter score 4:')
      name4 = input('Enter name 4:')
      score5 = input('Enter score 5:')
      name5 = input('Enter name 5:')
  
  # Define a function that caculates average test scores
  def calculate_average(score1, score2, score3, score4, score5):
      total = score1 + score2 + score3 + score4 + score5
      average = total / 5
      print(average)
  
  # Define a function that determines a letter grade
  # Based on the given score
  def determine_grade(score):
      if score &lt; 60:
          print ('F')
      elif 60 &lt;= score &lt;= 69:
          print ('D')
      elif  70 &lt;= score &lt;= 79:
          print ('C')
      elif 80 &lt;= score &lt;= 89:
          print ('B')
      elif 90 &lt;= score &lt;= 100:
          print ('A')
  
  
  
  # Define a function that displays a letter grade for each score
  # followed by the student's name and the average test score
  def display_menu():
     print ("Name\t\t\tnumeric grade\t\tlettergrade")
  print ("---------------------------------------------------------------")
  print ("%s:\t\t\t%f\t\t%s" % ('name1', 93, 'A'))
  print ("%s:\t\t\t%f\t\t%s" % ('name2', 89, 'B'))
  print ("%s:\t\t\t%f\t\t%s" % ('name3', 76, 'C'))
  print ("%s:\t\t\t%f\t\t%s" % ('name4', 58, 'F'))
  print ("%s:\t\t\t%f\t\t%s" % ('name5', 98, 'A'))
  print ("---------------------------------------------------------------")
  print (calculate_average)
  </code></pre>
  
  <p>And this is what happens when I run it:</p>
  
  <p><a href="https://i.stack.imgur.com/HTDSA.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/HTDSA.png" alt="enter image description here"></a></p>
  
  <p>Now, I have mainly two problems:</p>
  
  <p>1) How do I get the input statements to execute and enter the data BEFORE the table is displayed?</p>
  
  <p>2) How do I convert the numbers displayed so that they are in the '.2f' format? (I've already tried a few ways and none of them worked).</p>
  
  <p><strong>HOPEFULLY THE FINAL EDIT:</strong> I'm getting really close to the solution, but need help with a few more things. </p>
  
  <p>Here is my code:</p>
  
  <pre><code># Define a function that prompts the user to input names and test scores
  
  score = input('Enter score 1:')
  name1 = input('Enter name 1:')
  score = input('Enter score 2:')
  name2 = input('Enter name 2:')
  score = input('Enter score 3:')
  name3 = input('Enter name 3:')
  score = input('Enter score 4:')
  name4 = input('Enter name 4:')
  score = input('Enter score 5:')
  name5 = input('Enter name 5:')
  
  
  
  
  # Define a function that determines a letter grade
  # Based on the given score
  def determine_grade(score):
      if score &lt; 60:
          print ('F')
      elif 60 &lt;= score &lt;= 69:
          print ('D')
      elif  70 &lt;= score &lt;= 79:
          print ('C')
      elif 80 &lt;= score &lt;= 89:
          print ('B')
      elif 90 &lt;= score &lt;= 100:
          print ('A')
  
  determine_grade(score)
  
  
  # Define a function that caculates average test scores
  def calculate_average(score):
      total = score + score + score + score + score
      average = total / 5
      print(average)
  
  calculate_average(score)
  
  # Define a function that displays a letter grade for each score
  # followed by the student's name and the average test score
  def display_menu():
     print ("Name\t\t\tnumeric grade\t\tlettergrade")
  print ("---------------------------------------------------------------")
  print ("%s:\t\t\t%f\t\t%s" % ('name1', 'score', determine_grade('score')))
  print ("%s:\t\t\t%f\t\t%s" % ('name2', 'score', determine_grade('score')))
  print ("%s:\t\t\t%f\t\t%s" % ('name3', 'score', determine_grade('score')))
  print ("%s:\t\t\t%f\t\t%s" % ('name4', 'score', determine_grade('score')))
  print ("%s:\t\t\t%f\t\t%s" % ('name5', 'score', determine_grade('score')))
  print ("---------------------------------------------------------------")
  calculate_average(score)
  </code></pre>
  
  <p>And this is what happens when I press F5:</p>
  
  <p><a href="https://i.stack.imgur.com/Sv0Gh.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Sv0Gh.png" alt="enter image description here"></a></p>
  
  <p><strong>GUYS, I'M ALMOST DONE JUST NEED HELP WITH FORMATTING:</strong> 
  I created another file so I could reorganize my code a bit, so that's why there's no comments. This is what I have:</p>
  
  <pre><code>score1 = float(input('Enter score 1:'))
  name1 = input('Enter name 1:')
  score2 = float(input('Enter score 2:'))
  name2 = input('Enter name 2:')
  score3 = float(input('Enter score 3:'))
  name3 = input('Enter name 3:')
  score4 = float(input('Enter score 4:'))
  name4 = input('Enter name 4:')
  score5 = float(input('Enter score 5:'))
  name5 = input('Enter name 5:')
  
  
  def determine_letter_grade1(score1):
      if score1 &lt; 60.0:
          print ('F')
      elif 60.0 &lt;= score1 &lt;= 69.0:
          print ('D')
      elif  70.0 &lt;= score1 &lt;= 79.0:
          print ('C')
      elif 80.0 &lt;= score1 &lt;= 89.0:
          print ('B')
      elif 90.0 &lt;= score1 &lt;= 100.0:
          print ('A')
  
  def determine_letter_grade2(score2):
      if score2 &lt; 60.0:
          print ('F')
      elif 60.0 &lt;= score2 &lt;= 69.0:
          print ('D')
      elif  70.0 &lt;= score2 &lt;= 79.0:
          print ('C')
      elif 80.0 &lt;= score2 &lt;= 89.0:
          print ('B')
      elif 90.0 &lt;= score2 &lt;= 100.0:
          print ('A')
  
  def determine_letter_grade3(score3):
      if score3 &lt; 60.0:
          print ('F')
      elif 60.0 &lt;= score3 &lt;= 69.0:
          print ('D')
      elif  70.0 &lt;= score3 &lt;= 79.0:
          print ('C')
      elif 80.0 &lt;= score3 &lt;= 89.0:
          print ('B')
      elif 90.0 &lt;= score3 &lt;= 100.0:
          print ('A')
  
  def determine_letter_grade4(score4):
      if score4 &lt; 60.0:
          print ('F')
      elif 60.0 &lt;= score4 &lt;= 69.0:
          print ('D')
      elif  70.0 &lt;= score4 &lt;= 79.0:
          print ('C')
      elif 80.0 &lt;= score4 &lt;= 89.0:
          print ('B')
      elif 90.0 &lt;= score4 &lt;= 100.0:
          print ('A')
  
  def determine_letter_grade5(score5):
      if score5 &lt; 60.0:
          print ('F')
      elif 60.0 &lt;= score5 &lt;= 69.0:
          print ('D')
      elif  70.0 &lt;= score5 &lt;= 79.0:
          print ('C')
      elif 80.0 &lt;= score5 &lt;= 89.0:
          print ('B')
      elif 90.0 &lt;= score5 &lt;= 100.0:
          print ('A')
  
  average = (score1 + score2 + score3 + score4 + score5) / 5.0
  
  def determine_letter_grade_avg(average):
      if average &lt; 60.0:
          print ('F')
      elif 60.0 &lt;= average &lt;= 69.0:
          print ('D')
      elif  70.0 &lt;= average &lt;= 79.0:
          print ('C')
      elif 80.0 &lt;= average &lt;= 89.0:
          print ('B')
      elif 90.0 &lt;= average &lt;= 100.0:
          print ('A')
  
  def display_menu():
      for x in range(10):
          print("{:&lt;10}".format("{:0.1f}".format(x)), end='')
      print ("Name\t\t\tnumeric grade\t\tletter grade")
  print ("---------------------------------------------------------------")
  print ("%s:\t\t\t%f\t\t%s" % (name1, score1, determine_letter_grade1(score1)))
  print ("%s:\t\t\t%f\t\t%s" % (name2, score2, determine_letter_grade2(score2)))
  print ("%s:\t\t\t%f\t\t%s" % (name3, score3, determine_letter_grade3(score3)))
  print ("%s:\t\t\t%f\t\t%s" % (name4, score4, determine_letter_grade4(score4)))
  print ("%s:\t\t\t%f\t\t%s" % (name5, score5, determine_letter_grade5(score5)))
  print ("---------------------------------------------------------------")
  print ('Average Score:', average, determine_letter_grade_avg(average))
  </code></pre>
  
  <p>And when I run it:</p>
  
  <p><a href="https://i.stack.imgur.com/MLpXR.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/MLpXR.png" alt="enter image description here"></a></p>