Computer Science, asked by chamapadasmescd, 1 year ago

WRITE A PROGRAM TO READ DETAILS LIKE NAME, CLASS , AGE OF A STUDENT AND THEN PRINT THE DETAILS FIRSTLY IN SAME LINE AND THEN IN SEPERATE LINES. In python language..

Answers

Answered by rakeshchennupati143
132

Program:

name,class,age = input("Enter Student name : "),input("Enter student class : "),int(input("Enter student's age : "))

print("Student name : ",name,"-Student class : ",class,"-Student age : ",age)

print("Student name",name,"\nStudent class : ",class,"\nStudent age : ",age)

Output:

Enter Student name : student1

Enter student class : 10th

Enter student's age : 15

Student name :student1-Student class : 10th-Student age : 15

Student name :student1

Student class : 10th

Student age : 15

Explanation:

  • in print you can use "," to separate variables from the printing statements and you can use escape sequence like "\n" or "\t" and so on like that
  • so using that i printed in one line and in multiple lines.

-----Hope you got what you wanted,if you liked my program mark as brainliest,it would really help me.    :)

Answered by venuramcides
19

Program:

Name=input("Enter Name:")

Class=input("Enter Class:") #class is a keyword whereas Class isn't. Age=int(input("Enter Age:"))

print(Name,Class,Age)

print("\n")

print(Name)

print(Class)

print(Age)

Output:

Enter Name:venu

Enter Class:9

Enter Age:15

venu

9

15

Similar questions