CBSE Class 9 Computer Applications Question 23 of 23

Introducing Python — Question 16

Back to all questions
16
Question

Question 14

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 separate lines.

Make sure to have two blank lines in these two different types of prints.

Answer
Solution
n = input("Enter name of student: ")
c = int(input("Enter class of student: "))
a = int(input("Enter age of student: "))
print("Name:", n, "Class:", c, "Age:", a)
print()
print()
print("Name:", n)
print("Class:", c)
print("Age:", a)
Output
Enter name of student: Kavya
Enter class of student: 11
Enter age of student: 17
Name: Kavya Class: 11 Age: 17


Name: Kavya
Class: 11
Age: 17