Skip to main content

Posts

Showing posts with the label Operators in Python.

- Operators in python -

  Operators  : Operators are special symbols in Python that carry out some specific operations. Arithmetic operators are used to perform mathematical operations like addition, subtraction, multiplication, etc.performing Note:  ● + when used with a number, adds the values  ● + when used with strings, concatenates two strings      Eg: “hello” +” world”=” hello world”  ● String and number cannot be added, unless the number is converted to string using str().  Eg: ”Python”+str(3) =” Python3”  ● Number * character concatenates the character that many times. Eg: 3 * ‘a’ = ‘aaa’  Now that we know how arithmetic operators work, let us see how python handles other operations. You must have watched/followed the cricket world cup. In that, they keep a tally of the highest run-scorer, highest wicket-taker, etc. How do they do that? By comparing values(runs/wickets); right? And what are the operators used here; The operators are <, >, etc...