Demo entry 2649804

notes1

   

Submitted by anonymous on Sep 09, 2015 at 03:45
Language: Python 3. Code size: 2.4 kB.

#CS10   352500 shaolong lin
#157/2 = 78+        "1"
#78/2  = 39+        "0"
#39/2  = 19+        "1"
#19/2  = 9+         "1"
#9/2   = 4+         "0"
#4/2   = 2+         "0"
#2/2   = 1          "1"
#10011101 = 157 as computer language
#2^7  2^6  2^5 2^4 2^3 2^2 2^1 2^0
# 1    0    0   1   1   1   0   1
#128   0    0   16  8   4   0   1
#search:ASCII and print out all,EG A->65   1    1
#                                         lllllll
#                                         0 0000
#Input/Output
#programs typically has 3 steps
#1.Input
#2.Calculation/processing
#3.Output
#Output
#Using print ()
print("Hello World")
#1#Hello World
print('Hello World')
#2#Hello World
#Both double/single quotes works!
#
#String and string literals
#Each piece of letter is called a character.
#A sequence of characters is called a string.
#String litesal - when a string is in the actual code of a program must
#be enclosed in quotes.
#
#EG  Don't fear
print("Don't fear")
#3#Don't fear
#Wrong if you want to use single quote and sentense include single quote.
#XXXX wrong   print('Don't fear')   must  use double quote here.
#
#EG 2
# Read "hamlet" from shakopeare
print('Read "Hamlet" from shakospeare')
#4#Read "Hamlet" from shakospeare
# we can also use '''  with'''  """with """
#
#EG3
#    one
#    two
#    three
print('''one
two
three''')
#5#one
##two
##three
#
#Comments
#-notes for hummans,not for python
#
#Escaper Sequence with strings
#-allow special characters in string
print("\t\t\t Fancy Candy")
##		     Fancy Candy
#  \t   tab
#  \n   newline
print("here is a string \n")
#6#here is a string 

#  \a   bell
print("\a")
#7#
#  \'   single quote print
print("Hery\'The Great\' is not great")
#8#Hery'The Great' is not great
#  \" double quote p
#  \\  print a\
#
# Concatenating string - joining strings
# "Long live the King!"
# "Don't forget the queen!"
print("Long live the King" + "Don't forget the Queen")
#9#Long live the KingDon't forget the Queen
#
#Repeating Strings
print("money"*6)
#10#moneymoneymoneymoneymoneymoney

##>>> 
##1#Hello World
##2#Hello World
##3#Don't fear
##4#Read "Hamlet" from shakospeare
##5#one
##  two
##  three
##			 Fancy Candy
##6#here is a string 
##
##7#
##8#Hery'The Great' is not great
##Long live the KingDon't forget the Queen
##10#moneymoneymoneymoneymoneymoney
##>>> 

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).