How to print the student record data (a list of values) from a list of records nicely formatted?












3















I need help with my homework.



The requirements are:





  1. The source code shall be written by Python3



  2. The code shall contain the following:



    if-else statement



    if-elif-else statement



    while statement



    for statement



    list






My code:



print("                 Main Menu                 ")
print("[1] Input Student Records")
print("[2] Display Student Records")
main_choice=int(input("Choice: "))
Stud_list=
choice1='y'
if main_choice==1:
while choice1=='y' or choice1=='Y':
Stud_number=int(input("Student Number: "))

Stud_Course=input("Student Course: ")

Year_Level=int(input("Year Level: "))

Stud_Name=input("Student Name:")

Address=input("Address: ")

Birthday=int(input("Birthdate: "))

Father_Name=input("Father's Name: ")

Mother_Name=input("Mother's Name: ")

Stud_list.append([Stud_number, Stud_Course, Year_Level, Stud_Name,
Address, Birthday, Father_Name, Mother_Name])

choice1=input("Input another? [Y]/[N]: ")

for i in Stud_list:
print(i)


The output when displaying the list looks like:



[123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
[222222, 'Course', 2, 'Name2', 'Here2', Birth, 'HIM', 'HER']


But the output needs to look like this:



Student Number: 123456
Student Course: Course
Year Level: 1
Student Name: Name
Address: Here
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER

Student Number: 222222
Student Course: Course
Year Level: 2
Student Name: Name2
Address: Here2
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER


And continues until it prints the entire student records.



How do I print it like that?










share|improve this question




















  • 2





    good job getting to your output. Now, just manually add the string in front, at the end of the day, there is nothing special going on. For example: print("the number is " + str(1)) and so on.

    – Paritosh Singh
    Jan 1 at 13:48











  • The source code shall be written by Python3 Ouch.

    – user5173426
    Jan 1 at 14:10
















3















I need help with my homework.



The requirements are:





  1. The source code shall be written by Python3



  2. The code shall contain the following:



    if-else statement



    if-elif-else statement



    while statement



    for statement



    list






My code:



print("                 Main Menu                 ")
print("[1] Input Student Records")
print("[2] Display Student Records")
main_choice=int(input("Choice: "))
Stud_list=
choice1='y'
if main_choice==1:
while choice1=='y' or choice1=='Y':
Stud_number=int(input("Student Number: "))

Stud_Course=input("Student Course: ")

Year_Level=int(input("Year Level: "))

Stud_Name=input("Student Name:")

Address=input("Address: ")

Birthday=int(input("Birthdate: "))

Father_Name=input("Father's Name: ")

Mother_Name=input("Mother's Name: ")

Stud_list.append([Stud_number, Stud_Course, Year_Level, Stud_Name,
Address, Birthday, Father_Name, Mother_Name])

choice1=input("Input another? [Y]/[N]: ")

for i in Stud_list:
print(i)


The output when displaying the list looks like:



[123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
[222222, 'Course', 2, 'Name2', 'Here2', Birth, 'HIM', 'HER']


But the output needs to look like this:



Student Number: 123456
Student Course: Course
Year Level: 1
Student Name: Name
Address: Here
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER

Student Number: 222222
Student Course: Course
Year Level: 2
Student Name: Name2
Address: Here2
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER


And continues until it prints the entire student records.



How do I print it like that?










share|improve this question




















  • 2





    good job getting to your output. Now, just manually add the string in front, at the end of the day, there is nothing special going on. For example: print("the number is " + str(1)) and so on.

    – Paritosh Singh
    Jan 1 at 13:48











  • The source code shall be written by Python3 Ouch.

    – user5173426
    Jan 1 at 14:10














3












3








3








I need help with my homework.



The requirements are:





  1. The source code shall be written by Python3



  2. The code shall contain the following:



    if-else statement



    if-elif-else statement



    while statement



    for statement



    list






My code:



print("                 Main Menu                 ")
print("[1] Input Student Records")
print("[2] Display Student Records")
main_choice=int(input("Choice: "))
Stud_list=
choice1='y'
if main_choice==1:
while choice1=='y' or choice1=='Y':
Stud_number=int(input("Student Number: "))

Stud_Course=input("Student Course: ")

Year_Level=int(input("Year Level: "))

Stud_Name=input("Student Name:")

Address=input("Address: ")

Birthday=int(input("Birthdate: "))

Father_Name=input("Father's Name: ")

Mother_Name=input("Mother's Name: ")

Stud_list.append([Stud_number, Stud_Course, Year_Level, Stud_Name,
Address, Birthday, Father_Name, Mother_Name])

choice1=input("Input another? [Y]/[N]: ")

for i in Stud_list:
print(i)


The output when displaying the list looks like:



[123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
[222222, 'Course', 2, 'Name2', 'Here2', Birth, 'HIM', 'HER']


But the output needs to look like this:



Student Number: 123456
Student Course: Course
Year Level: 1
Student Name: Name
Address: Here
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER

Student Number: 222222
Student Course: Course
Year Level: 2
Student Name: Name2
Address: Here2
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER


And continues until it prints the entire student records.



How do I print it like that?










share|improve this question
















I need help with my homework.



The requirements are:





  1. The source code shall be written by Python3



  2. The code shall contain the following:



    if-else statement



    if-elif-else statement



    while statement



    for statement



    list






My code:



print("                 Main Menu                 ")
print("[1] Input Student Records")
print("[2] Display Student Records")
main_choice=int(input("Choice: "))
Stud_list=
choice1='y'
if main_choice==1:
while choice1=='y' or choice1=='Y':
Stud_number=int(input("Student Number: "))

Stud_Course=input("Student Course: ")

Year_Level=int(input("Year Level: "))

Stud_Name=input("Student Name:")

Address=input("Address: ")

Birthday=int(input("Birthdate: "))

Father_Name=input("Father's Name: ")

Mother_Name=input("Mother's Name: ")

Stud_list.append([Stud_number, Stud_Course, Year_Level, Stud_Name,
Address, Birthday, Father_Name, Mother_Name])

choice1=input("Input another? [Y]/[N]: ")

for i in Stud_list:
print(i)


The output when displaying the list looks like:



[123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
[222222, 'Course', 2, 'Name2', 'Here2', Birth, 'HIM', 'HER']


But the output needs to look like this:



Student Number: 123456
Student Course: Course
Year Level: 1
Student Name: Name
Address: Here
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER

Student Number: 222222
Student Course: Course
Year Level: 2
Student Name: Name2
Address: Here2
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER


And continues until it prints the entire student records.



How do I print it like that?







python python-3.x






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Jan 1 at 14:14









Patrick Artner

24.7k62443




24.7k62443










asked Jan 1 at 13:45









Wink101Wink101

182




182








  • 2





    good job getting to your output. Now, just manually add the string in front, at the end of the day, there is nothing special going on. For example: print("the number is " + str(1)) and so on.

    – Paritosh Singh
    Jan 1 at 13:48











  • The source code shall be written by Python3 Ouch.

    – user5173426
    Jan 1 at 14:10














  • 2





    good job getting to your output. Now, just manually add the string in front, at the end of the day, there is nothing special going on. For example: print("the number is " + str(1)) and so on.

    – Paritosh Singh
    Jan 1 at 13:48











  • The source code shall be written by Python3 Ouch.

    – user5173426
    Jan 1 at 14:10








2




2





good job getting to your output. Now, just manually add the string in front, at the end of the day, there is nothing special going on. For example: print("the number is " + str(1)) and so on.

– Paritosh Singh
Jan 1 at 13:48





good job getting to your output. Now, just manually add the string in front, at the end of the day, there is nothing special going on. For example: print("the number is " + str(1)) and so on.

– Paritosh Singh
Jan 1 at 13:48













The source code shall be written by Python3 Ouch.

– user5173426
Jan 1 at 14:10





The source code shall be written by Python3 Ouch.

– user5173426
Jan 1 at 14:10












5 Answers
5






active

oldest

votes


















2














Read up on string formating - python3.6 onwards supports f-strings - before that you can use str.format():



var1 = "22"
var2 = "2*11"
print(f"{var1} = {var2}")


before ypthon 3.6 str.format() is used to format strings, you can solve your output f.e. like this:



Stud_list = [[123456, 'Course', 1, 'Name', 'Here', "Birth", 'HIM', 'HER'],
[222222, 'Course', 2, 'Name2', 'Here2', "Birth", 'HIM', 'HER']]

for stud in Stud_list:
print(f"Student Number: {stud[0]}")
print(f"Student Course: {stud[1]}")
print(f"Year Level: {stud[2]}")
print(f"Student Name: {stud[3]}")
print(f"Address: {stud[4]}")
print(f"Birthdate: {stud[5]}")
print(f"Father's Name: {stud[6]}")
print(f"Mother's Name: {stud[7]}")


Output:



Student Number: 123456
Student Course: Course
Year Level: 1
Student Name: Name
Address: Here
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER
Student Number: 222222
Student Course: Course
Year Level: 2
Student Name: Name2
Address: Here2
Birthdate: Birth
Father's Name: HIM
Mother's Name: HER


Doku:





  • https://docs.python.org/3/library/string.html#custom-string-formatting

  • str.format()

  • f-strings






share|improve this answer

































    2














    You can use f formatted string or .format



    l = [123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
    print("""Student Number: {}n
    Student Course: {}n
    Year Level: {}n
    Student Name: {}n
    Address: {}n
    Birthdate: {}n
    Father's Name: {}n
    Mother's Name: {}n""".format(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]))





    share|improve this answer































      2














      Your code needs to be modified like this:https://onlinegdb.com/BkLmYxFZN



      print("                 Main Menu                 ")
      print("[1] Input Student Records")
      print("[2] Display Student Records")
      main_choice=int(input("Choice: "))
      Stud_list=
      k=
      choice1='y'
      if main_choice==1:
      while choice1=='y' or choice1=='Y':
      Stud_number=int(input("Student Number: "))

      Stud_Course=input("Student Course: ")

      Year_Level=int(input("Year Level: "))

      Stud_Name=input("Student Name:")

      Address=input("Address: ")

      Birthday=int(input("Birthdate: "))

      Father_Name=input("Father's Name: ")

      Mother_Name=input("Mother's Name: ")

      Stud_list.append([Stud_number,Stud_Course,Year_Level,Stud_Name,Address,Birthday,Father_Name,Mother_Name])

      choice1=input("Input another? [Y]/[N]: ")
      if main_choice==2:
      if not Stud_list:
      print("List is empty")
      else:
      for i in Stud_list :
      print("""
      Student Number: {}
      Student Course: {}
      Year Level: {}
      Student Name: {}
      Address: {}
      Birthdate: {}
      Father's Name: {}
      Mother's Name: {}""".format(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]))





      share|improve this answer

































        2














        Try this!



        print('''Student Number: {}
        nStudent Course: {}
        nYear Level: {}
        nStudent Name: {}
        nAddress: {}
        nBirthdate: {}
        nFather's Name: {}
        nMother's Name: {}'''.format(*i))





        share|improve this answer

































          0














          Stud_list you created is a list of list where you have stored all your data.
          you can use multiple for loops or the index of the sublist.
          You can use below code to print the desired output.



          for i in Stud_list: 
          print("Student Number:",i[0])
          print("Student Course:", i [1])
          print("Year Level:",i[2])
          print("Student Name:",i[3])
          print("Address: ",i[4])
          print("Birthdate: ",i[5])
          print("Father's Name: ",i[6])
          print("Mother's Name: ",i[7])
          print()





          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            autoActivateHeartbeat: false,
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














            draft saved

            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995960%2fhow-to-print-the-student-record-data-a-list-of-values-from-a-list-of-records-n%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            5 Answers
            5






            active

            oldest

            votes








            5 Answers
            5






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes









            2














            Read up on string formating - python3.6 onwards supports f-strings - before that you can use str.format():



            var1 = "22"
            var2 = "2*11"
            print(f"{var1} = {var2}")


            before ypthon 3.6 str.format() is used to format strings, you can solve your output f.e. like this:



            Stud_list = [[123456, 'Course', 1, 'Name', 'Here', "Birth", 'HIM', 'HER'],
            [222222, 'Course', 2, 'Name2', 'Here2', "Birth", 'HIM', 'HER']]

            for stud in Stud_list:
            print(f"Student Number: {stud[0]}")
            print(f"Student Course: {stud[1]}")
            print(f"Year Level: {stud[2]}")
            print(f"Student Name: {stud[3]}")
            print(f"Address: {stud[4]}")
            print(f"Birthdate: {stud[5]}")
            print(f"Father's Name: {stud[6]}")
            print(f"Mother's Name: {stud[7]}")


            Output:



            Student Number: 123456
            Student Course: Course
            Year Level: 1
            Student Name: Name
            Address: Here
            Birthdate: Birth
            Father's Name: HIM
            Mother's Name: HER
            Student Number: 222222
            Student Course: Course
            Year Level: 2
            Student Name: Name2
            Address: Here2
            Birthdate: Birth
            Father's Name: HIM
            Mother's Name: HER


            Doku:





            • https://docs.python.org/3/library/string.html#custom-string-formatting

            • str.format()

            • f-strings






            share|improve this answer






























              2














              Read up on string formating - python3.6 onwards supports f-strings - before that you can use str.format():



              var1 = "22"
              var2 = "2*11"
              print(f"{var1} = {var2}")


              before ypthon 3.6 str.format() is used to format strings, you can solve your output f.e. like this:



              Stud_list = [[123456, 'Course', 1, 'Name', 'Here', "Birth", 'HIM', 'HER'],
              [222222, 'Course', 2, 'Name2', 'Here2', "Birth", 'HIM', 'HER']]

              for stud in Stud_list:
              print(f"Student Number: {stud[0]}")
              print(f"Student Course: {stud[1]}")
              print(f"Year Level: {stud[2]}")
              print(f"Student Name: {stud[3]}")
              print(f"Address: {stud[4]}")
              print(f"Birthdate: {stud[5]}")
              print(f"Father's Name: {stud[6]}")
              print(f"Mother's Name: {stud[7]}")


              Output:



              Student Number: 123456
              Student Course: Course
              Year Level: 1
              Student Name: Name
              Address: Here
              Birthdate: Birth
              Father's Name: HIM
              Mother's Name: HER
              Student Number: 222222
              Student Course: Course
              Year Level: 2
              Student Name: Name2
              Address: Here2
              Birthdate: Birth
              Father's Name: HIM
              Mother's Name: HER


              Doku:





              • https://docs.python.org/3/library/string.html#custom-string-formatting

              • str.format()

              • f-strings






              share|improve this answer




























                2












                2








                2







                Read up on string formating - python3.6 onwards supports f-strings - before that you can use str.format():



                var1 = "22"
                var2 = "2*11"
                print(f"{var1} = {var2}")


                before ypthon 3.6 str.format() is used to format strings, you can solve your output f.e. like this:



                Stud_list = [[123456, 'Course', 1, 'Name', 'Here', "Birth", 'HIM', 'HER'],
                [222222, 'Course', 2, 'Name2', 'Here2', "Birth", 'HIM', 'HER']]

                for stud in Stud_list:
                print(f"Student Number: {stud[0]}")
                print(f"Student Course: {stud[1]}")
                print(f"Year Level: {stud[2]}")
                print(f"Student Name: {stud[3]}")
                print(f"Address: {stud[4]}")
                print(f"Birthdate: {stud[5]}")
                print(f"Father's Name: {stud[6]}")
                print(f"Mother's Name: {stud[7]}")


                Output:



                Student Number: 123456
                Student Course: Course
                Year Level: 1
                Student Name: Name
                Address: Here
                Birthdate: Birth
                Father's Name: HIM
                Mother's Name: HER
                Student Number: 222222
                Student Course: Course
                Year Level: 2
                Student Name: Name2
                Address: Here2
                Birthdate: Birth
                Father's Name: HIM
                Mother's Name: HER


                Doku:





                • https://docs.python.org/3/library/string.html#custom-string-formatting

                • str.format()

                • f-strings






                share|improve this answer















                Read up on string formating - python3.6 onwards supports f-strings - before that you can use str.format():



                var1 = "22"
                var2 = "2*11"
                print(f"{var1} = {var2}")


                before ypthon 3.6 str.format() is used to format strings, you can solve your output f.e. like this:



                Stud_list = [[123456, 'Course', 1, 'Name', 'Here', "Birth", 'HIM', 'HER'],
                [222222, 'Course', 2, 'Name2', 'Here2', "Birth", 'HIM', 'HER']]

                for stud in Stud_list:
                print(f"Student Number: {stud[0]}")
                print(f"Student Course: {stud[1]}")
                print(f"Year Level: {stud[2]}")
                print(f"Student Name: {stud[3]}")
                print(f"Address: {stud[4]}")
                print(f"Birthdate: {stud[5]}")
                print(f"Father's Name: {stud[6]}")
                print(f"Mother's Name: {stud[7]}")


                Output:



                Student Number: 123456
                Student Course: Course
                Year Level: 1
                Student Name: Name
                Address: Here
                Birthdate: Birth
                Father's Name: HIM
                Mother's Name: HER
                Student Number: 222222
                Student Course: Course
                Year Level: 2
                Student Name: Name2
                Address: Here2
                Birthdate: Birth
                Father's Name: HIM
                Mother's Name: HER


                Doku:





                • https://docs.python.org/3/library/string.html#custom-string-formatting

                • str.format()

                • f-strings







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Jan 1 at 14:14

























                answered Jan 1 at 13:56









                Patrick ArtnerPatrick Artner

                24.7k62443




                24.7k62443

























                    2














                    You can use f formatted string or .format



                    l = [123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
                    print("""Student Number: {}n
                    Student Course: {}n
                    Year Level: {}n
                    Student Name: {}n
                    Address: {}n
                    Birthdate: {}n
                    Father's Name: {}n
                    Mother's Name: {}n""".format(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]))





                    share|improve this answer




























                      2














                      You can use f formatted string or .format



                      l = [123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
                      print("""Student Number: {}n
                      Student Course: {}n
                      Year Level: {}n
                      Student Name: {}n
                      Address: {}n
                      Birthdate: {}n
                      Father's Name: {}n
                      Mother's Name: {}n""".format(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]))





                      share|improve this answer


























                        2












                        2








                        2







                        You can use f formatted string or .format



                        l = [123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
                        print("""Student Number: {}n
                        Student Course: {}n
                        Year Level: {}n
                        Student Name: {}n
                        Address: {}n
                        Birthdate: {}n
                        Father's Name: {}n
                        Mother's Name: {}n""".format(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]))





                        share|improve this answer













                        You can use f formatted string or .format



                        l = [123456, 'Course', 1, 'Name', 'Here', Birth, 'HIM', 'HER']
                        print("""Student Number: {}n
                        Student Course: {}n
                        Year Level: {}n
                        Student Name: {}n
                        Address: {}n
                        Birthdate: {}n
                        Father's Name: {}n
                        Mother's Name: {}n""".format(l[0], l[1], l[2], l[3], l[4], l[5], l[6], l[7]))






                        share|improve this answer












                        share|improve this answer



                        share|improve this answer










                        answered Jan 1 at 13:56









                        Aman RapariaAman Raparia

                        17518




                        17518























                            2














                            Your code needs to be modified like this:https://onlinegdb.com/BkLmYxFZN



                            print("                 Main Menu                 ")
                            print("[1] Input Student Records")
                            print("[2] Display Student Records")
                            main_choice=int(input("Choice: "))
                            Stud_list=
                            k=
                            choice1='y'
                            if main_choice==1:
                            while choice1=='y' or choice1=='Y':
                            Stud_number=int(input("Student Number: "))

                            Stud_Course=input("Student Course: ")

                            Year_Level=int(input("Year Level: "))

                            Stud_Name=input("Student Name:")

                            Address=input("Address: ")

                            Birthday=int(input("Birthdate: "))

                            Father_Name=input("Father's Name: ")

                            Mother_Name=input("Mother's Name: ")

                            Stud_list.append([Stud_number,Stud_Course,Year_Level,Stud_Name,Address,Birthday,Father_Name,Mother_Name])

                            choice1=input("Input another? [Y]/[N]: ")
                            if main_choice==2:
                            if not Stud_list:
                            print("List is empty")
                            else:
                            for i in Stud_list :
                            print("""
                            Student Number: {}
                            Student Course: {}
                            Year Level: {}
                            Student Name: {}
                            Address: {}
                            Birthdate: {}
                            Father's Name: {}
                            Mother's Name: {}""".format(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]))





                            share|improve this answer






























                              2














                              Your code needs to be modified like this:https://onlinegdb.com/BkLmYxFZN



                              print("                 Main Menu                 ")
                              print("[1] Input Student Records")
                              print("[2] Display Student Records")
                              main_choice=int(input("Choice: "))
                              Stud_list=
                              k=
                              choice1='y'
                              if main_choice==1:
                              while choice1=='y' or choice1=='Y':
                              Stud_number=int(input("Student Number: "))

                              Stud_Course=input("Student Course: ")

                              Year_Level=int(input("Year Level: "))

                              Stud_Name=input("Student Name:")

                              Address=input("Address: ")

                              Birthday=int(input("Birthdate: "))

                              Father_Name=input("Father's Name: ")

                              Mother_Name=input("Mother's Name: ")

                              Stud_list.append([Stud_number,Stud_Course,Year_Level,Stud_Name,Address,Birthday,Father_Name,Mother_Name])

                              choice1=input("Input another? [Y]/[N]: ")
                              if main_choice==2:
                              if not Stud_list:
                              print("List is empty")
                              else:
                              for i in Stud_list :
                              print("""
                              Student Number: {}
                              Student Course: {}
                              Year Level: {}
                              Student Name: {}
                              Address: {}
                              Birthdate: {}
                              Father's Name: {}
                              Mother's Name: {}""".format(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]))





                              share|improve this answer




























                                2












                                2








                                2







                                Your code needs to be modified like this:https://onlinegdb.com/BkLmYxFZN



                                print("                 Main Menu                 ")
                                print("[1] Input Student Records")
                                print("[2] Display Student Records")
                                main_choice=int(input("Choice: "))
                                Stud_list=
                                k=
                                choice1='y'
                                if main_choice==1:
                                while choice1=='y' or choice1=='Y':
                                Stud_number=int(input("Student Number: "))

                                Stud_Course=input("Student Course: ")

                                Year_Level=int(input("Year Level: "))

                                Stud_Name=input("Student Name:")

                                Address=input("Address: ")

                                Birthday=int(input("Birthdate: "))

                                Father_Name=input("Father's Name: ")

                                Mother_Name=input("Mother's Name: ")

                                Stud_list.append([Stud_number,Stud_Course,Year_Level,Stud_Name,Address,Birthday,Father_Name,Mother_Name])

                                choice1=input("Input another? [Y]/[N]: ")
                                if main_choice==2:
                                if not Stud_list:
                                print("List is empty")
                                else:
                                for i in Stud_list :
                                print("""
                                Student Number: {}
                                Student Course: {}
                                Year Level: {}
                                Student Name: {}
                                Address: {}
                                Birthdate: {}
                                Father's Name: {}
                                Mother's Name: {}""".format(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]))





                                share|improve this answer















                                Your code needs to be modified like this:https://onlinegdb.com/BkLmYxFZN



                                print("                 Main Menu                 ")
                                print("[1] Input Student Records")
                                print("[2] Display Student Records")
                                main_choice=int(input("Choice: "))
                                Stud_list=
                                k=
                                choice1='y'
                                if main_choice==1:
                                while choice1=='y' or choice1=='Y':
                                Stud_number=int(input("Student Number: "))

                                Stud_Course=input("Student Course: ")

                                Year_Level=int(input("Year Level: "))

                                Stud_Name=input("Student Name:")

                                Address=input("Address: ")

                                Birthday=int(input("Birthdate: "))

                                Father_Name=input("Father's Name: ")

                                Mother_Name=input("Mother's Name: ")

                                Stud_list.append([Stud_number,Stud_Course,Year_Level,Stud_Name,Address,Birthday,Father_Name,Mother_Name])

                                choice1=input("Input another? [Y]/[N]: ")
                                if main_choice==2:
                                if not Stud_list:
                                print("List is empty")
                                else:
                                for i in Stud_list :
                                print("""
                                Student Number: {}
                                Student Course: {}
                                Year Level: {}
                                Student Name: {}
                                Address: {}
                                Birthdate: {}
                                Father's Name: {}
                                Mother's Name: {}""".format(i[0], i[1], i[2], i[3], i[4], i[5], i[6], i[7]))






                                share|improve this answer














                                share|improve this answer



                                share|improve this answer








                                edited Jan 1 at 14:29

























                                answered Jan 1 at 14:16









                                i_thi_th

                                1,1601718




                                1,1601718























                                    2














                                    Try this!



                                    print('''Student Number: {}
                                    nStudent Course: {}
                                    nYear Level: {}
                                    nStudent Name: {}
                                    nAddress: {}
                                    nBirthdate: {}
                                    nFather's Name: {}
                                    nMother's Name: {}'''.format(*i))





                                    share|improve this answer






























                                      2














                                      Try this!



                                      print('''Student Number: {}
                                      nStudent Course: {}
                                      nYear Level: {}
                                      nStudent Name: {}
                                      nAddress: {}
                                      nBirthdate: {}
                                      nFather's Name: {}
                                      nMother's Name: {}'''.format(*i))





                                      share|improve this answer




























                                        2












                                        2








                                        2







                                        Try this!



                                        print('''Student Number: {}
                                        nStudent Course: {}
                                        nYear Level: {}
                                        nStudent Name: {}
                                        nAddress: {}
                                        nBirthdate: {}
                                        nFather's Name: {}
                                        nMother's Name: {}'''.format(*i))





                                        share|improve this answer















                                        Try this!



                                        print('''Student Number: {}
                                        nStudent Course: {}
                                        nYear Level: {}
                                        nStudent Name: {}
                                        nAddress: {}
                                        nBirthdate: {}
                                        nFather's Name: {}
                                        nMother's Name: {}'''.format(*i))






                                        share|improve this answer














                                        share|improve this answer



                                        share|improve this answer








                                        edited Jan 1 at 14:54

























                                        answered Jan 1 at 13:55









                                        AI_LearningAI_Learning

                                        3,57921033




                                        3,57921033























                                            0














                                            Stud_list you created is a list of list where you have stored all your data.
                                            you can use multiple for loops or the index of the sublist.
                                            You can use below code to print the desired output.



                                            for i in Stud_list: 
                                            print("Student Number:",i[0])
                                            print("Student Course:", i [1])
                                            print("Year Level:",i[2])
                                            print("Student Name:",i[3])
                                            print("Address: ",i[4])
                                            print("Birthdate: ",i[5])
                                            print("Father's Name: ",i[6])
                                            print("Mother's Name: ",i[7])
                                            print()





                                            share|improve this answer




























                                              0














                                              Stud_list you created is a list of list where you have stored all your data.
                                              you can use multiple for loops or the index of the sublist.
                                              You can use below code to print the desired output.



                                              for i in Stud_list: 
                                              print("Student Number:",i[0])
                                              print("Student Course:", i [1])
                                              print("Year Level:",i[2])
                                              print("Student Name:",i[3])
                                              print("Address: ",i[4])
                                              print("Birthdate: ",i[5])
                                              print("Father's Name: ",i[6])
                                              print("Mother's Name: ",i[7])
                                              print()





                                              share|improve this answer


























                                                0












                                                0








                                                0







                                                Stud_list you created is a list of list where you have stored all your data.
                                                you can use multiple for loops or the index of the sublist.
                                                You can use below code to print the desired output.



                                                for i in Stud_list: 
                                                print("Student Number:",i[0])
                                                print("Student Course:", i [1])
                                                print("Year Level:",i[2])
                                                print("Student Name:",i[3])
                                                print("Address: ",i[4])
                                                print("Birthdate: ",i[5])
                                                print("Father's Name: ",i[6])
                                                print("Mother's Name: ",i[7])
                                                print()





                                                share|improve this answer













                                                Stud_list you created is a list of list where you have stored all your data.
                                                you can use multiple for loops or the index of the sublist.
                                                You can use below code to print the desired output.



                                                for i in Stud_list: 
                                                print("Student Number:",i[0])
                                                print("Student Course:", i [1])
                                                print("Year Level:",i[2])
                                                print("Student Name:",i[3])
                                                print("Address: ",i[4])
                                                print("Birthdate: ",i[5])
                                                print("Father's Name: ",i[6])
                                                print("Mother's Name: ",i[7])
                                                print()






                                                share|improve this answer












                                                share|improve this answer



                                                share|improve this answer










                                                answered Jan 1 at 14:19









                                                Akshay SapraAkshay Sapra

                                                196317




                                                196317






























                                                    draft saved

                                                    draft discarded




















































                                                    Thanks for contributing an answer to Stack Overflow!


                                                    • Please be sure to answer the question. Provide details and share your research!

                                                    But avoid



                                                    • Asking for help, clarification, or responding to other answers.

                                                    • Making statements based on opinion; back them up with references or personal experience.


                                                    To learn more, see our tips on writing great answers.




                                                    draft saved


                                                    draft discarded














                                                    StackExchange.ready(
                                                    function () {
                                                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53995960%2fhow-to-print-the-student-record-data-a-list-of-values-from-a-list-of-records-n%23new-answer', 'question_page');
                                                    }
                                                    );

                                                    Post as a guest















                                                    Required, but never shown





















































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown

































                                                    Required, but never shown














                                                    Required, but never shown












                                                    Required, but never shown







                                                    Required, but never shown







                                                    Popular posts from this blog

                                                    Angular Downloading a file using contenturl with Basic Authentication

                                                    Olmecas

                                                    Can't read property showImagePicker of undefined in react native iOS