Write the python commands for following
Answers
INPUT COMMANDS:-
class University:
def getUdetails(self):
self.uName = input("Enter University Name : ")
self.uRID = input("Enter Reg. (University) No. : ")
def showUdetails(self):
print("University Name :", self.uName)
print("University Reg. No. :", self.uRID)
class College(University):
def getClgDetails(self):
self.cName = input("Enter College Name : ")
self.cRID = input("Enter Reg. (College) No. : ")
self.getUdetails()
def showClgDetails(self):
print("College Name :", self.cName)
print("College Reg. No. :", self.cRID)
self.showUdetails()
class Student(College):
def getStudDetails(self):
self.sName = input("Enter Student Name : ")
self.sRoll = input("Enter Student's Enroll No.: ")
self.sBranch = input("Enter Student's Branch: ")
self.getClgDetails()
def showStudDetails(self):
print("\nSTUDENT DETAILS", self.sName)
print("Student Name :", self.sName)
print("Student Enroll. No. :", self.sRoll)
print("Student Branch :", self.sBranch)
self.showClgDetails ()
s = Student()
s.getStudDetails()
s.showStudDetails()
Answer:
Hope it helps plss mark as brainlist and follow me dear plsssssssssssssss
Explanation:
The Python language has many similarities to Perl, C, and Java. However, there are some definite differences between the languages.
First Python Program
Let us execute programs in different modes of programming.
Interactive Mode Programming
Invoking the interpreter without passing a script file as a parameter brings up the following prompt −
$ python
Python 2.4.3 (#1, Nov 11 2010, 13:34:43)
[GCC 4.1.2 20080704 (Red Hat 4.1.2-48)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>>
Type the following text at the Python prompt and press the Enter −
>>> print "Hello, Python!"
If you are running new version of Python, then you would need to use print statement with parenthesis as in print ("Hello, Python!");. However in Python version 2.4.3, this produces the following result −
Hello, Python!
Script Mode Programming
Invoking the interpreter with a script parameter begins execution of the script and continues until the script is finished. When the script is finished, the interpreter is no longer active.
Let us write a simple Python program in a script. Python files have extension .py. Type the following source code in a test.py file −
Live Demo
print "Hello, Python!"
We assume that you have Python interpreter set in PATH variable. Now, try to run this program as follows −
$ python test.py
This produces the following result −
Hello, Python!
Let us try another way to execute a Python script. Here is the modified test.py file −
Live Demo
#!/usr/bin/python
print "Hello, Python!"
We assume that you have Python interpreter available in /usr/bin directory. Now, try to run this program as follows −
$ chmod +x test.py # This is to make file executable
$./test.py
This produces the following result −
Hello, Python!
Python Identifiers
A Python identifier is a name used to identify a variable, function, class, module or other object. An identifier starts with a letter A to Z or a to z or an underscore (_) followed by zero or more letters, underscores and digits (0 to 9).
Python does not allow punctuation characters such as @, $, and % within identifiers. Python is a case sensitive programming language. Thus, Manpower and manpower are two different identifiers in Python.