am_dot_com

FP20211018

Oct 18th, 2021 (edited)
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.97 KB | None | 0 0
  1. """
  2. variables
  3. constants
  4. operators / operadores
  5. operands / operandos
  6. assignment operator / operador atribuição
  7. arithmetic operators
  8. boolean operators
  9. relational operators
  10. """
  11. a = 3 #assignment
  12. b = a #3 #infix operator
  13. #"array" - adjacent memory .... NumPy
  14. #c = list[f3(f2(f1(data)), 2, 3)]
  15.  
  16. d = 3 ; e = 4 ;
  17.  
  18. def infiniteCycle():
  19. while(True):
  20. pass
  21. #def end
  22.  
  23. #d = infiniteCycle()
  24.  
  25. """
  26. math operators
  27. """
  28. a = b = 3 #cascade assignment
  29. a = 3 ; b = 2
  30. aSum = a + b #5
  31. #aConcatenation = "a"+"b" # "ab"
  32. aDifference = aSum - 2 #3
  33. aMultiplication = aDifference * 2 #6
  34. #print ("--"*6)
  35. realDivision = a/b #1.5
  36. integerDivision = a//b #int(a/b) #1
  37. powerOp = a**b #3**2 = 3*3 = 9
  38. remainderOfTheIntegerDivision = 3%2 #1 #thousand applications
  39. #root of r-index
  40. #n**(1/r)
  41.  
  42. sentence = phrase = sequenceOfSymbols = "" #double-quotes delimiters
  43. sentence = phrase = sequenceOfSymbols = '' #single-quotes delimiters
  44. a = "\"" #escape of double-quote
  45. a = '"'
  46.  
  47. a = "All men are mortal."
  48. b = "Socrates is a man.\n"
  49. c = a+b #concatenation
  50. print (c, end="") #standard output
  51. print (c)
  52.  
  53. c = "_.-^-."*12 #multiple-concatenation
  54. print (c)
  55.  
  56. #stored-program computers Manchester MK 1
  57. #American Standard Code for Information Interchange
  58. #ASCII "ask-he"
  59. #2^7 = 128 #ASCII
  60. #2^8 = 256 #e-ASCII
  61. #2^16 = 65536 UNICODE
  62.  
  63. print (2**16)
  64.  
  65. """to know the e-ASCII table"""
  66. iSymbolCode = 65 #.. 255 #255-0+1 = 256
  67. strCode = str(iSymbolCode)
  68. strSymbolCode = chr(65)
  69. print ("Code: "+strCode+" Symbol: "+strSymbolCode)
  70.  
  71. iSymbolCode = 66 #.. 255 #255-0+1 = 256
  72. strCode = str(iSymbolCode)
  73. strSymbolCode = chr(66)
  74. print ("Code: "+strCode+" Symbol: "+strSymbolCode)
  75.  
  76. asciiCodes = range(256) #collection 0..255
  77. for iSymbol in asciiCodes: #walk over the collection
  78. strSymbol = str(iSymbol)
  79. strCorrespondingRepresentation = chr(iSymbol)
  80. strBothCodeAndSymbol = \
  81. "Code: "+strSymbol+" Symbol: "+strCorrespondingRepresentation
  82. print (strBothCodeAndSymbol)
  83. #for
  84.  
Add Comment
Please, Sign In to add comment