Now type the following :
name = raw_input()
then type the name and apply command :
print name
print "my name is", name
so one thing to be noted is to put ' , ' after writing extra message to be printed.
If you want to input only Integer value then use : x = int(raw_input())
Anther way out is
There are many operators used in Python like :
+ plus
- minus
/ slash
* asterisk
% percent
< less-than
> greater-than
<= less-than-equal
>= greater-than-equal
The order Python follows is :PEMDAS which stands for Parentheses Exponents Multiplication Division Addition Subtraction.
STRINGS WITH VARIABLES EMBEDDED
Here, we have just a value to variable which we have used in string.
Have you ever thought to use both %s and %d in sentence ?
Yes it is possible !
See the following example
so it must be clear that you need to use ' + ' (without quotes) to use %s and %d in same line.
+ is the string concatenation operator.
Another way is as shown in the following image :
No comments:
Post a Comment
SAY HELLO!!