Let’s play with Math in Python

In general life there are some mathematical task. and how programming language handling these tasks ?
This tutorial is dedicated to “Chotu”

  • + plus
  • – minus
  • / slash
  • * asterisk
  • % percent
  • < less-than
  • > greater-than
  • <= less-than-equal
  • >= greater-than-equal

# -*- coding: utf-8 -*-

print &amp;quot;chotu do you know addition, subtraction, multiplication and division&amp;quot;;
print &amp;quot;ok add these numbers &nbsp;5+6+10&amp;quot;;
print 5+6+10
print &amp;quot;Subtract 20 from 90&amp;quot;;
print 90-20
print &amp;quot;multiply 4 to 34&amp;quot;;
print 4*34
print &amp;quot;divide 12 by 4&amp;quot;;
print 12/4

Some Additional Operation

# -*- coding: utf-8 -*-

print &amp;quot;7 divided by 2 equals 3 with a remainder of = &amp;amp;quot;,7%2
print &amp;quot;Is 5 is greater ?&amp;quot;;, 5 &amp;amp;gt; 3
print &amp;quot;Is 5 is greater or equal ?&amp;amp;quot;, 5 &amp;amp;gt;= 4
print &amp;quot;Is 5 is lesser ?&amp;quot;, 5 &amp;amp;lt; 4

Note

# -*- coding: utf-8 -*- is used to handling errors related ASCII encodings in Python script

Advertisements

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