Program 2: Print your name using print() function - 1000+ Python Programs

Question 2)

Write a program in Python to print "your name" in console using print() function!

# Program 2
# Program to Print your name using print() function
# 1000+ Python Programs by

print("Mike Alan")


Mike Alan


This is quite similar to the first program we saw, instead of "Hello World" we just print our name.

print() is a build in function in Python3

print(*objects, sep=' ', end='\n', file=None, flush=False)



Note: If you are using Python 2.x print is a statement and you will write the statement like below,

print "Mike Alan!"

If you run the above program in Python3 you will get an error,

print 'Mike Alan!'
SyntaxError: Missing parentheses in call to 'print'. 
Did you mean print('Mike Alan!')?

This is because Python3 (also known as Python 3.0, Python 3000, or Py3K) is not backward compatible with Python 2.x


Facing issues? Have Questions? Post them here! I am happy to answer!

Author: Rakesh
Author Info:

Rakesh is a seasoned developer with over 10 years of experience in web and app development, and a deep knowledge of operating systems. Author of insightful How-To articles for Code2care.

Follow him on: X

Copyright © Code2care 2023 | Privacy Policy | About Us | Contact Us | Sitemap