Thread: two other python questions

Results 1 to 5 of 5
  1. #1 two other python questions 
    Donator

    H1N1's Avatar
    Join Date
    Oct 2009
    Posts
    716
    Thanks given
    20
    Thanks received
    47
    Rep Power
    103
    Assign point_dist with the distance between point (x1, y1) and point (x2, y2). The calculation is: Distance = SquareRootOf( (x2 - x1)2 + (y2 - y1)2 ). Sample output for the given program:
    Points distance: 3.0
    Code:
    import math
    
    x1 = 1.0
    y1 = 2.0
    x2 = 1.0
    y2 = 5.0
    point_dist = 0.0
    
    result 
    
    
    
    print('Points distance:', point_dist)


    2nd question Simple geometry can compute the height of an object from the the object's shadow length and shadow angle using the formula: tan(angleElevation) = treeHeight / shadowLength. Given the shadow length and angle of elevation, compute the tree height. Sample output for the given program:
    Tree height: 13.5372315838

    Code:
    import math
    
    angle_elev  = 3.8
    shadow_len  = 17.5
    tree_height = 0.0
    
    '''Your solution goes here'''
    
    print('Tree height:', tree_height)
    Reply With Quote  
     

  2. #2  
    Registered Member
    hc747's Avatar
    Join Date
    Dec 2013
    Age
    20
    Posts
    1,301
    Thanks given
    2,537
    Thanks received
    562
    Rep Power
    552
    The only thing you need to know here is python's syntax; the formulas to achieve the results you're after are given to you - apply them.
    Spoiler for sig too large:
    [Only registered and activated users can see links. ]
    [Only registered and activated users can see links. ]
    Reply With Quote  
     

  3. Thankful user:


  4. #3  
    Donator

    H1N1's Avatar
    Join Date
    Oct 2009
    Posts
    716
    Thanks given
    20
    Thanks received
    47
    Rep Power
    103
    Quote Originally Posted by hc747 View Post
    The only thing you need to know here is python's syntax; the formulas to achieve the results you're after are given to you - apply them.
    solved the first problem now i can't solve the second
    Reply With Quote  
     

  5. #4  
    Registered Member
    Bartvh's Avatar
    Join Date
    May 2017
    Posts
    285
    Thanks given
    52
    Thanks received
    88
    Rep Power
    97
    tree_height = shadow_len * math.tan(math.radians(angle_elev))

    That's just really basic math and python?
    Reply With Quote  
     

  6. #5  
    Donator

    H1N1's Avatar
    Join Date
    Oct 2009
    Posts
    716
    Thanks given
    20
    Thanks received
    47
    Rep Power
    103
    Quote Originally Posted by Bartvh View Post
    tree_height = shadow_len * math.tan(math.radians(angle_elev))

    That's just really basic math and python?
    I got it lol
    Reply With Quote  
     


Thread Information
Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Two Client Related Questions
    By Lawless in forum Help
    Replies: 2
    Last Post: 02-14-2016, 10:09 PM
  2. Replies: 0
    Last Post: 01-20-2014, 01:56 AM
  3. Replies: 8
    Last Post: 08-13-2013, 07:57 PM
  4. Two Questions
    By Palidino in forum Help
    Replies: 3
    Last Post: 03-11-2009, 01:24 PM
  5. Two Questions.
    By AndyJay in forum Help
    Replies: 6
    Last Post: 02-10-2009, 02:03 AM
Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •