Homework
Math expressions: Write and calculate these expressions in Python.
e^5
Ceiling function of the square root of 127
Card exercise
Create a tuple to represent the four suits of cards (hearts, diamonds, spades, and clubs), and another tuple for 13 possible values (2 - 10, J, Q, K, A).
Iterate over all possible cards.
Using the random module, deal three random cards.
Sets
Take input for the elements of a set (space-separated integers). Create the set, and then create another set. Print the intersection/elements in common.
Resources:
Slides: https://docs.google.com/presentation/d/1hi_-88CqHDAJwl9RUiJnrb5QTC3sjLGAQT2klFYm7iY/edit?usp=sharing
Class code: https://replit.com/join/ctozgytivw-shravyas
Contact Info:
shravyassathish@gmail.com (mentor)
kingericwu@gmail.com (TA)
felixguo41@gmail.com (TA)
1)
import math
print(math.pow(math.e,5))
print(math.ceil(math.sqrt(127)))
2)
from random import randint
tuplen = ("Hearts", "Daimonds", "Spades", "Clubs")
tuple = (2,3,4,5,6,7,8,9,10,"J","Q","K","A")
for i in tuplen:
for j in tuple:
print(str(j)+ " of " +i)
3)
setex = input("Please put some numbers separated by space: ").split()
setex = set(setex)
another = input("Please put some numbers separated by space: ").split()
another = set(another)
print(setex.intersection(another))