forked from abhaysamantni/Python_OOP
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcoin_demo5.py
More file actions
34 lines (28 loc) · 826 Bytes
/
coin_demo5.py
File metadata and controls
34 lines (28 loc) · 826 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# This program imports the simulation module and
# creates three instances of the Coin class.
import coin
def main():
# Create three objects from the Coin class.
coin1 = coin.Coin()
coin2 = coin.Coin()
coin3 = coin.Coin()
# Display the side of each coin that is facing up.
print('I have three coins with these sides up:')
print(coin1.get_sideup())
print(coin2.get_sideup())
print(coin3.get_sideup())
print()
# Toss the coin.
print('I am tossing all three coins...')
print()
coin1.toss()
coin2.toss()
coin3.toss()
# Display the side of each coin that is facing up.
print('Now here are the sides that are up:')
print(coin1.get_sideup())
print(coin2.get_sideup())
print(coin3.get_sideup())
print()
# Call the main function.
main()