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 | |
a= random.sample(range(1,30), 7) | |
b= random.sample(range(1,30), 10) | |
result1= [] | |
result2 = [] | |
result3 = [] | |
for element in a: | |
if element in b: | |
result1.append(element) | |
print(result1) |
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 | |
cpunum = random.randrange(1,9) | |
usernum = 0 | |
count = 0 | |
print('guess a number between 1 and 9') | |
while True: | |
usernum = input() | |
count += 1 | |
if usernum== 'exit': | |
break |
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 | |
def mainfunction(): | |
while True: | |
rnum = random.randrange(1,4) | |
cpuschoice = numtochoice(rnum) | |
userscoice = input("Choose between stone, paper and scissor\n") | |
print('Cpu has choosen : ', cpuschoice) | |
print(decision(userscoice.lower(), cpuschoice)) | |
def numtochoice(num): |
NewerOlder