Skip to main content

Hellow World program in python

# Hello World program in Python
import datetime,time,sys
def welcome():
    print("Hi How are you" +str(datetime.datetime.now()));                    #prints date and time
    print("Hope you are having a great day");
    print("Welcome to python");
    time.sleep(1);        #cause program to wait for 1 second
welcome();
welcome();
exit();



This program creates welcome function, shows you how to import or do multiple import and print datetime.


with params
# Hello World program in Python
import datetime,time
def welcome(number):
    print("Hi How are you" +str(datetime.datetime.now()));
    print("Hope you are having a great day"+str(number+1));
    print("Welcome to python");
    time.sleep(1);
welcome(6);



Python Creating class example


class Person:
    def __init__(self,name,age):
        self.name=name;
        self.age=age;
       
p1 = Person("John", 36)
print(p1.name)

Comments