Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import math
- g = 9.81
- pi = math.pi
- def is_valid_angle(s:str)-> bool: <
- """
- Returns True if and only if s is a valid angle. See the assignment
- description and examples for more information regarding what's valid
- Examples:
- >>> is_valid_angle("85.3d")
- True
- >>> is_valid_angle("85.3.7D")
- False
- >>> is_valid_angle("90d")
- False
- >>> is_valid_angle("0.001r")
- True
- >>> is_valid_angle("1.5R")
- True
- """
- #Your code goes here
- if 'd' or 'D' in is_valid_angle:
- newstr = is_valid_angle.replace("r", "")
- newstr = is_valid_angle.replace("R", "")
- if float(90) >= float(newstr) <= float(0):
- return "True"
- if 90 <= float(newstr) >= 0:
- return "False"
- if 'r' or 'R' in is_valid_angle:
- newstr = is_valid_angle.replace("D", "")
- newstr = is_valid_angle.replace("d","")
- if (float(pi/2)) >= float(newstr) <= float(0):
- return "True"
- if float((pi/2)) <= float(newstr) >= float(0):
- return "False"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement