compare two dictionaries | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

compare two dictionaries

import random print("highest card wins \n") print(" S = spades.\n H = hearts.\n C = clubs.\n D = diamonds.\n J = big joker.\n j = small joker.\n") P1=input("press enter to draw your card\n player one: ") print("player one drew ") myList = {"Sk": 10, "Sq": 10, "Sj": 10, "Sa": 11, "S1": 1,} myList=random.choice(list(myList)) print(myList) P2=input(" \npress enter to draw your card\n player two: ") print("player two drew ") myList1 = {"Sk": 10, "Sq": 10, "Sj": 10, "Sa": 11, "S1": 1,} myList1=random.choice(list(myList1)) print(myList1) is there a way to print something if one choice is higher or lower than the other?

27th Nov 2018, 1:03 AM
Rodney Duncan
Rodney Duncan - avatar
2 Answers
+ 2
Maybe if you use something like... If myList>myList1: print("Your card is bigger than your opponent card")
4th Dec 2018, 10:19 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar
+ 2
https://code.sololearn.com/c1buO3d8AvxC/?ref=app Idk if this will help you but i will post it just for you to see.
4th Dec 2018, 10:20 AM
🍇 Alex Tușinean 💜
🍇 Alex Tușinean 💜 - avatar