Home » NO IDEA » variables and string

variables and string

Blog Stats

  • 14,863 hits
December 2012
M T W T F S S
« Sep   Jan »
 12
3456789
10111213141516
17181920212223
24252627282930
31  

VARIABLES AND STRING

In this exercise we are going to see about the some variables in format specifier type like in c program where you use %d,%S etc….

and you have see in line number 7 you notice after the %s” i never used , to print the variable name so it is important to have a look over it ,you can aslo print just saying print “lets talk about “,name but you must know that there are many ways to write 

There are three ways you can declare a string in Python: single quotes ('), double quotes ("), and triple quotes ("""). In all cases, you start and end the string with your chosen string declaration. For example:

>>> print ('I am a single quoted string')
I am a single quoted string
>>> print ("I am a double quoted string")
I am a double quoted string
>>> print ("""I am a triple quoted string""")
I am a triple quoted string
  1. #variables 2
  2. name=’Harinath’;
  3. age=19;
  4. hair=’black’;
  5. myeyes=’black’;
  6. myteeth=’white’;
  7. print”let us talk about %s”%name
  8. print”his age is %d”%age;
  9. print”colour of hair is %s”%hair;
  10. print”his teeth%s”%myteeth;
Advertisements

1 Comment

  1. […] variables and string […]

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: