Python program to print your name, roll number, section, session, and department on the output screen.

Here is a python program to print your name, roll number, section, session, and department on the output screen.

Contents

By printing directly

We can print the required data directly using the print() function. Here is the code:


#Python program to print your name, roll number, section, session, and department on the output screen.

# By printing directly
print('Name: Ahmad Shafiq')
print('Roll No: 2021-EE-367')
print('Section: A')
print('Session: 2021')
print('Department: Electrical Engineering')

# This code is contributed by Ahmad Shafiq

By declaring variables

We can also solve the above problem by declaring variables and then printing them by using the print() function.


#Python program to print your name, roll number, section, session, and department on the output screen.

#By declaring variables
name = 'Ahmad Shafiq'
rollNo = '2021-EE-367'
section = 'A'
session = '2021'
department = 'Electrical Engineering'
print('Name:', name, '\nRoll No', rollNo, '\nSection', section, '\nSession', session, '\nDepartment', department)

# This code is contributed by Ahmad Shafiq

callout-flag

Love this read? Subscribe to Modernage!

Do you have any queries? You can ask in the comments. We, at Modernage answer each and every question, asked in the comments, so If you have any queries, or you want to know about any specific platform you can ask in the comments below

Author

Leave a Reply

girl-carrying-document

More Articles.

SUBSCRIBE TO MODERNAGE

Top Posts

Author

SUBSCRIBE TO MODERNAGE

Technology

SUBSCRIBE TO MODERNAGE

Python

girl-carrying-document

More Articles.