EXAMPLE-1
print "Hello World!"
# save file helloWorld.py
#press F5 to run
Hello World!
>>>
EXAMPLE-2
firstName = raw_input("Enter your First name: ")
lastName = raw_input("Enter your Last name: ")
age = input("Enter your age: ")
print "Hello! Mr. " + firstName + " " + lastName
print "You are " + age + " " +"years old"
# save file basicInfo.py
#press F5 to run
Enter your First name: SACHIN
Enter your Last name: LARA
Enter your age: 43
Hello! Mr. SACHIN LARA
You are 43 years old
#NOTE: variable names in python are case sensitive
'''
FirstName, FIRSTNAME, firstName
all are different variables
so one should develop the habit of writing a variable of one kind only.
'''
print "Hello World!"
# save file helloWorld.py
#press F5 to run
Hello World!
>>>
EXAMPLE-2
firstName = raw_input("Enter your First name: ")
lastName = raw_input("Enter your Last name: ")
age = input("Enter your age: ")
print "Hello! Mr. " + firstName + " " + lastName
print "You are " + age + " " +"years old"
# save file basicInfo.py
#press F5 to run
Enter your First name: SACHIN
Enter your Last name: LARA
Enter your age: 43
Hello! Mr. SACHIN LARA
You are 43 years old
#NOTE: variable names in python are case sensitive
'''
FirstName, FIRSTNAME, firstName
all are different variables
so one should develop the habit of writing a variable of one kind only.
'''
No comments:
Post a Comment