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 Info:

Rakesh (He/Him) has over 14+ years of experience in Web and Application development. He is the author of insightful How-To articles for Code2care.

Follow him on: X

You can also reach out to him via e-mail:

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