Thread: two other python questions

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

    H1N1's Avatar
    Join Date
    Oct 2009
    Posts
    759
    Thanks given
    23
    Thanks received
    50
    Rep Power
    132
    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
    21
    Posts
    1,320
    Thanks given
    2,586
    Thanks received
    576
    Rep Power
    566
    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
    759
    Thanks given
    23
    Thanks received
    50
    Rep Power
    132
    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
    309
    Thanks given
    64
    Thanks received
    105
    Rep Power
    141
    tree_height = shadow_len * math.tan(math.radians(angle_elev))

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

  6. Thankful user:


  7. #5  
    Donator

    H1N1's Avatar
    Join Date
    Oct 2009
    Posts
    759
    Thanks given
    23
    Thanks received
    50
    Rep Power
    132
    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  
     

  8. #6  
    Registered Member
    Join Date
    Jun 2018
    Posts
    1
    Thanks given
    0
    Thanks received
    0
    Rep Power
    0
    import math

    x1 = 1.0
    y1 = 2.0
    x2 = 1.0
    y2 = 5.0
    point_dist = 0.0

    point_dist = math.sqrt((x2 - x1)**2 + (y2 - y1)**2)

    print('Points distance:', point_dist)
    Reply With Quote  
     

  9. #7  
    Registered Member
    Andys1814's Avatar
    Join Date
    Feb 2013
    Posts
    972
    Thanks given
    638
    Thanks received
    429
    Rep Power
    619
    i dont understand the point of this thread wth
    My only Discord is: andys1814#9452 and my only Skype is andrew.smith461[/COLOR][/B]
    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
  •