Skip to main content

Posts

Showing posts from June, 2022

String operation 2 hacker rank

  def   resume ( first ,   second ,   parent ,   city ,   phone ,   start ,   strfind ,   string1 ):      # Write your code here      #1      a = first . strip () # strip() used to remove white spaces at start and end      b = second . strip ()      c = parent . strip ()      d = city . strip ()      #2      w = a . title () # title() is used to capitalize first letter of sstring      x = b . title ()      y = c . title ()      #3      print ( w + " " + x + " " + y + " " + d )      #4      ph = ( phone . isdigit ()) # isdigit checks numerical      print ( ph )      print ( phone . startswith ( ...

new line and tab space

  def   Escape ( s1 ,   s2 ,   s3 ):      s = "Python\tRaw\nString\tConcept"      print ( s1 + "\n" + s2 + "\n" + s3 )      print ( s1 + "\t" + s2 + "\t" + s3 )      print ( s )      print ( r "Python\tRaw\nString\tConcept" ) # r is raw string

tcs fresco play python using int math operation

  def   Integer_Math ( Side ,   Radius ):      # Write your code here      AreaS = int ( math . pow ( Side , 2 ))# sq number=math.pow(num,2)      VolumeC = Side * AreaS      AreaC = 3.14 * math . pow ( Radius , 2 )      VolumeS = 4 / 3 * ( 3.14 * Radius * Radius * Radius )      AC = round ( AreaC , 2 ) # roundoff=round(num,digit)      VS = round ( VolumeS , 2 )      print ( "Area of Square is " + str ( AreaS ))      print ( "Volume of Cube is " + str ( VolumeC ))      print ( "Area of Circle is " + str ( AC ))      print ( "Volume of Sphere is " + str ( VS ))

Fresco play python range hacker rank solution

  def   rangefunction ( startvalue ,   endvalue ,   stepvalue ):      # Write your code here           for   i   in   range   ( startvalue , endvalue , stepvalue ):# range(start,stop,step)          print ( i * i , end = " " )# end =" " is to give space if   __name__  ==  '__main__' :

Import usage hacker ranker solution

  import math def   calc ( c ):      # Write your code here        radius = ( c / ( 2 * math . pi ))        area = ( math . pi * radius * radius )        x = round ( radius , 2 ) # for roundoff float x=(number, place)        y = round ( area , 2 )        return ( x , y ) if   __name__  ==  '__main__' :      fptr  =  open ( os . environ [ 'OUTPUT_PATH' ],   'w' )      c  =  int ( input () . strip ())      result  =  calc ( c )      fptr . write ( str ( result )  +  '\n' )      fptr . close ()