228k views
1 vote
The values of fields RNO, NAME, DOB, and FEE have to be accepted from the user. Help Veer write the program in Python.

a) Veer should use the input() function to get values from the user.

b) Veer should declare variables for each field and assign them values.

c) Veer should create a Python class to store these fields.

d) Veer should use the scanf() function to read values from the user.

User Ben Jonson
by
8.3k points

1 Answer

4 votes

Final answer:

Veer should use the input() function to get user inputs in Python, declare variables for each field, and create a class to store these fields. The scanf() function is not used in Python.

Step-by-step explanation:

The correct answer is option (a) and option (b). To help Veer write the program in Python, he should use the input() function to get values from the user and declare variables for each field assigning the input values to them. Additionally, Veer should create a Python class to store these fields as option (c) suggests. Option (d) is not applicable for Python because the scanf() function is a C language function and does not exist in Python.

Example Python Code

class Student:

def __init__(self, rno, name, dob, fee):

self.RNO = rno

self.NAME = name

self.DOB = dob

self.FEE = fee


# User input

rno = input("Enter RNO: ")

name = input("Enter NAME: ")

dob = input("Enter DOB: ")

fee = input("Enter FEE: ")


# Create an instance of Student

student = Student(rno, name, dob, fee)

User Mercurious
by
8.0k points

Related questions

asked Feb 2, 2017 193k views
Ssell asked Feb 2, 2017
by Ssell
7.9k points
1 answer
2 votes
193k views
asked Aug 15, 2019 108k views
Micnil asked Aug 15, 2019
by Micnil
8.5k points
1 answer
0 votes
108k views