fork download
  1. def test(filename):
  2. return not filename.endswith(".dat") and (
  3. filename.endswith(".dat") or not filename.endswith(".cup")
  4. )
  5.  
  6. for filename in [
  7. "name.txt",
  8. "name.dat",
  9. "name.cup",
  10. ]:
  11. print(f"{filename}: {test(filename)}")
Success #stdin #stdout 0.04s 9668KB
stdin
Standard input is empty
stdout
name.txt: True
name.dat: False
name.cup: False