Python Made Easy for AI - Day 3

December 17, 2022
# Start Here test_object("a") test_function("print") success_msg("Great job!")
Use the assignment operator (<-) to create the variable a.


Excercise - 1:

Function Coinflip, On a coin toss if it's Heads: India Bat's, If it's tails: Australia Bats:

def coinflip(Toss):
   if Toss == "Heads":
       print ("India's Batting")
      print ("Australia's Batting")


Excercise - 2:

Function that returns square of any number

def square(n):      #This is Header
   squared = n ** 2          #This is body
   print ("Square of number is:")
   print (squared)
   return squared #This is response

square(2) #This is a function call

Excercise - 3:

Few Inbuilt functions

maximum = max(8,92,34,119)
print maximum

minimum = min(8,92,34,119)
print minimum

length = len("Type Your Name Here")
print length

Related Posts