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
| dictionary = {"r":"5", "l":"7", "w":"3", "h": "1", "d": "0", "u":"4", "o":"9", "y":"2", "e":"6" } | |
| messages1 = ['d h y u y r w u u r', 'y h w e u h e h d d'] | |
| def dict_check (dict_, values): | |
| return ([k for k, v in dict_.items() if v == values])[0] |
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
| def naive_add(r1, r2): | |
| first_numerator = r1[0] | |
| first_denominator = r1[1] | |
| second_numerator = r2[0] | |
| second_denominator = r2[1] | |
| addition = ((first_numerator*second_denominator) + (second_numerator*first_denominator))/(first_denominator * second_denominator) | |
| return addition |
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
| #!/bin/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # | |
| # Complete the 'mostUnlucky' function below. |
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
| #!/bin/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # | |
| # Complete the 'char_complement' function below. |
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
| #!/bin/python3 | |
| import math | |
| import os | |
| import random | |
| import re | |
| import sys | |
| # | |
| # Complete the 'char_complement' function below. |
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
| def mult(x,y) : | |
| if y==0: | |
| return 0 | |
| else: | |
| return x + mult(x,y-1) | |
| print(mult(3,3)) |
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
| WordList = ['Jose', 'Sue', 'Ivan'] | |
| for x in WordList: | |
| print (x, x) | |
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
| import math | |
| def isPerfectSquare (n): | |
| testNumber = int(math.sqrt(n)) | |
| if(n == (testNumber * testNumber)): | |
| return True | |
| return False |
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
| player_1 = input("Please enter either rock, paper or scissors\n") | |
| player_2 = input("Please enter either rock, paper or scissors\n") | |
| game = ["rock", "paper", "scissors"] | |
| if player_1 not in game: | |
| print ("PLAYER 1 YOU HAVE NOT ENTER A VALID INPUT - GAME OVER") |
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
| def power(n): | |
| if(n<=0): | |
| return 0 | |
| else: | |
| return n**n | |
| def sumseries(num): |
NewerOlder