{"id":26427,"date":"2023-05-17T21:49:55","date_gmt":"2023-05-17T16:19:55","guid":{"rendered":"https:\/\/tocxten.com\/?page_id=26427"},"modified":"2023-05-17T21:53:58","modified_gmt":"2023-05-17T16:23:58","slug":"python-lab-manual-part-i","status":"publish","type":"page","link":"https:\/\/tocxten.com\/index.php\/python-lab-manual-part-i\/","title":{"rendered":"PYTHON LAB MANUAL : Part I"},"content":{"rendered":"\n<p class=\"has-background has-medium-font-size\" style=\"background-color:#d7dfe6\"><strong>1. Develop a program to read the student details like Name, USN, and Marks in three subjects. Display the student details, total marks and percentage with suitable messages.<\/strong><\/p>\n\n\n\n<p><strong>Source Code : <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>class Student:\r\n    marks = &#91;]\r\n    def getData(self, name, USN,max_marks, m1, m2, m3):\r\n        Student.name = name\r\n        Student.USN = USN\r\n        Student.max_marks = max_marks\r\n        Student.marks.append(m1)\r\n        Student.marks.append(m2)\r\n        Student.marks.append(m3)\r\n        \r\n    def displayData(self):\r\n        print (\"Name is: \", Student.name)\r\n        print (\"USN is: \", Student.USN)\r\n        print (\"Marks are: \", Student.marks)\r\n        print (\"Total Marks is: \", self.total())\r\n        print (\"Average Marks is: \", self.average())\r\n        print (\"Percentage Marks is: \", self.percentage())\r\n    \r\n    def total(self):\r\n        return (Student.marks&#91;0] + Student.marks&#91;1] +Student.marks&#91;2])\r\n    \r\n    def average(self):\r\n        return ((Student.marks&#91;0] + Student.marks&#91;1] +Student.marks&#91;2])\/3)\r\n    \r\n    def percentage(self):\r\n        return ((self.average()\/Student.max_marks)*100)\r\n\r\nname = input(\"Enter the name: \")\r\nusn = int (input(\"Enter the usn: \"))\r\nmax_marks = int (input(\"Enter the max_marks (25\/50\/100\/Any max):\"))\r\nm1 = int (input(\"Enter the marks in the first subject out of {0}:\".format(max_marks)))\r\nm2 = int (input(\"Enter the marks in the second subject out of {0}:\".format(max_marks)))\r\nm3 = int (input(\"Enter the marks in the third subject out of {0}:\".format(max_marks)))\r\n\r\ns1 = Student()\r\ns1.getData(name, usn,max_marks,m1, m2, m3)\r\ns1.displayData()<\/code><\/pre>\n\n\n\n<p class=\"has-light-green-cyan-background-color has-background has-medium-font-size\"><strong>Sample Output <\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Enter the name: Thyagu\r\nEnter the usn: 12345\r\nEnter the max_marks (25\/50\/100\/Any max):25\r\nEnter the marks in the first subject out of 25:23\r\nEnter the marks in the second subject out of 25:21\r\nEnter the marks in the third subject out of 25:21\r\nName is:  Thyagu\r\nUSN is:  12345\r\nMarks are:  &#91;23, 21, 21]\r\nTotal Marks is:  65\r\nAverage Marks is:  21.666666666666668\r\nPercentage Marks is:  86.66666666666667<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>1. Develop a program to read the student details like Name, USN, and Marks in three subjects. Display the student details, total marks and percentage with suitable messages. Source Code&#8230;<\/p>\n","protected":false},"author":1,"featured_media":0,"parent":0,"menu_order":0,"comment_status":"closed","ping_status":"closed","template":"","meta":{"om_disable_all_campaigns":false,"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":"","_links_to":"","_links_to_target":""},"class_list":["post-26427","page","type-page","status-publish","hentry"],"post_mailing_queue_ids":[],"_links":{"self":[{"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/pages\/26427","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/pages"}],"about":[{"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/types\/page"}],"author":[{"embeddable":true,"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/comments?post=26427"}],"version-history":[{"count":4,"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/pages\/26427\/revisions"}],"predecessor-version":[{"id":26433,"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/pages\/26427\/revisions\/26433"}],"wp:attachment":[{"href":"https:\/\/tocxten.com\/index.php\/wp-json\/wp\/v2\/media?parent=26427"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}