2nd part of the assignment 1 Write a program that determines
Solution
# In part1 ,Please change the file path before running the program
#Part 1
\'\'\' LastName1.py\'\'\'
x1=[]
with open(\'/home/naresh/Desktop/chegg/1.txt\') as f:
for line in f:
if line[0] != \'0\':
x1.append([int(y) for y in line.split()])
x2 = set([item for sublist in x1 for item in sublist])
if len(x2) == 99:
print(\"All the numbers from 1 to 99 are covered\")
else:
print(\"Some numbers are missing, All the numbers from 1 to 99 are not covered\")
\'\'\' LastName2.py\'\'\'
#Part 2
dict1 = {\'0\':\'Ace\',\'1\':\'2\',\'2\':\'3\',\'3\':\'4\',\'4\':\'5\',\'5\':\'6\',\'6\':\'7\',\'7\':\'8\',\'8\':\'9\',\'9\':\'10\',\'10\':\'Jack\',\'11\':\'Queen\',\'12\':\'King\'}
deck = list(range(52))
l1=[]
import random
random.shuffle(deck)
l1.append(deck[0])
l1.append(deck[13])
l1.append(deck[26])
l1.append(deck[39])
for val in l1:
if val // 13 == 0:
x = val % 13
print(\"Card Number\" + \' \' + str(val) + \' \' + \"is the\" + \' \' + dict1[str(x)] + \' \' + \"of spades\")
elif val // 13 == 1:
x = val % 13
print(\"Card Number\" + \' \' + str(val) + \' \' + \"is the\" + \' \' + dict1[str(x)] + \' \' + \"of hearts\")
elif val // 13 == 2:
x = val % 13
print(\"Card Number\" + \' \' + str(val) + \' \' + \"is the\" + \' \' + dict1[str(x)] + \' \' + \"of diamonds\")
else:
x = val % 13
print(\"Card Number\" + \' \' + str(val) + \' \' + \"is the\" + \' \' + dict1[str(x)] + \' \' + \"of clubs\")
