Advertisement
Guest User

Untitled

a guest
May 24th, 2017
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. Python 2.7.13 (v2.7.13:a06454b1afa1, Dec 17 2016, 20:42:59) [MSC v.1500 32 bit (Intel)] on win32
  2. Type "copyright", "credits" or "license()" for more information.
  3. >>> a = int(raw_input())
  4. 9
  5. >>> b = int(raw_input())
  6. 10
  7. >>> dodawnie = a + b
  8. >>> odejmowanie = a - b
  9. >>> mnozenie = a*b
  10. >>> dzielnie = a / b
  11. >>> print "wyniki dla liczb %f i %f" %(a,b)
  12. wyniki dla liczb 9.000000 i 10.000000
  13. >>> print "DODAWANIE: " dodawanie
  14. SyntaxError: invalid syntax
  15. >>> print "DODAWANIE: " + dodawanie
  16.  
  17. Traceback (most recent call last):
  18. File "<pyshell#8>", line 1, in <module>
  19. print "DODAWANIE: " + dodawanie
  20. NameError: name 'dodawanie' is not defined
  21. >>> print "DODAWANIE: " + dodawnie
  22.  
  23. Traceback (most recent call last):
  24. File "<pyshell#9>", line 1, in <module>
  25. print "DODAWANIE: " + dodawnie
  26. TypeError: cannot concatenate 'str' and 'int' objects
  27. >>> print "dodawnie: %d" %(dodawnie)
  28. dodawnie: 19
  29. >>> print "odejmowanie %d" %(odejmowanie)
  30. odejmowanie -1
  31. >>> print "mnozenie %f" %(mnozenie)
  32. mnozenie 90.000000
  33. >>> print "dzielnie %f" %(dzielnie)
  34. dzielnie 0.000000
  35. >>> dzielenie = float(a) / float(b)
  36. >>> print "dzielnie %f" %(dzielnie)
  37. dzielnie 0.000000
  38. >>> float(dzielenie) = float(a) / float(b)
  39. SyntaxError: can't assign to function call
  40. >>> dzielenie = float(a) / float(b)
  41. >>> print "dzielnie %f" %(dzielnie)
  42. dzielnie 0.000000
  43. >>>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement