Home
Projects
PHP
JAVA
Tips of programs
Tips of programming
Main Function with Examples: Understand main in Python | Python language | Python langcode
March 11, 2020
main() function use in python
Before we program more in front of Python, we know about using the main()function in Python
Consider the following code:-
Source code:
def main():
print("Hello!")
print("hii")
main() function
output:-
hii
Only "Hello!" print
not the code "hii" print
The call
function "if__name__== "__main__".
Source code:
def main():
print("Hello!")
if__name__=="__main__":
main()
print("hii")
use main() function
output:-
Hello!
hii
2 Comments
Parrot Lovers
March 11, 2020 at 7:49 AM
Good
Reply
Delete
Replies
Reply
Python language
March 11, 2020 at 6:32 PM
thanku
Reply
Delete
Replies
Reply
Add comment
Load more...
Newer
Older
2 Comments
Good
ReplyDeletethanku
ReplyDelete