"Price of the product is Rs. cost."
Last active
February 25, 2017 13:24
-
-
Save revathskumar/4673179 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template = "Price of the %s is Rs. %f." | |
# %s - string, %f - float and %d - integer | |
p template % ["apple", 70.00] | |
# prints Price of the apple is Rs. 70.000000. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
template = "Price of the %{product} is Rs. %{price}." | |
p template % {product:"apple", price:70.00} | |
# prints Price of the apple is Rs. 70.0. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
product = "apple" | |
cost = "70.00" | |
p "Price of the #{product} is Rs. #{cost}." | |
# prints Price of the apple is Rs. 70.00. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment