Page Index - nil41/GCP_services GitHub Wiki
24 page(s) in this GitHub Wiki:
- Home
- MY PYTHON STUDY:-
- print "Welcome to Python!" # hash is used for single line comment
- my_variable = 10 print my_variable // it will print 10
- print my_int // it will print 10, 10.5, True respectivly print my_float print my_bool
- print my_int // it will print 10 (reassigned)
- print spam() // this will print 12
- """ hi this is used for multi line comment """
- adition = 72 + 23 // we can also use -,*,/,% print adition
- eggs = 2 ** 3 // used for exponential (2^3)
- name = "Ryan" age = "19" food = "cheese" // all are treat as string use "" or ''
- 'There's a snake in my boot!' solution is, 'There's a snake in my boot!'
- c = "cats"[0] n = "Ryan"[3]
- pi = 3.14 print str(pi) // it will print 3.14 but treat as string
- print "Spam " + "and " + "eggs" // it will print Spam and eggs with spaces in between them
- print "I have " + str(2) + " coconuts!" // here 2 is treat as string, This will print I have 2 coconuts!
- print "Let's not go to %s. 'Tis a silly %s." % (string_1, string_2) // this will print Let's not go to Camelot. 'Tis a silly place.
- if 8 > 9: print "I don't printed!" else: print "I get printed!"
- def black_knight(): if answer == "'Tis but a scratch!": return True else: return False
- print greater_less_equal_5(4) print greater_less_equal_5(5) print greater_less_equal_5(6) // it will print -1 0 1
- we can also use if 5>4 and 4 > 3:
- original = raw_input("Enter a word:") if len(original) > 0: print original else: print "empty" // to check wheather input is empty or not.
- original = raw_input("Enter a word:") if len(original) > 0 and original.isalpha(): // to check string is non empty as well it is string only i.e. non-aplhabets (e.g. hj41) print original else: print "empty"
- slack link