t409.py 619 B

12345678910111213141516171819202122232425262728293031323334
  1. print float(), type(float(0))
  2. # integers
  3. print float(1), type(float(1))
  4. print float(3/2), type(float(3/2))
  5. print float(123456789L)
  6. # floating point
  7. print float(1.234)
  8. print float(3/2.0)
  9. # strings
  10. print float("12.3")
  11. print float(" 0.5 ")
  12. print float("0."+"123456789"*3)
  13. print float("123456789"*3)
  14. # nan and inf
  15. print float('nan')
  16. print float('-nan')
  17. print float('NAN')
  18. print float('-NAN')
  19. print float('+nAn')
  20. print float('inf')
  21. print float('-inf')
  22. print float('INF')
  23. print float('-INF')
  24. print float('+inF')
  25. try:
  26. print float("734L")
  27. print "You shouldn't see this."
  28. except ValueError:
  29. print float("734")