1
00:00:00,660 --> 00:00:03,600
All right. So now that you've learned all about dictionaries,

2
00:00:03,750 --> 00:00:08,750
we're going to put all of that knowledge to test and to use by building a blind

3
00:00:09,390 --> 00:00:13,860
auction program. So here's the program. When you first run it,

4
00:00:13,890 --> 00:00:18,890
it's just going to show you the logo art and maybe a line that tells you what

5
00:00:19,500 --> 00:00:22,320
program you're in. And then it's going to ask you for your name.

6
00:00:22,320 --> 00:00:26,100
So let's say we have three bidders, right? So first go,

7
00:00:26,220 --> 00:00:31,170
I go to the computer. I type in my name, I type in my bid and I hit enter.

8
00:00:31,740 --> 00:00:34,650
It asked me if there are any other bidders, I look around the room,

9
00:00:34,680 --> 00:00:37,620
I see two other colleagues. So I type yes.

10
00:00:38,160 --> 00:00:40,080
And now it clears the entire screen.

11
00:00:40,080 --> 00:00:43,470
So the other people can't see what my bid was.

12
00:00:43,860 --> 00:00:47,940
So now I leave the computer and my colleague comes over.

13
00:00:48,270 --> 00:00:52,170
They type in their name and also their bid.

14
00:00:53,460 --> 00:00:54,270
And again,

15
00:00:54,270 --> 00:00:57,660
they look around the room and they see this one other person who wants to bid.

16
00:00:57,720 --> 00:01:01,830
So they hit yes, again, it clears their bid. And finally,

17
00:01:01,830 --> 00:01:06,480
the last person makes their bid. At this point, everybody has bid

18
00:01:06,510 --> 00:01:08,100
so she's going to type no.

19
00:01:08,640 --> 00:01:12,480
And it's at this moment when our program is going to work out

20
00:01:12,600 --> 00:01:17,600
who has made the highest bid and print out who the winner is and what their bid

21
00:01:18,300 --> 00:01:22,140
was. This way, instead of competing with each other on bids,

22
00:01:22,380 --> 00:01:25,320
we actually all just give the highest price we're willing to pay

23
00:01:25,680 --> 00:01:29,190
and this is known as quite an efficient way of making a bid.

24
00:01:29,580 --> 00:01:34,230
And you see that a lot in say the construction industry and government,

25
00:01:34,230 --> 00:01:35,063
et cetera.

26
00:01:35,610 --> 00:01:40,610
The important thing in this program is you're going to start out using the blind

27
00:01:40,740 --> 00:01:42,510
auction start replit.

28
00:01:43,380 --> 00:01:47,850
And the first thing you'll notice is that I've already imported this function

29
00:01:47,850 --> 00:01:50,400
called clear from the replit module.

30
00:01:50,520 --> 00:01:55,020
And you can basically call this function, clear, whenever you want to clear the

31
00:01:55,020 --> 00:01:59,910
output just as you saw here. Whenever we typed yes after being asked

32
00:01:59,910 --> 00:02:01,110
if there are any other bidders,

33
00:02:01,130 --> 00:02:03,290
that just calls the clear

34
00:02:03,500 --> 00:02:08,000
and then it gets rid of everything that's in the console. In addition,

35
00:02:08,000 --> 00:02:11,810
we've also got the starting art of the gavel logo

36
00:02:12,110 --> 00:02:14,210
which you're going to put into the program.

37
00:02:14,600 --> 00:02:19,600
And the most important thing of all is that I want you to create a dictionary so

38
00:02:20,750 --> 00:02:25,750
that each person's name will be the key and their bid will be the value.

39
00:02:28,520 --> 00:02:33,520
And this dictionary is going to contain many of these key-value pairs

40
00:02:34,070 --> 00:02:38,510
and at the very end of the program when everybody's done with bidding,

41
00:02:38,810 --> 00:02:42,830
then we're going to loop through that dictionary and figure out who has made the

42
00:02:42,830 --> 00:02:45,200
highest bid. If you want,

43
00:02:45,260 --> 00:02:50,260
this is a good time to analyze this completed project and see if you can

44
00:02:50,750 --> 00:02:55,040
create your own flowchart using something like draw.io that I've shown you

45
00:02:55,040 --> 00:02:59,800
before, or just take a piece of paper and a pen and draw out flowchart.

46
00:03:00,460 --> 00:03:02,200
Now, if you want a hint,

47
00:03:02,290 --> 00:03:06,790
then you can head over to the course resources and you'll get taken to the flow

48
00:03:06,790 --> 00:03:10,660
chart that I've created for this program. So spoiler alert,

49
00:03:10,690 --> 00:03:13,920
I'm about to show you that flow chart. So if you don't want to see it

50
00:03:13,940 --> 00:03:17,170
and you want to create your own because it's a relatively simple program,

51
00:03:17,380 --> 00:03:20,530
then pause the video now and complete the challenge by yourself.

52
00:03:21,190 --> 00:03:24,190
Now for everybody else, who's still here, I want to show you,

53
00:03:24,190 --> 00:03:28,030
this is the flow chart I've created to represent this program.

54
00:03:28,690 --> 00:03:33,580
So we start at the beginning. We first show the logo from that file, art.py,

55
00:03:34,000 --> 00:03:36,940
and then we ask for a name input, we ask for their price.

56
00:03:37,450 --> 00:03:41,470
Now we're gonna add the name and the bid into a dictionary with the name as the

57
00:03:41,470 --> 00:03:45,430
key and the bid as the value. Now, once we're done with that,

58
00:03:45,520 --> 00:03:49,600
then we get to ask the user for another input and see if there are any other

59
00:03:49,600 --> 00:03:52,360
users who want to bid. So if they answer yes,

60
00:03:52,600 --> 00:03:55,780
then we're going to clear the screen and we're going to go back to here,

61
00:03:55,960 --> 00:04:00,790
ask for another name, another price, and so on and so forth. But if they say, no,

62
00:04:00,790 --> 00:04:02,080
everybody's done with bidding,

63
00:04:02,410 --> 00:04:05,140
then we're going to call some sort of function that we have,

64
00:04:05,380 --> 00:04:10,000
which is going to loop through our dictionary that was created here and find the

65
00:04:10,000 --> 00:04:15,000
person who had the highest bid value and then declare them as the winner and

66
00:04:15,250 --> 00:04:18,670
print out their bid. So it's a relatively simple program,

67
00:04:18,760 --> 00:04:21,010
at least compared to other things that you've built so far.

68
00:04:21,370 --> 00:04:24,760
So this is the time to pause the video and give it a go.

69
00:04:26,050 --> 00:04:29,110
I'll see you on the next lesson where we'll go through the solution together.

