Posts

Showing posts from July, 2024

Arithmetic Operators in python with example

Image
 # Addition of two no in Python..... a = 10 b = 5 add = a + b print ( 'a = 10' ) print ( 'b = 5' ) print ( add ) # Subtraction  of two no in python..... a = 10 b = 5 sub = a - b print ( 'a = 10' ) print ( 'b = 5' ) print ( sub ) # Division of two no in python..... a = 10 b = 5 divide = a / b print ( 'a = 10' ) print ( 'b = 5' ) print ( divide ) # Multiplication of two no in python..... a = 10 b = 5 multi = a * b print ( 'a = 10' ) print ( 'b = 5' ) print ( multi ) ...Output...

Match (Switch) statement in python

# Match (Switch) statement in python..... lang = str ( input ( "What's the programming language you want to learn? : " )) match lang :     case 'JavaScript' :         print ( 'You can become a web developer.' )     case 'Python' :         print ( 'You can become a Data Scientist.' )     case 'PHP' :         print ( 'You can become a backend developer.' )     case 'Java' :         print ( 'You can become a mobile app developer' )     case _:         print ( "The language doesn't matter, what matters is solving problems." )

Making Calculator Using Python

# Making Calculator Using Python..... print ( 'Calculator' ) def sum ( a , b ):     s = a + b     return s def diff ( a , b ):     d = a - b     return d def multi ( a , b ):     m = a * b     return m def divide ( a , b ):     d = a / b     return d def power ( a , b ):     p = a ** b     return p a = int ( input ( 'Enter the 1st values: ' )) b = int ( input ( 'Enter the 2nd values: ' )) print ( '' ) print ( 'Sum of ur number...' ) print ( '-->' , sum ( a , b )) print ( '' ) print ( 'Diff of ur number...' ) print ( '-->' , diff ( a , b )) print ( '' ) print ( 'Multiplaction of ur number...' ) print ( '-->' , multi ( a , b )) print ( '' ) print ( 'Product of ur number...' ) print ( '-->' , divide ( a , b )) print ( '' ) print ( 'Power of ur number...' ) print ( '-->' , power ( a , b )) print ( ...