4. Write a program in Python ro input a student s name class rool number and them print them
Answers
Answered by
4
Required program :-
name = input("Enter your name: ")
Class = input("Enter your class: ")
roll_no = int(input("Enter your roll number: "))
print("Name of the student is ",name)
print("Class of the student is ",Class)
print("Roll number of student is ", roll_no)
Explanation :-
- Firstly take input of name, class, roll number of student as input from the user by using input() function. [Python 3 by default takes the input as string ]
- Store these input values in different variables. [Remember there are some reserved words in python, don't take "class" as a variable because it is a reserved keyword].
- Now Using print function, print the details of the student as per the needs.
See a sample output in attachment
Attachments:
Similar questions