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 random | |
| people_list = ['john' , 'sherlock' , 'molly'] ## list of random people | |
| x = random.choice(people_list) ## choosing random people to be eliminated further in the game | |
| y = random.choice(people_list) | |
| for i in range(1,10) : | |
| if i == 5 : ## whoever gets the number 5 has to go | |
| people_list.remove(x) | |
| break | |
| if len(people_list) > 1 : ## if 2 people remain , do the game again | |
| for i in range(1,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
| import random | |
| people_list = ['john' , 'sherlock' , 'molly'] | |
| while len(people_list) > 1 : | |
| for i in range(0,10) : | |
| x = random.choice(people_list) | |
| if i == 5 : | |
| people_list.remove(x) | |
| print(people_list) |
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
| consonants = ['b','c','d','f','g','h','j','k','l','m','n','p','q','r','s','t','v','w','x','y','z'] | |
| vowels = ['a','e','i','o','u'] | |
| newLetters = '{consonant}o{consonant}' ## string formatting | |
| while True : | |
| wordPut = input("enter word : ") | |
| if wordPut == "-1" : | |
| break | |
| else : | |
| myList = [letter if letter in vowels else newLetters.format(consonant = letter) for letter in wordPut] |
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
| ## explain the following code : | |
| import socket | |
| my_socket = socket.socket(socket.AF_INET,socket.SOCK_STREAM) | |
| host = 'www.google.com' | |
| port = 80 | |
| remote_ip = socket.gethostbyname(host) |
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 threading | |
| import time | |
| def loop1_10(): | |
| for i in range(1, 11): | |
| time.sleep(1) | |
| print(i) | |
| threading.Thread(target=loop1_10).start() |
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
| manager_name = input('enter name you would like to play as : ') | |
| print('hi ' + manager_name + ' , you have $120 million dollars to start with and build your very own dream team . you can buy 11 players.listed player prices are in million ') | |
| my_budget = 120 | |
| players = {'hart' : 20 ,'curtois' : 18 ,'navas' : 20 ,'bravo' : 15,'cech' : 15 ,'de gea' : 20 , 'ramos' : 40 , 'pique' : 30 , 'ronaldo' : 50 , 'messi' : 50 , 'suarez' : 45 , 'neymar' : 48 , 'bale' : 45 , 'hazard' : 42 , 'aguero' : 40 , 'smith' : 2 , 'johhny' : 4 , 'sunny' : 8 , 'patrick' : 5 , 'debian' : 3 , 'shaggy' : 4.5 , 'randy' : 3 , 'karim' : 6 } | |
| my_team = [] | |
| for i in players : |
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 random | |
| import time | |
| my_team_name = input('name your team: ') | |
| opp_team_names = ['ice slayers' , 'crazy cats' , 'red devils' , 'blue walls'] | |
| opp_team_name = random.choice(opp_team_names) | |
| print('your match is against {}'.format(opp_team_name)) | |
| pass_text = [' gives the ball to ' , ' passes it to ' , ' sharply gives it to ' , ' puts it in the path of '] | |
| defend_text = [' performs a great tackle ' , ' comes up with a meaty tackle '] | |
| shoot_text = [ 'hits the ball ' , ' curls it towards the goal ' , ' shoots '] |
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 random | |
| import time | |
| my_team_name = input('name your team: ') | |
| opp_team_names = ['ice slayers' , 'crazy cats' , 'red devils' , 'blue walls'] | |
| opp_team_name = random.choice(opp_team_names) | |
| print('your match is against {}'.format(opp_team_name)) | |
| pass_text = [' gives the ball to ' , ' passes it to ' , ' sharply gives it to ' , ' puts it in the path of '] | |
| defend_text = [' performs a great tackle ' , ' comes up with a meaty tackle '] | |
| shoot_text = [ 'hits the ball ' , ' curls it towards the goal ' , ' shoots '] |
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 time | |
| special_char = ['?' , '!' , '.' , '/'] | |
| user_password = input("enter password: ") | |
| pass_strength = len(user_password) / 2 | |
| strength_comments = ['weak' , 'good' , 'strong'] |
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 time | |
| import random | |
| game_map = [""*i for i in range(9)] | |
| spots_for_comp = [int(x) for x in range(9)] | |
| print("the empty spaces are indexed 1-9 from left to right , top to bottom , choose where to put 'x' or 'o'. ") | |
| ask_user = input("choose x or o: ") | |
| comp_sign = "" | |
| if ask_user == "x":comp_sign == "o" |