This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| #!/usr/bin/env python | |
| import re | |
| import json | |
| import sys | |
| report = { | |
| } | |
| reporters = ['ingress', 'puptoo', 'rhsm-conduit', 'yupana'] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This function does not take any parameters and | |
| # doesn't return any value. A non-fruitful function. | |
| def simple_function(): | |
| a = 10 | |
| b = 20 | |
| a + b | |
| def function_with_parameters(w, v, u): | |
| ''' | |
| A non-fruitful function that takes three parameters |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| num = 10 | |
| # simple way to print 10 to 2 | |
| while num > 1: | |
| print(num) | |
| num -= 1 | |
| # This would have been an infinite loop if not for the break | |
| while True: | |
| if num == 10: |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| fruits = ['apple','orange','banana','peach'] | |
| for fruit in fruits: | |
| print(fruit) | |
| # This will print from 0 to 9 | |
| for i in range(10): | |
| print(i) | |
| # This will print 5 to 7 range(start, end) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # list creation | |
| simple_list = [1, 5, 8] | |
| print('List indexing is a thing:', simple_list[0]) | |
| print('Negative number to show the end item', simple_list[-1]) | |
| simple_list.append(12) # [1, 5, 8, 12] | |
| simple_list.append(21) # [1, 5, 8, 12, 21] | |
| print('get a portion of a list [start:end]', simple_list[1:3]) # [5, 8] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Nested if-statements | |
| if True: | |
| if 2 < 3: | |
| print('This is how you write nested if') | |
| # If-else statements | |
| if 's' == 's': | |
| print('If-else statement, guys!') | |
| else: | |
| print("This won't show up, sadly") |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if 23 == 23: | |
| print('This uses indentions') |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| if(23 === 23){ | |
| console.log('This is using curly braces'); | |
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # Declaring some variables | |
| a = 3 | |
| b = 7 | |
| a > b # False | |
| a < b # True | |
| a >= b # False -- greater than or equal to | |
| a <= b # True -- less than or equal to | |
| a == b # False -- a equals b |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 1 + 4 # 5 | |
| 12 - 3 # 9 | |
| 7 * 8 # 56 | |
| 10/3 # 3.3333.... | |
| 16 % 5 # 1 - modulus operator, the remainder of the division | |
| 16 // 5 # 3 - floor division operator | |
| 2**3 # 8 - exponentiation operator |
NewerOlder