Advertisement
Guest User

Untitled

a guest
Oct 15th, 2018
99
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.07 KB | None | 0 0
  1. import math
  2. g = 9.81
  3. pi = math.pi
  4.  
  5.  
  6. def is_valid_angle(s:str)-> bool: <
  7.     """
  8.    Returns True if and only if s is a valid angle. See the assignment
  9.    description and examples for more information regarding what's valid
  10.  
  11.    Examples:
  12.    >>> is_valid_angle("85.3d")
  13.    True
  14.    >>> is_valid_angle("85.3.7D")
  15.    False
  16.    >>> is_valid_angle("90d")
  17.    False
  18.    >>> is_valid_angle("0.001r")
  19.    True
  20.    >>> is_valid_angle("1.5R")
  21.    True
  22.    """
  23.     #Your code goes here
  24.  
  25.     if 'd' or 'D' in is_valid_angle:
  26.         newstr = is_valid_angle.replace("r", "")
  27.         newstr = is_valid_angle.replace("R", "")
  28.         if float(90) >= float(newstr) <= float(0):
  29.             return "True"
  30.         if 90 <= float(newstr) >= 0:
  31.             return "False"
  32.  
  33.     if 'r' or 'R' in is_valid_angle:
  34.         newstr = is_valid_angle.replace("D", "")
  35.         newstr = is_valid_angle.replace("d","")
  36.         if (float(pi/2)) >= float(newstr) <= float(0):
  37.             return "True"
  38.         if float((pi/2)) <= float(newstr) >= float(0):
  39.             return "False"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement