All language subtitles for [SubtitleTools.com] Python Tutorial for Beginners - Learn Python in 5 Hours [FULL COURSE]

af Afrikaans
sq Albanian
am Amharic
ar Arabic Download
hy Armenian
az Azerbaijani
eu Basque
be Belarusian
bn Bengali
bs Bosnian
bg Bulgarian
ca Catalan
ceb Cebuano
ny Chichewa
zh-CN Chinese (Simplified)
zh-TW Chinese (Traditional)
co Corsican
hr Croatian
cs Czech
da Danish
nl Dutch
en English
eo Esperanto
et Estonian
tl Filipino
fi Finnish
fr French
fy Frisian
gl Galician
ka Georgian
de German
el Greek
gu Gujarati
ht Haitian Creole
ha Hausa
haw Hawaiian
iw Hebrew
hi Hindi
hmn Hmong
hu Hungarian
is Icelandic
ig Igbo
id Indonesian
ga Irish
it Italian
ja Japanese
jw Javanese
kn Kannada
kk Kazakh
km Khmer
ko Korean
ku Kurdish (Kurmanji)
ky Kyrgyz
lo Lao
la Latin
lv Latvian
lt Lithuanian
lb Luxembourgish
mk Macedonian
mg Malagasy
ms Malay
ml Malayalam
mt Maltese
mi Maori
mr Marathi
mn Mongolian
my Myanmar (Burmese)
ne Nepali
no Norwegian
ps Pashto
fa Persian
pl Polish
pt Portuguese
pa Punjabi
ro Romanian
ru Russian
sm Samoan
gd Scots Gaelic
sr Serbian
st Sesotho
sn Shona
sd Sindhi
si Sinhala
sk Slovak
sl Slovenian
so Somali
es Spanish
su Sundanese
sw Swahili
sv Swedish
tg Tajik
ta Tamil
te Telugu
th Thai
tr Turkish
uk Ukrainian
ur Urdu
uz Uzbek
vi Vietnamese
cy Welsh
xh Xhosa
yi Yiddish
yo Yoruba
zu Zulu
or Odia (Oriya)
rw Kinyarwanda
tk Turkmen
tt Tatar
ug Uyghur
Would you like to inspect the original subtitles? These are the user uploaded subtitles that are being translated: 1 00:00:03,669 --> 00:00:03,679 hello and welcome to this python course 2 00:00:03,679 --> 00:00:05,430 hello and welcome to this python course in this full course you'll learn 3 00:00:05,430 --> 00:00:05,440 in this full course you'll learn 4 00:00:05,440 --> 00:00:07,349 in this full course you'll learn everything you need to get started with 5 00:00:07,349 --> 00:00:07,359 everything you need to get started with 6 00:00:07,359 --> 00:00:08,629 everything you need to get started with python 7 00:00:08,629 --> 00:00:08,639 python 8 00:00:08,639 --> 00:00:11,110 python python is the most popular programming 9 00:00:11,110 --> 00:00:11,120 python is the most popular programming 10 00:00:11,120 --> 00:00:12,230 python is the most popular programming language out there 11 00:00:12,230 --> 00:00:12,240 language out there 12 00:00:12,240 --> 00:00:14,629 language out there and is used for so many different 13 00:00:14,629 --> 00:00:14,639 and is used for so many different 14 00:00:14,639 --> 00:00:15,749 and is used for so many different industries 15 00:00:15,749 --> 00:00:15,759 industries 16 00:00:15,759 --> 00:00:18,470 industries like web development data science 17 00:00:18,470 --> 00:00:18,480 like web development data science 18 00:00:18,480 --> 00:00:19,590 like web development data science machine learning 19 00:00:19,590 --> 00:00:19,600 machine learning 20 00:00:19,600 --> 00:00:22,790 machine learning or generally for writing automation 21 00:00:22,790 --> 00:00:22,800 or generally for writing automation 22 00:00:22,800 --> 00:00:25,990 or generally for writing automation programs to automate repetitive tasks 23 00:00:25,990 --> 00:00:26,000 programs to automate repetitive tasks 24 00:00:26,000 --> 00:00:28,390 programs to automate repetitive tasks so learning python is definitely a good 25 00:00:28,390 --> 00:00:28,400 so learning python is definitely a good 26 00:00:28,400 --> 00:00:29,429 so learning python is definitely a good idea 27 00:00:29,429 --> 00:00:29,439 idea 28 00:00:29,439 --> 00:00:31,669 idea let me give you a short overview of all 29 00:00:31,669 --> 00:00:31,679 let me give you a short overview of all 30 00:00:31,679 --> 00:00:32,950 let me give you a short overview of all the topics i'll cover 31 00:00:32,950 --> 00:00:32,960 the topics i'll cover 32 00:00:32,960 --> 00:00:35,510 the topics i'll cover in this course after giving a short 33 00:00:35,510 --> 00:00:35,520 in this course after giving a short 34 00:00:35,520 --> 00:00:37,270 in this course after giving a short introduction to python 35 00:00:37,270 --> 00:00:37,280 introduction to python 36 00:00:37,280 --> 00:00:39,430 introduction to python we will start with the basic building 37 00:00:39,430 --> 00:00:39,440 we will start with the basic building 38 00:00:39,440 --> 00:00:41,430 we will start with the basic building blocks of programming 39 00:00:41,430 --> 00:00:41,440 blocks of programming 40 00:00:41,440 --> 00:00:43,510 blocks of programming the most important data types like 41 00:00:43,510 --> 00:00:43,520 the most important data types like 42 00:00:43,520 --> 00:00:44,549 the most important data types like strings 43 00:00:44,549 --> 00:00:44,559 strings 44 00:00:44,559 --> 00:00:47,670 strings numbers lists sets dictionaries 45 00:00:47,670 --> 00:00:47,680 numbers lists sets dictionaries 46 00:00:47,680 --> 00:00:50,549 numbers lists sets dictionaries boolean data types etc and how to work 47 00:00:50,549 --> 00:00:50,559 boolean data types etc and how to work 48 00:00:50,559 --> 00:00:51,910 boolean data types etc and how to work with them 49 00:00:51,910 --> 00:00:51,920 with them 50 00:00:51,920 --> 00:00:54,709 with them learn about variables and functions and 51 00:00:54,709 --> 00:00:54,719 learn about variables and functions and 52 00:00:54,719 --> 00:00:56,069 learn about variables and functions and why we need them 53 00:00:56,069 --> 00:00:56,079 why we need them 54 00:00:56,079 --> 00:00:59,189 why we need them write a program that accepts user input 55 00:00:59,189 --> 00:00:59,199 write a program that accepts user input 56 00:00:59,199 --> 00:01:01,910 write a program that accepts user input and learn how to validate the user input 57 00:01:01,910 --> 00:01:01,920 and learn how to validate the user input 58 00:01:01,920 --> 00:01:04,070 and learn how to validate the user input using conditionals 59 00:01:04,070 --> 00:01:04,080 using conditionals 60 00:01:04,080 --> 00:01:07,190 using conditionals error handling with try accept 61 00:01:07,190 --> 00:01:07,200 error handling with try accept 62 00:01:07,200 --> 00:01:10,230 error handling with try accept and also learn loops with while and for 63 00:01:10,230 --> 00:01:10,240 and also learn loops with while and for 64 00:01:10,240 --> 00:01:10,870 and also learn loops with while and for loops 65 00:01:10,870 --> 00:01:10,880 loops 66 00:01:10,880 --> 00:01:13,990 loops and again why we actually need them you 67 00:01:13,990 --> 00:01:14,000 and again why we actually need them you 68 00:01:14,000 --> 00:01:15,590 and again why we actually need them you will learn all these concepts 69 00:01:15,590 --> 00:01:15,600 will learn all these concepts 70 00:01:15,600 --> 00:01:19,350 will learn all these concepts with hands-on examples as a next step 71 00:01:19,350 --> 00:01:19,360 with hands-on examples as a next step 72 00:01:19,360 --> 00:01:21,350 with hands-on examples as a next step you will learn how to modularize your 73 00:01:21,350 --> 00:01:21,360 you will learn how to modularize your 74 00:01:21,360 --> 00:01:23,109 you will learn how to modularize your program by writing 75 00:01:23,109 --> 00:01:23,119 program by writing 76 00:01:23,119 --> 00:01:25,749 program by writing your own modules and then see how to use 77 00:01:25,749 --> 00:01:25,759 your own modules and then see how to use 78 00:01:25,759 --> 00:01:26,149 your own modules and then see how to use some 79 00:01:26,149 --> 00:01:26,159 some 80 00:01:26,159 --> 00:01:29,109 some built-in python modules with all this 81 00:01:29,109 --> 00:01:29,119 built-in python modules with all this 82 00:01:29,119 --> 00:01:30,230 built-in python modules with all this knowledge we can then 83 00:01:30,230 --> 00:01:30,240 knowledge we can then 84 00:01:30,240 --> 00:01:33,030 knowledge we can then build our next demo project to write a 85 00:01:33,030 --> 00:01:33,040 build our next demo project to write a 86 00:01:33,040 --> 00:01:33,990 build our next demo project to write a small program 87 00:01:33,990 --> 00:01:34,000 small program 88 00:01:34,000 --> 00:01:37,749 small program that accepts a goal and a deadline 89 00:01:37,749 --> 00:01:37,759 that accepts a goal and a deadline 90 00:01:37,759 --> 00:01:40,310 that accepts a goal and a deadline as user input and then outputs the 91 00:01:40,310 --> 00:01:40,320 as user input and then outputs the 92 00:01:40,320 --> 00:01:41,190 as user input and then outputs the number of days 93 00:01:41,190 --> 00:01:41,200 number of days 94 00:01:41,200 --> 00:01:44,310 number of days remaining till the goal deadline 95 00:01:44,310 --> 00:01:44,320 remaining till the goal deadline 96 00:01:44,320 --> 00:01:46,310 remaining till the goal deadline within this exercise you will learn how 97 00:01:46,310 --> 00:01:46,320 within this exercise you will learn how 98 00:01:46,320 --> 00:01:47,749 within this exercise you will learn how to use the date 99 00:01:47,749 --> 00:01:47,759 to use the date 100 00:01:47,759 --> 00:01:50,870 to use the date time module to work with dates 101 00:01:50,870 --> 00:01:50,880 time module to work with dates 102 00:01:50,880 --> 00:01:53,429 time module to work with dates after that you will learn about packages 103 00:01:53,429 --> 00:01:53,439 after that you will learn about packages 104 00:01:53,439 --> 00:01:55,510 after that you will learn about packages and comparison of package 105 00:01:55,510 --> 00:01:55,520 and comparison of package 106 00:01:55,520 --> 00:01:58,709 and comparison of package versus module and we will use an 107 00:01:58,709 --> 00:01:58,719 versus module and we will use an 108 00:01:58,719 --> 00:02:02,149 versus module and we will use an external python package in our next demo 109 00:02:02,149 --> 00:02:02,159 external python package in our next demo 110 00:02:02,159 --> 00:02:02,709 external python package in our next demo project 111 00:02:02,709 --> 00:02:02,719 project 112 00:02:02,719 --> 00:02:05,350 project in which we will automate some tasks for 113 00:02:05,350 --> 00:02:05,360 in which we will automate some tasks for 114 00:02:05,360 --> 00:02:07,670 in which we will automate some tasks for working with a spreadsheet file 115 00:02:07,670 --> 00:02:07,680 working with a spreadsheet file 116 00:02:07,680 --> 00:02:10,469 working with a spreadsheet file finally we dive into object-oriented 117 00:02:10,469 --> 00:02:10,479 finally we dive into object-oriented 118 00:02:10,479 --> 00:02:11,350 finally we dive into object-oriented programming 119 00:02:11,350 --> 00:02:11,360 programming 120 00:02:11,360 --> 00:02:13,670 programming you will learn what classes and objects 121 00:02:13,670 --> 00:02:13,680 you will learn what classes and objects 122 00:02:13,680 --> 00:02:15,030 you will learn what classes and objects are in programming 123 00:02:15,030 --> 00:02:15,040 are in programming 124 00:02:15,040 --> 00:02:17,750 are in programming and python specifically and why this 125 00:02:17,750 --> 00:02:17,760 and python specifically and why this 126 00:02:17,760 --> 00:02:18,710 and python specifically and why this concept is 127 00:02:18,710 --> 00:02:18,720 concept is 128 00:02:18,720 --> 00:02:22,070 concept is so useful in the final demo project you 129 00:02:22,070 --> 00:02:22,080 so useful in the final demo project you 130 00:02:22,080 --> 00:02:24,229 so useful in the final demo project you will learn another common use case with 131 00:02:24,229 --> 00:02:24,239 will learn another common use case with 132 00:02:24,239 --> 00:02:25,030 will learn another common use case with python 133 00:02:25,030 --> 00:02:25,040 python 134 00:02:25,040 --> 00:02:27,430 python which is communicating with other 135 00:02:27,430 --> 00:02:27,440 which is communicating with other 136 00:02:27,440 --> 00:02:28,390 which is communicating with other applications 137 00:02:28,390 --> 00:02:28,400 applications 138 00:02:28,400 --> 00:02:31,589 applications over the internet by making a request 139 00:02:31,589 --> 00:02:31,599 over the internet by making a request 140 00:02:31,599 --> 00:02:34,710 over the internet by making a request to fetch some data from gitlab api 141 00:02:34,710 --> 00:02:34,720 to fetch some data from gitlab api 142 00:02:34,720 --> 00:02:37,509 to fetch some data from gitlab api in this specific case we will list the 143 00:02:37,509 --> 00:02:37,519 in this specific case we will list the 144 00:02:37,519 --> 00:02:38,710 in this specific case we will list the gitlab projects 145 00:02:38,710 --> 00:02:38,720 gitlab projects 146 00:02:38,720 --> 00:02:42,070 gitlab projects of a specific user so that's what we're 147 00:02:42,070 --> 00:02:42,080 of a specific user so that's what we're 148 00:02:42,080 --> 00:02:43,030 of a specific user so that's what we're gonna learn 149 00:02:43,030 --> 00:02:43,040 gonna learn 150 00:02:43,040 --> 00:02:45,750 gonna learn if you like this course don't forget to 151 00:02:45,750 --> 00:02:45,760 if you like this course don't forget to 152 00:02:45,760 --> 00:02:47,990 if you like this course don't forget to give this video a thumbs up 153 00:02:47,990 --> 00:02:48,000 give this video a thumbs up 154 00:02:48,000 --> 00:02:50,150 give this video a thumbs up i'm really excited to teach you all of 155 00:02:50,150 --> 00:02:50,160 i'm really excited to teach you all of 156 00:02:50,160 --> 00:02:51,030 i'm really excited to teach you all of these so 157 00:02:51,030 --> 00:02:51,040 these so 158 00:02:51,040 --> 00:02:55,190 these so let's get started 159 00:02:57,589 --> 00:02:57,599 first of all python is a programming 160 00:02:57,599 --> 00:02:58,309 first of all python is a programming language 161 00:02:58,309 --> 00:02:58,319 language 162 00:02:58,319 --> 00:03:01,110 language just like java or javascript python 163 00:03:01,110 --> 00:03:01,120 just like java or javascript python 164 00:03:01,120 --> 00:03:03,030 just like java or javascript python compared to other languages 165 00:03:03,030 --> 00:03:03,040 compared to other languages 166 00:03:03,040 --> 00:03:06,550 compared to other languages has two very big advantages first of all 167 00:03:06,550 --> 00:03:06,560 has two very big advantages first of all 168 00:03:06,560 --> 00:03:08,710 has two very big advantages first of all it's easy to learn it has a simple 169 00:03:08,710 --> 00:03:08,720 it's easy to learn it has a simple 170 00:03:08,720 --> 00:03:09,589 it's easy to learn it has a simple syntax 171 00:03:09,589 --> 00:03:09,599 syntax 172 00:03:09,599 --> 00:03:11,830 syntax and it's very easy to set up and get 173 00:03:11,830 --> 00:03:11,840 and it's very easy to set up and get 174 00:03:11,840 --> 00:03:12,710 and it's very easy to set up and get started with 175 00:03:12,710 --> 00:03:12,720 started with 176 00:03:12,720 --> 00:03:15,270 started with for example compared to java where you 177 00:03:15,270 --> 00:03:15,280 for example compared to java where you 178 00:03:15,280 --> 00:03:15,910 for example compared to java where you need 179 00:03:15,910 --> 00:03:15,920 need 180 00:03:15,920 --> 00:03:18,229 need some initial configuration before you 181 00:03:18,229 --> 00:03:18,239 some initial configuration before you 182 00:03:18,239 --> 00:03:20,229 some initial configuration before you can even start your application 183 00:03:20,229 --> 00:03:20,239 can even start your application 184 00:03:20,239 --> 00:03:22,710 can even start your application but it's equally or even more powerful 185 00:03:22,710 --> 00:03:22,720 but it's equally or even more powerful 186 00:03:22,720 --> 00:03:23,589 but it's equally or even more powerful than java 187 00:03:23,589 --> 00:03:23,599 than java 188 00:03:23,599 --> 00:03:26,390 than java now what makes a language powerful or 189 00:03:26,390 --> 00:03:26,400 now what makes a language powerful or 190 00:03:26,400 --> 00:03:28,390 now what makes a language powerful or how can i say that python is more 191 00:03:28,390 --> 00:03:28,400 how can i say that python is more 192 00:03:28,400 --> 00:03:29,430 how can i say that python is more powerful 193 00:03:29,430 --> 00:03:29,440 powerful 194 00:03:29,440 --> 00:03:32,630 powerful well that comes from the ecosystem which 195 00:03:32,630 --> 00:03:32,640 well that comes from the ecosystem which 196 00:03:32,640 --> 00:03:33,430 well that comes from the ecosystem which means 197 00:03:33,430 --> 00:03:33,440 means 198 00:03:33,440 --> 00:03:35,670 means libraries and modules that python 199 00:03:35,670 --> 00:03:35,680 libraries and modules that python 200 00:03:35,680 --> 00:03:37,750 libraries and modules that python developers themselves develop 201 00:03:37,750 --> 00:03:37,760 developers themselves develop 202 00:03:37,760 --> 00:03:40,550 developers themselves develop but also external developers create and 203 00:03:40,550 --> 00:03:40,560 but also external developers create and 204 00:03:40,560 --> 00:03:41,430 but also external developers create and maintain 205 00:03:41,430 --> 00:03:41,440 maintain 206 00:03:41,440 --> 00:03:44,149 maintain so the more people adopt the language 207 00:03:44,149 --> 00:03:44,159 so the more people adopt the language 208 00:03:44,159 --> 00:03:46,390 so the more people adopt the language the more powerful it gets because 209 00:03:46,390 --> 00:03:46,400 the more powerful it gets because 210 00:03:46,400 --> 00:03:49,190 the more powerful it gets because new libraries and so new functionalities 211 00:03:49,190 --> 00:03:49,200 new libraries and so new functionalities 212 00:03:49,200 --> 00:03:50,789 new libraries and so new functionalities get added to it 213 00:03:50,789 --> 00:03:50,799 get added to it 214 00:03:50,799 --> 00:03:52,710 get added to it and the second advantage is that it's 215 00:03:52,710 --> 00:03:52,720 and the second advantage is that it's 216 00:03:52,720 --> 00:03:54,789 and the second advantage is that it's flexible now what does a 217 00:03:54,789 --> 00:03:54,799 flexible now what does a 218 00:03:54,799 --> 00:03:57,270 flexible now what does a flexible mean in this case what makes a 219 00:03:57,270 --> 00:03:57,280 flexible mean in this case what makes a 220 00:03:57,280 --> 00:03:58,789 flexible mean in this case what makes a language flexible 221 00:03:58,789 --> 00:03:58,799 language flexible 222 00:03:58,799 --> 00:04:01,990 language flexible it is easy to mold to your wishes 223 00:04:01,990 --> 00:04:02,000 it is easy to mold to your wishes 224 00:04:02,000 --> 00:04:04,550 it is easy to mold to your wishes so you are not limited or restricted by 225 00:04:04,550 --> 00:04:04,560 so you are not limited or restricted by 226 00:04:04,560 --> 00:04:06,229 so you are not limited or restricted by the language specifics like 227 00:04:06,229 --> 00:04:06,239 the language specifics like 228 00:04:06,239 --> 00:04:09,589 the language specifics like syntax or data types or some other 229 00:04:09,589 --> 00:04:09,599 syntax or data types or some other 230 00:04:09,599 --> 00:04:10,550 syntax or data types or some other constraints 231 00:04:10,550 --> 00:04:10,560 constraints 232 00:04:10,560 --> 00:04:13,670 constraints or even library functionalities you can 233 00:04:13,670 --> 00:04:13,680 or even library functionalities you can 234 00:04:13,680 --> 00:04:14,550 or even library functionalities you can extend 235 00:04:14,550 --> 00:04:14,560 extend 236 00:04:14,560 --> 00:04:17,909 extend python widely and as one of the results 237 00:04:17,909 --> 00:04:17,919 python widely and as one of the results 238 00:04:17,919 --> 00:04:19,670 python widely and as one of the results of this flexibility 239 00:04:19,670 --> 00:04:19,680 of this flexibility 240 00:04:19,680 --> 00:04:22,469 of this flexibility python also became a multi-purpose 241 00:04:22,469 --> 00:04:22,479 python also became a multi-purpose 242 00:04:22,479 --> 00:04:23,430 python also became a multi-purpose language 243 00:04:23,430 --> 00:04:23,440 language 244 00:04:23,440 --> 00:04:25,510 language meaning it is used for many different 245 00:04:25,510 --> 00:04:25,520 meaning it is used for many different 246 00:04:25,520 --> 00:04:26,469 meaning it is used for many different categories 247 00:04:26,469 --> 00:04:26,479 categories 248 00:04:26,479 --> 00:04:31,510 categories so let's see what these categories are 249 00:04:33,350 --> 00:04:33,360 first you can use it to write web 250 00:04:33,360 --> 00:04:35,749 first you can use it to write web applications the popular libraries for 251 00:04:35,749 --> 00:04:35,759 applications the popular libraries for 252 00:04:35,759 --> 00:04:36,870 applications the popular libraries for that are django 253 00:04:36,870 --> 00:04:36,880 that are django 254 00:04:36,880 --> 00:04:40,390 that are django or more lightweight flask python became 255 00:04:40,390 --> 00:04:40,400 or more lightweight flask python became 256 00:04:40,400 --> 00:04:43,189 or more lightweight flask python became extremely popular because of the rise of 257 00:04:43,189 --> 00:04:43,199 extremely popular because of the rise of 258 00:04:43,199 --> 00:04:44,390 extremely popular because of the rise of data science 259 00:04:44,390 --> 00:04:44,400 data science 260 00:04:44,400 --> 00:04:46,710 data science machine learning and artificial 261 00:04:46,710 --> 00:04:46,720 machine learning and artificial 262 00:04:46,720 --> 00:04:47,830 machine learning and artificial intelligence 263 00:04:47,830 --> 00:04:47,840 intelligence 264 00:04:47,840 --> 00:04:50,870 intelligence industries and more and more libraries 265 00:04:50,870 --> 00:04:50,880 industries and more and more libraries 266 00:04:50,880 --> 00:04:51,749 industries and more and more libraries were created 267 00:04:51,749 --> 00:04:51,759 were created 268 00:04:51,759 --> 00:04:54,629 were created and are still being added for python for 269 00:04:54,629 --> 00:04:54,639 and are still being added for python for 270 00:04:54,639 --> 00:04:56,230 and are still being added for python for all these categories 271 00:04:56,230 --> 00:04:56,240 all these categories 272 00:04:56,240 --> 00:04:58,310 all these categories they are very popular and highly used 273 00:04:58,310 --> 00:04:58,320 they are very popular and highly used 274 00:04:58,320 --> 00:04:59,510 they are very popular and highly used libraries for 275 00:04:59,510 --> 00:04:59,520 libraries for 276 00:04:59,520 --> 00:05:02,230 libraries for data analysis and data visualization 277 00:05:02,230 --> 00:05:02,240 data analysis and data visualization 278 00:05:02,240 --> 00:05:03,189 data analysis and data visualization libraries for 279 00:05:03,189 --> 00:05:03,199 libraries for 280 00:05:03,199 --> 00:05:05,590 libraries for artificial intelligence projects for 281 00:05:05,590 --> 00:05:05,600 artificial intelligence projects for 282 00:05:05,600 --> 00:05:06,230 artificial intelligence projects for things like 283 00:05:06,230 --> 00:05:06,240 things like 284 00:05:06,240 --> 00:05:08,950 things like face recognition voice recognition and a 285 00:05:08,950 --> 00:05:08,960 face recognition voice recognition and a 286 00:05:08,960 --> 00:05:10,710 face recognition voice recognition and a bunch of very powerful 287 00:05:10,710 --> 00:05:10,720 bunch of very powerful 288 00:05:10,720 --> 00:05:13,110 bunch of very powerful and widely used machine learning 289 00:05:13,110 --> 00:05:13,120 and widely used machine learning 290 00:05:13,120 --> 00:05:14,150 and widely used machine learning libraries 291 00:05:14,150 --> 00:05:14,160 libraries 292 00:05:14,160 --> 00:05:17,110 libraries python is also often used for data 293 00:05:17,110 --> 00:05:17,120 python is also often used for data 294 00:05:17,120 --> 00:05:17,909 python is also often used for data collection 295 00:05:17,909 --> 00:05:17,919 collection 296 00:05:17,919 --> 00:05:20,550 collection like scraping the web creating web 297 00:05:20,550 --> 00:05:20,560 like scraping the web creating web 298 00:05:20,560 --> 00:05:21,270 like scraping the web creating web crawlers 299 00:05:21,270 --> 00:05:21,280 crawlers 300 00:05:21,280 --> 00:05:23,270 crawlers that are basically programs that collect 301 00:05:23,270 --> 00:05:23,280 that are basically programs that collect 302 00:05:23,280 --> 00:05:24,870 that are basically programs that collect data from internet 303 00:05:24,870 --> 00:05:24,880 data from internet 304 00:05:24,880 --> 00:05:26,790 data from internet which you can save and then process 305 00:05:26,790 --> 00:05:26,800 which you can save and then process 306 00:05:26,800 --> 00:05:28,150 which you can save and then process later again 307 00:05:28,150 --> 00:05:28,160 later again 308 00:05:28,160 --> 00:05:29,990 later again many different powerful libraries to do 309 00:05:29,990 --> 00:05:30,000 many different powerful libraries to do 310 00:05:30,000 --> 00:05:31,189 many different powerful libraries to do all of that 311 00:05:31,189 --> 00:05:31,199 all of that 312 00:05:31,199 --> 00:05:34,629 all of that and finally automation with python 313 00:05:34,629 --> 00:05:34,639 and finally automation with python 314 00:05:34,639 --> 00:05:36,790 and finally automation with python python has many great libraries to 315 00:05:36,790 --> 00:05:36,800 python has many great libraries to 316 00:05:36,800 --> 00:05:37,749 python has many great libraries to automate 317 00:05:37,749 --> 00:05:37,759 automate 318 00:05:37,759 --> 00:05:40,230 automate devops tasks for example starting from 319 00:05:40,230 --> 00:05:40,240 devops tasks for example starting from 320 00:05:40,240 --> 00:05:41,189 devops tasks for example starting from ci cd 321 00:05:41,189 --> 00:05:41,199 ci cd 322 00:05:41,199 --> 00:05:43,510 ci cd pipelines to cloud platforms and 323 00:05:43,510 --> 00:05:43,520 pipelines to cloud platforms and 324 00:05:43,520 --> 00:05:45,189 pipelines to cloud platforms and monitoring your infrastructure 325 00:05:45,189 --> 00:05:45,199 monitoring your infrastructure 326 00:05:45,199 --> 00:05:48,550 monitoring your infrastructure etc you can also write python scripts to 327 00:05:48,550 --> 00:05:48,560 etc you can also write python scripts to 328 00:05:48,560 --> 00:05:48,870 etc you can also write python scripts to do 329 00:05:48,870 --> 00:05:48,880 do 330 00:05:48,880 --> 00:05:51,110 do automated backups cleanups on the 331 00:05:51,110 --> 00:05:51,120 automated backups cleanups on the 332 00:05:51,120 --> 00:05:52,790 automated backups cleanups on the servers etc 333 00:05:52,790 --> 00:05:52,800 servers etc 334 00:05:52,800 --> 00:05:55,270 servers etc in addition to devops tasks you can also 335 00:05:55,270 --> 00:05:55,280 in addition to devops tasks you can also 336 00:05:55,280 --> 00:05:56,070 in addition to devops tasks you can also automate 337 00:05:56,070 --> 00:05:56,080 automate 338 00:05:56,080 --> 00:05:58,710 automate just general tasks with python like when 339 00:05:58,710 --> 00:05:58,720 just general tasks with python like when 340 00:05:58,720 --> 00:05:59,510 just general tasks with python like when working with 341 00:05:59,510 --> 00:05:59,520 working with 342 00:05:59,520 --> 00:06:02,150 working with excel sheets which is a common use case 343 00:06:02,150 --> 00:06:02,160 excel sheets which is a common use case 344 00:06:02,160 --> 00:06:03,670 excel sheets which is a common use case in many big companies 345 00:06:03,670 --> 00:06:03,680 in many big companies 346 00:06:03,680 --> 00:06:05,909 in many big companies or automating some tasks on your own 347 00:06:05,909 --> 00:06:05,919 or automating some tasks on your own 348 00:06:05,919 --> 00:06:07,189 or automating some tasks on your own laptop 349 00:06:07,189 --> 00:06:07,199 laptop 350 00:06:07,199 --> 00:06:09,590 laptop and there are also libraries for mobile 351 00:06:09,590 --> 00:06:09,600 and there are also libraries for mobile 352 00:06:09,600 --> 00:06:10,469 and there are also libraries for mobile development 353 00:06:10,469 --> 00:06:10,479 development 354 00:06:10,479 --> 00:06:13,749 development gaming desktop applications but 355 00:06:13,749 --> 00:06:13,759 gaming desktop applications but 356 00:06:13,759 --> 00:06:15,830 gaming desktop applications but these are less likely use cases for 357 00:06:15,830 --> 00:06:15,840 these are less likely use cases for 358 00:06:15,840 --> 00:06:17,430 these are less likely use cases for python because there are better 359 00:06:17,430 --> 00:06:17,440 python because there are better 360 00:06:17,440 --> 00:06:18,469 python because there are better alternatives 361 00:06:18,469 --> 00:06:18,479 alternatives 362 00:06:18,479 --> 00:06:21,909 alternatives for that so you see that the use cases 363 00:06:21,909 --> 00:06:21,919 for that so you see that the use cases 364 00:06:21,919 --> 00:06:24,230 for that so you see that the use cases for python are pretty vast and it 365 00:06:24,230 --> 00:06:24,240 for python are pretty vast and it 366 00:06:24,240 --> 00:06:25,590 for python are pretty vast and it actually spans 367 00:06:25,590 --> 00:06:25,600 actually spans 368 00:06:25,600 --> 00:06:27,830 actually spans several industries and it's mostly 369 00:06:27,830 --> 00:06:27,840 several industries and it's mostly 370 00:06:27,840 --> 00:06:28,790 several industries and it's mostly concentrated 371 00:06:28,790 --> 00:06:28,800 concentrated 372 00:06:28,800 --> 00:06:31,029 concentrated around data analytics machine learning 373 00:06:31,029 --> 00:06:31,039 around data analytics machine learning 374 00:06:31,039 --> 00:06:31,990 around data analytics machine learning and automation 375 00:06:31,990 --> 00:06:32,000 and automation 376 00:06:32,000 --> 00:06:34,710 and automation areas and note that this isn't the case 377 00:06:34,710 --> 00:06:34,720 areas and note that this isn't the case 378 00:06:34,720 --> 00:06:36,710 areas and note that this isn't the case for many other programming languages 379 00:06:36,710 --> 00:06:36,720 for many other programming languages 380 00:06:36,720 --> 00:06:39,110 for many other programming languages usually one programming language is good 381 00:06:39,110 --> 00:06:39,120 usually one programming language is good 382 00:06:39,120 --> 00:06:39,830 usually one programming language is good for just 383 00:06:39,830 --> 00:06:39,840 for just 384 00:06:39,840 --> 00:06:42,550 for just few things and you should use something 385 00:06:42,550 --> 00:06:42,560 few things and you should use something 386 00:06:42,560 --> 00:06:43,270 few things and you should use something else 387 00:06:43,270 --> 00:06:43,280 else 388 00:06:43,280 --> 00:06:46,150 else for other use cases so now you see how 389 00:06:46,150 --> 00:06:46,160 for other use cases so now you see how 390 00:06:46,160 --> 00:06:46,870 for other use cases so now you see how useful 391 00:06:46,870 --> 00:06:46,880 useful 392 00:06:46,880 --> 00:06:49,270 useful python knowledge could be and how it can 393 00:06:49,270 --> 00:06:49,280 python knowledge could be and how it can 394 00:06:49,280 --> 00:06:49,909 python knowledge could be and how it can help you 395 00:06:49,909 --> 00:06:49,919 help you 396 00:06:49,919 --> 00:06:52,950 help you in your job but also make you more 397 00:06:52,950 --> 00:06:52,960 in your job but also make you more 398 00:06:52,960 --> 00:06:55,350 in your job but also make you more valuable at your work and for your 399 00:06:55,350 --> 00:06:55,360 valuable at your work and for your 400 00:06:55,360 --> 00:06:56,550 valuable at your work and for your entire team 401 00:06:56,550 --> 00:06:56,560 entire team 402 00:06:56,560 --> 00:06:58,309 entire team i hope you are already excited to learn 403 00:06:58,309 --> 00:06:58,319 i hope you are already excited to learn 404 00:06:58,319 --> 00:07:03,589 i hope you are already excited to learn python so let's get started 405 00:07:03,589 --> 00:07:03,599 python so let's get started 406 00:07:03,599 --> 00:07:05,749 python so let's get started as a first step we're going to configure 407 00:07:05,749 --> 00:07:05,759 as a first step we're going to configure 408 00:07:05,759 --> 00:07:07,110 as a first step we're going to configure our local 409 00:07:07,110 --> 00:07:07,120 our local 410 00:07:07,120 --> 00:07:09,830 our local python development environment so the 411 00:07:09,830 --> 00:07:09,840 python development environment so the 412 00:07:09,840 --> 00:07:10,790 python development environment so the first thing we need 413 00:07:10,790 --> 00:07:10,800 first thing we need 414 00:07:10,800 --> 00:07:13,990 first thing we need is install python locally 415 00:07:13,990 --> 00:07:14,000 is install python locally 416 00:07:14,000 --> 00:07:17,350 is install python locally on our laptop so first we 417 00:07:17,350 --> 00:07:17,360 on our laptop so first we 418 00:07:17,360 --> 00:07:20,550 on our laptop so first we install or download python package 419 00:07:20,550 --> 00:07:20,560 install or download python package 420 00:07:20,560 --> 00:07:23,350 install or download python package for your specific operating system and 421 00:07:23,350 --> 00:07:23,360 for your specific operating system and 422 00:07:23,360 --> 00:07:25,189 for your specific operating system and then basically just click through the 423 00:07:25,189 --> 00:07:25,199 then basically just click through the 424 00:07:25,199 --> 00:07:26,550 then basically just click through the installer 425 00:07:26,550 --> 00:07:26,560 installer 426 00:07:26,560 --> 00:07:29,670 installer wizard to install python 427 00:07:29,670 --> 00:07:29,680 wizard to install python 428 00:07:29,680 --> 00:07:32,870 wizard to install python locally on your laptop 429 00:07:32,870 --> 00:07:32,880 locally on your laptop 430 00:07:32,880 --> 00:07:34,870 locally on your laptop and note that if you're doing this on 431 00:07:34,870 --> 00:07:34,880 and note that if you're doing this on 432 00:07:34,880 --> 00:07:36,150 and note that if you're doing this on windows 433 00:07:36,150 --> 00:07:36,160 windows 434 00:07:36,160 --> 00:07:38,710 windows very important step in the installation 435 00:07:38,710 --> 00:07:38,720 very important step in the installation 436 00:07:38,720 --> 00:07:40,070 very important step in the installation process would be to 437 00:07:40,070 --> 00:07:40,080 process would be to 438 00:07:40,080 --> 00:07:43,270 process would be to check the ed python to 439 00:07:43,270 --> 00:07:43,280 check the ed python to 440 00:07:43,280 --> 00:07:46,710 check the ed python to path option basically that you see here 441 00:07:46,710 --> 00:07:46,720 path option basically that you see here 442 00:07:46,720 --> 00:07:49,510 path option basically that you see here because by default it is unchecked and 443 00:07:49,510 --> 00:07:49,520 because by default it is unchecked and 444 00:07:49,520 --> 00:07:50,550 because by default it is unchecked and you have to 445 00:07:50,550 --> 00:07:50,560 you have to 446 00:07:50,560 --> 00:07:52,629 you have to check mark it so that after the 447 00:07:52,629 --> 00:07:52,639 check mark it so that after the 448 00:07:52,639 --> 00:07:53,589 check mark it so that after the installation 449 00:07:53,589 --> 00:07:53,599 installation 450 00:07:53,599 --> 00:07:55,830 installation you'll be able to execute python 451 00:07:55,830 --> 00:07:55,840 you'll be able to execute python 452 00:07:55,840 --> 00:07:58,230 you'll be able to execute python commands in your terminal 453 00:07:58,230 --> 00:07:58,240 commands in your terminal 454 00:07:58,240 --> 00:07:59,990 commands in your terminal now an interesting note here if you're 455 00:07:59,990 --> 00:08:00,000 now an interesting note here if you're 456 00:08:00,000 --> 00:08:01,749 now an interesting note here if you're using mac os 457 00:08:01,749 --> 00:08:01,759 using mac os 458 00:08:01,759 --> 00:08:05,430 using mac os like i do is that by default 459 00:08:05,430 --> 00:08:05,440 like i do is that by default 460 00:08:05,440 --> 00:08:07,909 like i do is that by default on mac os there is python already 461 00:08:07,909 --> 00:08:07,919 on mac os there is python already 462 00:08:07,919 --> 00:08:08,710 on mac os there is python already installed 463 00:08:08,710 --> 00:08:08,720 installed 464 00:08:08,720 --> 00:08:12,309 installed so if i do python version 465 00:08:12,309 --> 00:08:12,319 so if i do python version 466 00:08:12,319 --> 00:08:15,189 so if i do python version and execute i see that python version 467 00:08:15,189 --> 00:08:15,199 and execute i see that python version 468 00:08:15,199 --> 00:08:16,550 and execute i see that python version 2.7 469 00:08:16,550 --> 00:08:16,560 2.7 470 00:08:16,560 --> 00:08:19,110 2.7 10 is installed and that is actually 471 00:08:19,110 --> 00:08:19,120 10 is installed and that is actually 472 00:08:19,120 --> 00:08:19,909 10 is installed and that is actually python 473 00:08:19,909 --> 00:08:19,919 python 474 00:08:19,919 --> 00:08:22,629 python that mac os the operating system itself 475 00:08:22,629 --> 00:08:22,639 that mac os the operating system itself 476 00:08:22,639 --> 00:08:23,670 that mac os the operating system itself is using 477 00:08:23,670 --> 00:08:23,680 is using 478 00:08:23,680 --> 00:08:26,550 is using however for our tutorial and generally 479 00:08:26,550 --> 00:08:26,560 however for our tutorial and generally 480 00:08:26,560 --> 00:08:28,070 however for our tutorial and generally when working with python 481 00:08:28,070 --> 00:08:28,080 when working with python 482 00:08:28,080 --> 00:08:30,390 when working with python we want to be using the newest version 483 00:08:30,390 --> 00:08:30,400 we want to be using the newest version 484 00:08:30,400 --> 00:08:31,110 we want to be using the newest version which is 485 00:08:31,110 --> 00:08:31,120 which is 486 00:08:31,120 --> 00:08:33,990 which is python 3. so we're going to leave that 487 00:08:33,990 --> 00:08:34,000 python 3. so we're going to leave that 488 00:08:34,000 --> 00:08:35,990 python 3. so we're going to leave that default python installation 489 00:08:35,990 --> 00:08:36,000 default python installation 490 00:08:36,000 --> 00:08:37,750 default python installation alone we're not going to use that or 491 00:08:37,750 --> 00:08:37,760 alone we're not going to use that or 492 00:08:37,760 --> 00:08:39,829 alone we're not going to use that or touched it and instead we're going to be 493 00:08:39,829 --> 00:08:39,839 touched it and instead we're going to be 494 00:08:39,839 --> 00:08:41,029 touched it and instead we're going to be using 495 00:08:41,029 --> 00:08:41,039 using 496 00:08:41,039 --> 00:08:43,990 using the python version 3 that we just 497 00:08:43,990 --> 00:08:44,000 the python version 3 that we just 498 00:08:44,000 --> 00:08:45,990 the python version 3 that we just installed locally 499 00:08:45,990 --> 00:08:46,000 installed locally 500 00:08:46,000 --> 00:08:48,870 installed locally so now if i clean this up and we want to 501 00:08:48,870 --> 00:08:48,880 so now if i clean this up and we want to 502 00:08:48,880 --> 00:08:49,509 so now if i clean this up and we want to execute 503 00:08:49,509 --> 00:08:49,519 execute 504 00:08:49,519 --> 00:08:52,630 execute python version 3 commands we're going to 505 00:08:52,630 --> 00:08:52,640 python version 3 commands we're going to 506 00:08:52,640 --> 00:08:54,949 python version 3 commands we're going to do python 3 instead 507 00:08:54,949 --> 00:08:54,959 do python 3 instead 508 00:08:54,959 --> 00:08:58,230 do python 3 instead and version and that will give us the 509 00:08:58,230 --> 00:08:58,240 and version and that will give us the 510 00:08:58,240 --> 00:08:59,430 and version and that will give us the version so that's how we can 511 00:08:59,430 --> 00:08:59,440 version so that's how we can 512 00:08:59,440 --> 00:09:01,030 version so that's how we can differentiate between 513 00:09:01,030 --> 00:09:01,040 differentiate between 514 00:09:01,040 --> 00:09:04,150 differentiate between the already installed python and 515 00:09:04,150 --> 00:09:04,160 the already installed python and 516 00:09:04,160 --> 00:09:05,670 the already installed python and the newest version that we just 517 00:09:05,670 --> 00:09:05,680 the newest version that we just 518 00:09:05,680 --> 00:09:07,350 the newest version that we just installed so just be 519 00:09:07,350 --> 00:09:07,360 installed so just be 520 00:09:07,360 --> 00:09:11,990 installed so just be aware of that difference 521 00:09:13,990 --> 00:09:14,000 now that we have python available 522 00:09:14,000 --> 00:09:15,990 now that we have python available locally it's time to 523 00:09:15,990 --> 00:09:16,000 locally it's time to 524 00:09:16,000 --> 00:09:19,030 locally it's time to download a code editor for python 525 00:09:19,030 --> 00:09:19,040 download a code editor for python 526 00:09:19,040 --> 00:09:21,430 download a code editor for python because we're going to be writing files 527 00:09:21,430 --> 00:09:21,440 because we're going to be writing files 528 00:09:21,440 --> 00:09:22,790 because we're going to be writing files with python code 529 00:09:22,790 --> 00:09:22,800 with python code 530 00:09:22,800 --> 00:09:25,350 with python code so we need a proper editor for writing 531 00:09:25,350 --> 00:09:25,360 so we need a proper editor for writing 532 00:09:25,360 --> 00:09:26,550 so we need a proper editor for writing python code 533 00:09:26,550 --> 00:09:26,560 python code 534 00:09:26,560 --> 00:09:29,910 python code and actually the best python code editor 535 00:09:29,910 --> 00:09:29,920 and actually the best python code editor 536 00:09:29,920 --> 00:09:30,550 and actually the best python code editor available 537 00:09:30,550 --> 00:09:30,560 available 538 00:09:30,560 --> 00:09:34,230 available out there currently is pycharm which is 539 00:09:34,230 --> 00:09:34,240 out there currently is pycharm which is 540 00:09:34,240 --> 00:09:35,430 out there currently is pycharm which is from jetbrains 541 00:09:35,430 --> 00:09:35,440 from jetbrains 542 00:09:35,440 --> 00:09:37,509 from jetbrains so that's what we're going to be using 543 00:09:37,509 --> 00:09:37,519 so that's what we're going to be using 544 00:09:37,519 --> 00:09:38,949 so that's what we're going to be using throughout our tutorial 545 00:09:38,949 --> 00:09:38,959 throughout our tutorial 546 00:09:38,959 --> 00:09:41,990 throughout our tutorial so let's go to pycharm it is an 547 00:09:41,990 --> 00:09:42,000 so let's go to pycharm it is an 548 00:09:42,000 --> 00:09:45,430 so let's go to pycharm it is an intelligent code editor which makes it 549 00:09:45,430 --> 00:09:45,440 intelligent code editor which makes it 550 00:09:45,440 --> 00:09:48,710 intelligent code editor which makes it much easier to write code so it makes 551 00:09:48,710 --> 00:09:48,720 much easier to write code so it makes 552 00:09:48,720 --> 00:09:50,389 much easier to write code so it makes you actually very productive when 553 00:09:50,389 --> 00:09:50,399 you actually very productive when 554 00:09:50,399 --> 00:09:51,350 you actually very productive when writing code 555 00:09:51,350 --> 00:09:51,360 writing code 556 00:09:51,360 --> 00:09:53,190 writing code and we will see why throughout the 557 00:09:53,190 --> 00:09:53,200 and we will see why throughout the 558 00:09:53,200 --> 00:09:55,269 and we will see why throughout the course as you can see there are two 559 00:09:55,269 --> 00:09:55,279 course as you can see there are two 560 00:09:55,279 --> 00:09:55,990 course as you can see there are two versions 561 00:09:55,990 --> 00:09:56,000 versions 562 00:09:56,000 --> 00:09:57,670 versions we have the community version and 563 00:09:57,670 --> 00:09:57,680 we have the community version and 564 00:09:57,680 --> 00:10:00,310 we have the community version and professional one community version is 565 00:10:00,310 --> 00:10:00,320 professional one community version is 566 00:10:00,320 --> 00:10:01,110 professional one community version is free and 567 00:10:01,110 --> 00:10:01,120 free and 568 00:10:01,120 --> 00:10:03,829 free and already has a lot of powerful features 569 00:10:03,829 --> 00:10:03,839 already has a lot of powerful features 570 00:10:03,839 --> 00:10:05,430 already has a lot of powerful features but the professional edition 571 00:10:05,430 --> 00:10:05,440 but the professional edition 572 00:10:05,440 --> 00:10:07,670 but the professional edition gives you additional very useful 573 00:10:07,670 --> 00:10:07,680 gives you additional very useful 574 00:10:07,680 --> 00:10:09,670 gives you additional very useful features especially if you're creating 575 00:10:09,670 --> 00:10:09,680 features especially if you're creating 576 00:10:09,680 --> 00:10:11,030 features especially if you're creating web applications 577 00:10:11,030 --> 00:10:11,040 web applications 578 00:10:11,040 --> 00:10:13,750 web applications or scientific projects in python so with 579 00:10:13,750 --> 00:10:13,760 or scientific projects in python so with 580 00:10:13,760 --> 00:10:14,470 or scientific projects in python so with professional 581 00:10:14,470 --> 00:10:14,480 professional 582 00:10:14,480 --> 00:10:16,550 professional version additionally you will get 583 00:10:16,550 --> 00:10:16,560 version additionally you will get 584 00:10:16,560 --> 00:10:18,550 version additionally you will get scientific tools that you can use 585 00:10:18,550 --> 00:10:18,560 scientific tools that you can use 586 00:10:18,560 --> 00:10:21,030 scientific tools that you can use in scientific projects with python but 587 00:10:21,030 --> 00:10:21,040 in scientific projects with python but 588 00:10:21,040 --> 00:10:22,470 in scientific projects with python but also you get support for 589 00:10:22,470 --> 00:10:22,480 also you get support for 590 00:10:22,480 --> 00:10:25,190 also you get support for python web frameworks and database 591 00:10:25,190 --> 00:10:25,200 python web frameworks and database 592 00:10:25,200 --> 00:10:26,949 python web frameworks and database integration which can be of course 593 00:10:26,949 --> 00:10:26,959 integration which can be of course 594 00:10:26,959 --> 00:10:28,630 integration which can be of course very helpful if you're developing web 595 00:10:28,630 --> 00:10:28,640 very helpful if you're developing web 596 00:10:28,640 --> 00:10:30,630 very helpful if you're developing web applications if you want to get the 597 00:10:30,630 --> 00:10:30,640 applications if you want to get the 598 00:10:30,640 --> 00:10:32,630 applications if you want to get the professional edition jetbrains actually 599 00:10:32,630 --> 00:10:32,640 professional edition jetbrains actually 600 00:10:32,640 --> 00:10:34,389 professional edition jetbrains actually provided me with a code 601 00:10:34,389 --> 00:10:34,399 provided me with a code 602 00:10:34,399 --> 00:10:37,190 provided me with a code for my channel to try it out for three 603 00:10:37,190 --> 00:10:37,200 for my channel to try it out for three 604 00:10:37,200 --> 00:10:38,310 for my channel to try it out for three months for free 605 00:10:38,310 --> 00:10:38,320 months for free 606 00:10:38,320 --> 00:10:40,710 months for free just use my code when you install it but 607 00:10:40,710 --> 00:10:40,720 just use my code when you install it but 608 00:10:40,720 --> 00:10:41,750 just use my code when you install it but for this demo 609 00:10:41,750 --> 00:10:41,760 for this demo 610 00:10:41,760 --> 00:10:44,470 for this demo community version is absolutely fine so 611 00:10:44,470 --> 00:10:44,480 community version is absolutely fine so 612 00:10:44,480 --> 00:10:45,990 community version is absolutely fine so i will go with this one and 613 00:10:45,990 --> 00:10:46,000 i will go with this one and 614 00:10:46,000 --> 00:10:49,509 i will go with this one and install it and just click download 615 00:10:49,509 --> 00:10:49,519 install it and just click download 616 00:10:49,519 --> 00:10:52,790 install it and just click download and once the pycharm installer is 617 00:10:52,790 --> 00:10:52,800 and once the pycharm installer is 618 00:10:52,800 --> 00:11:02,790 and once the pycharm installer is fully downloaded we can just click on it 619 00:11:05,509 --> 00:11:05,519 move it to the application and now i can 620 00:11:05,519 --> 00:11:06,870 move it to the application and now i can actually use it 621 00:11:06,870 --> 00:11:06,880 actually use it 622 00:11:06,880 --> 00:11:09,430 actually use it locally so i'm just gonna open the 623 00:11:09,430 --> 00:11:09,440 locally so i'm just gonna open the 624 00:11:09,440 --> 00:11:10,470 locally so i'm just gonna open the application 625 00:11:10,470 --> 00:11:10,480 application 626 00:11:10,480 --> 00:11:13,350 application and we're gonna take a quick tour around 627 00:11:13,350 --> 00:11:13,360 and we're gonna take a quick tour around 628 00:11:13,360 --> 00:11:18,310 and we're gonna take a quick tour around pychar 629 00:11:20,870 --> 00:11:20,880 it's actually pretty simple to set it up 630 00:11:20,880 --> 00:11:21,670 it's actually pretty simple to set it up and there you go 631 00:11:21,670 --> 00:11:21,680 and there you go 632 00:11:21,680 --> 00:11:24,389 and there you go we have our pycharm and we can now 633 00:11:24,389 --> 00:11:24,399 we have our pycharm and we can now 634 00:11:24,399 --> 00:11:25,030 we have our pycharm and we can now create 635 00:11:25,030 --> 00:11:25,040 create 636 00:11:25,040 --> 00:11:28,310 create a new project and let's call it 637 00:11:28,310 --> 00:11:28,320 a new project and let's call it 638 00:11:28,320 --> 00:11:31,670 a new project and let's call it my python project 639 00:11:31,670 --> 00:11:31,680 my python project 640 00:11:31,680 --> 00:11:34,389 my python project and that's it basically we don't need to 641 00:11:34,389 --> 00:11:34,399 and that's it basically we don't need to 642 00:11:34,399 --> 00:11:35,670 and that's it basically we don't need to change anything else 643 00:11:35,670 --> 00:11:35,680 change anything else 644 00:11:35,680 --> 00:11:38,150 change anything else and here you see the location basically 645 00:11:38,150 --> 00:11:38,160 and here you see the location basically 646 00:11:38,160 --> 00:11:39,910 and here you see the location basically of where this application 647 00:11:39,910 --> 00:11:39,920 of where this application 648 00:11:39,920 --> 00:11:42,389 of where this application folder will be created you see pycharm 649 00:11:42,389 --> 00:11:42,399 folder will be created you see pycharm 650 00:11:42,399 --> 00:11:43,030 folder will be created you see pycharm projects 651 00:11:43,030 --> 00:11:43,040 projects 652 00:11:43,040 --> 00:11:46,230 projects folder got created in my users directory 653 00:11:46,230 --> 00:11:46,240 folder got created in my users directory 654 00:11:46,240 --> 00:11:48,550 folder got created in my users directory so this is basically very convenient 655 00:11:48,550 --> 00:11:48,560 so this is basically very convenient 656 00:11:48,560 --> 00:11:49,590 so this is basically very convenient because all my 657 00:11:49,590 --> 00:11:49,600 because all my 658 00:11:49,600 --> 00:11:51,829 because all my pycharm projects or my python projects 659 00:11:51,829 --> 00:11:51,839 pycharm projects or my python projects 660 00:11:51,839 --> 00:11:53,590 pycharm projects or my python projects that i create using pycharm 661 00:11:53,590 --> 00:11:53,600 that i create using pycharm 662 00:11:53,600 --> 00:11:56,629 that i create using pycharm will be created in one location and here 663 00:11:56,629 --> 00:11:56,639 will be created in one location and here 664 00:11:56,639 --> 00:11:58,230 will be created in one location and here you also see that python 665 00:11:58,230 --> 00:11:58,240 you also see that python 666 00:11:58,240 --> 00:12:00,230 you also see that python version 3 that we installed is 667 00:12:00,230 --> 00:12:00,240 version 3 that we installed is 668 00:12:00,240 --> 00:12:01,350 version 3 that we installed is automatically 669 00:12:01,350 --> 00:12:01,360 automatically 670 00:12:01,360 --> 00:12:03,670 automatically being used for this project which is 671 00:12:03,670 --> 00:12:03,680 being used for this project which is 672 00:12:03,680 --> 00:12:05,190 being used for this project which is exactly what we want 673 00:12:05,190 --> 00:12:05,200 exactly what we want 674 00:12:05,200 --> 00:12:08,310 exactly what we want and you see it says base interpreter 675 00:12:08,310 --> 00:12:08,320 and you see it says base interpreter 676 00:12:08,320 --> 00:12:11,350 and you see it says base interpreter and python interpreter is basically 677 00:12:11,350 --> 00:12:11,360 and python interpreter is basically 678 00:12:11,360 --> 00:12:14,470 and python interpreter is basically a program that knows how to execute 679 00:12:14,470 --> 00:12:14,480 a program that knows how to execute 680 00:12:14,480 --> 00:12:16,710 a program that knows how to execute python code it will know how to 681 00:12:16,710 --> 00:12:16,720 python code it will know how to 682 00:12:16,720 --> 00:12:18,949 python code it will know how to interpret or translate 683 00:12:18,949 --> 00:12:18,959 interpret or translate 684 00:12:18,959 --> 00:12:21,990 interpret or translate our python code into instructions 685 00:12:21,990 --> 00:12:22,000 our python code into instructions 686 00:12:22,000 --> 00:12:24,949 our python code into instructions that computer can understand so with 687 00:12:24,949 --> 00:12:24,959 that computer can understand so with 688 00:12:24,959 --> 00:12:26,550 that computer can understand so with this configuration we don't have to 689 00:12:26,550 --> 00:12:26,560 this configuration we don't have to 690 00:12:26,560 --> 00:12:27,670 this configuration we don't have to change anything 691 00:12:27,670 --> 00:12:27,680 change anything 692 00:12:27,680 --> 00:12:30,470 change anything we're gonna create our project so first 693 00:12:30,470 --> 00:12:30,480 we're gonna create our project so first 694 00:12:30,480 --> 00:12:32,230 we're gonna create our project so first of all i'm going to 695 00:12:32,230 --> 00:12:32,240 of all i'm going to 696 00:12:32,240 --> 00:12:34,310 of all i'm going to make all this a little bit bigger so 697 00:12:34,310 --> 00:12:34,320 make all this a little bit bigger so 698 00:12:34,320 --> 00:12:35,509 make all this a little bit bigger so that you can see 699 00:12:35,509 --> 00:12:35,519 that you can see 700 00:12:35,519 --> 00:12:38,949 that you can see the menu here on the side and the code 701 00:12:38,949 --> 00:12:38,959 the menu here on the side and the code 702 00:12:38,959 --> 00:12:41,990 the menu here on the side and the code a little bit better so in preferences 703 00:12:41,990 --> 00:12:42,000 a little bit better so in preferences 704 00:12:42,000 --> 00:12:45,910 a little bit better so in preferences editor font we're going to set the size 705 00:12:45,910 --> 00:12:45,920 editor font we're going to set the size 706 00:12:45,920 --> 00:12:50,069 editor font we're going to set the size to 20. if i apply this 707 00:12:50,069 --> 00:12:50,079 to 20. if i apply this 708 00:12:50,079 --> 00:12:53,350 to 20. if i apply this right here you see that this code editor 709 00:12:53,350 --> 00:12:53,360 right here you see that this code editor 710 00:12:53,360 --> 00:12:56,069 right here you see that this code editor font basically got bigger and i also 711 00:12:56,069 --> 00:12:56,079 font basically got bigger and i also 712 00:12:56,079 --> 00:12:56,710 font basically got bigger and i also want to 713 00:12:56,710 --> 00:12:56,720 want to 714 00:12:56,720 --> 00:12:59,670 want to increase the size of this menu font here 715 00:12:59,670 --> 00:12:59,680 increase the size of this menu font here 716 00:12:59,680 --> 00:13:00,389 increase the size of this menu font here so in 717 00:13:00,389 --> 00:13:00,399 so in 718 00:13:00,399 --> 00:13:04,150 so in appearance i'm going to 719 00:13:04,150 --> 00:13:04,160 appearance i'm going to 720 00:13:04,160 --> 00:13:07,910 appearance i'm going to set it to maybe 18 and there you go 721 00:13:07,910 --> 00:13:07,920 set it to maybe 18 and there you go 722 00:13:07,920 --> 00:13:11,110 set it to maybe 18 and there you go so basically everything is bigger now so 723 00:13:11,110 --> 00:13:11,120 so basically everything is bigger now so 724 00:13:11,120 --> 00:13:12,949 so basically everything is bigger now so you can follow along and see exactly 725 00:13:12,949 --> 00:13:12,959 you can follow along and see exactly 726 00:13:12,959 --> 00:13:14,710 you can follow along and see exactly what i'm typing 727 00:13:14,710 --> 00:13:14,720 what i'm typing 728 00:13:14,720 --> 00:13:17,269 what i'm typing and also another note here if you want 729 00:13:17,269 --> 00:13:17,279 and also another note here if you want 730 00:13:17,279 --> 00:13:18,389 and also another note here if you want to configure 731 00:13:18,389 --> 00:13:18,399 to configure 732 00:13:18,399 --> 00:13:21,430 to configure your theme basically so if you don't 733 00:13:21,430 --> 00:13:21,440 your theme basically so if you don't 734 00:13:21,440 --> 00:13:22,870 your theme basically so if you don't want it to be dark 735 00:13:22,870 --> 00:13:22,880 want it to be dark 736 00:13:22,880 --> 00:13:24,710 want it to be dark or maybe you want some other color 737 00:13:24,710 --> 00:13:24,720 or maybe you want some other color 738 00:13:24,720 --> 00:13:26,389 or maybe you want some other color scheme then you can select it here 739 00:13:26,389 --> 00:13:26,399 scheme then you can select it here 740 00:13:26,399 --> 00:13:29,269 scheme then you can select it here in appearance you have four themes 741 00:13:29,269 --> 00:13:29,279 in appearance you have four themes 742 00:13:29,279 --> 00:13:29,910 in appearance you have four themes available 743 00:13:29,910 --> 00:13:29,920 available 744 00:13:29,920 --> 00:13:33,190 available let's actually try this one out 745 00:13:33,190 --> 00:13:33,200 let's actually try this one out 746 00:13:33,200 --> 00:13:36,310 let's actually try this one out and apply and there you go you have a 747 00:13:36,310 --> 00:13:36,320 and apply and there you go you have a 748 00:13:36,320 --> 00:13:38,629 and apply and there you go you have a different theme i actually prefer this 749 00:13:38,629 --> 00:13:38,639 different theme i actually prefer this 750 00:13:38,639 --> 00:13:39,430 different theme i actually prefer this one so 751 00:13:39,430 --> 00:13:39,440 one so 752 00:13:39,440 --> 00:13:42,629 one so let's leave it at that so as you see we 753 00:13:42,629 --> 00:13:42,639 let's leave it at that so as you see we 754 00:13:42,639 --> 00:13:43,910 let's leave it at that so as you see we have a very simple 755 00:13:43,910 --> 00:13:43,920 have a very simple 756 00:13:43,920 --> 00:13:47,189 have a very simple project with one 757 00:13:47,189 --> 00:13:47,199 project with one 758 00:13:47,199 --> 00:13:50,790 project with one main main.pi file the extension is for 759 00:13:50,790 --> 00:13:50,800 main main.pi file the extension is for 760 00:13:50,800 --> 00:13:51,990 main main.pi file the extension is for python files 761 00:13:51,990 --> 00:13:52,000 python files 762 00:13:52,000 --> 00:13:54,710 python files which basically contains very simple 763 00:13:54,710 --> 00:13:54,720 which basically contains very simple 764 00:13:54,720 --> 00:13:55,269 which basically contains very simple code 765 00:13:55,269 --> 00:13:55,279 code 766 00:13:55,279 --> 00:13:57,189 code and we're gonna basically just remove 767 00:13:57,189 --> 00:13:57,199 and we're gonna basically just remove 768 00:13:57,199 --> 00:13:58,310 and we're gonna basically just remove all of these 769 00:13:58,310 --> 00:13:58,320 all of these 770 00:13:58,320 --> 00:14:01,350 all of these and start from a clean python 771 00:14:01,350 --> 00:14:01,360 and start from a clean python 772 00:14:01,360 --> 00:14:04,069 and start from a clean python file state and in the next section we're 773 00:14:04,069 --> 00:14:04,079 file state and in the next section we're 774 00:14:04,079 --> 00:14:04,470 file state and in the next section we're gonna 775 00:14:04,470 --> 00:14:04,480 gonna 776 00:14:04,480 --> 00:14:07,670 gonna dive right in and write our first 777 00:14:07,670 --> 00:14:07,680 dive right in and write our first 778 00:14:07,680 --> 00:14:13,269 dive right in and write our first simple python application 779 00:14:15,269 --> 00:14:15,279 we're gonna start with the simplest 780 00:14:15,279 --> 00:14:17,430 we're gonna start with the simplest example in python 781 00:14:17,430 --> 00:14:17,440 example in python 782 00:14:17,440 --> 00:14:20,629 example in python to basically learn python syntax and 783 00:14:20,629 --> 00:14:20,639 to basically learn python syntax and 784 00:14:20,639 --> 00:14:23,189 to basically learn python syntax and get started as simply as possible so 785 00:14:23,189 --> 00:14:23,199 get started as simply as possible so 786 00:14:23,199 --> 00:14:24,150 get started as simply as possible so first of all 787 00:14:24,150 --> 00:14:24,160 first of all 788 00:14:24,160 --> 00:14:26,389 first of all we're gonna write a very simple 789 00:14:26,389 --> 00:14:26,399 we're gonna write a very simple 790 00:14:26,399 --> 00:14:27,829 we're gonna write a very simple application that just 791 00:14:27,829 --> 00:14:27,839 application that just 792 00:14:27,839 --> 00:14:31,829 application that just prints some output and in python when we 793 00:14:31,829 --> 00:14:31,839 prints some output and in python when we 794 00:14:31,839 --> 00:14:33,030 prints some output and in python when we want to print 795 00:14:33,030 --> 00:14:33,040 want to print 796 00:14:33,040 --> 00:14:35,910 want to print basically display results of what we 797 00:14:35,910 --> 00:14:35,920 basically display results of what we 798 00:14:35,920 --> 00:14:36,470 basically display results of what we wrote 799 00:14:36,470 --> 00:14:36,480 wrote 800 00:14:36,480 --> 00:14:39,430 wrote we use this syntax where we say print 801 00:14:39,430 --> 00:14:39,440 we use this syntax where we say print 802 00:14:39,440 --> 00:14:39,750 we use this syntax where we say print and 803 00:14:39,750 --> 00:14:39,760 and 804 00:14:39,760 --> 00:14:42,470 and here we can pass in basically whatever 805 00:14:42,470 --> 00:14:42,480 here we can pass in basically whatever 806 00:14:42,480 --> 00:14:43,990 here we can pass in basically whatever we want to display 807 00:14:43,990 --> 00:14:44,000 we want to display 808 00:14:44,000 --> 00:14:46,790 we want to display and now if i want to see whether this 809 00:14:46,790 --> 00:14:46,800 and now if i want to see whether this 810 00:14:46,800 --> 00:14:48,629 and now if i want to see whether this super simple application works 811 00:14:48,629 --> 00:14:48,639 super simple application works 812 00:14:48,639 --> 00:14:51,750 super simple application works i can run it or execute it 813 00:14:51,750 --> 00:14:51,760 i can run it or execute it 814 00:14:51,760 --> 00:14:54,790 i can run it or execute it with this triangle here and i have the 815 00:14:54,790 --> 00:14:54,800 with this triangle here and i have the 816 00:14:54,800 --> 00:14:56,949 with this triangle here and i have the output so the basically the output 817 00:14:56,949 --> 00:14:56,959 output so the basically the output 818 00:14:56,959 --> 00:15:00,069 output so the basically the output is displayed or printed right here and i 819 00:15:00,069 --> 00:15:00,079 is displayed or printed right here and i 820 00:15:00,079 --> 00:15:00,389 is displayed or printed right here and i see 821 00:15:00,389 --> 00:15:00,399 see 822 00:15:00,399 --> 00:15:03,350 see the output is 1. i can display some 823 00:15:03,350 --> 00:15:03,360 the output is 1. i can display some 824 00:15:03,360 --> 00:15:04,710 the output is 1. i can display some other values 825 00:15:04,710 --> 00:15:04,720 other values 826 00:15:04,720 --> 00:15:08,150 other values like 200 and run it and there you go 827 00:15:08,150 --> 00:15:08,160 like 200 and run it and there you go 828 00:15:08,160 --> 00:15:14,870 like 200 and run it and there you go let's say we want to display some text 829 00:15:17,590 --> 00:15:17,600 basically whatever some sentence and 830 00:15:17,600 --> 00:15:19,110 basically whatever some sentence and again 831 00:15:19,110 --> 00:15:19,120 again 832 00:15:19,120 --> 00:15:21,829 again triangle and we have that output here 833 00:15:21,829 --> 00:15:21,839 triangle and we have that output here 834 00:15:21,839 --> 00:15:22,389 triangle and we have that output here right 835 00:15:22,389 --> 00:15:22,399 right 836 00:15:22,399 --> 00:15:26,069 right so again very simple example of 837 00:15:26,069 --> 00:15:26,079 so again very simple example of 838 00:15:26,079 --> 00:15:29,189 so again very simple example of writing python code that basically 839 00:15:29,189 --> 00:15:29,199 writing python code that basically 840 00:15:29,199 --> 00:15:31,749 writing python code that basically displays some information when we 841 00:15:31,749 --> 00:15:31,759 displays some information when we 842 00:15:31,759 --> 00:15:35,990 displays some information when we execute it 843 00:15:38,389 --> 00:15:38,399 one thing that i want to note here is 844 00:15:38,399 --> 00:15:41,030 one thing that i want to note here is you see that we write some code 845 00:15:41,030 --> 00:15:41,040 you see that we write some code 846 00:15:41,040 --> 00:15:42,230 you see that we write some code basically 847 00:15:42,230 --> 00:15:42,240 basically 848 00:15:42,240 --> 00:15:45,030 basically in this window right here so in our 849 00:15:45,030 --> 00:15:45,040 in this window right here so in our 850 00:15:45,040 --> 00:15:46,230 in this window right here so in our main.pi 851 00:15:46,230 --> 00:15:46,240 main.pi 852 00:15:46,240 --> 00:15:49,350 main.pi file and when we run it 853 00:15:49,350 --> 00:15:49,360 file and when we run it 854 00:15:49,360 --> 00:15:52,790 file and when we run it or execute it our code we see some 855 00:15:52,790 --> 00:15:52,800 or execute it our code we see some 856 00:15:52,800 --> 00:15:55,910 or execute it our code we see some display in this window so you may be 857 00:15:55,910 --> 00:15:55,920 display in this window so you may be 858 00:15:55,920 --> 00:15:58,710 display in this window so you may be wondering what is this window and why do 859 00:15:58,710 --> 00:15:58,720 wondering what is this window and why do 860 00:15:58,720 --> 00:15:59,430 wondering what is this window and why do we see 861 00:15:59,430 --> 00:15:59,440 we see 862 00:15:59,440 --> 00:16:01,749 we see some output right here the answer to 863 00:16:01,749 --> 00:16:01,759 some output right here the answer to 864 00:16:01,759 --> 00:16:03,670 some output right here the answer to that is that whenever you're working 865 00:16:03,670 --> 00:16:03,680 that is that whenever you're working 866 00:16:03,680 --> 00:16:04,470 that is that whenever you're working with 867 00:16:04,470 --> 00:16:04,480 with 868 00:16:04,480 --> 00:16:07,509 with tools like pycharm which basically 869 00:16:07,509 --> 00:16:07,519 tools like pycharm which basically 870 00:16:07,519 --> 00:16:10,069 tools like pycharm which basically have all the functionality that you need 871 00:16:10,069 --> 00:16:10,079 have all the functionality that you need 872 00:16:10,079 --> 00:16:10,790 have all the functionality that you need to 873 00:16:10,790 --> 00:16:10,800 to 874 00:16:10,800 --> 00:16:12,710 to write your code and then execute your 875 00:16:12,710 --> 00:16:12,720 write your code and then execute your 876 00:16:12,720 --> 00:16:14,629 write your code and then execute your code you basically have everything in 877 00:16:14,629 --> 00:16:14,639 code you basically have everything in 878 00:16:14,639 --> 00:16:15,590 code you basically have everything in one place 879 00:16:15,590 --> 00:16:15,600 one place 880 00:16:15,600 --> 00:16:18,470 one place so whatever we write we can execute or 881 00:16:18,470 --> 00:16:18,480 so whatever we write we can execute or 882 00:16:18,480 --> 00:16:19,030 so whatever we write we can execute or run 883 00:16:19,030 --> 00:16:19,040 run 884 00:16:19,040 --> 00:16:22,069 run right away now without such tool how 885 00:16:22,069 --> 00:16:22,079 right away now without such tool how 886 00:16:22,079 --> 00:16:23,110 right away now without such tool how would we 887 00:16:23,110 --> 00:16:23,120 would we 888 00:16:23,120 --> 00:16:26,310 would we write code and how would we execute that 889 00:16:26,310 --> 00:16:26,320 write code and how would we execute that 890 00:16:26,320 --> 00:16:28,870 write code and how would we execute that code and this will help you understand 891 00:16:28,870 --> 00:16:28,880 code and this will help you understand 892 00:16:28,880 --> 00:16:29,829 code and this will help you understand what's going on 893 00:16:29,829 --> 00:16:29,839 what's going on 894 00:16:29,839 --> 00:16:31,990 what's going on here and to show that i'm going to go 895 00:16:31,990 --> 00:16:32,000 here and to show that i'm going to go 896 00:16:32,000 --> 00:16:33,269 here and to show that i'm going to go back to my terminal 897 00:16:33,269 --> 00:16:33,279 back to my terminal 898 00:16:33,279 --> 00:16:36,389 back to my terminal and i'm going to create a new file and 899 00:16:36,389 --> 00:16:36,399 and i'm going to create a new file and 900 00:16:36,399 --> 00:16:39,110 and i'm going to create a new file and i'm going to call it 901 00:16:39,110 --> 00:16:39,120 i'm going to call it 902 00:16:39,120 --> 00:16:43,430 i'm going to call it test dot py 903 00:16:51,430 --> 00:16:51,440 code basically in this file 904 00:16:51,440 --> 00:16:53,350 code basically in this file you can do it in a file editor i'm just 905 00:16:53,350 --> 00:16:53,360 you can do it in a file editor i'm just 906 00:16:53,360 --> 00:16:56,230 you can do it in a file editor i'm just doing it directly in the command line 907 00:16:56,230 --> 00:16:56,240 doing it directly in the command line 908 00:16:56,240 --> 00:16:59,030 doing it directly in the command line and save it so now we have the same 909 00:16:59,030 --> 00:16:59,040 and save it so now we have the same 910 00:16:59,040 --> 00:16:59,829 and save it so now we have the same identical 911 00:16:59,829 --> 00:16:59,839 identical 912 00:16:59,839 --> 00:17:02,949 identical file as here 913 00:17:02,949 --> 00:17:02,959 file as here 914 00:17:02,959 --> 00:17:06,470 file as here but not inside our code editor right 915 00:17:06,470 --> 00:17:06,480 but not inside our code editor right 916 00:17:06,480 --> 00:17:10,230 but not inside our code editor right not inside this pycharm tool and we have 917 00:17:10,230 --> 00:17:10,240 not inside this pycharm tool and we have 918 00:17:10,240 --> 00:17:13,510 not inside this pycharm tool and we have python 3 available locally so 919 00:17:13,510 --> 00:17:13,520 python 3 available locally so 920 00:17:13,520 --> 00:17:16,870 python 3 available locally so now how do i actually execute a python 921 00:17:16,870 --> 00:17:16,880 now how do i actually execute a python 922 00:17:16,880 --> 00:17:21,429 now how do i actually execute a python file outside this pie chart 923 00:17:21,429 --> 00:17:21,439 file outside this pie chart 924 00:17:21,439 --> 00:17:24,870 file outside this pie chart i can do that using python 3 test 925 00:17:24,870 --> 00:17:24,880 i can do that using python 3 test 926 00:17:24,880 --> 00:17:29,110 i can do that using python 3 test dot p y and if i do that 927 00:17:29,110 --> 00:17:29,120 dot p y and if i do that 928 00:17:29,120 --> 00:17:32,310 dot p y and if i do that i get the same output in the command 929 00:17:32,310 --> 00:17:32,320 i get the same output in the command 930 00:17:32,320 --> 00:17:32,950 i get the same output in the command line 931 00:17:32,950 --> 00:17:32,960 line 932 00:17:32,960 --> 00:17:35,430 line so basically what you see right here 933 00:17:35,430 --> 00:17:35,440 so basically what you see right here 934 00:17:35,440 --> 00:17:36,390 so basically what you see right here this whole thing 935 00:17:36,390 --> 00:17:36,400 this whole thing 936 00:17:36,400 --> 00:17:39,590 this whole thing is integrated so basically all 937 00:17:39,590 --> 00:17:39,600 is integrated so basically all 938 00:17:39,600 --> 00:17:42,549 is integrated so basically all in one place where you can write your 939 00:17:42,549 --> 00:17:42,559 in one place where you can write your 940 00:17:42,559 --> 00:17:43,110 in one place where you can write your code 941 00:17:43,110 --> 00:17:43,120 code 942 00:17:43,120 --> 00:17:45,990 code the editor right here where you can 943 00:17:45,990 --> 00:17:46,000 the editor right here where you can 944 00:17:46,000 --> 00:17:46,870 the editor right here where you can navigate 945 00:17:46,870 --> 00:17:46,880 navigate 946 00:17:46,880 --> 00:17:49,190 navigate your files in your project so basically 947 00:17:49,190 --> 00:17:49,200 your files in your project so basically 948 00:17:49,200 --> 00:17:50,870 your files in your project so basically this is just a folder 949 00:17:50,870 --> 00:17:50,880 this is just a folder 950 00:17:50,880 --> 00:17:53,990 this is just a folder on your laptop and you can navigate the 951 00:17:53,990 --> 00:17:54,000 on your laptop and you can navigate the 952 00:17:54,000 --> 00:17:55,270 on your laptop and you can navigate the files here 953 00:17:55,270 --> 00:17:55,280 files here 954 00:17:55,280 --> 00:17:58,390 files here and you have the execution environment 955 00:17:58,390 --> 00:17:58,400 and you have the execution environment 956 00:17:58,400 --> 00:18:00,470 and you have the execution environment at the same time so you have to go to 957 00:18:00,470 --> 00:18:00,480 at the same time so you have to go to 958 00:18:00,480 --> 00:18:03,029 at the same time so you have to go to terminal and execute python 3 959 00:18:03,029 --> 00:18:03,039 terminal and execute python 3 960 00:18:03,039 --> 00:18:05,270 terminal and execute python 3 whatever you have everything in one 961 00:18:05,270 --> 00:18:05,280 whatever you have everything in one 962 00:18:05,280 --> 00:18:06,310 whatever you have everything in one place and 963 00:18:06,310 --> 00:18:06,320 place and 964 00:18:06,320 --> 00:18:08,950 place and tools that provide you with this type of 965 00:18:08,950 --> 00:18:08,960 tools that provide you with this type of 966 00:18:08,960 --> 00:18:10,789 tools that provide you with this type of environment for different programming 967 00:18:10,789 --> 00:18:10,799 environment for different programming 968 00:18:10,799 --> 00:18:11,590 environment for different programming languages 969 00:18:11,590 --> 00:18:11,600 languages 970 00:18:11,600 --> 00:18:13,909 languages for python it happens to be pycharm 971 00:18:13,909 --> 00:18:13,919 for python it happens to be pycharm 972 00:18:13,919 --> 00:18:15,190 for python it happens to be pycharm these are called 973 00:18:15,190 --> 00:18:15,200 these are called 974 00:18:15,200 --> 00:18:18,789 these are called ides which stand for integrated 975 00:18:18,789 --> 00:18:18,799 ides which stand for integrated 976 00:18:18,799 --> 00:18:21,270 ides which stand for integrated development environment integrated 977 00:18:21,270 --> 00:18:21,280 development environment integrated 978 00:18:21,280 --> 00:18:21,990 development environment integrated because you have 979 00:18:21,990 --> 00:18:22,000 because you have 980 00:18:22,000 --> 00:18:24,470 because you have everything in one place so you don't 981 00:18:24,470 --> 00:18:24,480 everything in one place so you don't 982 00:18:24,480 --> 00:18:25,190 everything in one place so you don't need to 983 00:18:25,190 --> 00:18:25,200 need to 984 00:18:25,200 --> 00:18:27,990 need to use terminal but in addition to this 985 00:18:27,990 --> 00:18:28,000 use terminal but in addition to this 986 00:18:28,000 --> 00:18:30,950 use terminal but in addition to this integration you get more cool features 987 00:18:30,950 --> 00:18:30,960 integration you get more cool features 988 00:18:30,960 --> 00:18:33,669 integration you get more cool features which helps you in writing python code 989 00:18:33,669 --> 00:18:33,679 which helps you in writing python code 990 00:18:33,679 --> 00:18:34,789 which helps you in writing python code for example 991 00:18:34,789 --> 00:18:34,799 for example 992 00:18:34,799 --> 00:18:37,669 for example syntax highlighting highlighting errors 993 00:18:37,669 --> 00:18:37,679 syntax highlighting highlighting errors 994 00:18:37,679 --> 00:18:37,990 syntax highlighting highlighting errors or 995 00:18:37,990 --> 00:18:38,000 or 996 00:18:38,000 --> 00:18:40,150 or code suggestions autocomplete 997 00:18:40,150 --> 00:18:40,160 code suggestions autocomplete 998 00:18:40,160 --> 00:18:41,270 code suggestions autocomplete suggestions 999 00:18:41,270 --> 00:18:41,280 suggestions 1000 00:18:41,280 --> 00:18:43,430 suggestions and we will see those cool features 1001 00:18:43,430 --> 00:18:43,440 and we will see those cool features 1002 00:18:43,440 --> 00:18:45,909 and we will see those cool features actually also throughout this course 1003 00:18:45,909 --> 00:18:45,919 actually also throughout this course 1004 00:18:45,919 --> 00:18:47,990 actually also throughout this course so basically just makes your life as a 1005 00:18:47,990 --> 00:18:48,000 so basically just makes your life as a 1006 00:18:48,000 --> 00:18:49,270 so basically just makes your life as a developer easier 1007 00:18:49,270 --> 00:18:49,280 developer easier 1008 00:18:49,280 --> 00:18:51,270 developer easier however it's good to understand that 1009 00:18:51,270 --> 00:18:51,280 however it's good to understand that 1010 00:18:51,280 --> 00:18:52,390 however it's good to understand that connection 1011 00:18:52,390 --> 00:18:52,400 connection 1012 00:18:52,400 --> 00:18:55,029 connection between executing your files on the 1013 00:18:55,029 --> 00:18:55,039 between executing your files on the 1014 00:18:55,039 --> 00:18:56,070 between executing your files on the terminal 1015 00:18:56,070 --> 00:18:56,080 terminal 1016 00:18:56,080 --> 00:18:59,029 terminal when you don't have such a tool versus 1017 00:18:59,029 --> 00:18:59,039 when you don't have such a tool versus 1018 00:18:59,039 --> 00:19:00,789 when you don't have such a tool versus executing and working on your 1019 00:19:00,789 --> 00:19:00,799 executing and working on your 1020 00:19:00,799 --> 00:19:06,549 executing and working on your application inside that tool 1021 00:19:09,350 --> 00:19:09,360 awesome so let's get back to our code 1022 00:19:09,360 --> 00:19:10,070 awesome so let's get back to our code editor 1023 00:19:10,070 --> 00:19:10,080 editor 1024 00:19:10,080 --> 00:19:13,190 editor a file where we write our code and till 1025 00:19:13,190 --> 00:19:13,200 a file where we write our code and till 1026 00:19:13,200 --> 00:19:15,029 a file where we write our code and till now we have done something really simple 1027 00:19:15,029 --> 00:19:15,039 now we have done something really simple 1028 00:19:15,039 --> 00:19:16,230 now we have done something really simple like print 1029 00:19:16,230 --> 00:19:16,240 like print 1030 00:19:16,240 --> 00:19:19,510 like print a text basically and print 1031 00:19:19,510 --> 00:19:19,520 a text basically and print 1032 00:19:19,520 --> 00:19:22,630 a text basically and print a number right and this leads to 1033 00:19:22,630 --> 00:19:22,640 a number right and this leads to 1034 00:19:22,640 --> 00:19:25,029 a number right and this leads to the first concept in programming 1035 00:19:25,029 --> 00:19:25,039 the first concept in programming 1036 00:19:25,039 --> 00:19:25,990 the first concept in programming languages which 1037 00:19:25,990 --> 00:19:26,000 languages which 1038 00:19:26,000 --> 00:19:29,270 languages which are data types so in python 1039 00:19:29,270 --> 00:19:29,280 are data types so in python 1040 00:19:29,280 --> 00:19:30,710 are data types so in python just like in any other programming 1041 00:19:30,710 --> 00:19:30,720 just like in any other programming 1042 00:19:30,720 --> 00:19:33,510 just like in any other programming language you have data types 1043 00:19:33,510 --> 00:19:33,520 language you have data types 1044 00:19:33,520 --> 00:19:37,510 language you have data types for text and numbers the text data types 1045 00:19:37,510 --> 00:19:37,520 for text and numbers the text data types 1046 00:19:37,520 --> 00:19:38,150 for text and numbers the text data types are called 1047 00:19:38,150 --> 00:19:38,160 are called 1048 00:19:38,160 --> 00:19:40,950 are called strings so everything within the double 1049 00:19:40,950 --> 00:19:40,960 strings so everything within the double 1050 00:19:40,960 --> 00:19:43,350 strings so everything within the double quotes is basically a string 1051 00:19:43,350 --> 00:19:43,360 quotes is basically a string 1052 00:19:43,360 --> 00:19:45,750 quotes is basically a string but note that in python you can also use 1053 00:19:45,750 --> 00:19:45,760 but note that in python you can also use 1054 00:19:45,760 --> 00:19:46,710 but note that in python you can also use single quotes 1055 00:19:46,710 --> 00:19:46,720 single quotes 1056 00:19:46,720 --> 00:19:49,750 single quotes for strings so double quotes or single 1057 00:19:49,750 --> 00:19:49,760 for strings so double quotes or single 1058 00:19:49,760 --> 00:19:50,390 for strings so double quotes or single quotes 1059 00:19:50,390 --> 00:19:50,400 quotes 1060 00:19:50,400 --> 00:19:52,470 quotes they both work the same and there's 1061 00:19:52,470 --> 00:19:52,480 they both work the same and there's 1062 00:19:52,480 --> 00:19:55,029 they both work the same and there's actually no difference between them 1063 00:19:55,029 --> 00:19:55,039 actually no difference between them 1064 00:19:55,039 --> 00:19:57,350 actually no difference between them and for numbers we actually have 1065 00:19:57,350 --> 00:19:57,360 and for numbers we actually have 1066 00:19:57,360 --> 00:19:58,870 and for numbers we actually have different data types 1067 00:19:58,870 --> 00:19:58,880 different data types 1068 00:19:58,880 --> 00:20:02,390 different data types so for whole numbers like 2 20 1069 00:20:02,390 --> 00:20:02,400 so for whole numbers like 2 20 1070 00:20:02,400 --> 00:20:05,909 so for whole numbers like 2 20 but also 0 and negative numbers as well 1071 00:20:05,909 --> 00:20:05,919 but also 0 and negative numbers as well 1072 00:20:05,919 --> 00:20:06,549 but also 0 and negative numbers as well we have 1073 00:20:06,549 --> 00:20:06,559 we have 1074 00:20:06,559 --> 00:20:09,669 we have a data type called integer and that's 1075 00:20:09,669 --> 00:20:09,679 a data type called integer and that's 1076 00:20:09,679 --> 00:20:11,350 a data type called integer and that's also how it's called in most programming 1077 00:20:11,350 --> 00:20:11,360 also how it's called in most programming 1078 00:20:11,360 --> 00:20:12,149 also how it's called in most programming languages 1079 00:20:12,149 --> 00:20:12,159 languages 1080 00:20:12,159 --> 00:20:14,789 languages however you also have numbers for 1081 00:20:14,789 --> 00:20:14,799 however you also have numbers for 1082 00:20:14,799 --> 00:20:16,390 however you also have numbers for currency for example how much 1083 00:20:16,390 --> 00:20:16,400 currency for example how much 1084 00:20:16,400 --> 00:20:18,470 currency for example how much a product costs right so if you have an 1085 00:20:18,470 --> 00:20:18,480 a product costs right so if you have an 1086 00:20:18,480 --> 00:20:20,230 a product costs right so if you have an online shop you would have 1087 00:20:20,230 --> 00:20:20,240 online shop you would have 1088 00:20:20,240 --> 00:20:23,190 online shop you would have prices like this for example so these 1089 00:20:23,190 --> 00:20:23,200 prices like this for example so these 1090 00:20:23,200 --> 00:20:23,990 prices like this for example so these are basically 1091 00:20:23,990 --> 00:20:24,000 are basically 1092 00:20:24,000 --> 00:20:26,470 are basically numbers with precision this could also 1093 00:20:26,470 --> 00:20:26,480 numbers with precision this could also 1094 00:20:26,480 --> 00:20:27,110 numbers with precision this could also be 1095 00:20:27,110 --> 00:20:27,120 be 1096 00:20:27,120 --> 00:20:28,390 be for example when you're shipping 1097 00:20:28,390 --> 00:20:28,400 for example when you're shipping 1098 00:20:28,400 --> 00:20:30,230 for example when you're shipping something you could have 1099 00:20:30,230 --> 00:20:30,240 something you could have 1100 00:20:30,240 --> 00:20:33,350 something you could have a weight of a package that is also 1101 00:20:33,350 --> 00:20:33,360 a weight of a package that is also 1102 00:20:33,360 --> 00:20:35,909 a weight of a package that is also not a whole number but has a precision 1103 00:20:35,909 --> 00:20:35,919 not a whole number but has a precision 1104 00:20:35,919 --> 00:20:37,350 not a whole number but has a precision so this type of numbers 1105 00:20:37,350 --> 00:20:37,360 so this type of numbers 1106 00:20:37,360 --> 00:20:39,510 so this type of numbers in python and many other programming 1107 00:20:39,510 --> 00:20:39,520 in python and many other programming 1108 00:20:39,520 --> 00:20:40,870 in python and many other programming languages are 1109 00:20:40,870 --> 00:20:40,880 languages are 1110 00:20:40,880 --> 00:20:44,549 languages are represented as float data type 1111 00:20:44,549 --> 00:20:44,559 represented as float data type 1112 00:20:44,559 --> 00:20:48,310 represented as float data type so again you have integers 1113 00:20:48,310 --> 00:20:48,320 so again you have integers 1114 00:20:48,320 --> 00:20:51,990 so again you have integers and float data types and if we execute 1115 00:20:51,990 --> 00:20:52,000 and float data types and if we execute 1116 00:20:52,000 --> 00:20:52,390 and float data types and if we execute that 1117 00:20:52,390 --> 00:20:52,400 that 1118 00:20:52,400 --> 00:20:55,110 that you basically see all of that printed as 1119 00:20:55,110 --> 00:20:55,120 you basically see all of that printed as 1120 00:20:55,120 --> 00:20:59,510 you basically see all of that printed as we wrote them 1121 00:21:02,789 --> 00:21:02,799 now obviously printing values like 1122 00:21:02,799 --> 00:21:05,909 now obviously printing values like numbers and text like this doesn't make 1123 00:21:05,909 --> 00:21:05,919 numbers and text like this doesn't make 1124 00:21:05,919 --> 00:21:07,990 numbers and text like this doesn't make much sense unless we're getting some 1125 00:21:07,990 --> 00:21:08,000 much sense unless we're getting some 1126 00:21:08,000 --> 00:21:09,270 much sense unless we're getting some useful information 1127 00:21:09,270 --> 00:21:09,280 useful information 1128 00:21:09,280 --> 00:21:12,549 useful information from our simple program right here right 1129 00:21:12,549 --> 00:21:12,559 from our simple program right here right 1130 00:21:12,559 --> 00:21:15,350 from our simple program right here right so let's do something more useful with 1131 00:21:15,350 --> 00:21:15,360 so let's do something more useful with 1132 00:21:15,360 --> 00:21:17,510 so let's do something more useful with python now 1133 00:21:17,510 --> 00:21:17,520 python now 1134 00:21:17,520 --> 00:21:20,070 python now let's clean all this up and let's say we 1135 00:21:20,070 --> 00:21:20,080 let's clean all this up and let's say we 1136 00:21:20,080 --> 00:21:21,190 let's clean all this up and let's say we want to do some 1137 00:21:21,190 --> 00:21:21,200 want to do some 1138 00:21:21,200 --> 00:21:24,390 want to do some calculations very simple logic that 1139 00:21:24,390 --> 00:21:24,400 calculations very simple logic that 1140 00:21:24,400 --> 00:21:25,830 calculations very simple logic that basically calculates 1141 00:21:25,830 --> 00:21:25,840 basically calculates 1142 00:21:25,840 --> 00:21:32,310 basically calculates how many minutes there are in 20 days 1143 00:21:36,230 --> 00:21:36,240 so we have 20 days which have 24 hours 1144 00:21:36,240 --> 00:21:37,029 so we have 20 days which have 24 hours per day 1145 00:21:37,029 --> 00:21:37,039 per day 1146 00:21:37,039 --> 00:21:40,630 per day which have 60 minutes per hour 1147 00:21:40,630 --> 00:21:40,640 which have 60 minutes per hour 1148 00:21:40,640 --> 00:21:42,390 which have 60 minutes per hour so this line will give us basically 1149 00:21:42,390 --> 00:21:42,400 so this line will give us basically 1150 00:21:42,400 --> 00:21:43,990 so this line will give us basically calculation of 1151 00:21:43,990 --> 00:21:44,000 calculation of 1152 00:21:44,000 --> 00:21:47,669 calculation of minutes for 20 days and there you go 1153 00:21:47,669 --> 00:21:47,679 minutes for 20 days and there you go 1154 00:21:47,679 --> 00:21:50,230 minutes for 20 days and there you go that's our number now this makes a 1155 00:21:50,230 --> 00:21:50,240 that's our number now this makes a 1156 00:21:50,240 --> 00:21:51,669 that's our number now this makes a little bit more sense 1157 00:21:51,669 --> 00:21:51,679 little bit more sense 1158 00:21:51,679 --> 00:21:53,029 little bit more sense because now we have a program that 1159 00:21:53,029 --> 00:21:53,039 because now we have a program that 1160 00:21:53,039 --> 00:21:54,789 because now we have a program that actually does something for us 1161 00:21:54,789 --> 00:21:54,799 actually does something for us 1162 00:21:54,799 --> 00:21:57,909 actually does something for us so basically as you see you can do any 1163 00:21:57,909 --> 00:21:57,919 so basically as you see you can do any 1164 00:21:57,919 --> 00:21:59,669 so basically as you see you can do any math operations on numbers 1165 00:21:59,669 --> 00:21:59,679 math operations on numbers 1166 00:21:59,679 --> 00:22:01,990 math operations on numbers in python and again in many other 1167 00:22:01,990 --> 00:22:02,000 in python and again in many other 1168 00:22:02,000 --> 00:22:03,190 in python and again in many other programming languages 1169 00:22:03,190 --> 00:22:03,200 programming languages 1170 00:22:03,200 --> 00:22:06,630 programming languages you can do plus minus division whatever 1171 00:22:06,630 --> 00:22:06,640 you can do plus minus division whatever 1172 00:22:06,640 --> 00:22:09,029 you can do plus minus division whatever just like you know it from basic math 1173 00:22:09,029 --> 00:22:09,039 just like you know it from basic math 1174 00:22:09,039 --> 00:22:11,270 just like you know it from basic math however i want to note right here 1175 00:22:11,270 --> 00:22:11,280 however i want to note right here 1176 00:22:11,280 --> 00:22:13,990 however i want to note right here something that many people think about 1177 00:22:13,990 --> 00:22:14,000 something that many people think about 1178 00:22:14,000 --> 00:22:14,950 something that many people think about programming 1179 00:22:14,950 --> 00:22:14,960 programming 1180 00:22:14,960 --> 00:22:17,990 programming and maybe are misinformed about 1181 00:22:17,990 --> 00:22:18,000 and maybe are misinformed about 1182 00:22:18,000 --> 00:22:21,190 and maybe are misinformed about which is if you're doing web development 1183 00:22:21,190 --> 00:22:21,200 which is if you're doing web development 1184 00:22:21,200 --> 00:22:24,710 which is if you're doing web development or maybe devops automation with python 1185 00:22:24,710 --> 00:22:24,720 or maybe devops automation with python 1186 00:22:24,720 --> 00:22:27,350 or maybe devops automation with python and not something like data science or 1187 00:22:27,350 --> 00:22:27,360 and not something like data science or 1188 00:22:27,360 --> 00:22:28,950 and not something like data science or data analytics 1189 00:22:28,950 --> 00:22:28,960 data analytics 1190 00:22:28,960 --> 00:22:32,149 data analytics this is probably an example of the 1191 00:22:32,149 --> 00:22:32,159 this is probably an example of the 1192 00:22:32,159 --> 00:22:32,870 this is probably an example of the highest 1193 00:22:32,870 --> 00:22:32,880 highest 1194 00:22:32,880 --> 00:22:34,870 highest math knowledge that you need for 1195 00:22:34,870 --> 00:22:34,880 math knowledge that you need for 1196 00:22:34,880 --> 00:22:36,310 math knowledge that you need for programming in python 1197 00:22:36,310 --> 00:22:36,320 programming in python 1198 00:22:36,320 --> 00:22:37,909 programming in python because even though we're going to use 1199 00:22:37,909 --> 00:22:37,919 because even though we're going to use 1200 00:22:37,919 --> 00:22:39,510 because even though we're going to use some calculation 1201 00:22:39,510 --> 00:22:39,520 some calculation 1202 00:22:39,520 --> 00:22:41,750 some calculation examples because they're just good as 1203 00:22:41,750 --> 00:22:41,760 examples because they're just good as 1204 00:22:41,760 --> 00:22:43,270 examples because they're just good as examples to 1205 00:22:43,270 --> 00:22:43,280 examples to 1206 00:22:43,280 --> 00:22:45,750 examples to show you the basic concepts of python 1207 00:22:45,750 --> 00:22:45,760 show you the basic concepts of python 1208 00:22:45,760 --> 00:22:46,710 show you the basic concepts of python you do not 1209 00:22:46,710 --> 00:22:46,720 you do not 1210 00:22:46,720 --> 00:22:49,350 you do not really need any advanced or even 1211 00:22:49,350 --> 00:22:49,360 really need any advanced or even 1212 00:22:49,360 --> 00:22:50,390 really need any advanced or even intermediate 1213 00:22:50,390 --> 00:22:50,400 intermediate 1214 00:22:50,400 --> 00:22:52,710 intermediate knowledge of mathematics when 1215 00:22:52,710 --> 00:22:52,720 knowledge of mathematics when 1216 00:22:52,720 --> 00:22:53,590 knowledge of mathematics when programming 1217 00:22:53,590 --> 00:22:53,600 programming 1218 00:22:53,600 --> 00:22:55,909 programming because it's really not about meth 1219 00:22:55,909 --> 00:22:55,919 because it's really not about meth 1220 00:22:55,919 --> 00:22:57,270 because it's really not about meth however what you need is 1221 00:22:57,270 --> 00:22:57,280 however what you need is 1222 00:22:57,280 --> 00:22:59,909 however what you need is logical thinking and we're going to be 1223 00:22:59,909 --> 00:22:59,919 logical thinking and we're going to be 1224 00:22:59,919 --> 00:23:01,350 logical thinking and we're going to be doing some of that and 1225 00:23:01,350 --> 00:23:01,360 doing some of that and 1226 00:23:01,360 --> 00:23:04,149 doing some of that and see that as examples so just bear that 1227 00:23:04,149 --> 00:23:04,159 see that as examples so just bear that 1228 00:23:04,159 --> 00:23:05,029 see that as examples so just bear that in mind 1229 00:23:05,029 --> 00:23:05,039 in mind 1230 00:23:05,039 --> 00:23:11,110 in mind in case you are misinformed about that 1231 00:23:13,510 --> 00:23:13,520 so back to our example we have this 1232 00:23:13,520 --> 00:23:15,350 so back to our example we have this number that is displayed here 1233 00:23:15,350 --> 00:23:15,360 number that is displayed here 1234 00:23:15,360 --> 00:23:18,310 number that is displayed here as a result however maybe if we use this 1235 00:23:18,310 --> 00:23:18,320 as a result however maybe if we use this 1236 00:23:18,320 --> 00:23:19,029 as a result however maybe if we use this program 1237 00:23:19,029 --> 00:23:19,039 program 1238 00:23:19,039 --> 00:23:21,510 program we don't remember or we don't know what 1239 00:23:21,510 --> 00:23:21,520 we don't remember or we don't know what 1240 00:23:21,520 --> 00:23:22,789 we don't remember or we don't know what this number stands for 1241 00:23:22,789 --> 00:23:22,799 this number stands for 1242 00:23:22,799 --> 00:23:25,270 this number stands for if somebody else is using so we want to 1243 00:23:25,270 --> 00:23:25,280 if somebody else is using so we want to 1244 00:23:25,280 --> 00:23:26,870 if somebody else is using so we want to add some descriptive 1245 00:23:26,870 --> 00:23:26,880 add some descriptive 1246 00:23:26,880 --> 00:23:29,430 add some descriptive information about this number that says 1247 00:23:29,430 --> 00:23:29,440 information about this number that says 1248 00:23:29,440 --> 00:23:30,549 information about this number that says this is how many 1249 00:23:30,549 --> 00:23:30,559 this is how many 1250 00:23:30,559 --> 00:23:32,870 this is how many minutes there are in 20 days so 1251 00:23:32,870 --> 00:23:32,880 minutes there are in 20 days so 1252 00:23:32,880 --> 00:23:34,789 minutes there are in 20 days so basically we need a line that says 20 1253 00:23:34,789 --> 00:23:34,799 basically we need a line that says 20 1254 00:23:34,799 --> 00:23:35,190 basically we need a line that says 20 days 1255 00:23:35,190 --> 00:23:35,200 days 1256 00:23:35,200 --> 00:23:39,990 days are this many minutes 1257 00:23:42,549 --> 00:23:42,559 and this should basically be exactly 1258 00:23:42,559 --> 00:23:43,750 and this should basically be exactly this calculation 1259 00:23:43,750 --> 00:23:43,760 this calculation 1260 00:23:43,760 --> 00:23:47,269 this calculation right here so how do we put this 1261 00:23:47,269 --> 00:23:47,279 right here so how do we put this 1262 00:23:47,279 --> 00:23:49,830 right here so how do we put this calculation basically right here in the 1263 00:23:49,830 --> 00:23:49,840 calculation basically right here in the 1264 00:23:49,840 --> 00:23:50,870 calculation basically right here in the middle 1265 00:23:50,870 --> 00:23:50,880 middle 1266 00:23:50,880 --> 00:23:54,789 middle so that we end up with this whole phrase 1267 00:23:54,789 --> 00:23:54,799 so that we end up with this whole phrase 1268 00:23:54,799 --> 00:23:56,950 so that we end up with this whole phrase displayed right here so how do we 1269 00:23:56,950 --> 00:23:56,960 displayed right here so how do we 1270 00:23:56,960 --> 00:23:58,470 displayed right here so how do we combine text 1271 00:23:58,470 --> 00:23:58,480 combine text 1272 00:23:58,480 --> 00:24:02,470 combine text and numbers basically or calculation 1273 00:24:02,470 --> 00:24:02,480 and numbers basically or calculation 1274 00:24:02,480 --> 00:24:05,269 and numbers basically or calculation of numbers and in programming languages 1275 00:24:05,269 --> 00:24:05,279 of numbers and in programming languages 1276 00:24:05,279 --> 00:24:06,950 of numbers and in programming languages again this is not specific 1277 00:24:06,950 --> 00:24:06,960 again this is not specific 1278 00:24:06,960 --> 00:24:09,590 again this is not specific to python we would do that using 1279 00:24:09,590 --> 00:24:09,600 to python we would do that using 1280 00:24:09,600 --> 00:24:10,789 to python we would do that using something called 1281 00:24:10,789 --> 00:24:10,799 something called 1282 00:24:10,799 --> 00:24:13,830 something called string concatenation and string 1283 00:24:13,830 --> 00:24:13,840 string concatenation and string 1284 00:24:13,840 --> 00:24:16,230 string concatenation and string concatenation is basically a fancy word 1285 00:24:16,230 --> 00:24:16,240 concatenation is basically a fancy word 1286 00:24:16,240 --> 00:24:16,630 concatenation is basically a fancy word for 1287 00:24:16,630 --> 00:24:16,640 for 1288 00:24:16,640 --> 00:24:19,669 for gluing together or combining multiple 1289 00:24:19,669 --> 00:24:19,679 gluing together or combining multiple 1290 00:24:19,679 --> 00:24:21,029 gluing together or combining multiple strings 1291 00:24:21,029 --> 00:24:21,039 strings 1292 00:24:21,039 --> 00:24:23,190 strings now how does the syntax for that look 1293 00:24:23,190 --> 00:24:23,200 now how does the syntax for that look 1294 00:24:23,200 --> 00:24:24,070 now how does the syntax for that look like 1295 00:24:24,070 --> 00:24:24,080 like 1296 00:24:24,080 --> 00:24:27,269 like we combine the strings using plus sign 1297 00:24:27,269 --> 00:24:27,279 we combine the strings using plus sign 1298 00:24:27,279 --> 00:24:29,909 we combine the strings using plus sign so apart from adding numbers obviously 1299 00:24:29,909 --> 00:24:29,919 so apart from adding numbers obviously 1300 00:24:29,919 --> 00:24:30,950 so apart from adding numbers obviously using plus 1301 00:24:30,950 --> 00:24:30,960 using plus 1302 00:24:30,960 --> 00:24:33,590 using plus plus is also used in programming for 1303 00:24:33,590 --> 00:24:33,600 plus is also used in programming for 1304 00:24:33,600 --> 00:24:34,470 plus is also used in programming for combining 1305 00:24:34,470 --> 00:24:34,480 combining 1306 00:24:34,480 --> 00:24:37,510 combining multiple strings so in our example we 1307 00:24:37,510 --> 00:24:37,520 multiple strings so in our example we 1308 00:24:37,520 --> 00:24:37,990 multiple strings so in our example we have 1309 00:24:37,990 --> 00:24:38,000 have 1310 00:24:38,000 --> 00:24:40,710 have three string values and we want to put 1311 00:24:40,710 --> 00:24:40,720 three string values and we want to put 1312 00:24:40,720 --> 00:24:41,750 three string values and we want to put them all together 1313 00:24:41,750 --> 00:24:41,760 them all together 1314 00:24:41,760 --> 00:24:44,710 them all together in one string or one sentence we have 1315 00:24:44,710 --> 00:24:44,720 in one string or one sentence we have 1316 00:24:44,720 --> 00:24:47,190 in one string or one sentence we have the first string 20 days r 1317 00:24:47,190 --> 00:24:47,200 the first string 20 days r 1318 00:24:47,200 --> 00:24:49,029 the first string 20 days r and then we have the second string 1319 00:24:49,029 --> 00:24:49,039 and then we have the second string 1320 00:24:49,039 --> 00:24:50,789 and then we have the second string minutes and in the middle the third 1321 00:24:50,789 --> 00:24:50,799 minutes and in the middle the third 1322 00:24:50,799 --> 00:24:51,510 minutes and in the middle the third string 1323 00:24:51,510 --> 00:24:51,520 string 1324 00:24:51,520 --> 00:24:53,190 string which will be the value of the 1325 00:24:53,190 --> 00:24:53,200 which will be the value of the 1326 00:24:53,200 --> 00:24:54,950 which will be the value of the calculation 1327 00:24:54,950 --> 00:24:54,960 calculation 1328 00:24:54,960 --> 00:24:57,909 calculation however if we just put a number here 1329 00:24:57,909 --> 00:24:57,919 however if we just put a number here 1330 00:24:57,919 --> 00:24:58,830 however if we just put a number here python 1331 00:24:58,830 --> 00:24:58,840 python 1332 00:24:58,840 --> 00:25:01,750 python interpreter tells us it's not a string 1333 00:25:01,750 --> 00:25:01,760 interpreter tells us it's not a string 1334 00:25:01,760 --> 00:25:04,710 interpreter tells us it's not a string it's a number so we need to turn it into 1335 00:25:04,710 --> 00:25:04,720 it's a number so we need to turn it into 1336 00:25:04,720 --> 00:25:05,909 it's a number so we need to turn it into a string 1337 00:25:05,909 --> 00:25:05,919 a string 1338 00:25:05,919 --> 00:25:07,750 a string other programming languages do that 1339 00:25:07,750 --> 00:25:07,760 other programming languages do that 1340 00:25:07,760 --> 00:25:09,909 other programming languages do that automatically in python we need to do 1341 00:25:09,909 --> 00:25:09,919 automatically in python we need to do 1342 00:25:09,919 --> 00:25:10,630 automatically in python we need to do that 1343 00:25:10,630 --> 00:25:10,640 that 1344 00:25:10,640 --> 00:25:14,390 that explicitly so we need to tell python 1345 00:25:14,390 --> 00:25:14,400 explicitly so we need to tell python 1346 00:25:14,400 --> 00:25:17,269 explicitly so we need to tell python take this number but not as a number but 1347 00:25:17,269 --> 00:25:17,279 take this number but not as a number but 1348 00:25:17,279 --> 00:25:17,590 take this number but not as a number but as 1349 00:25:17,590 --> 00:25:17,600 as 1350 00:25:17,600 --> 00:25:23,350 as a string and we do that using a syntax 1351 00:25:25,590 --> 00:25:25,600 that looks exactly like that so 1352 00:25:25,600 --> 00:25:26,710 that looks exactly like that so basically we 1353 00:25:26,710 --> 00:25:26,720 basically we 1354 00:25:26,720 --> 00:25:28,630 basically we have a non-string value but we're 1355 00:25:28,630 --> 00:25:28,640 have a non-string value but we're 1356 00:25:28,640 --> 00:25:31,510 have a non-string value but we're telling python we want it as a string 1357 00:25:31,510 --> 00:25:31,520 telling python we want it as a string 1358 00:25:31,520 --> 00:25:34,070 telling python we want it as a string because it needs to be printed out as a 1359 00:25:34,070 --> 00:25:34,080 because it needs to be printed out as a 1360 00:25:34,080 --> 00:25:35,510 because it needs to be printed out as a text basically 1361 00:25:35,510 --> 00:25:35,520 text basically 1362 00:25:35,520 --> 00:25:39,029 text basically so if i execute this line 1363 00:25:39,029 --> 00:25:39,039 so if i execute this line 1364 00:25:39,039 --> 00:25:40,789 so if i execute this line let's see what happened and there you go 1365 00:25:40,789 --> 00:25:40,799 let's see what happened and there you go 1366 00:25:40,799 --> 00:25:42,470 let's see what happened and there you go we have our output 1367 00:25:42,470 --> 00:25:42,480 we have our output 1368 00:25:42,480 --> 00:25:45,269 we have our output just like we wrote it here but you see 1369 00:25:45,269 --> 00:25:45,279 just like we wrote it here but you see 1370 00:25:45,279 --> 00:25:45,990 just like we wrote it here but you see that there 1371 00:25:45,990 --> 00:25:46,000 that there 1372 00:25:46,000 --> 00:25:49,750 that there are no spaces around so basically 50 1373 00:25:49,750 --> 00:25:49,760 are no spaces around so basically 50 1374 00:25:49,760 --> 00:25:52,310 are no spaces around so basically 50 is just really glued together without 1375 00:25:52,310 --> 00:25:52,320 is just really glued together without 1376 00:25:52,320 --> 00:25:53,269 is just really glued together without any space 1377 00:25:53,269 --> 00:25:53,279 any space 1378 00:25:53,279 --> 00:25:56,230 any space around and how do we put spaces around 1379 00:25:56,230 --> 00:25:56,240 around and how do we put spaces around 1380 00:25:56,240 --> 00:25:57,430 around and how do we put spaces around these 50 1381 00:25:57,430 --> 00:25:57,440 these 50 1382 00:25:57,440 --> 00:25:59,990 these 50 basically add a space here add a space 1383 00:25:59,990 --> 00:26:00,000 basically add a space here add a space 1384 00:26:00,000 --> 00:26:00,630 basically add a space here add a space here 1385 00:26:00,630 --> 00:26:00,640 here 1386 00:26:00,640 --> 00:26:03,669 here now why does that work because this 1387 00:26:03,669 --> 00:26:03,679 now why does that work because this 1388 00:26:03,679 --> 00:26:06,710 now why does that work because this whole thing for python is a string again 1389 00:26:06,710 --> 00:26:06,720 whole thing for python is a string again 1390 00:26:06,720 --> 00:26:07,750 whole thing for python is a string again because we are 1391 00:26:07,750 --> 00:26:07,760 because we are 1392 00:26:07,760 --> 00:26:09,990 because we are putting it within these quotes so 1393 00:26:09,990 --> 00:26:10,000 putting it within these quotes so 1394 00:26:10,000 --> 00:26:11,669 putting it within these quotes so basically any character 1395 00:26:11,669 --> 00:26:11,679 basically any character 1396 00:26:11,679 --> 00:26:14,390 basically any character that you see on your keyboard right now 1397 00:26:14,390 --> 00:26:14,400 that you see on your keyboard right now 1398 00:26:14,400 --> 00:26:15,430 that you see on your keyboard right now if you put it 1399 00:26:15,430 --> 00:26:15,440 if you put it 1400 00:26:15,440 --> 00:26:19,029 if you put it between those quotes is 1401 00:26:19,029 --> 00:26:19,039 between those quotes is 1402 00:26:19,039 --> 00:26:22,870 between those quotes is interpreted by python as a string 1403 00:26:22,870 --> 00:26:22,880 interpreted by python as a string 1404 00:26:22,880 --> 00:26:25,830 interpreted by python as a string including this space character right so 1405 00:26:25,830 --> 00:26:25,840 including this space character right so 1406 00:26:25,840 --> 00:26:27,669 including this space character right so if we execute it again 1407 00:26:27,669 --> 00:26:27,679 if we execute it again 1408 00:26:27,679 --> 00:26:30,789 if we execute it again we have spaces around 50 and our 1409 00:26:30,789 --> 00:26:30,799 we have spaces around 50 and our 1410 00:26:30,799 --> 00:26:33,909 we have spaces around 50 and our sentence our phrase looks fine and if 1411 00:26:33,909 --> 00:26:33,919 sentence our phrase looks fine and if 1412 00:26:33,919 --> 00:26:35,190 sentence our phrase looks fine and if you're thinking right now this is 1413 00:26:35,190 --> 00:26:35,200 you're thinking right now this is 1414 00:26:35,200 --> 00:26:37,190 you're thinking right now this is actually kind of annoying because 1415 00:26:37,190 --> 00:26:37,200 actually kind of annoying because 1416 00:26:37,200 --> 00:26:39,750 actually kind of annoying because first of all it looks ugly and also 1417 00:26:39,750 --> 00:26:39,760 first of all it looks ugly and also 1418 00:26:39,760 --> 00:26:40,950 first of all it looks ugly and also there's a high chance you're gonna 1419 00:26:40,950 --> 00:26:40,960 there's a high chance you're gonna 1420 00:26:40,960 --> 00:26:41,909 there's a high chance you're gonna forget it 1421 00:26:41,909 --> 00:26:41,919 forget it 1422 00:26:41,919 --> 00:26:45,110 forget it that is absolutely right so in python 1423 00:26:45,110 --> 00:26:45,120 that is absolutely right so in python 1424 00:26:45,120 --> 00:26:45,590 that is absolutely right so in python again 1425 00:26:45,590 --> 00:26:45,600 again 1426 00:26:45,600 --> 00:26:48,789 again specifically there is a way to do it 1427 00:26:48,789 --> 00:26:48,799 specifically there is a way to do it 1428 00:26:48,799 --> 00:26:52,470 specifically there is a way to do it in a more elegant way using a different 1429 00:26:52,470 --> 00:26:52,480 in a more elegant way using a different 1430 00:26:52,480 --> 00:26:55,830 in a more elegant way using a different syntax and the more elegant syntax 1431 00:26:55,830 --> 00:26:55,840 syntax and the more elegant syntax 1432 00:26:55,840 --> 00:26:59,190 syntax and the more elegant syntax for that let's actually close this is 1433 00:26:59,190 --> 00:26:59,200 for that let's actually close this is 1434 00:26:59,200 --> 00:27:03,669 for that let's actually close this is print 1435 00:27:06,789 --> 00:27:06,799 and let's write that again and 1436 00:27:06,799 --> 00:27:10,149 and let's write that again and instead of having these plus 1437 00:27:10,149 --> 00:27:10,159 instead of having these plus 1438 00:27:10,159 --> 00:27:13,350 instead of having these plus we have curly braces and we write 1439 00:27:13,350 --> 00:27:13,360 we have curly braces and we write 1440 00:27:13,360 --> 00:27:16,230 we have curly braces and we write our number inside or whatever 1441 00:27:16,230 --> 00:27:16,240 our number inside or whatever 1442 00:27:16,240 --> 00:27:17,830 our number inside or whatever non-textual 1443 00:27:17,830 --> 00:27:17,840 non-textual 1444 00:27:17,840 --> 00:27:20,470 non-textual value and at the beginning right here 1445 00:27:20,470 --> 00:27:20,480 value and at the beginning right here 1446 00:27:20,480 --> 00:27:21,269 value and at the beginning right here basically 1447 00:27:21,269 --> 00:27:21,279 basically 1448 00:27:21,279 --> 00:27:24,070 basically before we start writing a string which 1449 00:27:24,070 --> 00:27:24,080 before we start writing a string which 1450 00:27:24,080 --> 00:27:24,950 before we start writing a string which starts with 1451 00:27:24,950 --> 00:27:24,960 starts with 1452 00:27:24,960 --> 00:27:28,310 starts with quotes we just write the letter f 1453 00:27:28,310 --> 00:27:28,320 quotes we just write the letter f 1454 00:27:28,320 --> 00:27:29,909 quotes we just write the letter f and you see the syntax highlighting as 1455 00:27:29,909 --> 00:27:29,919 and you see the syntax highlighting as 1456 00:27:29,919 --> 00:27:31,909 and you see the syntax highlighting as well basically 1457 00:27:31,909 --> 00:27:31,919 well basically 1458 00:27:31,919 --> 00:27:35,269 well basically sees that this is not part of the text 1459 00:27:35,269 --> 00:27:35,279 sees that this is not part of the text 1460 00:27:35,279 --> 00:27:38,470 sees that this is not part of the text this is non-text value and if i 1461 00:27:38,470 --> 00:27:38,480 this is non-text value and if i 1462 00:27:38,480 --> 00:27:41,590 this is non-text value and if i execute it i should see the same output 1463 00:27:41,590 --> 00:27:41,600 execute it i should see the same output 1464 00:27:41,600 --> 00:27:43,909 execute it i should see the same output from the second line and this is really 1465 00:27:43,909 --> 00:27:43,919 from the second line and this is really 1466 00:27:43,919 --> 00:27:45,510 from the second line and this is really a way cooler way 1467 00:27:45,510 --> 00:27:45,520 a way cooler way 1468 00:27:45,520 --> 00:27:48,549 a way cooler way to write this instead of using plus 1469 00:27:48,549 --> 00:27:48,559 to write this instead of using plus 1470 00:27:48,559 --> 00:27:50,630 to write this instead of using plus but this is something very common and 1471 00:27:50,630 --> 00:27:50,640 but this is something very common and 1472 00:27:50,640 --> 00:27:51,750 but this is something very common and also something that 1473 00:27:51,750 --> 00:27:51,760 also something that 1474 00:27:51,760 --> 00:27:53,590 also something that you would encounter in most programming 1475 00:27:53,590 --> 00:27:53,600 you would encounter in most programming 1476 00:27:53,600 --> 00:27:54,789 you would encounter in most programming languages so just 1477 00:27:54,789 --> 00:27:54,799 languages so just 1478 00:27:54,799 --> 00:27:57,269 languages so just important to know that this is a syntax 1479 00:27:57,269 --> 00:27:57,279 important to know that this is a syntax 1480 00:27:57,279 --> 00:27:57,830 important to know that this is a syntax for 1481 00:27:57,830 --> 00:27:57,840 for 1482 00:27:57,840 --> 00:28:00,870 for string concatenation as well so we can 1483 00:28:00,870 --> 00:28:00,880 string concatenation as well so we can 1484 00:28:00,880 --> 00:28:02,549 string concatenation as well so we can basically just 1485 00:28:02,549 --> 00:28:02,559 basically just 1486 00:28:02,559 --> 00:28:05,990 basically just remove it and use this syntax for our 1487 00:28:05,990 --> 00:28:06,000 remove it and use this syntax for our 1488 00:28:06,000 --> 00:28:06,870 remove it and use this syntax for our examples 1489 00:28:06,870 --> 00:28:06,880 examples 1490 00:28:06,880 --> 00:28:08,870 examples and also note that this syntax is 1491 00:28:08,870 --> 00:28:08,880 and also note that this syntax is 1492 00:28:08,880 --> 00:28:11,029 and also note that this syntax is actually a new addition to python 1493 00:28:11,029 --> 00:28:11,039 actually a new addition to python 1494 00:28:11,039 --> 00:28:13,590 actually a new addition to python so it only works if you have a latest 1495 00:28:13,590 --> 00:28:13,600 so it only works if you have a latest 1496 00:28:13,600 --> 00:28:14,950 so it only works if you have a latest python version 1497 00:28:14,950 --> 00:28:14,960 python version 1498 00:28:14,960 --> 00:28:17,590 python version in our project if you remember we 1499 00:28:17,590 --> 00:28:17,600 in our project if you remember we 1500 00:28:17,600 --> 00:28:18,310 in our project if you remember we actually 1501 00:28:18,310 --> 00:28:18,320 actually 1502 00:28:18,320 --> 00:28:22,870 actually configured and chose version 3.9 1503 00:28:22,870 --> 00:28:22,880 configured and chose version 3.9 1504 00:28:22,880 --> 00:28:25,669 configured and chose version 3.9 and that's why it works for us if you 1505 00:28:25,669 --> 00:28:25,679 and that's why it works for us if you 1506 00:28:25,679 --> 00:28:25,990 and that's why it works for us if you use 1507 00:28:25,990 --> 00:28:26,000 use 1508 00:28:26,000 --> 00:28:29,430 use python 2 for example python version 2 1509 00:28:29,430 --> 00:28:29,440 python 2 for example python version 2 1510 00:28:29,440 --> 00:28:31,750 python 2 for example python version 2 this syntax is not going to work for you 1511 00:28:31,750 --> 00:28:31,760 this syntax is not going to work for you 1512 00:28:31,760 --> 00:28:33,510 this syntax is not going to work for you we can actually demonstrate it 1513 00:28:33,510 --> 00:28:33,520 we can actually demonstrate it 1514 00:28:33,520 --> 00:28:36,789 we can actually demonstrate it so i'm going to copy that line 1515 00:28:36,789 --> 00:28:36,799 so i'm going to copy that line 1516 00:28:36,799 --> 00:28:47,990 so i'm going to copy that line and i'm going to change our test.pi 1517 00:28:51,110 --> 00:28:51,120 and now if i execute it using my python 1518 00:28:51,120 --> 00:28:53,590 and now if i execute it using my python 3 1519 00:28:56,470 --> 00:28:56,480 you see it works fine if i do it with 1520 00:28:56,480 --> 00:28:58,149 you see it works fine if i do it with python which is version 1521 00:28:58,149 --> 00:28:58,159 python which is version 1522 00:28:58,159 --> 00:29:01,510 python which is version two point something 1523 00:29:04,149 --> 00:29:04,159 let's see what happens there you go 1524 00:29:04,159 --> 00:29:06,710 let's see what happens there you go syntax error invalid syntax because 1525 00:29:06,710 --> 00:29:06,720 syntax error invalid syntax because 1526 00:29:06,720 --> 00:29:12,750 syntax error invalid syntax because python version 1527 00:29:12,750 --> 00:29:12,760 python version 1528 00:29:12,760 --> 00:29:15,669 python version 2.7.10 so older version basically 1529 00:29:15,669 --> 00:29:15,679 2.7.10 so older version basically 1530 00:29:15,679 --> 00:29:18,389 2.7.10 so older version basically doesn't recognize this syntax so just be 1531 00:29:18,389 --> 00:29:18,399 doesn't recognize this syntax so just be 1532 00:29:18,399 --> 00:29:19,269 doesn't recognize this syntax so just be aware of that 1533 00:29:19,269 --> 00:29:19,279 aware of that 1534 00:29:19,279 --> 00:29:21,750 aware of that so this syntax actually only works for 1535 00:29:21,750 --> 00:29:21,760 so this syntax actually only works for 1536 00:29:21,760 --> 00:29:22,870 so this syntax actually only works for python versions 1537 00:29:22,870 --> 00:29:22,880 python versions 1538 00:29:22,880 --> 00:29:26,710 python versions starting from 3.6 so everything 1539 00:29:26,710 --> 00:29:26,720 starting from 3.6 so everything 1540 00:29:26,720 --> 00:29:28,549 starting from 3.6 so everything below that every python version 1541 00:29:28,549 --> 00:29:28,559 below that every python version 1542 00:29:28,559 --> 00:29:31,190 below that every python version basically will not recognize this syntax 1543 00:29:31,190 --> 00:29:31,200 basically will not recognize this syntax 1544 00:29:31,200 --> 00:29:33,590 basically will not recognize this syntax as we see right here so again back to 1545 00:29:33,590 --> 00:29:33,600 as we see right here so again back to 1546 00:29:33,600 --> 00:29:34,470 as we see right here so again back to our code 1547 00:29:34,470 --> 00:29:34,480 our code 1548 00:29:34,480 --> 00:29:37,990 our code and now we just have a number here 1549 00:29:37,990 --> 00:29:38,000 and now we just have a number here 1550 00:29:38,000 --> 00:29:40,230 and now we just have a number here but what we actually want is the 1551 00:29:40,230 --> 00:29:40,240 but what we actually want is the 1552 00:29:40,240 --> 00:29:41,110 but what we actually want is the calculation 1553 00:29:41,110 --> 00:29:41,120 calculation 1554 00:29:41,120 --> 00:29:43,430 calculation for getting the correct result right so 1555 00:29:43,430 --> 00:29:43,440 for getting the correct result right so 1556 00:29:43,440 --> 00:29:44,710 for getting the correct result right so we want again 1557 00:29:44,710 --> 00:29:44,720 we want again 1558 00:29:44,720 --> 00:29:48,149 we want again 20 days 1559 00:29:51,430 --> 00:29:51,440 in hours and then in minutes and if i 1560 00:29:51,440 --> 00:29:52,230 in hours and then in minutes and if i execute it 1561 00:29:52,230 --> 00:29:52,240 execute it 1562 00:29:52,240 --> 00:29:55,350 execute it you see that the calculation was done 1563 00:29:55,350 --> 00:29:55,360 you see that the calculation was done 1564 00:29:55,360 --> 00:29:56,389 you see that the calculation was done and here we have 1565 00:29:56,389 --> 00:29:56,399 and here we have 1566 00:29:56,399 --> 00:29:58,870 and here we have the full complete sentence with the 1567 00:29:58,870 --> 00:29:58,880 the full complete sentence with the 1568 00:29:58,880 --> 00:30:00,070 the full complete sentence with the result in it 1569 00:30:00,070 --> 00:30:00,080 result in it 1570 00:30:00,080 --> 00:30:02,870 result in it and if you're curious this f actually 1571 00:30:02,870 --> 00:30:02,880 and if you're curious this f actually 1572 00:30:02,880 --> 00:30:03,430 and if you're curious this f actually stands 1573 00:30:03,430 --> 00:30:03,440 stands 1574 00:30:03,440 --> 00:30:05,990 stands for format so this is basically 1575 00:30:05,990 --> 00:30:06,000 for format so this is basically 1576 00:30:06,000 --> 00:30:06,789 for format so this is basically formatting 1577 00:30:06,789 --> 00:30:06,799 formatting 1578 00:30:06,799 --> 00:30:13,510 formatting our text or our string in a correct way 1579 00:30:15,430 --> 00:30:15,440 awesome so we have this line of code 1580 00:30:15,440 --> 00:30:17,190 awesome so we have this line of code here that basically 1581 00:30:17,190 --> 00:30:17,200 here that basically 1582 00:30:17,200 --> 00:30:19,269 here that basically calculates for us how many minutes there 1583 00:30:19,269 --> 00:30:19,279 calculates for us how many minutes there 1584 00:30:19,279 --> 00:30:20,789 calculates for us how many minutes there are in 20 days 1585 00:30:20,789 --> 00:30:20,799 are in 20 days 1586 00:30:20,799 --> 00:30:24,070 are in 20 days let's say we want to do the same for 35 1587 00:30:24,070 --> 00:30:24,080 let's say we want to do the same for 35 1588 00:30:24,080 --> 00:30:24,630 let's say we want to do the same for 35 days 1589 00:30:24,630 --> 00:30:24,640 days 1590 00:30:24,640 --> 00:30:27,830 days right what we can do is basically copy 1591 00:30:27,830 --> 00:30:27,840 right what we can do is basically copy 1592 00:30:27,840 --> 00:30:28,870 right what we can do is basically copy that line 1593 00:30:28,870 --> 00:30:28,880 that line 1594 00:30:28,880 --> 00:30:33,190 that line and replace the values 1595 00:30:33,190 --> 00:30:33,200 and replace the values 1596 00:30:33,200 --> 00:30:37,430 and replace the values for 20 with 35 and if i execute it 1597 00:30:37,430 --> 00:30:37,440 for 20 with 35 and if i execute it 1598 00:30:37,440 --> 00:30:40,630 for 20 with 35 and if i execute it i get the same calculation but for 35 1599 00:30:40,630 --> 00:30:40,640 i get the same calculation but for 35 1600 00:30:40,640 --> 00:30:41,269 i get the same calculation but for 35 days 1601 00:30:41,269 --> 00:30:41,279 days 1602 00:30:41,279 --> 00:30:44,389 days and we can do that basically multiple 1603 00:30:44,389 --> 00:30:44,399 and we can do that basically multiple 1604 00:30:44,399 --> 00:30:44,870 and we can do that basically multiple times 1605 00:30:44,870 --> 00:30:44,880 times 1606 00:30:44,880 --> 00:30:48,310 times for different values so let's say we 1607 00:30:48,310 --> 00:30:48,320 for different values so let's say we 1608 00:30:48,320 --> 00:30:48,950 for different values so let's say we want it 1609 00:30:48,950 --> 00:30:48,960 want it 1610 00:30:48,960 --> 00:30:51,269 want it for 50 days and we want the same 1611 00:30:51,269 --> 00:30:51,279 for 50 days and we want the same 1612 00:30:51,279 --> 00:30:52,149 for 50 days and we want the same calculation 1613 00:30:52,149 --> 00:30:52,159 calculation 1614 00:30:52,159 --> 00:30:55,590 calculation for i don't know let's say 110 days 1615 00:30:55,590 --> 00:30:55,600 for i don't know let's say 110 days 1616 00:30:55,600 --> 00:30:56,710 for i don't know let's say 110 days doesn't really matter 1617 00:30:56,710 --> 00:30:56,720 doesn't really matter 1618 00:30:56,720 --> 00:30:59,830 doesn't really matter and we have obviously different 1619 00:30:59,830 --> 00:30:59,840 and we have obviously different 1620 00:30:59,840 --> 00:31:02,630 and we have obviously different number of minutes for each of these 1621 00:31:02,630 --> 00:31:02,640 number of minutes for each of these 1622 00:31:02,640 --> 00:31:03,590 number of minutes for each of these values 1623 00:31:03,590 --> 00:31:03,600 values 1624 00:31:03,600 --> 00:31:05,750 values and now let's say we wrote this program 1625 00:31:05,750 --> 00:31:05,760 and now let's say we wrote this program 1626 00:31:05,760 --> 00:31:06,950 and now let's say we wrote this program it's ready 1627 00:31:06,950 --> 00:31:06,960 it's ready 1628 00:31:06,960 --> 00:31:09,750 it's ready and we're using it and at some point we 1629 00:31:09,750 --> 00:31:09,760 and we're using it and at some point we 1630 00:31:09,760 --> 00:31:11,590 and we're using it and at some point we decide you know what i want 1631 00:31:11,590 --> 00:31:11,600 decide you know what i want 1632 00:31:11,600 --> 00:31:14,710 decide you know what i want this program to actually calculate 1633 00:31:14,710 --> 00:31:14,720 this program to actually calculate 1634 00:31:14,720 --> 00:31:17,750 this program to actually calculate how many seconds there are for these 1635 00:31:17,750 --> 00:31:17,760 how many seconds there are for these 1636 00:31:17,760 --> 00:31:19,190 how many seconds there are for these provided days 1637 00:31:19,190 --> 00:31:19,200 provided days 1638 00:31:19,200 --> 00:31:22,389 provided days instead of minutes so what we would need 1639 00:31:22,389 --> 00:31:22,399 instead of minutes so what we would need 1640 00:31:22,399 --> 00:31:23,590 instead of minutes so what we would need to do in that case 1641 00:31:23,590 --> 00:31:23,600 to do in that case 1642 00:31:23,600 --> 00:31:26,389 to do in that case is basically change the calculation in 1643 00:31:26,389 --> 00:31:26,399 is basically change the calculation in 1644 00:31:26,399 --> 00:31:27,830 is basically change the calculation in all those four lines 1645 00:31:27,830 --> 00:31:27,840 all those four lines 1646 00:31:27,840 --> 00:31:29,990 all those four lines so instead of minutes it should actually 1647 00:31:29,990 --> 00:31:30,000 so instead of minutes it should actually 1648 00:31:30,000 --> 00:31:31,110 so instead of minutes it should actually calculate 1649 00:31:31,110 --> 00:31:31,120 calculate 1650 00:31:31,120 --> 00:31:33,590 calculate number of seconds in a day right so we 1651 00:31:33,590 --> 00:31:33,600 number of seconds in a day right so we 1652 00:31:33,600 --> 00:31:34,549 number of seconds in a day right so we have the hours 1653 00:31:34,549 --> 00:31:34,559 have the hours 1654 00:31:34,559 --> 00:31:37,669 have the hours minutes and seconds and we would have to 1655 00:31:37,669 --> 00:31:37,679 minutes and seconds and we would have to 1656 00:31:37,679 --> 00:31:40,470 minutes and seconds and we would have to change the text as well here and we 1657 00:31:40,470 --> 00:31:40,480 change the text as well here and we 1658 00:31:40,480 --> 00:31:41,509 change the text as well here and we would need to do that 1659 00:31:41,509 --> 00:31:41,519 would need to do that 1660 00:31:41,519 --> 00:31:44,549 would need to do that for each one of those lines right 1661 00:31:44,549 --> 00:31:44,559 for each one of those lines right 1662 00:31:44,559 --> 00:31:49,750 for each one of those lines right so we would have it here 1663 00:31:54,070 --> 00:31:54,080 like this and again if we need to modify 1664 00:31:54,080 --> 00:31:57,029 like this and again if we need to modify this for hours or milliseconds or 1665 00:31:57,029 --> 00:31:57,039 this for hours or milliseconds or 1666 00:31:57,039 --> 00:31:57,750 this for hours or milliseconds or whatever 1667 00:31:57,750 --> 00:31:57,760 whatever 1668 00:31:57,760 --> 00:31:59,909 whatever we basically have to do these changes 1669 00:31:59,909 --> 00:31:59,919 we basically have to do these changes 1670 00:31:59,919 --> 00:32:00,950 we basically have to do these changes multiple times 1671 00:32:00,950 --> 00:32:00,960 multiple times 1672 00:32:00,960 --> 00:32:02,950 multiple times right even though if you actually look 1673 00:32:02,950 --> 00:32:02,960 right even though if you actually look 1674 00:32:02,960 --> 00:32:04,070 right even though if you actually look at that this is 1675 00:32:04,070 --> 00:32:04,080 at that this is 1676 00:32:04,080 --> 00:32:06,710 at that this is the same exact calculation for each line 1677 00:32:06,710 --> 00:32:06,720 the same exact calculation for each line 1678 00:32:06,720 --> 00:32:08,470 the same exact calculation for each line that doesn't change right if you want 1679 00:32:08,470 --> 00:32:08,480 that doesn't change right if you want 1680 00:32:08,480 --> 00:32:10,470 that doesn't change right if you want seconds then this is the calculation 1681 00:32:10,470 --> 00:32:10,480 seconds then this is the calculation 1682 00:32:10,480 --> 00:32:11,590 seconds then this is the calculation that you need to do 1683 00:32:11,590 --> 00:32:11,600 that you need to do 1684 00:32:11,600 --> 00:32:14,389 that you need to do so how can we actually avoid repeating 1685 00:32:14,389 --> 00:32:14,399 so how can we actually avoid repeating 1686 00:32:14,399 --> 00:32:16,070 so how can we actually avoid repeating the same calculation 1687 00:32:16,070 --> 00:32:16,080 the same calculation 1688 00:32:16,080 --> 00:32:19,509 the same calculation and the same text in our code and the 1689 00:32:19,509 --> 00:32:19,519 and the same text in our code and the 1690 00:32:19,519 --> 00:32:22,549 and the same text in our code and the answer to that is variables so in 1691 00:32:22,549 --> 00:32:22,559 answer to that is variables so in 1692 00:32:22,559 --> 00:32:24,070 answer to that is variables so in programming languages we have 1693 00:32:24,070 --> 00:32:24,080 programming languages we have 1694 00:32:24,080 --> 00:32:27,110 programming languages we have variables that basically hold values 1695 00:32:27,110 --> 00:32:27,120 variables that basically hold values 1696 00:32:27,120 --> 00:32:30,230 variables that basically hold values that will repeat throughout your code 1697 00:32:30,230 --> 00:32:30,240 that will repeat throughout your code 1698 00:32:30,240 --> 00:32:33,350 that will repeat throughout your code that you can set once and 1699 00:32:33,350 --> 00:32:33,360 that you can set once and 1700 00:32:33,360 --> 00:32:35,830 that you can set once and use it in multiple different places so 1701 00:32:35,830 --> 00:32:35,840 use it in multiple different places so 1702 00:32:35,840 --> 00:32:37,029 use it in multiple different places so instead of 1703 00:32:37,029 --> 00:32:37,039 instead of 1704 00:32:37,039 --> 00:32:41,029 instead of basically repeating this calculation 1705 00:32:41,029 --> 00:32:41,039 basically repeating this calculation 1706 00:32:41,039 --> 00:32:43,269 basically repeating this calculation four times we basically do this 1707 00:32:43,269 --> 00:32:43,279 four times we basically do this 1708 00:32:43,279 --> 00:32:44,389 four times we basically do this calculation 1709 00:32:44,389 --> 00:32:44,399 calculation 1710 00:32:44,399 --> 00:32:47,669 calculation once like this 1711 00:32:47,669 --> 00:32:47,679 once like this 1712 00:32:47,679 --> 00:32:50,870 once like this and we basically save this value 1713 00:32:50,870 --> 00:32:50,880 and we basically save this value 1714 00:32:50,880 --> 00:32:53,590 and we basically save this value in a variable so that we can use it 1715 00:32:53,590 --> 00:32:53,600 in a variable so that we can use it 1716 00:32:53,600 --> 00:32:55,350 in a variable so that we can use it whenever we need right 1717 00:32:55,350 --> 00:32:55,360 whenever we need right 1718 00:32:55,360 --> 00:32:58,230 whenever we need right and the way that variables are defined 1719 00:32:58,230 --> 00:32:58,240 and the way that variables are defined 1720 00:32:58,240 --> 00:32:59,430 and the way that variables are defined in python 1721 00:32:59,430 --> 00:32:59,440 in python 1722 00:32:59,440 --> 00:33:03,669 in python is variable name let's call it 1723 00:33:12,230 --> 00:33:12,240 equals and whatever that value is that 1724 00:33:12,240 --> 00:33:14,950 equals and whatever that value is that repeats itself and that we want to save 1725 00:33:14,950 --> 00:33:14,960 repeats itself and that we want to save 1726 00:33:14,960 --> 00:33:16,630 repeats itself and that we want to save into a variable 1727 00:33:16,630 --> 00:33:16,640 into a variable 1728 00:33:16,640 --> 00:33:19,190 into a variable now i want to make two notes here 1729 00:33:19,190 --> 00:33:19,200 now i want to make two notes here 1730 00:33:19,200 --> 00:33:20,630 now i want to make two notes here regarding the variables 1731 00:33:20,630 --> 00:33:20,640 regarding the variables 1732 00:33:20,640 --> 00:33:24,310 regarding the variables in python first of all in python 1733 00:33:24,310 --> 00:33:24,320 in python first of all in python 1734 00:33:24,320 --> 00:33:26,870 in python first of all in python defining or creating a variable and 1735 00:33:26,870 --> 00:33:26,880 defining or creating a variable and 1736 00:33:26,880 --> 00:33:28,870 defining or creating a variable and giving it a value like this 1737 00:33:28,870 --> 00:33:28,880 giving it a value like this 1738 00:33:28,880 --> 00:33:31,990 giving it a value like this syntax for that is actually very simple 1739 00:33:31,990 --> 00:33:32,000 syntax for that is actually very simple 1740 00:33:32,000 --> 00:33:33,990 syntax for that is actually very simple compared to other languages because you 1741 00:33:33,990 --> 00:33:34,000 compared to other languages because you 1742 00:33:34,000 --> 00:33:35,590 compared to other languages because you just have the variable name 1743 00:33:35,590 --> 00:33:35,600 just have the variable name 1744 00:33:35,600 --> 00:33:38,070 just have the variable name and the value in many programming 1745 00:33:38,070 --> 00:33:38,080 and the value in many programming 1746 00:33:38,080 --> 00:33:40,070 and the value in many programming languages you actually have to define 1747 00:33:40,070 --> 00:33:40,080 languages you actually have to define 1748 00:33:40,080 --> 00:33:40,710 languages you actually have to define here 1749 00:33:40,710 --> 00:33:40,720 here 1750 00:33:40,720 --> 00:33:42,950 here some kind of data type for that variable 1751 00:33:42,950 --> 00:33:42,960 some kind of data type for that variable 1752 00:33:42,960 --> 00:33:44,789 some kind of data type for that variable for example if it's a number 1753 00:33:44,789 --> 00:33:44,799 for example if it's a number 1754 00:33:44,799 --> 00:33:48,149 for example if it's a number like float or integer or string 1755 00:33:48,149 --> 00:33:48,159 like float or integer or string 1756 00:33:48,159 --> 00:33:50,710 like float or integer or string etc in python you don't have to define 1757 00:33:50,710 --> 00:33:50,720 etc in python you don't have to define 1758 00:33:50,720 --> 00:33:51,190 etc in python you don't have to define that 1759 00:33:51,190 --> 00:33:51,200 that 1760 00:33:51,200 --> 00:33:53,269 that you just have name of the variable 1761 00:33:53,269 --> 00:33:53,279 you just have name of the variable 1762 00:33:53,279 --> 00:33:54,230 you just have name of the variable simple as that 1763 00:33:54,230 --> 00:33:54,240 simple as that 1764 00:33:54,240 --> 00:33:57,350 simple as that the second one is the naming 1765 00:33:57,350 --> 00:33:57,360 the second one is the naming 1766 00:33:57,360 --> 00:33:59,509 the second one is the naming convention or standard for the variables 1767 00:33:59,509 --> 00:33:59,519 convention or standard for the variables 1768 00:33:59,519 --> 00:34:01,750 convention or standard for the variables so we have two words for example if we 1769 00:34:01,750 --> 00:34:01,760 so we have two words for example if we 1770 00:34:01,760 --> 00:34:02,070 so we have two words for example if we name 1771 00:34:02,070 --> 00:34:02,080 name 1772 00:34:02,080 --> 00:34:04,830 name our variable calculation to seconds 1773 00:34:04,830 --> 00:34:04,840 our variable calculation to seconds 1774 00:34:04,840 --> 00:34:06,149 our variable calculation to seconds right 1775 00:34:06,149 --> 00:34:06,159 right 1776 00:34:06,159 --> 00:34:08,389 right we have actually three words here so 1777 00:34:08,389 --> 00:34:08,399 we have actually three words here so 1778 00:34:08,399 --> 00:34:10,230 we have actually three words here so variables that are descriptive so 1779 00:34:10,230 --> 00:34:10,240 variables that are descriptive so 1780 00:34:10,240 --> 00:34:11,669 variables that are descriptive so basically they tell you 1781 00:34:11,669 --> 00:34:11,679 basically they tell you 1782 00:34:11,679 --> 00:34:14,790 basically they tell you what this value actually is about so 1783 00:34:14,790 --> 00:34:14,800 what this value actually is about so 1784 00:34:14,800 --> 00:34:15,909 what this value actually is about so they have multiple 1785 00:34:15,909 --> 00:34:15,919 they have multiple 1786 00:34:15,919 --> 00:34:18,310 they have multiple words in them you can separate them 1787 00:34:18,310 --> 00:34:18,320 words in them you can separate them 1788 00:34:18,320 --> 00:34:19,109 words in them you can separate them using these 1789 00:34:19,109 --> 00:34:19,119 using these 1790 00:34:19,119 --> 00:34:21,990 using these underlines again in different languages 1791 00:34:21,990 --> 00:34:22,000 underlines again in different languages 1792 00:34:22,000 --> 00:34:22,629 underlines again in different languages the 1793 00:34:22,629 --> 00:34:22,639 the 1794 00:34:22,639 --> 00:34:24,950 the naming for variables can be different in 1795 00:34:24,950 --> 00:34:24,960 naming for variables can be different in 1796 00:34:24,960 --> 00:34:26,310 naming for variables can be different in python this is actually 1797 00:34:26,310 --> 00:34:26,320 python this is actually 1798 00:34:26,320 --> 00:34:29,190 python this is actually one of the standard ways of defining 1799 00:34:29,190 --> 00:34:29,200 one of the standard ways of defining 1800 00:34:29,200 --> 00:34:30,790 one of the standard ways of defining variable with underscores 1801 00:34:30,790 --> 00:34:30,800 variable with underscores 1802 00:34:30,800 --> 00:34:33,589 variable with underscores which i find pretty nice and easy to 1803 00:34:33,589 --> 00:34:33,599 which i find pretty nice and easy to 1804 00:34:33,599 --> 00:34:34,069 which i find pretty nice and easy to read 1805 00:34:34,069 --> 00:34:34,079 read 1806 00:34:34,079 --> 00:34:36,869 read so we're gonna use this syntax basically 1807 00:34:36,869 --> 00:34:36,879 so we're gonna use this syntax basically 1808 00:34:36,879 --> 00:34:37,829 so we're gonna use this syntax basically throughout the course 1809 00:34:37,829 --> 00:34:37,839 throughout the course 1810 00:34:37,839 --> 00:34:39,829 throughout the course it will be totally and absolutely okay 1811 00:34:39,829 --> 00:34:39,839 it will be totally and absolutely okay 1812 00:34:39,839 --> 00:34:41,669 it will be totally and absolutely okay if we wrote it like this 1813 00:34:41,669 --> 00:34:41,679 if we wrote it like this 1814 00:34:41,679 --> 00:34:45,109 if we wrote it like this or if we used capital letters instead 1815 00:34:45,109 --> 00:34:45,119 or if we used capital letters instead 1816 00:34:45,119 --> 00:34:48,069 or if we used capital letters instead but again this is probably the most 1817 00:34:48,069 --> 00:34:48,079 but again this is probably the most 1818 00:34:48,079 --> 00:34:49,190 but again this is probably the most readable form 1819 00:34:49,190 --> 00:34:49,200 readable form 1820 00:34:49,200 --> 00:34:51,909 readable form and this is what we're going to use now 1821 00:34:51,909 --> 00:34:51,919 and this is what we're going to use now 1822 00:34:51,919 --> 00:34:52,310 and this is what we're going to use now here 1823 00:34:52,310 --> 00:34:52,320 here 1824 00:34:52,320 --> 00:34:55,190 here note that we can decide whatever name we 1825 00:34:55,190 --> 00:34:55,200 note that we can decide whatever name we 1826 00:34:55,200 --> 00:34:55,909 note that we can decide whatever name we want to give 1827 00:34:55,909 --> 00:34:55,919 want to give 1828 00:34:55,919 --> 00:34:58,870 want to give our variable but in python there are 1829 00:34:58,870 --> 00:34:58,880 our variable but in python there are 1830 00:34:58,880 --> 00:35:00,550 our variable but in python there are some specific words 1831 00:35:00,550 --> 00:35:00,560 some specific words 1832 00:35:00,560 --> 00:35:02,870 some specific words that have special meaning to python 1833 00:35:02,870 --> 00:35:02,880 that have special meaning to python 1834 00:35:02,880 --> 00:35:05,109 that have special meaning to python these are called reserved words 1835 00:35:05,109 --> 00:35:05,119 these are called reserved words 1836 00:35:05,119 --> 00:35:07,510 these are called reserved words so you can't use these words as variable 1837 00:35:07,510 --> 00:35:07,520 so you can't use these words as variable 1838 00:35:07,520 --> 00:35:08,470 so you can't use these words as variable names 1839 00:35:08,470 --> 00:35:08,480 names 1840 00:35:08,480 --> 00:35:11,510 names and we will use some of these reserved 1841 00:35:11,510 --> 00:35:11,520 and we will use some of these reserved 1842 00:35:11,520 --> 00:35:12,390 and we will use some of these reserved words 1843 00:35:12,390 --> 00:35:12,400 words 1844 00:35:12,400 --> 00:35:14,230 words throughout the course so you will see 1845 00:35:14,230 --> 00:35:14,240 throughout the course so you will see 1846 00:35:14,240 --> 00:35:15,670 throughout the course so you will see some examples 1847 00:35:15,670 --> 00:35:15,680 some examples 1848 00:35:15,680 --> 00:35:17,990 some examples great so we have our variable defined 1849 00:35:17,990 --> 00:35:18,000 great so we have our variable defined 1850 00:35:18,000 --> 00:35:19,349 great so we have our variable defined here and 1851 00:35:19,349 --> 00:35:19,359 here and 1852 00:35:19,359 --> 00:35:21,270 here and this is the value that this variable 1853 00:35:21,270 --> 00:35:21,280 this is the value that this variable 1854 00:35:21,280 --> 00:35:24,230 this is the value that this variable gives us so how do we replace now 1855 00:35:24,230 --> 00:35:24,240 gives us so how do we replace now 1856 00:35:24,240 --> 00:35:26,950 gives us so how do we replace now these repeating values with this 1857 00:35:26,950 --> 00:35:26,960 these repeating values with this 1858 00:35:26,960 --> 00:35:27,510 these repeating values with this variable 1859 00:35:27,510 --> 00:35:27,520 variable 1860 00:35:27,520 --> 00:35:30,870 variable so we're going to delete that and again 1861 00:35:30,870 --> 00:35:30,880 so we're going to delete that and again 1862 00:35:30,880 --> 00:35:34,069 so we're going to delete that and again inside we're simply going to copy 1863 00:35:34,069 --> 00:35:34,079 inside we're simply going to copy 1864 00:35:34,079 --> 00:35:36,710 inside we're simply going to copy the name of the variable so let's 1865 00:35:36,710 --> 00:35:36,720 the name of the variable so let's 1866 00:35:36,720 --> 00:35:37,349 the name of the variable so let's execute 1867 00:35:37,349 --> 00:35:37,359 execute 1868 00:35:37,359 --> 00:35:40,710 execute and as you see we have our 1869 00:35:40,710 --> 00:35:40,720 and as you see we have our 1870 00:35:40,720 --> 00:35:43,190 and as you see we have our value printed just fine and we're going 1871 00:35:43,190 --> 00:35:43,200 value printed just fine and we're going 1872 00:35:43,200 --> 00:35:44,069 value printed just fine and we're going to do the same 1873 00:35:44,069 --> 00:35:44,079 to do the same 1874 00:35:44,079 --> 00:35:49,670 to do the same for all those 1875 00:35:53,430 --> 00:35:53,440 values and again execute 1876 00:35:53,440 --> 00:35:56,069 values and again execute everything works just like before now 1877 00:35:56,069 --> 00:35:56,079 everything works just like before now 1878 00:35:56,079 --> 00:35:57,430 everything works just like before now you may be thinking 1879 00:35:57,430 --> 00:35:57,440 you may be thinking 1880 00:35:57,440 --> 00:36:00,950 you may be thinking if we change this to minutes 1881 00:36:00,950 --> 00:36:00,960 if we change this to minutes 1882 00:36:00,960 --> 00:36:03,109 if we change this to minutes we would have to change the variable in 1883 00:36:03,109 --> 00:36:03,119 we would have to change the variable in 1884 00:36:03,119 --> 00:36:04,390 we would have to change the variable in all these places 1885 00:36:04,390 --> 00:36:04,400 all these places 1886 00:36:04,400 --> 00:36:07,829 all these places so that's our case we can basically just 1887 00:36:07,829 --> 00:36:07,839 so that's our case we can basically just 1888 00:36:07,839 --> 00:36:10,310 so that's our case we can basically just rename our variable something more 1889 00:36:10,310 --> 00:36:10,320 rename our variable something more 1890 00:36:10,320 --> 00:36:12,790 rename our variable something more generic so let's say calculation 1891 00:36:12,790 --> 00:36:12,800 generic so let's say calculation 1892 00:36:12,800 --> 00:36:16,069 generic so let's say calculation to units and this could be 1893 00:36:16,069 --> 00:36:16,079 to units and this could be 1894 00:36:16,079 --> 00:36:18,630 to units and this could be now any unit that we want second meaning 1895 00:36:18,630 --> 00:36:18,640 now any unit that we want second meaning 1896 00:36:18,640 --> 00:36:19,670 now any unit that we want second meaning it doesn't matter 1897 00:36:19,670 --> 00:36:19,680 it doesn't matter 1898 00:36:19,680 --> 00:36:22,310 it doesn't matter and this is exactly the advantage of 1899 00:36:22,310 --> 00:36:22,320 and this is exactly the advantage of 1900 00:36:22,320 --> 00:36:23,030 and this is exactly the advantage of variable 1901 00:36:23,030 --> 00:36:23,040 variable 1902 00:36:23,040 --> 00:36:24,829 variable because you can name it whatever you 1903 00:36:24,829 --> 00:36:24,839 because you can name it whatever you 1904 00:36:24,839 --> 00:36:27,910 because you can name it whatever you want 1905 00:36:30,230 --> 00:36:30,240 which basically just describes what this 1906 00:36:30,240 --> 00:36:31,910 which basically just describes what this variable is about 1907 00:36:31,910 --> 00:36:31,920 variable is about 1908 00:36:31,920 --> 00:36:34,950 variable is about and now you won't have to change that 1909 00:36:34,950 --> 00:36:34,960 and now you won't have to change that 1910 00:36:34,960 --> 00:36:35,670 and now you won't have to change that again 1911 00:36:35,670 --> 00:36:35,680 again 1912 00:36:35,680 --> 00:36:38,710 again and we can also replace this one here 1913 00:36:38,710 --> 00:36:38,720 and we can also replace this one here 1914 00:36:38,720 --> 00:36:41,030 and we can also replace this one here accordingly since it's a text we can 1915 00:36:41,030 --> 00:36:41,040 accordingly since it's a text we can 1916 00:36:41,040 --> 00:36:42,310 accordingly since it's a text we can call it a name 1917 00:36:42,310 --> 00:36:42,320 call it a name 1918 00:36:42,320 --> 00:36:45,270 call it a name of unit we can also call it unit doesn't 1919 00:36:45,270 --> 00:36:45,280 of unit we can also call it unit doesn't 1920 00:36:45,280 --> 00:36:46,150 of unit we can also call it unit doesn't really matter 1921 00:36:46,150 --> 00:36:46,160 really matter 1922 00:36:46,160 --> 00:36:48,470 really matter we're the ones deciding what that 1923 00:36:48,470 --> 00:36:48,480 we're the ones deciding what that 1924 00:36:48,480 --> 00:36:49,910 we're the ones deciding what that variable name is 1925 00:36:49,910 --> 00:36:49,920 variable name is 1926 00:36:49,920 --> 00:36:52,950 variable name is and once we have that variable we can 1927 00:36:52,950 --> 00:36:52,960 and once we have that variable we can 1928 00:36:52,960 --> 00:36:53,510 and once we have that variable we can now 1929 00:36:53,510 --> 00:36:53,520 now 1930 00:36:53,520 --> 00:36:55,910 now replace it here how do we do this 1931 00:36:55,910 --> 00:36:55,920 replace it here how do we do this 1932 00:36:55,920 --> 00:36:56,950 replace it here how do we do this because this is actually 1933 00:36:56,950 --> 00:36:56,960 because this is actually 1934 00:36:56,960 --> 00:37:00,310 because this is actually part of a text a string the same way we 1935 00:37:00,310 --> 00:37:00,320 part of a text a string the same way we 1936 00:37:00,320 --> 00:37:00,710 part of a text a string the same way we did 1937 00:37:00,710 --> 00:37:00,720 did 1938 00:37:00,720 --> 00:37:04,550 did right here we're gonna delete that 1939 00:37:04,550 --> 00:37:04,560 right here we're gonna delete that 1940 00:37:04,560 --> 00:37:08,150 right here we're gonna delete that and create an expression create a syntax 1941 00:37:08,150 --> 00:37:08,160 and create an expression create a syntax 1942 00:37:08,160 --> 00:37:09,829 and create an expression create a syntax that basically tells python 1943 00:37:09,829 --> 00:37:09,839 that basically tells python 1944 00:37:09,839 --> 00:37:12,030 that basically tells python hey this is not a string this is a 1945 00:37:12,030 --> 00:37:12,040 hey this is not a string this is a 1946 00:37:12,040 --> 00:37:13,430 hey this is not a string this is a non-string 1947 00:37:13,430 --> 00:37:13,440 non-string 1948 00:37:13,440 --> 00:37:15,589 non-string value and you already know this could be 1949 00:37:15,589 --> 00:37:15,599 value and you already know this could be 1950 00:37:15,599 --> 00:37:16,550 value and you already know this could be either number 1951 00:37:16,550 --> 00:37:16,560 either number 1952 00:37:16,560 --> 00:37:19,270 either number or variable itself and so we're going to 1953 00:37:19,270 --> 00:37:19,280 or variable itself and so we're going to 1954 00:37:19,280 --> 00:37:21,589 or variable itself and so we're going to use the curly braces 1955 00:37:21,589 --> 00:37:21,599 use the curly braces 1956 00:37:21,599 --> 00:37:24,630 use the curly braces and the name of the variable and just 1957 00:37:24,630 --> 00:37:24,640 and the name of the variable and just 1958 00:37:24,640 --> 00:37:25,190 and the name of the variable and just like that 1959 00:37:25,190 --> 00:37:25,200 like that 1960 00:37:25,200 --> 00:37:29,430 like that we have substituted these values here 1961 00:37:29,430 --> 00:37:29,440 we have substituted these values here 1962 00:37:29,440 --> 00:37:33,510 we have substituted these values here and if i execute it works perfectly fine 1963 00:37:33,510 --> 00:37:33,520 and if i execute it works perfectly fine 1964 00:37:33,520 --> 00:37:38,069 and if i execute it works perfectly fine and we can do that 1965 00:37:41,430 --> 00:37:41,440 in all four lines and our code is still 1966 00:37:41,440 --> 00:37:42,310 in all four lines and our code is still working 1967 00:37:42,310 --> 00:37:42,320 working 1968 00:37:42,320 --> 00:37:44,790 working and this syntax right here with this 1969 00:37:44,790 --> 00:37:44,800 and this syntax right here with this 1970 00:37:44,800 --> 00:37:45,750 and this syntax right here with this format 1971 00:37:45,750 --> 00:37:45,760 format 1972 00:37:45,760 --> 00:37:48,470 format at the beginning basically prevents us 1973 00:37:48,470 --> 00:37:48,480 at the beginning basically prevents us 1974 00:37:48,480 --> 00:37:49,829 at the beginning basically prevents us or avoids 1975 00:37:49,829 --> 00:37:49,839 or avoids 1976 00:37:49,839 --> 00:37:53,510 or avoids basically saves us from having a bunch 1977 00:37:53,510 --> 00:37:53,520 basically saves us from having a bunch 1978 00:37:53,520 --> 00:37:53,910 basically saves us from having a bunch of 1979 00:37:53,910 --> 00:37:53,920 of 1980 00:37:53,920 --> 00:37:57,109 of plus signs here and then space 1981 00:37:57,109 --> 00:37:57,119 plus signs here and then space 1982 00:37:57,119 --> 00:37:58,710 plus signs here and then space characters etc 1983 00:37:58,710 --> 00:37:58,720 characters etc 1984 00:37:58,720 --> 00:38:01,670 characters etc this all looks way elegant now and now 1985 00:38:01,670 --> 00:38:01,680 this all looks way elegant now and now 1986 00:38:01,680 --> 00:38:01,910 this all looks way elegant now and now if 1987 00:38:01,910 --> 00:38:01,920 if 1988 00:38:01,920 --> 00:38:03,510 if at some point we actually decide you 1989 00:38:03,510 --> 00:38:03,520 at some point we actually decide you 1990 00:38:03,520 --> 00:38:05,109 at some point we actually decide you know what i want 1991 00:38:05,109 --> 00:38:05,119 know what i want 1992 00:38:05,119 --> 00:38:08,470 know what i want this program to calculate how many hours 1993 00:38:08,470 --> 00:38:08,480 this program to calculate how many hours 1994 00:38:08,480 --> 00:38:11,109 this program to calculate how many hours there are in the given days instead of 1995 00:38:11,109 --> 00:38:11,119 there are in the given days instead of 1996 00:38:11,119 --> 00:38:11,829 there are in the given days instead of seconds 1997 00:38:11,829 --> 00:38:11,839 seconds 1998 00:38:11,839 --> 00:38:13,510 seconds and we want to change the program to do 1999 00:38:13,510 --> 00:38:13,520 and we want to change the program to do 2000 00:38:13,520 --> 00:38:15,589 and we want to change the program to do that we could basically 2001 00:38:15,589 --> 00:38:15,599 that we could basically 2002 00:38:15,599 --> 00:38:19,349 that we could basically just change the calculation here and 2003 00:38:19,349 --> 00:38:19,359 just change the calculation here and 2004 00:38:19,359 --> 00:38:22,550 just change the calculation here and instead of seconds we have hours and if 2005 00:38:22,550 --> 00:38:22,560 instead of seconds we have hours and if 2006 00:38:22,560 --> 00:38:23,670 instead of seconds we have hours and if i execute 2007 00:38:23,670 --> 00:38:23,680 i execute 2008 00:38:23,680 --> 00:38:25,910 i execute there you go we see the changes right 2009 00:38:25,910 --> 00:38:25,920 there you go we see the changes right 2010 00:38:25,920 --> 00:38:26,790 there you go we see the changes right away so 2011 00:38:26,790 --> 00:38:26,800 away so 2012 00:38:26,800 --> 00:38:29,349 away so this is why when you're programming 2013 00:38:29,349 --> 00:38:29,359 this is why when you're programming 2014 00:38:29,359 --> 00:38:31,030 this is why when you're programming doesn't matter in which language 2015 00:38:31,030 --> 00:38:31,040 doesn't matter in which language 2016 00:38:31,040 --> 00:38:33,910 doesn't matter in which language including python using variables will be 2017 00:38:33,910 --> 00:38:33,920 including python using variables will be 2018 00:38:33,920 --> 00:38:36,069 including python using variables will be probably some of the most frequent thing 2019 00:38:36,069 --> 00:38:36,079 probably some of the most frequent thing 2020 00:38:36,079 --> 00:38:36,710 probably some of the most frequent thing that you do 2021 00:38:36,710 --> 00:38:36,720 that you do 2022 00:38:36,720 --> 00:38:38,710 that you do because you always have values that are 2023 00:38:38,710 --> 00:38:38,720 because you always have values that are 2024 00:38:38,720 --> 00:38:39,990 because you always have values that are repeating themselves 2025 00:38:39,990 --> 00:38:40,000 repeating themselves 2026 00:38:40,000 --> 00:38:42,790 repeating themselves and you want to write clean code so you 2027 00:38:42,790 --> 00:38:42,800 and you want to write clean code so you 2028 00:38:42,800 --> 00:38:43,109 and you want to write clean code so you create 2029 00:38:43,109 --> 00:38:43,119 create 2030 00:38:43,119 --> 00:38:46,069 create variables and one of the best practices 2031 00:38:46,069 --> 00:38:46,079 variables and one of the best practices 2032 00:38:46,079 --> 00:38:46,550 variables and one of the best practices when 2033 00:38:46,550 --> 00:38:46,560 when 2034 00:38:46,560 --> 00:38:49,750 when creating and using variables is as we're 2035 00:38:49,750 --> 00:38:49,760 creating and using variables is as we're 2036 00:38:49,760 --> 00:38:52,870 creating and using variables is as we're using actually here is to name your 2037 00:38:52,870 --> 00:38:52,880 using actually here is to name your 2038 00:38:52,880 --> 00:38:54,069 using actually here is to name your variables 2039 00:38:54,069 --> 00:38:54,079 variables 2040 00:38:54,079 --> 00:38:56,710 variables so that you later and also other 2041 00:38:56,710 --> 00:38:56,720 so that you later and also other 2042 00:38:56,720 --> 00:38:58,550 so that you later and also other programmers who are working with you 2043 00:38:58,550 --> 00:38:58,560 programmers who are working with you 2044 00:38:58,560 --> 00:39:01,109 programmers who are working with you understand what this variable actually 2045 00:39:01,109 --> 00:39:01,119 understand what this variable actually 2046 00:39:01,119 --> 00:39:03,109 understand what this variable actually does or what type of value 2047 00:39:03,109 --> 00:39:03,119 does or what type of value 2048 00:39:03,119 --> 00:39:05,510 does or what type of value it actually has because if you just look 2049 00:39:05,510 --> 00:39:05,520 it actually has because if you just look 2050 00:39:05,520 --> 00:39:08,310 it actually has because if you just look at 24 you would probably not know 2051 00:39:08,310 --> 00:39:08,320 at 24 you would probably not know 2052 00:39:08,320 --> 00:39:10,790 at 24 you would probably not know what this 24 is about right but with 2053 00:39:10,790 --> 00:39:10,800 what this 24 is about right but with 2054 00:39:10,800 --> 00:39:11,589 what this 24 is about right but with variable 2055 00:39:11,589 --> 00:39:11,599 variable 2056 00:39:11,599 --> 00:39:13,349 variable you actually know that this actually 2057 00:39:13,349 --> 00:39:13,359 you actually know that this actually 2058 00:39:13,359 --> 00:39:15,990 you actually know that this actually represents a number that is used 2059 00:39:15,990 --> 00:39:16,000 represents a number that is used 2060 00:39:16,000 --> 00:39:19,030 represents a number that is used for calculating units right it could 2061 00:39:19,030 --> 00:39:19,040 for calculating units right it could 2062 00:39:19,040 --> 00:39:20,630 for calculating units right it could also be more descriptive 2063 00:39:20,630 --> 00:39:20,640 also be more descriptive 2064 00:39:20,640 --> 00:39:23,990 also be more descriptive like units for days but generally 2065 00:39:23,990 --> 00:39:24,000 like units for days but generally 2066 00:39:24,000 --> 00:39:27,030 like units for days but generally another advantage of variable is to 2067 00:39:27,030 --> 00:39:27,040 another advantage of variable is to 2068 00:39:27,040 --> 00:39:29,589 another advantage of variable is to basically describe that value 2069 00:39:29,589 --> 00:39:29,599 basically describe that value 2070 00:39:29,599 --> 00:39:35,109 basically describe that value as well that you're using in your code 2071 00:39:37,349 --> 00:39:37,359 now another thing you probably also 2072 00:39:37,359 --> 00:39:38,550 now another thing you probably also noticed is that 2073 00:39:38,550 --> 00:39:38,560 noticed is that 2074 00:39:38,560 --> 00:39:40,710 noticed is that even though we're using variables here 2075 00:39:40,710 --> 00:39:40,720 even though we're using variables here 2076 00:39:40,720 --> 00:39:42,150 even though we're using variables here so that we don't have to change 2077 00:39:42,150 --> 00:39:42,160 so that we don't have to change 2078 00:39:42,160 --> 00:39:45,109 so that we don't have to change those values in four different places a 2079 00:39:45,109 --> 00:39:45,119 those values in four different places a 2080 00:39:45,119 --> 00:39:45,750 those values in four different places a lot of 2081 00:39:45,750 --> 00:39:45,760 lot of 2082 00:39:45,760 --> 00:39:47,910 lot of these four lines are actually pretty 2083 00:39:47,910 --> 00:39:47,920 these four lines are actually pretty 2084 00:39:47,920 --> 00:39:50,069 these four lines are actually pretty similar the only difference 2085 00:39:50,069 --> 00:39:50,079 similar the only difference 2086 00:39:50,079 --> 00:39:52,550 similar the only difference in those four lines are actually these 2087 00:39:52,550 --> 00:39:52,560 in those four lines are actually these 2088 00:39:52,560 --> 00:39:53,430 in those four lines are actually these numbers 2089 00:39:53,430 --> 00:39:53,440 numbers 2090 00:39:53,440 --> 00:39:55,829 numbers right here everything else is exactly 2091 00:39:55,829 --> 00:39:55,839 right here everything else is exactly 2092 00:39:55,839 --> 00:39:56,470 right here everything else is exactly the same 2093 00:39:56,470 --> 00:39:56,480 the same 2094 00:39:56,480 --> 00:39:59,750 the same so what if instead we wanted to 2095 00:39:59,750 --> 00:39:59,760 so what if instead we wanted to 2096 00:39:59,760 --> 00:40:02,390 so what if instead we wanted to make this code cleaner and basically 2097 00:40:02,390 --> 00:40:02,400 make this code cleaner and basically 2098 00:40:02,400 --> 00:40:03,030 make this code cleaner and basically avoid 2099 00:40:03,030 --> 00:40:03,040 avoid 2100 00:40:03,040 --> 00:40:06,069 avoid this type of duplication in our code 2101 00:40:06,069 --> 00:40:06,079 this type of duplication in our code 2102 00:40:06,079 --> 00:40:08,309 this type of duplication in our code right so for example if we did this for 2103 00:40:08,309 --> 00:40:08,319 right so for example if we did this for 2104 00:40:08,319 --> 00:40:09,750 right so for example if we did this for 10 different values 2105 00:40:09,750 --> 00:40:09,760 10 different values 2106 00:40:09,760 --> 00:40:12,710 10 different values we would have the same line this long 2107 00:40:12,710 --> 00:40:12,720 we would have the same line this long 2108 00:40:12,720 --> 00:40:14,870 we would have the same line this long line basically 10 times right 2109 00:40:14,870 --> 00:40:14,880 line basically 10 times right 2110 00:40:14,880 --> 00:40:16,790 line basically 10 times right so how do we avoid this type of 2111 00:40:16,790 --> 00:40:16,800 so how do we avoid this type of 2112 00:40:16,800 --> 00:40:17,910 so how do we avoid this type of duplication 2113 00:40:17,910 --> 00:40:17,920 duplication 2114 00:40:17,920 --> 00:40:19,589 duplication so right here we actually avoided 2115 00:40:19,589 --> 00:40:19,599 so right here we actually avoided 2116 00:40:19,599 --> 00:40:20,950 so right here we actually avoided duplication 2117 00:40:20,950 --> 00:40:20,960 duplication 2118 00:40:20,960 --> 00:40:23,750 duplication for specific values right piece of 2119 00:40:23,750 --> 00:40:23,760 for specific values right piece of 2120 00:40:23,760 --> 00:40:24,790 for specific values right piece of string here 2121 00:40:24,790 --> 00:40:24,800 string here 2122 00:40:24,800 --> 00:40:27,589 string here a whole calculation here but how do we 2123 00:40:27,589 --> 00:40:27,599 a whole calculation here but how do we 2124 00:40:27,599 --> 00:40:28,710 a whole calculation here but how do we actually 2125 00:40:28,710 --> 00:40:28,720 actually 2126 00:40:28,720 --> 00:40:31,990 actually avoid duplicating a whole line right the 2127 00:40:31,990 --> 00:40:32,000 avoid duplicating a whole line right the 2128 00:40:32,000 --> 00:40:32,390 avoid duplicating a whole line right the whole 2129 00:40:32,390 --> 00:40:32,400 whole 2130 00:40:32,400 --> 00:40:34,790 whole piece of code basically which has 2131 00:40:34,790 --> 00:40:34,800 piece of code basically which has 2132 00:40:34,800 --> 00:40:36,550 piece of code basically which has multiple different stuff in it 2133 00:40:36,550 --> 00:40:36,560 multiple different stuff in it 2134 00:40:36,560 --> 00:40:39,829 multiple different stuff in it not just a value and we do that using 2135 00:40:39,829 --> 00:40:39,839 not just a value and we do that using 2136 00:40:39,839 --> 00:40:42,390 not just a value and we do that using functions so functions are basically 2137 00:40:42,390 --> 00:40:42,400 functions so functions are basically 2138 00:40:42,400 --> 00:40:43,990 functions so functions are basically blocks of code 2139 00:40:43,990 --> 00:40:44,000 blocks of code 2140 00:40:44,000 --> 00:40:47,109 blocks of code like this right or basically logic in 2141 00:40:47,109 --> 00:40:47,119 like this right or basically logic in 2142 00:40:47,119 --> 00:40:47,910 like this right or basically logic in code 2143 00:40:47,910 --> 00:40:47,920 code 2144 00:40:47,920 --> 00:40:49,829 code that does something it's not just simply 2145 00:40:49,829 --> 00:40:49,839 that does something it's not just simply 2146 00:40:49,839 --> 00:40:52,150 that does something it's not just simply a value but actually does something more 2147 00:40:52,150 --> 00:40:52,160 a value but actually does something more 2148 00:40:52,160 --> 00:40:53,030 a value but actually does something more complex 2149 00:40:53,030 --> 00:40:53,040 complex 2150 00:40:53,040 --> 00:40:56,550 complex that is again used in order to avoid 2151 00:40:56,550 --> 00:40:56,560 that is again used in order to avoid 2152 00:40:56,560 --> 00:40:59,670 that is again used in order to avoid repeating the same logic or most of the 2153 00:40:59,670 --> 00:40:59,680 repeating the same logic or most of the 2154 00:40:59,680 --> 00:41:00,870 repeating the same logic or most of the same logic 2155 00:41:00,870 --> 00:41:00,880 same logic 2156 00:41:00,880 --> 00:41:04,069 same logic in your code so how do we create 2157 00:41:04,069 --> 00:41:04,079 in your code so how do we create 2158 00:41:04,079 --> 00:41:06,870 in your code so how do we create functions just like we created variables 2159 00:41:06,870 --> 00:41:06,880 functions just like we created variables 2160 00:41:06,880 --> 00:41:07,430 functions just like we created variables here 2161 00:41:07,430 --> 00:41:07,440 here 2162 00:41:07,440 --> 00:41:10,069 here we create functions and the way we do 2163 00:41:10,069 --> 00:41:10,079 we create functions and the way we do 2164 00:41:10,079 --> 00:41:10,470 we create functions and the way we do that 2165 00:41:10,470 --> 00:41:10,480 that 2166 00:41:10,480 --> 00:41:15,109 that is using following syntax 2167 00:41:15,109 --> 00:41:15,119 is using following syntax 2168 00:41:15,119 --> 00:41:17,430 is using following syntax right here let's create our first 2169 00:41:17,430 --> 00:41:17,440 right here let's create our first 2170 00:41:17,440 --> 00:41:19,270 right here let's create our first function 2171 00:41:19,270 --> 00:41:19,280 function 2172 00:41:19,280 --> 00:41:22,550 function we start with def so we define 2173 00:41:22,550 --> 00:41:22,560 we start with def so we define 2174 00:41:22,560 --> 00:41:25,270 we start with def so we define a function just like we define a 2175 00:41:25,270 --> 00:41:25,280 a function just like we define a 2176 00:41:25,280 --> 00:41:25,910 a function just like we define a variable 2177 00:41:25,910 --> 00:41:25,920 variable 2178 00:41:25,920 --> 00:41:28,069 variable but for function we need this keyword 2179 00:41:28,069 --> 00:41:28,079 but for function we need this keyword 2180 00:41:28,079 --> 00:41:29,430 but for function we need this keyword basically called def 2181 00:41:29,430 --> 00:41:29,440 basically called def 2182 00:41:29,440 --> 00:41:32,710 basically called def and now we can give our function a name 2183 00:41:32,710 --> 00:41:32,720 and now we can give our function a name 2184 00:41:32,720 --> 00:41:34,710 and now we can give our function a name just like we gave name to our variable 2185 00:41:34,710 --> 00:41:34,720 just like we gave name to our variable 2186 00:41:34,720 --> 00:41:36,630 just like we gave name to our variable we can give our function a name 2187 00:41:36,630 --> 00:41:36,640 we can give our function a name 2188 00:41:36,640 --> 00:41:39,589 we can give our function a name and here we can use the same standards 2189 00:41:39,589 --> 00:41:39,599 and here we can use the same standards 2190 00:41:39,599 --> 00:41:40,710 and here we can use the same standards like for variable 2191 00:41:40,710 --> 00:41:40,720 like for variable 2192 00:41:40,720 --> 00:41:42,309 like for variable we can name the function something 2193 00:41:42,309 --> 00:41:42,319 we can name the function something 2194 00:41:42,319 --> 00:41:44,230 we can name the function something descriptive something that actually says 2195 00:41:44,230 --> 00:41:44,240 descriptive something that actually says 2196 00:41:44,240 --> 00:41:46,790 descriptive something that actually says what this function does and let's call 2197 00:41:46,790 --> 00:41:46,800 what this function does and let's call 2198 00:41:46,800 --> 00:41:48,550 what this function does and let's call our function days 2199 00:41:48,550 --> 00:41:48,560 our function days 2200 00:41:48,560 --> 00:41:52,710 our function days to units and then we have the brackets 2201 00:41:52,710 --> 00:41:52,720 to units and then we have the brackets 2202 00:41:52,720 --> 00:41:55,910 to units and then we have the brackets and a column so this line basically 2203 00:41:55,910 --> 00:41:55,920 and a column so this line basically 2204 00:41:55,920 --> 00:41:58,870 and a column so this line basically defines a function it tells python hey 2205 00:41:58,870 --> 00:41:58,880 defines a function it tells python hey 2206 00:41:58,880 --> 00:41:59,510 defines a function it tells python hey whatever 2207 00:41:59,510 --> 00:41:59,520 whatever 2208 00:41:59,520 --> 00:42:03,510 whatever comes after this is actually going to be 2209 00:42:03,510 --> 00:42:03,520 comes after this is actually going to be 2210 00:42:03,520 --> 00:42:06,150 comes after this is actually going to be a block of code that is going to be 2211 00:42:06,150 --> 00:42:06,160 a block of code that is going to be 2212 00:42:06,160 --> 00:42:06,870 a block of code that is going to be referred 2213 00:42:06,870 --> 00:42:06,880 referred 2214 00:42:06,880 --> 00:42:10,230 referred to or is going to be named these two 2215 00:42:10,230 --> 00:42:10,240 to or is going to be named these two 2216 00:42:10,240 --> 00:42:13,589 to or is going to be named these two units and how do you write a function 2217 00:42:13,589 --> 00:42:13,599 units and how do you write a function 2218 00:42:13,599 --> 00:42:15,270 units and how do you write a function i'm just going to copy this one actually 2219 00:42:15,270 --> 00:42:15,280 i'm just going to copy this one actually 2220 00:42:15,280 --> 00:42:18,230 i'm just going to copy this one actually here and let's give us some space 2221 00:42:18,230 --> 00:42:18,240 here and let's give us some space 2222 00:42:18,240 --> 00:42:20,470 here and let's give us some space and again this is very specific to 2223 00:42:20,470 --> 00:42:20,480 and again this is very specific to 2224 00:42:20,480 --> 00:42:21,510 and again this is very specific to python 2225 00:42:21,510 --> 00:42:21,520 python 2226 00:42:21,520 --> 00:42:25,750 python we need to indent here with spaces 2227 00:42:25,750 --> 00:42:25,760 we need to indent here with spaces 2228 00:42:25,760 --> 00:42:29,030 we need to indent here with spaces and i'm going to paste in what i copied 2229 00:42:29,030 --> 00:42:29,040 and i'm going to paste in what i copied 2230 00:42:29,040 --> 00:42:31,670 and i'm going to paste in what i copied inside these two lines basically tell 2231 00:42:31,670 --> 00:42:31,680 inside these two lines basically tell 2232 00:42:31,680 --> 00:42:33,109 inside these two lines basically tell python 2233 00:42:33,109 --> 00:42:33,119 python 2234 00:42:33,119 --> 00:42:36,470 python this piece of code or this line of code 2235 00:42:36,470 --> 00:42:36,480 this piece of code or this line of code 2236 00:42:36,480 --> 00:42:38,630 this piece of code or this line of code because we just have one line here 2237 00:42:38,630 --> 00:42:38,640 because we just have one line here 2238 00:42:38,640 --> 00:42:42,150 because we just have one line here belongs to a function called these two 2239 00:42:42,150 --> 00:42:42,160 belongs to a function called these two 2240 00:42:42,160 --> 00:42:42,870 belongs to a function called these two units 2241 00:42:42,870 --> 00:42:42,880 units 2242 00:42:42,880 --> 00:42:45,030 units and again we just have one line but this 2243 00:42:45,030 --> 00:42:45,040 and again we just have one line but this 2244 00:42:45,040 --> 00:42:47,510 and again we just have one line but this could be function with hundreds of lines 2245 00:42:47,510 --> 00:42:47,520 could be function with hundreds of lines 2246 00:42:47,520 --> 00:42:47,990 could be function with hundreds of lines right 2247 00:42:47,990 --> 00:42:48,000 right 2248 00:42:48,000 --> 00:42:50,630 right so i can write whatever i want the next 2249 00:42:50,630 --> 00:42:50,640 so i can write whatever i want the next 2250 00:42:50,640 --> 00:42:52,150 so i can write whatever i want the next line 2251 00:42:52,150 --> 00:42:52,160 line 2252 00:42:52,160 --> 00:42:55,829 line all good and then i can do some 2253 00:42:55,829 --> 00:42:55,839 all good and then i can do some 2254 00:42:55,839 --> 00:42:58,710 all good and then i can do some calculations and i can basically write 2255 00:42:58,710 --> 00:42:58,720 calculations and i can basically write 2256 00:42:58,720 --> 00:43:00,470 calculations and i can basically write whatever logic i want 2257 00:43:00,470 --> 00:43:00,480 whatever logic i want 2258 00:43:00,480 --> 00:43:03,670 whatever logic i want here and all these will belong to 2259 00:43:03,670 --> 00:43:03,680 here and all these will belong to 2260 00:43:03,680 --> 00:43:07,109 here and all these will belong to this function so now this 2261 00:43:07,109 --> 00:43:07,119 this function so now this 2262 00:43:07,119 --> 00:43:10,150 this function so now this logic is inside a function that is 2263 00:43:10,150 --> 00:43:10,160 logic is inside a function that is 2264 00:43:10,160 --> 00:43:10,550 logic is inside a function that is called 2265 00:43:10,550 --> 00:43:10,560 called 2266 00:43:10,560 --> 00:43:13,510 called these two units and we can actually get 2267 00:43:13,510 --> 00:43:13,520 these two units and we can actually get 2268 00:43:13,520 --> 00:43:15,430 these two units and we can actually get rid of this 2269 00:43:15,430 --> 00:43:15,440 rid of this 2270 00:43:15,440 --> 00:43:18,790 rid of this and test our function and here if you 2271 00:43:18,790 --> 00:43:18,800 and test our function and here if you 2272 00:43:18,800 --> 00:43:19,670 and test our function and here if you noticed 2273 00:43:19,670 --> 00:43:19,680 noticed 2274 00:43:19,680 --> 00:43:21,510 noticed we have this yellow line under the 2275 00:43:21,510 --> 00:43:21,520 we have this yellow line under the 2276 00:43:21,520 --> 00:43:23,829 we have this yellow line under the function name that's actually a warning 2277 00:43:23,829 --> 00:43:23,839 function name that's actually a warning 2278 00:43:23,839 --> 00:43:25,430 function name that's actually a warning for our code style 2279 00:43:25,430 --> 00:43:25,440 for our code style 2280 00:43:25,440 --> 00:43:27,670 for our code style it says we need two blank lines before 2281 00:43:27,670 --> 00:43:27,680 it says we need two blank lines before 2282 00:43:27,680 --> 00:43:29,270 it says we need two blank lines before so pycharm has a 2283 00:43:29,270 --> 00:43:29,280 so pycharm has a 2284 00:43:29,280 --> 00:43:32,710 so pycharm has a built-in official style guide for python 2285 00:43:32,710 --> 00:43:32,720 built-in official style guide for python 2286 00:43:32,720 --> 00:43:35,109 built-in official style guide for python that tells you how to style your code or 2287 00:43:35,109 --> 00:43:35,119 that tells you how to style your code or 2288 00:43:35,119 --> 00:43:37,109 that tells you how to style your code or how to write your code correctly 2289 00:43:37,109 --> 00:43:37,119 how to write your code correctly 2290 00:43:37,119 --> 00:43:40,069 how to write your code correctly now why is code style important well 2291 00:43:40,069 --> 00:43:40,079 now why is code style important well 2292 00:43:40,079 --> 00:43:42,069 now why is code style important well just like you write code you need to 2293 00:43:42,069 --> 00:43:42,079 just like you write code you need to 2294 00:43:42,079 --> 00:43:44,230 just like you write code you need to read code from other developers or 2295 00:43:44,230 --> 00:43:44,240 read code from other developers or 2296 00:43:44,240 --> 00:43:46,550 read code from other developers or your own code to understand what the 2297 00:43:46,550 --> 00:43:46,560 your own code to understand what the 2298 00:43:46,560 --> 00:43:47,910 your own code to understand what the code is actually doing 2299 00:43:47,910 --> 00:43:47,920 code is actually doing 2300 00:43:47,920 --> 00:43:50,790 code is actually doing so it's important that code is easily 2301 00:43:50,790 --> 00:43:50,800 so it's important that code is easily 2302 00:43:50,800 --> 00:43:51,990 so it's important that code is easily readable 2303 00:43:51,990 --> 00:43:52,000 readable 2304 00:43:52,000 --> 00:43:54,390 readable and this is just another example of how 2305 00:43:54,390 --> 00:43:54,400 and this is just another example of how 2306 00:43:54,400 --> 00:43:56,550 and this is just another example of how an editor like pycharm 2307 00:43:56,550 --> 00:43:56,560 an editor like pycharm 2308 00:43:56,560 --> 00:44:00,230 an editor like pycharm helps you to write code so to fix the 2309 00:44:00,230 --> 00:44:00,240 helps you to write code so to fix the 2310 00:44:00,240 --> 00:44:00,950 helps you to write code so to fix the warning 2311 00:44:00,950 --> 00:44:00,960 warning 2312 00:44:00,960 --> 00:44:03,510 warning we're just going to add a new blank line 2313 00:44:03,510 --> 00:44:03,520 we're just going to add a new blank line 2314 00:44:03,520 --> 00:44:06,150 we're just going to add a new blank line before the function definition 2315 00:44:06,150 --> 00:44:06,160 before the function definition 2316 00:44:06,160 --> 00:44:09,430 before the function definition so now what happens if i execute this 2317 00:44:09,430 --> 00:44:09,440 so now what happens if i execute this 2318 00:44:09,440 --> 00:44:11,430 so now what happens if i execute this block of code i have the variables 2319 00:44:11,430 --> 00:44:11,440 block of code i have the variables 2320 00:44:11,440 --> 00:44:13,349 block of code i have the variables defined here that i'm using in the 2321 00:44:13,349 --> 00:44:13,359 defined here that i'm using in the 2322 00:44:13,359 --> 00:44:16,630 defined here that i'm using in the function and then we have these two 2323 00:44:16,630 --> 00:44:16,640 function and then we have these two 2324 00:44:16,640 --> 00:44:17,910 function and then we have these two print statements 2325 00:44:17,910 --> 00:44:17,920 print statements 2326 00:44:17,920 --> 00:44:20,550 print statements so what happens if i execute now and as 2327 00:44:20,550 --> 00:44:20,560 so what happens if i execute now and as 2328 00:44:20,560 --> 00:44:21,750 so what happens if i execute now and as you see in the 2329 00:44:21,750 --> 00:44:21,760 you see in the 2330 00:44:21,760 --> 00:44:24,470 you see in the output here there is no output right 2331 00:44:24,470 --> 00:44:24,480 output here there is no output right 2332 00:44:24,480 --> 00:44:25,030 output here there is no output right nothing 2333 00:44:25,030 --> 00:44:25,040 nothing 2334 00:44:25,040 --> 00:44:27,349 nothing actually got printed so what actually 2335 00:44:27,349 --> 00:44:27,359 actually got printed so what actually 2336 00:44:27,359 --> 00:44:29,270 actually got printed so what actually happened because we have 2337 00:44:29,270 --> 00:44:29,280 happened because we have 2338 00:44:29,280 --> 00:44:31,829 happened because we have those two print statements that we 2339 00:44:31,829 --> 00:44:31,839 those two print statements that we 2340 00:44:31,839 --> 00:44:33,430 those two print statements that we defined in the function 2341 00:44:33,430 --> 00:44:33,440 defined in the function 2342 00:44:33,440 --> 00:44:35,829 defined in the function but we don't see anything in the output 2343 00:44:35,829 --> 00:44:35,839 but we don't see anything in the output 2344 00:44:35,839 --> 00:44:37,910 but we don't see anything in the output and the way it works is whenever you 2345 00:44:37,910 --> 00:44:37,920 and the way it works is whenever you 2346 00:44:37,920 --> 00:44:40,150 and the way it works is whenever you create a function or define a function 2347 00:44:40,150 --> 00:44:40,160 create a function or define a function 2348 00:44:40,160 --> 00:44:41,109 create a function or define a function like this 2349 00:44:41,109 --> 00:44:41,119 like this 2350 00:44:41,119 --> 00:44:44,390 like this you actually have to use that function 2351 00:44:44,390 --> 00:44:44,400 you actually have to use that function 2352 00:44:44,400 --> 00:44:46,550 you actually have to use that function right again this is a similar concept to 2353 00:44:46,550 --> 00:44:46,560 right again this is a similar concept to 2354 00:44:46,560 --> 00:44:47,910 right again this is a similar concept to variables we have 2355 00:44:47,910 --> 00:44:47,920 variables we have 2356 00:44:47,920 --> 00:44:50,470 variables we have created variables here and we're using 2357 00:44:50,470 --> 00:44:50,480 created variables here and we're using 2358 00:44:50,480 --> 00:44:50,950 created variables here and we're using that 2359 00:44:50,950 --> 00:44:50,960 that 2360 00:44:50,960 --> 00:44:53,829 that variable in our code the same way we 2361 00:44:53,829 --> 00:44:53,839 variable in our code the same way we 2362 00:44:53,839 --> 00:44:55,349 variable in our code the same way we create a function and we 2363 00:44:55,349 --> 00:44:55,359 create a function and we 2364 00:44:55,359 --> 00:44:57,829 create a function and we need to use that function how do we use 2365 00:44:57,829 --> 00:44:57,839 need to use that function how do we use 2366 00:44:57,839 --> 00:44:58,790 need to use that function how do we use a function 2367 00:44:58,790 --> 00:44:58,800 a function 2368 00:44:58,800 --> 00:45:01,750 a function or in programming languages it's called 2369 00:45:01,750 --> 00:45:01,760 or in programming languages it's called 2370 00:45:01,760 --> 00:45:03,510 or in programming languages it's called calling a function or executing a 2371 00:45:03,510 --> 00:45:03,520 calling a function or executing a 2372 00:45:03,520 --> 00:45:04,309 calling a function or executing a function 2373 00:45:04,309 --> 00:45:04,319 function 2374 00:45:04,319 --> 00:45:07,349 function and we do that using the name of the 2375 00:45:07,349 --> 00:45:07,359 and we do that using the name of the 2376 00:45:07,359 --> 00:45:08,390 and we do that using the name of the function 2377 00:45:08,390 --> 00:45:08,400 function 2378 00:45:08,400 --> 00:45:11,270 function like this and as you see in the 2379 00:45:11,270 --> 00:45:11,280 like this and as you see in the 2380 00:45:11,280 --> 00:45:13,270 like this and as you see in the suggestion as well 2381 00:45:13,270 --> 00:45:13,280 suggestion as well 2382 00:45:13,280 --> 00:45:16,790 suggestion as well using brackets like this so 2383 00:45:16,790 --> 00:45:16,800 using brackets like this so 2384 00:45:16,800 --> 00:45:19,990 using brackets like this so this syntax here basically is 2385 00:45:19,990 --> 00:45:20,000 this syntax here basically is 2386 00:45:20,000 --> 00:45:22,390 this syntax here basically is what we call calling the function that 2387 00:45:22,390 --> 00:45:22,400 what we call calling the function that 2388 00:45:22,400 --> 00:45:24,550 what we call calling the function that we defined right here or using that 2389 00:45:24,550 --> 00:45:24,560 we defined right here or using that 2390 00:45:24,560 --> 00:45:25,349 we defined right here or using that function 2391 00:45:25,349 --> 00:45:25,359 function 2392 00:45:25,359 --> 00:45:28,230 function so now if we execute it there you go you 2393 00:45:28,230 --> 00:45:28,240 so now if we execute it there you go you 2394 00:45:28,240 --> 00:45:28,710 so now if we execute it there you go you see 2395 00:45:28,710 --> 00:45:28,720 see 2396 00:45:28,720 --> 00:45:32,069 see that those two lines got executed and we 2397 00:45:32,069 --> 00:45:32,079 that those two lines got executed and we 2398 00:45:32,079 --> 00:45:33,510 that those two lines got executed and we have the results here 2399 00:45:33,510 --> 00:45:33,520 have the results here 2400 00:45:33,520 --> 00:45:35,990 have the results here so we're creating variables and we're 2401 00:45:35,990 --> 00:45:36,000 so we're creating variables and we're 2402 00:45:36,000 --> 00:45:37,349 so we're creating variables and we're using that here 2403 00:45:37,349 --> 00:45:37,359 using that here 2404 00:45:37,359 --> 00:45:39,030 using that here we're creating a function and we're 2405 00:45:39,030 --> 00:45:39,040 we're creating a function and we're 2406 00:45:39,040 --> 00:45:41,270 we're creating a function and we're using that function here 2407 00:45:41,270 --> 00:45:41,280 using that function here 2408 00:45:41,280 --> 00:45:43,750 using that function here and note the difference between using a 2409 00:45:43,750 --> 00:45:43,760 and note the difference between using a 2410 00:45:43,760 --> 00:45:45,750 and note the difference between using a variable and using a function 2411 00:45:45,750 --> 00:45:45,760 variable and using a function 2412 00:45:45,760 --> 00:45:47,829 variable and using a function python knows this is a function because 2413 00:45:47,829 --> 00:45:47,839 python knows this is a function because 2414 00:45:47,839 --> 00:45:49,829 python knows this is a function because we are providing these 2415 00:45:49,829 --> 00:45:49,839 we are providing these 2416 00:45:49,839 --> 00:45:51,910 we are providing these brackets at the end right that tells us 2417 00:45:51,910 --> 00:45:51,920 brackets at the end right that tells us 2418 00:45:51,920 --> 00:45:53,829 brackets at the end right that tells us we're making a function 2419 00:45:53,829 --> 00:45:53,839 we're making a function 2420 00:45:53,839 --> 00:45:57,750 we're making a function call basically 2421 00:46:00,790 --> 00:46:00,800 but as you see now we have these 20 days 2422 00:46:00,800 --> 00:46:01,430 but as you see now we have these 20 days so this 2423 00:46:01,430 --> 00:46:01,440 so this 2424 00:46:01,440 --> 00:46:04,309 so this only works for 20 days right what about 2425 00:46:04,309 --> 00:46:04,319 only works for 20 days right what about 2426 00:46:04,319 --> 00:46:05,190 only works for 20 days right what about other 2427 00:46:05,190 --> 00:46:05,200 other 2428 00:46:05,200 --> 00:46:07,670 other values that we had what about 35 days 2429 00:46:07,670 --> 00:46:07,680 values that we had what about 35 days 2430 00:46:07,680 --> 00:46:08,470 values that we had what about 35 days and 100 2431 00:46:08,470 --> 00:46:08,480 and 100 2432 00:46:08,480 --> 00:46:11,589 and 100 days we haven't de-duplicated that right 2433 00:46:11,589 --> 00:46:11,599 days we haven't de-duplicated that right 2434 00:46:11,599 --> 00:46:12,550 days we haven't de-duplicated that right we have 2435 00:46:12,550 --> 00:46:12,560 we have 2436 00:46:12,560 --> 00:46:16,550 we have just one case here so how do we use 2437 00:46:16,550 --> 00:46:16,560 just one case here so how do we use 2438 00:46:16,560 --> 00:46:20,550 just one case here so how do we use functions so that everything else 2439 00:46:20,550 --> 00:46:20,560 functions so that everything else 2440 00:46:20,560 --> 00:46:23,670 functions so that everything else except for these two values right here 2441 00:46:23,670 --> 00:46:23,680 except for these two values right here 2442 00:46:23,680 --> 00:46:26,390 except for these two values right here actually stay the same and we do that in 2443 00:46:26,390 --> 00:46:26,400 actually stay the same and we do that in 2444 00:46:26,400 --> 00:46:27,430 actually stay the same and we do that in programming 2445 00:46:27,430 --> 00:46:27,440 programming 2446 00:46:27,440 --> 00:46:30,790 programming by giving our functions some kind of 2447 00:46:30,790 --> 00:46:30,800 by giving our functions some kind of 2448 00:46:30,800 --> 00:46:33,190 by giving our functions some kind of input value which are also called 2449 00:46:33,190 --> 00:46:33,200 input value which are also called 2450 00:46:33,200 --> 00:46:34,150 input value which are also called parameters 2451 00:46:34,150 --> 00:46:34,160 parameters 2452 00:46:34,160 --> 00:46:37,190 parameters so instead of having this 20 basically 2453 00:46:37,190 --> 00:46:37,200 so instead of having this 20 basically 2454 00:46:37,200 --> 00:46:40,230 so instead of having this 20 basically here hard coded as we said here 2455 00:46:40,230 --> 00:46:40,240 here hard coded as we said here 2456 00:46:40,240 --> 00:46:43,589 here hard coded as we said here and here we provide that value of 20 or 2457 00:46:43,589 --> 00:46:43,599 and here we provide that value of 20 or 2458 00:46:43,599 --> 00:46:45,990 and here we provide that value of 20 or 35 or whatever that value is 2459 00:46:45,990 --> 00:46:46,000 35 or whatever that value is 2460 00:46:46,000 --> 00:46:48,550 35 or whatever that value is basically whenever we use the function 2461 00:46:48,550 --> 00:46:48,560 basically whenever we use the function 2462 00:46:48,560 --> 00:46:49,349 basically whenever we use the function so we are 2463 00:46:49,349 --> 00:46:49,359 so we are 2464 00:46:49,359 --> 00:46:52,069 so we are telling python use these days to units 2465 00:46:52,069 --> 00:46:52,079 telling python use these days to units 2466 00:46:52,079 --> 00:46:53,030 telling python use these days to units function 2467 00:46:53,030 --> 00:46:53,040 function 2468 00:46:53,040 --> 00:46:56,230 function with a value of 20 or use that 2469 00:46:56,230 --> 00:46:56,240 with a value of 20 or use that 2470 00:46:56,240 --> 00:46:59,430 with a value of 20 or use that function with a value of 35 and way we 2471 00:46:59,430 --> 00:46:59,440 function with a value of 35 and way we 2472 00:46:59,440 --> 00:47:00,309 function with a value of 35 and way we define this 2473 00:47:00,309 --> 00:47:00,319 define this 2474 00:47:00,319 --> 00:47:03,430 define this input parameter in functions 2475 00:47:03,430 --> 00:47:03,440 input parameter in functions 2476 00:47:03,440 --> 00:47:07,190 input parameter in functions is very simply by defining this 2477 00:47:07,190 --> 00:47:07,200 is very simply by defining this 2478 00:47:07,200 --> 00:47:07,990 is very simply by defining this parameter 2479 00:47:07,990 --> 00:47:08,000 parameter 2480 00:47:08,000 --> 00:47:11,109 parameter between those brackets right so 2481 00:47:11,109 --> 00:47:11,119 between those brackets right so 2482 00:47:11,119 --> 00:47:13,589 between those brackets right so this is where the input we as 2483 00:47:13,589 --> 00:47:13,599 this is where the input we as 2484 00:47:13,599 --> 00:47:14,390 this is where the input we as programmers 2485 00:47:14,390 --> 00:47:14,400 programmers 2486 00:47:14,400 --> 00:47:17,109 programmers define the input parameters so right 2487 00:47:17,109 --> 00:47:17,119 define the input parameters so right 2488 00:47:17,119 --> 00:47:17,990 define the input parameters so right here 2489 00:47:17,990 --> 00:47:18,000 here 2490 00:47:18,000 --> 00:47:21,349 here how do we define that using our already 2491 00:47:21,349 --> 00:47:21,359 how do we define that using our already 2492 00:47:21,359 --> 00:47:22,470 how do we define that using our already familiar 2493 00:47:22,470 --> 00:47:22,480 familiar 2494 00:47:22,480 --> 00:47:25,190 familiar variables so basically right here i'm 2495 00:47:25,190 --> 00:47:25,200 variables so basically right here i'm 2496 00:47:25,200 --> 00:47:25,750 variables so basically right here i'm going to 2497 00:47:25,750 --> 00:47:25,760 going to 2498 00:47:25,760 --> 00:47:27,589 going to define a variable and i'm going to call 2499 00:47:27,589 --> 00:47:27,599 define a variable and i'm going to call 2500 00:47:27,599 --> 00:47:29,109 define a variable and i'm going to call it whatever i want 2501 00:47:29,109 --> 00:47:29,119 it whatever i want 2502 00:47:29,119 --> 00:47:31,990 it whatever i want i'm going to call it days or number of 2503 00:47:31,990 --> 00:47:32,000 i'm going to call it days or number of 2504 00:47:32,000 --> 00:47:36,069 i'm going to call it days or number of days 2505 00:47:37,990 --> 00:47:38,000 but i'm not assigning a value to that 2506 00:47:38,000 --> 00:47:39,349 but i'm not assigning a value to that variable right like 2507 00:47:39,349 --> 00:47:39,359 variable right like 2508 00:47:39,359 --> 00:47:41,510 variable right like i did here because i want it to be 2509 00:47:41,510 --> 00:47:41,520 i did here because i want it to be 2510 00:47:41,520 --> 00:47:42,390 i did here because i want it to be assigned 2511 00:47:42,390 --> 00:47:42,400 assigned 2512 00:47:42,400 --> 00:47:45,109 assigned whenever i use the function so this 2513 00:47:45,109 --> 00:47:45,119 whenever i use the function so this 2514 00:47:45,119 --> 00:47:46,150 whenever i use the function so this basically 2515 00:47:46,150 --> 00:47:46,160 basically 2516 00:47:46,160 --> 00:47:49,430 basically tells python that a function these two 2517 00:47:49,430 --> 00:47:49,440 tells python that a function these two 2518 00:47:49,440 --> 00:47:50,069 tells python that a function these two units 2519 00:47:50,069 --> 00:47:50,079 units 2520 00:47:50,079 --> 00:47:54,230 units can be used using one input parameter 2521 00:47:54,230 --> 00:47:54,240 can be used using one input parameter 2522 00:47:54,240 --> 00:47:56,710 can be used using one input parameter which is called num of dates right 2523 00:47:56,710 --> 00:47:56,720 which is called num of dates right 2524 00:47:56,720 --> 00:47:57,750 which is called num of dates right number of days 2525 00:47:57,750 --> 00:47:57,760 number of days 2526 00:47:57,760 --> 00:48:00,230 number of days so now the last part which is remaining 2527 00:48:00,230 --> 00:48:00,240 so now the last part which is remaining 2528 00:48:00,240 --> 00:48:01,190 so now the last part which is remaining is 2529 00:48:01,190 --> 00:48:01,200 is 2530 00:48:01,200 --> 00:48:04,230 is replacing these values using this 2531 00:48:04,230 --> 00:48:04,240 replacing these values using this 2532 00:48:04,240 --> 00:48:05,270 replacing these values using this variable right 2533 00:48:05,270 --> 00:48:05,280 variable right 2534 00:48:05,280 --> 00:48:08,470 variable right and just like we do it in these two 2535 00:48:08,470 --> 00:48:08,480 and just like we do it in these two 2536 00:48:08,480 --> 00:48:09,750 and just like we do it in these two places where we're 2537 00:48:09,750 --> 00:48:09,760 places where we're 2538 00:48:09,760 --> 00:48:12,150 places where we're also using variables defined here 2539 00:48:12,150 --> 00:48:12,160 also using variables defined here 2540 00:48:12,160 --> 00:48:13,910 also using variables defined here exactly the same way 2541 00:48:13,910 --> 00:48:13,920 exactly the same way 2542 00:48:13,920 --> 00:48:17,510 exactly the same way we're gonna remove this and 2543 00:48:17,510 --> 00:48:17,520 we're gonna remove this and 2544 00:48:17,520 --> 00:48:20,630 we're gonna remove this and define a block for non-textual value 2545 00:48:20,630 --> 00:48:20,640 define a block for non-textual value 2546 00:48:20,640 --> 00:48:23,750 define a block for non-textual value and we're gonna put our 2547 00:48:23,750 --> 00:48:23,760 and we're gonna put our 2548 00:48:23,760 --> 00:48:28,950 and we're gonna put our variable num updates here and 2549 00:48:32,390 --> 00:48:32,400 also here so you see now that our 2550 00:48:32,400 --> 00:48:33,109 also here so you see now that our function 2551 00:48:33,109 --> 00:48:33,119 function 2552 00:48:33,119 --> 00:48:35,910 function actually doesn't have any fixed numbers 2553 00:48:35,910 --> 00:48:35,920 actually doesn't have any fixed numbers 2554 00:48:35,920 --> 00:48:36,790 actually doesn't have any fixed numbers in it 2555 00:48:36,790 --> 00:48:36,800 in it 2556 00:48:36,800 --> 00:48:39,750 in it instead we're using variables we're 2557 00:48:39,750 --> 00:48:39,760 instead we're using variables we're 2558 00:48:39,760 --> 00:48:41,589 instead we're using variables we're using two variables that are defined 2559 00:48:41,589 --> 00:48:41,599 using two variables that are defined 2560 00:48:41,599 --> 00:48:45,109 using two variables that are defined outside that function and we're using 2561 00:48:45,109 --> 00:48:45,119 outside that function and we're using 2562 00:48:45,119 --> 00:48:47,829 outside that function and we're using one variable that is defined within that 2563 00:48:47,829 --> 00:48:47,839 one variable that is defined within that 2564 00:48:47,839 --> 00:48:48,710 one variable that is defined within that function right 2565 00:48:48,710 --> 00:48:48,720 function right 2566 00:48:48,720 --> 00:48:51,430 function right this variable actually belongs to that 2567 00:48:51,430 --> 00:48:51,440 this variable actually belongs to that 2568 00:48:51,440 --> 00:48:52,150 this variable actually belongs to that function 2569 00:48:52,150 --> 00:48:52,160 function 2570 00:48:52,160 --> 00:48:55,589 function and now as you see whenever we want to 2571 00:48:55,589 --> 00:48:55,599 and now as you see whenever we want to 2572 00:48:55,599 --> 00:48:55,990 and now as you see whenever we want to use 2573 00:48:55,990 --> 00:48:56,000 use 2574 00:48:56,000 --> 00:48:59,190 use that function we're telling python hey 2575 00:48:59,190 --> 00:48:59,200 that function we're telling python hey 2576 00:48:59,200 --> 00:49:01,750 that function we're telling python hey call this function called days to units 2577 00:49:01,750 --> 00:49:01,760 call this function called days to units 2578 00:49:01,760 --> 00:49:05,270 call this function called days to units with a parameter an input basically 2579 00:49:05,270 --> 00:49:05,280 with a parameter an input basically 2580 00:49:05,280 --> 00:49:08,309 with a parameter an input basically of 35. so now if we execute it 2581 00:49:08,309 --> 00:49:08,319 of 35. so now if we execute it 2582 00:49:08,319 --> 00:49:10,230 of 35. so now if we execute it by the way we can also do it here you 2583 00:49:10,230 --> 00:49:10,240 by the way we can also do it here you 2584 00:49:10,240 --> 00:49:11,910 by the way we can also do it here you see 35 days 2585 00:49:11,910 --> 00:49:11,920 see 35 days 2586 00:49:11,920 --> 00:49:14,630 see 35 days are and the calculation was done here 2587 00:49:14,630 --> 00:49:14,640 are and the calculation was done here 2588 00:49:14,640 --> 00:49:15,190 are and the calculation was done here and 2589 00:49:15,190 --> 00:49:15,200 and 2590 00:49:15,200 --> 00:49:18,309 and hours and now if we go back to 2591 00:49:18,309 --> 00:49:18,319 hours and now if we go back to 2592 00:49:18,319 --> 00:49:21,430 hours and now if we go back to our previous example where we wanted to 2593 00:49:21,430 --> 00:49:21,440 our previous example where we wanted to 2594 00:49:21,440 --> 00:49:22,710 our previous example where we wanted to calculate these for 2595 00:49:22,710 --> 00:49:22,720 calculate these for 2596 00:49:22,720 --> 00:49:24,630 calculate these for four different values right for 2597 00:49:24,630 --> 00:49:24,640 four different values right for 2598 00:49:24,640 --> 00:49:26,069 four different values right for different number of days 2599 00:49:26,069 --> 00:49:26,079 different number of days 2600 00:49:26,079 --> 00:49:29,190 different number of days we can actually do the same 2601 00:49:29,190 --> 00:49:29,200 we can actually do the same 2602 00:49:29,200 --> 00:49:32,630 we can actually do the same so we had 20 then we had 2603 00:49:32,630 --> 00:49:32,640 so we had 20 then we had 2604 00:49:32,640 --> 00:49:36,870 so we had 20 then we had 50 and we had 110 2605 00:49:36,870 --> 00:49:36,880 50 and we had 110 2606 00:49:36,880 --> 00:49:39,750 50 and we had 110 right so this basically gives us exactly 2607 00:49:39,750 --> 00:49:39,760 right so this basically gives us exactly 2608 00:49:39,760 --> 00:49:42,710 right so this basically gives us exactly the same logic that we had previously 2609 00:49:42,710 --> 00:49:42,720 the same logic that we had previously 2610 00:49:42,720 --> 00:49:45,829 the same logic that we had previously but with different syntax right so you 2611 00:49:45,829 --> 00:49:45,839 but with different syntax right so you 2612 00:49:45,839 --> 00:49:47,270 but with different syntax right so you see the difference 2613 00:49:47,270 --> 00:49:47,280 see the difference 2614 00:49:47,280 --> 00:49:50,549 see the difference that instead of having this basically 2615 00:49:50,549 --> 00:49:50,559 that instead of having this basically 2616 00:49:50,559 --> 00:49:51,589 that instead of having this basically four times 2617 00:49:51,589 --> 00:49:51,599 four times 2618 00:49:51,599 --> 00:49:54,870 four times we have much cleaner syntax where we 2619 00:49:54,870 --> 00:49:54,880 we have much cleaner syntax where we 2620 00:49:54,880 --> 00:49:57,990 we have much cleaner syntax where we actually see what this logic is doing 2621 00:49:57,990 --> 00:49:58,000 actually see what this logic is doing 2622 00:49:58,000 --> 00:50:01,109 actually see what this logic is doing which is days to units and then 2623 00:50:01,109 --> 00:50:01,119 which is days to units and then 2624 00:50:01,119 --> 00:50:03,670 which is days to units and then we have the number of days that we pass 2625 00:50:03,670 --> 00:50:03,680 we have the number of days that we pass 2626 00:50:03,680 --> 00:50:04,150 we have the number of days that we pass or 2627 00:50:04,150 --> 00:50:04,160 or 2628 00:50:04,160 --> 00:50:07,670 or give our function as parameter and if i 2629 00:50:07,670 --> 00:50:07,680 give our function as parameter and if i 2630 00:50:07,680 --> 00:50:10,710 give our function as parameter and if i execute this you see that 2631 00:50:10,710 --> 00:50:10,720 execute this you see that 2632 00:50:10,720 --> 00:50:12,870 execute this you see that it was printed four times for all 2633 00:50:12,870 --> 00:50:12,880 it was printed four times for all 2634 00:50:12,880 --> 00:50:14,069 it was printed four times for all different values 2635 00:50:14,069 --> 00:50:14,079 different values 2636 00:50:14,079 --> 00:50:17,190 different values we can actually remove this line 2637 00:50:17,190 --> 00:50:17,200 we can actually remove this line 2638 00:50:17,200 --> 00:50:20,870 we can actually remove this line and now if we make some change in 2639 00:50:20,870 --> 00:50:20,880 and now if we make some change in 2640 00:50:20,880 --> 00:50:23,670 and now if we make some change in our function for example we change the 2641 00:50:23,670 --> 00:50:23,680 our function for example we change the 2642 00:50:23,680 --> 00:50:25,030 our function for example we change the name of this 2643 00:50:25,030 --> 00:50:25,040 name of this 2644 00:50:25,040 --> 00:50:27,829 name of this variable we want it to be hours instead 2645 00:50:27,829 --> 00:50:27,839 variable we want it to be hours instead 2646 00:50:27,839 --> 00:50:29,270 variable we want it to be hours instead of units 2647 00:50:29,270 --> 00:50:29,280 of units 2648 00:50:29,280 --> 00:50:32,549 of units we just do it once in one place 2649 00:50:32,549 --> 00:50:32,559 we just do it once in one place 2650 00:50:32,559 --> 00:50:35,030 we just do it once in one place and that's basically it so whatever 2651 00:50:35,030 --> 00:50:35,040 and that's basically it so whatever 2652 00:50:35,040 --> 00:50:36,069 and that's basically it so whatever changes we make 2653 00:50:36,069 --> 00:50:36,079 changes we make 2654 00:50:36,079 --> 00:50:38,230 changes we make inside that function and that is 2655 00:50:38,230 --> 00:50:38,240 inside that function and that is 2656 00:50:38,240 --> 00:50:39,190 inside that function and that is actually 2657 00:50:39,190 --> 00:50:39,200 actually 2658 00:50:39,200 --> 00:50:41,829 actually the big advantage of using functions in 2659 00:50:41,829 --> 00:50:41,839 the big advantage of using functions in 2660 00:50:41,839 --> 00:50:42,549 the big advantage of using functions in code 2661 00:50:42,549 --> 00:50:42,559 code 2662 00:50:42,559 --> 00:50:45,910 code whatever change we make inside here 2663 00:50:45,910 --> 00:50:45,920 whatever change we make inside here 2664 00:50:45,920 --> 00:50:48,470 whatever change we make inside here it doesn't affect how we use the 2665 00:50:48,470 --> 00:50:48,480 it doesn't affect how we use the 2666 00:50:48,480 --> 00:50:49,829 it doesn't affect how we use the function because 2667 00:50:49,829 --> 00:50:49,839 function because 2668 00:50:49,839 --> 00:50:52,309 function because for using the function we only need the 2669 00:50:52,309 --> 00:50:52,319 for using the function we only need the 2670 00:50:52,319 --> 00:50:53,670 for using the function we only need the name of that function 2671 00:50:53,670 --> 00:50:53,680 name of that function 2672 00:50:53,680 --> 00:50:56,069 name of that function and the input parameter now probably 2673 00:50:56,069 --> 00:50:56,079 and the input parameter now probably 2674 00:50:56,079 --> 00:50:57,430 and the input parameter now probably you're wondering 2675 00:50:57,430 --> 00:50:57,440 you're wondering 2676 00:50:57,440 --> 00:51:00,069 you're wondering what happens if i do not give my 2677 00:51:00,069 --> 00:51:00,079 what happens if i do not give my 2678 00:51:00,079 --> 00:51:02,069 what happens if i do not give my function a value 2679 00:51:02,069 --> 00:51:02,079 function a value 2680 00:51:02,079 --> 00:51:04,549 function a value let's delete those lines and let's say 2681 00:51:04,549 --> 00:51:04,559 let's delete those lines and let's say 2682 00:51:04,559 --> 00:51:07,510 let's delete those lines and let's say we do not provide any value here 2683 00:51:07,510 --> 00:51:07,520 we do not provide any value here 2684 00:51:07,520 --> 00:51:10,950 we do not provide any value here and we try to execute or 2685 00:51:10,950 --> 00:51:10,960 and we try to execute or 2686 00:51:10,960 --> 00:51:13,510 and we try to execute or call our function without the parameter 2687 00:51:13,510 --> 00:51:13,520 call our function without the parameter 2688 00:51:13,520 --> 00:51:15,270 call our function without the parameter and let's execute 2689 00:51:15,270 --> 00:51:15,280 and let's execute 2690 00:51:15,280 --> 00:51:18,470 and let's execute and you see that python interpreter is 2691 00:51:18,470 --> 00:51:18,480 and you see that python interpreter is 2692 00:51:18,480 --> 00:51:22,549 and you see that python interpreter is complaining because we have told python 2693 00:51:22,549 --> 00:51:22,559 complaining because we have told python 2694 00:51:22,559 --> 00:51:25,030 complaining because we have told python here is a function called these two 2695 00:51:25,030 --> 00:51:25,040 here is a function called these two 2696 00:51:25,040 --> 00:51:25,750 here is a function called these two units 2697 00:51:25,750 --> 00:51:25,760 units 2698 00:51:25,760 --> 00:51:28,630 units and whenever i want to use that or my 2699 00:51:28,630 --> 00:51:28,640 and whenever i want to use that or my 2700 00:51:28,640 --> 00:51:30,309 and whenever i want to use that or my colleague another programmer wants to 2701 00:51:30,309 --> 00:51:30,319 colleague another programmer wants to 2702 00:51:30,319 --> 00:51:31,510 colleague another programmer wants to use that function 2703 00:51:31,510 --> 00:51:31,520 use that function 2704 00:51:31,520 --> 00:51:34,950 use that function they have to provide an input value here 2705 00:51:34,950 --> 00:51:34,960 they have to provide an input value here 2706 00:51:34,960 --> 00:51:37,990 they have to provide an input value here right so now whenever python sees 2707 00:51:37,990 --> 00:51:38,000 right so now whenever python sees 2708 00:51:38,000 --> 00:51:40,150 right so now whenever python sees the usage of that function and there is 2709 00:51:40,150 --> 00:51:40,160 the usage of that function and there is 2710 00:51:40,160 --> 00:51:41,190 the usage of that function and there is no input 2711 00:51:41,190 --> 00:51:41,200 no input 2712 00:51:41,200 --> 00:51:42,950 no input parameter that we are giving that 2713 00:51:42,950 --> 00:51:42,960 parameter that we are giving that 2714 00:51:42,960 --> 00:51:44,549 parameter that we are giving that function it cannot 2715 00:51:44,549 --> 00:51:44,559 function it cannot 2716 00:51:44,559 --> 00:51:47,109 function it cannot execute that function right because 2717 00:51:47,109 --> 00:51:47,119 execute that function right because 2718 00:51:47,119 --> 00:51:48,309 execute that function right because basically this 2719 00:51:48,309 --> 00:51:48,319 basically this 2720 00:51:48,319 --> 00:51:50,630 basically this value is missing here right and that's 2721 00:51:50,630 --> 00:51:50,640 value is missing here right and that's 2722 00:51:50,640 --> 00:51:51,670 value is missing here right and that's why we get 2723 00:51:51,670 --> 00:51:51,680 why we get 2724 00:51:51,680 --> 00:51:54,230 why we get an error which also says missing one 2725 00:51:54,230 --> 00:51:54,240 an error which also says missing one 2726 00:51:54,240 --> 00:51:55,270 an error which also says missing one required 2727 00:51:55,270 --> 00:51:55,280 required 2728 00:51:55,280 --> 00:51:58,150 required argument so as you see whenever we 2729 00:51:58,150 --> 00:51:58,160 argument so as you see whenever we 2730 00:51:58,160 --> 00:52:00,309 argument so as you see whenever we define a function with a parameter 2731 00:52:00,309 --> 00:52:00,319 define a function with a parameter 2732 00:52:00,319 --> 00:52:03,109 define a function with a parameter with input parameter we have to also 2733 00:52:03,109 --> 00:52:03,119 with input parameter we have to also 2734 00:52:03,119 --> 00:52:04,950 with input parameter we have to also provide that input parameter 2735 00:52:04,950 --> 00:52:04,960 provide that input parameter 2736 00:52:04,960 --> 00:52:07,109 provide that input parameter another thing that you may be also 2737 00:52:07,109 --> 00:52:07,119 another thing that you may be also 2738 00:52:07,119 --> 00:52:08,470 another thing that you may be also wondering is 2739 00:52:08,470 --> 00:52:08,480 wondering is 2740 00:52:08,480 --> 00:52:11,670 wondering is what if i want to provide multiple input 2741 00:52:11,670 --> 00:52:11,680 what if i want to provide multiple input 2742 00:52:11,680 --> 00:52:13,109 what if i want to provide multiple input parameters to functions 2743 00:52:13,109 --> 00:52:13,119 parameters to functions 2744 00:52:13,119 --> 00:52:15,349 parameters to functions how do i do that it's actually very 2745 00:52:15,349 --> 00:52:15,359 how do i do that it's actually very 2746 00:52:15,359 --> 00:52:17,030 how do i do that it's actually very simple you can do that by 2747 00:52:17,030 --> 00:52:17,040 simple you can do that by 2748 00:52:17,040 --> 00:52:19,829 simple you can do that by simply defining here another input 2749 00:52:19,829 --> 00:52:19,839 simply defining here another input 2750 00:52:19,839 --> 00:52:20,790 simply defining here another input parameter 2751 00:52:20,790 --> 00:52:20,800 parameter 2752 00:52:20,800 --> 00:52:24,390 parameter separated by comma and let's say we want 2753 00:52:24,390 --> 00:52:24,400 separated by comma and let's say we want 2754 00:52:24,400 --> 00:52:25,109 separated by comma and let's say we want to pass 2755 00:52:25,109 --> 00:52:25,119 to pass 2756 00:52:25,119 --> 00:52:26,950 to pass here something that we want to print out 2757 00:52:26,950 --> 00:52:26,960 here something that we want to print out 2758 00:52:26,960 --> 00:52:29,589 here something that we want to print out additionally like a custom message 2759 00:52:29,589 --> 00:52:29,599 additionally like a custom message 2760 00:52:29,599 --> 00:52:33,510 additionally like a custom message doesn't really matter and the same way 2761 00:52:33,510 --> 00:52:33,520 doesn't really matter and the same way 2762 00:52:33,520 --> 00:52:35,589 doesn't really matter and the same way exactly the same way as the first one we 2763 00:52:35,589 --> 00:52:35,599 exactly the same way as the first one we 2764 00:52:35,599 --> 00:52:36,549 exactly the same way as the first one we can actually 2765 00:52:36,549 --> 00:52:36,559 can actually 2766 00:52:36,559 --> 00:52:39,349 can actually use it in here we can even create a new 2767 00:52:39,349 --> 00:52:39,359 use it in here we can even create a new 2768 00:52:39,359 --> 00:52:40,710 use it in here we can even create a new line 2769 00:52:40,710 --> 00:52:40,720 line 2770 00:52:40,720 --> 00:52:42,950 line and basically just print out that 2771 00:52:42,950 --> 00:52:42,960 and basically just print out that 2772 00:52:42,960 --> 00:52:44,309 and basically just print out that message right 2773 00:52:44,309 --> 00:52:44,319 message right 2774 00:52:44,319 --> 00:52:45,990 message right and note that if you are using a 2775 00:52:45,990 --> 00:52:46,000 and note that if you are using a 2776 00:52:46,000 --> 00:52:47,910 and note that if you are using a variable without 2777 00:52:47,910 --> 00:52:47,920 variable without 2778 00:52:47,920 --> 00:52:49,750 variable without stream so basically it's just the 2779 00:52:49,750 --> 00:52:49,760 stream so basically it's just the 2780 00:52:49,760 --> 00:52:52,309 stream so basically it's just the variable itself we're not using any text 2781 00:52:52,309 --> 00:52:52,319 variable itself we're not using any text 2782 00:52:52,319 --> 00:52:54,870 variable itself we're not using any text in that case you don't need this format 2783 00:52:54,870 --> 00:52:54,880 in that case you don't need this format 2784 00:52:54,880 --> 00:52:55,349 in that case you don't need this format right 2785 00:52:55,349 --> 00:52:55,359 right 2786 00:52:55,359 --> 00:52:57,430 right so you can basically just print it out 2787 00:52:57,430 --> 00:52:57,440 so you can basically just print it out 2788 00:52:57,440 --> 00:52:58,470 so you can basically just print it out directly 2789 00:52:58,470 --> 00:52:58,480 directly 2790 00:52:58,480 --> 00:53:02,069 directly and now again we have told python 2791 00:53:02,069 --> 00:53:02,079 and now again we have told python 2792 00:53:02,079 --> 00:53:05,510 and now again we have told python i have this function and two input 2793 00:53:05,510 --> 00:53:05,520 i have this function and two input 2794 00:53:05,520 --> 00:53:07,430 i have this function and two input parameters are required 2795 00:53:07,430 --> 00:53:07,440 parameters are required 2796 00:53:07,440 --> 00:53:10,549 parameters are required so i also need to pass to input 2797 00:53:10,549 --> 00:53:10,559 so i also need to pass to input 2798 00:53:10,559 --> 00:53:14,069 so i also need to pass to input values whenever i use that function so 2799 00:53:14,069 --> 00:53:14,079 values whenever i use that function so 2800 00:53:14,079 --> 00:53:17,190 values whenever i use that function so now let me just pass in some custom 2801 00:53:17,190 --> 00:53:17,200 now let me just pass in some custom 2802 00:53:17,200 --> 00:53:17,750 now let me just pass in some custom message 2803 00:53:17,750 --> 00:53:17,760 message 2804 00:53:17,760 --> 00:53:18,870 message let's say i'm happy about the 2805 00:53:18,870 --> 00:53:18,880 let's say i'm happy about the 2806 00:53:18,880 --> 00:53:20,870 let's say i'm happy about the calculation or i know i'm going to be 2807 00:53:20,870 --> 00:53:20,880 calculation or i know i'm going to be 2808 00:53:20,880 --> 00:53:21,670 calculation or i know i'm going to be happy so 2809 00:53:21,670 --> 00:53:21,680 happy so 2810 00:53:21,680 --> 00:53:26,069 happy so let's say awesome and 2811 00:53:26,069 --> 00:53:26,079 let's say awesome and 2812 00:53:26,079 --> 00:53:28,470 let's say awesome and let's do another calculation and this 2813 00:53:28,470 --> 00:53:28,480 let's do another calculation and this 2814 00:53:28,480 --> 00:53:29,109 let's do another calculation and this time 2815 00:53:29,109 --> 00:53:29,119 time 2816 00:53:29,119 --> 00:53:32,549 time i say looks good 2817 00:53:32,549 --> 00:53:32,559 i say looks good 2818 00:53:32,559 --> 00:53:35,990 i say looks good and if i execute it you see that i get 2819 00:53:35,990 --> 00:53:36,000 and if i execute it you see that i get 2820 00:53:36,000 --> 00:53:38,790 and if i execute it you see that i get awesome the first time and then for 35 i 2821 00:53:38,790 --> 00:53:38,800 awesome the first time and then for 35 i 2822 00:53:38,800 --> 00:53:39,349 awesome the first time and then for 35 i get 2823 00:53:39,349 --> 00:53:39,359 get 2824 00:53:39,359 --> 00:53:43,030 get looks good so you can basically define 2825 00:53:43,030 --> 00:53:43,040 looks good so you can basically define 2826 00:53:43,040 --> 00:53:44,150 looks good so you can basically define and provide as many 2827 00:53:44,150 --> 00:53:44,160 and provide as many 2828 00:53:44,160 --> 00:53:46,630 and provide as many input parameters as you want common 2829 00:53:46,630 --> 00:53:46,640 input parameters as you want common 2830 00:53:46,640 --> 00:53:47,430 input parameters as you want common practice 2831 00:53:47,430 --> 00:53:47,440 practice 2832 00:53:47,440 --> 00:53:49,829 practice and also what you will see in just 2833 00:53:49,829 --> 00:53:49,839 and also what you will see in just 2834 00:53:49,839 --> 00:53:51,589 and also what you will see in just normal code basically 2835 00:53:51,589 --> 00:53:51,599 normal code basically 2836 00:53:51,599 --> 00:53:54,390 normal code basically is just a handful of input parameters 2837 00:53:54,390 --> 00:53:54,400 is just a handful of input parameters 2838 00:53:54,400 --> 00:53:56,069 is just a handful of input parameters maybe one or two 2839 00:53:56,069 --> 00:53:56,079 maybe one or two 2840 00:53:56,079 --> 00:53:58,470 maybe one or two so it's not actually overloaded with 10 2841 00:53:58,470 --> 00:53:58,480 so it's not actually overloaded with 10 2842 00:53:58,480 --> 00:54:03,430 so it's not actually overloaded with 10 parameters 2843 00:54:06,390 --> 00:54:06,400 cool now that we know functions and 2844 00:54:06,400 --> 00:54:07,589 cool now that we know functions and variables 2845 00:54:07,589 --> 00:54:07,599 variables 2846 00:54:07,599 --> 00:54:10,069 variables why they're used or why are they useful 2847 00:54:10,069 --> 00:54:10,079 why they're used or why are they useful 2848 00:54:10,079 --> 00:54:11,910 why they're used or why are they useful and how we use them 2849 00:54:11,910 --> 00:54:11,920 and how we use them 2850 00:54:11,920 --> 00:54:14,069 and how we use them there is one point that i want to 2851 00:54:14,069 --> 00:54:14,079 there is one point that i want to 2852 00:54:14,079 --> 00:54:14,950 there is one point that i want to mention 2853 00:54:14,950 --> 00:54:14,960 mention 2854 00:54:14,960 --> 00:54:18,710 mention which is variable scopes in functions 2855 00:54:18,710 --> 00:54:18,720 which is variable scopes in functions 2856 00:54:18,720 --> 00:54:20,390 which is variable scopes in functions what does it mean as i mentioned 2857 00:54:20,390 --> 00:54:20,400 what does it mean as i mentioned 2858 00:54:20,400 --> 00:54:22,790 what does it mean as i mentioned previously in this function we're using 2859 00:54:22,790 --> 00:54:22,800 previously in this function we're using 2860 00:54:22,800 --> 00:54:25,190 previously in this function we're using multiple variables right we're using two 2861 00:54:25,190 --> 00:54:25,200 multiple variables right we're using two 2862 00:54:25,200 --> 00:54:25,910 multiple variables right we're using two variables 2863 00:54:25,910 --> 00:54:25,920 variables 2864 00:54:25,920 --> 00:54:29,030 variables that are part of the input right that 2865 00:54:29,030 --> 00:54:29,040 that are part of the input right that 2866 00:54:29,040 --> 00:54:31,270 that are part of the input right that we provide when using a function and 2867 00:54:31,270 --> 00:54:31,280 we provide when using a function and 2868 00:54:31,280 --> 00:54:33,430 we provide when using a function and we're using two variables that are 2869 00:54:33,430 --> 00:54:33,440 we're using two variables that are 2870 00:54:33,440 --> 00:54:35,589 we're using two variables that are defined outside the function right 2871 00:54:35,589 --> 00:54:35,599 defined outside the function right 2872 00:54:35,599 --> 00:54:37,270 defined outside the function right somewhere else in the code 2873 00:54:37,270 --> 00:54:37,280 somewhere else in the code 2874 00:54:37,280 --> 00:54:40,710 somewhere else in the code so variable scope basically means where 2875 00:54:40,710 --> 00:54:40,720 so variable scope basically means where 2876 00:54:40,720 --> 00:54:44,390 so variable scope basically means where is the variable that function uses 2877 00:54:44,390 --> 00:54:44,400 is the variable that function uses 2878 00:54:44,400 --> 00:54:47,349 is the variable that function uses defined and variable has a global scope 2879 00:54:47,349 --> 00:54:47,359 defined and variable has a global scope 2880 00:54:47,359 --> 00:54:48,470 defined and variable has a global scope for a function 2881 00:54:48,470 --> 00:54:48,480 for a function 2882 00:54:48,480 --> 00:54:51,430 for a function if it is defined outside the function 2883 00:54:51,430 --> 00:54:51,440 if it is defined outside the function 2884 00:54:51,440 --> 00:54:52,150 if it is defined outside the function like 2885 00:54:52,150 --> 00:54:52,160 like 2886 00:54:52,160 --> 00:54:54,870 like these two variables right here could be 2887 00:54:54,870 --> 00:54:54,880 these two variables right here could be 2888 00:54:54,880 --> 00:54:55,589 these two variables right here could be completely 2889 00:54:55,589 --> 00:54:55,599 completely 2890 00:54:55,599 --> 00:54:57,750 completely in a different file not even in the same 2891 00:54:57,750 --> 00:54:57,760 in a different file not even in the same 2892 00:54:57,760 --> 00:54:59,589 in a different file not even in the same file where the function is 2893 00:54:59,589 --> 00:54:59,599 file where the function is 2894 00:54:59,599 --> 00:55:02,789 file where the function is so these are global variables so all the 2895 00:55:02,789 --> 00:55:02,799 so these are global variables so all the 2896 00:55:02,799 --> 00:55:04,069 so these are global variables so all the functions that you have 2897 00:55:04,069 --> 00:55:04,079 functions that you have 2898 00:55:04,079 --> 00:55:06,390 functions that you have in your python code can use those global 2899 00:55:06,390 --> 00:55:06,400 in your python code can use those global 2900 00:55:06,400 --> 00:55:08,230 in your python code can use those global variables and then you have 2901 00:55:08,230 --> 00:55:08,240 variables and then you have 2902 00:55:08,240 --> 00:55:11,190 variables and then you have local variables local variables are 2903 00:55:11,190 --> 00:55:11,200 local variables local variables are 2904 00:55:11,200 --> 00:55:12,470 local variables local variables are variables that are 2905 00:55:12,470 --> 00:55:12,480 variables that are 2906 00:55:12,480 --> 00:55:15,910 variables that are created within that function right 2907 00:55:15,910 --> 00:55:15,920 created within that function right 2908 00:55:15,920 --> 00:55:18,789 created within that function right so these two variables are basically 2909 00:55:18,789 --> 00:55:18,799 so these two variables are basically 2910 00:55:18,799 --> 00:55:19,589 so these two variables are basically only 2911 00:55:19,589 --> 00:55:19,599 only 2912 00:55:19,599 --> 00:55:22,950 only available inside that function 2913 00:55:22,950 --> 00:55:22,960 available inside that function 2914 00:55:22,960 --> 00:55:25,589 available inside that function because it was created within that 2915 00:55:25,589 --> 00:55:25,599 because it was created within that 2916 00:55:25,599 --> 00:55:26,230 because it was created within that function 2917 00:55:26,230 --> 00:55:26,240 function 2918 00:55:26,240 --> 00:55:29,430 function so internal scope and global scope 2919 00:55:29,430 --> 00:55:29,440 so internal scope and global scope 2920 00:55:29,440 --> 00:55:31,270 so internal scope and global scope so that means that when we create 2921 00:55:31,270 --> 00:55:31,280 so that means that when we create 2922 00:55:31,280 --> 00:55:35,190 so that means that when we create another function 2923 00:55:35,190 --> 00:55:35,200 another function 2924 00:55:35,200 --> 00:55:36,789 another function let's call it scope check because that's 2925 00:55:36,789 --> 00:55:36,799 let's call it scope check because that's 2926 00:55:36,799 --> 00:55:38,230 let's call it scope check because that's what we're going to do 2927 00:55:38,230 --> 00:55:38,240 what we're going to do 2928 00:55:38,240 --> 00:55:43,270 what we're going to do we want to test the scope 2929 00:55:47,349 --> 00:55:47,359 in this function i can access 2930 00:55:47,359 --> 00:55:50,549 in this function i can access the global variables like 2931 00:55:50,549 --> 00:55:50,559 the global variables like 2932 00:55:50,559 --> 00:55:53,829 the global variables like name of units 2933 00:55:53,829 --> 00:55:53,839 name of units 2934 00:55:53,839 --> 00:55:56,870 name of units but i cannot access the internal 2935 00:55:56,870 --> 00:55:56,880 but i cannot access the internal 2936 00:55:56,880 --> 00:55:57,670 but i cannot access the internal variables 2937 00:55:57,670 --> 00:55:57,680 variables 2938 00:55:57,680 --> 00:56:01,109 variables like number of days and let's actually 2939 00:56:01,109 --> 00:56:01,119 like number of days and let's actually 2940 00:56:01,119 --> 00:56:05,030 like number of days and let's actually test that 2941 00:56:08,069 --> 00:56:08,079 so i have num of units which is a global 2942 00:56:08,079 --> 00:56:09,510 so i have num of units which is a global variable defined here 2943 00:56:09,510 --> 00:56:09,520 variable defined here 2944 00:56:09,520 --> 00:56:12,309 variable defined here outside the function and the second one 2945 00:56:12,309 --> 00:56:12,319 outside the function and the second one 2946 00:56:12,319 --> 00:56:13,910 outside the function and the second one i have a variable that is defined 2947 00:56:13,910 --> 00:56:13,920 i have a variable that is defined 2948 00:56:13,920 --> 00:56:17,030 i have a variable that is defined inside another function right 2949 00:56:17,030 --> 00:56:17,040 inside another function right 2950 00:56:17,040 --> 00:56:19,910 inside another function right so as i said internal and as you see 2951 00:56:19,910 --> 00:56:19,920 so as i said internal and as you see 2952 00:56:19,920 --> 00:56:20,789 so as i said internal and as you see right here 2953 00:56:20,789 --> 00:56:20,799 right here 2954 00:56:20,799 --> 00:56:23,349 right here we already get a red line underneath 2955 00:56:23,349 --> 00:56:23,359 we already get a red line underneath 2956 00:56:23,359 --> 00:56:24,069 we already get a red line underneath that says 2957 00:56:24,069 --> 00:56:24,079 that says 2958 00:56:24,079 --> 00:56:27,589 that says unresolved reference num of days 2959 00:56:27,589 --> 00:56:27,599 unresolved reference num of days 2960 00:56:27,599 --> 00:56:30,710 unresolved reference num of days so for this function basically that 2961 00:56:30,710 --> 00:56:30,720 so for this function basically that 2962 00:56:30,720 --> 00:56:31,270 so for this function basically that variable 2963 00:56:31,270 --> 00:56:31,280 variable 2964 00:56:31,280 --> 00:56:33,589 variable is not visible it's not accessible it 2965 00:56:33,589 --> 00:56:33,599 is not visible it's not accessible it 2966 00:56:33,599 --> 00:56:35,910 is not visible it's not accessible it doesn't exist basically at all 2967 00:56:35,910 --> 00:56:35,920 doesn't exist basically at all 2968 00:56:35,920 --> 00:56:40,069 doesn't exist basically at all and we can even test it out actually 2969 00:56:40,069 --> 00:56:40,079 and we can even test it out actually 2970 00:56:40,079 --> 00:56:42,630 and we can even test it out actually so again if we want to see the results 2971 00:56:42,630 --> 00:56:42,640 so again if we want to see the results 2972 00:56:42,640 --> 00:56:43,990 so again if we want to see the results we have to actually use that 2973 00:56:43,990 --> 00:56:44,000 we have to actually use that 2974 00:56:44,000 --> 00:56:47,109 we have to actually use that function like this run the function and 2975 00:56:47,109 --> 00:56:47,119 function like this run the function and 2976 00:56:47,119 --> 00:56:48,390 function like this run the function and if i execute it 2977 00:56:48,390 --> 00:56:48,400 if i execute it 2978 00:56:48,400 --> 00:56:52,069 if i execute it you see that we get an error that says 2979 00:56:52,069 --> 00:56:52,079 you see that we get an error that says 2980 00:56:52,079 --> 00:56:55,030 you see that we get an error that says name num of days is not defined right it 2981 00:56:55,030 --> 00:56:55,040 name num of days is not defined right it 2982 00:56:55,040 --> 00:56:56,549 name num of days is not defined right it doesn't know that there is a function 2983 00:56:56,549 --> 00:56:56,559 doesn't know that there is a function 2984 00:56:56,559 --> 00:56:57,109 doesn't know that there is a function like that 2985 00:56:57,109 --> 00:56:57,119 like that 2986 00:56:57,119 --> 00:57:00,069 like that anywhere in code however it does 2987 00:57:00,069 --> 00:57:00,079 anywhere in code however it does 2988 00:57:00,079 --> 00:57:01,270 anywhere in code however it does recognize 2989 00:57:01,270 --> 00:57:01,280 recognize 2990 00:57:01,280 --> 00:57:04,870 recognize the global variable and that means that 2991 00:57:04,870 --> 00:57:04,880 the global variable and that means that 2992 00:57:04,880 --> 00:57:06,950 the global variable and that means that variables defined outside function 2993 00:57:06,950 --> 00:57:06,960 variables defined outside function 2994 00:57:06,960 --> 00:57:09,270 variables defined outside function itself global variables are accessible 2995 00:57:09,270 --> 00:57:09,280 itself global variables are accessible 2996 00:57:09,280 --> 00:57:10,789 itself global variables are accessible to all the functions 2997 00:57:10,789 --> 00:57:10,799 to all the functions 2998 00:57:10,799 --> 00:57:14,150 to all the functions and if you have variables defined inside 2999 00:57:14,150 --> 00:57:14,160 and if you have variables defined inside 3000 00:57:14,160 --> 00:57:15,990 and if you have variables defined inside the function then they're only 3001 00:57:15,990 --> 00:57:16,000 the function then they're only 3002 00:57:16,000 --> 00:57:18,470 the function then they're only accessible for that specific function 3003 00:57:18,470 --> 00:57:18,480 accessible for that specific function 3004 00:57:18,480 --> 00:57:21,589 accessible for that specific function and not for other ones and that means 3005 00:57:21,589 --> 00:57:21,599 and not for other ones and that means 3006 00:57:21,599 --> 00:57:22,549 and not for other ones and that means actually that if 3007 00:57:22,549 --> 00:57:22,559 actually that if 3008 00:57:22,559 --> 00:57:25,109 actually that if num of days variable does not exist for 3009 00:57:25,109 --> 00:57:25,119 num of days variable does not exist for 3010 00:57:25,119 --> 00:57:26,549 num of days variable does not exist for scope check variable 3011 00:57:26,549 --> 00:57:26,559 scope check variable 3012 00:57:26,559 --> 00:57:29,910 scope check variable we can actually create a variable 3013 00:57:29,910 --> 00:57:29,920 we can actually create a variable 3014 00:57:29,920 --> 00:57:32,630 we can actually create a variable inside scope check with the same name 3015 00:57:32,630 --> 00:57:32,640 inside scope check with the same name 3016 00:57:32,640 --> 00:57:34,630 inside scope check with the same name and we would have basically 3017 00:57:34,630 --> 00:57:34,640 and we would have basically 3018 00:57:34,640 --> 00:57:36,870 and we would have basically no problem at all so this is not going 3019 00:57:36,870 --> 00:57:36,880 no problem at all so this is not going 3020 00:57:36,880 --> 00:57:37,990 no problem at all so this is not going to be a duplicate 3021 00:57:37,990 --> 00:57:38,000 to be a duplicate 3022 00:57:38,000 --> 00:57:40,950 to be a duplicate because this function doesn't know about 3023 00:57:40,950 --> 00:57:40,960 because this function doesn't know about 3024 00:57:40,960 --> 00:57:43,190 because this function doesn't know about this variable the number of days here 3025 00:57:43,190 --> 00:57:43,200 this variable the number of days here 3026 00:57:43,200 --> 00:57:45,190 this variable the number of days here and scope check doesn't know anything 3027 00:57:45,190 --> 00:57:45,200 and scope check doesn't know anything 3028 00:57:45,200 --> 00:57:46,630 and scope check doesn't know anything about variable 3029 00:57:46,630 --> 00:57:46,640 about variable 3030 00:57:46,640 --> 00:57:50,150 about variable num of days right here and if we 3031 00:57:50,150 --> 00:57:50,160 num of days right here and if we 3032 00:57:50,160 --> 00:57:52,470 num of days right here and if we want to use that function now we have to 3033 00:57:52,470 --> 00:57:52,480 want to use that function now we have to 3034 00:57:52,480 --> 00:57:54,549 want to use that function now we have to put provide the value 3035 00:57:54,549 --> 00:57:54,559 put provide the value 3036 00:57:54,559 --> 00:57:57,990 put provide the value let's do 20 and if i execute 3037 00:57:57,990 --> 00:57:58,000 let's do 20 and if i execute 3038 00:57:58,000 --> 00:58:01,670 let's do 20 and if i execute there you go you have name of units and 3039 00:58:01,670 --> 00:58:01,680 there you go you have name of units and 3040 00:58:01,680 --> 00:58:04,870 there you go you have name of units and the 20 that we provided so global 3041 00:58:04,870 --> 00:58:04,880 the 20 that we provided so global 3042 00:58:04,880 --> 00:58:05,750 the 20 that we provided so global variable 3043 00:58:05,750 --> 00:58:05,760 variable 3044 00:58:05,760 --> 00:58:08,069 variable local variable defined here another 3045 00:58:08,069 --> 00:58:08,079 local variable defined here another 3046 00:58:08,079 --> 00:58:09,510 local variable defined here another interesting thing is that 3047 00:58:09,510 --> 00:58:09,520 interesting thing is that 3048 00:58:09,520 --> 00:58:12,549 interesting thing is that as i said inside the function 3049 00:58:12,549 --> 00:58:12,559 as i said inside the function 3050 00:58:12,559 --> 00:58:14,870 as i said inside the function body so to say so this is basically 3051 00:58:14,870 --> 00:58:14,880 body so to say so this is basically 3052 00:58:14,880 --> 00:58:15,589 body so to say so this is basically whatever 3053 00:58:15,589 --> 00:58:15,599 whatever 3054 00:58:15,599 --> 00:58:18,150 whatever is part of the function right in this 3055 00:58:18,150 --> 00:58:18,160 is part of the function right in this 3056 00:58:18,160 --> 00:58:19,030 is part of the function right in this indentation 3057 00:58:19,030 --> 00:58:19,040 indentation 3058 00:58:19,040 --> 00:58:22,390 indentation is called function body so we can 3059 00:58:22,390 --> 00:58:22,400 is called function body so we can 3060 00:58:22,400 --> 00:58:25,190 is called function body so we can create whatever logic we want inside 3061 00:58:25,190 --> 00:58:25,200 create whatever logic we want inside 3062 00:58:25,200 --> 00:58:26,630 create whatever logic we want inside that function body 3063 00:58:26,630 --> 00:58:26,640 that function body 3064 00:58:26,640 --> 00:58:29,670 that function body so whatever i can do in python 3065 00:58:29,670 --> 00:58:29,680 so whatever i can do in python 3066 00:58:29,680 --> 00:58:32,789 so whatever i can do in python generally i can do inside the function 3067 00:58:32,789 --> 00:58:32,799 generally i can do inside the function 3068 00:58:32,799 --> 00:58:33,349 generally i can do inside the function body 3069 00:58:33,349 --> 00:58:33,359 body 3070 00:58:33,359 --> 00:58:35,510 body so one of those things is actually 3071 00:58:35,510 --> 00:58:35,520 so one of those things is actually 3072 00:58:35,520 --> 00:58:36,950 so one of those things is actually creating variables 3073 00:58:36,950 --> 00:58:36,960 creating variables 3074 00:58:36,960 --> 00:58:38,710 creating variables right just like we created variables 3075 00:58:38,710 --> 00:58:38,720 right just like we created variables 3076 00:58:38,720 --> 00:58:41,190 right just like we created variables here we can create variables 3077 00:58:41,190 --> 00:58:41,200 here we can create variables 3078 00:58:41,200 --> 00:58:44,630 here we can create variables here like this let's call it 3079 00:58:44,630 --> 00:58:44,640 here like this let's call it 3080 00:58:44,640 --> 00:58:47,910 here like this let's call it myvariable and 3081 00:58:47,910 --> 00:58:47,920 myvariable and 3082 00:58:47,920 --> 00:58:51,430 myvariable and variable inside function 3083 00:58:51,430 --> 00:58:51,440 variable inside function 3084 00:58:51,440 --> 00:58:56,230 variable inside function and we can print that out as well 3085 00:58:59,190 --> 00:58:59,200 so now we have three types of variables 3086 00:58:59,200 --> 00:59:00,870 so now we have three types of variables that we are 3087 00:59:00,870 --> 00:59:00,880 that we are 3088 00:59:00,880 --> 00:59:03,670 that we are using in this function we have a global 3089 00:59:03,670 --> 00:59:03,680 using in this function we have a global 3090 00:59:03,680 --> 00:59:04,630 using in this function we have a global variable 3091 00:59:04,630 --> 00:59:04,640 variable 3092 00:59:04,640 --> 00:59:07,670 variable we have internal variable that is passed 3093 00:59:07,670 --> 00:59:07,680 we have internal variable that is passed 3094 00:59:07,680 --> 00:59:10,630 we have internal variable that is passed in as a parameter and we have internal 3095 00:59:10,630 --> 00:59:10,640 in as a parameter and we have internal 3096 00:59:10,640 --> 00:59:11,670 in as a parameter and we have internal variable again 3097 00:59:11,670 --> 00:59:11,680 variable again 3098 00:59:11,680 --> 00:59:14,069 variable again that is basically defined so the 3099 00:59:14,069 --> 00:59:14,079 that is basically defined so the 3100 00:59:14,079 --> 00:59:15,510 that is basically defined so the variable isn't 3101 00:59:15,510 --> 00:59:15,520 variable isn't 3102 00:59:15,520 --> 00:59:17,589 variable isn't provided when we use the function but 3103 00:59:17,589 --> 00:59:17,599 provided when we use the function but 3104 00:59:17,599 --> 00:59:18,950 provided when we use the function but it's basically just 3105 00:59:18,950 --> 00:59:18,960 it's basically just 3106 00:59:18,960 --> 00:59:21,990 it's basically just defined inside the variable and again if 3107 00:59:21,990 --> 00:59:22,000 defined inside the variable and again if 3108 00:59:22,000 --> 00:59:22,309 defined inside the variable and again if i 3109 00:59:22,309 --> 00:59:22,319 i 3110 00:59:22,319 --> 00:59:27,670 i execute this 3111 00:59:31,190 --> 00:59:31,200 see hours num updates and variable 3112 00:59:31,200 --> 00:59:32,630 see hours num updates and variable inside function 3113 00:59:32,630 --> 00:59:32,640 inside function 3114 00:59:32,640 --> 00:59:36,069 inside function text printed out like this 3115 00:59:36,069 --> 00:59:36,079 text printed out like this 3116 00:59:36,079 --> 00:59:37,990 text printed out like this and obviously this is just for 3117 00:59:37,990 --> 00:59:38,000 and obviously this is just for 3118 00:59:38,000 --> 00:59:39,750 and obviously this is just for demonstration but we're going to see 3119 00:59:39,750 --> 00:59:39,760 demonstration but we're going to see 3120 00:59:39,760 --> 00:59:42,390 demonstration but we're going to see more realistic examples of that in our 3121 00:59:42,390 --> 00:59:42,400 more realistic examples of that in our 3122 00:59:42,400 --> 00:59:43,430 more realistic examples of that in our projects 3123 00:59:43,430 --> 00:59:43,440 projects 3124 00:59:43,440 --> 00:59:46,870 projects so i'm going to clean this up and 3125 00:59:46,870 --> 00:59:46,880 so i'm going to clean this up and 3126 00:59:46,880 --> 00:59:52,470 so i'm going to clean this up and we can move on to the next concept 3127 00:59:54,630 --> 00:59:54,640 so now let's go back to the example 3128 00:59:54,640 --> 00:59:56,150 so now let's go back to the example where we calculate 3129 00:59:56,150 --> 00:59:56,160 where we calculate 3130 00:59:56,160 --> 00:59:59,589 where we calculate number of hours and we do that for four 3131 00:59:59,589 --> 00:59:59,599 number of hours and we do that for four 3132 00:59:59,599 --> 01:00:02,069 number of hours and we do that for four different values now if you want this 3133 01:00:02,069 --> 01:00:02,079 different values now if you want this 3134 01:00:02,079 --> 01:00:04,069 different values now if you want this application to be really useful 3135 01:00:04,069 --> 01:00:04,079 application to be really useful 3136 01:00:04,079 --> 01:00:06,789 application to be really useful for us or somebody else it doesn't help 3137 01:00:06,789 --> 01:00:06,799 for us or somebody else it doesn't help 3138 01:00:06,799 --> 01:00:07,670 for us or somebody else it doesn't help that we have to 3139 01:00:07,670 --> 01:00:07,680 that we have to 3140 01:00:07,680 --> 01:00:10,630 that we have to fixate here just four different values 3141 01:00:10,630 --> 01:00:10,640 fixate here just four different values 3142 01:00:10,640 --> 01:00:11,109 fixate here just four different values right 3143 01:00:11,109 --> 01:00:11,119 right 3144 01:00:11,119 --> 01:00:13,349 right the application should be able to take 3145 01:00:13,349 --> 01:00:13,359 the application should be able to take 3146 01:00:13,359 --> 01:00:15,190 the application should be able to take any value that we basically 3147 01:00:15,190 --> 01:00:15,200 any value that we basically 3148 01:00:15,200 --> 01:00:18,470 any value that we basically fit it right so we should be able to 3149 01:00:18,470 --> 01:00:18,480 fit it right so we should be able to 3150 01:00:18,480 --> 01:00:20,870 fit it right so we should be able to provide any number of days and the 3151 01:00:20,870 --> 01:00:20,880 provide any number of days and the 3152 01:00:20,880 --> 01:00:22,549 provide any number of days and the program should calculate 3153 01:00:22,549 --> 01:00:22,559 program should calculate 3154 01:00:22,559 --> 01:00:25,430 program should calculate the number of hours in those days so 3155 01:00:25,430 --> 01:00:25,440 the number of hours in those days so 3156 01:00:25,440 --> 01:00:26,549 the number of hours in those days so what we need here 3157 01:00:26,549 --> 01:00:26,559 what we need here 3158 01:00:26,559 --> 01:00:29,589 what we need here is user input so when we give this 3159 01:00:29,589 --> 01:00:29,599 is user input so when we give this 3160 01:00:29,599 --> 01:00:30,710 is user input so when we give this application 3161 01:00:30,710 --> 01:00:30,720 application 3162 01:00:30,720 --> 01:00:33,030 application program to somebody else or use it 3163 01:00:33,030 --> 01:00:33,040 program to somebody else or use it 3164 01:00:33,040 --> 01:00:33,750 program to somebody else or use it ourselves 3165 01:00:33,750 --> 01:00:33,760 ourselves 3166 01:00:33,760 --> 01:00:36,870 ourselves it should allow some user input so 3167 01:00:36,870 --> 01:00:36,880 it should allow some user input so 3168 01:00:36,880 --> 01:00:40,309 it should allow some user input so how do we write a program that asks for 3169 01:00:40,309 --> 01:00:40,319 how do we write a program that asks for 3170 01:00:40,319 --> 01:00:41,430 how do we write a program that asks for and accepts 3171 01:00:41,430 --> 01:00:41,440 and accepts 3172 01:00:41,440 --> 01:00:44,150 and accepts a user input and then does something 3173 01:00:44,150 --> 01:00:44,160 a user input and then does something 3174 01:00:44,160 --> 01:00:45,109 a user input and then does something some kind of 3175 01:00:45,109 --> 01:00:45,119 some kind of 3176 01:00:45,119 --> 01:00:47,990 some kind of calculation some kind of other logic 3177 01:00:47,990 --> 01:00:48,000 calculation some kind of other logic 3178 01:00:48,000 --> 01:00:49,270 calculation some kind of other logic based on that 3179 01:00:49,270 --> 01:00:49,280 based on that 3180 01:00:49,280 --> 01:00:52,549 based on that user input accepting a user input 3181 01:00:52,549 --> 01:00:52,559 user input accepting a user input 3182 01:00:52,559 --> 01:00:54,390 user input accepting a user input from a python application is actually 3183 01:00:54,390 --> 01:00:54,400 from a python application is actually 3184 01:00:54,400 --> 01:00:55,589 from a python application is actually pretty easy 3185 01:00:55,589 --> 01:00:55,599 pretty easy 3186 01:00:55,599 --> 01:00:58,309 pretty easy let's get rid of all of these lines 3187 01:00:58,309 --> 01:00:58,319 let's get rid of all of these lines 3188 01:00:58,319 --> 01:00:59,589 let's get rid of all of these lines first 3189 01:00:59,589 --> 01:00:59,599 first 3190 01:00:59,599 --> 01:01:03,829 first and we can do that by writing input 3191 01:01:03,829 --> 01:01:03,839 and we can do that by writing input 3192 01:01:03,839 --> 01:01:06,950 and we can do that by writing input and this will basically give a user a 3193 01:01:06,950 --> 01:01:06,960 and this will basically give a user a 3194 01:01:06,960 --> 01:01:08,069 and this will basically give a user a prompt 3195 01:01:08,069 --> 01:01:08,079 prompt 3196 01:01:08,079 --> 01:01:11,589 prompt to enter some input value now 3197 01:01:11,589 --> 01:01:11,599 to enter some input value now 3198 01:01:11,599 --> 01:01:14,950 to enter some input value now you probably already see from the syntax 3199 01:01:14,950 --> 01:01:14,960 you probably already see from the syntax 3200 01:01:14,960 --> 01:01:17,990 you probably already see from the syntax that this looks very much like 3201 01:01:17,990 --> 01:01:18,000 that this looks very much like 3202 01:01:18,000 --> 01:01:21,589 that this looks very much like using our days to units function 3203 01:01:21,589 --> 01:01:21,599 using our days to units function 3204 01:01:21,599 --> 01:01:24,549 using our days to units function right in this case with the parameter so 3205 01:01:24,549 --> 01:01:24,559 right in this case with the parameter so 3206 01:01:24,559 --> 01:01:25,510 right in this case with the parameter so input is 3207 01:01:25,510 --> 01:01:25,520 input is 3208 01:01:25,520 --> 01:01:28,789 input is actually a function that python provides 3209 01:01:28,789 --> 01:01:28,799 actually a function that python provides 3210 01:01:28,799 --> 01:01:29,349 actually a function that python provides us with 3211 01:01:29,349 --> 01:01:29,359 us with 3212 01:01:29,359 --> 01:01:30,950 us with so we didn't have to write this input 3213 01:01:30,950 --> 01:01:30,960 so we didn't have to write this input 3214 01:01:30,960 --> 01:01:32,870 so we didn't have to write this input function right we wrote the days to 3215 01:01:32,870 --> 01:01:32,880 function right we wrote the days to 3216 01:01:32,880 --> 01:01:33,990 function right we wrote the days to units function 3217 01:01:33,990 --> 01:01:34,000 units function 3218 01:01:34,000 --> 01:01:36,630 units function but input function is available in 3219 01:01:36,630 --> 01:01:36,640 but input function is available in 3220 01:01:36,640 --> 01:01:37,349 but input function is available in python 3221 01:01:37,349 --> 01:01:37,359 python 3222 01:01:37,359 --> 01:01:40,390 python so that we can use it whenever we want 3223 01:01:40,390 --> 01:01:40,400 so that we can use it whenever we want 3224 01:01:40,400 --> 01:01:43,349 so that we can use it whenever we want and this parenthesis here tells python 3225 01:01:43,349 --> 01:01:43,359 and this parenthesis here tells python 3226 01:01:43,359 --> 01:01:44,470 and this parenthesis here tells python we want to call 3227 01:01:44,470 --> 01:01:44,480 we want to call 3228 01:01:44,480 --> 01:01:47,510 we want to call an input function and we're calling it 3229 01:01:47,510 --> 01:01:47,520 an input function and we're calling it 3230 01:01:47,520 --> 01:01:49,990 an input function and we're calling it or using a function without a parameter 3231 01:01:49,990 --> 01:01:50,000 or using a function without a parameter 3232 01:01:50,000 --> 01:01:52,630 or using a function without a parameter so now we know that we can write 3233 01:01:52,630 --> 01:01:52,640 so now we know that we can write 3234 01:01:52,640 --> 01:01:53,510 so now we know that we can write functions 3235 01:01:53,510 --> 01:01:53,520 functions 3236 01:01:53,520 --> 01:01:56,710 functions ourselves for logic that we need 3237 01:01:56,710 --> 01:01:56,720 ourselves for logic that we need 3238 01:01:56,720 --> 01:02:00,150 ourselves for logic that we need but python has tons of functions 3239 01:02:00,150 --> 01:02:00,160 but python has tons of functions 3240 01:02:00,160 --> 01:02:02,710 but python has tons of functions that python developers already wrote and 3241 01:02:02,710 --> 01:02:02,720 that python developers already wrote and 3242 01:02:02,720 --> 01:02:03,190 that python developers already wrote and is 3243 01:02:03,190 --> 01:02:03,200 is 3244 01:02:03,200 --> 01:02:06,069 is part of python and we can use it in our 3245 01:02:06,069 --> 01:02:06,079 part of python and we can use it in our 3246 01:02:06,079 --> 01:02:07,910 part of python and we can use it in our code so that not everybody 3247 01:02:07,910 --> 01:02:07,920 code so that not everybody 3248 01:02:07,920 --> 01:02:10,390 code so that not everybody has to write their own input function 3249 01:02:10,390 --> 01:02:10,400 has to write their own input function 3250 01:02:10,400 --> 01:02:11,109 has to write their own input function logic 3251 01:02:11,109 --> 01:02:11,119 logic 3252 01:02:11,119 --> 01:02:12,950 logic and the code or the functions that 3253 01:02:12,950 --> 01:02:12,960 and the code or the functions that 3254 01:02:12,960 --> 01:02:14,549 and the code or the functions that python provides 3255 01:02:14,549 --> 01:02:14,559 python provides 3256 01:02:14,559 --> 01:02:17,829 python provides are again part of this python that we 3257 01:02:17,829 --> 01:02:17,839 are again part of this python that we 3258 01:02:17,839 --> 01:02:19,430 are again part of this python that we use in a project 3259 01:02:19,430 --> 01:02:19,440 use in a project 3260 01:02:19,440 --> 01:02:22,230 use in a project and obviously if you're using the latest 3261 01:02:22,230 --> 01:02:22,240 and obviously if you're using the latest 3262 01:02:22,240 --> 01:02:22,789 and obviously if you're using the latest version 3263 01:02:22,789 --> 01:02:22,799 version 3264 01:02:22,799 --> 01:02:26,150 version of python you will get the latest code 3265 01:02:26,150 --> 01:02:26,160 of python you will get the latest code 3266 01:02:26,160 --> 01:02:26,950 of python you will get the latest code and latest 3267 01:02:26,950 --> 01:02:26,960 and latest 3268 01:02:26,960 --> 01:02:31,910 and latest functions that python basically provides 3269 01:02:31,910 --> 01:02:31,920 functions that python basically provides 3270 01:02:31,920 --> 01:02:35,750 functions that python basically provides so back to our function execution 3271 01:02:35,750 --> 01:02:35,760 so back to our function execution 3272 01:02:35,760 --> 01:02:38,630 so back to our function execution and let's see what happens when we 3273 01:02:38,630 --> 01:02:38,640 and let's see what happens when we 3274 01:02:38,640 --> 01:02:39,990 and let's see what happens when we execute this program 3275 01:02:39,990 --> 01:02:40,000 execute this program 3276 01:02:40,000 --> 01:02:42,789 execute this program i'm going to run it and in the outputs 3277 01:02:42,789 --> 01:02:42,799 i'm going to run it and in the outputs 3278 01:02:42,799 --> 01:02:44,950 i'm going to run it and in the outputs you actually do not see anything 3279 01:02:44,950 --> 01:02:44,960 you actually do not see anything 3280 01:02:44,960 --> 01:02:48,789 you actually do not see anything other than my cursor is blinking here 3281 01:02:48,789 --> 01:02:48,799 other than my cursor is blinking here 3282 01:02:48,799 --> 01:02:51,430 other than my cursor is blinking here so it's actually waiting for user input 3283 01:02:51,430 --> 01:02:51,440 so it's actually waiting for user input 3284 01:02:51,440 --> 01:02:53,589 so it's actually waiting for user input so i can actually type in 3285 01:02:53,589 --> 01:02:53,599 so i can actually type in 3286 01:02:53,599 --> 01:02:57,190 so i can actually type in something here so i can do 20 and enter 3287 01:02:57,190 --> 01:02:57,200 something here so i can do 20 and enter 3288 01:02:57,200 --> 01:02:59,910 something here so i can do 20 and enter and process finished with exit code so i 3289 01:02:59,910 --> 01:02:59,920 and process finished with exit code so i 3290 01:02:59,920 --> 01:03:00,950 and process finished with exit code so i was able to 3291 01:03:00,950 --> 01:03:00,960 was able to 3292 01:03:00,960 --> 01:03:05,270 was able to input something doesn't really matter 3293 01:03:05,270 --> 01:03:05,280 input something doesn't really matter 3294 01:03:05,280 --> 01:03:08,150 input something doesn't really matter it could also be a string actually 3295 01:03:08,150 --> 01:03:08,160 it could also be a string actually 3296 01:03:08,160 --> 01:03:08,630 it could also be a string actually doesn't 3297 01:03:08,630 --> 01:03:08,640 doesn't 3298 01:03:08,640 --> 01:03:12,390 doesn't really matter and program basically 3299 01:03:12,390 --> 01:03:12,400 really matter and program basically 3300 01:03:12,400 --> 01:03:16,150 really matter and program basically finishes so that's the simplest usage of 3301 01:03:16,150 --> 01:03:16,160 finishes so that's the simplest usage of 3302 01:03:16,160 --> 01:03:19,829 finishes so that's the simplest usage of input however as you noticed here 3303 01:03:19,829 --> 01:03:19,839 input however as you noticed here 3304 01:03:19,839 --> 01:03:21,510 input however as you noticed here running this program and basically 3305 01:03:21,510 --> 01:03:21,520 running this program and basically 3306 01:03:21,520 --> 01:03:23,190 running this program and basically having this blank 3307 01:03:23,190 --> 01:03:23,200 having this blank 3308 01:03:23,200 --> 01:03:25,990 having this blank output here is a little bit confusing so 3309 01:03:25,990 --> 01:03:26,000 output here is a little bit confusing so 3310 01:03:26,000 --> 01:03:27,190 output here is a little bit confusing so if another user 3311 01:03:27,190 --> 01:03:27,200 if another user 3312 01:03:27,200 --> 01:03:30,150 if another user is using our program they will probably 3313 01:03:30,150 --> 01:03:30,160 is using our program they will probably 3314 01:03:30,160 --> 01:03:31,910 is using our program they will probably be wondering what's happening here 3315 01:03:31,910 --> 01:03:31,920 be wondering what's happening here 3316 01:03:31,920 --> 01:03:35,190 be wondering what's happening here so what we can do is in input function 3317 01:03:35,190 --> 01:03:35,200 so what we can do is in input function 3318 01:03:35,200 --> 01:03:38,309 so what we can do is in input function we can provide a parameter that actually 3319 01:03:38,309 --> 01:03:38,319 we can provide a parameter that actually 3320 01:03:38,319 --> 01:03:41,589 we can provide a parameter that actually tells a user something right like 3321 01:03:41,589 --> 01:03:41,599 tells a user something right like 3322 01:03:41,599 --> 01:03:45,109 tells a user something right like enter a value for number of days or 3323 01:03:45,109 --> 01:03:45,119 enter a value for number of days or 3324 01:03:45,119 --> 01:03:47,829 enter a value for number of days or something similar so that it's not just 3325 01:03:47,829 --> 01:03:47,839 something similar so that it's not just 3326 01:03:47,839 --> 01:03:48,150 something similar so that it's not just a 3327 01:03:48,150 --> 01:03:48,160 a 3328 01:03:48,160 --> 01:03:52,309 a blank prompt right so we can do that by 3329 01:03:52,309 --> 01:03:52,319 blank prompt right so we can do that by 3330 01:03:52,319 --> 01:03:55,349 blank prompt right so we can do that by passing in a parameter a string which is 3331 01:03:55,349 --> 01:03:55,359 passing in a parameter a string which is 3332 01:03:55,359 --> 01:03:56,789 passing in a parameter a string which is going to be our message 3333 01:03:56,789 --> 01:03:56,799 going to be our message 3334 01:03:56,799 --> 01:04:00,470 going to be our message so we can do a user 3335 01:04:00,470 --> 01:04:00,480 so we can do a user 3336 01:04:00,480 --> 01:04:04,390 so we can do a user enter a number of days 3337 01:04:07,910 --> 01:04:07,920 and i will convert it to 3338 01:04:07,920 --> 01:04:11,829 and i will convert it to hours and here you see right now that 3339 01:04:11,829 --> 01:04:11,839 hours and here you see right now that 3340 01:04:11,839 --> 01:04:13,510 hours and here you see right now that the program wasn't finished because we 3341 01:04:13,510 --> 01:04:13,520 the program wasn't finished because we 3342 01:04:13,520 --> 01:04:14,470 the program wasn't finished because we didn't enter 3343 01:04:14,470 --> 01:04:14,480 didn't enter 3344 01:04:14,480 --> 01:04:18,309 didn't enter anything so this program finished line 3345 01:04:18,309 --> 01:04:18,319 anything so this program finished line 3346 01:04:18,319 --> 01:04:20,789 anything so this program finished line wasn't output yet and that means the 3347 01:04:20,789 --> 01:04:20,799 wasn't output yet and that means the 3348 01:04:20,799 --> 01:04:22,150 wasn't output yet and that means the program is still running 3349 01:04:22,150 --> 01:04:22,160 program is still running 3350 01:04:22,160 --> 01:04:25,589 program is still running it is still waiting for our input 3351 01:04:25,589 --> 01:04:25,599 it is still waiting for our input 3352 01:04:25,599 --> 01:04:28,950 it is still waiting for our input and in pycharm in this ide 3353 01:04:28,950 --> 01:04:28,960 and in pycharm in this ide 3354 01:04:28,960 --> 01:04:31,349 and in pycharm in this ide if you want to terminate the program 3355 01:04:31,349 --> 01:04:31,359 if you want to terminate the program 3356 01:04:31,359 --> 01:04:32,870 if you want to terminate the program manually yourself 3357 01:04:32,870 --> 01:04:32,880 manually yourself 3358 01:04:32,880 --> 01:04:36,789 manually yourself you can click this stop button 3359 01:04:36,789 --> 01:04:36,799 you can click this stop button 3360 01:04:36,799 --> 01:04:39,990 you can click this stop button and as you see process finished so 3361 01:04:39,990 --> 01:04:40,000 and as you see process finished so 3362 01:04:40,000 --> 01:04:43,190 and as you see process finished so now we can run the program again and as 3363 01:04:43,190 --> 01:04:43,200 now we can run the program again and as 3364 01:04:43,200 --> 01:04:44,549 now we can run the program again and as you see here we 3365 01:04:44,549 --> 01:04:44,559 you see here we 3366 01:04:44,559 --> 01:04:47,109 you see here we already have a message that we're 3367 01:04:47,109 --> 01:04:47,119 already have a message that we're 3368 01:04:47,119 --> 01:04:48,549 already have a message that we're displaying to the user 3369 01:04:48,549 --> 01:04:48,559 displaying to the user 3370 01:04:48,559 --> 01:04:52,870 displaying to the user so that they can enter the hours right 3371 01:04:52,870 --> 01:04:52,880 so that they can enter the hours right 3372 01:04:52,880 --> 01:04:56,789 so that they can enter the hours right and here we can provide our input 3373 01:04:56,789 --> 01:04:56,799 and here we can provide our input 3374 01:04:56,799 --> 01:05:00,150 and here we can provide our input 30 and there you go however 3375 01:05:00,150 --> 01:05:00,160 30 and there you go however 3376 01:05:00,160 --> 01:05:02,390 30 and there you go however this doesn't look nice here we actually 3377 01:05:02,390 --> 01:05:02,400 this doesn't look nice here we actually 3378 01:05:02,400 --> 01:05:04,309 this doesn't look nice here we actually want the user 3379 01:05:04,309 --> 01:05:04,319 want the user 3380 01:05:04,319 --> 01:05:07,270 want the user to get a prompt on the next line how do 3381 01:05:07,270 --> 01:05:07,280 to get a prompt on the next line how do 3382 01:05:07,280 --> 01:05:08,150 to get a prompt on the next line how do we do that 3383 01:05:08,150 --> 01:05:08,160 we do that 3384 01:05:08,160 --> 01:05:10,549 we do that as part of a string we can actually add 3385 01:05:10,549 --> 01:05:10,559 as part of a string we can actually add 3386 01:05:10,559 --> 01:05:11,670 as part of a string we can actually add a new line 3387 01:05:11,670 --> 01:05:11,680 a new line 3388 01:05:11,680 --> 01:05:14,710 a new line or newline character basically and 3389 01:05:14,710 --> 01:05:14,720 or newline character basically and 3390 01:05:14,720 --> 01:05:16,710 or newline character basically and that in programming is actually 3391 01:05:16,710 --> 01:05:16,720 that in programming is actually 3392 01:05:16,720 --> 01:05:17,990 that in programming is actually represented 3393 01:05:17,990 --> 01:05:18,000 represented 3394 01:05:18,000 --> 01:05:21,109 represented by backslash n and you see 3395 01:05:21,109 --> 01:05:21,119 by backslash n and you see 3396 01:05:21,119 --> 01:05:23,109 by backslash n and you see a special highlighting for that one now 3397 01:05:23,109 --> 01:05:23,119 a special highlighting for that one now 3398 01:05:23,119 --> 01:05:24,630 a special highlighting for that one now let's execute 3399 01:05:24,630 --> 01:05:24,640 let's execute 3400 01:05:24,640 --> 01:05:27,430 let's execute and you see that my cursor is on the 3401 01:05:27,430 --> 01:05:27,440 and you see that my cursor is on the 3402 01:05:27,440 --> 01:05:28,390 and you see that my cursor is on the next line now 3403 01:05:28,390 --> 01:05:28,400 next line now 3404 01:05:28,400 --> 01:05:32,069 next line now and again let's provide a value enter 3405 01:05:32,069 --> 01:05:32,079 and again let's provide a value enter 3406 01:05:32,079 --> 01:05:35,510 and again let's provide a value enter and program ended so we have 3407 01:05:35,510 --> 01:05:35,520 and program ended so we have 3408 01:05:35,520 --> 01:05:38,309 and program ended so we have now a more user-friendly way of asking 3409 01:05:38,309 --> 01:05:38,319 now a more user-friendly way of asking 3410 01:05:38,319 --> 01:05:40,069 now a more user-friendly way of asking program user for their input 3411 01:05:40,069 --> 01:05:40,079 program user for their input 3412 01:05:40,079 --> 01:05:43,029 program user for their input instead of just showing an empty prompt 3413 01:05:43,029 --> 01:05:43,039 instead of just showing an empty prompt 3414 01:05:43,039 --> 01:05:44,870 instead of just showing an empty prompt and we're getting user input 3415 01:05:44,870 --> 01:05:44,880 and we're getting user input 3416 01:05:44,880 --> 01:05:47,109 and we're getting user input now we're not doing anything with that 3417 01:05:47,109 --> 01:05:47,119 now we're not doing anything with that 3418 01:05:47,119 --> 01:05:48,230 now we're not doing anything with that user input right 3419 01:05:48,230 --> 01:05:48,240 user input right 3420 01:05:48,240 --> 01:05:50,789 user input right that input basically just finishes the 3421 01:05:50,789 --> 01:05:50,799 that input basically just finishes the 3422 01:05:50,799 --> 01:05:52,390 that input basically just finishes the program and that's it 3423 01:05:52,390 --> 01:05:52,400 program and that's it 3424 01:05:52,400 --> 01:05:55,109 program and that's it we're not doing any calculation for that 3425 01:05:55,109 --> 01:05:55,119 we're not doing any calculation for that 3426 01:05:55,119 --> 01:05:55,829 we're not doing any calculation for that input 3427 01:05:55,829 --> 01:05:55,839 input 3428 01:05:55,839 --> 01:05:59,349 input so how do we use the value that user 3429 01:05:59,349 --> 01:05:59,359 so how do we use the value that user 3430 01:05:59,359 --> 01:06:00,390 so how do we use the value that user enters here 3431 01:06:00,390 --> 01:06:00,400 enters here 3432 01:06:00,400 --> 01:06:04,230 enters here when input function gets executed we do 3433 01:06:04,230 --> 01:06:04,240 when input function gets executed we do 3434 01:06:04,240 --> 01:06:05,990 when input function gets executed we do that and this is a very important 3435 01:06:05,990 --> 01:06:06,000 that and this is a very important 3436 01:06:06,000 --> 01:06:06,870 that and this is a very important concept 3437 01:06:06,870 --> 01:06:06,880 concept 3438 01:06:06,880 --> 01:06:10,230 concept by assigning whatever result 3439 01:06:10,230 --> 01:06:10,240 by assigning whatever result 3440 01:06:10,240 --> 01:06:13,589 by assigning whatever result this function usage gives us which is 3441 01:06:13,589 --> 01:06:13,599 this function usage gives us which is 3442 01:06:13,599 --> 01:06:17,190 this function usage gives us which is in this case user input assigning that 3443 01:06:17,190 --> 01:06:17,200 in this case user input assigning that 3444 01:06:17,200 --> 01:06:19,750 in this case user input assigning that result to a variable so right now it's 3445 01:06:19,750 --> 01:06:19,760 result to a variable so right now it's 3446 01:06:19,760 --> 01:06:20,390 result to a variable so right now it's basically 3447 01:06:20,390 --> 01:06:20,400 basically 3448 01:06:20,400 --> 01:06:22,309 basically executed and it's just wasted right it 3449 01:06:22,309 --> 01:06:22,319 executed and it's just wasted right it 3450 01:06:22,319 --> 01:06:23,430 executed and it's just wasted right it just disappears 3451 01:06:23,430 --> 01:06:23,440 just disappears 3452 01:06:23,440 --> 01:06:25,750 just disappears so instead we want to save that value 3453 01:06:25,750 --> 01:06:25,760 so instead we want to save that value 3454 01:06:25,760 --> 01:06:26,950 so instead we want to save that value that entered 3455 01:06:26,950 --> 01:06:26,960 that entered 3456 01:06:26,960 --> 01:06:30,069 that entered input value in a variable so that we can 3457 01:06:30,069 --> 01:06:30,079 input value in a variable so that we can 3458 01:06:30,079 --> 01:06:33,510 input value in a variable so that we can access it later and we do that by 3459 01:06:33,510 --> 01:06:33,520 access it later and we do that by 3460 01:06:33,520 --> 01:06:37,190 access it later and we do that by let's call it user input variable 3461 01:06:37,190 --> 01:06:37,200 let's call it user input variable 3462 01:06:37,200 --> 01:06:40,390 let's call it user input variable equals so just like we created variables 3463 01:06:40,390 --> 01:06:40,400 equals so just like we created variables 3464 01:06:40,400 --> 01:06:40,950 equals so just like we created variables here 3465 01:06:40,950 --> 01:06:40,960 here 3466 01:06:40,960 --> 01:06:44,470 here with variable name and a value right or 3467 01:06:44,470 --> 01:06:44,480 with variable name and a value right or 3468 01:06:44,480 --> 01:06:47,029 with variable name and a value right or even an expression right if we did a 3469 01:06:47,029 --> 01:06:47,039 even an expression right if we did a 3470 01:06:47,039 --> 01:06:48,630 even an expression right if we did a calculation here that will be 3471 01:06:48,630 --> 01:06:48,640 calculation here that will be 3472 01:06:48,640 --> 01:06:50,470 calculation here that will be basically a whole expression whole 3473 01:06:50,470 --> 01:06:50,480 basically a whole expression whole 3474 01:06:50,480 --> 01:06:51,750 basically a whole expression whole calculation 3475 01:06:51,750 --> 01:06:51,760 calculation 3476 01:06:51,760 --> 01:06:55,990 calculation the same way we can use values 3477 01:06:55,990 --> 01:06:56,000 the same way we can use values 3478 01:06:56,000 --> 01:06:59,029 the same way we can use values that function execution gives 3479 01:06:59,029 --> 01:06:59,039 that function execution gives 3480 01:06:59,039 --> 01:07:01,910 that function execution gives us to assign it to a variable so now 3481 01:07:01,910 --> 01:07:01,920 us to assign it to a variable so now 3482 01:07:01,920 --> 01:07:02,789 us to assign it to a variable so now what i'm going to do 3483 01:07:02,789 --> 01:07:02,799 what i'm going to do 3484 01:07:02,799 --> 01:07:05,670 what i'm going to do is i'm just going to print the user 3485 01:07:05,670 --> 01:07:05,680 is i'm just going to print the user 3486 01:07:05,680 --> 01:07:06,390 is i'm just going to print the user input 3487 01:07:06,390 --> 01:07:06,400 input 3488 01:07:06,400 --> 01:07:09,670 input so that we can see what value that 3489 01:07:09,670 --> 01:07:09,680 so that we can see what value that 3490 01:07:09,680 --> 01:07:13,029 so that we can see what value that user input variable has so let's execute 3491 01:07:13,029 --> 01:07:13,039 user input variable has so let's execute 3492 01:07:13,039 --> 01:07:13,589 user input variable has so let's execute again 3493 01:07:13,589 --> 01:07:13,599 again 3494 01:07:13,599 --> 01:07:17,029 again it asks for our input let's put 20 3495 01:07:17,029 --> 01:07:17,039 it asks for our input let's put 20 3496 01:07:17,039 --> 01:07:20,309 it asks for our input let's put 20 and print user input gives us 20. 3497 01:07:20,309 --> 01:07:20,319 and print user input gives us 20. 3498 01:07:20,319 --> 01:07:23,190 and print user input gives us 20. so user input variable value basically 3499 01:07:23,190 --> 01:07:23,200 so user input variable value basically 3500 01:07:23,200 --> 01:07:24,069 so user input variable value basically becomes 3501 01:07:24,069 --> 01:07:24,079 becomes 3502 01:07:24,079 --> 01:07:30,069 becomes whatever we provide as an input 3503 01:07:31,829 --> 01:07:31,839 now that's a new concept and it could be 3504 01:07:31,839 --> 01:07:33,349 now that's a new concept and it could be a little bit confusing 3505 01:07:33,349 --> 01:07:33,359 a little bit confusing 3506 01:07:33,359 --> 01:07:35,910 a little bit confusing so let's see another example with our 3507 01:07:35,910 --> 01:07:35,920 so let's see another example with our 3508 01:07:35,920 --> 01:07:36,710 so let's see another example with our own function 3509 01:07:36,710 --> 01:07:36,720 own function 3510 01:07:36,720 --> 01:07:40,950 own function what would happen if we 3511 01:07:44,470 --> 01:07:44,480 assigned value of this 3512 01:07:44,480 --> 01:07:47,829 assigned value of this to a variable 3513 01:07:50,470 --> 01:07:50,480 we get a warning as you see here in the 3514 01:07:50,480 --> 01:07:51,270 we get a warning as you see here in the editor 3515 01:07:51,270 --> 01:07:51,280 editor 3516 01:07:51,280 --> 01:07:53,270 editor which is one of the great things about 3517 01:07:53,270 --> 01:07:53,280 which is one of the great things about 3518 01:07:53,280 --> 01:07:55,270 which is one of the great things about ides that it basically gives you 3519 01:07:55,270 --> 01:07:55,280 ides that it basically gives you 3520 01:07:55,280 --> 01:07:57,589 ides that it basically gives you warnings when something is not correct 3521 01:07:57,589 --> 01:07:57,599 warnings when something is not correct 3522 01:07:57,599 --> 01:07:59,670 warnings when something is not correct and the warning says function doesn't 3523 01:07:59,670 --> 01:07:59,680 and the warning says function doesn't 3524 01:07:59,680 --> 01:08:01,349 and the warning says function doesn't return anything 3525 01:08:01,349 --> 01:08:01,359 return anything 3526 01:08:01,359 --> 01:08:04,309 return anything so basically if we want to have some 3527 01:08:04,309 --> 01:08:04,319 so basically if we want to have some 3528 01:08:04,319 --> 01:08:05,109 so basically if we want to have some value 3529 01:08:05,109 --> 01:08:05,119 value 3530 01:08:05,119 --> 01:08:07,670 value as a result of function execution we 3531 01:08:07,670 --> 01:08:07,680 as a result of function execution we 3532 01:08:07,680 --> 01:08:08,870 as a result of function execution we have to return 3533 01:08:08,870 --> 01:08:08,880 have to return 3534 01:08:08,880 --> 01:08:11,750 have to return some value in the function and how we do 3535 01:08:11,750 --> 01:08:11,760 some value in the function and how we do 3536 01:08:11,760 --> 01:08:12,470 some value in the function and how we do that 3537 01:08:12,470 --> 01:08:12,480 that 3538 01:08:12,480 --> 01:08:15,750 that instead of printing the value right away 3539 01:08:15,750 --> 01:08:15,760 instead of printing the value right away 3540 01:08:15,760 --> 01:08:19,510 instead of printing the value right away we can actually return that value 3541 01:08:19,510 --> 01:08:19,520 we can actually return that value 3542 01:08:19,520 --> 01:08:22,870 we can actually return that value using return keyword again you see 3543 01:08:22,870 --> 01:08:22,880 using return keyword again you see 3544 01:08:22,880 --> 01:08:24,950 using return keyword again you see special highlighting here just like here 3545 01:08:24,950 --> 01:08:24,960 special highlighting here just like here 3546 01:08:24,960 --> 01:08:25,910 special highlighting here just like here because return 3547 01:08:25,910 --> 01:08:25,920 because return 3548 01:08:25,920 --> 01:08:28,309 because return is a special word that python 3549 01:08:28,309 --> 01:08:28,319 is a special word that python 3550 01:08:28,319 --> 01:08:29,269 is a special word that python understands 3551 01:08:29,269 --> 01:08:29,279 understands 3552 01:08:29,279 --> 01:08:32,550 understands that you want to basically give back 3553 01:08:32,550 --> 01:08:32,560 that you want to basically give back 3554 01:08:32,560 --> 01:08:35,749 that you want to basically give back a value this value right here as a 3555 01:08:35,749 --> 01:08:35,759 a value this value right here as a 3556 01:08:35,759 --> 01:08:36,550 a value this value right here as a result 3557 01:08:36,550 --> 01:08:36,560 result 3558 01:08:36,560 --> 01:08:39,829 result of using the function right so you could 3559 01:08:39,829 --> 01:08:39,839 of using the function right so you could 3560 01:08:39,839 --> 01:08:40,709 of using the function right so you could have 3561 01:08:40,709 --> 01:08:40,719 have 3562 01:08:40,719 --> 01:08:43,349 have some logic here doing the calculation 3563 01:08:43,349 --> 01:08:43,359 some logic here doing the calculation 3564 01:08:43,359 --> 01:08:44,229 some logic here doing the calculation whatever 3565 01:08:44,229 --> 01:08:44,239 whatever 3566 01:08:44,239 --> 01:08:48,070 whatever and then as the last line you can return 3567 01:08:48,070 --> 01:08:48,080 and then as the last line you can return 3568 01:08:48,080 --> 01:08:51,510 and then as the last line you can return that calculated value and now 3569 01:08:51,510 --> 01:08:51,520 that calculated value and now 3570 01:08:51,520 --> 01:08:53,189 that calculated value and now the warning is gone because we're 3571 01:08:53,189 --> 01:08:53,199 the warning is gone because we're 3572 01:08:53,199 --> 01:08:55,030 the warning is gone because we're actually returning something 3573 01:08:55,030 --> 01:08:55,040 actually returning something 3574 01:08:55,040 --> 01:08:58,390 actually returning something from the function and when we return 3575 01:08:58,390 --> 01:08:58,400 from the function and when we return 3576 01:08:58,400 --> 01:09:01,110 from the function and when we return value from a function again we can 3577 01:09:01,110 --> 01:09:01,120 value from a function again we can 3578 01:09:01,120 --> 01:09:02,229 value from a function again we can assign it 3579 01:09:02,229 --> 01:09:02,239 assign it 3580 01:09:02,239 --> 01:09:04,789 assign it to a variable so that we can use that 3581 01:09:04,789 --> 01:09:04,799 to a variable so that we can use that 3582 01:09:04,799 --> 01:09:05,990 to a variable so that we can use that value whatever function 3583 01:09:05,990 --> 01:09:06,000 value whatever function 3584 01:09:06,000 --> 01:09:09,430 value whatever function returned by referencing the variable and 3585 01:09:09,430 --> 01:09:09,440 returned by referencing the variable and 3586 01:09:09,440 --> 01:09:11,749 returned by referencing the variable and one of the usages will be basically just 3587 01:09:11,749 --> 01:09:11,759 one of the usages will be basically just 3588 01:09:11,759 --> 01:09:12,709 one of the usages will be basically just to print it 3589 01:09:12,709 --> 01:09:12,719 to print it 3590 01:09:12,719 --> 01:09:16,789 to print it just like we did before like this let's 3591 01:09:16,789 --> 01:09:16,799 just like we did before like this let's 3592 01:09:16,799 --> 01:09:19,990 just like we did before like this let's delete it temporarily and 3593 01:09:19,990 --> 01:09:20,000 delete it temporarily and 3594 01:09:20,000 --> 01:09:23,510 delete it temporarily and test our program 3595 01:09:23,510 --> 01:09:23,520 test our program 3596 01:09:23,520 --> 01:09:25,749 test our program and there you go you see that this 3597 01:09:25,749 --> 01:09:25,759 and there you go you see that this 3598 01:09:25,759 --> 01:09:26,630 and there you go you see that this function 3599 01:09:26,630 --> 01:09:26,640 function 3600 01:09:26,640 --> 01:09:29,749 function got executed with input 20 3601 01:09:29,749 --> 01:09:29,759 got executed with input 20 3602 01:09:29,759 --> 01:09:33,110 got executed with input 20 this text this display text basically 3603 01:09:33,110 --> 01:09:33,120 this text this display text basically 3604 01:09:33,120 --> 01:09:35,829 this text this display text basically was put together in the function and was 3605 01:09:35,829 --> 01:09:35,839 was put together in the function and was 3606 01:09:35,839 --> 01:09:37,829 was put together in the function and was returned or was given back 3607 01:09:37,829 --> 01:09:37,839 returned or was given back 3608 01:09:37,839 --> 01:09:41,349 returned or was given back as a result and we saved that 3609 01:09:41,349 --> 01:09:41,359 as a result and we saved that 3610 01:09:41,359 --> 01:09:43,189 as a result and we saved that this whole string basically this whole 3611 01:09:43,189 --> 01:09:43,199 this whole string basically this whole 3612 01:09:43,199 --> 01:09:45,829 this whole string basically this whole sentence in a variable called myvar 3613 01:09:45,829 --> 01:09:45,839 sentence in a variable called myvar 3614 01:09:45,839 --> 01:09:48,630 sentence in a variable called myvar and when we print that myvar we see that 3615 01:09:48,630 --> 01:09:48,640 and when we print that myvar we see that 3616 01:09:48,640 --> 01:09:49,189 and when we print that myvar we see that value 3617 01:09:49,189 --> 01:09:49,199 value 3618 01:09:49,199 --> 01:09:52,229 value printed out here and again if we enter 3619 01:09:52,229 --> 01:09:52,239 printed out here and again if we enter 3620 01:09:52,239 --> 01:09:55,189 printed out here and again if we enter some other value we would get different 3621 01:09:55,189 --> 01:09:55,199 some other value we would get different 3622 01:09:55,199 --> 01:09:55,669 some other value we would get different text 3623 01:09:55,669 --> 01:09:55,679 text 3624 01:09:55,679 --> 01:09:57,910 text and again that is actually a very 3625 01:09:57,910 --> 01:09:57,920 and again that is actually a very 3626 01:09:57,920 --> 01:09:59,270 and again that is actually a very important concept 3627 01:09:59,270 --> 01:09:59,280 important concept 3628 01:09:59,280 --> 01:10:02,229 important concept of giving back some results from a 3629 01:10:02,229 --> 01:10:02,239 of giving back some results from a 3630 01:10:02,239 --> 01:10:04,229 of giving back some results from a function execution and you saw in our 3631 01:10:04,229 --> 01:10:04,239 function execution and you saw in our 3632 01:10:04,239 --> 01:10:05,270 function execution and you saw in our examples that 3633 01:10:05,270 --> 01:10:05,280 examples that 3634 01:10:05,280 --> 01:10:06,870 examples that you can have a function that doesn't 3635 01:10:06,870 --> 01:10:06,880 you can have a function that doesn't 3636 01:10:06,880 --> 01:10:09,189 you can have a function that doesn't return a value just print something on 3637 01:10:09,189 --> 01:10:09,199 return a value just print something on 3638 01:10:09,199 --> 01:10:11,110 return a value just print something on maybe does something else 3639 01:10:11,110 --> 01:10:11,120 maybe does something else 3640 01:10:11,120 --> 01:10:14,070 maybe does something else or function that returns some value you 3641 01:10:14,070 --> 01:10:14,080 or function that returns some value you 3642 01:10:14,080 --> 01:10:14,550 or function that returns some value you can have 3643 01:10:14,550 --> 01:10:14,560 can have 3644 01:10:14,560 --> 01:10:18,550 can have both types 3645 01:10:21,750 --> 01:10:21,760 so back to our example of 3646 01:10:21,760 --> 01:10:24,470 so back to our example of user input so now hopefully it makes 3647 01:10:24,470 --> 01:10:24,480 user input so now hopefully it makes 3648 01:10:24,480 --> 01:10:25,350 user input so now hopefully it makes sense 3649 01:10:25,350 --> 01:10:25,360 sense 3650 01:10:25,360 --> 01:10:28,709 sense that input function returns 3651 01:10:28,709 --> 01:10:28,719 that input function returns 3652 01:10:28,719 --> 01:10:31,430 that input function returns whatever value the user entered as a 3653 01:10:31,430 --> 01:10:31,440 whatever value the user entered as a 3654 01:10:31,440 --> 01:10:33,110 whatever value the user entered as a result and we can 3655 01:10:33,110 --> 01:10:33,120 result and we can 3656 01:10:33,120 --> 01:10:35,430 result and we can save it in a variable and then access it 3657 01:10:35,430 --> 01:10:35,440 save it in a variable and then access it 3658 01:10:35,440 --> 01:10:36,790 save it in a variable and then access it later again let's 3659 01:10:36,790 --> 01:10:36,800 later again let's 3660 01:10:36,800 --> 01:10:39,669 later again let's get rid of this line and now let's 3661 01:10:39,669 --> 01:10:39,679 get rid of this line and now let's 3662 01:10:39,679 --> 01:10:41,350 get rid of this line and now let's actually do the calculation 3663 01:10:41,350 --> 01:10:41,360 actually do the calculation 3664 01:10:41,360 --> 01:10:44,470 actually do the calculation on the user input number of days how do 3665 01:10:44,470 --> 01:10:44,480 on the user input number of days how do 3666 01:10:44,480 --> 01:10:46,070 on the user input number of days how do we calculate number of days 3667 01:10:46,070 --> 01:10:46,080 we calculate number of days 3668 01:10:46,080 --> 01:10:48,790 we calculate number of days very simple by calling our function that 3669 01:10:48,790 --> 01:10:48,800 very simple by calling our function that 3670 01:10:48,800 --> 01:10:49,510 very simple by calling our function that actually 3671 01:10:49,510 --> 01:10:49,520 actually 3672 01:10:49,520 --> 01:10:52,709 actually does that so we're going to call our 3673 01:10:52,709 --> 01:10:52,719 does that so we're going to call our 3674 01:10:52,719 --> 01:10:53,510 does that so we're going to call our function 3675 01:10:53,510 --> 01:10:53,520 function 3676 01:10:53,520 --> 01:10:56,550 function to calculate the number of hours for 3677 01:10:56,550 --> 01:10:56,560 to calculate the number of hours for 3678 01:10:56,560 --> 01:10:59,430 to calculate the number of hours for an input and the parameter that we 3679 01:10:59,430 --> 01:10:59,440 an input and the parameter that we 3680 01:10:59,440 --> 01:10:59,830 an input and the parameter that we passed 3681 01:10:59,830 --> 01:10:59,840 passed 3682 01:10:59,840 --> 01:11:02,070 passed in is going to be whatever the user 3683 01:11:02,070 --> 01:11:02,080 in is going to be whatever the user 3684 01:11:02,080 --> 01:11:02,870 in is going to be whatever the user provided 3685 01:11:02,870 --> 01:11:02,880 provided 3686 01:11:02,880 --> 01:11:05,510 provided so instead of basically hard coding a 3687 01:11:05,510 --> 01:11:05,520 so instead of basically hard coding a 3688 01:11:05,520 --> 01:11:06,229 so instead of basically hard coding a value here 3689 01:11:06,229 --> 01:11:06,239 value here 3690 01:11:06,239 --> 01:11:09,270 value here ourselves we give it a value that user 3691 01:11:09,270 --> 01:11:09,280 ourselves we give it a value that user 3692 01:11:09,280 --> 01:11:12,149 ourselves we give it a value that user provided instead so the num of days will 3693 01:11:12,149 --> 01:11:12,159 provided instead so the num of days will 3694 01:11:12,159 --> 01:11:12,550 provided instead so the num of days will be 3695 01:11:12,550 --> 01:11:12,560 be 3696 01:11:12,560 --> 01:11:15,669 be the user input and now again because 3697 01:11:15,669 --> 01:11:15,679 the user input and now again because 3698 01:11:15,679 --> 01:11:16,709 the user input and now again because this function 3699 01:11:16,709 --> 01:11:16,719 this function 3700 01:11:16,719 --> 01:11:20,229 this function returns the whole string it doesn't 3701 01:11:20,229 --> 01:11:20,239 returns the whole string it doesn't 3702 01:11:20,239 --> 01:11:21,110 returns the whole string it doesn't print it 3703 01:11:21,110 --> 01:11:21,120 print it 3704 01:11:21,120 --> 01:11:24,149 print it remember it just returns it so when i 3705 01:11:24,149 --> 01:11:24,159 remember it just returns it so when i 3706 01:11:24,159 --> 01:11:27,270 remember it just returns it so when i execute this and i provide in 3707 01:11:27,270 --> 01:11:27,280 execute this and i provide in 3708 01:11:27,280 --> 01:11:30,709 execute this and i provide in some value that's to 200 you see that 3709 01:11:30,709 --> 01:11:30,719 some value that's to 200 you see that 3710 01:11:30,719 --> 01:11:33,350 some value that's to 200 you see that i don't have any output here because we 3711 01:11:33,350 --> 01:11:33,360 i don't have any output here because we 3712 01:11:33,360 --> 01:11:34,950 i don't have any output here because we didn't print anything we 3713 01:11:34,950 --> 01:11:34,960 didn't print anything we 3714 01:11:34,960 --> 01:11:37,590 didn't print anything we basically just returned the value here 3715 01:11:37,590 --> 01:11:37,600 basically just returned the value here 3716 01:11:37,600 --> 01:11:38,229 basically just returned the value here we didn't do 3717 01:11:38,229 --> 01:11:38,239 we didn't do 3718 01:11:38,239 --> 01:11:40,470 we didn't do anything with it so the last piece 3719 01:11:40,470 --> 01:11:40,480 anything with it so the last piece 3720 01:11:40,480 --> 01:11:41,590 anything with it so the last piece missing here is 3721 01:11:41,590 --> 01:11:41,600 missing here is 3722 01:11:41,600 --> 01:11:44,709 missing here is to display the text the string that 3723 01:11:44,709 --> 01:11:44,719 to display the text the string that 3724 01:11:44,719 --> 01:11:47,830 to display the text the string that function returns so we save that 3725 01:11:47,830 --> 01:11:47,840 function returns so we save that 3726 01:11:47,840 --> 01:11:52,830 function returns so we save that return value first let's do calculated 3727 01:11:52,830 --> 01:11:52,840 return value first let's do calculated 3728 01:11:52,840 --> 01:11:56,390 return value first let's do calculated value so we save this thing 3729 01:11:56,390 --> 01:11:56,400 value so we save this thing 3730 01:11:56,400 --> 01:11:59,510 value so we save this thing in calculated value variable and 3731 01:11:59,510 --> 01:11:59,520 in calculated value variable and 3732 01:11:59,520 --> 01:12:02,950 in calculated value variable and finally we can print it and now let's 3733 01:12:02,950 --> 01:12:02,960 finally we can print it and now let's 3734 01:12:02,960 --> 01:12:03,990 finally we can print it and now let's execute it and 3735 01:12:03,990 --> 01:12:04,000 execute it and 3736 01:12:04,000 --> 01:12:06,470 execute it and let's see what happens i'm going to type 3737 01:12:06,470 --> 01:12:06,480 let's see what happens i'm going to type 3738 01:12:06,480 --> 01:12:07,110 let's see what happens i'm going to type in 3739 01:12:07,110 --> 01:12:07,120 in 3740 01:12:07,120 --> 01:12:11,189 in 10 10 days and let's see what we get now 3741 01:12:11,189 --> 01:12:11,199 10 10 days and let's see what we get now 3742 01:12:11,199 --> 01:12:13,990 10 10 days and let's see what we get now and you see we have this weird value 3743 01:12:13,990 --> 01:12:14,000 and you see we have this weird value 3744 01:12:14,000 --> 01:12:14,550 and you see we have this weird value here 3745 01:12:14,550 --> 01:12:14,560 here 3746 01:12:14,560 --> 01:12:17,830 here as a result of the calculation so what 3747 01:12:17,830 --> 01:12:17,840 as a result of the calculation so what 3748 01:12:17,840 --> 01:12:18,950 as a result of the calculation so what exactly happened 3749 01:12:18,950 --> 01:12:18,960 exactly happened 3750 01:12:18,960 --> 01:12:21,990 exactly happened so this part of calculation basically 3751 01:12:21,990 --> 01:12:22,000 so this part of calculation basically 3752 01:12:22,000 --> 01:12:24,630 so this part of calculation basically which represents this number didn't do a 3753 01:12:24,630 --> 01:12:24,640 which represents this number didn't do a 3754 01:12:24,640 --> 01:12:25,830 which represents this number didn't do a proper calculation 3755 01:12:25,830 --> 01:12:25,840 proper calculation 3756 01:12:25,840 --> 01:12:28,149 proper calculation and the reason for that is because the 3757 01:12:28,149 --> 01:12:28,159 and the reason for that is because the 3758 01:12:28,159 --> 01:12:29,910 and the reason for that is because the input value that we get 3759 01:12:29,910 --> 01:12:29,920 input value that we get 3760 01:12:29,920 --> 01:12:33,669 input value that we get with inputs function is always 3761 01:12:33,669 --> 01:12:33,679 with inputs function is always 3762 01:12:33,679 --> 01:12:36,950 with inputs function is always treated as a string and not a number so 3763 01:12:36,950 --> 01:12:36,960 treated as a string and not a number so 3764 01:12:36,960 --> 01:12:38,070 treated as a string and not a number so basically 3765 01:12:38,070 --> 01:12:38,080 basically 3766 01:12:38,080 --> 01:12:42,550 basically at this place here number of days inputs 3767 01:12:42,550 --> 01:12:42,560 at this place here number of days inputs 3768 01:12:42,560 --> 01:12:45,830 at this place here number of days inputs 10 here is actually treated as a 3769 01:12:45,830 --> 01:12:45,840 10 here is actually treated as a 3770 01:12:45,840 --> 01:12:48,149 10 here is actually treated as a text and not a number and where this 3771 01:12:48,149 --> 01:12:48,159 text and not a number and where this 3772 01:12:48,159 --> 01:12:50,790 text and not a number and where this weird result comes from is basically 3773 01:12:50,790 --> 01:12:50,800 weird result comes from is basically 3774 01:12:50,800 --> 01:12:54,149 weird result comes from is basically number 10 printed out 24 3775 01:12:54,149 --> 01:12:54,159 number 10 printed out 24 3776 01:12:54,159 --> 01:12:56,950 number 10 printed out 24 times so instead of doing the actual 3777 01:12:56,950 --> 01:12:56,960 times so instead of doing the actual 3778 01:12:56,960 --> 01:12:59,189 times so instead of doing the actual calculation 10 times 24 3779 01:12:59,189 --> 01:12:59,199 calculation 10 times 24 3780 01:12:59,199 --> 01:13:01,669 calculation 10 times 24 10 is printed 24 times and that's what 3781 01:13:01,669 --> 01:13:01,679 10 is printed 24 times and that's what 3782 01:13:01,679 --> 01:13:03,990 10 is printed 24 times and that's what happens when this is interpreted as 3783 01:13:03,990 --> 01:13:04,000 happens when this is interpreted as 3784 01:13:04,000 --> 01:13:07,750 happens when this is interpreted as a string so how do we make python 3785 01:13:07,750 --> 01:13:07,760 a string so how do we make python 3786 01:13:07,760 --> 01:13:11,110 a string so how do we make python see that number see that input value as 3787 01:13:11,110 --> 01:13:11,120 see that number see that input value as 3788 01:13:11,120 --> 01:13:14,550 see that number see that input value as a number as an integer and not a 3789 01:13:14,550 --> 01:13:14,560 a number as an integer and not a 3790 01:13:14,560 --> 01:13:16,390 a number as an integer and not a text or not as a string and it's 3791 01:13:16,390 --> 01:13:16,400 text or not as a string and it's 3792 01:13:16,400 --> 01:13:18,550 text or not as a string and it's actually pretty easy to do 3793 01:13:18,550 --> 01:13:18,560 actually pretty easy to do 3794 01:13:18,560 --> 01:13:21,510 actually pretty easy to do on the next line the user inputs again 3795 01:13:21,510 --> 01:13:21,520 on the next line the user inputs again 3796 01:13:21,520 --> 01:13:22,229 on the next line the user inputs again we saw 3797 01:13:22,229 --> 01:13:22,239 we saw 3798 01:13:22,239 --> 01:13:25,910 we saw right here it is a string so we have to 3799 01:13:25,910 --> 01:13:25,920 right here it is a string so we have to 3800 01:13:25,920 --> 01:13:28,310 right here it is a string so we have to make it into a number and we're going to 3801 01:13:28,310 --> 01:13:28,320 make it into a number and we're going to 3802 01:13:28,320 --> 01:13:28,950 make it into a number and we're going to do that 3803 01:13:28,950 --> 01:13:28,960 do that 3804 01:13:28,960 --> 01:13:33,590 do that using int and user input 3805 01:13:33,590 --> 01:13:33,600 using int and user input 3806 01:13:33,600 --> 01:13:36,390 using int and user input and that process of turning a value from 3807 01:13:36,390 --> 01:13:36,400 and that process of turning a value from 3808 01:13:36,400 --> 01:13:38,390 and that process of turning a value from one data type into another 3809 01:13:38,390 --> 01:13:38,400 one data type into another 3810 01:13:38,400 --> 01:13:41,030 one data type into another is called casting if you remember we 3811 01:13:41,030 --> 01:13:41,040 is called casting if you remember we 3812 01:13:41,040 --> 01:13:42,950 is called casting if you remember we already saw an example of it when we 3813 01:13:42,950 --> 01:13:42,960 already saw an example of it when we 3814 01:13:42,960 --> 01:13:43,350 already saw an example of it when we turned 3815 01:13:43,350 --> 01:13:43,360 turned 3816 01:13:43,360 --> 01:13:47,030 turned a number into a string in the string 3817 01:13:47,030 --> 01:13:47,040 a number into a string in the string 3818 01:13:47,040 --> 01:13:48,950 a number into a string in the string concatenation example 3819 01:13:48,950 --> 01:13:48,960 concatenation example 3820 01:13:48,960 --> 01:13:50,950 concatenation example again from the syntax you should already 3821 01:13:50,950 --> 01:13:50,960 again from the syntax you should already 3822 01:13:50,960 --> 01:13:52,790 again from the syntax you should already know that this is a function 3823 01:13:52,790 --> 01:13:52,800 know that this is a function 3824 01:13:52,800 --> 01:13:54,870 know that this is a function call so we're calling a function called 3825 01:13:54,870 --> 01:13:54,880 call so we're calling a function called 3826 01:13:54,880 --> 01:13:55,830 call so we're calling a function called int again 3827 01:13:55,830 --> 01:13:55,840 int again 3828 01:13:55,840 --> 01:13:58,310 int again that python itself provides us with 3829 01:13:58,310 --> 01:13:58,320 that python itself provides us with 3830 01:13:58,320 --> 01:13:59,910 that python itself provides us with because we didn't write that function 3831 01:13:59,910 --> 01:13:59,920 because we didn't write that function 3832 01:13:59,920 --> 01:14:01,270 because we didn't write that function and we're passing in 3833 01:14:01,270 --> 01:14:01,280 and we're passing in 3834 01:14:01,280 --> 01:14:03,830 and we're passing in one parameter which is a string and we 3835 01:14:03,830 --> 01:14:03,840 one parameter which is a string and we 3836 01:14:03,840 --> 01:14:04,630 one parameter which is a string and we should 3837 01:14:04,630 --> 01:14:04,640 should 3838 01:14:04,640 --> 01:14:07,510 should get an integer from that string as a 3839 01:14:07,510 --> 01:14:07,520 get an integer from that string as a 3840 01:14:07,520 --> 01:14:08,310 get an integer from that string as a result 3841 01:14:08,310 --> 01:14:08,320 result 3842 01:14:08,320 --> 01:14:10,630 result and we can save that number into a 3843 01:14:10,630 --> 01:14:10,640 and we can save that number into a 3844 01:14:10,640 --> 01:14:12,830 and we can save that number into a variable and let's call it user 3845 01:14:12,830 --> 01:14:12,840 variable and let's call it user 3846 01:14:12,840 --> 01:14:16,149 variable and let's call it user input number and 3847 01:14:16,149 --> 01:14:16,159 input number and 3848 01:14:16,159 --> 01:14:19,189 input number and now we have 10 as a number instead of as 3849 01:14:19,189 --> 01:14:19,199 now we have 10 as a number instead of as 3850 01:14:19,199 --> 01:14:19,830 now we have 10 as a number instead of as a string 3851 01:14:19,830 --> 01:14:19,840 a string 3852 01:14:19,840 --> 01:14:21,990 a string and instead of passing in that string 3853 01:14:21,990 --> 01:14:22,000 and instead of passing in that string 3854 01:14:22,000 --> 01:14:23,510 and instead of passing in that string user input we can 3855 01:14:23,510 --> 01:14:23,520 user input we can 3856 01:14:23,520 --> 01:14:26,550 user input we can now give our function number 3857 01:14:26,550 --> 01:14:26,560 now give our function number 3858 01:14:26,560 --> 01:14:29,430 now give our function number that it expects let's save it and 3859 01:14:29,430 --> 01:14:29,440 that it expects let's save it and 3860 01:14:29,440 --> 01:14:31,110 that it expects let's save it and execute 3861 01:14:31,110 --> 01:14:31,120 execute 3862 01:14:31,120 --> 01:14:34,310 execute let's put in 10 and there you go now the 3863 01:14:34,310 --> 01:14:34,320 let's put in 10 and there you go now the 3864 01:14:34,320 --> 01:14:35,350 let's put in 10 and there you go now the calculation 3865 01:14:35,350 --> 01:14:35,360 calculation 3866 01:14:35,360 --> 01:14:38,709 calculation is correct what i want to show you now 3867 01:14:38,709 --> 01:14:38,719 is correct what i want to show you now 3868 01:14:38,719 --> 01:14:41,910 is correct what i want to show you now is how this user input actually works 3869 01:14:41,910 --> 01:14:41,920 is how this user input actually works 3870 01:14:41,920 --> 01:14:42,870 is how this user input actually works without 3871 01:14:42,870 --> 01:14:42,880 without 3872 01:14:42,880 --> 01:14:46,470 without a code editor like pycharm so i'm gonna 3873 01:14:46,470 --> 01:14:46,480 a code editor like pycharm so i'm gonna 3874 01:14:46,480 --> 01:14:49,189 a code editor like pycharm so i'm gonna copy all this code and let's go back to 3875 01:14:49,189 --> 01:14:49,199 copy all this code and let's go back to 3876 01:14:49,199 --> 01:14:52,149 copy all this code and let's go back to our terminal 3877 01:15:03,110 --> 01:15:03,120 i'm going to paste in our code 3878 01:15:03,120 --> 01:15:06,229 i'm going to paste in our code and save and let's now actually 3879 01:15:06,229 --> 01:15:06,239 and save and let's now actually 3880 01:15:06,239 --> 01:15:08,709 and save and let's now actually see how the user input works when we 3881 01:15:08,709 --> 01:15:08,719 see how the user input works when we 3882 01:15:08,719 --> 01:15:09,750 see how the user input works when we execute it 3883 01:15:09,750 --> 01:15:09,760 execute it 3884 01:15:09,760 --> 01:15:12,870 execute it in a simple terminal window and as you 3885 01:15:12,870 --> 01:15:12,880 in a simple terminal window and as you 3886 01:15:12,880 --> 01:15:15,030 in a simple terminal window and as you see here we have the message first 3887 01:15:15,030 --> 01:15:15,040 see here we have the message first 3888 01:15:15,040 --> 01:15:17,910 see here we have the message first and the prompt is right here so we can 3889 01:15:17,910 --> 01:15:17,920 and the prompt is right here so we can 3890 01:15:17,920 --> 01:15:19,189 and the prompt is right here so we can enter a value 3891 01:15:19,189 --> 01:15:19,199 enter a value 3892 01:15:19,199 --> 01:15:22,630 enter a value let's do 25 enter 3893 01:15:22,630 --> 01:15:22,640 let's do 25 enter 3894 01:15:22,640 --> 01:15:26,070 let's do 25 enter and we have a result 25 days are 3895 01:15:26,070 --> 01:15:26,080 and we have a result 25 days are 3896 01:15:26,080 --> 01:15:30,950 and we have a result 25 days are 600 hours 3897 01:15:33,510 --> 01:15:33,520 great so our program is working it is 3898 01:15:33,520 --> 01:15:34,550 great so our program is working it is converting 3899 01:15:34,550 --> 01:15:34,560 converting 3900 01:15:34,560 --> 01:15:37,669 converting the number of days to number of hours 3901 01:15:37,669 --> 01:15:37,679 the number of days to number of hours 3902 01:15:37,679 --> 01:15:40,550 the number of days to number of hours and accepts a user input now what 3903 01:15:40,550 --> 01:15:40,560 and accepts a user input now what 3904 01:15:40,560 --> 01:15:41,110 and accepts a user input now what happens 3905 01:15:41,110 --> 01:15:41,120 happens 3906 01:15:41,120 --> 01:15:45,350 happens if a user enters an invalid value here 3907 01:15:45,350 --> 01:15:45,360 if a user enters an invalid value here 3908 01:15:45,360 --> 01:15:47,990 if a user enters an invalid value here so for example instead of a positive 3909 01:15:47,990 --> 01:15:48,000 so for example instead of a positive 3910 01:15:48,000 --> 01:15:49,350 so for example instead of a positive value for number of days 3911 01:15:49,350 --> 01:15:49,360 value for number of days 3912 01:15:49,360 --> 01:15:52,470 value for number of days maybe they enter a negative value like 3913 01:15:52,470 --> 01:15:52,480 maybe they enter a negative value like 3914 01:15:52,480 --> 01:15:55,669 maybe they enter a negative value like -10 for example and obviously 3915 01:15:55,669 --> 01:15:55,679 -10 for example and obviously 3916 01:15:55,679 --> 01:15:58,229 -10 for example and obviously that input value doesn't make any sense 3917 01:15:58,229 --> 01:15:58,239 that input value doesn't make any sense 3918 01:15:58,239 --> 01:15:59,830 that input value doesn't make any sense but we are still 3919 01:15:59,830 --> 01:15:59,840 but we are still 3920 01:15:59,840 --> 01:16:02,950 but we are still calculating and giving a value right and 3921 01:16:02,950 --> 01:16:02,960 calculating and giving a value right and 3922 01:16:02,960 --> 01:16:04,550 calculating and giving a value right and this is another 3923 01:16:04,550 --> 01:16:04,560 this is another 3924 01:16:04,560 --> 01:16:07,270 this is another important concept in programming 3925 01:16:07,270 --> 01:16:07,280 important concept in programming 3926 01:16:07,280 --> 01:16:08,149 important concept in programming generally 3927 01:16:08,149 --> 01:16:08,159 generally 3928 01:16:08,159 --> 01:16:11,669 generally that when we allow users to give our 3929 01:16:11,669 --> 01:16:11,679 that when we allow users to give our 3930 01:16:11,679 --> 01:16:12,310 that when we allow users to give our program 3931 01:16:12,310 --> 01:16:12,320 program 3932 01:16:12,320 --> 01:16:14,950 program some input value we also want to 3933 01:16:14,950 --> 01:16:14,960 some input value we also want to 3934 01:16:14,960 --> 01:16:16,149 some input value we also want to restrict them 3935 01:16:16,149 --> 01:16:16,159 restrict them 3936 01:16:16,159 --> 01:16:19,430 restrict them and basically validate that what they 3937 01:16:19,430 --> 01:16:19,440 and basically validate that what they 3938 01:16:19,440 --> 01:16:22,950 and basically validate that what they provided as input is a valid value for 3939 01:16:22,950 --> 01:16:22,960 provided as input is a valid value for 3940 01:16:22,960 --> 01:16:24,709 provided as input is a valid value for our program specifically 3941 01:16:24,709 --> 01:16:24,719 our program specifically 3942 01:16:24,719 --> 01:16:28,149 our program specifically one that it makes sense like in our case 3943 01:16:28,149 --> 01:16:28,159 one that it makes sense like in our case 3944 01:16:28,159 --> 01:16:30,709 one that it makes sense like in our case -10 program still does a calculation but 3945 01:16:30,709 --> 01:16:30,719 -10 program still does a calculation but 3946 01:16:30,719 --> 01:16:32,229 -10 program still does a calculation but it doesn't really make sense 3947 01:16:32,229 --> 01:16:32,239 it doesn't really make sense 3948 01:16:32,239 --> 01:16:35,669 it doesn't really make sense and second it doesn't crash our program 3949 01:16:35,669 --> 01:16:35,679 and second it doesn't crash our program 3950 01:16:35,679 --> 01:16:36,229 and second it doesn't crash our program right 3951 01:16:36,229 --> 01:16:36,239 right 3952 01:16:36,239 --> 01:16:38,470 right so now let's see what happens if we 3953 01:16:38,470 --> 01:16:38,480 so now let's see what happens if we 3954 01:16:38,480 --> 01:16:39,590 so now let's see what happens if we enter 3955 01:16:39,590 --> 01:16:39,600 enter 3956 01:16:39,600 --> 01:16:42,709 enter some text here you see 3957 01:16:42,709 --> 01:16:42,719 some text here you see 3958 01:16:42,719 --> 01:16:44,790 some text here you see that the calculation didn't happen 3959 01:16:44,790 --> 01:16:44,800 that the calculation didn't happen 3960 01:16:44,800 --> 01:16:45,750 that the calculation didn't happen because 3961 01:16:45,750 --> 01:16:45,760 because 3962 01:16:45,760 --> 01:16:48,149 because we basically crashed the program 3963 01:16:48,149 --> 01:16:48,159 we basically crashed the program 3964 01:16:48,159 --> 01:16:49,270 we basically crashed the program application 3965 01:16:49,270 --> 01:16:49,280 application 3966 01:16:49,280 --> 01:16:52,709 application using that invalid user input does make 3967 01:16:52,709 --> 01:16:52,719 using that invalid user input does make 3968 01:16:52,719 --> 01:16:53,510 using that invalid user input does make sense 3969 01:16:53,510 --> 01:16:53,520 sense 3970 01:16:53,520 --> 01:16:56,870 sense or an input that crashes our application 3971 01:16:56,870 --> 01:16:56,880 or an input that crashes our application 3972 01:16:56,880 --> 01:16:58,470 or an input that crashes our application because the calculation isn't even 3973 01:16:58,470 --> 01:16:58,480 because the calculation isn't even 3974 01:16:58,480 --> 01:16:59,350 because the calculation isn't even possible 3975 01:16:59,350 --> 01:16:59,360 possible 3976 01:16:59,360 --> 01:17:02,630 possible and we want to avoid users basically 3977 01:17:02,630 --> 01:17:02,640 and we want to avoid users basically 3978 01:17:02,640 --> 01:17:05,510 and we want to avoid users basically either providing a nonsense value or a 3979 01:17:05,510 --> 01:17:05,520 either providing a nonsense value or a 3980 01:17:05,520 --> 01:17:07,910 either providing a nonsense value or a value that will crash our application 3981 01:17:07,910 --> 01:17:07,920 value that will crash our application 3982 01:17:07,920 --> 01:17:11,030 value that will crash our application so we need to validate user input 3983 01:17:11,030 --> 01:17:11,040 so we need to validate user input 3984 01:17:11,040 --> 01:17:13,590 so we need to validate user input and this is again important concept in 3985 01:17:13,590 --> 01:17:13,600 and this is again important concept in 3986 01:17:13,600 --> 01:17:14,709 and this is again important concept in program because 3987 01:17:14,709 --> 01:17:14,719 program because 3988 01:17:14,719 --> 01:17:17,750 program because whenever you allow user input you always 3989 01:17:17,750 --> 01:17:17,760 whenever you allow user input you always 3990 01:17:17,760 --> 01:17:20,630 whenever you allow user input you always have to validate it so in this part 3991 01:17:20,630 --> 01:17:20,640 have to validate it so in this part 3992 01:17:20,640 --> 01:17:21,750 have to validate it so in this part we're going to learn 3993 01:17:21,750 --> 01:17:21,760 we're going to learn 3994 01:17:21,760 --> 01:17:24,390 we're going to learn concept called conditionals and we're 3995 01:17:24,390 --> 01:17:24,400 concept called conditionals and we're 3996 01:17:24,400 --> 01:17:25,830 concept called conditionals and we're going to learn this concept 3997 01:17:25,830 --> 01:17:25,840 going to learn this concept 3998 01:17:25,840 --> 01:17:28,830 going to learn this concept with an example of validating a user 3999 01:17:28,830 --> 01:17:28,840 with an example of validating a user 4000 01:17:28,840 --> 01:17:30,550 with an example of validating a user input so 4001 01:17:30,550 --> 01:17:30,560 input so 4002 01:17:30,560 --> 01:17:32,709 input so where are we going to do the user input 4003 01:17:32,709 --> 01:17:32,719 where are we going to do the user input 4004 01:17:32,719 --> 01:17:34,470 where are we going to do the user input validation we can do it 4005 01:17:34,470 --> 01:17:34,480 validation we can do it 4006 01:17:34,480 --> 01:17:37,669 validation we can do it in our function right before we 4007 01:17:37,669 --> 01:17:37,679 in our function right before we 4008 01:17:37,679 --> 01:17:40,630 in our function right before we actually do the calculation we can first 4009 01:17:40,630 --> 01:17:40,640 actually do the calculation we can first 4010 01:17:40,640 --> 01:17:41,510 actually do the calculation we can first validate 4011 01:17:41,510 --> 01:17:41,520 validate 4012 01:17:41,520 --> 01:17:44,229 validate is it a positive number and not a 4013 01:17:44,229 --> 01:17:44,239 is it a positive number and not a 4014 01:17:44,239 --> 01:17:46,870 is it a positive number and not a negative one 4015 01:17:46,870 --> 01:17:46,880 negative one 4016 01:17:46,880 --> 01:17:49,990 negative one so user gives us their input we 4017 01:17:49,990 --> 01:17:50,000 so user gives us their input we 4018 01:17:50,000 --> 01:17:52,950 so user gives us their input we convert it to a number and then we pass 4019 01:17:52,950 --> 01:17:52,960 convert it to a number and then we pass 4020 01:17:52,960 --> 01:17:53,830 convert it to a number and then we pass that number 4021 01:17:53,830 --> 01:17:53,840 that number 4022 01:17:53,840 --> 01:17:57,110 that number to our function so negative 10 4023 01:17:57,110 --> 01:17:57,120 to our function so negative 10 4024 01:17:57,120 --> 01:18:00,229 to our function so negative 10 positive 10 that is a number basically 4025 01:18:00,229 --> 01:18:00,239 positive 10 that is a number basically 4026 01:18:00,239 --> 01:18:00,790 positive 10 that is a number basically will be 4027 01:18:00,790 --> 01:18:00,800 will be 4028 01:18:00,800 --> 01:18:03,830 will be passed on to our function and right here 4029 01:18:03,830 --> 01:18:03,840 passed on to our function and right here 4030 01:18:03,840 --> 01:18:07,030 passed on to our function and right here we can check whether this 4031 01:18:07,030 --> 01:18:07,040 we can check whether this 4032 01:18:07,040 --> 01:18:09,910 we can check whether this variable value here is a negative number 4033 01:18:09,910 --> 01:18:09,920 variable value here is a negative number 4034 01:18:09,920 --> 01:18:11,030 variable value here is a negative number or not 4035 01:18:11,030 --> 01:18:11,040 or not 4036 01:18:11,040 --> 01:18:14,310 or not how do we do that we do that using 4037 01:18:14,310 --> 01:18:14,320 how do we do that we do that using 4038 01:18:14,320 --> 01:18:18,149 how do we do that we do that using if else conditional statements so 4039 01:18:18,149 --> 01:18:18,159 if else conditional statements so 4040 01:18:18,159 --> 01:18:21,830 if else conditional statements so very simple and intuitive to understand 4041 01:18:21,830 --> 01:18:21,840 very simple and intuitive to understand 4042 01:18:21,840 --> 01:18:24,870 very simple and intuitive to understand we say if number of days 4043 01:18:24,870 --> 01:18:24,880 we say if number of days 4044 01:18:24,880 --> 01:18:29,350 we say if number of days is greater than 0 4045 01:18:29,350 --> 01:18:29,360 is greater than 0 4046 01:18:29,360 --> 01:18:32,550 is greater than 0 means it is a positive number 4047 01:18:32,550 --> 01:18:32,560 means it is a positive number 4048 01:18:32,560 --> 01:18:35,189 means it is a positive number then we want to do the calculation and 4049 01:18:35,189 --> 01:18:35,199 then we want to do the calculation and 4050 01:18:35,199 --> 01:18:35,830 then we want to do the calculation and return 4051 01:18:35,830 --> 01:18:35,840 return 4052 01:18:35,840 --> 01:18:38,229 return all of this but you see that we have a 4053 01:18:38,229 --> 01:18:38,239 all of this but you see that we have a 4054 01:18:38,239 --> 01:18:39,189 all of this but you see that we have a red line here 4055 01:18:39,189 --> 01:18:39,199 red line here 4056 01:18:39,199 --> 01:18:42,149 red line here so basically whenever we use if 4057 01:18:42,149 --> 01:18:42,159 so basically whenever we use if 4058 01:18:42,159 --> 01:18:44,229 so basically whenever we use if condition we have to have a proper 4059 01:18:44,229 --> 01:18:44,239 condition we have to have a proper 4060 01:18:44,239 --> 01:18:46,470 condition we have to have a proper indentation so all of this line 4061 01:18:46,470 --> 01:18:46,480 indentation so all of this line 4062 01:18:46,480 --> 01:18:48,070 indentation so all of this line basically goes 4063 01:18:48,070 --> 01:18:48,080 basically goes 4064 01:18:48,080 --> 01:18:51,669 basically goes indented for this line kind of the same 4065 01:18:51,669 --> 01:18:51,679 indented for this line kind of the same 4066 01:18:51,679 --> 01:18:53,669 indented for this line kind of the same way as we indented 4067 01:18:53,669 --> 01:18:53,679 way as we indented 4068 01:18:53,679 --> 01:18:56,229 way as we indented the whole function body inside the 4069 01:18:56,229 --> 01:18:56,239 the whole function body inside the 4070 01:18:56,239 --> 01:18:57,030 the whole function body inside the function 4071 01:18:57,030 --> 01:18:57,040 function 4072 01:18:57,040 --> 01:18:59,990 function whatever logic and whatever code is 4073 01:18:59,990 --> 01:19:00,000 whatever logic and whatever code is 4074 01:19:00,000 --> 01:19:00,790 whatever logic and whatever code is right here 4075 01:19:00,790 --> 01:19:00,800 right here 4076 01:19:00,800 --> 01:19:03,830 right here indented below the if condition 4077 01:19:03,830 --> 01:19:03,840 indented below the if condition 4078 01:19:03,840 --> 01:19:07,750 indented below the if condition will be executed if number of days 4079 01:19:07,750 --> 01:19:07,760 will be executed if number of days 4080 01:19:07,760 --> 01:19:10,470 will be executed if number of days is really greater than zero so let's try 4081 01:19:10,470 --> 01:19:10,480 is really greater than zero so let's try 4082 01:19:10,480 --> 01:19:11,590 is really greater than zero so let's try that again 4083 01:19:11,590 --> 01:19:11,600 that again 4084 01:19:11,600 --> 01:19:14,470 that again i'm going to execute it let's put a 4085 01:19:14,470 --> 01:19:14,480 i'm going to execute it let's put a 4086 01:19:14,480 --> 01:19:15,990 i'm going to execute it let's put a positive 10 4087 01:19:15,990 --> 01:19:16,000 positive 10 4088 01:19:16,000 --> 01:19:19,110 positive 10 you see 10 days are 240 hours 4089 01:19:19,110 --> 01:19:19,120 you see 10 days are 240 hours 4090 01:19:19,120 --> 01:19:22,229 you see 10 days are 240 hours got calculated now let's put 4091 01:19:22,229 --> 01:19:22,239 got calculated now let's put 4092 01:19:22,239 --> 01:19:25,510 got calculated now let's put -10 as an input and you see none 4093 01:19:25,510 --> 01:19:25,520 -10 as an input and you see none 4094 01:19:25,520 --> 01:19:29,110 -10 as an input and you see none basically no output for us because 4095 01:19:29,110 --> 01:19:29,120 basically no output for us because 4096 01:19:29,120 --> 01:19:32,630 basically no output for us because this line didn't actually get executed 4097 01:19:32,630 --> 01:19:32,640 this line didn't actually get executed 4098 01:19:32,640 --> 01:19:35,910 this line didn't actually get executed for -10 input value now what if we want 4099 01:19:35,910 --> 01:19:35,920 for -10 input value now what if we want 4100 01:19:35,920 --> 01:19:37,189 for -10 input value now what if we want to tell a user 4101 01:19:37,189 --> 01:19:37,199 to tell a user 4102 01:19:37,199 --> 01:19:39,590 to tell a user hey this was an invalid value and that's 4103 01:19:39,590 --> 01:19:39,600 hey this was an invalid value and that's 4104 01:19:39,600 --> 01:19:41,510 hey this was an invalid value and that's why we didn't do the calculation 4105 01:19:41,510 --> 01:19:41,520 why we didn't do the calculation 4106 01:19:41,520 --> 01:19:45,030 why we didn't do the calculation instead of just showing none we can do 4107 01:19:45,030 --> 01:19:45,040 instead of just showing none we can do 4108 01:19:45,040 --> 01:19:45,669 instead of just showing none we can do that 4109 01:19:45,669 --> 01:19:45,679 that 4110 01:19:45,679 --> 01:19:48,390 that by returning this feedback message or 4111 01:19:48,390 --> 01:19:48,400 by returning this feedback message or 4112 01:19:48,400 --> 01:19:49,510 by returning this feedback message or error message 4113 01:19:49,510 --> 01:19:49,520 error message 4114 01:19:49,520 --> 01:19:52,709 error message whenever this is not true so whenever 4115 01:19:52,709 --> 01:19:52,719 whenever this is not true so whenever 4116 01:19:52,719 --> 01:19:54,229 whenever this is not true so whenever number of days is not 4117 01:19:54,229 --> 01:19:54,239 number of days is not 4118 01:19:54,239 --> 01:19:57,189 number of days is not greater than zero we want to return 4119 01:19:57,189 --> 01:19:57,199 greater than zero we want to return 4120 01:19:57,199 --> 01:19:59,270 greater than zero we want to return something else right another message 4121 01:19:59,270 --> 01:19:59,280 something else right another message 4122 01:19:59,280 --> 01:20:04,630 something else right another message and we can do that using else 4123 01:20:04,630 --> 01:20:04,640 and we can do that using else 4124 01:20:04,640 --> 01:20:07,270 and we can do that using else and the same way as for if we have the 4125 01:20:07,270 --> 01:20:07,280 and the same way as for if we have the 4126 01:20:07,280 --> 01:20:08,470 and the same way as for if we have the indentation 4127 01:20:08,470 --> 01:20:08,480 indentation 4128 01:20:08,480 --> 01:20:10,229 indentation and whatever we write here will be 4129 01:20:10,229 --> 01:20:10,239 and whatever we write here will be 4130 01:20:10,239 --> 01:20:12,709 and whatever we write here will be executed if number of days is not 4131 01:20:12,709 --> 01:20:12,719 executed if number of days is not 4132 01:20:12,719 --> 01:20:14,070 executed if number of days is not greater than zero 4133 01:20:14,070 --> 01:20:14,080 greater than zero 4134 01:20:14,080 --> 01:20:17,669 greater than zero so here we are gonna return 4135 01:20:17,669 --> 01:20:17,679 so here we are gonna return 4136 01:20:17,679 --> 01:20:21,830 so here we are gonna return you entered a negative 4137 01:20:21,830 --> 01:20:21,840 you entered a negative 4138 01:20:21,840 --> 01:20:24,870 you entered a negative value so no 4139 01:20:24,870 --> 01:20:24,880 value so no 4140 01:20:24,880 --> 01:20:28,070 value so no conversion for you 4141 01:20:28,070 --> 01:20:28,080 conversion for you 4142 01:20:28,080 --> 01:20:30,310 conversion for you and here it's time for another special 4143 01:20:30,310 --> 01:20:30,320 and here it's time for another special 4144 01:20:30,320 --> 01:20:32,870 and here it's time for another special term in programming that greater than 4145 01:20:32,870 --> 01:20:32,880 term in programming that greater than 4146 01:20:32,880 --> 01:20:33,350 term in programming that greater than sign 4147 01:20:33,350 --> 01:20:33,360 sign 4148 01:20:33,360 --> 01:20:36,229 sign is called a comparison operator and we 4149 01:20:36,229 --> 01:20:36,239 is called a comparison operator and we 4150 01:20:36,239 --> 01:20:38,310 is called a comparison operator and we have three of them we have greater than 4151 01:20:38,310 --> 01:20:38,320 have three of them we have greater than 4152 01:20:38,320 --> 01:20:40,310 have three of them we have greater than less than and equals and these are 4153 01:20:40,310 --> 01:20:40,320 less than and equals and these are 4154 01:20:40,320 --> 01:20:42,870 less than and equals and these are called comparison operators because 4155 01:20:42,870 --> 01:20:42,880 called comparison operators because 4156 01:20:42,880 --> 01:20:45,910 called comparison operators because they are used in an operation to compare 4157 01:20:45,910 --> 01:20:45,920 they are used in an operation to compare 4158 01:20:45,920 --> 01:20:47,110 they are used in an operation to compare two values 4159 01:20:47,110 --> 01:20:47,120 two values 4160 01:20:47,120 --> 01:20:49,590 two values and before in this course we learned 4161 01:20:49,590 --> 01:20:49,600 and before in this course we learned 4162 01:20:49,600 --> 01:20:51,430 and before in this course we learned arithmetic operations 4163 01:20:51,430 --> 01:20:51,440 arithmetic operations 4164 01:20:51,440 --> 01:20:54,950 arithmetic operations like plus minus divide multiply so again 4165 01:20:54,950 --> 01:20:54,960 like plus minus divide multiply so again 4166 01:20:54,960 --> 01:20:56,070 like plus minus divide multiply so again fancy words for 4167 01:20:56,070 --> 01:20:56,080 fancy words for 4168 01:20:56,080 --> 01:20:57,990 fancy words for simple concepts but these are the 4169 01:20:57,990 --> 01:20:58,000 simple concepts but these are the 4170 01:20:58,000 --> 01:20:59,669 simple concepts but these are the official terms for these 4171 01:20:59,669 --> 01:20:59,679 official terms for these 4172 01:20:59,679 --> 01:21:02,070 official terms for these so now if someone mentions them you will 4173 01:21:02,070 --> 01:21:02,080 so now if someone mentions them you will 4174 01:21:02,080 --> 01:21:04,149 so now if someone mentions them you will know what they're talking about 4175 01:21:04,149 --> 01:21:04,159 know what they're talking about 4176 01:21:04,159 --> 01:21:07,270 know what they're talking about so now let's execute the application 4177 01:21:07,270 --> 01:21:07,280 so now let's execute the application 4178 01:21:07,280 --> 01:21:11,030 so now let's execute the application and let's provide -10 and you see that 4179 01:21:11,030 --> 01:21:11,040 and let's provide -10 and you see that 4180 01:21:11,040 --> 01:21:14,709 and let's provide -10 and you see that this line was printed 4181 01:21:14,709 --> 01:21:14,719 this line was printed 4182 01:21:14,719 --> 01:21:17,990 this line was printed as a feedback to the user 4183 01:21:17,990 --> 01:21:18,000 as a feedback to the user 4184 01:21:18,000 --> 01:21:20,950 as a feedback to the user so let's go through the flow again user 4185 01:21:20,950 --> 01:21:20,960 so let's go through the flow again user 4186 01:21:20,960 --> 01:21:22,229 so let's go through the flow again user gives us their input 4187 01:21:22,229 --> 01:21:22,239 gives us their input 4188 01:21:22,239 --> 01:21:25,189 gives us their input in this case -10 we convert it to 4189 01:21:25,189 --> 01:21:25,199 in this case -10 we convert it to 4190 01:21:25,199 --> 01:21:25,750 in this case -10 we convert it to integer 4191 01:21:25,750 --> 01:21:25,760 integer 4192 01:21:25,760 --> 01:21:29,270 integer so now it's -10 integer and we pass it 4193 01:21:29,270 --> 01:21:29,280 so now it's -10 integer and we pass it 4194 01:21:29,280 --> 01:21:31,030 so now it's -10 integer and we pass it on to our days to units 4195 01:21:31,030 --> 01:21:31,040 on to our days to units 4196 01:21:31,040 --> 01:21:34,790 on to our days to units function and these two units function 4197 01:21:34,790 --> 01:21:34,800 function and these two units function 4198 01:21:34,800 --> 01:21:38,790 function and these two units function basically has this if else statement 4199 01:21:38,790 --> 01:21:38,800 basically has this if else statement 4200 01:21:38,800 --> 01:21:40,550 basically has this if else statement that's how it's called in programming 4201 01:21:40,550 --> 01:21:40,560 that's how it's called in programming 4202 01:21:40,560 --> 01:21:41,990 that's how it's called in programming and our if else 4203 01:21:41,990 --> 01:21:42,000 and our if else 4204 01:21:42,000 --> 01:21:45,510 and our if else statement validates or checks 4205 01:21:45,510 --> 01:21:45,520 statement validates or checks 4206 01:21:45,520 --> 01:21:50,070 statement validates or checks whether this input is greater than zero 4207 01:21:50,070 --> 01:21:50,080 whether this input is greater than zero 4208 01:21:50,080 --> 01:21:54,310 whether this input is greater than zero if it is then the function will return 4209 01:21:54,310 --> 01:21:54,320 if it is then the function will return 4210 01:21:54,320 --> 01:21:56,470 if it is then the function will return this as a result so basically the 4211 01:21:56,470 --> 01:21:56,480 this as a result so basically the 4212 01:21:56,480 --> 01:21:58,629 this as a result so basically the calculation with a proper message 4213 01:21:58,629 --> 01:21:58,639 calculation with a proper message 4214 01:21:58,639 --> 01:22:01,830 calculation with a proper message else so basically if this is not 4215 01:22:01,830 --> 01:22:01,840 else so basically if this is not 4216 01:22:01,840 --> 01:22:05,030 else so basically if this is not the case then it will return basically 4217 01:22:05,030 --> 01:22:05,040 the case then it will return basically 4218 01:22:05,040 --> 01:22:05,430 the case then it will return basically just 4219 01:22:05,430 --> 01:22:05,440 just 4220 01:22:05,440 --> 01:22:08,310 just a feedback message for the user and note 4221 01:22:08,310 --> 01:22:08,320 a feedback message for the user and note 4222 01:22:08,320 --> 01:22:08,629 a feedback message for the user and note that 4223 01:22:08,629 --> 01:22:08,639 that 4224 01:22:08,639 --> 01:22:11,669 that else doesn't have such a check here we 4225 01:22:11,669 --> 01:22:11,679 else doesn't have such a check here we 4226 01:22:11,679 --> 01:22:12,870 else doesn't have such a check here we don't check 4227 01:22:12,870 --> 01:22:12,880 don't check 4228 01:22:12,880 --> 01:22:16,070 don't check num of days is less than zero and the 4229 01:22:16,070 --> 01:22:16,080 num of days is less than zero and the 4230 01:22:16,080 --> 01:22:16,950 num of days is less than zero and the reason for that 4231 01:22:16,950 --> 01:22:16,960 reason for that 4232 01:22:16,960 --> 01:22:19,590 reason for that is because it doesn't check for less 4233 01:22:19,590 --> 01:22:19,600 is because it doesn't check for less 4234 01:22:19,600 --> 01:22:20,390 is because it doesn't check for less than zero 4235 01:22:20,390 --> 01:22:20,400 than zero 4236 01:22:20,400 --> 01:22:22,550 than zero because it basically just decides if 4237 01:22:22,550 --> 01:22:22,560 because it basically just decides if 4238 01:22:22,560 --> 01:22:23,830 because it basically just decides if this is not true 4239 01:22:23,830 --> 01:22:23,840 this is not true 4240 01:22:23,840 --> 01:22:26,950 this is not true else or in that case just do this 4241 01:22:26,950 --> 01:22:26,960 else or in that case just do this 4242 01:22:26,960 --> 01:22:29,430 else or in that case just do this so we don't need additional check here 4243 01:22:29,430 --> 01:22:29,440 so we don't need additional check here 4244 01:22:29,440 --> 01:22:31,510 so we don't need additional check here now this segment right here 4245 01:22:31,510 --> 01:22:31,520 now this segment right here 4246 01:22:31,520 --> 01:22:34,390 now this segment right here where we're doing the check is called a 4247 01:22:34,390 --> 01:22:34,400 where we're doing the check is called a 4248 01:22:34,400 --> 01:22:35,189 where we're doing the check is called a conditional 4249 01:22:35,189 --> 01:22:35,199 conditional 4250 01:22:35,199 --> 01:22:37,110 conditional so basically we're providing our program 4251 01:22:37,110 --> 01:22:37,120 so basically we're providing our program 4252 01:22:37,120 --> 01:22:38,229 so basically we're providing our program a condition 4253 01:22:38,229 --> 01:22:38,239 a condition 4254 01:22:38,239 --> 01:22:41,590 a condition if this condition is correct 4255 01:22:41,590 --> 01:22:41,600 if this condition is correct 4256 01:22:41,600 --> 01:22:45,189 if this condition is correct then do something otherwise do something 4257 01:22:45,189 --> 01:22:45,199 then do something otherwise do something 4258 01:22:45,199 --> 01:22:45,830 then do something otherwise do something else 4259 01:22:45,830 --> 01:22:45,840 else 4260 01:22:45,840 --> 01:22:49,270 else and that conditional can be true 4261 01:22:49,270 --> 01:22:49,280 and that conditional can be true 4262 01:22:49,280 --> 01:22:52,470 and that conditional can be true or false if we enter 10 then this 4263 01:22:52,470 --> 01:22:52,480 or false if we enter 10 then this 4264 01:22:52,480 --> 01:22:53,669 or false if we enter 10 then this conditional will be true 4265 01:22:53,669 --> 01:22:53,679 conditional will be true 4266 01:22:53,679 --> 01:22:56,550 conditional will be true because it's greater than 0 if we enter 4267 01:22:56,550 --> 01:22:56,560 because it's greater than 0 if we enter 4268 01:22:56,560 --> 01:22:58,950 because it's greater than 0 if we enter -10 then this conditional will be 4269 01:22:58,950 --> 01:22:58,960 -10 then this conditional will be 4270 01:22:58,960 --> 01:23:02,149 -10 then this conditional will be negative it's not greater than 0 4271 01:23:02,149 --> 01:23:02,159 negative it's not greater than 0 4272 01:23:02,159 --> 01:23:05,430 negative it's not greater than 0 and those true and false values in 4273 01:23:05,430 --> 01:23:05,440 and those true and false values in 4274 01:23:05,440 --> 01:23:06,310 and those true and false values in programming 4275 01:23:06,310 --> 01:23:06,320 programming 4276 01:23:06,320 --> 01:23:08,950 programming actually are represented by its own data 4277 01:23:08,950 --> 01:23:08,960 actually are represented by its own data 4278 01:23:08,960 --> 01:23:10,229 actually are represented by its own data type which is called 4279 01:23:10,229 --> 01:23:10,239 type which is called 4280 01:23:10,239 --> 01:23:13,590 type which is called boolean and in order to show it to you 4281 01:23:13,590 --> 01:23:13,600 boolean and in order to show it to you 4282 01:23:13,600 --> 01:23:16,149 boolean and in order to show it to you that this conditional either gives true 4283 01:23:16,149 --> 01:23:16,159 that this conditional either gives true 4284 01:23:16,159 --> 01:23:17,270 that this conditional either gives true or false 4285 01:23:17,270 --> 01:23:17,280 or false 4286 01:23:17,280 --> 01:23:19,189 or false what i'm going to do is i'm going to 4287 01:23:19,189 --> 01:23:19,199 what i'm going to do is i'm going to 4288 01:23:19,199 --> 01:23:21,750 what i'm going to do is i'm going to print 4289 01:23:21,750 --> 01:23:21,760 print 4290 01:23:21,760 --> 01:23:24,390 print this conditional right before i do the 4291 01:23:24,390 --> 01:23:24,400 this conditional right before i do the 4292 01:23:24,400 --> 01:23:24,950 this conditional right before i do the check 4293 01:23:24,950 --> 01:23:24,960 check 4294 01:23:24,960 --> 01:23:27,350 check so for a positive number input this 4295 01:23:27,350 --> 01:23:27,360 so for a positive number input this 4296 01:23:27,360 --> 01:23:28,310 so for a positive number input this should print 4297 01:23:28,310 --> 01:23:28,320 should print 4298 01:23:28,320 --> 01:23:32,070 should print true and if it's negative so it's not 4299 01:23:32,070 --> 01:23:32,080 true and if it's negative so it's not 4300 01:23:32,080 --> 01:23:35,590 true and if it's negative so it's not greater than 0 this should print false 4301 01:23:35,590 --> 01:23:35,600 greater than 0 this should print false 4302 01:23:35,600 --> 01:23:38,870 greater than 0 this should print false so let's test it out 4303 01:23:38,870 --> 01:23:38,880 so let's test it out 4304 01:23:38,880 --> 01:23:42,870 so let's test it out first i'm going to provide positive 10 4305 01:23:42,870 --> 01:23:42,880 first i'm going to provide positive 10 4306 01:23:42,880 --> 01:23:46,390 first i'm going to provide positive 10 and right here you see true 4307 01:23:46,390 --> 01:23:46,400 and right here you see true 4308 01:23:46,400 --> 01:23:49,830 and right here you see true because this condition is indeed true 4309 01:23:49,830 --> 01:23:49,840 because this condition is indeed true 4310 01:23:49,840 --> 01:23:51,510 because this condition is indeed true and note that this is not a string 4311 01:23:51,510 --> 01:23:51,520 and note that this is not a string 4312 01:23:51,520 --> 01:23:54,070 and note that this is not a string that's why we don't need the quotes here 4313 01:23:54,070 --> 01:23:54,080 that's why we don't need the quotes here 4314 01:23:54,080 --> 01:23:55,830 that's why we don't need the quotes here so we can basically just put in the 4315 01:23:55,830 --> 01:23:55,840 so we can basically just put in the 4316 01:23:55,840 --> 01:23:58,229 so we can basically just put in the whole expression in a print 4317 01:23:58,229 --> 01:23:58,239 whole expression in a print 4318 01:23:58,239 --> 01:24:01,590 whole expression in a print function and now let's do the same with 4319 01:24:01,590 --> 01:24:01,600 function and now let's do the same with 4320 01:24:01,600 --> 01:24:05,590 function and now let's do the same with negative 10 and you see 4321 01:24:05,590 --> 01:24:05,600 negative 10 and you see 4322 01:24:05,600 --> 01:24:09,189 negative 10 and you see false and as i said true and false 4323 01:24:09,189 --> 01:24:09,199 false and as i said true and false 4324 01:24:09,199 --> 01:24:11,830 false and as i said true and false values belong to its own data type in 4325 01:24:11,830 --> 01:24:11,840 values belong to its own data type in 4326 01:24:11,840 --> 01:24:13,030 values belong to its own data type in programming 4327 01:24:13,030 --> 01:24:13,040 programming 4328 01:24:13,040 --> 01:24:15,910 programming which is called a boolean and again we 4329 01:24:15,910 --> 01:24:15,920 which is called a boolean and again we 4330 01:24:15,920 --> 01:24:17,510 which is called a boolean and again we can demonstrate that 4331 01:24:17,510 --> 01:24:17,520 can demonstrate that 4332 01:24:17,520 --> 01:24:21,030 can demonstrate that instead of printing it out 4333 01:24:21,030 --> 01:24:21,040 instead of printing it out 4334 01:24:21,040 --> 01:24:24,229 instead of printing it out we can save it into a variable let's 4335 01:24:24,229 --> 01:24:24,239 we can save it into a variable let's 4336 01:24:24,239 --> 01:24:24,950 we can save it into a variable let's call it 4337 01:24:24,950 --> 01:24:24,960 call it 4338 01:24:24,960 --> 01:24:27,990 call it conditional check 4339 01:24:27,990 --> 01:24:28,000 conditional check 4340 01:24:28,000 --> 01:24:31,350 conditional check and in python there is a function called 4341 01:24:31,350 --> 01:24:31,360 and in python there is a function called 4342 01:24:31,360 --> 01:24:34,470 and in python there is a function called type which checks or prints out 4343 01:24:34,470 --> 01:24:34,480 type which checks or prints out 4344 01:24:34,480 --> 01:24:35,350 type which checks or prints out basically 4345 01:24:35,350 --> 01:24:35,360 basically 4346 01:24:35,360 --> 01:24:38,709 basically a type data type of a variable or 4347 01:24:38,709 --> 01:24:38,719 a type data type of a variable or 4348 01:24:38,719 --> 01:24:41,830 a type data type of a variable or a single value so if we 4349 01:24:41,830 --> 01:24:41,840 a single value so if we 4350 01:24:41,840 --> 01:24:45,350 a single value so if we pass it so this will give us data type 4351 01:24:45,350 --> 01:24:45,360 pass it so this will give us data type 4352 01:24:45,360 --> 01:24:46,629 pass it so this will give us data type of conditional check 4353 01:24:46,629 --> 01:24:46,639 of conditional check 4354 01:24:46,639 --> 01:24:48,629 of conditional check and obviously if you want to see that 4355 01:24:48,629 --> 01:24:48,639 and obviously if you want to see that 4356 01:24:48,639 --> 01:24:50,629 and obviously if you want to see that result we need to print it 4357 01:24:50,629 --> 01:24:50,639 result we need to print it 4358 01:24:50,639 --> 01:24:53,830 result we need to print it so print the whole thing so it doesn't 4359 01:24:53,830 --> 01:24:53,840 so print the whole thing so it doesn't 4360 01:24:53,840 --> 01:24:55,430 so print the whole thing so it doesn't matter what we pass in 4361 01:24:55,430 --> 01:24:55,440 matter what we pass in 4362 01:24:55,440 --> 01:24:58,709 matter what we pass in this point and right here you see 4363 01:24:58,709 --> 01:24:58,719 this point and right here you see 4364 01:24:58,719 --> 01:25:01,910 this point and right here you see class boolean so this 4365 01:25:01,910 --> 01:25:01,920 class boolean so this 4366 01:25:01,920 --> 01:25:04,790 class boolean so this conditional check here which has a value 4367 01:25:04,790 --> 01:25:04,800 conditional check here which has a value 4368 01:25:04,800 --> 01:25:05,830 conditional check here which has a value of 4369 01:25:05,830 --> 01:25:05,840 of 4370 01:25:05,840 --> 01:25:09,189 of true or false is of type boolean 4371 01:25:09,189 --> 01:25:09,199 true or false is of type boolean 4372 01:25:09,199 --> 01:25:11,350 true or false is of type boolean now there are two things that i want to 4373 01:25:11,350 --> 01:25:11,360 now there are two things that i want to 4374 01:25:11,360 --> 01:25:12,229 now there are two things that i want to note here 4375 01:25:12,229 --> 01:25:12,239 note here 4376 01:25:12,239 --> 01:25:15,830 note here the first one is that you see that 4377 01:25:15,830 --> 01:25:15,840 the first one is that you see that 4378 01:25:15,840 --> 01:25:18,470 the first one is that you see that i am calling a function here which is 4379 01:25:18,470 --> 01:25:18,480 i am calling a function here which is 4380 01:25:18,480 --> 01:25:19,590 i am calling a function here which is type 4381 01:25:19,590 --> 01:25:19,600 type 4382 01:25:19,600 --> 01:25:21,990 type and then whatever that function type 4383 01:25:21,990 --> 01:25:22,000 and then whatever that function type 4384 01:25:22,000 --> 01:25:23,350 and then whatever that function type returns 4385 01:25:23,350 --> 01:25:23,360 returns 4386 01:25:23,360 --> 01:25:26,550 returns which is basically this output here we 4387 01:25:26,550 --> 01:25:26,560 which is basically this output here we 4388 01:25:26,560 --> 01:25:27,510 which is basically this output here we are printing it 4389 01:25:27,510 --> 01:25:27,520 are printing it 4390 01:25:27,520 --> 01:25:29,990 are printing it so we have two function calls that are 4391 01:25:29,990 --> 01:25:30,000 so we have two function calls that are 4392 01:25:30,000 --> 01:25:30,790 so we have two function calls that are basically 4393 01:25:30,790 --> 01:25:30,800 basically 4394 01:25:30,800 --> 01:25:33,270 basically nested and that is absolutely fine you 4395 01:25:33,270 --> 01:25:33,280 nested and that is absolutely fine you 4396 01:25:33,280 --> 01:25:34,390 nested and that is absolutely fine you can nest 4397 01:25:34,390 --> 01:25:34,400 can nest 4398 01:25:34,400 --> 01:25:37,350 can nest function calls another example of doing 4399 01:25:37,350 --> 01:25:37,360 function calls another example of doing 4400 01:25:37,360 --> 01:25:37,750 function calls another example of doing this 4401 01:25:37,750 --> 01:25:37,760 this 4402 01:25:37,760 --> 01:25:39,430 this nested function called would be for 4403 01:25:39,430 --> 01:25:39,440 nested function called would be for 4404 01:25:39,440 --> 01:25:41,430 nested function called would be for example right here 4405 01:25:41,430 --> 01:25:41,440 example right here 4406 01:25:41,440 --> 01:25:44,310 example right here instead of assigning these to a variable 4407 01:25:44,310 --> 01:25:44,320 instead of assigning these to a variable 4408 01:25:44,320 --> 01:25:45,830 instead of assigning these to a variable and then passing it here 4409 01:25:45,830 --> 01:25:45,840 and then passing it here 4410 01:25:45,840 --> 01:25:48,950 and then passing it here we can actually save us that step 4411 01:25:48,950 --> 01:25:48,960 we can actually save us that step 4412 01:25:48,960 --> 01:25:52,550 we can actually save us that step and in the days to units function call 4413 01:25:52,550 --> 01:25:52,560 and in the days to units function call 4414 01:25:52,560 --> 01:25:55,830 and in the days to units function call pass it as a value so this is a 4415 01:25:55,830 --> 01:25:55,840 pass it as a value so this is a 4416 01:25:55,840 --> 01:25:56,550 pass it as a value so this is a perfectly 4417 01:25:56,550 --> 01:25:56,560 perfectly 4418 01:25:56,560 --> 01:25:59,990 perfectly valid syntax and you can do that you can 4419 01:25:59,990 --> 01:26:00,000 valid syntax and you can do that you can 4420 01:26:00,000 --> 01:26:02,870 valid syntax and you can do that you can nest in the function calls and you would 4421 01:26:02,870 --> 01:26:02,880 nest in the function calls and you would 4422 01:26:02,880 --> 01:26:04,709 nest in the function calls and you would not need this additional step 4423 01:26:04,709 --> 01:26:04,719 not need this additional step 4424 01:26:04,719 --> 01:26:06,310 not need this additional step and you can do that as many times as you 4425 01:26:06,310 --> 01:26:06,320 and you can do that as many times as you 4426 01:26:06,320 --> 01:26:09,430 and you can do that as many times as you want it just looks cleaner when you have 4427 01:26:09,430 --> 01:26:09,440 want it just looks cleaner when you have 4428 01:26:09,440 --> 01:26:11,590 want it just looks cleaner when you have that syntax a little bit separated and 4429 01:26:11,590 --> 01:26:11,600 that syntax a little bit separated and 4430 01:26:11,600 --> 01:26:13,110 that syntax a little bit separated and not have two three 4431 01:26:13,110 --> 01:26:13,120 not have two three 4432 01:26:13,120 --> 01:26:15,830 not have two three four function calls nested so that's one 4433 01:26:15,830 --> 01:26:15,840 four function calls nested so that's one 4434 01:26:15,840 --> 01:26:16,629 four function calls nested so that's one thing 4435 01:26:16,629 --> 01:26:16,639 thing 4436 01:26:16,639 --> 01:26:19,510 thing and another thing is we just saw a class 4437 01:26:19,510 --> 01:26:19,520 and another thing is we just saw a class 4438 01:26:19,520 --> 01:26:21,110 and another thing is we just saw a class boolean type here 4439 01:26:21,110 --> 01:26:21,120 boolean type here 4440 01:26:21,120 --> 01:26:23,990 boolean type here and let's actually see the same output 4441 01:26:23,990 --> 01:26:24,000 and let's actually see the same output 4442 01:26:24,000 --> 01:26:24,470 and let's actually see the same output for 4443 01:26:24,470 --> 01:26:24,480 for 4444 01:26:24,480 --> 01:26:27,750 for string and number so just for the 4445 01:26:27,750 --> 01:26:27,760 string and number so just for the 4446 01:26:27,760 --> 01:26:29,110 string and number so just for the demonstration let's actually 4447 01:26:29,110 --> 01:26:29,120 demonstration let's actually 4448 01:26:29,120 --> 01:26:36,390 demonstration let's actually see the type of string and integer 4449 01:26:36,390 --> 01:26:36,400 see the type of string and integer 4450 01:26:36,400 --> 01:26:38,629 see the type of string and integer let's get rid of this for a second 4451 01:26:38,629 --> 01:26:38,639 let's get rid of this for a second 4452 01:26:38,639 --> 01:26:40,629 let's get rid of this for a second because we just want to test 4453 01:26:40,629 --> 01:26:40,639 because we just want to test 4454 01:26:40,639 --> 01:26:44,950 because we just want to test so we're going to print the type of 4455 01:26:44,950 --> 01:26:44,960 so we're going to print the type of 4456 01:26:44,960 --> 01:26:47,910 so we're going to print the type of a string which says this should be a 4457 01:26:47,910 --> 01:26:47,920 a string which says this should be a 4458 01:26:47,920 --> 01:26:48,950 a string which says this should be a string 4459 01:26:48,950 --> 01:26:48,960 string 4460 01:26:48,960 --> 01:26:52,870 string type and execute 4461 01:26:52,870 --> 01:26:52,880 type and execute 4462 01:26:52,880 --> 01:26:55,910 type and execute and you see class string and 4463 01:26:55,910 --> 01:26:55,920 and you see class string and 4464 01:26:55,920 --> 01:26:59,669 and you see class string and now let's provide an integer 4465 01:26:59,669 --> 01:26:59,679 now let's provide an integer 4466 01:26:59,679 --> 01:27:04,550 now let's provide an integer you see class int and let's provide 4467 01:27:04,550 --> 01:27:04,560 you see class int and let's provide 4468 01:27:04,560 --> 01:27:08,550 you see class int and let's provide a float and there you go we have float 4469 01:27:08,550 --> 01:27:08,560 a float and there you go we have float 4470 01:27:08,560 --> 01:27:11,189 a float and there you go we have float so this is a very handy way of checking 4471 01:27:11,189 --> 01:27:11,199 so this is a very handy way of checking 4472 01:27:11,199 --> 01:27:12,950 so this is a very handy way of checking the type and we're going to need that 4473 01:27:12,950 --> 01:27:12,960 the type and we're going to need that 4474 01:27:12,960 --> 01:27:16,470 the type and we're going to need that actually in a later example 4475 01:27:16,470 --> 01:27:16,480 actually in a later example 4476 01:27:16,480 --> 01:27:20,390 actually in a later example so back to our 4477 01:27:20,390 --> 01:27:20,400 so back to our 4478 01:27:20,400 --> 01:27:23,430 so back to our application and one note about booleans 4479 01:27:23,430 --> 01:27:23,440 application and one note about booleans 4480 01:27:23,440 --> 01:27:24,390 application and one note about booleans and conditionals 4481 01:27:24,390 --> 01:27:24,400 and conditionals 4482 01:27:24,400 --> 01:27:27,110 and conditionals is that you're going to be using a lot 4483 01:27:27,110 --> 01:27:27,120 is that you're going to be using a lot 4484 01:27:27,120 --> 01:27:27,990 is that you're going to be using a lot of those 4485 01:27:27,990 --> 01:27:28,000 of those 4486 01:27:28,000 --> 01:27:31,189 of those in programming because they're really 4487 01:27:31,189 --> 01:27:31,199 in programming because they're really 4488 01:27:31,199 --> 01:27:34,790 in programming because they're really the major or the core part of writing 4489 01:27:34,790 --> 01:27:34,800 the major or the core part of writing 4490 01:27:34,800 --> 01:27:37,750 the major or the core part of writing any kind of logic in programming so 4491 01:27:37,750 --> 01:27:37,760 any kind of logic in programming so 4492 01:27:37,760 --> 01:27:38,629 any kind of logic in programming so you're going to need 4493 01:27:38,629 --> 01:27:38,639 you're going to need 4494 01:27:38,639 --> 01:27:41,510 you're going to need if else conditions and statements and 4495 01:27:41,510 --> 01:27:41,520 if else conditions and statements and 4496 01:27:41,520 --> 01:27:42,310 if else conditions and statements and booleans 4497 01:27:42,310 --> 01:27:42,320 booleans 4498 01:27:42,320 --> 01:27:45,350 booleans in your application so it is a very core 4499 01:27:45,350 --> 01:27:45,360 in your application so it is a very core 4500 01:27:45,360 --> 01:27:46,870 in your application so it is a very core concept and we're going to be using a 4501 01:27:46,870 --> 01:27:46,880 concept and we're going to be using a 4502 01:27:46,880 --> 01:27:47,510 concept and we're going to be using a lot of them 4503 01:27:47,510 --> 01:27:47,520 lot of them 4504 01:27:47,520 --> 01:27:49,990 lot of them in our coming examples so let's get rid 4505 01:27:49,990 --> 01:27:50,000 in our coming examples so let's get rid 4506 01:27:50,000 --> 01:27:50,550 in our coming examples so let's get rid of 4507 01:27:50,550 --> 01:27:50,560 of 4508 01:27:50,560 --> 01:27:53,669 of this code right here and one note before 4509 01:27:53,669 --> 01:27:53,679 this code right here and one note before 4510 01:27:53,679 --> 01:27:54,629 this code right here and one note before we move on 4511 01:27:54,629 --> 01:27:54,639 we move on 4512 01:27:54,639 --> 01:27:57,430 we move on here is that the negative numbers are 4513 01:27:57,430 --> 01:27:57,440 here is that the negative numbers are 4514 01:27:57,440 --> 01:27:58,310 here is that the negative numbers are not 4515 01:27:58,310 --> 01:27:58,320 not 4516 01:27:58,320 --> 01:28:00,709 not being calculated because of this 4517 01:28:00,709 --> 01:28:00,719 being calculated because of this 4518 01:28:00,719 --> 01:28:01,669 being calculated because of this condition 4519 01:28:01,669 --> 01:28:01,679 condition 4520 01:28:01,679 --> 01:28:04,470 condition now what about zero let's actually try 4521 01:28:04,470 --> 01:28:04,480 now what about zero let's actually try 4522 01:28:04,480 --> 01:28:05,669 now what about zero let's actually try that out 4523 01:28:05,669 --> 01:28:05,679 that out 4524 01:28:05,679 --> 01:28:08,950 that out so i'm gonna enter zero which is 4525 01:28:08,950 --> 01:28:08,960 so i'm gonna enter zero which is 4526 01:28:08,960 --> 01:28:09,590 so i'm gonna enter zero which is actually 4527 01:28:09,590 --> 01:28:09,600 actually 4528 01:28:09,600 --> 01:28:11,910 actually also valued that doesn't make sense 4529 01:28:11,910 --> 01:28:11,920 also valued that doesn't make sense 4530 01:28:11,920 --> 01:28:13,030 also valued that doesn't make sense because 4531 01:28:13,030 --> 01:28:13,040 because 4532 01:28:13,040 --> 01:28:15,669 because zero days input obviously will give zero 4533 01:28:15,669 --> 01:28:15,679 zero days input obviously will give zero 4534 01:28:15,679 --> 01:28:17,030 zero days input obviously will give zero of any units 4535 01:28:17,030 --> 01:28:17,040 of any units 4536 01:28:17,040 --> 01:28:20,390 of any units so enter and 4537 01:28:20,390 --> 01:28:20,400 so enter and 4538 01:28:20,400 --> 01:28:23,750 so enter and right here you see a feedback to user 4539 01:28:23,750 --> 01:28:23,760 right here you see a feedback to user 4540 01:28:23,760 --> 01:28:25,510 right here you see a feedback to user that says you entered a negative value 4541 01:28:25,510 --> 01:28:25,520 that says you entered a negative value 4542 01:28:25,520 --> 01:28:27,189 that says you entered a negative value so no conversion for you 4543 01:28:27,189 --> 01:28:27,199 so no conversion for you 4544 01:28:27,199 --> 01:28:30,390 so no conversion for you and the reason for that is because this 4545 01:28:30,390 --> 01:28:30,400 and the reason for that is because this 4546 01:28:30,400 --> 01:28:33,350 and the reason for that is because this condition here number of days checks 4547 01:28:33,350 --> 01:28:33,360 condition here number of days checks 4548 01:28:33,360 --> 01:28:34,629 condition here number of days checks greater than zero 4549 01:28:34,629 --> 01:28:34,639 greater than zero 4550 01:28:34,639 --> 01:28:37,270 greater than zero which means that negative numbers and 4551 01:28:37,270 --> 01:28:37,280 which means that negative numbers and 4552 01:28:37,280 --> 01:28:37,750 which means that negative numbers and zero 4553 01:28:37,750 --> 01:28:37,760 zero 4554 01:28:37,760 --> 01:28:40,550 zero will not match this condition so they 4555 01:28:40,550 --> 01:28:40,560 will not match this condition so they 4556 01:28:40,560 --> 01:28:41,110 will not match this condition so they will 4557 01:28:41,110 --> 01:28:41,120 will 4558 01:28:41,120 --> 01:28:43,270 will basically give you this feedback but our 4559 01:28:43,270 --> 01:28:43,280 basically give you this feedback but our 4560 01:28:43,280 --> 01:28:45,270 basically give you this feedback but our message says you entered a negative 4561 01:28:45,270 --> 01:28:45,280 message says you entered a negative 4562 01:28:45,280 --> 01:28:45,750 message says you entered a negative value 4563 01:28:45,750 --> 01:28:45,760 value 4564 01:28:45,760 --> 01:28:48,950 value right when we entered zero what if we 4565 01:28:48,950 --> 01:28:48,960 right when we entered zero what if we 4566 01:28:48,960 --> 01:28:49,910 right when we entered zero what if we wanted to 4567 01:28:49,910 --> 01:28:49,920 wanted to 4568 01:28:49,920 --> 01:28:52,229 wanted to have a specific message for a user if 4569 01:28:52,229 --> 01:28:52,239 have a specific message for a user if 4570 01:28:52,239 --> 01:28:53,270 have a specific message for a user if they enter 4571 01:28:53,270 --> 01:28:53,280 they enter 4572 01:28:53,280 --> 01:28:56,229 they enter zero and a specific one if they enter 4573 01:28:56,229 --> 01:28:56,239 zero and a specific one if they enter 4574 01:28:56,239 --> 01:28:57,189 zero and a specific one if they enter negative value 4575 01:28:57,189 --> 01:28:57,199 negative value 4576 01:28:57,199 --> 01:28:58,870 negative value right we want to differentiate between 4577 01:28:58,870 --> 01:28:58,880 right we want to differentiate between 4578 01:28:58,880 --> 01:29:01,030 right we want to differentiate between those two how can we do that 4579 01:29:01,030 --> 01:29:01,040 those two how can we do that 4580 01:29:01,040 --> 01:29:04,470 those two how can we do that in the if else statement in programming 4581 01:29:04,470 --> 01:29:04,480 in the if else statement in programming 4582 01:29:04,480 --> 01:29:08,149 in the if else statement in programming we can have multiple conditionals so 4583 01:29:08,149 --> 01:29:08,159 we can have multiple conditionals so 4584 01:29:08,159 --> 01:29:11,590 we can have multiple conditionals so basically we can have multiple ifs so 4585 01:29:11,590 --> 01:29:11,600 basically we can have multiple ifs so 4586 01:29:11,600 --> 01:29:13,750 basically we can have multiple ifs so how do we do that first we check number 4587 01:29:13,750 --> 01:29:13,760 how do we do that first we check number 4588 01:29:13,760 --> 01:29:15,270 how do we do that first we check number of days is greater than zero 4589 01:29:15,270 --> 01:29:15,280 of days is greater than zero 4590 01:29:15,280 --> 01:29:17,910 of days is greater than zero okay great now we want to check whether 4591 01:29:17,910 --> 01:29:17,920 okay great now we want to check whether 4592 01:29:17,920 --> 01:29:18,790 okay great now we want to check whether number of days 4593 01:29:18,790 --> 01:29:18,800 number of days 4594 01:29:18,800 --> 01:29:22,149 number of days is equal to zero and we can do that 4595 01:29:22,149 --> 01:29:22,159 is equal to zero and we can do that 4596 01:29:22,159 --> 01:29:26,149 is equal to zero and we can do that using another if here and in python 4597 01:29:26,149 --> 01:29:26,159 using another if here and in python 4598 01:29:26,159 --> 01:29:29,830 using another if here and in python the syntax for that is el if 4599 01:29:29,830 --> 01:29:29,840 the syntax for that is el if 4600 01:29:29,840 --> 01:29:32,550 the syntax for that is el if which basically is a combination of else 4601 01:29:32,550 --> 01:29:32,560 which basically is a combination of else 4602 01:29:32,560 --> 01:29:32,870 which basically is a combination of else and 4603 01:29:32,870 --> 01:29:32,880 and 4604 01:29:32,880 --> 01:29:36,709 and if so if this is not true 4605 01:29:36,709 --> 01:29:36,719 if so if this is not true 4606 01:29:36,719 --> 01:29:40,149 if so if this is not true then we want to check another condition 4607 01:29:40,149 --> 01:29:40,159 then we want to check another condition 4608 01:29:40,159 --> 01:29:43,830 then we want to check another condition number of days equals 0. 4609 01:29:43,830 --> 01:29:43,840 number of days equals 0. 4610 01:29:43,840 --> 01:29:46,870 number of days equals 0. now you know the equation sign generally 4611 01:29:46,870 --> 01:29:46,880 now you know the equation sign generally 4612 01:29:46,880 --> 01:29:49,910 now you know the equation sign generally is this one right here 4613 01:29:49,910 --> 01:29:49,920 is this one right here 4614 01:29:49,920 --> 01:29:52,550 is this one right here however when we're checking whether 4615 01:29:52,550 --> 01:29:52,560 however when we're checking whether 4616 01:29:52,560 --> 01:29:53,590 however when we're checking whether something 4617 01:29:53,590 --> 01:29:53,600 something 4618 01:29:53,600 --> 01:29:56,550 something equals to something else in programming 4619 01:29:56,550 --> 01:29:56,560 equals to something else in programming 4620 01:29:56,560 --> 01:29:57,030 equals to something else in programming that 4621 01:29:57,030 --> 01:29:57,040 that 4622 01:29:57,040 --> 01:30:00,149 that equation check is represented with two 4623 01:30:00,149 --> 01:30:00,159 equation check is represented with two 4624 01:30:00,159 --> 01:30:02,629 equation check is represented with two equal signs and the reason is because 4625 01:30:02,629 --> 01:30:02,639 equal signs and the reason is because 4626 01:30:02,639 --> 01:30:04,709 equal signs and the reason is because one equal sign is already 4627 01:30:04,709 --> 01:30:04,719 one equal sign is already 4628 01:30:04,719 --> 01:30:08,149 one equal sign is already used to represent assigning a value to a 4629 01:30:08,149 --> 01:30:08,159 used to represent assigning a value to a 4630 01:30:08,159 --> 01:30:09,110 used to represent assigning a value to a variable 4631 01:30:09,110 --> 01:30:09,120 variable 4632 01:30:09,120 --> 01:30:12,149 variable so not to confuse those two actions 4633 01:30:12,149 --> 01:30:12,159 so not to confuse those two actions 4634 01:30:12,159 --> 01:30:14,470 so not to confuse those two actions in programming we have two equation 4635 01:30:14,470 --> 01:30:14,480 in programming we have two equation 4636 01:30:14,480 --> 01:30:15,270 in programming we have two equation signs 4637 01:30:15,270 --> 01:30:15,280 signs 4638 01:30:15,280 --> 01:30:16,950 signs when we want to check whether something 4639 01:30:16,950 --> 01:30:16,960 when we want to check whether something 4640 01:30:16,960 --> 01:30:19,430 when we want to check whether something equals a certain value 4641 01:30:19,430 --> 01:30:19,440 equals a certain value 4642 01:30:19,440 --> 01:30:22,870 equals a certain value and just like here we 4643 01:30:22,870 --> 01:30:22,880 and just like here we 4644 01:30:22,880 --> 01:30:26,229 and just like here we execute some logic whenever this 4645 01:30:26,229 --> 01:30:26,239 execute some logic whenever this 4646 01:30:26,239 --> 01:30:27,189 execute some logic whenever this condition is 4647 01:30:27,189 --> 01:30:27,199 condition is 4648 01:30:27,199 --> 01:30:30,390 condition is true so in our case we want to 4649 01:30:30,390 --> 01:30:30,400 true so in our case we want to 4650 01:30:30,400 --> 01:30:34,310 true so in our case we want to tell the user you entered 4651 01:30:34,310 --> 01:30:34,320 tell the user you entered 4652 01:30:34,320 --> 01:30:37,590 tell the user you entered a zero please enter 4653 01:30:37,590 --> 01:30:37,600 a zero please enter 4654 01:30:37,600 --> 01:30:41,350 a zero please enter a valid positive number 4655 01:30:41,350 --> 01:30:41,360 a valid positive number 4656 01:30:41,360 --> 01:30:44,709 a valid positive number so now again to go through this logic 4657 01:30:44,709 --> 01:30:44,719 so now again to go through this logic 4658 01:30:44,719 --> 01:30:48,070 so now again to go through this logic flow if the input value is 4659 01:30:48,070 --> 01:30:48,080 flow if the input value is 4660 01:30:48,080 --> 01:30:50,390 flow if the input value is a positive number then function will 4661 01:30:50,390 --> 01:30:50,400 a positive number then function will 4662 01:30:50,400 --> 01:30:51,110 a positive number then function will return 4663 01:30:51,110 --> 01:30:51,120 return 4664 01:30:51,120 --> 01:30:54,149 return the calculation and the message if it's 4665 01:30:54,149 --> 01:30:54,159 the calculation and the message if it's 4666 01:30:54,159 --> 01:30:56,550 the calculation and the message if it's not a positive number then we will check 4667 01:30:56,550 --> 01:30:56,560 not a positive number then we will check 4668 01:30:56,560 --> 01:30:57,510 not a positive number then we will check additionally 4669 01:30:57,510 --> 01:30:57,520 additionally 4670 01:30:57,520 --> 01:31:00,629 additionally whether it's zero if it's not zero 4671 01:31:00,629 --> 01:31:00,639 whether it's zero if it's not zero 4672 01:31:00,639 --> 01:31:03,669 whether it's zero if it's not zero then this is a last condition basically 4673 01:31:03,669 --> 01:31:03,679 then this is a last condition basically 4674 01:31:03,679 --> 01:31:05,590 then this is a last condition basically then we know that it has to be a 4675 01:31:05,590 --> 01:31:05,600 then we know that it has to be a 4676 01:31:05,600 --> 01:31:07,590 then we know that it has to be a negative number right 4677 01:31:07,590 --> 01:31:07,600 negative number right 4678 01:31:07,600 --> 01:31:10,629 negative number right so let's test this out 4679 01:31:10,629 --> 01:31:10,639 so let's test this out 4680 01:31:10,639 --> 01:31:13,110 so let's test this out let's enter a positive number there you 4681 01:31:13,110 --> 01:31:13,120 let's enter a positive number there you 4682 01:31:13,120 --> 01:31:14,470 let's enter a positive number there you go 4683 01:31:14,470 --> 01:31:14,480 go 4684 01:31:14,480 --> 01:31:17,750 go let's enter zero you entered 4685 01:31:17,750 --> 01:31:17,760 let's enter zero you entered 4686 01:31:17,760 --> 01:31:19,590 let's enter zero you entered zero please enter a valley positive 4687 01:31:19,590 --> 01:31:19,600 zero please enter a valley positive 4688 01:31:19,600 --> 01:31:21,110 zero please enter a valley positive number and 4689 01:31:21,110 --> 01:31:21,120 number and 4690 01:31:21,120 --> 01:31:24,390 number and let's enter negative one and everything 4691 01:31:24,390 --> 01:31:24,400 let's enter negative one and everything 4692 01:31:24,400 --> 01:31:25,110 let's enter negative one and everything works 4693 01:31:25,110 --> 01:31:25,120 works 4694 01:31:25,120 --> 01:31:26,790 works perfectly note that you can have 4695 01:31:26,790 --> 01:31:26,800 perfectly note that you can have 4696 01:31:26,800 --> 01:31:28,390 perfectly note that you can have multiple alif's 4697 01:31:28,390 --> 01:31:28,400 multiple alif's 4698 01:31:28,400 --> 01:31:31,430 multiple alif's between if and else statements and again 4699 01:31:31,430 --> 01:31:31,440 between if and else statements and again 4700 01:31:31,440 --> 01:31:32,310 between if and else statements and again note that el 4701 01:31:32,310 --> 01:31:32,320 note that el 4702 01:31:32,320 --> 01:31:34,390 note that el if has a condition just like if 4703 01:31:34,390 --> 01:31:34,400 if has a condition just like if 4704 01:31:34,400 --> 01:31:35,350 if has a condition just like if statement 4705 01:31:35,350 --> 01:31:35,360 statement 4706 01:31:35,360 --> 01:31:38,229 statement else does not have any condition so this 4707 01:31:38,229 --> 01:31:38,239 else does not have any condition so this 4708 01:31:38,239 --> 01:31:39,910 else does not have any condition so this is like the fallback so if 4709 01:31:39,910 --> 01:31:39,920 is like the fallback so if 4710 01:31:39,920 --> 01:31:43,030 is like the fallback so if everything previously stated all the 4711 01:31:43,030 --> 01:31:43,040 everything previously stated all the 4712 01:31:43,040 --> 01:31:44,950 everything previously stated all the previous conditions did not 4713 01:31:44,950 --> 01:31:44,960 previous conditions did not 4714 01:31:44,960 --> 01:31:47,830 previous conditions did not match so they were all false basically 4715 01:31:47,830 --> 01:31:47,840 match so they were all false basically 4716 01:31:47,840 --> 01:31:48,229 match so they were all false basically then 4717 01:31:48,229 --> 01:31:48,239 then 4718 01:31:48,239 --> 01:31:51,110 then this is the logic that will get executed 4719 01:31:51,110 --> 01:31:51,120 this is the logic that will get executed 4720 01:31:51,120 --> 01:31:55,350 this is the logic that will get executed in that case 4721 01:31:58,229 --> 01:31:58,239 great so we have validated input value 4722 01:31:58,239 --> 01:31:58,709 great so we have validated input value for 4723 01:31:58,709 --> 01:31:58,719 for 4724 01:31:58,719 --> 01:32:01,510 for users and we may feel pretty good about 4725 01:32:01,510 --> 01:32:01,520 users and we may feel pretty good about 4726 01:32:01,520 --> 01:32:01,830 users and we may feel pretty good about our 4727 01:32:01,830 --> 01:32:01,840 our 4728 01:32:01,840 --> 01:32:04,870 our program because it doesn't calculate 4729 01:32:04,870 --> 01:32:04,880 program because it doesn't calculate 4730 01:32:04,880 --> 01:32:07,510 program because it doesn't calculate anything for values that don't make any 4731 01:32:07,510 --> 01:32:07,520 anything for values that don't make any 4732 01:32:07,520 --> 01:32:07,990 anything for values that don't make any sense 4733 01:32:07,990 --> 01:32:08,000 sense 4734 01:32:08,000 --> 01:32:11,110 sense however we still have a problem what 4735 01:32:11,110 --> 01:32:11,120 however we still have a problem what 4736 01:32:11,120 --> 01:32:12,550 however we still have a problem what happens if 4737 01:32:12,550 --> 01:32:12,560 happens if 4738 01:32:12,560 --> 01:32:15,430 happens if a user enters a text instead of a number 4739 01:32:15,430 --> 01:32:15,440 a user enters a text instead of a number 4740 01:32:15,440 --> 01:32:17,350 a user enters a text instead of a number so basically anything that is not 4741 01:32:17,350 --> 01:32:17,360 so basically anything that is not 4742 01:32:17,360 --> 01:32:21,270 so basically anything that is not a number value doesn't really matter 4743 01:32:21,270 --> 01:32:21,280 a number value doesn't really matter 4744 01:32:21,280 --> 01:32:24,550 a number value doesn't really matter basically some text if i enter 4745 01:32:24,550 --> 01:32:24,560 basically some text if i enter 4746 01:32:24,560 --> 01:32:26,390 basically some text if i enter you see that our program actually 4747 01:32:26,390 --> 01:32:26,400 you see that our program actually 4748 01:32:26,400 --> 01:32:27,830 you see that our program actually crashed and this is 4749 01:32:27,830 --> 01:32:27,840 crashed and this is 4750 01:32:27,840 --> 01:32:30,310 crashed and this is actually a user input that we want to 4751 01:32:30,310 --> 01:32:30,320 actually a user input that we want to 4752 01:32:30,320 --> 01:32:32,390 actually a user input that we want to protect our programs from 4753 01:32:32,390 --> 01:32:32,400 protect our programs from 4754 01:32:32,400 --> 01:32:35,430 protect our programs from because we don't want to allow users to 4755 01:32:35,430 --> 01:32:35,440 because we don't want to allow users to 4756 01:32:35,440 --> 01:32:38,149 because we don't want to allow users to blow up our application right so let's 4757 01:32:38,149 --> 01:32:38,159 blow up our application right so let's 4758 01:32:38,159 --> 01:32:39,189 blow up our application right so let's see what happened 4759 01:32:39,189 --> 01:32:39,199 see what happened 4760 01:32:39,199 --> 01:32:41,990 see what happened it actually says that we provided an 4761 01:32:41,990 --> 01:32:42,000 it actually says that we provided an 4762 01:32:42,000 --> 01:32:42,950 it actually says that we provided an invalid 4763 01:32:42,950 --> 01:32:42,960 invalid 4764 01:32:42,960 --> 01:32:45,990 invalid literal literal basically means the text 4765 01:32:45,990 --> 01:32:46,000 literal literal basically means the text 4766 01:32:46,000 --> 01:32:46,950 literal literal basically means the text itself or 4767 01:32:46,950 --> 01:32:46,960 itself or 4768 01:32:46,960 --> 01:32:49,270 itself or a number so basically a value that we 4769 01:32:49,270 --> 01:32:49,280 a number so basically a value that we 4770 01:32:49,280 --> 01:32:50,070 a number so basically a value that we entered 4771 01:32:50,070 --> 01:32:50,080 entered 4772 01:32:50,080 --> 01:32:53,350 entered for int function that's the problem 4773 01:32:53,350 --> 01:32:53,360 for int function that's the problem 4774 01:32:53,360 --> 01:32:56,310 for int function that's the problem so this function call basically just 4775 01:32:56,310 --> 01:32:56,320 so this function call basically just 4776 01:32:56,320 --> 01:32:57,030 so this function call basically just blew up 4777 01:32:57,030 --> 01:32:57,040 blew up 4778 01:32:57,040 --> 01:33:00,550 blew up because in function expects a value 4779 01:33:00,550 --> 01:33:00,560 because in function expects a value 4780 01:33:00,560 --> 01:33:03,669 because in function expects a value which is a string representation of a 4781 01:33:03,669 --> 01:33:03,679 which is a string representation of a 4782 01:33:03,679 --> 01:33:04,310 which is a string representation of a number 4783 01:33:04,310 --> 01:33:04,320 number 4784 01:33:04,320 --> 01:33:06,629 number so basically ind expects something like 4785 01:33:06,629 --> 01:33:06,639 so basically ind expects something like 4786 01:33:06,639 --> 01:33:07,990 so basically ind expects something like this or something like 4787 01:33:07,990 --> 01:33:08,000 this or something like 4788 01:33:08,000 --> 01:33:11,030 this or something like this it doesn't expect 4789 01:33:11,030 --> 01:33:11,040 this it doesn't expect 4790 01:33:11,040 --> 01:33:14,870 this it doesn't expect my text or some text so our application 4791 01:33:14,870 --> 01:33:14,880 my text or some text so our application 4792 01:33:14,880 --> 01:33:17,910 my text or some text so our application crashed on some text input now let's see 4793 01:33:17,910 --> 01:33:17,920 crashed on some text input now let's see 4794 01:33:17,920 --> 01:33:18,790 crashed on some text input now let's see what happens 4795 01:33:18,790 --> 01:33:18,800 what happens 4796 01:33:18,800 --> 01:33:21,990 what happens if i provide a number 4797 01:33:21,990 --> 01:33:22,000 if i provide a number 4798 01:33:22,000 --> 01:33:25,430 if i provide a number but a float number instead of integer 4799 01:33:25,430 --> 01:33:25,440 but a float number instead of integer 4800 01:33:25,440 --> 01:33:30,149 but a float number instead of integer let's enter 19.99 4801 01:33:30,149 --> 01:33:30,159 let's enter 19.99 4802 01:33:30,159 --> 01:33:33,350 let's enter 19.99 and enter and you see the same error 4803 01:33:33,350 --> 01:33:33,360 and enter and you see the same error 4804 01:33:33,360 --> 01:33:35,750 and enter and you see the same error this function basically returns an error 4805 01:33:35,750 --> 01:33:35,760 this function basically returns an error 4806 01:33:35,760 --> 01:33:37,030 this function basically returns an error because it cannot 4807 01:33:37,030 --> 01:33:37,040 because it cannot 4808 01:33:37,040 --> 01:33:40,390 because it cannot convert float into integer as well 4809 01:33:40,390 --> 01:33:40,400 convert float into integer as well 4810 01:33:40,400 --> 01:33:42,310 convert float into integer as well so we have a problem here that whenever 4811 01:33:42,310 --> 01:33:42,320 so we have a problem here that whenever 4812 01:33:42,320 --> 01:33:43,510 so we have a problem here that whenever user enters 4813 01:33:43,510 --> 01:33:43,520 user enters 4814 01:33:43,520 --> 01:33:46,149 user enters anything which is not an integer our 4815 01:33:46,149 --> 01:33:46,159 anything which is not an integer our 4816 01:33:46,159 --> 01:33:46,709 anything which is not an integer our program 4817 01:33:46,709 --> 01:33:46,719 program 4818 01:33:46,719 --> 01:33:50,149 program will blow up so how do we avoid 4819 01:33:50,149 --> 01:33:50,159 will blow up so how do we avoid 4820 01:33:50,159 --> 01:33:52,950 will blow up so how do we avoid that so basically before the int 4821 01:33:52,950 --> 01:33:52,960 that so basically before the int 4822 01:33:52,960 --> 01:33:54,790 that so basically before the int function gets executed with an 4823 01:33:54,790 --> 01:33:54,800 function gets executed with an 4824 01:33:54,800 --> 01:33:58,229 function gets executed with an invalid value we need to validate this 4825 01:33:58,229 --> 01:33:58,239 invalid value we need to validate this 4826 01:33:58,239 --> 01:33:58,870 invalid value we need to validate this whole thing and 4827 01:33:58,870 --> 01:33:58,880 whole thing and 4828 01:33:58,880 --> 01:34:01,669 whole thing and stop our program before that happens so 4829 01:34:01,669 --> 01:34:01,679 stop our program before that happens so 4830 01:34:01,679 --> 01:34:03,830 stop our program before that happens so we need the validation before int gets 4831 01:34:03,830 --> 01:34:03,840 we need the validation before int gets 4832 01:34:03,840 --> 01:34:06,790 we need the validation before int gets executed and we can do that right here 4833 01:34:06,790 --> 01:34:06,800 executed and we can do that right here 4834 01:34:06,800 --> 01:34:07,350 executed and we can do that right here right 4835 01:34:07,350 --> 01:34:07,360 right 4836 01:34:07,360 --> 01:34:10,229 right so before that line gets executed we're 4837 01:34:10,229 --> 01:34:10,239 so before that line gets executed we're 4838 01:34:10,239 --> 01:34:11,990 so before that line gets executed we're gonna do a validation 4839 01:34:11,990 --> 01:34:12,000 gonna do a validation 4840 01:34:12,000 --> 01:34:15,189 gonna do a validation and one way we can do that is using our 4841 01:34:15,189 --> 01:34:15,199 and one way we can do that is using our 4842 01:34:15,199 --> 01:34:18,470 and one way we can do that is using our familiar if else statement 4843 01:34:18,470 --> 01:34:18,480 familiar if else statement 4844 01:34:18,480 --> 01:34:22,550 familiar if else statement so we can say if user input 4845 01:34:22,550 --> 01:34:22,560 so we can say if user input 4846 01:34:22,560 --> 01:34:26,470 so we can say if user input is digit 4847 01:34:28,550 --> 01:34:28,560 so again from the syntax you know this 4848 01:34:28,560 --> 01:34:30,790 so again from the syntax you know this is calling a function 4849 01:34:30,790 --> 01:34:30,800 is calling a function 4850 01:34:30,800 --> 01:34:32,790 is calling a function but note that instead of calling the 4851 01:34:32,790 --> 01:34:32,800 but note that instead of calling the 4852 01:34:32,800 --> 01:34:33,910 but note that instead of calling the function 4853 01:34:33,910 --> 01:34:33,920 function 4854 01:34:33,920 --> 01:34:37,030 function like this so basically just stand alone 4855 01:34:37,030 --> 01:34:37,040 like this so basically just stand alone 4856 01:34:37,040 --> 01:34:39,510 like this so basically just stand alone we have the syntax where we have the 4857 01:34:39,510 --> 01:34:39,520 we have the syntax where we have the 4858 01:34:39,520 --> 01:34:40,310 we have the syntax where we have the variable 4859 01:34:40,310 --> 01:34:40,320 variable 4860 01:34:40,320 --> 01:34:42,390 variable dot and then the function name so 4861 01:34:42,390 --> 01:34:42,400 dot and then the function name so 4862 01:34:42,400 --> 01:34:44,070 dot and then the function name so instead of passing this 4863 01:34:44,070 --> 01:34:44,080 instead of passing this 4864 01:34:44,080 --> 01:34:46,470 instead of passing this as a parameter right here in the 4865 01:34:46,470 --> 01:34:46,480 as a parameter right here in the 4866 01:34:46,480 --> 01:34:47,270 as a parameter right here in the function 4867 01:34:47,270 --> 01:34:47,280 function 4868 01:34:47,280 --> 01:34:49,910 function brackets we are passing it as a 4869 01:34:49,910 --> 01:34:49,920 brackets we are passing it as a 4870 01:34:49,920 --> 01:34:51,189 brackets we are passing it as a parameter again 4871 01:34:51,189 --> 01:34:51,199 parameter again 4872 01:34:51,199 --> 01:34:54,149 parameter again but using this syntax right so each 4873 01:34:54,149 --> 01:34:54,159 but using this syntax right so each 4874 01:34:54,159 --> 01:34:56,149 but using this syntax right so each digit function will execute 4875 01:34:56,149 --> 01:34:56,159 digit function will execute 4876 01:34:56,159 --> 01:34:59,189 digit function will execute for user input as a parameter 4877 01:34:59,189 --> 01:34:59,199 for user input as a parameter 4878 01:34:59,199 --> 01:35:02,149 for user input as a parameter and again in if we have conditions so 4879 01:35:02,149 --> 01:35:02,159 and again in if we have conditions so 4880 01:35:02,159 --> 01:35:04,149 and again in if we have conditions so this will be either true or false 4881 01:35:04,149 --> 01:35:04,159 this will be either true or false 4882 01:35:04,159 --> 01:35:07,189 this will be either true or false it's a boolean and 4883 01:35:07,189 --> 01:35:07,199 it's a boolean and 4884 01:35:07,199 --> 01:35:10,709 it's a boolean and if user input is digit it's a number 4885 01:35:10,709 --> 01:35:10,719 if user input is digit it's a number 4886 01:35:10,719 --> 01:35:13,910 if user input is digit it's a number basically so basically this will filter 4887 01:35:13,910 --> 01:35:13,920 basically so basically this will filter 4888 01:35:13,920 --> 01:35:15,030 basically so basically this will filter out 4889 01:35:15,030 --> 01:35:15,040 out 4890 01:35:15,040 --> 01:35:17,830 out input values that are text so basically 4891 01:35:17,830 --> 01:35:17,840 input values that are text so basically 4892 01:35:17,840 --> 01:35:18,550 input values that are text so basically they're not 4893 01:35:18,550 --> 01:35:18,560 they're not 4894 01:35:18,560 --> 01:35:22,550 they're not numbers and if the input is digit 4895 01:35:22,550 --> 01:35:22,560 numbers and if the input is digit 4896 01:35:22,560 --> 01:35:26,070 numbers and if the input is digit then we want to execute this line 4897 01:35:26,070 --> 01:35:26,080 then we want to execute this line 4898 01:35:26,080 --> 01:35:30,390 then we want to execute this line and also the rest of our application 4899 01:35:30,390 --> 01:35:30,400 and also the rest of our application 4900 01:35:30,400 --> 01:35:33,669 and also the rest of our application like this and if it's not true 4901 01:35:33,669 --> 01:35:33,679 like this and if it's not true 4902 01:35:33,679 --> 01:35:36,470 like this and if it's not true so if the user input is not a digit we 4903 01:35:36,470 --> 01:35:36,480 so if the user input is not a digit we 4904 01:35:36,480 --> 01:35:38,070 so if the user input is not a digit we don't want to execute 4905 01:35:38,070 --> 01:35:38,080 don't want to execute 4906 01:35:38,080 --> 01:35:39,750 don't want to execute anything in our application we want to 4907 01:35:39,750 --> 01:35:39,760 anything in our application we want to 4908 01:35:39,760 --> 01:35:42,070 anything in our application we want to stop the execution and want to tell the 4909 01:35:42,070 --> 01:35:42,080 stop the execution and want to tell the 4910 01:35:42,080 --> 01:35:42,790 stop the execution and want to tell the user 4911 01:35:42,790 --> 01:35:42,800 user 4912 01:35:42,800 --> 01:35:45,990 user this was an invalid input value i'm not 4913 01:35:45,990 --> 01:35:46,000 this was an invalid input value i'm not 4914 01:35:46,000 --> 01:35:46,790 this was an invalid input value i'm not doing anything 4915 01:35:46,790 --> 01:35:46,800 doing anything 4916 01:35:46,800 --> 01:35:49,350 doing anything with my program so that it doesn't crash 4917 01:35:49,350 --> 01:35:49,360 with my program so that it doesn't crash 4918 01:35:49,360 --> 01:35:49,830 with my program so that it doesn't crash so 4919 01:35:49,830 --> 01:35:49,840 so 4920 01:35:49,840 --> 01:35:52,950 so else if not digit we 4921 01:35:52,950 --> 01:35:52,960 else if not digit we 4922 01:35:52,960 --> 01:35:56,629 else if not digit we are telling the user your input 4923 01:35:56,629 --> 01:35:56,639 are telling the user your input 4924 01:35:56,639 --> 01:36:00,550 are telling the user your input is not a number 4925 01:36:00,550 --> 01:36:00,560 is not a number 4926 01:36:00,560 --> 01:36:03,830 is not a number don't ruin my program 4927 01:36:03,830 --> 01:36:03,840 don't ruin my program 4928 01:36:03,840 --> 01:36:07,030 don't ruin my program so now let's actually test it 4929 01:36:07,030 --> 01:36:07,040 so now let's actually test it 4930 01:36:07,040 --> 01:36:10,229 so now let's actually test it so i'm going to execute and write some 4931 01:36:10,229 --> 01:36:10,239 so i'm going to execute and write some 4932 01:36:10,239 --> 01:36:13,189 so i'm going to execute and write some text 4933 01:36:16,149 --> 01:36:16,159 and there you go so user input is digit 4934 01:36:16,159 --> 01:36:16,470 and there you go so user input is digit was 4935 01:36:16,470 --> 01:36:16,480 was 4936 01:36:16,480 --> 01:36:19,750 was evaluated to false so 4937 01:36:19,750 --> 01:36:19,760 evaluated to false so 4938 01:36:19,760 --> 01:36:22,550 evaluated to false so none of these got executed instead the 4939 01:36:22,550 --> 01:36:22,560 none of these got executed instead the 4940 01:36:22,560 --> 01:36:23,270 none of these got executed instead the else 4941 01:36:23,270 --> 01:36:23,280 else 4942 01:36:23,280 --> 01:36:25,990 else block was executed and it printed a 4943 01:36:25,990 --> 01:36:26,000 block was executed and it printed a 4944 01:36:26,000 --> 01:36:26,790 block was executed and it printed a message 4945 01:36:26,790 --> 01:36:26,800 message 4946 01:36:26,800 --> 01:36:29,430 message for our user so we basically avoided our 4947 01:36:29,430 --> 01:36:29,440 for our user so we basically avoided our 4948 01:36:29,440 --> 01:36:30,950 for our user so we basically avoided our application to crash 4949 01:36:30,950 --> 01:36:30,960 application to crash 4950 01:36:30,960 --> 01:36:34,070 application to crash with this check and 4951 01:36:34,070 --> 01:36:34,080 with this check and 4952 01:36:34,080 --> 01:36:37,590 with this check and if we try a proper number 4953 01:36:37,590 --> 01:36:37,600 if we try a proper number 4954 01:36:37,600 --> 01:36:40,870 if we try a proper number it works and if we enter 4955 01:36:40,870 --> 01:36:40,880 it works and if we enter 4956 01:36:40,880 --> 01:36:44,629 it works and if we enter 0 for example the application 4957 01:36:44,629 --> 01:36:44,639 0 for example the application 4958 01:36:44,639 --> 01:36:47,669 0 for example the application will get executed and we will get 4959 01:36:47,669 --> 01:36:47,679 will get executed and we will get 4960 01:36:47,679 --> 01:36:50,950 will get executed and we will get our message from here 4961 01:36:50,950 --> 01:36:50,960 our message from here 4962 01:36:50,960 --> 01:36:53,510 our message from here so our application is more or less 4963 01:36:53,510 --> 01:36:53,520 so our application is more or less 4964 01:36:53,520 --> 01:36:54,470 so our application is more or less protected 4965 01:36:54,470 --> 01:36:54,480 protected 4966 01:36:54,480 --> 01:36:57,990 protected and we're not allowing for a invalid 4967 01:36:57,990 --> 01:36:58,000 and we're not allowing for a invalid 4968 01:36:58,000 --> 01:37:01,430 and we're not allowing for a invalid input number you say not a valid 4969 01:37:01,430 --> 01:37:01,440 input number you say not a valid 4970 01:37:01,440 --> 01:37:03,350 input number you say not a valid number now we know that in programming 4971 01:37:03,350 --> 01:37:03,360 number now we know that in programming 4972 01:37:03,360 --> 01:37:05,350 number now we know that in programming there are different types of numbers 4973 01:37:05,350 --> 01:37:05,360 there are different types of numbers 4974 01:37:05,360 --> 01:37:08,390 there are different types of numbers we have float numbers as well so 4975 01:37:08,390 --> 01:37:08,400 we have float numbers as well so 4976 01:37:08,400 --> 01:37:11,990 we have float numbers as well so let's actually see what ease digit 4977 01:37:11,990 --> 01:37:12,000 let's actually see what ease digit 4978 01:37:12,000 --> 01:37:13,030 let's actually see what ease digit function 4979 01:37:13,030 --> 01:37:13,040 function 4980 01:37:13,040 --> 01:37:16,149 function really checks so let's actually try 4981 01:37:16,149 --> 01:37:16,159 really checks so let's actually try 4982 01:37:16,159 --> 01:37:19,270 really checks so let's actually try to provide a float number instead of 4983 01:37:19,270 --> 01:37:19,280 to provide a float number instead of 4984 01:37:19,280 --> 01:37:22,390 to provide a float number instead of integer which is not a proper valid 4985 01:37:22,390 --> 01:37:22,400 integer which is not a proper valid 4986 01:37:22,400 --> 01:37:24,950 integer which is not a proper valid input for our program so i'm going to 4987 01:37:24,950 --> 01:37:24,960 input for our program so i'm going to 4988 01:37:24,960 --> 01:37:27,030 input for our program so i'm going to type in 19.99 4989 01:37:27,030 --> 01:37:27,040 type in 19.99 4990 01:37:27,040 --> 01:37:30,790 type in 19.99 and you see that each digit 4991 01:37:30,790 --> 01:37:30,800 and you see that each digit 4992 01:37:30,800 --> 01:37:33,910 and you see that each digit is false for a float number so we got 4993 01:37:33,910 --> 01:37:33,920 is false for a float number so we got 4994 01:37:33,920 --> 01:37:34,790 is false for a float number so we got the same 4995 01:37:34,790 --> 01:37:34,800 the same 4996 01:37:34,800 --> 01:37:37,830 the same your input is not a valid number output 4997 01:37:37,830 --> 01:37:37,840 your input is not a valid number output 4998 01:37:37,840 --> 01:37:39,669 your input is not a valid number output for float number as well which is 4999 01:37:39,669 --> 01:37:39,679 for float number as well which is 5000 01:37:39,679 --> 01:37:41,750 for float number as well which is perfect it's exactly what we need 5001 01:37:41,750 --> 01:37:41,760 perfect it's exactly what we need 5002 01:37:41,760 --> 01:37:44,790 perfect it's exactly what we need and now let's actually try 5003 01:37:44,790 --> 01:37:44,800 and now let's actually try 5004 01:37:44,800 --> 01:37:47,510 and now let's actually try to enter a negative number and let's see 5005 01:37:47,510 --> 01:37:47,520 to enter a negative number and let's see 5006 01:37:47,520 --> 01:37:49,350 to enter a negative number and let's see if each digit function 5007 01:37:49,350 --> 01:37:49,360 if each digit function 5008 01:37:49,360 --> 01:37:52,790 if each digit function returns true or false i'm going to enter 5009 01:37:52,790 --> 01:37:52,800 returns true or false i'm going to enter 5010 01:37:52,800 --> 01:37:56,310 returns true or false i'm going to enter and you see that else block got executed 5011 01:37:56,310 --> 01:37:56,320 and you see that else block got executed 5012 01:37:56,320 --> 01:37:57,109 and you see that else block got executed because 5013 01:37:57,109 --> 01:37:57,119 because 5014 01:37:57,119 --> 01:38:00,390 because is digit was false for a negative number 5015 01:38:00,390 --> 01:38:00,400 is digit was false for a negative number 5016 01:38:00,400 --> 01:38:02,390 is digit was false for a negative number so basically this function 5017 01:38:02,390 --> 01:38:02,400 so basically this function 5018 01:38:02,400 --> 01:38:05,830 so basically this function filters out a lot of the bad input 5019 01:38:05,830 --> 01:38:05,840 filters out a lot of the bad input 5020 01:38:05,840 --> 01:38:08,870 filters out a lot of the bad input for us to protect our application 5021 01:38:08,870 --> 01:38:08,880 for us to protect our application 5022 01:38:08,880 --> 01:38:11,910 for us to protect our application from bad user input and that also means 5023 01:38:11,910 --> 01:38:11,920 from bad user input and that also means 5024 01:38:11,920 --> 01:38:12,550 from bad user input and that also means that 5025 01:38:12,550 --> 01:38:12,560 that 5026 01:38:12,560 --> 01:38:14,310 that we don't need a check for negative 5027 01:38:14,310 --> 01:38:14,320 we don't need a check for negative 5028 01:38:14,320 --> 01:38:16,470 we don't need a check for negative values anymore and 5029 01:38:16,470 --> 01:38:16,480 values anymore and 5030 01:38:16,480 --> 01:38:19,030 values anymore and by the way in python you can actually 5031 01:38:19,030 --> 01:38:19,040 by the way in python you can actually 5032 01:38:19,040 --> 01:38:19,910 by the way in python you can actually have 5033 01:38:19,910 --> 01:38:19,920 have 5034 01:38:19,920 --> 01:38:22,950 have if statement without an else 5035 01:38:22,950 --> 01:38:22,960 if statement without an else 5036 01:38:22,960 --> 01:38:29,189 if statement without an else at the end this will work perfectly fine 5037 01:38:36,390 --> 01:38:36,400 however note that in programming we 5038 01:38:36,400 --> 01:38:38,790 however note that in programming we don't put this type of 5039 01:38:38,790 --> 01:38:38,800 don't put this type of 5040 01:38:38,800 --> 01:38:41,910 don't put this type of logic directly like this 5041 01:38:41,910 --> 01:38:41,920 logic directly like this 5042 01:38:41,920 --> 01:38:44,709 logic directly like this basically outside a function as a common 5043 01:38:44,709 --> 01:38:44,719 basically outside a function as a common 5044 01:38:44,719 --> 01:38:46,070 basically outside a function as a common and best practice we 5045 01:38:46,070 --> 01:38:46,080 and best practice we 5046 01:38:46,080 --> 01:38:49,030 and best practice we encapsulate most of the logic basically 5047 01:38:49,030 --> 01:38:49,040 encapsulate most of the logic basically 5048 01:38:49,040 --> 01:38:50,229 encapsulate most of the logic basically in functions 5049 01:38:50,229 --> 01:38:50,239 in functions 5050 01:38:50,239 --> 01:38:54,149 in functions so as a cleanup for our code 5051 01:38:54,149 --> 01:38:54,159 so as a cleanup for our code 5052 01:38:54,159 --> 01:38:57,990 so as a cleanup for our code we can take all this and put it into 5053 01:38:57,990 --> 01:38:58,000 we can take all this and put it into 5054 01:38:58,000 --> 01:39:01,430 we can take all this and put it into a function so right here i'm going to 5055 01:39:01,430 --> 01:39:01,440 a function so right here i'm going to 5056 01:39:01,440 --> 01:39:01,830 a function so right here i'm going to create 5057 01:39:01,830 --> 01:39:01,840 create 5058 01:39:01,840 --> 01:39:05,430 create a function and let's call it 5059 01:39:05,430 --> 01:39:05,440 a function and let's call it 5060 01:39:05,440 --> 01:39:09,109 a function and let's call it validate and execute 5061 01:39:09,109 --> 01:39:09,119 validate and execute 5062 01:39:09,119 --> 01:39:13,830 validate and execute or something like this 5063 01:39:13,830 --> 01:39:13,840 or something like this 5064 01:39:13,840 --> 01:39:17,350 or something like this and all the logic that i copied 5065 01:39:17,350 --> 01:39:17,360 and all the logic that i copied 5066 01:39:17,360 --> 01:39:20,470 and all the logic that i copied will be just simply pasted in that 5067 01:39:20,470 --> 01:39:20,480 will be just simply pasted in that 5068 01:39:20,480 --> 01:39:21,990 will be just simply pasted in that function like this 5069 01:39:21,990 --> 01:39:22,000 function like this 5070 01:39:22,000 --> 01:39:24,470 function like this so now we have the logic nicely 5071 01:39:24,470 --> 01:39:24,480 so now we have the logic nicely 5072 01:39:24,480 --> 01:39:27,510 so now we have the logic nicely encapsulated in its own function 5073 01:39:27,510 --> 01:39:27,520 encapsulated in its own function 5074 01:39:27,520 --> 01:39:29,669 encapsulated in its own function but as you know when we create a 5075 01:39:29,669 --> 01:39:29,679 but as you know when we create a 5076 01:39:29,679 --> 01:39:31,510 but as you know when we create a function we have to call that function 5077 01:39:31,510 --> 01:39:31,520 function we have to call that function 5078 01:39:31,520 --> 01:39:33,189 function we have to call that function otherwise nothing happens 5079 01:39:33,189 --> 01:39:33,199 otherwise nothing happens 5080 01:39:33,199 --> 01:39:36,709 otherwise nothing happens so we're gonna call it right here 5081 01:39:36,709 --> 01:39:36,719 so we're gonna call it right here 5082 01:39:36,719 --> 01:39:38,870 so we're gonna call it right here we don't have parameters and we don't 5083 01:39:38,870 --> 01:39:38,880 we don't have parameters and we don't 5084 01:39:38,880 --> 01:39:39,990 we don't have parameters and we don't have to provide a user 5085 01:39:39,990 --> 01:39:40,000 have to provide a user 5086 01:39:40,000 --> 01:39:42,950 have to provide a user input because user input is a global 5087 01:39:42,950 --> 01:39:42,960 input because user input is a global 5088 01:39:42,960 --> 01:39:43,910 input because user input is a global variable 5089 01:39:43,910 --> 01:39:43,920 variable 5090 01:39:43,920 --> 01:39:47,109 variable so our function has access to it let's 5091 01:39:47,109 --> 01:39:47,119 so our function has access to it let's 5092 01:39:47,119 --> 01:39:50,950 so our function has access to it let's actually test it out 5093 01:39:53,990 --> 01:39:54,000 and it works and let's provide some bad 5094 01:39:54,000 --> 01:39:58,550 and it works and let's provide some bad input 5095 01:40:01,510 --> 01:40:01,520 and it works too so that's actually a 5096 01:40:01,520 --> 01:40:03,590 and it works too so that's actually a proper way of writing code 5097 01:40:03,590 --> 01:40:03,600 proper way of writing code 5098 01:40:03,600 --> 01:40:06,149 proper way of writing code having every piece of logic in its own 5099 01:40:06,149 --> 01:40:06,159 having every piece of logic in its own 5100 01:40:06,159 --> 01:40:06,870 having every piece of logic in its own function 5101 01:40:06,870 --> 01:40:06,880 function 5102 01:40:06,880 --> 01:40:08,709 function with a proper description for the 5103 01:40:08,709 --> 01:40:08,719 with a proper description for the 5104 01:40:08,719 --> 01:40:12,550 with a proper description for the function 5105 01:40:15,350 --> 01:40:15,360 now as a next step i want to show you 5106 01:40:15,360 --> 01:40:17,109 now as a next step i want to show you also a concept or something that you 5107 01:40:17,109 --> 01:40:17,119 also a concept or something that you 5108 01:40:17,119 --> 01:40:17,910 also a concept or something that you will encounter 5109 01:40:17,910 --> 01:40:17,920 will encounter 5110 01:40:17,920 --> 01:40:21,270 will encounter very often in code which is nested 5111 01:40:21,270 --> 01:40:21,280 very often in code which is nested 5112 01:40:21,280 --> 01:40:24,470 very often in code which is nested if else statements and i'm going to show 5113 01:40:24,470 --> 01:40:24,480 if else statements and i'm going to show 5114 01:40:24,480 --> 01:40:25,750 if else statements and i'm going to show that example by 5115 01:40:25,750 --> 01:40:25,760 that example by 5116 01:40:25,760 --> 01:40:29,430 that example by cleaning up our program a little bit 5117 01:40:29,430 --> 01:40:29,440 cleaning up our program a little bit 5118 01:40:29,440 --> 01:40:31,750 cleaning up our program a little bit so as you see here we're doing 5119 01:40:31,750 --> 01:40:31,760 so as you see here we're doing 5120 01:40:31,760 --> 01:40:33,910 so as you see here we're doing validation in two different places 5121 01:40:33,910 --> 01:40:33,920 validation in two different places 5122 01:40:33,920 --> 01:40:36,629 validation in two different places so we're validating user input here but 5123 01:40:36,629 --> 01:40:36,639 so we're validating user input here but 5124 01:40:36,639 --> 01:40:37,590 so we're validating user input here but also 5125 01:40:37,590 --> 01:40:37,600 also 5126 01:40:37,600 --> 01:40:41,590 also inside these two units function itself 5127 01:40:41,590 --> 01:40:41,600 inside these two units function itself 5128 01:40:41,600 --> 01:40:43,910 inside these two units function itself so what we can do is we can put all the 5129 01:40:43,910 --> 01:40:43,920 so what we can do is we can put all the 5130 01:40:43,920 --> 01:40:45,350 so what we can do is we can put all the validation in one place 5131 01:40:45,350 --> 01:40:45,360 validation in one place 5132 01:40:45,360 --> 01:40:47,750 validation in one place in this validate and execute function 5133 01:40:47,750 --> 01:40:47,760 in this validate and execute function 5134 01:40:47,760 --> 01:40:48,629 in this validate and execute function and basically 5135 01:40:48,629 --> 01:40:48,639 and basically 5136 01:40:48,639 --> 01:40:52,390 and basically have all the validate logic in here 5137 01:40:52,390 --> 01:40:52,400 have all the validate logic in here 5138 01:40:52,400 --> 01:40:55,430 have all the validate logic in here and let the days to units function just 5139 01:40:55,430 --> 01:40:55,440 and let the days to units function just 5140 01:40:55,440 --> 01:40:56,149 and let the days to units function just do the 5141 01:40:56,149 --> 01:40:56,159 do the 5142 01:40:56,159 --> 01:40:58,709 do the calculation and not the validation and 5143 01:40:58,709 --> 01:40:58,719 calculation and not the validation and 5144 01:40:58,719 --> 01:40:59,270 calculation and not the validation and this way 5145 01:40:59,270 --> 01:40:59,280 this way 5146 01:40:59,280 --> 01:41:01,910 this way our functions and code will be a little 5147 01:41:01,910 --> 01:41:01,920 our functions and code will be a little 5148 01:41:01,920 --> 01:41:02,470 our functions and code will be a little bit 5149 01:41:02,470 --> 01:41:02,480 bit 5150 01:41:02,480 --> 01:41:06,470 bit cleaner and more logically built 5151 01:41:06,470 --> 01:41:06,480 cleaner and more logically built 5152 01:41:06,480 --> 01:41:09,910 cleaner and more logically built so after we validate that user input is 5153 01:41:09,910 --> 01:41:09,920 so after we validate that user input is 5154 01:41:09,920 --> 01:41:13,430 so after we validate that user input is digit we convert it into an integer 5155 01:41:13,430 --> 01:41:13,440 digit we convert it into an integer 5156 01:41:13,440 --> 01:41:16,070 digit we convert it into an integer so right here we have an integer value 5157 01:41:16,070 --> 01:41:16,080 so right here we have an integer value 5158 01:41:16,080 --> 01:41:17,350 so right here we have an integer value of the user input 5159 01:41:17,350 --> 01:41:17,360 of the user input 5160 01:41:17,360 --> 01:41:19,510 of the user input so we can actually check whether that 5161 01:41:19,510 --> 01:41:19,520 so we can actually check whether that 5162 01:41:19,520 --> 01:41:20,790 so we can actually check whether that integer value is 5163 01:41:20,790 --> 01:41:20,800 integer value is 5164 01:41:20,800 --> 01:41:23,910 integer value is greater than zero or equal to zero and 5165 01:41:23,910 --> 01:41:23,920 greater than zero or equal to zero and 5166 01:41:23,920 --> 01:41:24,950 greater than zero or equal to zero and we can do that 5167 01:41:24,950 --> 01:41:24,960 we can do that 5168 01:41:24,960 --> 01:41:27,590 we can do that right here without passing it on to the 5169 01:41:27,590 --> 01:41:27,600 right here without passing it on to the 5170 01:41:27,600 --> 01:41:28,790 right here without passing it on to the days to units 5171 01:41:28,790 --> 01:41:28,800 days to units 5172 01:41:28,800 --> 01:41:31,590 days to units function and just like this if 5173 01:41:31,590 --> 01:41:31,600 function and just like this if 5174 01:41:31,600 --> 01:41:32,550 function and just like this if conditional 5175 01:41:32,550 --> 01:41:32,560 conditional 5176 01:41:32,560 --> 01:41:35,669 conditional we're gonna do user input number 5177 01:41:35,669 --> 01:41:35,679 we're gonna do user input number 5178 01:41:35,679 --> 01:41:39,030 we're gonna do user input number greater than zero if that's the case 5179 01:41:39,030 --> 01:41:39,040 greater than zero if that's the case 5180 01:41:39,040 --> 01:41:42,070 greater than zero if that's the case we want the calculation to happen so 5181 01:41:42,070 --> 01:41:42,080 we want the calculation to happen so 5182 01:41:42,080 --> 01:41:44,470 we want the calculation to happen so both of these lines will get executed 5183 01:41:44,470 --> 01:41:44,480 both of these lines will get executed 5184 01:41:44,480 --> 01:41:46,870 both of these lines will get executed only if user input number is greater 5185 01:41:46,870 --> 01:41:46,880 only if user input number is greater 5186 01:41:46,880 --> 01:41:47,669 only if user input number is greater than zero 5187 01:41:47,669 --> 01:41:47,679 than zero 5188 01:41:47,679 --> 01:41:50,870 than zero and else in our case if it's 5189 01:41:50,870 --> 01:41:50,880 and else in our case if it's 5190 01:41:50,880 --> 01:41:54,390 and else in our case if it's exactly zero we want to print a message 5191 01:41:54,390 --> 01:41:54,400 exactly zero we want to print a message 5192 01:41:54,400 --> 01:41:56,950 exactly zero we want to print a message to user you entered zero and remember 5193 01:41:56,950 --> 01:41:56,960 to user you entered zero and remember 5194 01:41:56,960 --> 01:41:58,950 to user you entered zero and remember we've got the negative numbers already 5195 01:41:58,950 --> 01:41:58,960 we've got the negative numbers already 5196 01:41:58,960 --> 01:42:00,470 we've got the negative numbers already covered using 5197 01:42:00,470 --> 01:42:00,480 covered using 5198 01:42:00,480 --> 01:42:03,109 covered using this condition here so that's the one 5199 01:42:03,109 --> 01:42:03,119 this condition here so that's the one 5200 01:42:03,119 --> 01:42:03,830 this condition here so that's the one remaining 5201 01:42:03,830 --> 01:42:03,840 remaining 5202 01:42:03,840 --> 01:42:06,229 remaining i'm just going to copy that and paste it 5203 01:42:06,229 --> 01:42:06,239 i'm just going to copy that and paste it 5204 01:42:06,239 --> 01:42:07,590 i'm just going to copy that and paste it right here 5205 01:42:07,590 --> 01:42:07,600 right here 5206 01:42:07,600 --> 01:42:10,550 right here variable is called user input number so 5207 01:42:10,550 --> 01:42:10,560 variable is called user input number so 5208 01:42:10,560 --> 01:42:11,830 variable is called user input number so we'll fix that 5209 01:42:11,830 --> 01:42:11,840 we'll fix that 5210 01:42:11,840 --> 01:42:14,629 we'll fix that and we're going to print out that 5211 01:42:14,629 --> 01:42:14,639 and we're going to print out that 5212 01:42:14,639 --> 01:42:17,750 and we're going to print out that message 5213 01:42:20,229 --> 01:42:20,239 so that means we don't need any 5214 01:42:20,239 --> 01:42:21,669 so that means we don't need any validation 5215 01:42:21,669 --> 01:42:21,679 validation 5216 01:42:21,679 --> 01:42:26,550 validation right here we can 5217 01:42:29,990 --> 01:42:30,000 simply do the calculation 5218 01:42:30,000 --> 01:42:33,430 simply do the calculation so to go through this logical flow of if 5219 01:42:33,430 --> 01:42:33,440 so to go through this logical flow of if 5220 01:42:33,440 --> 01:42:35,990 so to go through this logical flow of if else or nested e-files 5221 01:42:35,990 --> 01:42:36,000 else or nested e-files 5222 01:42:36,000 --> 01:42:38,870 else or nested e-files statements we have the first if right 5223 01:42:38,870 --> 01:42:38,880 statements we have the first if right 5224 01:42:38,880 --> 01:42:39,430 statements we have the first if right here 5225 01:42:39,430 --> 01:42:39,440 here 5226 01:42:39,440 --> 01:42:42,870 here also note that indentations for 5227 01:42:42,870 --> 01:42:42,880 also note that indentations for 5228 01:42:42,880 --> 01:42:45,350 also note that indentations for these if else so basically they are on 5229 01:42:45,350 --> 01:42:45,360 these if else so basically they are on 5230 01:42:45,360 --> 01:42:46,229 these if else so basically they are on the same 5231 01:42:46,229 --> 01:42:46,239 the same 5232 01:42:46,239 --> 01:42:49,430 the same line here same position and 5233 01:42:49,430 --> 01:42:49,440 line here same position and 5234 01:42:49,440 --> 01:42:53,189 line here same position and the nested if else or in our case alif 5235 01:42:53,189 --> 01:42:53,199 the nested if else or in our case alif 5236 01:42:53,199 --> 01:42:55,430 the nested if else or in our case alif they're also in the same position so 5237 01:42:55,430 --> 01:42:55,440 they're also in the same position so 5238 01:42:55,440 --> 01:42:56,709 they're also in the same position so again first 5239 01:42:56,709 --> 01:42:56,719 again first 5240 01:42:56,719 --> 01:42:58,950 again first that's the big validation the first one 5241 01:42:58,950 --> 01:42:58,960 that's the big validation the first one 5242 01:42:58,960 --> 01:42:59,830 that's the big validation the first one is 5243 01:42:59,830 --> 01:42:59,840 is 5244 01:42:59,840 --> 01:43:02,550 is is the user input digit in the first 5245 01:43:02,550 --> 01:43:02,560 is the user input digit in the first 5246 01:43:02,560 --> 01:43:03,510 is the user input digit in the first place if not 5247 01:43:03,510 --> 01:43:03,520 place if not 5248 01:43:03,520 --> 01:43:06,870 place if not we basically shut down the program we 5249 01:43:06,870 --> 01:43:06,880 we basically shut down the program we 5250 01:43:06,880 --> 01:43:08,870 we basically shut down the program we print out a message to the user and 5251 01:43:08,870 --> 01:43:08,880 print out a message to the user and 5252 01:43:08,880 --> 01:43:10,149 print out a message to the user and that's it 5253 01:43:10,149 --> 01:43:10,159 that's it 5254 01:43:10,159 --> 01:43:13,669 that's it if it is a digit then we need additional 5255 01:43:13,669 --> 01:43:13,679 if it is a digit then we need additional 5256 01:43:13,679 --> 01:43:16,870 if it is a digit then we need additional validation is that digit a positive 5257 01:43:16,870 --> 01:43:16,880 validation is that digit a positive 5258 01:43:16,880 --> 01:43:17,750 validation is that digit a positive number 5259 01:43:17,750 --> 01:43:17,760 number 5260 01:43:17,760 --> 01:43:20,870 number or is it a zero so we do that additional 5261 01:43:20,870 --> 01:43:20,880 or is it a zero so we do that additional 5262 01:43:20,880 --> 01:43:22,870 or is it a zero so we do that additional validation using a nested ifall 5263 01:43:22,870 --> 01:43:22,880 validation using a nested ifall 5264 01:43:22,880 --> 01:43:23,590 validation using a nested ifall statement 5265 01:43:23,590 --> 01:43:23,600 statement 5266 01:43:23,600 --> 01:43:26,709 statement and basically this line gets executed 5267 01:43:26,709 --> 01:43:26,719 and basically this line gets executed 5268 01:43:26,719 --> 01:43:29,830 and basically this line gets executed only if it is a valid number and if it's 5269 01:43:29,830 --> 01:43:29,840 only if it is a valid number and if it's 5270 01:43:29,840 --> 01:43:32,950 only if it is a valid number and if it's a positive number and because of that 5271 01:43:32,950 --> 01:43:32,960 a positive number and because of that 5272 01:43:32,960 --> 01:43:35,510 a positive number and because of that we don't need any additional validation 5273 01:43:35,510 --> 01:43:35,520 we don't need any additional validation 5274 01:43:35,520 --> 01:43:36,709 we don't need any additional validation once the 5275 01:43:36,709 --> 01:43:36,719 once the 5276 01:43:36,719 --> 01:43:40,310 once the these two units function gets cold 5277 01:43:40,310 --> 01:43:40,320 these two units function gets cold 5278 01:43:40,320 --> 01:43:42,390 these two units function gets cold and you probably already think and 5279 01:43:42,390 --> 01:43:42,400 and you probably already think and 5280 01:43:42,400 --> 01:43:43,830 and you probably already think and notice that nested 5281 01:43:43,830 --> 01:43:43,840 notice that nested 5282 01:43:43,840 --> 01:43:46,709 notice that nested if else statements are not the most 5283 01:43:46,709 --> 01:43:46,719 if else statements are not the most 5284 01:43:46,719 --> 01:43:48,070 if else statements are not the most beautiful thing in the world they are 5285 01:43:48,070 --> 01:43:48,080 beautiful thing in the world they are 5286 01:43:48,080 --> 01:43:48,470 beautiful thing in the world they are pretty 5287 01:43:48,470 --> 01:43:48,480 pretty 5288 01:43:48,480 --> 01:43:50,790 pretty ugly actually and especially we have 5289 01:43:50,790 --> 01:43:50,800 ugly actually and especially we have 5290 01:43:50,800 --> 01:43:52,070 ugly actually and especially we have multiple of them or 5291 01:43:52,070 --> 01:43:52,080 multiple of them or 5292 01:43:52,080 --> 01:43:55,350 multiple of them or multiple else ifs in between 5293 01:43:55,350 --> 01:43:55,360 multiple else ifs in between 5294 01:43:55,360 --> 01:43:57,750 multiple else ifs in between the function may actually end up looking 5295 01:43:57,750 --> 01:43:57,760 the function may actually end up looking 5296 01:43:57,760 --> 01:43:58,790 the function may actually end up looking pretty bad 5297 01:43:58,790 --> 01:43:58,800 pretty bad 5298 01:43:58,800 --> 01:44:01,350 pretty bad so it's not recommended to have multiple 5299 01:44:01,350 --> 01:44:01,360 so it's not recommended to have multiple 5300 01:44:01,360 --> 01:44:02,310 so it's not recommended to have multiple levels of these 5301 01:44:02,310 --> 01:44:02,320 levels of these 5302 01:44:02,320 --> 01:44:05,669 levels of these nested if else statements in your code 5303 01:44:05,669 --> 01:44:05,679 nested if else statements in your code 5304 01:44:05,679 --> 01:44:08,950 nested if else statements in your code to basically just keep it clean but as i 5305 01:44:08,950 --> 01:44:08,960 to basically just keep it clean but as i 5306 01:44:08,960 --> 01:44:09,590 to basically just keep it clean but as i said 5307 01:44:09,590 --> 01:44:09,600 said 5308 01:44:09,600 --> 01:44:12,870 said you will encounter it a lot in programs 5309 01:44:12,870 --> 01:44:12,880 you will encounter it a lot in programs 5310 01:44:12,880 --> 01:44:14,310 you will encounter it a lot in programs in application code 5311 01:44:14,310 --> 01:44:14,320 in application code 5312 01:44:14,320 --> 01:44:16,149 in application code because sometimes you just have to write 5313 01:44:16,149 --> 01:44:16,159 because sometimes you just have to write 5314 01:44:16,159 --> 01:44:20,149 because sometimes you just have to write it like this 5315 01:44:20,149 --> 01:44:20,159 it like this 5316 01:44:20,159 --> 01:44:22,390 it like this thing i want to show you here is 5317 01:44:22,390 --> 01:44:22,400 thing i want to show you here is 5318 01:44:22,400 --> 01:44:23,350 thing i want to show you here is something called 5319 01:44:23,350 --> 01:44:23,360 something called 5320 01:44:23,360 --> 01:44:27,189 something called a try accept in python so right here as 5321 01:44:27,189 --> 01:44:27,199 a try accept in python so right here as 5322 01:44:27,199 --> 01:44:28,870 a try accept in python so right here as you see we're validating 5323 01:44:28,870 --> 01:44:28,880 you see we're validating 5324 01:44:28,880 --> 01:44:30,950 you see we're validating user input right and then we're 5325 01:44:30,950 --> 01:44:30,960 user input right and then we're 5326 01:44:30,960 --> 01:44:33,270 user input right and then we're executing this part of code 5327 01:44:33,270 --> 01:44:33,280 executing this part of code 5328 01:44:33,280 --> 01:44:36,790 executing this part of code only if that condition is true 5329 01:44:36,790 --> 01:44:36,800 only if that condition is true 5330 01:44:36,800 --> 01:44:39,910 only if that condition is true what if we had logic here where 5331 01:44:39,910 --> 01:44:39,920 what if we had logic here where 5332 01:44:39,920 --> 01:44:43,030 what if we had logic here where there were multiple places where 5333 01:44:43,030 --> 01:44:43,040 there were multiple places where 5334 01:44:43,040 --> 01:44:45,750 there were multiple places where something could go wrong let's say a 5335 01:44:45,750 --> 01:44:45,760 something could go wrong let's say a 5336 01:44:45,760 --> 01:44:46,310 something could go wrong let's say a function 5337 01:44:46,310 --> 01:44:46,320 function 5338 01:44:46,320 --> 01:44:49,189 function execution could basically just blow up 5339 01:44:49,189 --> 01:44:49,199 execution could basically just blow up 5340 01:44:49,199 --> 01:44:50,070 execution could basically just blow up because of 5341 01:44:50,070 --> 01:44:50,080 because of 5342 01:44:50,080 --> 01:44:53,109 because of a wrong input or even 5343 01:44:53,109 --> 01:44:53,119 a wrong input or even 5344 01:44:53,119 --> 01:44:56,390 a wrong input or even as an example maybe this is digit 5345 01:44:56,390 --> 01:44:56,400 as an example maybe this is digit 5346 01:44:56,400 --> 01:44:59,669 as an example maybe this is digit doesn't actually cover all the use cases 5347 01:44:59,669 --> 01:44:59,679 doesn't actually cover all the use cases 5348 01:44:59,679 --> 01:45:01,830 doesn't actually cover all the use cases so maybe there is a value that user can 5349 01:45:01,830 --> 01:45:01,840 so maybe there is a value that user can 5350 01:45:01,840 --> 01:45:03,350 so maybe there is a value that user can input that will still 5351 01:45:03,350 --> 01:45:03,360 input that will still 5352 01:45:03,360 --> 01:45:05,669 input that will still blow up our program so instead of 5353 01:45:05,669 --> 01:45:05,679 blow up our program so instead of 5354 01:45:05,679 --> 01:45:08,070 blow up our program so instead of checking each such possible scenario 5355 01:45:08,070 --> 01:45:08,080 checking each such possible scenario 5356 01:45:08,080 --> 01:45:10,470 checking each such possible scenario using if statements and then doing the 5357 01:45:10,470 --> 01:45:10,480 using if statements and then doing the 5358 01:45:10,480 --> 01:45:12,470 using if statements and then doing the actual calculation once 5359 01:45:12,470 --> 01:45:12,480 actual calculation once 5360 01:45:12,480 --> 01:45:15,109 actual calculation once all those things have been validated 5361 01:45:15,109 --> 01:45:15,119 all those things have been validated 5362 01:45:15,119 --> 01:45:17,030 all those things have been validated what we can do instead 5363 01:45:17,030 --> 01:45:17,040 what we can do instead 5364 01:45:17,040 --> 01:45:20,229 what we can do instead is basically tell python 5365 01:45:20,229 --> 01:45:20,239 is basically tell python 5366 01:45:20,239 --> 01:45:23,270 is basically tell python something like try 5367 01:45:23,270 --> 01:45:23,280 something like try 5368 01:45:23,280 --> 01:45:27,109 something like try executing this part of code here 5369 01:45:27,109 --> 01:45:27,119 executing this part of code here 5370 01:45:27,119 --> 01:45:30,390 executing this part of code here and if something goes wrong so if any 5371 01:45:30,390 --> 01:45:30,400 and if something goes wrong so if any 5372 01:45:30,400 --> 01:45:33,510 and if something goes wrong so if any line any function call or any logic 5373 01:45:33,510 --> 01:45:33,520 line any function call or any logic 5374 01:45:33,520 --> 01:45:34,310 line any function call or any logic execution 5375 01:45:34,310 --> 01:45:34,320 execution 5376 01:45:34,320 --> 01:45:37,510 execution fails we want to catch that error and we 5377 01:45:37,510 --> 01:45:37,520 fails we want to catch that error and we 5378 01:45:37,520 --> 01:45:39,750 fails we want to catch that error and we want to control what happens 5379 01:45:39,750 --> 01:45:39,760 want to control what happens 5380 01:45:39,760 --> 01:45:42,070 want to control what happens with that error ourselves 5381 01:45:42,070 --> 01:45:42,080 with that error ourselves 5382 01:45:42,080 --> 01:45:43,270 with that error ourselves programmatically 5383 01:45:43,270 --> 01:45:43,280 programmatically 5384 01:45:43,280 --> 01:45:46,790 programmatically and then catch logic will be 5385 01:45:46,790 --> 01:45:46,800 and then catch logic will be 5386 01:45:46,800 --> 01:45:50,790 and then catch logic will be accept and we're going to specify 5387 01:45:50,790 --> 01:45:50,800 accept and we're going to specify 5388 01:45:50,800 --> 01:45:53,910 accept and we're going to specify what type of value we want to catch 5389 01:45:53,910 --> 01:45:53,920 what type of value we want to catch 5390 01:45:53,920 --> 01:45:57,109 what type of value we want to catch basically using this block 5391 01:45:57,109 --> 01:45:57,119 basically using this block 5392 01:45:57,119 --> 01:46:00,229 basically using this block and the name of that error type is 5393 01:46:00,229 --> 01:46:00,239 and the name of that error type is 5394 01:46:00,239 --> 01:46:03,109 and the name of that error type is actually what we saw in the output when 5395 01:46:03,109 --> 01:46:03,119 actually what we saw in the output when 5396 01:46:03,119 --> 01:46:03,990 actually what we saw in the output when we provided 5397 01:46:03,990 --> 01:46:04,000 we provided 5398 01:46:04,000 --> 01:46:07,030 we provided some text and a float which 5399 01:46:07,030 --> 01:46:07,040 some text and a float which 5400 01:46:07,040 --> 01:46:10,550 some text and a float which is value error 5401 01:46:10,550 --> 01:46:10,560 is value error 5402 01:46:10,560 --> 01:46:12,229 is value error so that's the error that we want to 5403 01:46:12,229 --> 01:46:12,239 so that's the error that we want to 5404 01:46:12,239 --> 01:46:14,229 so that's the error that we want to catch basically so 5405 01:46:14,229 --> 01:46:14,239 catch basically so 5406 01:46:14,239 --> 01:46:17,109 catch basically so again we tell python you know what try 5407 01:46:17,109 --> 01:46:17,119 again we tell python you know what try 5408 01:46:17,119 --> 01:46:17,430 again we tell python you know what try to 5409 01:46:17,430 --> 01:46:17,440 to 5410 01:46:17,440 --> 01:46:20,470 to execute this block of code here 5411 01:46:20,470 --> 01:46:20,480 execute this block of code here 5412 01:46:20,480 --> 01:46:24,470 execute this block of code here and if one of those lines in that code 5413 01:46:24,470 --> 01:46:24,480 and if one of those lines in that code 5414 01:46:24,480 --> 01:46:27,430 and if one of those lines in that code results into a value error then instead 5415 01:46:27,430 --> 01:46:27,440 results into a value error then instead 5416 01:46:27,440 --> 01:46:28,070 results into a value error then instead of just 5417 01:46:28,070 --> 01:46:28,080 of just 5418 01:46:28,080 --> 01:46:30,070 of just crashing the program basically catch 5419 01:46:30,070 --> 01:46:30,080 crashing the program basically catch 5420 01:46:30,080 --> 01:46:31,270 crashing the program basically catch that error 5421 01:46:31,270 --> 01:46:31,280 that error 5422 01:46:31,280 --> 01:46:34,390 that error and print out a friendly message to a 5423 01:46:34,390 --> 01:46:34,400 and print out a friendly message to a 5424 01:46:34,400 --> 01:46:35,350 and print out a friendly message to a user 5425 01:46:35,350 --> 01:46:35,360 user 5426 01:46:35,360 --> 01:46:38,790 user so let's actually try this out 5427 01:46:38,790 --> 01:46:38,800 so let's actually try this out 5428 01:46:38,800 --> 01:46:40,470 so let's actually try this out and note that try doesn't have any 5429 01:46:40,470 --> 01:46:40,480 and note that try doesn't have any 5430 01:46:40,480 --> 01:46:41,910 and note that try doesn't have any validation 5431 01:46:41,910 --> 01:46:41,920 validation 5432 01:46:41,920 --> 01:46:45,270 validation like if statement so 5433 01:46:45,270 --> 01:46:45,280 like if statement so 5434 01:46:45,280 --> 01:46:49,030 like if statement so when i entered some text here 5435 01:46:49,030 --> 01:46:49,040 when i entered some text here 5436 01:46:49,040 --> 01:46:51,109 when i entered some text here int function will actually be called 5437 01:46:51,109 --> 01:46:51,119 int function will actually be called 5438 01:46:51,119 --> 01:46:52,149 int function will actually be called with some text 5439 01:46:52,149 --> 01:46:52,159 with some text 5440 01:46:52,159 --> 01:46:55,830 with some text and it will result in a value error and 5441 01:46:55,830 --> 01:46:55,840 and it will result in a value error and 5442 01:46:55,840 --> 01:46:58,950 and it will result in a value error and this block will then handle that error 5443 01:46:58,950 --> 01:46:58,960 this block will then handle that error 5444 01:46:58,960 --> 01:47:02,550 this block will then handle that error so i'm going to enter and and you see 5445 01:47:02,550 --> 01:47:02,560 so i'm going to enter and and you see 5446 01:47:02,560 --> 01:47:02,950 so i'm going to enter and and you see that 5447 01:47:02,950 --> 01:47:02,960 that 5448 01:47:02,960 --> 01:47:05,990 that your input is not a valid number message 5449 01:47:05,990 --> 01:47:06,000 your input is not a valid number message 5450 01:47:06,000 --> 01:47:09,030 your input is not a valid number message got printed and the same will work 5451 01:47:09,030 --> 01:47:09,040 got printed and the same will work 5452 01:47:09,040 --> 01:47:12,390 got printed and the same will work for a float number 5453 01:47:12,390 --> 01:47:12,400 for a float number 5454 01:47:12,400 --> 01:47:15,830 for a float number that also doesn't convert to integer and 5455 01:47:15,830 --> 01:47:15,840 that also doesn't convert to integer and 5456 01:47:15,840 --> 01:47:20,390 that also doesn't convert to integer and for a proper integer value 5457 01:47:20,390 --> 01:47:20,400 for a proper integer value 5458 01:47:20,400 --> 01:47:23,430 for a proper integer value it will work fine and 5459 01:47:23,430 --> 01:47:23,440 it will work fine and 5460 01:47:23,440 --> 01:47:25,750 it will work fine and again difference between if else 5461 01:47:25,750 --> 01:47:25,760 again difference between if else 5462 01:47:25,760 --> 01:47:27,830 again difference between if else statement and using try except 5463 01:47:27,830 --> 01:47:27,840 statement and using try except 5464 01:47:27,840 --> 01:47:30,709 statement and using try except is that you can cover multiple such 5465 01:47:30,709 --> 01:47:30,719 is that you can cover multiple such 5466 01:47:30,719 --> 01:47:31,669 is that you can cover multiple such errors 5467 01:47:31,669 --> 01:47:31,679 errors 5468 01:47:31,679 --> 01:47:34,709 errors with this whole try except block right 5469 01:47:34,709 --> 01:47:34,719 with this whole try except block right 5470 01:47:34,719 --> 01:47:37,350 with this whole try except block right so you don't have to do the validation 5471 01:47:37,350 --> 01:47:37,360 so you don't have to do the validation 5472 01:47:37,360 --> 01:47:40,229 so you don't have to do the validation specifically and that is especially 5473 01:47:40,229 --> 01:47:40,239 specifically and that is especially 5474 01:47:40,239 --> 01:47:42,550 specifically and that is especially useful for cases where you can't 5475 01:47:42,550 --> 01:47:42,560 useful for cases where you can't 5476 01:47:42,560 --> 01:47:45,750 useful for cases where you can't really validate something using if 5477 01:47:45,750 --> 01:47:45,760 really validate something using if 5478 01:47:45,760 --> 01:47:47,990 really validate something using if condition right if there is a chance 5479 01:47:47,990 --> 01:47:48,000 condition right if there is a chance 5480 01:47:48,000 --> 01:47:49,109 condition right if there is a chance that you might miss 5481 01:47:49,109 --> 01:47:49,119 that you might miss 5482 01:47:49,119 --> 01:47:51,750 that you might miss something in that condition check so 5483 01:47:51,750 --> 01:47:51,760 something in that condition check so 5484 01:47:51,760 --> 01:47:53,590 something in that condition check so basically you just say you know what 5485 01:47:53,590 --> 01:47:53,600 basically you just say you know what 5486 01:47:53,600 --> 01:47:56,550 basically you just say you know what just try to execute with whatever value 5487 01:47:56,550 --> 01:47:56,560 just try to execute with whatever value 5488 01:47:56,560 --> 01:47:57,109 just try to execute with whatever value and 5489 01:47:57,109 --> 01:47:57,119 and 5490 01:47:57,119 --> 01:48:00,070 and if error happens then i still got it 5491 01:48:00,070 --> 01:48:00,080 if error happens then i still got it 5492 01:48:00,080 --> 01:48:00,709 if error happens then i still got it covered 5493 01:48:00,709 --> 01:48:00,719 covered 5494 01:48:00,719 --> 01:48:03,590 covered and an obvious difference between this 5495 01:48:03,590 --> 01:48:03,600 and an obvious difference between this 5496 01:48:03,600 --> 01:48:04,870 and an obvious difference between this if else 5497 01:48:04,870 --> 01:48:04,880 if else 5498 01:48:04,880 --> 01:48:06,790 if else is that here nothing actually crashes 5499 01:48:06,790 --> 01:48:06,800 is that here nothing actually crashes 5500 01:48:06,800 --> 01:48:08,790 is that here nothing actually crashes the program the program will still work 5501 01:48:08,790 --> 01:48:08,800 the program the program will still work 5502 01:48:08,800 --> 01:48:09,430 the program the program will still work is just 5503 01:48:09,430 --> 01:48:09,440 is just 5504 01:48:09,440 --> 01:48:12,390 is just a nonsense value with zero days right 5505 01:48:12,390 --> 01:48:12,400 a nonsense value with zero days right 5506 01:48:12,400 --> 01:48:15,030 a nonsense value with zero days right and as you see here we have specified 5507 01:48:15,030 --> 01:48:15,040 and as you see here we have specified 5508 01:48:15,040 --> 01:48:18,070 and as you see here we have specified an error type but with try 5509 01:48:18,070 --> 01:48:18,080 an error type but with try 5510 01:48:18,080 --> 01:48:20,149 an error type but with try except what can also do is you can 5511 01:48:20,149 --> 01:48:20,159 except what can also do is you can 5512 01:48:20,159 --> 01:48:21,590 except what can also do is you can basically say you know what 5513 01:48:21,590 --> 01:48:21,600 basically say you know what 5514 01:48:21,600 --> 01:48:24,870 basically say you know what i want to cover any type of air i don't 5515 01:48:24,870 --> 01:48:24,880 i want to cover any type of air i don't 5516 01:48:24,880 --> 01:48:25,590 i want to cover any type of air i don't care if it's 5517 01:48:25,590 --> 01:48:25,600 care if it's 5518 01:48:25,600 --> 01:48:28,229 care if it's value air or some other type of air let 5519 01:48:28,229 --> 01:48:28,239 value air or some other type of air let 5520 01:48:28,239 --> 01:48:28,950 value air or some other type of air let me 5521 01:48:28,950 --> 01:48:28,960 me 5522 01:48:28,960 --> 01:48:31,430 me handle any type of air in this case you 5523 01:48:31,430 --> 01:48:31,440 handle any type of air in this case you 5524 01:48:31,440 --> 01:48:33,510 handle any type of air in this case you can basically just leave it without a 5525 01:48:33,510 --> 01:48:33,520 can basically just leave it without a 5526 01:48:33,520 --> 01:48:34,550 can basically just leave it without a specific type 5527 01:48:34,550 --> 01:48:34,560 specific type 5528 01:48:34,560 --> 01:48:36,870 specific type you get a warning though that it's too 5529 01:48:36,870 --> 01:48:36,880 you get a warning though that it's too 5530 01:48:36,880 --> 01:48:37,750 you get a warning though that it's too general 5531 01:48:37,750 --> 01:48:37,760 general 5532 01:48:37,760 --> 01:48:39,990 general however this would work and you will be 5533 01:48:39,990 --> 01:48:40,000 however this would work and you will be 5534 01:48:40,000 --> 01:48:42,310 however this would work and you will be covering all the air cases with it 5535 01:48:42,310 --> 01:48:42,320 covering all the air cases with it 5536 01:48:42,320 --> 01:48:44,790 covering all the air cases with it but we can go back to our value error 5537 01:48:44,790 --> 01:48:44,800 but we can go back to our value error 5538 01:48:44,800 --> 01:48:46,229 but we can go back to our value error and know that in many programming 5539 01:48:46,229 --> 01:48:46,239 and know that in many programming 5540 01:48:46,239 --> 01:48:48,470 and know that in many programming languages this is actually called a try 5541 01:48:48,470 --> 01:48:48,480 languages this is actually called a try 5542 01:48:48,480 --> 01:48:51,590 languages this is actually called a try catch so accept is actually pretty 5543 01:48:51,590 --> 01:48:51,600 catch so accept is actually pretty 5544 01:48:51,600 --> 01:48:52,229 catch so accept is actually pretty specific 5545 01:48:52,229 --> 01:48:52,239 specific 5546 01:48:52,239 --> 01:48:54,629 specific for python i personally think try catch 5547 01:48:54,629 --> 01:48:54,639 for python i personally think try catch 5548 01:48:54,639 --> 01:48:55,910 for python i personally think try catch makes more sense because you are 5549 01:48:55,910 --> 01:48:55,920 makes more sense because you are 5550 01:48:55,920 --> 01:48:56,950 makes more sense because you are catching 5551 01:48:56,950 --> 01:48:56,960 catching 5552 01:48:56,960 --> 01:48:59,270 catching any error that may happen right here and 5553 01:48:59,270 --> 01:48:59,280 any error that may happen right here and 5554 01:48:59,280 --> 01:49:01,109 any error that may happen right here and then basically 5555 01:49:01,109 --> 01:49:01,119 then basically 5556 01:49:01,119 --> 01:49:03,990 then basically handling it in the catch block so if you 5557 01:49:03,990 --> 01:49:04,000 handling it in the catch block so if you 5558 01:49:04,000 --> 01:49:05,109 handling it in the catch block so if you happen to hear or see 5559 01:49:05,109 --> 01:49:05,119 happen to hear or see 5560 01:49:05,119 --> 01:49:07,750 happen to hear or see try catch in other programming languages 5561 01:49:07,750 --> 01:49:07,760 try catch in other programming languages 5562 01:49:07,760 --> 01:49:08,390 try catch in other programming languages note that 5563 01:49:08,390 --> 01:49:08,400 note that 5564 01:49:08,400 --> 01:49:10,950 note that this is the same thing as try except in 5565 01:49:10,950 --> 01:49:10,960 this is the same thing as try except in 5566 01:49:10,960 --> 01:49:11,510 this is the same thing as try except in python 5567 01:49:11,510 --> 01:49:11,520 python 5568 01:49:11,520 --> 01:49:13,270 python one thing that we're missing because we 5569 01:49:13,270 --> 01:49:13,280 one thing that we're missing because we 5570 01:49:13,280 --> 01:49:14,950 one thing that we're missing because we converted that if statement 5571 01:49:14,950 --> 01:49:14,960 converted that if statement 5572 01:49:14,960 --> 01:49:18,070 converted that if statement into try except is now we need to 5573 01:49:18,070 --> 01:49:18,080 into try except is now we need to 5574 01:49:18,080 --> 01:49:20,070 into try except is now we need to validate the negative numbers again 5575 01:49:20,070 --> 01:49:20,080 validate the negative numbers again 5576 01:49:20,080 --> 01:49:22,229 validate the negative numbers again because negative numbers will not cause 5577 01:49:22,229 --> 01:49:22,239 because negative numbers will not cause 5578 01:49:22,239 --> 01:49:23,189 because negative numbers will not cause an error 5579 01:49:23,189 --> 01:49:23,199 an error 5580 01:49:23,199 --> 01:49:25,589 an error in our application so they're not 5581 01:49:25,589 --> 01:49:25,599 in our application so they're not 5582 01:49:25,599 --> 01:49:26,870 in our application so they're not covered by this 5583 01:49:26,870 --> 01:49:26,880 covered by this 5584 01:49:26,880 --> 01:49:30,870 covered by this except block here so let's add back 5585 01:49:30,870 --> 01:49:30,880 except block here so let's add back 5586 01:49:30,880 --> 01:49:34,629 except block here so let's add back our previous else block 5587 01:49:34,629 --> 01:49:34,639 our previous else block 5588 01:49:34,639 --> 01:49:38,629 our previous else block and again if neither of these 5589 01:49:38,629 --> 01:49:38,639 and again if neither of these 5590 01:49:38,639 --> 01:49:41,109 and again if neither of these are true it means automatically would 5591 01:49:41,109 --> 01:49:41,119 are true it means automatically would 5592 01:49:41,119 --> 01:49:44,229 are true it means automatically would mean that it is a negative number 5593 01:49:44,229 --> 01:49:44,239 mean that it is a negative number 5594 01:49:44,239 --> 01:49:47,589 mean that it is a negative number so let's 5595 01:49:47,589 --> 01:49:47,599 so let's 5596 01:49:47,599 --> 01:49:50,229 so let's print that message for a user enter 5597 01:49:50,229 --> 01:49:50,239 print that message for a user enter 5598 01:49:50,239 --> 01:49:55,830 print that message for a user enter negative number 5599 01:50:04,629 --> 01:50:04,639 so now we got all the cases covered 5600 01:50:04,639 --> 01:50:05,750 so now we got all the cases covered again 5601 01:50:05,750 --> 01:50:05,760 again 5602 01:50:05,760 --> 01:50:09,189 again so let's try that out -10 5603 01:50:09,189 --> 01:50:09,199 so let's try that out -10 5604 01:50:09,199 --> 01:50:13,589 so let's try that out -10 and there you go 5605 01:50:16,629 --> 01:50:16,639 now there is one minor problem with our 5606 01:50:16,639 --> 01:50:17,750 now there is one minor problem with our application 5607 01:50:17,750 --> 01:50:17,760 application 5608 01:50:17,760 --> 01:50:21,030 application and that is we can only use it once 5609 01:50:21,030 --> 01:50:21,040 and that is we can only use it once 5610 01:50:21,040 --> 01:50:24,390 and that is we can only use it once so basically whenever we type in a value 5611 01:50:24,390 --> 01:50:24,400 so basically whenever we type in a value 5612 01:50:24,400 --> 01:50:28,149 so basically whenever we type in a value it either calculates it or gives us 5613 01:50:28,149 --> 01:50:28,159 it either calculates it or gives us 5614 01:50:28,159 --> 01:50:30,950 it either calculates it or gives us a message that we provided an invalid 5615 01:50:30,950 --> 01:50:30,960 a message that we provided an invalid 5616 01:50:30,960 --> 01:50:31,669 a message that we provided an invalid value 5617 01:50:31,669 --> 01:50:31,679 value 5618 01:50:31,679 --> 01:50:34,470 value then the program basically exits so if 5619 01:50:34,470 --> 01:50:34,480 then the program basically exits so if 5620 01:50:34,480 --> 01:50:35,910 then the program basically exits so if we want to do a calculation 5621 01:50:35,910 --> 01:50:35,920 we want to do a calculation 5622 01:50:35,920 --> 01:50:37,910 we want to do a calculation for another value then we have to 5623 01:50:37,910 --> 01:50:37,920 for another value then we have to 5624 01:50:37,920 --> 01:50:39,510 for another value then we have to restart the application 5625 01:50:39,510 --> 01:50:39,520 restart the application 5626 01:50:39,520 --> 01:50:42,709 restart the application provided value and then do the same 5627 01:50:42,709 --> 01:50:42,719 provided value and then do the same 5628 01:50:42,719 --> 01:50:45,430 provided value and then do the same so that's not very convenient if we want 5629 01:50:45,430 --> 01:50:45,440 so that's not very convenient if we want 5630 01:50:45,440 --> 01:50:47,189 so that's not very convenient if we want to use that program to 5631 01:50:47,189 --> 01:50:47,199 to use that program to 5632 01:50:47,199 --> 01:50:50,229 to use that program to basically calculate a number of hours 5633 01:50:50,229 --> 01:50:50,239 basically calculate a number of hours 5634 01:50:50,239 --> 01:50:52,470 basically calculate a number of hours for many different values so basically 5635 01:50:52,470 --> 01:50:52,480 for many different values so basically 5636 01:50:52,480 --> 01:50:53,510 for many different values so basically we want to 5637 01:50:53,510 --> 01:50:53,520 we want to 5638 01:50:53,520 --> 01:50:56,390 we want to keep fitting it some different values 5639 01:50:56,390 --> 01:50:56,400 keep fitting it some different values 5640 01:50:56,400 --> 01:50:57,669 keep fitting it some different values for calculation 5641 01:50:57,669 --> 01:50:57,679 for calculation 5642 01:50:57,679 --> 01:50:59,030 for calculation because we don't want to restart the 5643 01:50:59,030 --> 01:50:59,040 because we don't want to restart the 5644 01:50:59,040 --> 01:51:01,109 because we don't want to restart the application over and over again 5645 01:51:01,109 --> 01:51:01,119 application over and over again 5646 01:51:01,119 --> 01:51:04,390 application over and over again so how can we actually make the program 5647 01:51:04,390 --> 01:51:04,400 so how can we actually make the program 5648 01:51:04,400 --> 01:51:08,470 so how can we actually make the program continue after it's calculated the first 5649 01:51:08,470 --> 01:51:08,480 continue after it's calculated the first 5650 01:51:08,480 --> 01:51:09,109 continue after it's calculated the first value 5651 01:51:09,109 --> 01:51:09,119 value 5652 01:51:09,119 --> 01:51:11,350 value so we want the program to basically just 5653 01:51:11,350 --> 01:51:11,360 so we want the program to basically just 5654 01:51:11,360 --> 01:51:12,870 so we want the program to basically just keep running and 5655 01:51:12,870 --> 01:51:12,880 keep running and 5656 01:51:12,880 --> 01:51:16,149 keep running and accepting our values so how do we do 5657 01:51:16,149 --> 01:51:16,159 accepting our values so how do we do 5658 01:51:16,159 --> 01:51:16,709 accepting our values so how do we do that 5659 01:51:16,709 --> 01:51:16,719 that 5660 01:51:16,719 --> 01:51:19,350 that and we can implement the logic using 5661 01:51:19,350 --> 01:51:19,360 and we can implement the logic using 5662 01:51:19,360 --> 01:51:20,550 and we can implement the logic using something called 5663 01:51:20,550 --> 01:51:20,560 something called 5664 01:51:20,560 --> 01:51:23,669 something called while loop concept of loops in 5665 01:51:23,669 --> 01:51:23,679 while loop concept of loops in 5666 01:51:23,679 --> 01:51:24,390 while loop concept of loops in programming 5667 01:51:24,390 --> 01:51:24,400 programming 5668 01:51:24,400 --> 01:51:28,390 programming is basically you do the same thing 5669 01:51:28,390 --> 01:51:28,400 is basically you do the same thing 5670 01:51:28,400 --> 01:51:31,669 is basically you do the same thing so the same logic gets executed 5671 01:51:31,669 --> 01:51:31,679 so the same logic gets executed 5672 01:51:31,679 --> 01:51:35,030 so the same logic gets executed multiple times in a loop and how many 5673 01:51:35,030 --> 01:51:35,040 multiple times in a loop and how many 5674 01:51:35,040 --> 01:51:35,990 multiple times in a loop and how many times 5675 01:51:35,990 --> 01:51:36,000 times 5676 01:51:36,000 --> 01:51:38,870 times that logic gets executed is basically 5677 01:51:38,870 --> 01:51:38,880 that logic gets executed is basically 5678 01:51:38,880 --> 01:51:39,669 that logic gets executed is basically defined 5679 01:51:39,669 --> 01:51:39,679 defined 5680 01:51:39,679 --> 01:51:42,310 defined in the condition of that loop and the 5681 01:51:42,310 --> 01:51:42,320 in the condition of that loop and the 5682 01:51:42,320 --> 01:51:43,350 in the condition of that loop and the condition could be 5683 01:51:43,350 --> 01:51:43,360 condition could be 5684 01:51:43,360 --> 01:51:45,830 condition could be it should run 10 times or condition 5685 01:51:45,830 --> 01:51:45,840 it should run 10 times or condition 5686 01:51:45,840 --> 01:51:46,709 it should run 10 times or condition could also be 5687 01:51:46,709 --> 01:51:46,719 could also be 5688 01:51:46,719 --> 01:51:50,149 could also be it should run until some specific 5689 01:51:50,149 --> 01:51:50,159 it should run until some specific 5690 01:51:50,159 --> 01:51:53,510 it should run until some specific event happens in the application and 5691 01:51:53,510 --> 01:51:53,520 event happens in the application and 5692 01:51:53,520 --> 01:51:56,709 event happens in the application and conditions you already know from if else 5693 01:51:56,709 --> 01:51:56,719 conditions you already know from if else 5694 01:51:56,719 --> 01:51:57,589 conditions you already know from if else statement 5695 01:51:57,589 --> 01:51:57,599 statement 5696 01:51:57,599 --> 01:52:00,709 statement conditions are basically logic that 5697 01:52:00,709 --> 01:52:00,719 conditions are basically logic that 5698 01:52:00,719 --> 01:52:01,990 conditions are basically logic that gives you either true 5699 01:52:01,990 --> 01:52:02,000 gives you either true 5700 01:52:02,000 --> 01:52:04,950 gives you either true or false so condition is checking some 5701 01:52:04,950 --> 01:52:04,960 or false so condition is checking some 5702 01:52:04,960 --> 01:52:05,910 or false so condition is checking some logic and then 5703 01:52:05,910 --> 01:52:05,920 logic and then 5704 01:52:05,920 --> 01:52:08,070 logic and then giving you a result which is either true 5705 01:52:08,070 --> 01:52:08,080 giving you a result which is either true 5706 01:52:08,080 --> 01:52:09,109 giving you a result which is either true or false 5707 01:52:09,109 --> 01:52:09,119 or false 5708 01:52:09,119 --> 01:52:11,430 or false so now the question is how many times do 5709 01:52:11,430 --> 01:52:11,440 so now the question is how many times do 5710 01:52:11,440 --> 01:52:13,750 so now the question is how many times do we want this application to run 5711 01:52:13,750 --> 01:52:13,760 we want this application to run 5712 01:52:13,760 --> 01:52:15,990 we want this application to run in our case let's say we want to run 5713 01:52:15,990 --> 01:52:16,000 in our case let's say we want to run 5714 01:52:16,000 --> 01:52:16,870 in our case let's say we want to run indefinitely 5715 01:52:16,870 --> 01:52:16,880 indefinitely 5716 01:52:16,880 --> 01:52:19,669 indefinitely right until we actually stop it from 5717 01:52:19,669 --> 01:52:19,679 right until we actually stop it from 5718 01:52:19,679 --> 01:52:21,510 right until we actually stop it from here until we kill the program 5719 01:52:21,510 --> 01:52:21,520 here until we kill the program 5720 01:52:21,520 --> 01:52:24,390 here until we kill the program so it means the condition for that 5721 01:52:24,390 --> 01:52:24,400 so it means the condition for that 5722 01:52:24,400 --> 01:52:24,870 so it means the condition for that should 5723 01:52:24,870 --> 01:52:24,880 should 5724 01:52:24,880 --> 01:52:29,430 should always be true and for our application 5725 01:52:29,430 --> 01:52:29,440 always be true and for our application 5726 01:52:29,440 --> 01:52:31,830 always be true and for our application we're going to use a while loop which is 5727 01:52:31,830 --> 01:52:31,840 we're going to use a while loop which is 5728 01:52:31,840 --> 01:52:32,629 we're going to use a while loop which is one 5729 01:52:32,629 --> 01:52:32,639 one 5730 01:52:32,639 --> 01:52:36,870 one type of a loop and very simple syntax 5731 01:52:36,870 --> 01:52:36,880 type of a loop and very simple syntax 5732 01:52:36,880 --> 01:52:40,229 type of a loop and very simple syntax while and while just like if actually 5733 01:52:40,229 --> 01:52:40,239 while and while just like if actually 5734 01:52:40,239 --> 01:52:40,709 while and while just like if actually takes 5735 01:52:40,709 --> 01:52:40,719 takes 5736 01:52:40,719 --> 01:52:42,550 takes a condition this is going to be the 5737 01:52:42,550 --> 01:52:42,560 a condition this is going to be the 5738 01:52:42,560 --> 01:52:44,310 a condition this is going to be the condition for the loop 5739 01:52:44,310 --> 01:52:44,320 condition for the loop 5740 01:52:44,320 --> 01:52:46,790 condition for the loop so basically we want to tell the while 5741 01:52:46,790 --> 01:52:46,800 so basically we want to tell the while 5742 01:52:46,800 --> 01:52:48,149 so basically we want to tell the while loop how many times 5743 01:52:48,149 --> 01:52:48,159 loop how many times 5744 01:52:48,159 --> 01:52:51,910 loop how many times it should run the logic coming after it 5745 01:52:51,910 --> 01:52:51,920 it should run the logic coming after it 5746 01:52:51,920 --> 01:52:54,070 it should run the logic coming after it and again you know our familiar 5747 01:52:54,070 --> 01:52:54,080 and again you know our familiar 5748 01:52:54,080 --> 01:52:55,430 and again you know our familiar indentation 5749 01:52:55,430 --> 01:52:55,440 indentation 5750 01:52:55,440 --> 01:52:58,629 indentation these two lines should execute in a loop 5751 01:52:58,629 --> 01:52:58,639 these two lines should execute in a loop 5752 01:52:58,639 --> 01:53:01,830 these two lines should execute in a loop over and over again with some condition 5753 01:53:01,830 --> 01:53:01,840 over and over again with some condition 5754 01:53:01,840 --> 01:53:04,550 over and over again with some condition right here so how many times do we want 5755 01:53:04,550 --> 01:53:04,560 right here so how many times do we want 5756 01:53:04,560 --> 01:53:06,390 right here so how many times do we want the program to execute 5757 01:53:06,390 --> 01:53:06,400 the program to execute 5758 01:53:06,400 --> 01:53:09,589 the program to execute in our specific case well we want the 5759 01:53:09,589 --> 01:53:09,599 in our specific case well we want the 5760 01:53:09,599 --> 01:53:10,870 in our specific case well we want the program to 5761 01:53:10,870 --> 01:53:10,880 program to 5762 01:53:10,880 --> 01:53:14,149 program to run indefinitely until we actually stop 5763 01:53:14,149 --> 01:53:14,159 run indefinitely until we actually stop 5764 01:53:14,159 --> 01:53:14,950 run indefinitely until we actually stop it from here 5765 01:53:14,950 --> 01:53:14,960 it from here 5766 01:53:14,960 --> 01:53:18,149 it from here right from our editor so 5767 01:53:18,149 --> 01:53:18,159 right from our editor so 5768 01:53:18,159 --> 01:53:21,350 right from our editor so that means that condition of the loop 5769 01:53:21,350 --> 01:53:21,360 that means that condition of the loop 5770 01:53:21,360 --> 01:53:24,390 that means that condition of the loop that decides whether the next lines 5771 01:53:24,390 --> 01:53:24,400 that decides whether the next lines 5772 01:53:24,400 --> 01:53:27,189 that decides whether the next lines should get executed or not in our case 5773 01:53:27,189 --> 01:53:27,199 should get executed or not in our case 5774 01:53:27,199 --> 01:53:28,790 should get executed or not in our case should always be 5775 01:53:28,790 --> 01:53:28,800 should always be 5776 01:53:28,800 --> 01:53:32,070 should always be true because if it's false then 5777 01:53:32,070 --> 01:53:32,080 true because if it's false then 5778 01:53:32,080 --> 01:53:35,270 true because if it's false then the loop will stop right no execution 5779 01:53:35,270 --> 01:53:35,280 the loop will stop right no execution 5780 01:53:35,280 --> 01:53:35,990 the loop will stop right no execution anymore 5781 01:53:35,990 --> 01:53:36,000 anymore 5782 01:53:36,000 --> 01:53:38,870 anymore so how can we make sure it's always true 5783 01:53:38,870 --> 01:53:38,880 so how can we make sure it's always true 5784 01:53:38,880 --> 01:53:40,229 so how can we make sure it's always true we just write 5785 01:53:40,229 --> 01:53:40,239 we just write 5786 01:53:40,239 --> 01:53:43,830 we just write true right here and you remember i told 5787 01:53:43,830 --> 01:53:43,840 true right here and you remember i told 5788 01:53:43,840 --> 01:53:45,910 true right here and you remember i told you that true and false in 5789 01:53:45,910 --> 01:53:45,920 you that true and false in 5790 01:53:45,920 --> 01:53:47,510 you that true and false in programming languages have their own 5791 01:53:47,510 --> 01:53:47,520 programming languages have their own 5792 01:53:47,520 --> 01:53:50,070 programming languages have their own data types well they are also reserved 5793 01:53:50,070 --> 01:53:50,080 data types well they are also reserved 5794 01:53:50,080 --> 01:53:50,950 data types well they are also reserved words 5795 01:53:50,950 --> 01:53:50,960 words 5796 01:53:50,960 --> 01:53:52,870 words even though this is just text 5797 01:53:52,870 --> 01:53:52,880 even though this is just text 5798 01:53:52,880 --> 01:53:54,550 even though this is just text representation basically you see the 5799 01:53:54,550 --> 01:53:54,560 representation basically you see the 5800 01:53:54,560 --> 01:53:55,830 representation basically you see the highlighting here 5801 01:53:55,830 --> 01:53:55,840 highlighting here 5802 01:53:55,840 --> 01:53:57,750 highlighting here just like for these other words because 5803 01:53:57,750 --> 01:53:57,760 just like for these other words because 5804 01:53:57,760 --> 01:53:58,950 just like for these other words because python knows 5805 01:53:58,950 --> 01:53:58,960 python knows 5806 01:53:58,960 --> 01:54:02,390 python knows this is a boolean value of 5807 01:54:02,390 --> 01:54:02,400 this is a boolean value of 5808 01:54:02,400 --> 01:54:05,430 this is a boolean value of true and note that again specifically 5809 01:54:05,430 --> 01:54:05,440 true and note that again specifically 5810 01:54:05,440 --> 01:54:07,189 true and note that again specifically for python we actually 5811 01:54:07,189 --> 01:54:07,199 for python we actually 5812 01:54:07,199 --> 01:54:10,310 for python we actually write true with capital t 5813 01:54:10,310 --> 01:54:10,320 write true with capital t 5814 01:54:10,320 --> 01:54:13,109 write true with capital t unlike in other programming languages so 5815 01:54:13,109 --> 01:54:13,119 unlike in other programming languages so 5816 01:54:13,119 --> 01:54:13,510 unlike in other programming languages so this 5817 01:54:13,510 --> 01:54:13,520 this 5818 01:54:13,520 --> 01:54:16,550 this will basically be just a string 5819 01:54:16,550 --> 01:54:16,560 will basically be just a string 5820 01:54:16,560 --> 01:54:18,229 will basically be just a string so python doesn't know what to do with 5821 01:54:18,229 --> 01:54:18,239 so python doesn't know what to do with 5822 01:54:18,239 --> 01:54:20,390 so python doesn't know what to do with it but it recognizes 5823 01:54:20,390 --> 01:54:20,400 it but it recognizes 5824 01:54:20,400 --> 01:54:23,990 it but it recognizes true width capital t so we're telling 5825 01:54:23,990 --> 01:54:24,000 true width capital t so we're telling 5826 01:54:24,000 --> 01:54:25,990 true width capital t so we're telling our loop 5827 01:54:25,990 --> 01:54:26,000 our loop 5828 01:54:26,000 --> 01:54:28,950 our loop our while loop the condition is always 5829 01:54:28,950 --> 01:54:28,960 our while loop the condition is always 5830 01:54:28,960 --> 01:54:29,430 our while loop the condition is always true 5831 01:54:29,430 --> 01:54:29,440 true 5832 01:54:29,440 --> 01:54:31,589 true so basically run these two lines 5833 01:54:31,589 --> 01:54:31,599 so basically run these two lines 5834 01:54:31,599 --> 01:54:33,189 so basically run these two lines indefinitely because the condition 5835 01:54:33,189 --> 01:54:33,199 indefinitely because the condition 5836 01:54:33,199 --> 01:54:34,629 indefinitely because the condition will never change it's always going to 5837 01:54:34,629 --> 01:54:34,639 will never change it's always going to 5838 01:54:34,639 --> 01:54:36,390 will never change it's always going to be true and 5839 01:54:36,390 --> 01:54:36,400 be true and 5840 01:54:36,400 --> 01:54:39,030 be true and the syntax is probably already familiar 5841 01:54:39,030 --> 01:54:39,040 the syntax is probably already familiar 5842 01:54:39,040 --> 01:54:39,750 the syntax is probably already familiar to you 5843 01:54:39,750 --> 01:54:39,760 to you 5844 01:54:39,760 --> 01:54:42,950 to you we have the keyword just like if 5845 01:54:42,950 --> 01:54:42,960 we have the keyword just like if 5846 01:54:42,960 --> 01:54:45,030 we have the keyword just like if or try we can actually compare the 5847 01:54:45,030 --> 01:54:45,040 or try we can actually compare the 5848 01:54:45,040 --> 01:54:46,950 or try we can actually compare the syntax to the if statement 5849 01:54:46,950 --> 01:54:46,960 syntax to the if statement 5850 01:54:46,960 --> 01:54:49,990 syntax to the if statement so we have the while keyword here 5851 01:54:49,990 --> 01:54:50,000 so we have the while keyword here 5852 01:54:50,000 --> 01:54:52,149 so we have the while keyword here then we have the condition so this is 5853 01:54:52,149 --> 01:54:52,159 then we have the condition so this is 5854 01:54:52,159 --> 01:54:54,070 then we have the condition so this is the same type of condition 5855 01:54:54,070 --> 01:54:54,080 the same type of condition 5856 01:54:54,080 --> 01:54:56,629 the same type of condition as this one right here it's just that 5857 01:54:56,629 --> 01:54:56,639 as this one right here it's just that 5858 01:54:56,639 --> 01:54:57,189 as this one right here it's just that with us 5859 01:54:57,189 --> 01:54:57,199 with us 5860 01:54:57,199 --> 01:55:00,229 with us is basically fixed true value 5861 01:55:00,229 --> 01:55:00,239 is basically fixed true value 5862 01:55:00,239 --> 01:55:02,550 is basically fixed true value here it could be true or it could be 5863 01:55:02,550 --> 01:55:02,560 here it could be true or it could be 5864 01:55:02,560 --> 01:55:04,470 here it could be true or it could be false based on the condition 5865 01:55:04,470 --> 01:55:04,480 false based on the condition 5866 01:55:04,480 --> 01:55:06,310 false based on the condition and then we have the colon and then we 5867 01:55:06,310 --> 01:55:06,320 and then we have the colon and then we 5868 01:55:06,320 --> 01:55:07,910 and then we have the colon and then we have the indentation 5869 01:55:07,910 --> 01:55:07,920 have the indentation 5870 01:55:07,920 --> 01:55:09,990 have the indentation for the next lines so all of these 5871 01:55:09,990 --> 01:55:10,000 for the next lines so all of these 5872 01:55:10,000 --> 01:55:10,950 for the next lines so all of these belong to 5873 01:55:10,950 --> 01:55:10,960 belong to 5874 01:55:10,960 --> 01:55:14,310 belong to the while loop so that's basically it 5875 01:55:14,310 --> 01:55:14,320 the while loop so that's basically it 5876 01:55:14,320 --> 01:55:17,430 the while loop so that's basically it we can now execute the application and 5877 01:55:17,430 --> 01:55:17,440 we can now execute the application and 5878 01:55:17,440 --> 01:55:19,910 we can now execute the application and see that our program runs indefinitely 5879 01:55:19,910 --> 01:55:19,920 see that our program runs indefinitely 5880 01:55:19,920 --> 01:55:21,669 see that our program runs indefinitely so this is the first one 5881 01:55:21,669 --> 01:55:21,679 so this is the first one 5882 01:55:21,679 --> 01:55:24,390 so this is the first one let's say we enter 10 awesome we have a 5883 01:55:24,390 --> 01:55:24,400 let's say we enter 10 awesome we have a 5884 01:55:24,400 --> 01:55:24,950 let's say we enter 10 awesome we have a result 5885 01:55:24,950 --> 01:55:24,960 result 5886 01:55:24,960 --> 01:55:28,149 result and then we have again the next 5887 01:55:28,149 --> 01:55:28,159 and then we have again the next 5888 01:55:28,159 --> 01:55:30,629 and then we have again the next execution where it's asking for our 5889 01:55:30,629 --> 01:55:30,639 execution where it's asking for our 5890 01:55:30,639 --> 01:55:31,990 execution where it's asking for our input again 5891 01:55:31,990 --> 01:55:32,000 input again 5892 01:55:32,000 --> 01:55:35,990 input again and we can do -10 now it's telling us we 5893 01:55:35,990 --> 01:55:36,000 and we can do -10 now it's telling us we 5894 01:55:36,000 --> 01:55:37,430 and we can do -10 now it's telling us we provide a negative value 5895 01:55:37,430 --> 01:55:37,440 provide a negative value 5896 01:55:37,440 --> 01:55:40,390 provide a negative value but we can enter the value again let's 5897 01:55:40,390 --> 01:55:40,400 but we can enter the value again let's 5898 01:55:40,400 --> 01:55:41,109 but we can enter the value again let's enter some 5899 01:55:41,109 --> 01:55:41,119 enter some 5900 01:55:41,119 --> 01:55:44,550 enter some invalid value that should be 5901 01:55:44,550 --> 01:55:44,560 invalid value that should be 5902 01:55:44,560 --> 01:55:47,510 invalid value that should be handled by this value error block 5903 01:55:47,510 --> 01:55:47,520 handled by this value error block 5904 01:55:47,520 --> 01:55:48,229 handled by this value error block execute 5905 01:55:48,229 --> 01:55:48,239 execute 5906 01:55:48,239 --> 01:55:51,350 execute it's not a valid number and application 5907 01:55:51,350 --> 01:55:51,360 it's not a valid number and application 5908 01:55:51,360 --> 01:55:54,310 it's not a valid number and application basically continues so again as you see 5909 01:55:54,310 --> 01:55:54,320 basically continues so again as you see 5910 01:55:54,320 --> 01:55:55,109 basically continues so again as you see if you 5911 01:55:55,109 --> 01:55:55,119 if you 5912 01:55:55,119 --> 01:55:57,189 if you have an application that should continue 5913 01:55:57,189 --> 01:55:57,199 have an application that should continue 5914 01:55:57,199 --> 01:55:59,510 have an application that should continue running and basically get user input 5915 01:55:59,510 --> 01:55:59,520 running and basically get user input 5916 01:55:59,520 --> 01:56:00,629 running and basically get user input over and over again 5917 01:56:00,629 --> 01:56:00,639 over and over again 5918 01:56:00,639 --> 01:56:02,870 over and over again you don't want that application to be 5919 01:56:02,870 --> 01:56:02,880 you don't want that application to be 5920 01:56:02,880 --> 01:56:05,109 you don't want that application to be crashed at some point by some 5921 01:56:05,109 --> 01:56:05,119 crashed at some point by some 5922 01:56:05,119 --> 01:56:08,390 crashed at some point by some bad input you want to catch and handle 5923 01:56:08,390 --> 01:56:08,400 bad input you want to catch and handle 5924 01:56:08,400 --> 01:56:11,030 bad input you want to catch and handle every type of input so that your 5925 01:56:11,030 --> 01:56:11,040 every type of input so that your 5926 01:56:11,040 --> 01:56:12,070 every type of input so that your application 5927 01:56:12,070 --> 01:56:12,080 application 5928 01:56:12,080 --> 01:56:15,350 application continues to run and if we want to stop 5929 01:56:15,350 --> 01:56:15,360 continues to run and if we want to stop 5930 01:56:15,360 --> 01:56:16,070 continues to run and if we want to stop it 5931 01:56:16,070 --> 01:56:16,080 it 5932 01:56:16,080 --> 01:56:19,109 it we can basically just shut it off here 5933 01:56:19,109 --> 01:56:19,119 we can basically just shut it off here 5934 01:56:19,119 --> 01:56:24,470 we can basically just shut it off here and process finished 5935 01:56:27,189 --> 01:56:27,199 now we can do one optimization in our 5936 01:56:27,199 --> 01:56:28,070 now we can do one optimization in our program 5937 01:56:28,070 --> 01:56:28,080 program 5938 01:56:28,080 --> 01:56:31,189 program and this would be to allow users 5939 01:56:31,189 --> 01:56:31,199 and this would be to allow users 5940 01:56:31,199 --> 01:56:32,310 and this would be to allow users themselves 5941 01:56:32,310 --> 01:56:32,320 themselves 5942 01:56:32,320 --> 01:56:36,070 themselves to stop the application using 5943 01:56:36,070 --> 01:56:36,080 to stop the application using 5944 01:56:36,080 --> 01:56:40,870 to stop the application using some specific input value so for example 5945 01:56:40,870 --> 01:56:40,880 some specific input value so for example 5946 01:56:40,880 --> 01:56:43,830 some specific input value so for example when they type in exit for example the 5947 01:56:43,830 --> 01:56:43,840 when they type in exit for example the 5948 01:56:43,840 --> 01:56:44,790 when they type in exit for example the application 5949 01:56:44,790 --> 01:56:44,800 application 5950 01:56:44,800 --> 01:56:48,149 application should stop only for that specific 5951 01:56:48,149 --> 01:56:48,159 should stop only for that specific 5952 01:56:48,159 --> 01:56:51,109 should stop only for that specific word so it shouldn't run anymore so how 5953 01:56:51,109 --> 01:56:51,119 word so it shouldn't run anymore so how 5954 01:56:51,119 --> 01:56:52,149 word so it shouldn't run anymore so how can we do that 5955 01:56:52,149 --> 01:56:52,159 can we do that 5956 01:56:52,159 --> 01:56:54,550 can we do that so basically instead of having a 5957 01:56:54,550 --> 01:56:54,560 so basically instead of having a 5958 01:56:54,560 --> 01:56:55,669 so basically instead of having a condition that is 5959 01:56:55,669 --> 01:56:55,679 condition that is 5960 01:56:55,679 --> 01:56:58,070 condition that is always true we want a condition that 5961 01:56:58,070 --> 01:56:58,080 always true we want a condition that 5962 01:56:58,080 --> 01:56:58,950 always true we want a condition that says 5963 01:56:58,950 --> 01:56:58,960 says 5964 01:56:58,960 --> 01:57:02,470 says if the user did not input 5965 01:57:02,470 --> 01:57:02,480 if the user did not input 5966 01:57:02,480 --> 01:57:05,270 if the user did not input word exit then continue running the 5967 01:57:05,270 --> 01:57:05,280 word exit then continue running the 5968 01:57:05,280 --> 01:57:06,149 word exit then continue running the program 5969 01:57:06,149 --> 01:57:06,159 program 5970 01:57:06,159 --> 01:57:09,510 program if user entered exit then basically just 5971 01:57:09,510 --> 01:57:09,520 if user entered exit then basically just 5972 01:57:09,520 --> 01:57:12,229 if user entered exit then basically just stop it right so we need to change our 5973 01:57:12,229 --> 01:57:12,239 stop it right so we need to change our 5974 01:57:12,239 --> 01:57:13,589 stop it right so we need to change our condition right here 5975 01:57:13,589 --> 01:57:13,599 condition right here 5976 01:57:13,599 --> 01:57:16,709 condition right here so here we want user input is not 5977 01:57:16,709 --> 01:57:16,719 so here we want user input is not 5978 01:57:16,719 --> 01:57:20,870 so here we want user input is not exit right so user input 5979 01:57:20,870 --> 01:57:20,880 exit right so user input 5980 01:57:20,880 --> 01:57:24,629 exit right so user input is not exit now we didn't learn 5981 01:57:24,629 --> 01:57:24,639 is not exit now we didn't learn 5982 01:57:24,639 --> 01:57:28,149 is not exit now we didn't learn how to check for not equals 5983 01:57:28,149 --> 01:57:28,159 how to check for not equals 5984 01:57:28,159 --> 01:57:30,870 how to check for not equals something right we have check for 5985 01:57:30,870 --> 01:57:30,880 something right we have check for 5986 01:57:30,880 --> 01:57:33,030 something right we have check for equality so we check whether 5987 01:57:33,030 --> 01:57:33,040 equality so we check whether 5988 01:57:33,040 --> 01:57:35,830 equality so we check whether input number equals zero or if it's 5989 01:57:35,830 --> 01:57:35,840 input number equals zero or if it's 5990 01:57:35,840 --> 01:57:36,790 input number equals zero or if it's greater than 5991 01:57:36,790 --> 01:57:36,800 greater than 5992 01:57:36,800 --> 01:57:39,750 greater than or smaller than however we didn't learn 5993 01:57:39,750 --> 01:57:39,760 or smaller than however we didn't learn 5994 01:57:39,760 --> 01:57:41,109 or smaller than however we didn't learn how to check for 5995 01:57:41,109 --> 01:57:41,119 how to check for 5996 01:57:41,119 --> 01:57:44,070 how to check for not equals not equals in programming and 5997 01:57:44,070 --> 01:57:44,080 not equals not equals in programming and 5998 01:57:44,080 --> 01:57:45,669 not equals not equals in programming and this is not specific for 5999 01:57:45,669 --> 01:57:45,679 this is not specific for 6000 01:57:45,679 --> 01:57:49,350 this is not specific for python is expressed like this 6001 01:57:49,350 --> 01:57:49,360 python is expressed like this 6002 01:57:49,360 --> 01:57:52,470 python is expressed like this so instead of two equation 6003 01:57:52,470 --> 01:57:52,480 so instead of two equation 6004 01:57:52,480 --> 01:57:55,189 so instead of two equation signs we have an exclamation mark and 6005 01:57:55,189 --> 01:57:55,199 signs we have an exclamation mark and 6006 01:57:55,199 --> 01:57:55,830 signs we have an exclamation mark and equals 6007 01:57:55,830 --> 01:57:55,840 equals 6008 01:57:55,840 --> 01:57:59,030 equals and if we want to compare it to a string 6009 01:57:59,030 --> 01:57:59,040 and if we want to compare it to a string 6010 01:57:59,040 --> 01:58:00,390 and if we want to compare it to a string obviously 6011 01:58:00,390 --> 01:58:00,400 obviously 6012 01:58:00,400 --> 01:58:04,310 obviously we type that string in our case it's 6013 01:58:04,310 --> 01:58:04,320 we type that string in our case it's 6014 01:58:04,320 --> 01:58:07,910 we type that string in our case it's exit so basically this condition 6015 01:58:07,910 --> 01:58:07,920 exit so basically this condition 6016 01:58:07,920 --> 01:58:11,430 exit so basically this condition tells our while loop while 6017 01:58:11,430 --> 01:58:11,440 tells our while loop while 6018 01:58:11,440 --> 01:58:14,550 tells our while loop while user input is not exit 6019 01:58:14,550 --> 01:58:14,560 user input is not exit 6020 01:58:14,560 --> 01:58:17,030 user input is not exit continue running the program so while 6021 01:58:17,030 --> 01:58:17,040 continue running the program so while 6022 01:58:17,040 --> 01:58:18,070 continue running the program so while this is true 6023 01:58:18,070 --> 01:58:18,080 this is true 6024 01:58:18,080 --> 01:58:20,470 this is true basically just keep moving on but if 6025 01:58:20,470 --> 01:58:20,480 basically just keep moving on but if 6026 01:58:20,480 --> 01:58:21,510 basically just keep moving on but if user enters 6027 01:58:21,510 --> 01:58:21,520 user enters 6028 01:58:21,520 --> 01:58:23,830 user enters exit this will not be true anymore it 6029 01:58:23,830 --> 01:58:23,840 exit this will not be true anymore it 6030 01:58:23,840 --> 01:58:24,950 exit this will not be true anymore it will be false 6031 01:58:24,950 --> 01:58:24,960 will be false 6032 01:58:24,960 --> 01:58:27,510 will be false so loop will basically break and 6033 01:58:27,510 --> 01:58:27,520 so loop will basically break and 6034 01:58:27,520 --> 01:58:28,550 so loop will basically break and application will 6035 01:58:28,550 --> 01:58:28,560 application will 6036 01:58:28,560 --> 01:58:31,189 application will end now you see that we have a warning 6037 01:58:31,189 --> 01:58:31,199 end now you see that we have a warning 6038 01:58:31,199 --> 01:58:32,629 end now you see that we have a warning on this user input 6039 01:58:32,629 --> 01:58:32,639 on this user input 6040 01:58:32,639 --> 01:58:35,030 on this user input that we're using here and if i hover 6041 01:58:35,030 --> 01:58:35,040 that we're using here and if i hover 6042 01:58:35,040 --> 01:58:37,510 that we're using here and if i hover over it you see a message that says 6043 01:58:37,510 --> 01:58:37,520 over it you see a message that says 6044 01:58:37,520 --> 01:58:41,030 over it you see a message that says name user input can be undefined 6045 01:58:41,030 --> 01:58:41,040 name user input can be undefined 6046 01:58:41,040 --> 01:58:43,030 name user input can be undefined so it's not always undefined but it can 6047 01:58:43,030 --> 01:58:43,040 so it's not always undefined but it can 6048 01:58:43,040 --> 01:58:45,910 so it's not always undefined but it can be and here i want to mention again 6049 01:58:45,910 --> 01:58:45,920 be and here i want to mention again 6050 01:58:45,920 --> 01:58:49,189 be and here i want to mention again that pycharm because it's an intelligent 6051 01:58:49,189 --> 01:58:49,199 that pycharm because it's an intelligent 6052 01:58:49,199 --> 01:58:50,229 that pycharm because it's an intelligent editor 6053 01:58:50,229 --> 01:58:50,239 editor 6054 01:58:50,239 --> 01:58:52,790 editor can give you actually this warning when 6055 01:58:52,790 --> 01:58:52,800 can give you actually this warning when 6056 01:58:52,800 --> 01:58:53,830 can give you actually this warning when otherwise 6057 01:58:53,830 --> 01:58:53,840 otherwise 6058 01:58:53,840 --> 01:58:56,870 otherwise in a simple or normal code editor 6059 01:58:56,870 --> 01:58:56,880 in a simple or normal code editor 6060 01:58:56,880 --> 01:58:59,109 in a simple or normal code editor you probably wouldn't get such a warning 6061 01:58:59,109 --> 01:58:59,119 you probably wouldn't get such a warning 6062 01:58:59,119 --> 01:59:01,109 you probably wouldn't get such a warning so again it helps you 6063 01:59:01,109 --> 01:59:01,119 so again it helps you 6064 01:59:01,119 --> 01:59:03,350 so again it helps you in avoiding some of the mistakes that 6065 01:59:03,350 --> 01:59:03,360 in avoiding some of the mistakes that 6066 01:59:03,360 --> 01:59:05,109 in avoiding some of the mistakes that you might accidentally 6067 01:59:05,109 --> 01:59:05,119 you might accidentally 6068 01:59:05,119 --> 01:59:08,390 you might accidentally make when writing code so basically it 6069 01:59:08,390 --> 01:59:08,400 make when writing code so basically it 6070 01:59:08,400 --> 01:59:10,790 make when writing code so basically it detects the errors or possible errors 6071 01:59:10,790 --> 01:59:10,800 detects the errors or possible errors 6072 01:59:10,800 --> 01:59:11,830 detects the errors or possible errors for you 6073 01:59:11,830 --> 01:59:11,840 for you 6074 01:59:11,840 --> 01:59:15,109 for you and tells you to fix it so again 6075 01:59:15,109 --> 01:59:15,119 and tells you to fix it so again 6076 01:59:15,119 --> 01:59:17,910 and tells you to fix it so again this kind of intelligent warnings and 6077 01:59:17,910 --> 01:59:17,920 this kind of intelligent warnings and 6078 01:59:17,920 --> 01:59:18,870 this kind of intelligent warnings and error messages 6079 01:59:18,870 --> 01:59:18,880 error messages 6080 01:59:18,880 --> 01:59:21,430 error messages can be a lot of help when programming an 6081 01:59:21,430 --> 01:59:21,440 can be a lot of help when programming an 6082 01:59:21,440 --> 01:59:22,390 can be a lot of help when programming an application 6083 01:59:22,390 --> 01:59:22,400 application 6084 01:59:22,400 --> 01:59:25,510 application and now let's fix that warning so what's 6085 01:59:25,510 --> 01:59:25,520 and now let's fix that warning so what's 6086 01:59:25,520 --> 01:59:26,709 and now let's fix that warning so what's that all about 6087 01:59:26,709 --> 01:59:26,719 that all about 6088 01:59:26,719 --> 01:59:29,350 that all about the problem is on the very very first 6089 01:59:29,350 --> 01:59:29,360 the problem is on the very very first 6090 01:59:29,360 --> 01:59:30,229 the problem is on the very very first run of 6091 01:59:30,229 --> 01:59:30,239 run of 6092 01:59:30,239 --> 01:59:33,990 run of this while loop user input 6093 01:59:33,990 --> 01:59:34,000 this while loop user input 6094 01:59:34,000 --> 01:59:37,350 this while loop user input variable itself will not exist 6095 01:59:37,350 --> 01:59:37,360 variable itself will not exist 6096 01:59:37,360 --> 01:59:39,910 variable itself will not exist why because we're creating that user 6097 01:59:39,910 --> 01:59:39,920 why because we're creating that user 6098 01:59:39,920 --> 01:59:41,270 why because we're creating that user input variable 6099 01:59:41,270 --> 01:59:41,280 input variable 6100 01:59:41,280 --> 01:59:44,629 input variable on this line first so our 6101 01:59:44,629 --> 01:59:44,639 on this line first so our 6102 01:59:44,639 --> 01:59:47,030 on this line first so our application will basically complain 6103 01:59:47,030 --> 01:59:47,040 application will basically complain 6104 01:59:47,040 --> 01:59:48,070 application will basically complain because 6105 01:59:48,070 --> 01:59:48,080 because 6106 01:59:48,080 --> 01:59:50,070 because when our while loop runs for the first 6107 01:59:50,070 --> 01:59:50,080 when our while loop runs for the first 6108 01:59:50,080 --> 01:59:52,470 when our while loop runs for the first time it will not be able to find 6109 01:59:52,470 --> 01:59:52,480 time it will not be able to find 6110 01:59:52,480 --> 01:59:54,550 time it will not be able to find user input variable let's actually try 6111 01:59:54,550 --> 01:59:54,560 user input variable let's actually try 6112 01:59:54,560 --> 01:59:55,589 user input variable let's actually try that 6113 01:59:55,589 --> 01:59:55,599 that 6114 01:59:55,599 --> 01:59:58,709 that and as you see user input is not defined 6115 01:59:58,709 --> 01:59:58,719 and as you see user input is not defined 6116 01:59:58,719 --> 02:00:00,550 and as you see user input is not defined so we need to create that user input 6117 02:00:00,550 --> 02:00:00,560 so we need to create that user input 6118 02:00:00,560 --> 02:00:02,229 so we need to create that user input variable before 6119 02:00:02,229 --> 02:00:02,239 variable before 6120 02:00:02,239 --> 02:00:05,669 variable before the first execution of the loop 6121 02:00:05,669 --> 02:00:05,679 the first execution of the loop 6122 02:00:05,679 --> 02:00:09,350 the first execution of the loop so right here 6123 02:00:12,550 --> 02:00:12,560 we're going to create user input so 6124 02:00:12,560 --> 02:00:14,470 we're going to create user input so we're going to create this user input 6125 02:00:14,470 --> 02:00:14,480 we're going to create this user input 6126 02:00:14,480 --> 02:00:15,589 we're going to create this user input variable 6127 02:00:15,589 --> 02:00:15,599 variable 6128 02:00:15,599 --> 02:00:18,870 variable before the while loops first run 6129 02:00:18,870 --> 02:00:18,880 before the while loops first run 6130 02:00:18,880 --> 02:00:20,470 before the while loops first run and it doesn't really matter what the 6131 02:00:20,470 --> 02:00:20,480 and it doesn't really matter what the 6132 02:00:20,480 --> 02:00:22,390 and it doesn't really matter what the value of that user input variable will 6133 02:00:22,390 --> 02:00:22,400 value of that user input variable will 6134 02:00:22,400 --> 02:00:23,510 value of that user input variable will be because 6135 02:00:23,510 --> 02:00:23,520 be because 6136 02:00:23,520 --> 02:00:26,629 be because what matters is the variable exists so 6137 02:00:26,629 --> 02:00:26,639 what matters is the variable exists so 6138 02:00:26,639 --> 02:00:28,870 what matters is the variable exists so the value is basically just empty 6139 02:00:28,870 --> 02:00:28,880 the value is basically just empty 6140 02:00:28,880 --> 02:00:32,229 the value is basically just empty and as long as it's not exit the 6141 02:00:32,229 --> 02:00:32,239 and as long as it's not exit the 6142 02:00:32,239 --> 02:00:34,870 and as long as it's not exit the loop will start running and our 6143 02:00:34,870 --> 02:00:34,880 loop will start running and our 6144 02:00:34,880 --> 02:00:37,109 loop will start running and our application will get executed 6145 02:00:37,109 --> 02:00:37,119 application will get executed 6146 02:00:37,119 --> 02:00:39,990 application will get executed so again to go through the flow of this 6147 02:00:39,990 --> 02:00:40,000 so again to go through the flow of this 6148 02:00:40,000 --> 02:00:41,270 so again to go through the flow of this we're creating a 6149 02:00:41,270 --> 02:00:41,280 we're creating a 6150 02:00:41,280 --> 02:00:43,750 we're creating a user input variable then we're making 6151 02:00:43,750 --> 02:00:43,760 user input variable then we're making 6152 02:00:43,760 --> 02:00:44,550 user input variable then we're making sure it's not 6153 02:00:44,550 --> 02:00:44,560 sure it's not 6154 02:00:44,560 --> 02:00:47,589 sure it's not exit if it's not this line will get 6155 02:00:47,589 --> 02:00:47,599 exit if it's not this line will get 6156 02:00:47,599 --> 02:00:48,950 exit if it's not this line will get executed so we get the 6157 02:00:48,950 --> 02:00:48,960 executed so we get the 6158 02:00:48,960 --> 02:00:50,790 executed so we get the input from the user that's going to be 6159 02:00:50,790 --> 02:00:50,800 input from the user that's going to be 6160 02:00:50,800 --> 02:00:52,310 input from the user that's going to be our first input 6161 02:00:52,310 --> 02:00:52,320 our first input 6162 02:00:52,320 --> 02:00:55,030 our first input and then we call validate and execute 6163 02:00:55,030 --> 02:00:55,040 and then we call validate and execute 6164 02:00:55,040 --> 02:00:56,229 and then we call validate and execute function 6165 02:00:56,229 --> 02:00:56,239 function 6166 02:00:56,239 --> 02:00:58,470 function that basically does all the checks and 6167 02:00:58,470 --> 02:00:58,480 that basically does all the checks and 6168 02:00:58,480 --> 02:00:59,430 that basically does all the checks and execution 6169 02:00:59,430 --> 02:00:59,440 execution 6170 02:00:59,440 --> 02:01:01,990 execution so that's going to be the first run of 6171 02:01:01,990 --> 02:01:02,000 so that's going to be the first run of 6172 02:01:02,000 --> 02:01:02,870 so that's going to be the first run of that loop 6173 02:01:02,870 --> 02:01:02,880 that loop 6174 02:01:02,880 --> 02:01:05,109 that loop on the second run of the loop the 6175 02:01:05,109 --> 02:01:05,119 on the second run of the loop the 6176 02:01:05,119 --> 02:01:06,510 on the second run of the loop the condition will get 6177 02:01:06,510 --> 02:01:06,520 condition will get 6178 02:01:06,520 --> 02:01:09,830 condition will get re-evaluated so now the user input is 6179 02:01:09,830 --> 02:01:09,840 re-evaluated so now the user input is 6180 02:01:09,840 --> 02:01:13,030 re-evaluated so now the user input is what the user provided so again python 6181 02:01:13,030 --> 02:01:13,040 what the user provided so again python 6182 02:01:13,040 --> 02:01:14,870 what the user provided so again python will check is the user input 6183 02:01:14,870 --> 02:01:14,880 will check is the user input 6184 02:01:14,880 --> 02:01:18,229 will check is the user input exit no cool let's execute the program 6185 02:01:18,229 --> 02:01:18,239 exit no cool let's execute the program 6186 02:01:18,239 --> 02:01:21,589 exit no cool let's execute the program again user will have to enter another 6187 02:01:21,589 --> 02:01:21,599 again user will have to enter another 6188 02:01:21,599 --> 02:01:22,390 again user will have to enter another value 6189 02:01:22,390 --> 02:01:22,400 value 6190 02:01:22,400 --> 02:01:25,030 value and then that value will get 6191 02:01:25,030 --> 02:01:25,040 and then that value will get 6192 02:01:25,040 --> 02:01:26,229 and then that value will get re-evaluated 6193 02:01:26,229 --> 02:01:26,239 re-evaluated 6194 02:01:26,239 --> 02:01:29,510 re-evaluated so note that after each time 6195 02:01:29,510 --> 02:01:29,520 so note that after each time 6196 02:01:29,520 --> 02:01:31,910 so note that after each time that this block of code has run and 6197 02:01:31,910 --> 02:01:31,920 that this block of code has run and 6198 02:01:31,920 --> 02:01:33,109 that this block of code has run and executed 6199 02:01:33,109 --> 02:01:33,119 executed 6200 02:01:33,119 --> 02:01:35,510 executed every single value that user will give 6201 02:01:35,510 --> 02:01:35,520 every single value that user will give 6202 02:01:35,520 --> 02:01:36,709 every single value that user will give as an input 6203 02:01:36,709 --> 02:01:36,719 as an input 6204 02:01:36,719 --> 02:01:40,149 as an input will be evaluated over and over again 6205 02:01:40,149 --> 02:01:40,159 will be evaluated over and over again 6206 02:01:40,159 --> 02:01:43,430 will be evaluated over and over again in that condition and while user input 6207 02:01:43,430 --> 02:01:43,440 in that condition and while user input 6208 02:01:43,440 --> 02:01:46,950 in that condition and while user input is something else then exit it will run 6209 02:01:46,950 --> 02:01:46,960 is something else then exit it will run 6210 02:01:46,960 --> 02:01:47,830 is something else then exit it will run the program 6211 02:01:47,830 --> 02:01:47,840 the program 6212 02:01:47,840 --> 02:01:51,270 the program if it is exit then the loop will break 6213 02:01:51,270 --> 02:01:51,280 if it is exit then the loop will break 6214 02:01:51,280 --> 02:01:55,510 if it is exit then the loop will break so let's actually test that 6215 02:01:57,430 --> 02:01:57,440 so this is our first message and our 6216 02:01:57,440 --> 02:01:58,550 so this is our first message and our first input 6217 02:01:58,550 --> 02:01:58,560 first input 6218 02:01:58,560 --> 02:02:02,550 first input let's do 10 it got calculated 6219 02:02:02,550 --> 02:02:02,560 let's do 10 it got calculated 6220 02:02:02,560 --> 02:02:06,229 let's do 10 it got calculated let's do minus 6221 02:02:08,229 --> 02:02:08,239 again calculate it and we can do that 6222 02:02:08,239 --> 02:02:10,149 again calculate it and we can do that over and over and over again 6223 02:02:10,149 --> 02:02:10,159 over and over and over again 6224 02:02:10,159 --> 02:02:12,629 over and over and over again and now let's actually enter exit and 6225 02:02:12,629 --> 02:02:12,639 and now let's actually enter exit and 6226 02:02:12,639 --> 02:02:14,709 and now let's actually enter exit and let's see what happens 6227 02:02:14,709 --> 02:02:14,719 let's see what happens 6228 02:02:14,719 --> 02:02:17,669 let's see what happens and as you see a process finished with 6229 02:02:17,669 --> 02:02:17,679 and as you see a process finished with 6230 02:02:17,679 --> 02:02:19,910 and as you see a process finished with exit code so our application actually 6231 02:02:19,910 --> 02:02:19,920 exit code so our application actually 6232 02:02:19,920 --> 02:02:22,629 exit code so our application actually stopped because this condition was not 6233 02:02:22,629 --> 02:02:22,639 stopped because this condition was not 6234 02:02:22,639 --> 02:02:23,830 stopped because this condition was not true anymore it was 6235 02:02:23,830 --> 02:02:23,840 true anymore it was 6236 02:02:23,840 --> 02:02:26,950 true anymore it was false because we entered exit 6237 02:02:26,950 --> 02:02:26,960 false because we entered exit 6238 02:02:26,960 --> 02:02:30,470 false because we entered exit so that's how we can allow users to 6239 02:02:30,470 --> 02:02:30,480 so that's how we can allow users to 6240 02:02:30,480 --> 02:02:33,350 so that's how we can allow users to finish the application and two takeaways 6241 02:02:33,350 --> 02:02:33,360 finish the application and two takeaways 6242 02:02:33,360 --> 02:02:34,070 finish the application and two takeaways here 6243 02:02:34,070 --> 02:02:34,080 here 6244 02:02:34,080 --> 02:02:37,589 here one is a conditional in a loop 6245 02:02:37,589 --> 02:02:37,599 one is a conditional in a loop 6246 02:02:37,599 --> 02:02:40,870 one is a conditional in a loop and the second one is a negative equals 6247 02:02:40,870 --> 02:02:40,880 and the second one is a negative equals 6248 02:02:40,880 --> 02:02:41,350 and the second one is a negative equals check 6249 02:02:41,350 --> 02:02:41,360 check 6250 02:02:41,360 --> 02:02:45,990 check for values 6251 02:02:45,990 --> 02:02:46,000 for values 6252 02:02:46,000 --> 02:02:48,390 for values great so now we have our application 6253 02:02:48,390 --> 02:02:48,400 great so now we have our application 6254 02:02:48,400 --> 02:02:49,910 great so now we have our application that basically 6255 02:02:49,910 --> 02:02:49,920 that basically 6256 02:02:49,920 --> 02:02:53,109 that basically allows inputs multiple times 6257 02:02:53,109 --> 02:02:53,119 allows inputs multiple times 6258 02:02:53,119 --> 02:02:56,149 allows inputs multiple times and can be terminated with exit 6259 02:02:56,149 --> 02:02:56,159 and can be terminated with exit 6260 02:02:56,159 --> 02:03:00,550 and can be terminated with exit input now what if i wanted to calculate 6261 02:03:00,550 --> 02:03:00,560 input now what if i wanted to calculate 6262 02:03:00,560 --> 02:03:03,589 input now what if i wanted to calculate number of hours for several days but i 6263 02:03:03,589 --> 02:03:03,599 number of hours for several days but i 6264 02:03:03,599 --> 02:03:04,709 number of hours for several days but i didn't want to 6265 02:03:04,709 --> 02:03:04,719 didn't want to 6266 02:03:04,719 --> 02:03:07,189 didn't want to basically just pass it on one after 6267 02:03:07,189 --> 02:03:07,199 basically just pass it on one after 6268 02:03:07,199 --> 02:03:09,109 basically just pass it on one after another because that's just 6269 02:03:09,109 --> 02:03:09,119 another because that's just 6270 02:03:09,119 --> 02:03:10,950 another because that's just too much effort for me so let's say i 6271 02:03:10,950 --> 02:03:10,960 too much effort for me so let's say i 6272 02:03:10,960 --> 02:03:12,229 too much effort for me so let's say i wanted to give it 6273 02:03:12,229 --> 02:03:12,239 wanted to give it 6274 02:03:12,239 --> 02:03:14,390 wanted to give it 10 different values but i don't want to 6275 02:03:14,390 --> 02:03:14,400 10 different values but i don't want to 6276 02:03:14,400 --> 02:03:15,669 10 different values but i don't want to type it in 6277 02:03:15,669 --> 02:03:15,679 type it in 6278 02:03:15,679 --> 02:03:18,149 type it in 10 times right i want that application 6279 02:03:18,149 --> 02:03:18,159 10 times right i want that application 6280 02:03:18,159 --> 02:03:19,510 10 times right i want that application to basically do the 6281 02:03:19,510 --> 02:03:19,520 to basically do the 6282 02:03:19,520 --> 02:03:21,830 to basically do the whole calculation for all those 10 6283 02:03:21,830 --> 02:03:21,840 whole calculation for all those 10 6284 02:03:21,840 --> 02:03:22,709 whole calculation for all those 10 values but 6285 02:03:22,709 --> 02:03:22,719 values but 6286 02:03:22,719 --> 02:03:25,430 values but i just want to enter that list once 6287 02:03:25,430 --> 02:03:25,440 i just want to enter that list once 6288 02:03:25,440 --> 02:03:26,390 i just want to enter that list once instead of 6289 02:03:26,390 --> 02:03:26,400 instead of 6290 02:03:26,400 --> 02:03:29,990 instead of entering each value separately 6291 02:03:29,990 --> 02:03:30,000 entering each value separately 6292 02:03:30,000 --> 02:03:32,629 entering each value separately so in this part we're going to learn 6293 02:03:32,629 --> 02:03:32,639 so in this part we're going to learn 6294 02:03:32,639 --> 02:03:33,910 so in this part we're going to learn another data type 6295 02:03:33,910 --> 02:03:33,920 another data type 6296 02:03:33,920 --> 02:03:37,189 another data type in python called list 6297 02:03:37,189 --> 02:03:37,199 in python called list 6298 02:03:37,199 --> 02:03:39,750 in python called list so till now we have learned several data 6299 02:03:39,750 --> 02:03:39,760 so till now we have learned several data 6300 02:03:39,760 --> 02:03:41,109 so till now we have learned several data types 6301 02:03:41,109 --> 02:03:41,119 types 6302 02:03:41,119 --> 02:03:46,149 types like strings for example 6303 02:03:49,270 --> 02:03:49,280 as well as integers and 6304 02:03:49,280 --> 02:03:52,870 as well as integers and float numbers and 6305 02:03:52,870 --> 02:03:52,880 float numbers and 6306 02:03:52,880 --> 02:03:56,310 float numbers and boolean true or false 6307 02:03:56,310 --> 02:03:56,320 boolean true or false 6308 02:03:56,320 --> 02:03:59,830 boolean true or false and list is just another data type 6309 02:03:59,830 --> 02:03:59,840 and list is just another data type 6310 02:03:59,840 --> 02:04:03,430 and list is just another data type and the syntax for list is 6311 02:04:03,430 --> 02:04:03,440 and the syntax for list is 6312 02:04:03,440 --> 02:04:06,470 and the syntax for list is using square brackets and 6313 02:04:06,470 --> 02:04:06,480 using square brackets and 6314 02:04:06,480 --> 02:04:08,470 using square brackets and inside the square brackets we have a 6315 02:04:08,470 --> 02:04:08,480 inside the square brackets we have a 6316 02:04:08,480 --> 02:04:10,629 inside the square brackets we have a list of 6317 02:04:10,629 --> 02:04:10,639 list of 6318 02:04:10,639 --> 02:04:14,310 list of elements and those elements can again be 6319 02:04:14,310 --> 02:04:14,320 elements and those elements can again be 6320 02:04:14,320 --> 02:04:18,470 elements and those elements can again be either strings numbers or boolean values 6321 02:04:18,470 --> 02:04:18,480 either strings numbers or boolean values 6322 02:04:18,480 --> 02:04:20,310 either strings numbers or boolean values in our case we want to provide our 6323 02:04:20,310 --> 02:04:20,320 in our case we want to provide our 6324 02:04:20,320 --> 02:04:22,550 in our case we want to provide our application with a list of 6325 02:04:22,550 --> 02:04:22,560 application with a list of 6326 02:04:22,560 --> 02:04:25,030 application with a list of number of days right so we're going to 6327 02:04:25,030 --> 02:04:25,040 number of days right so we're going to 6328 02:04:25,040 --> 02:04:25,589 number of days right so we're going to have 6329 02:04:25,589 --> 02:04:25,599 have 6330 02:04:25,599 --> 02:04:29,109 have a list of integers 6331 02:04:29,109 --> 02:04:29,119 a list of integers 6332 02:04:29,119 --> 02:04:32,790 a list of integers like this 6333 02:04:35,270 --> 02:04:35,280 and you can have as many values inside 6334 02:04:35,280 --> 02:04:36,629 and you can have as many values inside the list as you want 6335 02:04:36,629 --> 02:04:36,639 the list as you want 6336 02:04:36,639 --> 02:04:37,750 the list as you want and these are going to be comma 6337 02:04:37,750 --> 02:04:37,760 and these are going to be comma 6338 02:04:37,760 --> 02:04:40,470 and these are going to be comma separated and the syntax will look 6339 02:04:40,470 --> 02:04:40,480 separated and the syntax will look 6340 02:04:40,480 --> 02:04:42,870 separated and the syntax will look like this but again as i said you can 6341 02:04:42,870 --> 02:04:42,880 like this but again as i said you can 6342 02:04:42,880 --> 02:04:44,709 like this but again as i said you can have a list of strings 6343 02:04:44,709 --> 02:04:44,719 have a list of strings 6344 02:04:44,719 --> 02:04:48,550 have a list of strings list of booleans etc so as i mentioned 6345 02:04:48,550 --> 02:04:48,560 list of booleans etc so as i mentioned 6346 02:04:48,560 --> 02:04:51,750 list of booleans etc so as i mentioned we want to let user basically 6347 02:04:51,750 --> 02:04:51,760 we want to let user basically 6348 02:04:51,760 --> 02:04:55,350 we want to let user basically provide inputs as a list 6349 02:04:55,350 --> 02:04:55,360 provide inputs as a list 6350 02:04:55,360 --> 02:04:58,390 provide inputs as a list instead of those individual values one 6351 02:04:58,390 --> 02:04:58,400 instead of those individual values one 6352 02:04:58,400 --> 02:04:59,669 instead of those individual values one at a time 6353 02:04:59,669 --> 02:04:59,679 at a time 6354 02:04:59,679 --> 02:05:03,030 at a time so i'm going to copy this let's clean 6355 02:05:03,030 --> 02:05:03,040 so i'm going to copy this let's clean 6356 02:05:03,040 --> 02:05:03,990 so i'm going to copy this let's clean this up 6357 02:05:03,990 --> 02:05:04,000 this up 6358 02:05:04,000 --> 02:05:06,149 this up and let's actually see what happens if i 6359 02:05:06,149 --> 02:05:06,159 and let's actually see what happens if i 6360 02:05:06,159 --> 02:05:07,109 and let's actually see what happens if i just 6361 02:05:07,109 --> 02:05:07,119 just 6362 02:05:07,119 --> 02:05:10,709 just input that list as a value 6363 02:05:10,709 --> 02:05:10,719 input that list as a value 6364 02:05:10,719 --> 02:05:14,149 input that list as a value right here and enter you see program 6365 02:05:14,149 --> 02:05:14,159 right here and enter you see program 6366 02:05:14,159 --> 02:05:15,669 right here and enter you see program doesn't recognize that 6367 02:05:15,669 --> 02:05:15,679 doesn't recognize that 6368 02:05:15,679 --> 02:05:18,229 doesn't recognize that as a valid number obviously because we 6369 02:05:18,229 --> 02:05:18,239 as a valid number obviously because we 6370 02:05:18,239 --> 02:05:19,430 as a valid number obviously because we have the check 6371 02:05:19,430 --> 02:05:19,440 have the check 6372 02:05:19,440 --> 02:05:23,030 have the check and causes a value error that's why we 6373 02:05:23,030 --> 02:05:23,040 and causes a value error that's why we 6374 02:05:23,040 --> 02:05:23,669 and causes a value error that's why we get 6375 02:05:23,669 --> 02:05:23,679 get 6376 02:05:23,679 --> 02:05:26,310 get your input is not a valid number don't 6377 02:05:26,310 --> 02:05:26,320 your input is not a valid number don't 6378 02:05:26,320 --> 02:05:27,430 your input is not a valid number don't ruin my program 6379 02:05:27,430 --> 02:05:27,440 ruin my program 6380 02:05:27,440 --> 02:05:29,910 ruin my program message right here so we want to change 6381 02:05:29,910 --> 02:05:29,920 message right here so we want to change 6382 02:05:29,920 --> 02:05:31,189 message right here so we want to change that and 6383 02:05:31,189 --> 02:05:31,199 that and 6384 02:05:31,199 --> 02:05:33,990 that and make our program actually accept that as 6385 02:05:33,990 --> 02:05:34,000 make our program actually accept that as 6386 02:05:34,000 --> 02:05:34,709 make our program actually accept that as a valid 6387 02:05:34,709 --> 02:05:34,719 a valid 6388 02:05:34,719 --> 02:05:38,069 a valid input so how do we actually implement it 6389 02:05:38,069 --> 02:05:38,079 input so how do we actually implement it 6390 02:05:38,079 --> 02:05:40,229 input so how do we actually implement it and let's go through this logic 6391 02:05:40,229 --> 02:05:40,239 and let's go through this logic 6392 02:05:40,239 --> 02:05:41,750 and let's go through this logic theoretically first 6393 02:05:41,750 --> 02:05:41,760 theoretically first 6394 02:05:41,760 --> 02:05:44,709 theoretically first before we start implementing it what we 6395 02:05:44,709 --> 02:05:44,719 before we start implementing it what we 6396 02:05:44,719 --> 02:05:45,990 before we start implementing it what we need here is that 6397 02:05:45,990 --> 02:05:46,000 need here is that 6398 02:05:46,000 --> 02:05:48,470 need here is that we want to read this list and we want to 6399 02:05:48,470 --> 02:05:48,480 we want to read this list and we want to 6400 02:05:48,480 --> 02:05:49,189 we want to read this list and we want to do 6401 02:05:49,189 --> 02:05:49,199 do 6402 02:05:49,199 --> 02:05:53,030 do validation and execution for each 6403 02:05:53,030 --> 02:05:53,040 validation and execution for each 6404 02:05:53,040 --> 02:05:56,629 validation and execution for each value one at a time so that means that 6405 02:05:56,629 --> 02:05:56,639 value one at a time so that means that 6406 02:05:56,639 --> 02:05:59,510 value one at a time so that means that validate and execute function needs to 6407 02:05:59,510 --> 02:05:59,520 validate and execute function needs to 6408 02:05:59,520 --> 02:06:00,550 validate and execute function needs to be called 6409 02:06:00,550 --> 02:06:00,560 be called 6410 02:06:00,560 --> 02:06:04,390 be called for each value in that list right 6411 02:06:04,390 --> 02:06:04,400 for each value in that list right 6412 02:06:04,400 --> 02:06:07,589 for each value in that list right so basically this function for all this 6413 02:06:07,589 --> 02:06:07,599 so basically this function for all this 6414 02:06:07,599 --> 02:06:08,229 so basically this function for all this logic 6415 02:06:08,229 --> 02:06:08,239 logic 6416 02:06:08,239 --> 02:06:12,069 logic needs to be executed for each element 6417 02:06:12,069 --> 02:06:12,079 needs to be executed for each element 6418 02:06:12,079 --> 02:06:15,030 needs to be executed for each element now how do we get the individual 6419 02:06:15,030 --> 02:06:15,040 now how do we get the individual 6420 02:06:15,040 --> 02:06:15,750 now how do we get the individual elements 6421 02:06:15,750 --> 02:06:15,760 elements 6422 02:06:15,760 --> 02:06:18,629 elements of the list so you remember the 6423 02:06:18,629 --> 02:06:18,639 of the list so you remember the 6424 02:06:18,639 --> 02:06:19,430 of the list so you remember the definition 6425 02:06:19,430 --> 02:06:19,440 definition 6426 02:06:19,440 --> 02:06:23,350 definition of a loop loop is basically executing 6427 02:06:23,350 --> 02:06:23,360 of a loop loop is basically executing 6428 02:06:23,360 --> 02:06:25,830 of a loop loop is basically executing same function with the same logic 6429 02:06:25,830 --> 02:06:25,840 same function with the same logic 6430 02:06:25,840 --> 02:06:27,430 same function with the same logic multiple times 6431 02:06:27,430 --> 02:06:27,440 multiple times 6432 02:06:27,440 --> 02:06:30,229 multiple times and the number of times basically 6433 02:06:30,229 --> 02:06:30,239 and the number of times basically 6434 02:06:30,239 --> 02:06:32,229 and the number of times basically depends on the condition right 6435 02:06:32,229 --> 02:06:32,239 depends on the condition right 6436 02:06:32,239 --> 02:06:34,470 depends on the condition right here we have a condition for while loop 6437 02:06:34,470 --> 02:06:34,480 here we have a condition for while loop 6438 02:06:34,480 --> 02:06:35,510 here we have a condition for while loop and the condition 6439 02:06:35,510 --> 02:06:35,520 and the condition 6440 02:06:35,520 --> 02:06:38,709 and the condition for executing the same logic for each of 6441 02:06:38,709 --> 02:06:38,719 for executing the same logic for each of 6442 02:06:38,719 --> 02:06:39,510 for executing the same logic for each of those 6443 02:06:39,510 --> 02:06:39,520 those 6444 02:06:39,520 --> 02:06:42,870 those elements is going to be the number of 6445 02:06:42,870 --> 02:06:42,880 elements is going to be the number of 6446 02:06:42,880 --> 02:06:45,030 elements is going to be the number of elements in that list right so we want 6447 02:06:45,030 --> 02:06:45,040 elements in that list right so we want 6448 02:06:45,040 --> 02:06:46,709 elements in that list right so we want to execute the logic 6449 02:06:46,709 --> 02:06:46,719 to execute the logic 6450 02:06:46,719 --> 02:06:49,589 to execute the logic as many times as we have elements in the 6451 02:06:49,589 --> 02:06:49,599 as many times as we have elements in the 6452 02:06:49,599 --> 02:06:50,229 as many times as we have elements in the list 6453 02:06:50,229 --> 02:06:50,239 list 6454 02:06:50,239 --> 02:06:53,830 list and for that we have another type of 6455 02:06:53,830 --> 02:06:53,840 and for that we have another type of 6456 02:06:53,840 --> 02:06:54,390 and for that we have another type of loop 6457 02:06:54,390 --> 02:06:54,400 loop 6458 02:06:54,400 --> 02:06:58,149 loop called for loop and basically we want to 6459 02:06:58,149 --> 02:06:58,159 called for loop and basically we want to 6460 02:06:58,159 --> 02:07:00,950 called for loop and basically we want to execute validate and execute function 6461 02:07:00,950 --> 02:07:00,960 execute validate and execute function 6462 02:07:00,960 --> 02:07:04,709 execute validate and execute function using a for loop the syntax for 6463 02:07:04,709 --> 02:07:04,719 using a for loop the syntax for 6464 02:07:04,719 --> 02:07:07,430 using a for loop the syntax for for loop is a little bit different first 6465 02:07:07,430 --> 02:07:07,440 for loop is a little bit different first 6466 02:07:07,440 --> 02:07:08,629 for loop is a little bit different first of all we have four 6467 02:07:08,629 --> 02:07:08,639 of all we have four 6468 02:07:08,639 --> 02:07:11,990 of all we have four keyword just like for while then we have 6469 02:07:11,990 --> 02:07:12,000 keyword just like for while then we have 6470 02:07:12,000 --> 02:07:12,310 keyword just like for while then we have the 6471 02:07:12,310 --> 02:07:12,320 the 6472 02:07:12,320 --> 02:07:15,189 the element is a variable so we can call 6473 02:07:15,189 --> 02:07:15,199 element is a variable so we can call 6474 02:07:15,199 --> 02:07:16,069 element is a variable so we can call that 6475 02:07:16,069 --> 02:07:16,079 that 6476 02:07:16,079 --> 02:07:19,350 that number of days 6477 02:07:22,069 --> 02:07:22,079 so this variable basically represents 6478 02:07:22,079 --> 02:07:23,030 so this variable basically represents each 6479 02:07:23,030 --> 02:07:23,040 each 6480 02:07:23,040 --> 02:07:26,629 each of those elements in the list 6481 02:07:26,629 --> 02:07:26,639 of those elements in the list 6482 02:07:26,639 --> 02:07:29,589 of those elements in the list and then we have in which is again a 6483 02:07:29,589 --> 02:07:29,599 and then we have in which is again a 6484 02:07:29,599 --> 02:07:31,189 and then we have in which is again a keyword of python 6485 02:07:31,189 --> 02:07:31,199 keyword of python 6486 02:07:31,199 --> 02:07:34,149 keyword of python so for in basically puts together the 6487 02:07:34,149 --> 02:07:34,159 so for in basically puts together the 6488 02:07:34,159 --> 02:07:35,510 so for in basically puts together the for loop 6489 02:07:35,510 --> 02:07:35,520 for loop 6490 02:07:35,520 --> 02:07:38,149 for loop logic in python so python knows what we 6491 02:07:38,149 --> 02:07:38,159 logic in python so python knows what we 6492 02:07:38,159 --> 02:07:39,990 logic in python so python knows what we are trying to execute 6493 02:07:39,990 --> 02:07:40,000 are trying to execute 6494 02:07:40,000 --> 02:07:43,669 are trying to execute and finally we need the list 6495 02:07:43,669 --> 02:07:43,679 and finally we need the list 6496 02:07:43,679 --> 02:07:47,189 and finally we need the list that we are executing this loop on 6497 02:07:47,189 --> 02:07:47,199 that we are executing this loop on 6498 02:07:47,199 --> 02:07:51,430 that we are executing this loop on and our list is our user input 6499 02:07:51,430 --> 02:07:51,440 and our list is our user input 6500 02:07:51,440 --> 02:07:55,270 and our list is our user input and that's our for loop however 6501 02:07:55,270 --> 02:07:55,280 and that's our for loop however 6502 02:07:55,280 --> 02:07:57,589 and that's our for loop however again you remember the indentation the 6503 02:07:57,589 --> 02:07:57,599 again you remember the indentation the 6504 02:07:57,599 --> 02:07:58,550 again you remember the indentation the logic 6505 02:07:58,550 --> 02:07:58,560 logic 6506 02:07:58,560 --> 02:08:01,510 logic that for loop executes needs to be 6507 02:08:01,510 --> 02:08:01,520 that for loop executes needs to be 6508 02:08:01,520 --> 02:08:04,149 that for loop executes needs to be indented so it should belong to for loop 6509 02:08:04,149 --> 02:08:04,159 indented so it should belong to for loop 6510 02:08:04,159 --> 02:08:07,189 indented so it should belong to for loop so now we can read that for loop 6511 02:08:07,189 --> 02:08:07,199 so now we can read that for loop 6512 02:08:07,199 --> 02:08:08,790 so now we can read that for loop statement as follows 6513 02:08:08,790 --> 02:08:08,800 statement as follows 6514 02:08:08,800 --> 02:08:12,870 statement as follows for each element which we call we decide 6515 02:08:12,870 --> 02:08:12,880 for each element which we call we decide 6516 02:08:12,880 --> 02:08:14,870 for each element which we call we decide to call number of days 6517 02:08:14,870 --> 02:08:14,880 to call number of days 6518 02:08:14,880 --> 02:08:18,149 to call number of days in a list called user input 6519 02:08:18,149 --> 02:08:18,159 in a list called user input 6520 02:08:18,159 --> 02:08:21,350 in a list called user input we want to execute this logic 6521 02:08:21,350 --> 02:08:21,360 we want to execute this logic 6522 02:08:21,360 --> 02:08:23,830 we want to execute this logic exactly what i said before so for each 6523 02:08:23,830 --> 02:08:23,840 exactly what i said before so for each 6524 02:08:23,840 --> 02:08:24,390 exactly what i said before so for each element 6525 02:08:24,390 --> 02:08:24,400 element 6526 02:08:24,400 --> 02:08:26,550 element in this user input list we want to 6527 02:08:26,550 --> 02:08:26,560 in this user input list we want to 6528 02:08:26,560 --> 02:08:29,589 in this user input list we want to execute 6529 02:08:31,910 --> 02:08:31,920 validate and execute function we don't 6530 02:08:31,920 --> 02:08:33,030 validate and execute function we don't have a condition 6531 02:08:33,030 --> 02:08:33,040 have a condition 6532 02:08:33,040 --> 02:08:35,750 have a condition written here like we did in while loop 6533 02:08:35,750 --> 02:08:35,760 written here like we did in while loop 6534 02:08:35,760 --> 02:08:36,310 written here like we did in while loop or 6535 02:08:36,310 --> 02:08:36,320 or 6536 02:08:36,320 --> 02:08:38,629 or if statement so the condition is 6537 02:08:38,629 --> 02:08:38,639 if statement so the condition is 6538 02:08:38,639 --> 02:08:39,990 if statement so the condition is basically implicit 6539 02:08:39,990 --> 02:08:40,000 basically implicit 6540 02:08:40,000 --> 02:08:43,189 basically implicit right the condition says however many 6541 02:08:43,189 --> 02:08:43,199 right the condition says however many 6542 02:08:43,199 --> 02:08:44,069 right the condition says however many elements there 6543 02:08:44,069 --> 02:08:44,079 elements there 6544 02:08:44,079 --> 02:08:47,830 elements there are in this list that many times that 6545 02:08:47,830 --> 02:08:47,840 are in this list that many times that 6546 02:08:47,840 --> 02:08:50,629 are in this list that many times that function or that block of code here will 6547 02:08:50,629 --> 02:08:50,639 function or that block of code here will 6548 02:08:50,639 --> 02:08:51,669 function or that block of code here will get executed 6549 02:08:51,669 --> 02:08:51,679 get executed 6550 02:08:51,679 --> 02:08:54,310 get executed so if i provide five elements you will 6551 02:08:54,310 --> 02:08:54,320 so if i provide five elements you will 6552 02:08:54,320 --> 02:08:55,910 so if i provide five elements you will be executed five times 6553 02:08:55,910 --> 02:08:55,920 be executed five times 6554 02:08:55,920 --> 02:08:58,550 be executed five times if i provide 10 elements it will be 6555 02:08:58,550 --> 02:08:58,560 if i provide 10 elements it will be 6556 02:08:58,560 --> 02:08:59,990 if i provide 10 elements it will be executed 10 times 6557 02:08:59,990 --> 02:09:00,000 executed 10 times 6558 02:09:00,000 --> 02:09:02,069 executed 10 times and that's exactly what we want however 6559 02:09:02,069 --> 02:09:02,079 and that's exactly what we want however 6560 02:09:02,079 --> 02:09:03,270 and that's exactly what we want however there are still 6561 02:09:03,270 --> 02:09:03,280 there are still 6562 02:09:03,280 --> 02:09:05,350 there are still a couple of things we need to do for 6563 02:09:05,350 --> 02:09:05,360 a couple of things we need to do for 6564 02:09:05,360 --> 02:09:06,870 a couple of things we need to do for this application to work 6565 02:09:06,870 --> 02:09:06,880 this application to work 6566 02:09:06,880 --> 02:09:09,589 this application to work properly first of all validate and 6567 02:09:09,589 --> 02:09:09,599 properly first of all validate and 6568 02:09:09,599 --> 02:09:10,470 properly first of all validate and execute 6569 02:09:10,470 --> 02:09:10,480 execute 6570 02:09:10,480 --> 02:09:14,390 execute function still uses user input 6571 02:09:14,390 --> 02:09:14,400 function still uses user input 6572 02:09:14,400 --> 02:09:17,430 function still uses user input right here so instead we want it to 6573 02:09:17,430 --> 02:09:17,440 right here so instead we want it to 6574 02:09:17,440 --> 02:09:20,149 right here so instead we want it to use the individual values of the user 6575 02:09:20,149 --> 02:09:20,159 use the individual values of the user 6576 02:09:20,159 --> 02:09:21,510 use the individual values of the user input because now it's going to be a 6577 02:09:21,510 --> 02:09:21,520 input because now it's going to be a 6578 02:09:21,520 --> 02:09:21,990 input because now it's going to be a list 6579 02:09:21,990 --> 02:09:22,000 list 6580 02:09:22,000 --> 02:09:26,310 list and not a number so this 6581 02:09:26,310 --> 02:09:26,320 and not a number so this 6582 02:09:26,320 --> 02:09:28,790 and not a number so this element we can actually call it num of 6583 02:09:28,790 --> 02:09:28,800 element we can actually call it num of 6584 02:09:28,800 --> 02:09:29,350 element we can actually call it num of days 6585 02:09:29,350 --> 02:09:29,360 days 6586 02:09:29,360 --> 02:09:33,109 days element this value should be used here 6587 02:09:33,109 --> 02:09:33,119 element this value should be used here 6588 02:09:33,119 --> 02:09:33,990 element this value should be used here instead 6589 02:09:33,990 --> 02:09:34,000 instead 6590 02:09:34,000 --> 02:09:37,910 instead right so we're going to use that element 6591 02:09:37,910 --> 02:09:37,920 right so we're going to use that element 6592 02:09:37,920 --> 02:09:41,109 right so we're going to use that element instead of the whole user input list 6593 02:09:41,109 --> 02:09:41,119 instead of the whole user input list 6594 02:09:41,119 --> 02:09:43,669 instead of the whole user input list and paste it here so that fixes the 6595 02:09:43,669 --> 02:09:43,679 and paste it here so that fixes the 6596 02:09:43,679 --> 02:09:44,629 and paste it here so that fixes the first problem 6597 02:09:44,629 --> 02:09:44,639 first problem 6598 02:09:44,639 --> 02:09:48,069 first problem and the second one is as you know user 6599 02:09:48,069 --> 02:09:48,079 and the second one is as you know user 6600 02:09:48,079 --> 02:09:48,870 and the second one is as you know user input is 6601 02:09:48,870 --> 02:09:48,880 input is 6602 02:09:48,880 --> 02:09:52,390 input is always a string so even if we provide 6603 02:09:52,390 --> 02:09:52,400 always a string so even if we provide 6604 02:09:52,400 --> 02:09:55,669 always a string so even if we provide a list of these it is still going to be 6605 02:09:55,669 --> 02:09:55,679 a list of these it is still going to be 6606 02:09:55,679 --> 02:09:56,470 a list of these it is still going to be considered 6607 02:09:56,470 --> 02:09:56,480 considered 6608 02:09:56,480 --> 02:09:59,589 considered as a string so we need something similar 6609 02:09:59,589 --> 02:09:59,599 as a string so we need something similar 6610 02:09:59,599 --> 02:10:00,069 as a string so we need something similar to 6611 02:10:00,069 --> 02:10:00,079 to 6612 02:10:00,079 --> 02:10:03,189 to this right here so the list of numbers 6613 02:10:03,189 --> 02:10:03,199 this right here so the list of numbers 6614 02:10:03,199 --> 02:10:05,669 this right here so the list of numbers that are provided as input needs to be 6615 02:10:05,669 --> 02:10:05,679 that are provided as input needs to be 6616 02:10:05,679 --> 02:10:06,470 that are provided as input needs to be converted 6617 02:10:06,470 --> 02:10:06,480 converted 6618 02:10:06,480 --> 02:10:09,830 converted in at least in python and we can 6619 02:10:09,830 --> 02:10:09,840 in at least in python and we can 6620 02:10:09,840 --> 02:10:10,790 in at least in python and we can actually do that 6621 02:10:10,790 --> 02:10:10,800 actually do that 6622 02:10:10,800 --> 02:10:15,189 actually do that in a convenient way using user input 6623 02:10:15,189 --> 02:10:15,199 in a convenient way using user input 6624 02:10:15,199 --> 02:10:19,750 in a convenient way using user input dot split and split is a function 6625 02:10:19,750 --> 02:10:19,760 dot split and split is a function 6626 02:10:19,760 --> 02:10:23,350 dot split and split is a function that will take user input as a parameter 6627 02:10:23,350 --> 02:10:23,360 that will take user input as a parameter 6628 02:10:23,360 --> 02:10:26,790 that will take user input as a parameter and will give us a list data type 6629 02:10:26,790 --> 02:10:26,800 and will give us a list data type 6630 02:10:26,800 --> 02:10:29,510 and will give us a list data type so split function basically will return 6631 02:10:29,510 --> 02:10:29,520 so split function basically will return 6632 02:10:29,520 --> 02:10:30,310 so split function basically will return a list 6633 02:10:30,310 --> 02:10:30,320 a list 6634 02:10:30,320 --> 02:10:33,750 a list of all those input values 6635 02:10:33,750 --> 02:10:33,760 of all those input values 6636 02:10:33,760 --> 02:10:37,189 of all those input values and again note the syntax of executing 6637 02:10:37,189 --> 02:10:37,199 and again note the syntax of executing 6638 02:10:37,199 --> 02:10:38,550 and again note the syntax of executing the split function 6639 02:10:38,550 --> 02:10:38,560 the split function 6640 02:10:38,560 --> 02:10:41,510 the split function we're not just calling a split function 6641 02:10:41,510 --> 02:10:41,520 we're not just calling a split function 6642 02:10:41,520 --> 02:10:43,109 we're not just calling a split function like this 6643 02:10:43,109 --> 02:10:43,119 like this 6644 02:10:43,119 --> 02:10:45,750 like this with user input as parameter instead we 6645 02:10:45,750 --> 02:10:45,760 with user input as parameter instead we 6646 02:10:45,760 --> 02:10:46,470 with user input as parameter instead we are basically 6647 02:10:46,470 --> 02:10:46,480 are basically 6648 02:10:46,480 --> 02:10:48,950 are basically calling it on user input and i'm going 6649 02:10:48,950 --> 02:10:48,960 calling it on user input and i'm going 6650 02:10:48,960 --> 02:10:49,510 calling it on user input and i'm going to explain 6651 02:10:49,510 --> 02:10:49,520 to explain 6652 02:10:49,520 --> 02:10:51,910 to explain more about this type of functions in 6653 02:10:51,910 --> 02:10:51,920 more about this type of functions in 6654 02:10:51,920 --> 02:10:52,870 more about this type of functions in python 6655 02:10:52,870 --> 02:10:52,880 python 6656 02:10:52,880 --> 02:10:55,270 python later but for now let's actually execute 6657 02:10:55,270 --> 02:10:55,280 later but for now let's actually execute 6658 02:10:55,280 --> 02:10:56,709 later but for now let's actually execute this application 6659 02:10:56,709 --> 02:10:56,719 this application 6660 02:10:56,719 --> 02:10:59,910 this application and see what happens so first of all 6661 02:10:59,910 --> 02:10:59,920 and see what happens so first of all 6662 02:10:59,920 --> 02:11:03,030 and see what happens so first of all how am i going to provide a list 6663 02:11:03,030 --> 02:11:03,040 how am i going to provide a list 6664 02:11:03,040 --> 02:11:06,030 how am i going to provide a list to this application so that 6665 02:11:06,030 --> 02:11:06,040 to this application so that 6666 02:11:06,040 --> 02:11:07,270 to this application so that userinput.split 6667 02:11:07,270 --> 02:11:07,280 userinput.split 6668 02:11:07,280 --> 02:11:10,790 userinput.split can actually convert it into a proper 6669 02:11:10,790 --> 02:11:10,800 can actually convert it into a proper 6670 02:11:10,800 --> 02:11:13,910 can actually convert it into a proper list in python and the way i should 6671 02:11:13,910 --> 02:11:13,920 list in python and the way i should 6672 02:11:13,920 --> 02:11:15,830 list in python and the way i should provide the values are 6673 02:11:15,830 --> 02:11:15,840 provide the values are 6674 02:11:15,840 --> 02:11:20,069 provide the values are list of values with spaces between them 6675 02:11:20,069 --> 02:11:20,079 list of values with spaces between them 6676 02:11:20,079 --> 02:11:24,069 list of values with spaces between them so basically like that so why spaces how 6677 02:11:24,069 --> 02:11:24,079 so basically like that so why spaces how 6678 02:11:24,079 --> 02:11:25,430 so basically like that so why spaces how come it's not 6679 02:11:25,430 --> 02:11:25,440 come it's not 6680 02:11:25,440 --> 02:11:28,550 come it's not a comma or something else the reason 6681 02:11:28,550 --> 02:11:28,560 a comma or something else the reason 6682 02:11:28,560 --> 02:11:32,550 a comma or something else the reason is because split function by default 6683 02:11:32,550 --> 02:11:32,560 is because split function by default 6684 02:11:32,560 --> 02:11:35,589 is because split function by default splits that provided list on 6685 02:11:35,589 --> 02:11:35,599 splits that provided list on 6686 02:11:35,599 --> 02:11:39,030 splits that provided list on spaces and then creates a list value 6687 02:11:39,030 --> 02:11:39,040 spaces and then creates a list value 6688 02:11:39,040 --> 02:11:40,870 spaces and then creates a list value out of them so that's the default 6689 02:11:40,870 --> 02:11:40,880 out of them so that's the default 6690 02:11:40,880 --> 02:11:42,390 out of them so that's the default behavior of split 6691 02:11:42,390 --> 02:11:42,400 behavior of split 6692 02:11:42,400 --> 02:11:44,709 behavior of split however we can override that behavior 6693 02:11:44,709 --> 02:11:44,719 however we can override that behavior 6694 02:11:44,719 --> 02:11:46,229 however we can override that behavior and we can decide you know what 6695 02:11:46,229 --> 02:11:46,239 and we can decide you know what 6696 02:11:46,239 --> 02:11:49,589 and we can decide you know what we want the input to be a list of 6697 02:11:49,589 --> 02:11:49,599 we want the input to be a list of 6698 02:11:49,599 --> 02:11:52,550 we want the input to be a list of numbers that are comma separated instead 6699 02:11:52,550 --> 02:11:52,560 numbers that are comma separated instead 6700 02:11:52,560 --> 02:11:52,870 numbers that are comma separated instead of 6701 02:11:52,870 --> 02:11:52,880 of 6702 02:11:52,880 --> 02:11:55,910 of space separated so what we can do is 6703 02:11:55,910 --> 02:11:55,920 space separated so what we can do is 6704 02:11:55,920 --> 02:11:59,510 space separated so what we can do is right here we can do split on a comma 6705 02:11:59,510 --> 02:11:59,520 right here we can do split on a comma 6706 02:11:59,520 --> 02:12:01,750 right here we can do split on a comma so that's what our split function here 6707 02:12:01,750 --> 02:12:01,760 so that's what our split function here 6708 02:12:01,760 --> 02:12:06,069 so that's what our split function here will do and now if i re-execute it 6709 02:12:06,069 --> 02:12:06,079 will do and now if i re-execute it 6710 02:12:06,079 --> 02:12:11,589 will do and now if i re-execute it and i can do commas now 6711 02:12:15,189 --> 02:12:15,199 40 55. 6712 02:12:15,199 --> 02:12:17,430 40 55. so that's going to be user input and 6713 02:12:17,430 --> 02:12:17,440 so that's going to be user input and 6714 02:12:17,440 --> 02:12:18,310 so that's going to be user input and split 6715 02:12:18,310 --> 02:12:18,320 split 6716 02:12:18,320 --> 02:12:21,430 split with comma should convert it into 6717 02:12:21,430 --> 02:12:21,440 with comma should convert it into 6718 02:12:21,440 --> 02:12:24,790 with comma should convert it into a list value in python so let's execute 6719 02:12:24,790 --> 02:12:24,800 a list value in python so let's execute 6720 02:12:24,800 --> 02:12:26,229 a list value in python so let's execute it 6721 02:12:26,229 --> 02:12:26,239 it 6722 02:12:26,239 --> 02:12:29,750 it and as you see it worked fine we have 6723 02:12:29,750 --> 02:12:29,760 and as you see it worked fine we have 6724 02:12:29,760 --> 02:12:33,430 and as you see it worked fine we have a calculation for each of those values 6725 02:12:33,430 --> 02:12:33,440 a calculation for each of those values 6726 02:12:33,440 --> 02:12:35,270 a calculation for each of those values now let's actually play around with this 6727 02:12:35,270 --> 02:12:35,280 now let's actually play around with this 6728 02:12:35,280 --> 02:12:37,109 now let's actually play around with this and let's say we provide 6729 02:12:37,109 --> 02:12:37,119 and let's say we provide 6730 02:12:37,119 --> 02:12:40,550 and let's say we provide a list with some values 6731 02:12:40,550 --> 02:12:40,560 a list with some values 6732 02:12:40,560 --> 02:12:43,589 a list with some values and somewhere in between we decide to 6733 02:12:43,589 --> 02:12:43,599 and somewhere in between we decide to 6734 02:12:43,599 --> 02:12:44,790 and somewhere in between we decide to add a text 6735 02:12:44,790 --> 02:12:44,800 add a text 6736 02:12:44,800 --> 02:12:48,069 add a text and then maybe a float so let's see what 6737 02:12:48,069 --> 02:12:48,079 and then maybe a float so let's see what 6738 02:12:48,079 --> 02:12:49,589 and then maybe a float so let's see what happens now 6739 02:12:49,589 --> 02:12:49,599 happens now 6740 02:12:49,599 --> 02:12:52,310 happens now and you see that for those two valid 6741 02:12:52,310 --> 02:12:52,320 and you see that for those two valid 6742 02:12:52,320 --> 02:12:54,310 and you see that for those two valid numbers the calculation was done 6743 02:12:54,310 --> 02:12:54,320 numbers the calculation was done 6744 02:12:54,320 --> 02:12:57,910 numbers the calculation was done properly and for the other two basically 6745 02:12:57,910 --> 02:12:57,920 properly and for the other two basically 6746 02:12:57,920 --> 02:13:00,229 properly and for the other two basically the validation kicked in and it says 6747 02:13:00,229 --> 02:13:00,239 the validation kicked in and it says 6748 02:13:00,239 --> 02:13:02,470 the validation kicked in and it says that these are invalid numbers 6749 02:13:02,470 --> 02:13:02,480 that these are invalid numbers 6750 02:13:02,480 --> 02:13:05,270 that these are invalid numbers however again our application ran 6751 02:13:05,270 --> 02:13:05,280 however again our application ran 6752 02:13:05,280 --> 02:13:06,629 however again our application ran without any problems 6753 02:13:06,629 --> 02:13:06,639 without any problems 6754 02:13:06,639 --> 02:13:09,750 without any problems and we can even provide another input so 6755 02:13:09,750 --> 02:13:09,760 and we can even provide another input so 6756 02:13:09,760 --> 02:13:10,870 and we can even provide another input so now let's actually 6757 02:13:10,870 --> 02:13:10,880 now let's actually 6758 02:13:10,880 --> 02:13:15,109 now let's actually do 20 maybe a boolean even 6759 02:13:15,109 --> 02:13:15,119 do 20 maybe a boolean even 6760 02:13:15,119 --> 02:13:18,550 do 20 maybe a boolean even and a negative number execute 6761 02:13:18,550 --> 02:13:18,560 and a negative number execute 6762 02:13:18,560 --> 02:13:21,109 and a negative number execute and you see that for 20 the number of 6763 02:13:21,109 --> 02:13:21,119 and you see that for 20 the number of 6764 02:13:21,119 --> 02:13:23,109 and you see that for 20 the number of hours got calculated 6765 02:13:23,109 --> 02:13:23,119 hours got calculated 6766 02:13:23,119 --> 02:13:26,390 hours got calculated true is obviously not a valid number 6767 02:13:26,390 --> 02:13:26,400 true is obviously not a valid number 6768 02:13:26,400 --> 02:13:29,430 true is obviously not a valid number and minus 100 is a negative number 6769 02:13:29,430 --> 02:13:29,440 and minus 100 is a negative number 6770 02:13:29,440 --> 02:13:33,030 and minus 100 is a negative number so everything works perfect validations 6771 02:13:33,030 --> 02:13:33,040 so everything works perfect validations 6772 02:13:33,040 --> 02:13:33,910 so everything works perfect validations in place 6773 02:13:33,910 --> 02:13:33,920 in place 6774 02:13:33,920 --> 02:13:36,629 in place and we can provide a list here now and 6775 02:13:36,629 --> 02:13:36,639 and we can provide a list here now and 6776 02:13:36,639 --> 02:13:38,310 and we can provide a list here now and as a final optimization 6777 02:13:38,310 --> 02:13:38,320 as a final optimization 6778 02:13:38,320 --> 02:13:40,709 as a final optimization we can actually change this message here 6779 02:13:40,709 --> 02:13:40,719 we can actually change this message here 6780 02:13:40,719 --> 02:13:41,830 we can actually change this message here that says 6781 02:13:41,830 --> 02:13:41,840 that says 6782 02:13:41,840 --> 02:13:48,229 that says hey user enter 6783 02:13:51,430 --> 02:13:51,440 number of days as a 6784 02:13:51,440 --> 02:13:55,669 number of days as a comma separated 6785 02:13:55,669 --> 02:13:55,679 comma separated 6786 02:13:55,679 --> 02:13:59,189 comma separated list and i will convert it 6787 02:13:59,189 --> 02:13:59,199 list and i will convert it 6788 02:13:59,199 --> 02:14:02,709 list and i will convert it to hours so now we can provide 6789 02:14:02,709 --> 02:14:02,719 to hours so now we can provide 6790 02:14:02,719 --> 02:14:05,030 to hours so now we can provide either just one value and it works fine 6791 02:14:05,030 --> 02:14:05,040 either just one value and it works fine 6792 02:14:05,040 --> 02:14:06,470 either just one value and it works fine or we can provide 6793 02:14:06,470 --> 02:14:06,480 or we can provide 6794 02:14:06,480 --> 02:14:10,470 or we can provide multiple values 6795 02:14:16,709 --> 02:14:16,719 and again if we want to see how that 6796 02:14:16,719 --> 02:14:17,109 and again if we want to see how that list 6797 02:14:17,109 --> 02:14:17,119 list 6798 02:14:17,119 --> 02:14:20,470 list actually looks like and check the type 6799 02:14:20,470 --> 02:14:20,480 actually looks like and check the type 6800 02:14:20,480 --> 02:14:23,189 actually looks like and check the type that it has in python let's actually 6801 02:14:23,189 --> 02:14:23,199 that it has in python let's actually 6802 02:14:23,199 --> 02:14:24,550 that it has in python let's actually print it 6803 02:14:24,550 --> 02:14:24,560 print it 6804 02:14:24,560 --> 02:14:28,709 print it so first i'm gonna print type 6805 02:14:28,709 --> 02:14:28,719 so first i'm gonna print type 6806 02:14:28,719 --> 02:14:34,629 so first i'm gonna print type of user input called split 6807 02:14:38,870 --> 02:14:38,880 and then i'm just gonna print that list 6808 02:14:38,880 --> 02:14:44,149 and then i'm just gonna print that list itself so let's execute 6809 02:14:44,149 --> 02:14:44,159 itself so let's execute 6810 02:14:44,159 --> 02:14:51,189 itself so let's execute and let's provide 6811 02:14:54,709 --> 02:14:54,719 some values and here you see 6812 02:14:54,719 --> 02:14:57,589 some values and here you see this is the class list so basically the 6813 02:14:57,589 --> 02:14:57,599 this is the class list so basically the 6814 02:14:57,599 --> 02:14:59,189 this is the class list so basically the data type 6815 02:14:59,189 --> 02:14:59,199 data type 6816 02:14:59,199 --> 02:15:03,109 data type list and that's how our list 6817 02:15:03,109 --> 02:15:03,119 list and that's how our list 6818 02:15:03,119 --> 02:15:04,950 list and that's how our list looks like so we have these square 6819 02:15:04,950 --> 02:15:04,960 looks like so we have these square 6820 02:15:04,960 --> 02:15:07,350 looks like so we have these square brackets here and each element inside 6821 02:15:07,350 --> 02:15:07,360 brackets here and each element inside 6822 02:15:07,360 --> 02:15:10,149 brackets here and each element inside as a string because we have the quotes 6823 02:15:10,149 --> 02:15:10,159 as a string because we have the quotes 6824 02:15:10,159 --> 02:15:10,870 as a string because we have the quotes here 6825 02:15:10,870 --> 02:15:10,880 here 6826 02:15:10,880 --> 02:15:14,709 here and later our application then 6827 02:15:14,709 --> 02:15:14,719 and later our application then 6828 02:15:14,719 --> 02:15:16,709 and later our application then transforms it or tries to 6829 02:15:16,709 --> 02:15:16,719 transforms it or tries to 6830 02:15:16,719 --> 02:15:19,910 transforms it or tries to transform it into an integer 6831 02:15:19,910 --> 02:15:19,920 transform it into an integer 6832 02:15:19,920 --> 02:15:21,430 transform it into an integer and you also see there are some 6833 02:15:21,430 --> 02:15:21,440 and you also see there are some 6834 02:15:21,440 --> 02:15:23,669 and you also see there are some additional spaces here because 6835 02:15:23,669 --> 02:15:23,679 additional spaces here because 6836 02:15:23,679 --> 02:15:26,550 additional spaces here because that's how we entered the values so 6837 02:15:26,550 --> 02:15:26,560 that's how we entered the values so 6838 02:15:26,560 --> 02:15:27,510 that's how we entered the values so basically 6839 02:15:27,510 --> 02:15:27,520 basically 6840 02:15:27,520 --> 02:15:30,950 basically the split splits the values on comma 6841 02:15:30,950 --> 02:15:30,960 the split splits the values on comma 6842 02:15:30,960 --> 02:15:34,709 the split splits the values on comma so this space also becomes part of that 6843 02:15:34,709 --> 02:15:34,719 so this space also becomes part of that 6844 02:15:34,719 --> 02:15:35,510 so this space also becomes part of that element 6845 02:15:35,510 --> 02:15:35,520 element 6846 02:15:35,520 --> 02:15:38,069 element so to fix that leading space in each 6847 02:15:38,069 --> 02:15:38,079 so to fix that leading space in each 6848 02:15:38,079 --> 02:15:39,350 so to fix that leading space in each value we can 6849 02:15:39,350 --> 02:15:39,360 value we can 6850 02:15:39,360 --> 02:15:42,069 value we can basically just add a space here so it 6851 02:15:42,069 --> 02:15:42,079 basically just add a space here so it 6852 02:15:42,079 --> 02:15:43,589 basically just add a space here so it will split on 6853 02:15:43,589 --> 02:15:43,599 will split on 6854 02:15:43,599 --> 02:15:47,589 will split on comma and space 6855 02:15:47,589 --> 02:15:47,599 comma and space 6856 02:15:47,599 --> 02:15:56,790 comma and space and let's test it out 6857 02:16:00,229 --> 02:16:00,239 and there you go we have our values 6858 02:16:00,239 --> 02:16:06,709 and there you go we have our values without the space before them 6859 02:16:09,430 --> 02:16:09,440 so you saw an example of when we 6860 02:16:09,440 --> 02:16:10,229 so you saw an example of when we actually need 6861 02:16:10,229 --> 02:16:10,239 actually need 6862 02:16:10,239 --> 02:16:13,669 actually need to use list data types in this example 6863 02:16:13,669 --> 02:16:13,679 to use list data types in this example 6864 02:16:13,679 --> 02:16:16,790 to use list data types in this example we wanted to allow users to basically 6865 02:16:16,790 --> 02:16:16,800 we wanted to allow users to basically 6866 02:16:16,800 --> 02:16:20,709 we wanted to allow users to basically just input multiple values at once as a 6867 02:16:20,709 --> 02:16:20,719 just input multiple values at once as a 6868 02:16:20,719 --> 02:16:21,510 just input multiple values at once as a list 6869 02:16:21,510 --> 02:16:21,520 list 6870 02:16:21,520 --> 02:16:23,669 list but obviously this is just one of the 6871 02:16:23,669 --> 02:16:23,679 but obviously this is just one of the 6872 02:16:23,679 --> 02:16:24,550 but obviously this is just one of the use cases 6873 02:16:24,550 --> 02:16:24,560 use cases 6874 02:16:24,560 --> 02:16:26,550 use cases for a list and one of the specific 6875 02:16:26,550 --> 02:16:26,560 for a list and one of the specific 6876 02:16:26,560 --> 02:16:28,149 for a list and one of the specific examples because throughout the 6877 02:16:28,149 --> 02:16:28,159 examples because throughout the 6878 02:16:28,159 --> 02:16:29,750 examples because throughout the application you can create 6879 02:16:29,750 --> 02:16:29,760 application you can create 6880 02:16:29,760 --> 02:16:31,990 application you can create lists and you can use the elements of 6881 02:16:31,990 --> 02:16:32,000 lists and you can use the elements of 6882 02:16:32,000 --> 02:16:33,190 lists and you can use the elements of that list 6883 02:16:33,190 --> 02:16:33,200 that list 6884 02:16:33,200 --> 02:16:35,429 that list in another function so you can use it 6885 02:16:35,429 --> 02:16:35,439 in another function so you can use it 6886 02:16:35,439 --> 02:16:37,110 in another function so you can use it for multiple use cases 6887 02:16:37,110 --> 02:16:37,120 for multiple use cases 6888 02:16:37,120 --> 02:16:40,230 for multiple use cases and just to show you some basic syntax 6889 02:16:40,230 --> 02:16:40,240 and just to show you some basic syntax 6890 02:16:40,240 --> 02:16:40,950 and just to show you some basic syntax of 6891 02:16:40,950 --> 02:16:40,960 of 6892 02:16:40,960 --> 02:16:43,910 of how to create lists within your code 6893 02:16:43,910 --> 02:16:43,920 how to create lists within your code 6894 02:16:43,920 --> 02:16:46,070 how to create lists within your code inside your application so how to 6895 02:16:46,070 --> 02:16:46,080 inside your application so how to 6896 02:16:46,080 --> 02:16:49,030 inside your application so how to initiate it and then how to use that 6897 02:16:49,030 --> 02:16:49,040 initiate it and then how to use that 6898 02:16:49,040 --> 02:16:49,990 initiate it and then how to use that list 6899 02:16:49,990 --> 02:16:50,000 list 6900 02:16:50,000 --> 02:16:52,629 list i will show you the examples here so 6901 02:16:52,629 --> 02:16:52,639 i will show you the examples here so 6902 02:16:52,639 --> 02:16:53,990 i will show you the examples here so basically to create a 6903 02:16:53,990 --> 02:16:54,000 basically to create a 6904 02:16:54,000 --> 02:16:56,230 basically to create a list in your code you would use that 6905 02:16:56,230 --> 02:16:56,240 list in your code you would use that 6906 02:16:56,240 --> 02:16:57,910 list in your code you would use that syntax that i showed you earlier 6907 02:16:57,910 --> 02:16:57,920 syntax that i showed you earlier 6908 02:16:57,920 --> 02:17:00,549 syntax that i showed you earlier with square brackets and inside that you 6909 02:17:00,549 --> 02:17:00,559 with square brackets and inside that you 6910 02:17:00,559 --> 02:17:01,030 with square brackets and inside that you would have 6911 02:17:01,030 --> 02:17:01,040 would have 6912 02:17:01,040 --> 02:17:03,750 would have list of elements and this could be 6913 02:17:03,750 --> 02:17:03,760 list of elements and this could be 6914 02:17:03,760 --> 02:17:04,709 list of elements and this could be strings 6915 02:17:04,709 --> 02:17:04,719 strings 6916 02:17:04,719 --> 02:17:07,509 strings so it could be for example names of 6917 02:17:07,509 --> 02:17:07,519 so it could be for example names of 6918 02:17:07,519 --> 02:17:08,150 so it could be for example names of month 6919 02:17:08,150 --> 02:17:08,160 month 6920 02:17:08,160 --> 02:17:14,790 month let's say like this 6921 02:17:14,790 --> 02:17:14,800 let's say like this 6922 02:17:14,800 --> 02:17:17,429 let's say like this and then we would have to assign it to a 6923 02:17:17,429 --> 02:17:17,439 and then we would have to assign it to a 6924 02:17:17,439 --> 02:17:18,469 and then we would have to assign it to a variable right 6925 02:17:18,469 --> 02:17:18,479 variable right 6926 02:17:18,479 --> 02:17:20,790 variable right again just like we did for strings or 6927 02:17:20,790 --> 02:17:20,800 again just like we did for strings or 6928 02:17:20,800 --> 02:17:22,950 again just like we did for strings or integers or other data types 6929 02:17:22,950 --> 02:17:22,960 integers or other data types 6930 02:17:22,960 --> 02:17:26,309 integers or other data types so we can call it my list 6931 02:17:26,309 --> 02:17:26,319 so we can call it my list 6932 02:17:26,319 --> 02:17:29,990 so we can call it my list and this will give us a list with 6933 02:17:29,990 --> 02:17:30,000 and this will give us a list with 6934 02:17:30,000 --> 02:17:33,669 and this will give us a list with three string values inside 6935 02:17:33,669 --> 02:17:33,679 three string values inside 6936 02:17:33,679 --> 02:17:36,549 three string values inside and once you have created a list you can 6937 02:17:36,549 --> 02:17:36,559 and once you have created a list you can 6938 02:17:36,559 --> 02:17:37,270 and once you have created a list you can then 6939 02:17:37,270 --> 02:17:37,280 then 6940 02:17:37,280 --> 02:17:40,070 then use it to read the values from the list 6941 02:17:40,070 --> 02:17:40,080 use it to read the values from the list 6942 02:17:40,080 --> 02:17:40,549 use it to read the values from the list right 6943 02:17:40,549 --> 02:17:40,559 right 6944 02:17:40,559 --> 02:17:43,589 right so basically to get the individual 6945 02:17:43,589 --> 02:17:43,599 so basically to get the individual 6946 02:17:43,599 --> 02:17:46,870 so basically to get the individual values elements out of that list so for 6947 02:17:46,870 --> 02:17:46,880 values elements out of that list so for 6948 02:17:46,880 --> 02:17:49,429 values elements out of that list so for example if we wanted to print out 6949 02:17:49,429 --> 02:17:49,439 example if we wanted to print out 6950 02:17:49,439 --> 02:17:53,110 example if we wanted to print out the first element of my list 6951 02:17:53,110 --> 02:17:53,120 the first element of my list 6952 02:17:53,120 --> 02:17:56,389 the first element of my list then we would access that 6953 02:17:56,389 --> 02:17:56,399 then we would access that 6954 02:17:56,399 --> 02:18:00,309 then we would access that using my list and then following syntax 6955 02:18:00,309 --> 02:18:00,319 using my list and then following syntax 6956 02:18:00,319 --> 02:18:03,589 using my list and then following syntax with again square brackets and then 6957 02:18:03,589 --> 02:18:03,599 with again square brackets and then 6958 02:18:03,599 --> 02:18:06,629 with again square brackets and then index number of the element which is 6959 02:18:06,629 --> 02:18:06,639 index number of the element which is 6960 02:18:06,639 --> 02:18:09,509 index number of the element which is starting from zero so this is the first 6961 02:18:09,509 --> 02:18:09,519 starting from zero so this is the first 6962 02:18:09,519 --> 02:18:11,910 starting from zero so this is the first element with index zero this is 6963 02:18:11,910 --> 02:18:11,920 element with index zero this is 6964 02:18:11,920 --> 02:18:15,030 element with index zero this is the element with index one index 6965 02:18:15,030 --> 02:18:15,040 the element with index one index 6966 02:18:15,040 --> 02:18:17,270 the element with index one index two and so on right so it could be 6967 02:18:17,270 --> 02:18:17,280 two and so on right so it could be 6968 02:18:17,280 --> 02:18:19,509 two and so on right so it could be confusing because it starts with zero 6969 02:18:19,509 --> 02:18:19,519 confusing because it starts with zero 6970 02:18:19,519 --> 02:18:22,709 confusing because it starts with zero not with one but that's how the 6971 02:18:22,709 --> 02:18:22,719 not with one but that's how the 6972 02:18:22,719 --> 02:18:25,669 not with one but that's how the specific element of a list can be 6973 02:18:25,669 --> 02:18:25,679 specific element of a list can be 6974 02:18:25,679 --> 02:18:26,950 specific element of a list can be accessed right 6975 02:18:26,950 --> 02:18:26,960 accessed right 6976 02:18:26,960 --> 02:18:30,150 accessed right so if i wanted the march value here the 6977 02:18:30,150 --> 02:18:30,160 so if i wanted the march value here the 6978 02:18:30,160 --> 02:18:31,910 so if i wanted the march value here the third element then i would just 6979 02:18:31,910 --> 02:18:31,920 third element then i would just 6980 02:18:31,920 --> 02:18:34,870 third element then i would just type in index two and this is a syntax 6981 02:18:34,870 --> 02:18:34,880 type in index two and this is a syntax 6982 02:18:34,880 --> 02:18:35,349 type in index two and this is a syntax of 6983 02:18:35,349 --> 02:18:35,359 of 6984 02:18:35,359 --> 02:18:37,349 of getting elements from a list if i just 6985 02:18:37,349 --> 02:18:37,359 getting elements from a list if i just 6986 02:18:37,359 --> 02:18:39,030 getting elements from a list if i just want specific 6987 02:18:39,030 --> 02:18:39,040 want specific 6988 02:18:39,040 --> 02:18:42,870 want specific values and not each element one by one 6989 02:18:42,870 --> 02:18:42,880 values and not each element one by one 6990 02:18:42,880 --> 02:18:45,190 values and not each element one by one as we had in this example right so one 6991 02:18:45,190 --> 02:18:45,200 as we had in this example right so one 6992 02:18:45,200 --> 02:18:46,469 as we had in this example right so one way to use a list 6993 02:18:46,469 --> 02:18:46,479 way to use a list 6994 02:18:46,479 --> 02:18:49,349 way to use a list is to basically loop through it and get 6995 02:18:49,349 --> 02:18:49,359 is to basically loop through it and get 6996 02:18:49,359 --> 02:18:51,110 is to basically loop through it and get one element at a time 6997 02:18:51,110 --> 02:18:51,120 one element at a time 6998 02:18:51,120 --> 02:18:52,549 one element at a time and that's why we don't need to use 6999 02:18:52,549 --> 02:18:52,559 and that's why we don't need to use 7000 02:18:52,559 --> 02:18:54,629 and that's why we don't need to use index here because it gives us 7001 02:18:54,629 --> 02:18:54,639 index here because it gives us 7002 02:18:54,639 --> 02:18:57,750 index here because it gives us elements one after another or 7003 02:18:57,750 --> 02:18:57,760 elements one after another or 7004 02:18:57,760 --> 02:18:59,910 elements one after another or maybe we don't want all the elements or 7005 02:18:59,910 --> 02:18:59,920 maybe we don't want all the elements or 7006 02:18:59,920 --> 02:19:01,910 maybe we don't want all the elements or to do something for each element we just 7007 02:19:01,910 --> 02:19:01,920 to do something for each element we just 7008 02:19:01,920 --> 02:19:03,270 to do something for each element we just want specific 7009 02:19:03,270 --> 02:19:03,280 want specific 7010 02:19:03,280 --> 02:19:05,030 want specific values from the list for different use 7011 02:19:05,030 --> 02:19:05,040 values from the list for different use 7012 02:19:05,040 --> 02:19:06,469 values from the list for different use cases in this case we can 7013 02:19:06,469 --> 02:19:06,479 cases in this case we can 7014 02:19:06,479 --> 02:19:10,309 cases in this case we can access them individually like this and 7015 02:19:10,309 --> 02:19:10,319 access them individually like this and 7016 02:19:10,319 --> 02:19:13,030 access them individually like this and in addition to accessing the values from 7017 02:19:13,030 --> 02:19:13,040 in addition to accessing the values from 7018 02:19:13,040 --> 02:19:14,950 in addition to accessing the values from a list or basically reading the values 7019 02:19:14,950 --> 02:19:14,960 a list or basically reading the values 7020 02:19:14,960 --> 02:19:15,669 a list or basically reading the values from release 7021 02:19:15,669 --> 02:19:15,679 from release 7022 02:19:15,679 --> 02:19:19,509 from release we can also add values to a list 7023 02:19:19,509 --> 02:19:19,519 we can also add values to a list 7024 02:19:19,519 --> 02:19:23,270 we can also add values to a list and we can do that by typing my list 7025 02:19:23,270 --> 02:19:23,280 and we can do that by typing my list 7026 02:19:23,280 --> 02:19:25,589 and we can do that by typing my list and then on the my list we're going to 7027 02:19:25,589 --> 02:19:25,599 and then on the my list we're going to 7028 02:19:25,599 --> 02:19:26,870 and then on the my list we're going to do dot 7029 02:19:26,870 --> 02:19:26,880 do dot 7030 02:19:26,880 --> 02:19:30,150 do dot and use the append function 7031 02:19:30,150 --> 02:19:30,160 and use the append function 7032 02:19:30,160 --> 02:19:33,270 and use the append function right so append will basically take the 7033 02:19:33,270 --> 02:19:33,280 right so append will basically take the 7034 02:19:33,280 --> 02:19:34,150 right so append will basically take the next element 7035 02:19:34,150 --> 02:19:34,160 next element 7036 02:19:34,160 --> 02:19:38,070 next element or another value basically and add it to 7037 02:19:38,070 --> 02:19:38,080 or another value basically and add it to 7038 02:19:38,080 --> 02:19:41,030 or another value basically and add it to the list of elements already in the list 7039 02:19:41,030 --> 02:19:41,040 the list of elements already in the list 7040 02:19:41,040 --> 02:19:41,509 the list of elements already in the list right 7041 02:19:41,509 --> 02:19:41,519 right 7042 02:19:41,519 --> 02:19:43,429 right so let's say we want to add the next 7043 02:19:43,429 --> 02:19:43,439 so let's say we want to add the next 7044 02:19:43,439 --> 02:19:44,549 so let's say we want to add the next month 7045 02:19:44,549 --> 02:19:44,559 month 7046 02:19:44,559 --> 02:19:47,589 month and now if i print 7047 02:19:47,589 --> 02:19:47,599 and now if i print 7048 02:19:47,599 --> 02:19:51,030 and now if i print my list we should actually see 7049 02:19:51,030 --> 02:19:51,040 my list we should actually see 7050 02:19:51,040 --> 02:19:54,950 my list we should actually see this here with april as a fourth element 7051 02:19:54,950 --> 02:19:54,960 this here with april as a fourth element 7052 02:19:54,960 --> 02:19:58,950 this here with april as a fourth element right so let's execute and there you go 7053 02:19:58,950 --> 02:19:58,960 right so let's execute and there you go 7054 02:19:58,960 --> 02:20:01,349 right so let's execute and there you go so first we have march here printed out 7055 02:20:01,349 --> 02:20:01,359 so first we have march here printed out 7056 02:20:01,359 --> 02:20:02,469 so first we have march here printed out which is 7057 02:20:02,469 --> 02:20:02,479 which is 7058 02:20:02,479 --> 02:20:05,670 which is the third element right index two 7059 02:20:05,670 --> 02:20:05,680 the third element right index two 7060 02:20:05,680 --> 02:20:09,030 the third element right index two and then we have my list append that 7061 02:20:09,030 --> 02:20:09,040 and then we have my list append that 7062 02:20:09,040 --> 02:20:12,309 and then we have my list append that adds fourth month name into the list 7063 02:20:12,309 --> 02:20:12,319 adds fourth month name into the list 7064 02:20:12,319 --> 02:20:15,429 adds fourth month name into the list so after append this is how my list 7065 02:20:15,429 --> 02:20:15,439 so after append this is how my list 7066 02:20:15,439 --> 02:20:17,990 so after append this is how my list will look like and now again we can 7067 02:20:17,990 --> 02:20:18,000 will look like and now again we can 7068 02:20:18,000 --> 02:20:19,030 will look like and now again we can access 7069 02:20:19,030 --> 02:20:19,040 access 7070 02:20:19,040 --> 02:20:21,110 access the specific element for example if we 7071 02:20:21,110 --> 02:20:21,120 the specific element for example if we 7072 02:20:21,120 --> 02:20:22,150 the specific element for example if we wanted to access 7073 02:20:22,150 --> 02:20:22,160 wanted to access 7074 02:20:22,160 --> 02:20:26,710 wanted to access the newly edit element on index three 7075 02:20:26,710 --> 02:20:26,720 the newly edit element on index three 7076 02:20:26,720 --> 02:20:29,110 the newly edit element on index three so that's going to be the fourth element 7077 02:20:29,110 --> 02:20:29,120 so that's going to be the fourth element 7078 02:20:29,120 --> 02:20:31,349 so that's going to be the fourth element and there you go we have the new 7079 02:20:31,349 --> 02:20:31,359 and there you go we have the new 7080 02:20:31,359 --> 02:20:33,990 and there you go we have the new element printed out and also an 7081 02:20:33,990 --> 02:20:34,000 element printed out and also an 7082 02:20:34,000 --> 02:20:35,990 element printed out and also an interesting note is what happens 7083 02:20:35,990 --> 02:20:36,000 interesting note is what happens 7084 02:20:36,000 --> 02:20:39,030 interesting note is what happens if we use an index here which is 7085 02:20:39,030 --> 02:20:39,040 if we use an index here which is 7086 02:20:39,040 --> 02:20:41,190 if we use an index here which is too high so basically pointing an 7087 02:20:41,190 --> 02:20:41,200 too high so basically pointing an 7088 02:20:41,200 --> 02:20:43,110 too high so basically pointing an element that doesn't exist right so 7089 02:20:43,110 --> 02:20:43,120 element that doesn't exist right so 7090 02:20:43,120 --> 02:20:44,870 element that doesn't exist right so instead of three let's say we have 7091 02:20:44,870 --> 02:20:44,880 instead of three let's say we have 7092 02:20:44,880 --> 02:20:47,590 instead of three let's say we have four here so this will point to the 7093 02:20:47,590 --> 02:20:47,600 four here so this will point to the 7094 02:20:47,600 --> 02:20:50,070 four here so this will point to the fifth element and since we only have 7095 02:20:50,070 --> 02:20:50,080 fifth element and since we only have 7096 02:20:50,080 --> 02:20:52,230 fifth element and since we only have four elements let's actually see what's 7097 02:20:52,230 --> 02:20:52,240 four elements let's actually see what's 7098 02:20:52,240 --> 02:20:54,630 four elements let's actually see what's gonna happen so i'm gonna execute this 7099 02:20:54,630 --> 02:20:54,640 gonna happen so i'm gonna execute this 7100 02:20:54,640 --> 02:20:57,670 gonna happen so i'm gonna execute this and there you go you see an error index 7101 02:20:57,670 --> 02:20:57,680 and there you go you see an error index 7102 02:20:57,680 --> 02:21:00,070 and there you go you see an error index error that says a list index out of 7103 02:21:00,070 --> 02:21:00,080 error that says a list index out of 7104 02:21:00,080 --> 02:21:00,710 error that says a list index out of range 7105 02:21:00,710 --> 02:21:00,720 range 7106 02:21:00,720 --> 02:21:04,150 range so every time you access or you try to 7107 02:21:04,150 --> 02:21:04,160 so every time you access or you try to 7108 02:21:04,160 --> 02:21:04,790 so every time you access or you try to access an 7109 02:21:04,790 --> 02:21:04,800 access an 7110 02:21:04,800 --> 02:21:08,309 access an element at an index that doesn't exist 7111 02:21:08,309 --> 02:21:08,319 element at an index that doesn't exist 7112 02:21:08,319 --> 02:21:10,710 element at an index that doesn't exist you will get this list index out of 7113 02:21:10,710 --> 02:21:10,720 you will get this list index out of 7114 02:21:10,720 --> 02:21:12,150 you will get this list index out of range error 7115 02:21:12,150 --> 02:21:12,160 range error 7116 02:21:12,160 --> 02:21:14,389 range error and this is actually something that may 7117 02:21:14,389 --> 02:21:14,399 and this is actually something that may 7118 02:21:14,399 --> 02:21:15,990 and this is actually something that may happen pretty often 7119 02:21:15,990 --> 02:21:16,000 happen pretty often 7120 02:21:16,000 --> 02:21:19,110 happen pretty often when working with lists if you're 7121 02:21:19,110 --> 02:21:19,120 when working with lists if you're 7122 02:21:19,120 --> 02:21:22,469 when working with lists if you're accessing the values like this 7123 02:21:22,469 --> 02:21:22,479 accessing the values like this 7124 02:21:22,479 --> 02:21:24,630 accessing the values like this so this is how you work with lists how 7125 02:21:24,630 --> 02:21:24,640 so this is how you work with lists how 7126 02:21:24,640 --> 02:21:26,070 so this is how you work with lists how you create them and access 7127 02:21:26,070 --> 02:21:26,080 you create them and access 7128 02:21:26,080 --> 02:21:27,750 you create them and access values in them as well as add some 7129 02:21:27,750 --> 02:21:27,760 values in them as well as add some 7130 02:21:27,760 --> 02:21:29,190 values in them as well as add some values however 7131 02:21:29,190 --> 02:21:29,200 values however 7132 02:21:29,200 --> 02:21:31,670 values however note that most of the time if you are 7133 02:21:31,670 --> 02:21:31,680 note that most of the time if you are 7134 02:21:31,680 --> 02:21:32,790 note that most of the time if you are using lists 7135 02:21:32,790 --> 02:21:32,800 using lists 7136 02:21:32,800 --> 02:21:34,870 using lists you're going to be using them in a for 7137 02:21:34,870 --> 02:21:34,880 you're going to be using them in a for 7138 02:21:34,880 --> 02:21:36,790 you're going to be using them in a for loop because most of the time you would 7139 02:21:36,790 --> 02:21:36,800 loop because most of the time you would 7140 02:21:36,800 --> 02:21:37,670 loop because most of the time you would want to do 7141 02:21:37,670 --> 02:21:37,680 want to do 7142 02:21:37,680 --> 02:21:40,309 want to do something specific for each element in 7143 02:21:40,309 --> 02:21:40,319 something specific for each element in 7144 02:21:40,319 --> 02:21:41,110 something specific for each element in the list 7145 02:21:41,110 --> 02:21:41,120 the list 7146 02:21:41,120 --> 02:21:42,950 the list so this basically should give you an 7147 02:21:42,950 --> 02:21:42,960 so this basically should give you an 7148 02:21:42,960 --> 02:21:44,870 so this basically should give you an idea of syntax of 7149 02:21:44,870 --> 02:21:44,880 idea of syntax of 7150 02:21:44,880 --> 02:21:47,349 idea of syntax of lists and how to use them generally and 7151 02:21:47,349 --> 02:21:47,359 lists and how to use them generally and 7152 02:21:47,359 --> 02:21:49,750 lists and how to use them generally and also how to use them in combination with 7153 02:21:49,750 --> 02:21:49,760 also how to use them in combination with 7154 02:21:49,760 --> 02:21:52,870 also how to use them in combination with for loops here i want to take a few 7155 02:21:52,870 --> 02:21:52,880 for loops here i want to take a few 7156 02:21:52,880 --> 02:21:54,950 for loops here i want to take a few seconds to thank jetbrains 7157 02:21:54,950 --> 02:21:54,960 seconds to thank jetbrains 7158 02:21:54,960 --> 02:21:57,590 seconds to thank jetbrains the creators of the awesome pycharm and 7159 02:21:57,590 --> 02:21:57,600 the creators of the awesome pycharm and 7160 02:21:57,600 --> 02:21:59,030 the creators of the awesome pycharm and intellij editors 7161 02:21:59,030 --> 02:21:59,040 intellij editors 7162 02:21:59,040 --> 02:22:01,670 intellij editors for sponsoring this complete course 7163 02:22:01,670 --> 02:22:01,680 for sponsoring this complete course 7164 02:22:01,680 --> 02:22:04,070 for sponsoring this complete course besides all the great existing products 7165 02:22:04,070 --> 02:22:04,080 besides all the great existing products 7166 02:22:04,080 --> 02:22:04,870 besides all the great existing products they have 7167 02:22:04,870 --> 02:22:04,880 they have 7168 02:22:04,880 --> 02:22:07,830 they have they recently introduced space which is 7169 02:22:07,830 --> 02:22:07,840 they recently introduced space which is 7170 02:22:07,840 --> 02:22:08,150 they recently introduced space which is an 7171 02:22:08,150 --> 02:22:08,160 an 7172 02:22:08,160 --> 02:22:10,950 an all-in-one team collaboration platform 7173 02:22:10,950 --> 02:22:10,960 all-in-one team collaboration platform 7174 02:22:10,960 --> 02:22:12,950 all-in-one team collaboration platform covering software development 7175 02:22:12,950 --> 02:22:12,960 covering software development 7176 02:22:12,960 --> 02:22:15,429 covering software development project and team management and the 7177 02:22:15,429 --> 02:22:15,439 project and team management and the 7178 02:22:15,439 --> 02:22:17,429 project and team management and the great thing about space is that 7179 02:22:17,429 --> 02:22:17,439 great thing about space is that 7180 02:22:17,439 --> 02:22:19,510 great thing about space is that every single tool you would need in a 7181 02:22:19,510 --> 02:22:19,520 every single tool you would need in a 7182 02:22:19,520 --> 02:22:22,309 every single tool you would need in a company to collaborate and work together 7183 02:22:22,309 --> 02:22:22,319 company to collaborate and work together 7184 02:22:22,319 --> 02:22:23,510 company to collaborate and work together in a team 7185 02:22:23,510 --> 02:22:23,520 in a team 7186 02:22:23,520 --> 02:22:27,429 in a team is in one space so you have tools for 7187 02:22:27,429 --> 02:22:27,439 is in one space so you have tools for 7188 02:22:27,439 --> 02:22:30,790 is in one space so you have tools for chats blogs planning and creating tasks 7189 02:22:30,790 --> 02:22:30,800 chats blogs planning and creating tasks 7190 02:22:30,800 --> 02:22:33,429 chats blogs planning and creating tasks meetings but also software development 7191 02:22:33,429 --> 02:22:33,439 meetings but also software development 7192 02:22:33,439 --> 02:22:34,070 meetings but also software development tools like 7193 02:22:34,070 --> 02:22:34,080 tools like 7194 02:22:34,080 --> 02:22:36,630 tools like version control ci cd package 7195 02:22:36,630 --> 02:22:36,640 version control ci cd package 7196 02:22:36,640 --> 02:22:38,790 version control ci cd package repositories and much more 7197 02:22:38,790 --> 02:22:38,800 repositories and much more 7198 02:22:38,800 --> 02:22:41,750 repositories and much more so all these in one platform and in 7199 02:22:41,750 --> 02:22:41,760 so all these in one platform and in 7200 02:22:41,760 --> 02:22:42,309 so all these in one platform and in terms of 7201 02:22:42,309 --> 02:22:42,319 terms of 7202 02:22:42,319 --> 02:22:45,270 terms of productivity the great thing is you get 7203 02:22:45,270 --> 02:22:45,280 productivity the great thing is you get 7204 02:22:45,280 --> 02:22:47,590 productivity the great thing is you get all the notifications in one place 7205 02:22:47,590 --> 02:22:47,600 all the notifications in one place 7206 02:22:47,600 --> 02:22:50,389 all the notifications in one place like code review updates newly created 7207 02:22:50,389 --> 02:22:50,399 like code review updates newly created 7208 02:22:50,399 --> 02:22:50,870 like code review updates newly created issues 7209 02:22:50,870 --> 02:22:50,880 issues 7210 02:22:50,880 --> 02:22:53,670 issues new blog posts etc you get all of these 7211 02:22:53,670 --> 02:22:53,680 new blog posts etc you get all of these 7212 02:22:53,680 --> 02:22:53,990 new blog posts etc you get all of these in 7213 02:22:53,990 --> 02:22:54,000 in 7214 02:22:54,000 --> 02:22:57,110 in chats where you can react directly in 7215 02:22:57,110 --> 02:22:57,120 chats where you can react directly in 7216 02:22:57,120 --> 02:22:57,750 chats where you can react directly in place 7217 02:22:57,750 --> 02:22:57,760 place 7218 02:22:57,760 --> 02:22:59,990 place or add them to your to-do list 7219 02:22:59,990 --> 02:23:00,000 or add them to your to-do list 7220 02:23:00,000 --> 02:23:01,349 or add them to your to-do list automatically 7221 02:23:01,349 --> 02:23:01,359 automatically 7222 02:23:01,359 --> 02:23:03,750 automatically so i think the main value of space isn't 7223 02:23:03,750 --> 02:23:03,760 so i think the main value of space isn't 7224 02:23:03,760 --> 02:23:05,750 so i think the main value of space isn't that it has all these tools 7225 02:23:05,750 --> 02:23:05,760 that it has all these tools 7226 02:23:05,760 --> 02:23:07,910 that it has all these tools but rather the fact that it integrates 7227 02:23:07,910 --> 02:23:07,920 but rather the fact that it integrates 7228 02:23:07,920 --> 02:23:10,150 but rather the fact that it integrates them in such an intelligent way 7229 02:23:10,150 --> 02:23:10,160 them in such an intelligent way 7230 02:23:10,160 --> 02:23:12,630 them in such an intelligent way that it improves the team communication 7231 02:23:12,630 --> 02:23:12,640 that it improves the team communication 7232 02:23:12,640 --> 02:23:14,550 that it improves the team communication and productivity overall 7233 02:23:14,550 --> 02:23:14,560 and productivity overall 7234 02:23:14,560 --> 02:23:19,510 and productivity overall now let's go back to coding 7235 02:23:19,510 --> 02:23:19,520 now let's go back to coding 7236 02:23:19,520 --> 02:23:21,910 now let's go back to coding now at this point here i want to mention 7237 02:23:21,910 --> 02:23:21,920 now at this point here i want to mention 7238 02:23:21,920 --> 02:23:23,349 now at this point here i want to mention a pretty 7239 02:23:23,349 --> 02:23:23,359 a pretty 7240 02:23:23,359 --> 02:23:25,990 a pretty minor and simple detail but something 7241 02:23:25,990 --> 02:23:26,000 minor and simple detail but something 7242 02:23:26,000 --> 02:23:27,190 minor and simple detail but something that is also very 7243 02:23:27,190 --> 02:23:27,200 that is also very 7244 02:23:27,200 --> 02:23:29,990 that is also very important and useful in programming and 7245 02:23:29,990 --> 02:23:30,000 important and useful in programming and 7246 02:23:30,000 --> 02:23:30,309 important and useful in programming and that 7247 02:23:30,309 --> 02:23:30,319 that 7248 02:23:30,319 --> 02:23:33,590 that is comments so how do we write comments 7249 02:23:33,590 --> 02:23:33,600 is comments so how do we write comments 7250 02:23:33,600 --> 02:23:36,870 is comments so how do we write comments in python and why do we need or in which 7251 02:23:36,870 --> 02:23:36,880 in python and why do we need or in which 7252 02:23:36,880 --> 02:23:37,750 in python and why do we need or in which cases 7253 02:23:37,750 --> 02:23:37,760 cases 7254 02:23:37,760 --> 02:23:40,150 cases are comments actually useful one usage 7255 02:23:40,150 --> 02:23:40,160 are comments actually useful one usage 7256 02:23:40,160 --> 02:23:41,830 are comments actually useful one usage of comments is basically to give 7257 02:23:41,830 --> 02:23:41,840 of comments is basically to give 7258 02:23:41,840 --> 02:23:42,870 of comments is basically to give yourself 7259 02:23:42,870 --> 02:23:42,880 yourself 7260 02:23:42,880 --> 02:23:45,990 yourself some notes on your own code so 7261 02:23:45,990 --> 02:23:46,000 some notes on your own code so 7262 02:23:46,000 --> 02:23:48,309 some notes on your own code so basically if your code gets a little bit 7263 02:23:48,309 --> 02:23:48,319 basically if your code gets a little bit 7264 02:23:48,319 --> 02:23:49,429 basically if your code gets a little bit complicated 7265 02:23:49,429 --> 02:23:49,439 complicated 7266 02:23:49,439 --> 02:23:51,750 complicated and it's not really clear what the logic 7267 02:23:51,750 --> 02:23:51,760 and it's not really clear what the logic 7268 02:23:51,760 --> 02:23:53,990 and it's not really clear what the logic or the function body is doing 7269 02:23:53,990 --> 02:23:54,000 or the function body is doing 7270 02:23:54,000 --> 02:23:55,670 or the function body is doing it could be because of bad programming 7271 02:23:55,670 --> 02:23:55,680 it could be because of bad programming 7272 02:23:55,680 --> 02:23:57,110 it could be because of bad programming but also because 7273 02:23:57,110 --> 02:23:57,120 but also because 7274 02:23:57,120 --> 02:23:59,590 but also because the function logic is just a little too 7275 02:23:59,590 --> 02:23:59,600 the function logic is just a little too 7276 02:23:59,600 --> 02:24:00,550 the function logic is just a little too complicated 7277 02:24:00,550 --> 02:24:00,560 complicated 7278 02:24:00,560 --> 02:24:03,429 complicated so you want to add some textual notes to 7279 02:24:03,429 --> 02:24:03,439 so you want to add some textual notes to 7280 02:24:03,439 --> 02:24:04,309 so you want to add some textual notes to that code 7281 02:24:04,309 --> 02:24:04,319 that code 7282 02:24:04,319 --> 02:24:06,630 that code so that you understand what's going on 7283 02:24:06,630 --> 02:24:06,640 so that you understand what's going on 7284 02:24:06,640 --> 02:24:09,110 so that you understand what's going on there even when you look at that code 7285 02:24:09,110 --> 02:24:09,120 there even when you look at that code 7286 02:24:09,120 --> 02:24:12,389 there even when you look at that code days or maybe weeks after you wrote it 7287 02:24:12,389 --> 02:24:12,399 days or maybe weeks after you wrote it 7288 02:24:12,399 --> 02:24:15,190 days or maybe weeks after you wrote it so for example right here we may want to 7289 02:24:15,190 --> 02:24:15,200 so for example right here we may want to 7290 02:24:15,200 --> 02:24:15,910 so for example right here we may want to add 7291 02:24:15,910 --> 02:24:15,920 add 7292 02:24:15,920 --> 02:24:19,830 add some notes about what 7293 02:24:19,830 --> 02:24:19,840 some notes about what 7294 02:24:19,840 --> 02:24:22,950 some notes about what this part here is doing and comments in 7295 02:24:22,950 --> 02:24:22,960 this part here is doing and comments in 7296 02:24:22,960 --> 02:24:23,830 this part here is doing and comments in python 7297 02:24:23,830 --> 02:24:23,840 python 7298 02:24:23,840 --> 02:24:26,790 python are written with this character so for 7299 02:24:26,790 --> 02:24:26,800 are written with this character so for 7300 02:24:26,800 --> 02:24:27,510 are written with this character so for example 7301 02:24:27,510 --> 02:24:27,520 example 7302 02:24:27,520 --> 02:24:30,710 example i want to add a note here we want 7303 02:24:30,710 --> 02:24:30,720 i want to add a note here we want 7304 02:24:30,720 --> 02:24:34,070 i want to add a note here we want to do conversion only 7305 02:24:34,070 --> 02:24:34,080 to do conversion only 7306 02:24:34,080 --> 02:24:40,150 to do conversion only for positive integers 7307 02:24:42,469 --> 02:24:42,479 and that's basically my note that 7308 02:24:42,479 --> 02:24:44,070 and that's basically my note that summarizes 7309 02:24:44,070 --> 02:24:44,080 summarizes 7310 02:24:44,080 --> 02:24:47,190 summarizes all that logic right here and it is not 7311 02:24:47,190 --> 02:24:47,200 all that logic right here and it is not 7312 02:24:47,200 --> 02:24:49,190 all that logic right here and it is not only useful for myself 7313 02:24:49,190 --> 02:24:49,200 only useful for myself 7314 02:24:49,200 --> 02:24:52,630 only useful for myself in case i forget what this complex logic 7315 02:24:52,630 --> 02:24:52,640 in case i forget what this complex logic 7316 02:24:52,640 --> 02:24:55,429 in case i forget what this complex logic actually does but also for your team 7317 02:24:55,429 --> 02:24:55,439 actually does but also for your team 7318 02:24:55,439 --> 02:24:57,910 actually does but also for your team members so if you're working in a team 7319 02:24:57,910 --> 02:24:57,920 members so if you're working in a team 7320 02:24:57,920 --> 02:25:01,030 members so if you're working in a team and your code gets really complex and 7321 02:25:01,030 --> 02:25:01,040 and your code gets really complex and 7322 02:25:01,040 --> 02:25:01,429 and your code gets really complex and it's 7323 02:25:01,429 --> 02:25:01,439 it's 7324 02:25:01,439 --> 02:25:03,830 it's difficult to keep an overview of 7325 02:25:03,830 --> 02:25:03,840 difficult to keep an overview of 7326 02:25:03,840 --> 02:25:05,750 difficult to keep an overview of different functions and variables and 7327 02:25:05,750 --> 02:25:05,760 different functions and variables and 7328 02:25:05,760 --> 02:25:07,349 different functions and variables and what all these things do 7329 02:25:07,349 --> 02:25:07,359 what all these things do 7330 02:25:07,359 --> 02:25:09,910 what all these things do you can basically add these comments as 7331 02:25:09,910 --> 02:25:09,920 you can basically add these comments as 7332 02:25:09,920 --> 02:25:10,630 you can basically add these comments as notes 7333 02:25:10,630 --> 02:25:10,640 notes 7334 02:25:10,640 --> 02:25:12,550 notes to your team members so they can also 7335 02:25:12,550 --> 02:25:12,560 to your team members so they can also 7336 02:25:12,560 --> 02:25:14,550 to your team members so they can also understand what you thought 7337 02:25:14,550 --> 02:25:14,560 understand what you thought 7338 02:25:14,560 --> 02:25:17,270 understand what you thought or what kind of logic actually you were 7339 02:25:17,270 --> 02:25:17,280 or what kind of logic actually you were 7340 02:25:17,280 --> 02:25:19,349 or what kind of logic actually you were thinking about when writing this code 7341 02:25:19,349 --> 02:25:19,359 thinking about when writing this code 7342 02:25:19,359 --> 02:25:22,870 thinking about when writing this code so comments is a way of communicating 7343 02:25:22,870 --> 02:25:22,880 so comments is a way of communicating 7344 02:25:22,880 --> 02:25:25,030 so comments is a way of communicating your thoughts and your logic on your 7345 02:25:25,030 --> 02:25:25,040 your thoughts and your logic on your 7346 02:25:25,040 --> 02:25:27,030 your thoughts and your logic on your code so that's one use case for using 7347 02:25:27,030 --> 02:25:27,040 code so that's one use case for using 7348 02:25:27,040 --> 02:25:27,750 code so that's one use case for using comments 7349 02:25:27,750 --> 02:25:27,760 comments 7350 02:25:27,760 --> 02:25:29,510 comments and the second use case if you have a 7351 02:25:29,510 --> 02:25:29,520 and the second use case if you have a 7352 02:25:29,520 --> 02:25:31,830 and the second use case if you have a piece of code that you do not want to 7353 02:25:31,830 --> 02:25:31,840 piece of code that you do not want to 7354 02:25:31,840 --> 02:25:32,790 piece of code that you do not want to delete 7355 02:25:32,790 --> 02:25:32,800 delete 7356 02:25:32,800 --> 02:25:35,429 delete because it has some logic or it has some 7357 02:25:35,429 --> 02:25:35,439 because it has some logic or it has some 7358 02:25:35,439 --> 02:25:37,190 because it has some logic or it has some example that you want to 7359 02:25:37,190 --> 02:25:37,200 example that you want to 7360 02:25:37,200 --> 02:25:39,670 example that you want to keep as a reference but you don't want 7361 02:25:39,670 --> 02:25:39,680 keep as a reference but you don't want 7362 02:25:39,680 --> 02:25:40,710 keep as a reference but you don't want that code to be 7363 02:25:40,710 --> 02:25:40,720 that code to be 7364 02:25:40,720 --> 02:25:43,510 that code to be executed so basically you can comment 7365 02:25:43,510 --> 02:25:43,520 executed so basically you can comment 7366 02:25:43,520 --> 02:25:44,070 executed so basically you can comment out 7367 02:25:44,070 --> 02:25:44,080 out 7368 02:25:44,080 --> 02:25:47,429 out code so that it still stays there but 7369 02:25:47,429 --> 02:25:47,439 code so that it still stays there but 7370 02:25:47,439 --> 02:25:49,349 code so that it still stays there but doesn't get executed and the way to do 7371 02:25:49,349 --> 02:25:49,359 doesn't get executed and the way to do 7372 02:25:49,359 --> 02:25:52,950 doesn't get executed and the way to do that is just basically 7373 02:25:52,950 --> 02:25:52,960 that is just basically 7374 02:25:52,960 --> 02:25:55,670 that is just basically having this character before the line 7375 02:25:55,670 --> 02:25:55,680 having this character before the line 7376 02:25:55,680 --> 02:25:56,550 having this character before the line and also 7377 02:25:56,550 --> 02:25:56,560 and also 7378 02:25:56,560 --> 02:25:59,429 and also note the color of the comment in the 7379 02:25:59,429 --> 02:25:59,439 note the color of the comment in the 7380 02:25:59,439 --> 02:26:00,150 note the color of the comment in the editor 7381 02:26:00,150 --> 02:26:00,160 editor 7382 02:26:00,160 --> 02:26:01,990 editor is gray so it's immediately visible that 7383 02:26:01,990 --> 02:26:02,000 is gray so it's immediately visible that 7384 02:26:02,000 --> 02:26:03,190 is gray so it's immediately visible that these are the comments 7385 02:26:03,190 --> 02:26:03,200 these are the comments 7386 02:26:03,200 --> 02:26:05,349 these are the comments and now these two lines will not get 7387 02:26:05,349 --> 02:26:05,359 and now these two lines will not get 7388 02:26:05,359 --> 02:26:06,870 and now these two lines will not get executed by the program 7389 02:26:06,870 --> 02:26:06,880 executed by the program 7390 02:26:06,880 --> 02:26:09,030 executed by the program they will be ignored but they are for 7391 02:26:09,030 --> 02:26:09,040 they will be ignored but they are for 7392 02:26:09,040 --> 02:26:10,150 they will be ignored but they are for your own reference 7393 02:26:10,150 --> 02:26:10,160 your own reference 7394 02:26:10,160 --> 02:26:12,230 your own reference in case you want to keep it there for 7395 02:26:12,230 --> 02:26:12,240 in case you want to keep it there for 7396 02:26:12,240 --> 02:26:13,910 in case you want to keep it there for example this could happen 7397 02:26:13,910 --> 02:26:13,920 example this could happen 7398 02:26:13,920 --> 02:26:16,389 example this could happen if you are unsure about the change and 7399 02:26:16,389 --> 02:26:16,399 if you are unsure about the change and 7400 02:26:16,399 --> 02:26:18,389 if you are unsure about the change and you want to delete that whole code 7401 02:26:18,389 --> 02:26:18,399 you want to delete that whole code 7402 02:26:18,399 --> 02:26:20,710 you want to delete that whole code from your application because you might 7403 02:26:20,710 --> 02:26:20,720 from your application because you might 7404 02:26:20,720 --> 02:26:21,910 from your application because you might actually need that 7405 02:26:21,910 --> 02:26:21,920 actually need that 7406 02:26:21,920 --> 02:26:24,150 actually need that eventually so you're not sure about it 7407 02:26:24,150 --> 02:26:24,160 eventually so you're not sure about it 7408 02:26:24,160 --> 02:26:25,670 eventually so you're not sure about it so temporary 7409 02:26:25,670 --> 02:26:25,680 so temporary 7410 02:26:25,680 --> 02:26:27,990 so temporary comment the code before you permanently 7411 02:26:27,990 --> 02:26:28,000 comment the code before you permanently 7412 02:26:28,000 --> 02:26:29,030 comment the code before you permanently delete that 7413 02:26:29,030 --> 02:26:29,040 delete that 7414 02:26:29,040 --> 02:26:31,190 delete that so these are some of the use cases of 7415 02:26:31,190 --> 02:26:31,200 so these are some of the use cases of 7416 02:26:31,200 --> 02:26:32,150 so these are some of the use cases of comments 7417 02:26:32,150 --> 02:26:32,160 comments 7418 02:26:32,160 --> 02:26:34,630 comments now if you have multiple lines of code 7419 02:26:34,630 --> 02:26:34,640 now if you have multiple lines of code 7420 02:26:34,640 --> 02:26:36,070 now if you have multiple lines of code that you want to comment out 7421 02:26:36,070 --> 02:26:36,080 that you want to comment out 7422 02:26:36,080 --> 02:26:38,389 that you want to comment out or maybe hold text that you wrote as a 7423 02:26:38,389 --> 02:26:38,399 or maybe hold text that you wrote as a 7424 02:26:38,399 --> 02:26:40,469 or maybe hold text that you wrote as a note so for example you want to comment 7425 02:26:40,469 --> 02:26:40,479 note so for example you want to comment 7426 02:26:40,479 --> 02:26:42,309 note so for example you want to comment out all these four lines here 7427 02:26:42,309 --> 02:26:42,319 out all these four lines here 7428 02:26:42,319 --> 02:26:44,710 out all these four lines here obviously you don't want to do this in 7429 02:26:44,710 --> 02:26:44,720 obviously you don't want to do this in 7430 02:26:44,720 --> 02:26:46,309 obviously you don't want to do this in front of every line 7431 02:26:46,309 --> 02:26:46,319 front of every line 7432 02:26:46,319 --> 02:26:48,950 front of every line so for multi-line comments you can 7433 02:26:48,950 --> 02:26:48,960 so for multi-line comments you can 7434 02:26:48,960 --> 02:26:49,510 so for multi-line comments you can actually 7435 02:26:49,510 --> 02:26:49,520 actually 7436 02:26:49,520 --> 02:26:53,510 actually use the following syntax which is three 7437 02:26:53,510 --> 02:26:53,520 use the following syntax which is three 7438 02:26:53,520 --> 02:26:56,550 use the following syntax which is three quotes at the beginning and 7439 02:26:56,550 --> 02:26:56,560 quotes at the beginning and 7440 02:26:56,560 --> 02:26:59,590 quotes at the beginning and at the end and again you see the 7441 02:26:59,590 --> 02:26:59,600 at the end and again you see the 7442 02:26:59,600 --> 02:27:01,030 at the end and again you see the highlighting is 7443 02:27:01,030 --> 02:27:01,040 highlighting is 7444 02:27:01,040 --> 02:27:04,070 highlighting is different here which basically is 7445 02:27:04,070 --> 02:27:04,080 different here which basically is 7446 02:27:04,080 --> 02:27:06,950 different here which basically is highlighting of a string however it is 7447 02:27:06,950 --> 02:27:06,960 highlighting of a string however it is 7448 02:27:06,960 --> 02:27:07,670 highlighting of a string however it is ignored 7449 02:27:07,670 --> 02:27:07,680 ignored 7450 02:27:07,680 --> 02:27:09,830 ignored by the program and it will not be 7451 02:27:09,830 --> 02:27:09,840 by the program and it will not be 7452 02:27:09,840 --> 02:27:10,790 by the program and it will not be executed 7453 02:27:10,790 --> 02:27:10,800 executed 7454 02:27:10,800 --> 02:27:13,030 executed as a best practice you shouldn't have 7455 02:27:13,030 --> 02:27:13,040 as a best practice you shouldn't have 7456 02:27:13,040 --> 02:27:14,790 as a best practice you shouldn't have too many comments in your code because 7457 02:27:14,790 --> 02:27:14,800 too many comments in your code because 7458 02:27:14,800 --> 02:27:17,190 too many comments in your code because it will just add additional clutter 7459 02:27:17,190 --> 02:27:17,200 it will just add additional clutter 7460 02:27:17,200 --> 02:27:19,270 it will just add additional clutter and your code will look basically 7461 02:27:19,270 --> 02:27:19,280 and your code will look basically 7462 02:27:19,280 --> 02:27:20,389 and your code will look basically unclean so 7463 02:27:20,389 --> 02:27:20,399 unclean so 7464 02:27:20,399 --> 02:27:26,150 unclean so you should use them only when needed 7465 02:27:28,070 --> 02:27:28,080 in this part i'm going to show you 7466 02:27:28,080 --> 02:27:30,469 in this part i'm going to show you another data type in python 7467 02:27:30,469 --> 02:27:30,479 another data type in python 7468 02:27:30,479 --> 02:27:33,670 another data type in python called set so what is a set let's start 7469 02:27:33,670 --> 02:27:33,680 called set so what is a set let's start 7470 02:27:33,680 --> 02:27:35,030 called set so what is a set let's start our application again 7471 02:27:35,030 --> 02:27:35,040 our application again 7472 02:27:35,040 --> 02:27:38,469 our application again and let's say i provide here input 7473 02:27:38,469 --> 02:27:38,479 and let's say i provide here input 7474 02:27:38,479 --> 02:27:41,750 and let's say i provide here input values as a list let's say 20 7475 02:27:41,750 --> 02:27:41,760 values as a list let's say 20 7476 02:27:41,760 --> 02:27:44,870 values as a list let's say 20 40 and 20 again 7477 02:27:44,870 --> 02:27:44,880 40 and 20 again 7478 02:27:44,880 --> 02:27:47,830 40 and 20 again so basically i have duplicate values in 7479 02:27:47,830 --> 02:27:47,840 so basically i have duplicate values in 7480 02:27:47,840 --> 02:27:48,870 so basically i have duplicate values in my list 7481 02:27:48,870 --> 02:27:48,880 my list 7482 02:27:48,880 --> 02:27:51,910 my list and when i execute it i see that 7483 02:27:51,910 --> 02:27:51,920 and when i execute it i see that 7484 02:27:51,920 --> 02:27:53,990 and when i execute it i see that the program got executed for each 7485 02:27:53,990 --> 02:27:54,000 the program got executed for each 7486 02:27:54,000 --> 02:27:55,349 the program got executed for each element 7487 02:27:55,349 --> 02:27:55,359 element 7488 02:27:55,359 --> 02:27:58,309 element and i have duplicate results because i 7489 02:27:58,309 --> 02:27:58,319 and i have duplicate results because i 7490 02:27:58,319 --> 02:27:59,990 and i have duplicate results because i passed in the same value 7491 02:27:59,990 --> 02:28:00,000 passed in the same value 7492 02:28:00,000 --> 02:28:03,030 passed in the same value twice now again users 7493 02:28:03,030 --> 02:28:03,040 twice now again users 7494 02:28:03,040 --> 02:28:05,670 twice now again users they can input any value they want 7495 02:28:05,670 --> 02:28:05,680 they can input any value they want 7496 02:28:05,680 --> 02:28:06,389 they can input any value they want either 7497 02:28:06,389 --> 02:28:06,399 either 7498 02:28:06,399 --> 02:28:08,950 either intentionally or accidentally this could 7499 02:28:08,950 --> 02:28:08,960 intentionally or accidentally this could 7500 02:28:08,960 --> 02:28:09,990 intentionally or accidentally this could be bad values 7501 02:28:09,990 --> 02:28:10,000 be bad values 7502 02:28:10,000 --> 02:28:12,630 be bad values or things that don't make any sense so 7503 02:28:12,630 --> 02:28:12,640 or things that don't make any sense so 7504 02:28:12,640 --> 02:28:13,270 or things that don't make any sense so let's say 7505 02:28:13,270 --> 02:28:13,280 let's say 7506 02:28:13,280 --> 02:28:15,750 let's say we want our program to behave in a way 7507 02:28:15,750 --> 02:28:15,760 we want our program to behave in a way 7508 02:28:15,760 --> 02:28:16,469 we want our program to behave in a way that 7509 02:28:16,469 --> 02:28:16,479 that 7510 02:28:16,479 --> 02:28:19,910 that if user provides the same values twice 7511 02:28:19,910 --> 02:28:19,920 if user provides the same values twice 7512 02:28:19,920 --> 02:28:23,510 if user provides the same values twice or three times we only want to calculate 7513 02:28:23,510 --> 02:28:23,520 or three times we only want to calculate 7514 02:28:23,520 --> 02:28:26,469 or three times we only want to calculate the number of hours for that value just 7515 02:28:26,469 --> 02:28:26,479 the number of hours for that value just 7516 02:28:26,479 --> 02:28:27,429 the number of hours for that value just once 7517 02:28:27,429 --> 02:28:27,439 once 7518 02:28:27,439 --> 02:28:30,309 once so basically for this input we want just 7519 02:28:30,309 --> 02:28:30,319 so basically for this input we want just 7520 02:28:30,319 --> 02:28:30,870 so basically for this input we want just those 7521 02:28:30,870 --> 02:28:30,880 those 7522 02:28:30,880 --> 02:28:33,110 those two lines and basically ignore the 7523 02:28:33,110 --> 02:28:33,120 two lines and basically ignore the 7524 02:28:33,120 --> 02:28:35,510 two lines and basically ignore the execution again for the same value 7525 02:28:35,510 --> 02:28:35,520 execution again for the same value 7526 02:28:35,520 --> 02:28:37,590 execution again for the same value and you probably already guessed that's 7527 02:28:37,590 --> 02:28:37,600 and you probably already guessed that's 7528 02:28:37,600 --> 02:28:38,870 and you probably already guessed that's where set 7529 02:28:38,870 --> 02:28:38,880 where set 7530 02:28:38,880 --> 02:28:41,750 where set data type will help us so set is 7531 02:28:41,750 --> 02:28:41,760 data type will help us so set is 7532 02:28:41,760 --> 02:28:43,349 data type will help us so set is basically a list 7533 02:28:43,349 --> 02:28:43,359 basically a list 7534 02:28:43,359 --> 02:28:46,309 basically a list of elements but with unique values 7535 02:28:46,309 --> 02:28:46,319 of elements but with unique values 7536 02:28:46,319 --> 02:28:47,190 of elements but with unique values inside 7537 02:28:47,190 --> 02:28:47,200 inside 7538 02:28:47,200 --> 02:28:50,070 inside so list data type allows duplicate 7539 02:28:50,070 --> 02:28:50,080 so list data type allows duplicate 7540 02:28:50,080 --> 02:28:50,790 so list data type allows duplicate values 7541 02:28:50,790 --> 02:28:50,800 values 7542 02:28:50,800 --> 02:28:54,150 values the same value multiple times set does 7543 02:28:54,150 --> 02:28:54,160 the same value multiple times set does 7544 02:28:54,160 --> 02:28:56,150 the same value multiple times set does not allow duplicate values 7545 02:28:56,150 --> 02:28:56,160 not allow duplicate values 7546 02:28:56,160 --> 02:28:59,349 not allow duplicate values so how do we use set instead of a list 7547 02:28:59,349 --> 02:28:59,359 so how do we use set instead of a list 7548 02:28:59,359 --> 02:29:01,830 so how do we use set instead of a list and it's actually very easy to convert 7549 02:29:01,830 --> 02:29:01,840 and it's actually very easy to convert 7550 02:29:01,840 --> 02:29:02,710 and it's actually very easy to convert an existing 7551 02:29:02,710 --> 02:29:02,720 an existing 7552 02:29:02,720 --> 02:29:05,910 an existing list into a set and we can do that 7553 02:29:05,910 --> 02:29:05,920 list into a set and we can do that 7554 02:29:05,920 --> 02:29:09,349 list into a set and we can do that using a function called set 7555 02:29:09,349 --> 02:29:09,359 using a function called set 7556 02:29:09,359 --> 02:29:11,750 using a function called set and basically the parameter of our set 7557 02:29:11,750 --> 02:29:11,760 and basically the parameter of our set 7558 02:29:11,760 --> 02:29:12,790 and basically the parameter of our set function will be 7559 02:29:12,790 --> 02:29:12,800 function will be 7560 02:29:12,800 --> 02:29:16,469 function will be the list so if this list here contains 7561 02:29:16,469 --> 02:29:16,479 the list so if this list here contains 7562 02:29:16,479 --> 02:29:18,550 the list so if this list here contains any duplicated values that will be 7563 02:29:18,550 --> 02:29:18,560 any duplicated values that will be 7564 02:29:18,560 --> 02:29:20,230 any duplicated values that will be basically just filtered out 7565 02:29:20,230 --> 02:29:20,240 basically just filtered out 7566 02:29:20,240 --> 02:29:22,710 basically just filtered out when we convert it into a set so that's 7567 02:29:22,710 --> 02:29:22,720 when we convert it into a set so that's 7568 02:29:22,720 --> 02:29:23,910 when we convert it into a set so that's how it works 7569 02:29:23,910 --> 02:29:23,920 how it works 7570 02:29:23,920 --> 02:29:27,190 how it works and again for demonstration let's 7571 02:29:27,190 --> 02:29:27,200 and again for demonstration let's 7572 02:29:27,200 --> 02:29:28,710 and again for demonstration let's actually print out 7573 02:29:28,710 --> 02:29:28,720 actually print out 7574 02:29:28,720 --> 02:29:31,990 actually print out how set value looks like 7575 02:29:31,990 --> 02:29:32,000 how set value looks like 7576 02:29:32,000 --> 02:29:36,630 how set value looks like so i'm going to print the list first 7577 02:29:36,630 --> 02:29:36,640 so i'm going to print the list first 7578 02:29:36,640 --> 02:29:40,070 so i'm going to print the list first so that we can compare then we're gonna 7579 02:29:40,070 --> 02:29:40,080 so that we can compare then we're gonna 7580 02:29:40,080 --> 02:29:45,429 so that we can compare then we're gonna print out the set 7581 02:29:49,349 --> 02:29:49,359 and let's also print out the types 7582 02:29:49,359 --> 02:29:51,510 and let's also print out the types and i don't want to repeat this 7583 02:29:51,510 --> 02:29:51,520 and i don't want to repeat this 7584 02:29:51,520 --> 02:29:53,670 and i don't want to repeat this expression over and over again 7585 02:29:53,670 --> 02:29:53,680 expression over and over again 7586 02:29:53,680 --> 02:29:55,910 expression over and over again so what we can do even though this is 7587 02:29:55,910 --> 02:29:55,920 so what we can do even though this is 7588 02:29:55,920 --> 02:29:57,670 so what we can do even though this is just for demonstration 7589 02:29:57,670 --> 02:29:57,680 just for demonstration 7590 02:29:57,680 --> 02:30:01,030 just for demonstration we can actually 7591 02:30:05,190 --> 02:30:05,200 extract it into a variable let's say 7592 02:30:05,200 --> 02:30:11,270 extract it into a variable let's say list of days 7593 02:30:14,630 --> 02:30:14,640 like this and 7594 02:30:14,640 --> 02:30:16,710 like this and we can use it everywhere we need and 7595 02:30:16,710 --> 02:30:16,720 we can use it everywhere we need and 7596 02:30:16,720 --> 02:30:18,950 we can use it everywhere we need and this is a little bit cleaner because 7597 02:30:18,950 --> 02:30:18,960 this is a little bit cleaner because 7598 02:30:18,960 --> 02:30:20,950 this is a little bit cleaner because we don't have to repeat the same 7599 02:30:20,950 --> 02:30:20,960 we don't have to repeat the same 7600 02:30:20,960 --> 02:30:21,990 we don't have to repeat the same expression 7601 02:30:21,990 --> 02:30:22,000 expression 7602 02:30:22,000 --> 02:30:24,309 expression over and over again and again let's 7603 02:30:24,309 --> 02:30:24,319 over and over again and again let's 7604 02:30:24,319 --> 02:30:26,230 over and over again and again let's print out the type 7605 02:30:26,230 --> 02:30:26,240 print out the type 7606 02:30:26,240 --> 02:30:30,309 print out the type of list of days and then print out 7607 02:30:30,309 --> 02:30:30,319 of list of days and then print out 7608 02:30:30,319 --> 02:30:34,790 of list of days and then print out the type of a set 7609 02:30:34,790 --> 02:30:34,800 the type of a set 7610 02:30:34,800 --> 02:30:37,990 the type of a set of lists of days and again you see that 7611 02:30:37,990 --> 02:30:38,000 of lists of days and again you see that 7612 02:30:38,000 --> 02:30:41,990 of lists of days and again you see that nested function calls three times 7613 02:30:41,990 --> 02:30:42,000 nested function calls three times 7614 02:30:42,000 --> 02:30:43,830 nested function calls three times and this should give us some interesting 7615 02:30:43,830 --> 02:30:43,840 and this should give us some interesting 7616 02:30:43,840 --> 02:30:45,590 and this should give us some interesting value that we can compare 7617 02:30:45,590 --> 02:30:45,600 value that we can compare 7618 02:30:45,600 --> 02:30:48,389 value that we can compare lists and sets and just a small note 7619 02:30:48,389 --> 02:30:48,399 lists and sets and just a small note 7620 02:30:48,399 --> 02:30:50,469 lists and sets and just a small note here that whenever we have this nested 7621 02:30:50,469 --> 02:30:50,479 here that whenever we have this nested 7622 02:30:50,479 --> 02:30:51,830 here that whenever we have this nested function calls 7623 02:30:51,830 --> 02:30:51,840 function calls 7624 02:30:51,840 --> 02:30:55,030 function calls think of the execution from inside 7625 02:30:55,030 --> 02:30:55,040 think of the execution from inside 7626 02:30:55,040 --> 02:30:57,190 think of the execution from inside out so the first function that will get 7627 02:30:57,190 --> 02:30:57,200 out so the first function that will get 7628 02:30:57,200 --> 02:30:58,630 out so the first function that will get executed in this chain 7629 02:30:58,630 --> 02:30:58,640 executed in this chain 7630 02:30:58,640 --> 02:31:01,270 executed in this chain is actually the set right so it starts 7631 02:31:01,270 --> 02:31:01,280 is actually the set right so it starts 7632 02:31:01,280 --> 02:31:03,030 is actually the set right so it starts from the last function 7633 02:31:03,030 --> 02:31:03,040 from the last function 7634 02:31:03,040 --> 02:31:05,429 from the last function in that chain so set function will get 7635 02:31:05,429 --> 02:31:05,439 in that chain so set function will get 7636 02:31:05,439 --> 02:31:07,429 in that chain so set function will get executed and convert that list into a 7637 02:31:07,429 --> 02:31:07,439 executed and convert that list into a 7638 02:31:07,439 --> 02:31:08,070 executed and convert that list into a set 7639 02:31:08,070 --> 02:31:08,080 set 7640 02:31:08,080 --> 02:31:10,309 set then type function will get executed on 7641 02:31:10,309 --> 02:31:10,319 then type function will get executed on 7642 02:31:10,319 --> 02:31:12,469 then type function will get executed on that resulting set value 7643 02:31:12,469 --> 02:31:12,479 that resulting set value 7644 02:31:12,479 --> 02:31:14,469 that resulting set value and then print will get executed and 7645 02:31:14,469 --> 02:31:14,479 and then print will get executed and 7646 02:31:14,479 --> 02:31:15,910 and then print will get executed and print basically the result 7647 02:31:15,910 --> 02:31:15,920 print basically the result 7648 02:31:15,920 --> 02:31:18,630 print basically the result of the type so the order goes from 7649 02:31:18,630 --> 02:31:18,640 of the type so the order goes from 7650 02:31:18,640 --> 02:31:20,630 of the type so the order goes from innermost function to the outer 7651 02:31:20,630 --> 02:31:20,640 innermost function to the outer 7652 02:31:20,640 --> 02:31:22,150 innermost function to the outer functions 7653 02:31:22,150 --> 02:31:22,160 functions 7654 02:31:22,160 --> 02:31:25,030 functions so let's save it and execute and now i'm 7655 02:31:25,030 --> 02:31:25,040 so let's save it and execute and now i'm 7656 02:31:25,040 --> 02:31:25,429 so let's save it and execute and now i'm going to 7657 02:31:25,429 --> 02:31:25,439 going to 7658 02:31:25,439 --> 02:31:28,710 going to again provide a list let's say 10 7659 02:31:28,710 --> 02:31:28,720 again provide a list let's say 10 7660 02:31:28,720 --> 02:31:33,110 again provide a list let's say 10 and then 45 and 30 and 10 again 7661 02:31:33,110 --> 02:31:33,120 and then 45 and 30 and 10 again 7662 02:31:33,120 --> 02:31:37,270 and then 45 and 30 and 10 again and enter and first of all we see that 7663 02:31:37,270 --> 02:31:37,280 and enter and first of all we see that 7664 02:31:37,280 --> 02:31:41,670 and enter and first of all we see that 10 only got executed once and not twice 7665 02:31:41,670 --> 02:31:41,680 10 only got executed once and not twice 7666 02:31:41,680 --> 02:31:44,790 10 only got executed once and not twice and we can also see the first one 7667 02:31:44,790 --> 02:31:44,800 and we can also see the first one 7668 02:31:44,800 --> 02:31:48,389 and we can also see the first one is basically value of a list and you see 7669 02:31:48,389 --> 02:31:48,399 is basically value of a list and you see 7670 02:31:48,399 --> 02:31:51,590 is basically value of a list and you see at least here the second one is a set 7671 02:31:51,590 --> 02:31:51,600 at least here the second one is a set 7672 02:31:51,600 --> 02:31:54,710 at least here the second one is a set and you already notice the difference 7673 02:31:54,710 --> 02:31:54,720 and you already notice the difference 7674 02:31:54,720 --> 02:31:58,469 and you already notice the difference that list basically uses square brackets 7675 02:31:58,469 --> 02:31:58,479 that list basically uses square brackets 7676 02:31:58,479 --> 02:31:59,190 that list basically uses square brackets and set 7677 02:31:59,190 --> 02:31:59,200 and set 7678 02:31:59,200 --> 02:32:02,309 and set is represented using curly braces right 7679 02:32:02,309 --> 02:32:02,319 is represented using curly braces right 7680 02:32:02,319 --> 02:32:05,750 is represented using curly braces right and again it has value of 10 just once 7681 02:32:05,750 --> 02:32:05,760 and again it has value of 10 just once 7682 02:32:05,760 --> 02:32:08,469 and again it has value of 10 just once and again we have the data type of a 7683 02:32:08,469 --> 02:32:08,479 and again we have the data type of a 7684 02:32:08,479 --> 02:32:08,950 and again we have the data type of a list 7685 02:32:08,950 --> 02:32:08,960 list 7686 02:32:08,960 --> 02:32:11,429 list and a set so just to demonstrate that 7687 02:32:11,429 --> 02:32:11,439 and a set so just to demonstrate that 7688 02:32:11,439 --> 02:32:12,550 and a set so just to demonstrate that they are actually 7689 02:32:12,550 --> 02:32:12,560 they are actually 7690 02:32:12,560 --> 02:32:18,950 they are actually own separate data types 7691 02:32:22,070 --> 02:32:22,080 and like we saw previously with lists we 7692 02:32:22,080 --> 02:32:22,870 and like we saw previously with lists we can also 7693 02:32:22,870 --> 02:32:22,880 can also 7694 02:32:22,880 --> 02:32:25,349 can also create sets as well as add an excess 7695 02:32:25,349 --> 02:32:25,359 create sets as well as add an excess 7696 02:32:25,359 --> 02:32:27,030 create sets as well as add an excess values from it 7697 02:32:27,030 --> 02:32:27,040 values from it 7698 02:32:27,040 --> 02:32:29,429 values from it so let's see an example here for example 7699 02:32:29,429 --> 02:32:29,439 so let's see an example here for example 7700 02:32:29,439 --> 02:32:31,190 so let's see an example here for example if you want to create a set 7701 02:32:31,190 --> 02:32:31,200 if you want to create a set 7702 02:32:31,200 --> 02:32:34,230 if you want to create a set the syntax for that will look like this 7703 02:32:34,230 --> 02:32:34,240 the syntax for that will look like this 7704 02:32:34,240 --> 02:32:37,910 the syntax for that will look like this as we already saw again set can have 7705 02:32:37,910 --> 02:32:37,920 as we already saw again set can have 7706 02:32:37,920 --> 02:32:40,469 as we already saw again set can have strings or numbers or booleans 7707 02:32:40,469 --> 02:32:40,479 strings or numbers or booleans 7708 02:32:40,479 --> 02:32:43,590 strings or numbers or booleans as its elements let's use the same 7709 02:32:43,590 --> 02:32:43,600 as its elements let's use the same 7710 02:32:43,600 --> 02:32:45,349 as its elements let's use the same example we use with lists so 7711 02:32:45,349 --> 02:32:45,359 example we use with lists so 7712 02:32:45,359 --> 02:32:48,710 example we use with lists so i'm gonna just basically type in names 7713 02:32:48,710 --> 02:32:48,720 i'm gonna just basically type in names 7714 02:32:48,720 --> 02:32:50,070 i'm gonna just basically type in names of the month here 7715 02:32:50,070 --> 02:32:50,080 of the month here 7716 02:32:50,080 --> 02:32:55,429 of the month here so let's say we have again january 7717 02:33:02,309 --> 02:33:02,319 march and we're going to 7718 02:33:02,319 --> 02:33:05,429 march and we're going to assign that again to a variable 7719 02:33:05,429 --> 02:33:05,439 assign that again to a variable 7720 02:33:05,439 --> 02:33:07,270 assign that again to a variable so this will give us a set that we can 7721 02:33:07,270 --> 02:33:07,280 so this will give us a set that we can 7722 02:33:07,280 --> 02:33:08,630 so this will give us a set that we can create ourselves 7723 02:33:08,630 --> 02:33:08,640 create ourselves 7724 02:33:08,640 --> 02:33:11,429 create ourselves not just from the user input and now we 7725 02:33:11,429 --> 02:33:11,439 not just from the user input and now we 7726 02:33:11,439 --> 02:33:12,550 not just from the user input and now we can access 7727 02:33:12,550 --> 02:33:12,560 can access 7728 02:33:12,560 --> 02:33:14,790 can access the values the individual elements from 7729 02:33:14,790 --> 02:33:14,800 the values the individual elements from 7730 02:33:14,800 --> 02:33:15,590 the values the individual elements from the set 7731 02:33:15,590 --> 02:33:15,600 the set 7732 02:33:15,600 --> 02:33:18,550 the set and we can also add elements to the set 7733 02:33:18,550 --> 02:33:18,560 and we can also add elements to the set 7734 02:33:18,560 --> 02:33:19,590 and we can also add elements to the set however 7735 02:33:19,590 --> 02:33:19,600 however 7736 02:33:19,600 --> 02:33:23,590 however we cannot access the individual 7737 02:33:23,590 --> 02:33:23,600 we cannot access the individual 7738 02:33:23,600 --> 02:33:26,870 we cannot access the individual elements of the set like we did on lists 7739 02:33:26,870 --> 02:33:26,880 elements of the set like we did on lists 7740 02:33:26,880 --> 02:33:27,349 elements of the set like we did on lists right 7741 02:33:27,349 --> 02:33:27,359 right 7742 02:33:27,359 --> 02:33:31,429 right you remember on lists we use the syntax 7743 02:33:31,429 --> 02:33:31,439 you remember on lists we use the syntax 7744 02:33:31,439 --> 02:33:34,389 you remember on lists we use the syntax with square brackets and the index of 7745 02:33:34,389 --> 02:33:34,399 with square brackets and the index of 7746 02:33:34,399 --> 02:33:35,990 with square brackets and the index of the element 7747 02:33:35,990 --> 02:33:36,000 the element 7748 02:33:36,000 --> 02:33:39,910 the element in set we cannot actually do that 7749 02:33:39,910 --> 02:33:39,920 in set we cannot actually do that 7750 02:33:39,920 --> 02:33:42,150 in set we cannot actually do that instead we can only access the elements 7751 02:33:42,150 --> 02:33:42,160 instead we can only access the elements 7752 02:33:42,160 --> 02:33:42,950 instead we can only access the elements of a set 7753 02:33:42,950 --> 02:33:42,960 of a set 7754 02:33:42,960 --> 02:33:47,510 of a set in a loop so for example in a for loop 7755 02:33:47,510 --> 02:33:47,520 in a loop so for example in a for loop 7756 02:33:47,520 --> 02:33:51,110 in a loop so for example in a for loop we would write element 7757 02:33:51,110 --> 02:33:51,120 we would write element 7758 02:33:51,120 --> 02:33:55,429 we would write element in my set and then 7759 02:33:55,429 --> 02:33:55,439 in my set and then 7760 02:33:55,439 --> 02:33:58,550 in my set and then we can basically print that element so 7761 02:33:58,550 --> 02:33:58,560 we can basically print that element so 7762 02:33:58,560 --> 02:34:00,830 we can basically print that element so let's 7763 02:34:02,230 --> 02:34:02,240 execute 7764 02:34:02,240 --> 02:34:04,950 execute and right here you see all the elements 7765 02:34:04,950 --> 02:34:04,960 and right here you see all the elements 7766 02:34:04,960 --> 02:34:06,070 and right here you see all the elements printed out 7767 02:34:06,070 --> 02:34:06,080 printed out 7768 02:34:06,080 --> 02:34:08,950 printed out and again as i mentioned with lists also 7769 02:34:08,950 --> 02:34:08,960 and again as i mentioned with lists also 7770 02:34:08,960 --> 02:34:09,910 and again as i mentioned with lists also previously 7771 02:34:09,910 --> 02:34:09,920 previously 7772 02:34:09,920 --> 02:34:11,429 previously most of the time when you're working 7773 02:34:11,429 --> 02:34:11,439 most of the time when you're working 7774 02:34:11,439 --> 02:34:13,750 most of the time when you're working with lists or sets 7775 02:34:13,750 --> 02:34:13,760 with lists or sets 7776 02:34:13,760 --> 02:34:15,510 with lists or sets you're gonna want to look through the 7777 02:34:15,510 --> 02:34:15,520 you're gonna want to look through the 7778 02:34:15,520 --> 02:34:17,670 you're gonna want to look through the elements because you probably would want 7779 02:34:17,670 --> 02:34:17,680 elements because you probably would want 7780 02:34:17,680 --> 02:34:19,429 elements because you probably would want to do some operation 7781 02:34:19,429 --> 02:34:19,439 to do some operation 7782 02:34:19,439 --> 02:34:21,429 to do some operation on individual elements or some of the 7783 02:34:21,429 --> 02:34:21,439 on individual elements or some of the 7784 02:34:21,439 --> 02:34:23,349 on individual elements or some of the elements right instead of just grabbing 7785 02:34:23,349 --> 02:34:23,359 elements right instead of just grabbing 7786 02:34:23,359 --> 02:34:24,710 elements right instead of just grabbing individual 7787 02:34:24,710 --> 02:34:24,720 individual 7788 02:34:24,720 --> 02:34:27,510 individual one or two values from that now how do 7789 02:34:27,510 --> 02:34:27,520 one or two values from that now how do 7790 02:34:27,520 --> 02:34:28,070 one or two values from that now how do we 7791 02:34:28,070 --> 02:34:28,080 we 7792 02:34:28,080 --> 02:34:31,510 we add elements to a set 7793 02:34:31,510 --> 02:34:31,520 add elements to a set 7794 02:34:31,520 --> 02:34:34,950 add elements to a set let's see it as well we can add elements 7795 02:34:34,950 --> 02:34:34,960 let's see it as well we can add elements 7796 02:34:34,960 --> 02:34:36,309 let's see it as well we can add elements to my set 7797 02:34:36,309 --> 02:34:36,319 to my set 7798 02:34:36,319 --> 02:34:39,349 to my set using my set so the 7799 02:34:39,349 --> 02:34:39,359 using my set so the 7800 02:34:39,359 --> 02:34:42,070 using my set so the set itself the variable name and then if 7801 02:34:42,070 --> 02:34:42,080 set itself the variable name and then if 7802 02:34:42,080 --> 02:34:42,710 set itself the variable name and then if you do 7803 02:34:42,710 --> 02:34:42,720 you do 7804 02:34:42,720 --> 02:34:45,270 you do dot you see a bunch of built-in 7805 02:34:45,270 --> 02:34:45,280 dot you see a bunch of built-in 7806 02:34:45,280 --> 02:34:46,389 dot you see a bunch of built-in functions again 7807 02:34:46,389 --> 02:34:46,399 functions again 7808 02:34:46,399 --> 02:34:49,110 functions again set has its own built-in functions which 7809 02:34:49,110 --> 02:34:49,120 set has its own built-in functions which 7810 02:34:49,120 --> 02:34:51,190 set has its own built-in functions which are completely different from what 7811 02:34:51,190 --> 02:34:51,200 are completely different from what 7812 02:34:51,200 --> 02:34:54,550 are completely different from what list has and it has a function called 7813 02:34:54,550 --> 02:34:54,560 list has and it has a function called 7814 02:34:54,560 --> 02:34:58,389 list has and it has a function called ed and here we can basically add 7815 02:34:58,389 --> 02:34:58,399 ed and here we can basically add 7816 02:34:58,399 --> 02:35:01,910 ed and here we can basically add a new element again let's do april 7817 02:35:01,910 --> 02:35:01,920 a new element again let's do april 7818 02:35:01,920 --> 02:35:07,190 a new element again let's do april and now we can print my set 7819 02:35:10,550 --> 02:35:10,560 and execute and there you go so we have 7820 02:35:10,560 --> 02:35:12,469 and execute and there you go so we have here individual elements that are 7821 02:35:12,469 --> 02:35:12,479 here individual elements that are 7822 02:35:12,479 --> 02:35:13,590 here individual elements that are printed out 7823 02:35:13,590 --> 02:35:13,600 printed out 7824 02:35:13,600 --> 02:35:17,590 printed out and we have the new list after we edit 7825 02:35:17,590 --> 02:35:17,600 and we have the new list after we edit 7826 02:35:17,600 --> 02:35:20,550 and we have the new list after we edit april now one thing you probably already 7827 02:35:20,550 --> 02:35:20,560 april now one thing you probably already 7828 02:35:20,560 --> 02:35:21,670 april now one thing you probably already noticed 7829 02:35:21,670 --> 02:35:21,680 noticed 7830 02:35:21,680 --> 02:35:23,990 noticed when working with the set like printing 7831 02:35:23,990 --> 02:35:24,000 when working with the set like printing 7832 02:35:24,000 --> 02:35:25,990 when working with the set like printing its elements or 7833 02:35:25,990 --> 02:35:26,000 its elements or 7834 02:35:26,000 --> 02:35:29,349 its elements or adding a new element it doesn't work 7835 02:35:29,349 --> 02:35:29,359 adding a new element it doesn't work 7836 02:35:29,359 --> 02:35:32,230 adding a new element it doesn't work in the same sequence as with a list 7837 02:35:32,230 --> 02:35:32,240 in the same sequence as with a list 7838 02:35:32,240 --> 02:35:32,790 in the same sequence as with a list right 7839 02:35:32,790 --> 02:35:32,800 right 7840 02:35:32,800 --> 02:35:35,030 right so for list we basically had this 7841 02:35:35,030 --> 02:35:35,040 so for list we basically had this 7842 02:35:35,040 --> 02:35:37,030 so for list we basically had this january february march in this 7843 02:35:37,030 --> 02:35:37,040 january february march in this 7844 02:35:37,040 --> 02:35:39,830 january february march in this exact order and when we edit a new 7845 02:35:39,830 --> 02:35:39,840 exact order and when we edit a new 7846 02:35:39,840 --> 02:35:40,389 exact order and when we edit a new element 7847 02:35:40,389 --> 02:35:40,399 element 7848 02:35:40,399 --> 02:35:42,870 element basically it got added at the end right 7849 02:35:42,870 --> 02:35:42,880 basically it got added at the end right 7850 02:35:42,880 --> 02:35:44,389 basically it got added at the end right as a fourth element 7851 02:35:44,389 --> 02:35:44,399 as a fourth element 7852 02:35:44,399 --> 02:35:48,070 as a fourth element in set it's not ordered it's basically 7853 02:35:48,070 --> 02:35:48,080 in set it's not ordered it's basically 7854 02:35:48,080 --> 02:35:49,830 in set it's not ordered it's basically in a random order right 7855 02:35:49,830 --> 02:35:49,840 in a random order right 7856 02:35:49,840 --> 02:35:53,030 in a random order right so if i execute this again rerun 7857 02:35:53,030 --> 02:35:53,040 so if i execute this again rerun 7858 02:35:53,040 --> 02:35:56,309 so if i execute this again rerun you see the order changed here and here 7859 02:35:56,309 --> 02:35:56,319 you see the order changed here and here 7860 02:35:56,319 --> 02:35:57,349 you see the order changed here and here as well right 7861 02:35:57,349 --> 02:35:57,359 as well right 7862 02:35:57,359 --> 02:36:00,550 as well right and if i do it again there you go so 7863 02:36:00,550 --> 02:36:00,560 and if i do it again there you go so 7864 02:36:00,560 --> 02:36:03,429 and if i do it again there you go so this order and this order basically 7865 02:36:03,429 --> 02:36:03,439 this order and this order basically 7866 02:36:03,439 --> 02:36:04,790 this order and this order basically changes right 7867 02:36:04,790 --> 02:36:04,800 changes right 7868 02:36:04,800 --> 02:36:07,990 changes right so as you see working with sets 7869 02:36:07,990 --> 02:36:08,000 so as you see working with sets 7870 02:36:08,000 --> 02:36:09,830 so as you see working with sets is actually pretty different from 7871 02:36:09,830 --> 02:36:09,840 is actually pretty different from 7872 02:36:09,840 --> 02:36:11,349 is actually pretty different from working with lists 7873 02:36:11,349 --> 02:36:11,359 working with lists 7874 02:36:11,359 --> 02:36:14,870 working with lists so this means that set 7875 02:36:14,870 --> 02:36:14,880 so this means that set 7876 02:36:14,880 --> 02:36:17,349 so this means that set not having or not allowing duplicate 7877 02:36:17,349 --> 02:36:17,359 not having or not allowing duplicate 7878 02:36:17,359 --> 02:36:18,150 not having or not allowing duplicate values is 7879 02:36:18,150 --> 02:36:18,160 values is 7880 02:36:18,160 --> 02:36:20,710 values is basically just one of the differences 7881 02:36:20,710 --> 02:36:20,720 basically just one of the differences 7882 02:36:20,720 --> 02:36:21,510 basically just one of the differences between 7883 02:36:21,510 --> 02:36:21,520 between 7884 02:36:21,520 --> 02:36:24,630 between sets and lists and 7885 02:36:24,630 --> 02:36:24,640 sets and lists and 7886 02:36:24,640 --> 02:36:26,630 sets and lists and of course you're probably wondering i 7887 02:36:26,630 --> 02:36:26,640 of course you're probably wondering i 7888 02:36:26,640 --> 02:36:28,950 of course you're probably wondering i can add elements i can access elements 7889 02:36:28,950 --> 02:36:28,960 can add elements i can access elements 7890 02:36:28,960 --> 02:36:31,910 can add elements i can access elements what about removing elements right from 7891 02:36:31,910 --> 02:36:31,920 what about removing elements right from 7892 02:36:31,920 --> 02:36:32,950 what about removing elements right from lists or 7893 02:36:32,950 --> 02:36:32,960 lists or 7894 02:36:32,960 --> 02:36:36,150 lists or sets and you can do that actually 7895 02:36:36,150 --> 02:36:36,160 sets and you can do that actually 7896 02:36:36,160 --> 02:36:39,190 sets and you can do that actually the same way for both sets and 7897 02:36:39,190 --> 02:36:39,200 the same way for both sets and 7898 02:36:39,200 --> 02:36:41,349 the same way for both sets and lists so for example if we want to 7899 02:36:41,349 --> 02:36:41,359 lists so for example if we want to 7900 02:36:41,359 --> 02:36:43,750 lists so for example if we want to remove an element from a set 7901 02:36:43,750 --> 02:36:43,760 remove an element from a set 7902 02:36:43,760 --> 02:36:45,910 remove an element from a set we can execute a built-in function 7903 02:36:45,910 --> 02:36:45,920 we can execute a built-in function 7904 02:36:45,920 --> 02:36:47,510 we can execute a built-in function called remove 7905 02:36:47,510 --> 02:36:47,520 called remove 7906 02:36:47,520 --> 02:36:49,750 called remove and remove basically takes a parameter 7907 02:36:49,750 --> 02:36:49,760 and remove basically takes a parameter 7908 02:36:49,760 --> 02:36:51,910 and remove basically takes a parameter which is the value itself 7909 02:36:51,910 --> 02:36:51,920 which is the value itself 7910 02:36:51,920 --> 02:36:53,349 which is the value itself so let's say if we want to remove 7911 02:36:53,349 --> 02:36:53,359 so let's say if we want to remove 7912 02:36:53,359 --> 02:36:55,349 so let's say if we want to remove january from here 7913 02:36:55,349 --> 02:36:55,359 january from here 7914 02:36:55,359 --> 02:36:57,510 january from here then we're going to pass the value to 7915 02:36:57,510 --> 02:36:57,520 then we're going to pass the value to 7916 02:36:57,520 --> 02:36:59,190 then we're going to pass the value to remove function 7917 02:36:59,190 --> 02:36:59,200 remove function 7918 02:36:59,200 --> 02:37:03,270 remove function and now if i print my set again 7919 02:37:03,270 --> 02:37:03,280 and now if i print my set again 7920 02:37:03,280 --> 02:37:06,230 and now if i print my set again after the remove gets executed and let's 7921 02:37:06,230 --> 02:37:06,240 after the remove gets executed and let's 7922 02:37:06,240 --> 02:37:07,349 after the remove gets executed and let's run it 7923 02:37:07,349 --> 02:37:07,359 run it 7924 02:37:07,359 --> 02:37:09,110 run it and here you see the last print 7925 02:37:09,110 --> 02:37:09,120 and here you see the last print 7926 02:37:09,120 --> 02:37:11,590 and here you see the last print basically doesn't have january 7927 02:37:11,590 --> 02:37:11,600 basically doesn't have january 7928 02:37:11,600 --> 02:37:14,710 basically doesn't have january inside and as i said it works the same 7929 02:37:14,710 --> 02:37:14,720 inside and as i said it works the same 7930 02:37:14,720 --> 02:37:18,070 inside and as i said it works the same for lists so let me demonstrate 7931 02:37:18,070 --> 02:37:18,080 for lists so let me demonstrate 7932 02:37:18,080 --> 02:37:21,429 for lists so let me demonstrate this as well so on my list which has its 7933 02:37:21,429 --> 02:37:21,439 this as well so on my list which has its 7934 02:37:21,439 --> 02:37:22,230 this as well so on my list which has its own 7935 02:37:22,230 --> 02:37:22,240 own 7936 02:37:22,240 --> 02:37:25,190 own set of built-in functions one of them is 7937 02:37:25,190 --> 02:37:25,200 set of built-in functions one of them is 7938 02:37:25,200 --> 02:37:26,070 set of built-in functions one of them is remove 7939 02:37:26,070 --> 02:37:26,080 remove 7940 02:37:26,080 --> 02:37:28,389 remove which in this case is called the same 7941 02:37:28,389 --> 02:37:28,399 which in this case is called the same 7942 02:37:28,399 --> 02:37:30,070 which in this case is called the same for both set and list 7943 02:37:30,070 --> 02:37:30,080 for both set and list 7944 02:37:30,080 --> 02:37:32,870 for both set and list and this remove built-in function also 7945 02:37:32,870 --> 02:37:32,880 and this remove built-in function also 7946 02:37:32,880 --> 02:37:33,830 and this remove built-in function also accepts 7947 02:37:33,830 --> 02:37:33,840 accepts 7948 02:37:33,840 --> 02:37:36,150 accepts the value of the element you want to 7949 02:37:36,150 --> 02:37:36,160 the value of the element you want to 7950 02:37:36,160 --> 02:37:36,950 the value of the element you want to remove 7951 02:37:36,950 --> 02:37:36,960 remove 7952 02:37:36,960 --> 02:37:42,389 remove and let's print it again my list 7953 02:37:42,389 --> 02:37:42,399 and let's print it again my list 7954 02:37:42,399 --> 02:37:46,230 and let's print it again my list and execute there you go this is a set 7955 02:37:46,230 --> 02:37:46,240 and execute there you go this is a set 7956 02:37:46,240 --> 02:37:48,309 and execute there you go this is a set with the syntax with curly braces and 7957 02:37:48,309 --> 02:37:48,319 with the syntax with curly braces and 7958 02:37:48,319 --> 02:37:49,750 with the syntax with curly braces and this is a list 7959 02:37:49,750 --> 02:37:49,760 this is a list 7960 02:37:49,760 --> 02:37:51,910 this is a list which now doesn't have january inside 7961 02:37:51,910 --> 02:37:51,920 which now doesn't have january inside 7962 02:37:51,920 --> 02:37:53,830 which now doesn't have january inside because we removed it 7963 02:37:53,830 --> 02:37:53,840 because we removed it 7964 02:37:53,840 --> 02:37:56,389 because we removed it and as you know lists can have duplicate 7965 02:37:56,389 --> 02:37:56,399 and as you know lists can have duplicate 7966 02:37:56,399 --> 02:37:57,110 and as you know lists can have duplicate values 7967 02:37:57,110 --> 02:37:57,120 values 7968 02:37:57,120 --> 02:38:00,150 values so if we have january 7969 02:38:00,150 --> 02:38:00,160 so if we have january 7970 02:38:00,160 --> 02:38:03,910 so if we have january again here so two times and 7971 02:38:03,910 --> 02:38:03,920 again here so two times and 7972 02:38:03,920 --> 02:38:06,710 again here so two times and we do remove january it will actually 7973 02:38:06,710 --> 02:38:06,720 we do remove january it will actually 7974 02:38:06,720 --> 02:38:07,349 we do remove january it will actually remove 7975 02:38:07,349 --> 02:38:07,359 remove 7976 02:38:07,359 --> 02:38:10,550 remove the first occurrence of that value so if 7977 02:38:10,550 --> 02:38:10,560 the first occurrence of that value so if 7978 02:38:10,560 --> 02:38:11,990 the first occurrence of that value so if i execute this 7979 02:38:11,990 --> 02:38:12,000 i execute this 7980 02:38:12,000 --> 02:38:15,590 i execute this you see the first one got removed and 7981 02:38:15,590 --> 02:38:15,600 you see the first one got removed and 7982 02:38:15,600 --> 02:38:18,309 you see the first one got removed and the last one or the second january value 7983 02:38:18,309 --> 02:38:18,319 the last one or the second january value 7984 02:38:18,319 --> 02:38:18,950 the last one or the second january value is 7985 02:38:18,950 --> 02:38:18,960 is 7986 02:38:18,960 --> 02:38:22,550 is still there so that's how you work 7987 02:38:22,550 --> 02:38:22,560 still there so that's how you work 7988 02:38:22,560 --> 02:38:25,750 still there so that's how you work with sets basically and also how to 7989 02:38:25,750 --> 02:38:25,760 with sets basically and also how to 7990 02:38:25,760 --> 02:38:26,309 with sets basically and also how to remove 7991 02:38:26,309 --> 02:38:26,319 remove 7992 02:38:26,319 --> 02:38:33,429 remove elements from sets and lists 7993 02:38:36,630 --> 02:38:36,640 so at this point i want to take time and 7994 02:38:36,640 --> 02:38:39,510 so at this point i want to take time and review the functions that we have used 7995 02:38:39,510 --> 02:38:39,520 review the functions that we have used 7996 02:38:39,520 --> 02:38:40,070 review the functions that we have used from 7997 02:38:40,070 --> 02:38:40,080 from 7998 02:38:40,080 --> 02:38:42,870 from python itself so the functions that we 7999 02:38:42,870 --> 02:38:42,880 python itself so the functions that we 8000 02:38:42,880 --> 02:38:44,389 python itself so the functions that we ourselves didn't actually 8001 02:38:44,389 --> 02:38:44,399 ourselves didn't actually 8002 02:38:44,399 --> 02:38:47,030 ourselves didn't actually write and the functions that python 8003 02:38:47,030 --> 02:38:47,040 write and the functions that python 8004 02:38:47,040 --> 02:38:48,070 write and the functions that python basically makes 8005 02:38:48,070 --> 02:38:48,080 basically makes 8006 02:38:48,080 --> 02:38:51,030 basically makes available for us to use are called 8007 02:38:51,030 --> 02:38:51,040 available for us to use are called 8008 02:38:51,040 --> 02:38:52,469 available for us to use are called built-in functions 8009 02:38:52,469 --> 02:38:52,479 built-in functions 8010 02:38:52,479 --> 02:38:55,510 built-in functions so till now we have used function 8011 02:38:55,510 --> 02:38:55,520 so till now we have used function 8012 02:38:55,520 --> 02:38:58,790 so till now we have used function print which basically just takes 8013 02:38:58,790 --> 02:38:58,800 print which basically just takes 8014 02:38:58,800 --> 02:39:01,190 print which basically just takes some input this could be a string this 8015 02:39:01,190 --> 02:39:01,200 some input this could be a string this 8016 02:39:01,200 --> 02:39:02,309 some input this could be a string this could be a variable 8017 02:39:02,309 --> 02:39:02,319 could be a variable 8018 02:39:02,319 --> 02:39:04,070 could be a variable this could be a number doesn't really 8019 02:39:04,070 --> 02:39:04,080 this could be a number doesn't really 8020 02:39:04,080 --> 02:39:05,429 this could be a number doesn't really matter and 8021 02:39:05,429 --> 02:39:05,439 matter and 8022 02:39:05,439 --> 02:39:08,469 matter and basically just prints it in the output 8023 02:39:08,469 --> 02:39:08,479 basically just prints it in the output 8024 02:39:08,479 --> 02:39:09,429 basically just prints it in the output console right 8025 02:39:09,429 --> 02:39:09,439 console right 8026 02:39:09,439 --> 02:39:13,110 console right in the terminal we also saw input 8027 02:39:13,110 --> 02:39:13,120 in the terminal we also saw input 8028 02:39:13,120 --> 02:39:16,950 in the terminal we also saw input function that basically takes user input 8029 02:39:16,950 --> 02:39:16,960 function that basically takes user input 8030 02:39:16,960 --> 02:39:19,110 function that basically takes user input again we can provide a parameter which 8031 02:39:19,110 --> 02:39:19,120 again we can provide a parameter which 8032 02:39:19,120 --> 02:39:20,469 again we can provide a parameter which will be a message 8033 02:39:20,469 --> 02:39:20,479 will be a message 8034 02:39:20,479 --> 02:39:23,750 will be a message or leave it empty we also in the 8035 02:39:23,750 --> 02:39:23,760 or leave it empty we also in the 8036 02:39:23,760 --> 02:39:27,590 or leave it empty we also in the last example so an example of set 8037 02:39:27,590 --> 02:39:27,600 last example so an example of set 8038 02:39:27,600 --> 02:39:31,270 last example so an example of set function which basically takes a list 8039 02:39:31,270 --> 02:39:31,280 function which basically takes a list 8040 02:39:31,280 --> 02:39:34,230 function which basically takes a list and converts it into a set and another 8041 02:39:34,230 --> 02:39:34,240 and converts it into a set and another 8042 02:39:34,240 --> 02:39:34,950 and converts it into a set and another example 8043 02:39:34,950 --> 02:39:34,960 example 8044 02:39:34,960 --> 02:39:38,309 example is int again takes 8045 02:39:38,309 --> 02:39:38,319 is int again takes 8046 02:39:38,319 --> 02:39:40,870 is int again takes a string as a parameter and converts it 8047 02:39:40,870 --> 02:39:40,880 a string as a parameter and converts it 8048 02:39:40,880 --> 02:39:41,910 a string as a parameter and converts it into integer 8049 02:39:41,910 --> 02:39:41,920 into integer 8050 02:39:41,920 --> 02:39:44,309 into integer and all of these are built-in functions 8051 02:39:44,309 --> 02:39:44,319 and all of these are built-in functions 8052 02:39:44,319 --> 02:39:46,870 and all of these are built-in functions because python provides them to us 8053 02:39:46,870 --> 02:39:46,880 because python provides them to us 8054 02:39:46,880 --> 02:39:49,590 because python provides them to us so that we can use it in our code and in 8055 02:39:49,590 --> 02:39:49,600 so that we can use it in our code and in 8056 02:39:49,600 --> 02:39:50,309 so that we can use it in our code and in python 8057 02:39:50,309 --> 02:39:50,319 python 8058 02:39:50,319 --> 02:39:53,270 python there are a lot of very useful built-in 8059 02:39:53,270 --> 02:39:53,280 there are a lot of very useful built-in 8060 02:39:53,280 --> 02:39:55,670 there are a lot of very useful built-in functions for different purposes 8061 02:39:55,670 --> 02:39:55,680 functions for different purposes 8062 02:39:55,680 --> 02:39:57,190 functions for different purposes and as i mentioned most of these 8063 02:39:57,190 --> 02:39:57,200 and as i mentioned most of these 8064 02:39:57,200 --> 02:39:59,349 and as i mentioned most of these functions basically accept 8065 02:39:59,349 --> 02:39:59,359 functions basically accept 8066 02:39:59,359 --> 02:40:02,070 functions basically accept a parameter and then do something with 8067 02:40:02,070 --> 02:40:02,080 a parameter and then do something with 8068 02:40:02,080 --> 02:40:03,110 a parameter and then do something with that parameter 8069 02:40:03,110 --> 02:40:03,120 that parameter 8070 02:40:03,120 --> 02:40:05,510 that parameter that input that we provide that function 8071 02:40:05,510 --> 02:40:05,520 that input that we provide that function 8072 02:40:05,520 --> 02:40:06,469 that input that we provide that function and give us an 8073 02:40:06,469 --> 02:40:06,479 and give us an 8074 02:40:06,479 --> 02:40:09,990 and give us an output again print basically 8075 02:40:09,990 --> 02:40:10,000 output again print basically 8076 02:40:10,000 --> 02:40:13,510 output again print basically provides something here and gives us the 8077 02:40:13,510 --> 02:40:13,520 provides something here and gives us the 8078 02:40:13,520 --> 02:40:14,070 provides something here and gives us the output 8079 02:40:14,070 --> 02:40:14,080 output 8080 02:40:14,080 --> 02:40:17,750 output in the output window here 8081 02:40:17,750 --> 02:40:17,760 in the output window here 8082 02:40:17,760 --> 02:40:23,510 in the output window here in input we can provide some message 8083 02:40:26,150 --> 02:40:26,160 that will again print an input here and 8084 02:40:26,160 --> 02:40:27,030 that will again print an input here and the rest of them 8085 02:40:27,030 --> 02:40:27,040 the rest of them 8086 02:40:27,040 --> 02:40:30,309 the rest of them are giving value inside the code 8087 02:40:30,309 --> 02:40:30,319 are giving value inside the code 8088 02:40:30,319 --> 02:40:33,269 are giving value inside the code without displaying anything so in set we 8089 02:40:33,269 --> 02:40:33,279 without displaying anything so in set we 8090 02:40:33,279 --> 02:40:34,150 without displaying anything so in set we can 8091 02:40:34,150 --> 02:40:34,160 can 8092 02:40:34,160 --> 02:40:37,269 can provide a list 8093 02:40:40,469 --> 02:40:40,479 and the same way a parameter here which 8094 02:40:40,479 --> 02:40:42,309 and the same way a parameter here which is logical because the purpose of a 8095 02:40:42,309 --> 02:40:42,319 is logical because the purpose of a 8096 02:40:42,319 --> 02:40:43,190 is logical because the purpose of a function 8097 02:40:43,190 --> 02:40:43,200 function 8098 02:40:43,200 --> 02:40:46,870 function usually is to take some input like 8099 02:40:46,870 --> 02:40:46,880 usually is to take some input like 8100 02:40:46,880 --> 02:40:49,349 usually is to take some input like this as a parameter do something with 8101 02:40:49,349 --> 02:40:49,359 this as a parameter do something with 8102 02:40:49,359 --> 02:40:50,150 this as a parameter do something with that input 8103 02:40:50,150 --> 02:40:50,160 that input 8104 02:40:50,160 --> 02:40:52,150 that input and give us an output from that 8105 02:40:52,150 --> 02:40:52,160 and give us an output from that 8106 02:40:52,160 --> 02:40:54,550 and give us an output from that parameter and we have created our own 8107 02:40:54,550 --> 02:40:54,560 parameter and we have created our own 8108 02:40:54,560 --> 02:40:55,670 parameter and we have created our own functions 8109 02:40:55,670 --> 02:40:55,680 functions 8110 02:40:55,680 --> 02:40:59,269 functions that also take some input and 8111 02:40:59,269 --> 02:40:59,279 that also take some input and 8112 02:40:59,279 --> 02:41:02,469 that also take some input and give back some output like this and 8113 02:41:02,469 --> 02:41:02,479 give back some output like this and 8114 02:41:02,479 --> 02:41:05,429 give back some output like this and in addition to built-in functions that 8115 02:41:05,429 --> 02:41:05,439 in addition to built-in functions that 8116 02:41:05,439 --> 02:41:07,110 in addition to built-in functions that are called like this 8117 02:41:07,110 --> 02:41:07,120 are called like this 8118 02:41:07,120 --> 02:41:10,230 are called like this and our own functions we have also used 8119 02:41:10,230 --> 02:41:10,240 and our own functions we have also used 8120 02:41:10,240 --> 02:41:13,269 and our own functions we have also used third type of functions which is called 8121 02:41:13,269 --> 02:41:13,279 third type of functions which is called 8122 02:41:13,279 --> 02:41:16,469 third type of functions which is called directly on a value right and this is an 8123 02:41:16,469 --> 02:41:16,479 directly on a value right and this is an 8124 02:41:16,479 --> 02:41:17,750 directly on a value right and this is an example of that 8125 02:41:17,750 --> 02:41:17,760 example of that 8126 02:41:17,760 --> 02:41:20,870 example of that so basically directly on a value this 8127 02:41:20,870 --> 02:41:20,880 so basically directly on a value this 8128 02:41:20,880 --> 02:41:22,150 so basically directly on a value this could be a variable but 8129 02:41:22,150 --> 02:41:22,160 could be a variable but 8130 02:41:22,160 --> 02:41:24,630 could be a variable but also the string representation of that 8131 02:41:24,630 --> 02:41:24,640 also the string representation of that 8132 02:41:24,640 --> 02:41:25,429 also the string representation of that itself 8133 02:41:25,429 --> 02:41:25,439 itself 8134 02:41:25,439 --> 02:41:27,830 itself so if i had a string like that so 8135 02:41:27,830 --> 02:41:27,840 so if i had a string like that so 8136 02:41:27,840 --> 02:41:31,030 so if i had a string like that so basically directly on that value 8137 02:41:31,030 --> 02:41:31,040 basically directly on that value 8138 02:41:31,040 --> 02:41:34,389 basically directly on that value call a function like this and these are 8139 02:41:34,389 --> 02:41:34,399 call a function like this and these are 8140 02:41:34,399 --> 02:41:36,389 call a function like this and these are also built-in functions because 8141 02:41:36,389 --> 02:41:36,399 also built-in functions because 8142 02:41:36,399 --> 02:41:39,429 also built-in functions because python makes them available to us other 8143 02:41:39,429 --> 02:41:39,439 python makes them available to us other 8144 02:41:39,439 --> 02:41:40,950 python makes them available to us other than the syntax 8145 02:41:40,950 --> 02:41:40,960 than the syntax 8146 02:41:40,960 --> 02:41:43,670 than the syntax there is one major difference between 8147 02:41:43,670 --> 02:41:43,680 there is one major difference between 8148 02:41:43,680 --> 02:41:43,990 there is one major difference between these 8149 02:41:43,990 --> 02:41:44,000 these 8150 02:41:44,000 --> 02:41:46,309 these type of functions that are called 8151 02:41:46,309 --> 02:41:46,319 type of functions that are called 8152 02:41:46,319 --> 02:41:47,510 type of functions that are called directly like that 8153 02:41:47,510 --> 02:41:47,520 directly like that 8154 02:41:47,520 --> 02:41:49,590 directly like that and the functions that are called on the 8155 02:41:49,590 --> 02:41:49,600 and the functions that are called on the 8156 02:41:49,600 --> 02:41:51,030 and the functions that are called on the value itself 8157 02:41:51,030 --> 02:41:51,040 value itself 8158 02:41:51,040 --> 02:41:53,830 value itself and the main difference is that each 8159 02:41:53,830 --> 02:41:53,840 and the main difference is that each 8160 02:41:53,840 --> 02:41:55,429 and the main difference is that each data type 8161 02:41:55,429 --> 02:41:55,439 data type 8162 02:41:55,439 --> 02:41:58,710 data type has its own set of functions 8163 02:41:58,710 --> 02:41:58,720 has its own set of functions 8164 02:41:58,720 --> 02:42:02,150 has its own set of functions that can be executed like this so 8165 02:42:02,150 --> 02:42:02,160 that can be executed like this so 8166 02:42:02,160 --> 02:42:06,870 that can be executed like this so again let's take example of a string 8167 02:42:06,870 --> 02:42:06,880 again let's take example of a string 8168 02:42:06,880 --> 02:42:10,469 again let's take example of a string and if i do dot here you see 8169 02:42:10,469 --> 02:42:10,479 and if i do dot here you see 8170 02:42:10,479 --> 02:42:13,990 and if i do dot here you see the ide pycharm basically gives me 8171 02:42:13,990 --> 02:42:14,000 the ide pycharm basically gives me 8172 02:42:14,000 --> 02:42:17,190 the ide pycharm basically gives me a list of all the functions 8173 02:42:17,190 --> 02:42:17,200 a list of all the functions 8174 02:42:17,200 --> 02:42:19,750 a list of all the functions again built-in functions in python but 8175 02:42:19,750 --> 02:42:19,760 again built-in functions in python but 8176 02:42:19,760 --> 02:42:21,269 again built-in functions in python but functions that i can execute 8177 02:42:21,269 --> 02:42:21,279 functions that i can execute 8178 02:42:21,279 --> 02:42:24,389 functions that i can execute on a string value and 8179 02:42:24,389 --> 02:42:24,399 on a string value and 8180 02:42:24,399 --> 02:42:27,750 on a string value and again you see split is digit this is the 8181 02:42:27,750 --> 02:42:27,760 again you see split is digit this is the 8182 02:42:27,760 --> 02:42:28,630 again you see split is digit this is the one that we used 8183 02:42:28,630 --> 02:42:28,640 one that we used 8184 02:42:28,640 --> 02:42:30,950 one that we used in one of our previous examples that 8185 02:42:30,950 --> 02:42:30,960 in one of our previous examples that 8186 02:42:30,960 --> 02:42:33,349 in one of our previous examples that basically checks if that string 8187 02:42:33,349 --> 02:42:33,359 basically checks if that string 8188 02:42:33,359 --> 02:42:35,670 basically checks if that string is a representation of a digit or just a 8189 02:42:35,670 --> 02:42:35,680 is a representation of a digit or just a 8190 02:42:35,680 --> 02:42:36,870 is a representation of a digit or just a regular string 8191 02:42:36,870 --> 02:42:36,880 regular string 8192 02:42:36,880 --> 02:42:41,349 regular string and as you see lots of different 8193 02:42:41,349 --> 02:42:41,359 and as you see lots of different 8194 02:42:41,359 --> 02:42:44,309 and as you see lots of different functions so all of these are provided 8195 02:42:44,309 --> 02:42:44,319 functions so all of these are provided 8196 02:42:44,319 --> 02:42:45,349 functions so all of these are provided by python 8197 02:42:45,349 --> 02:42:45,359 by python 8198 02:42:45,359 --> 02:42:48,870 by python to do different stuff like turn the 8199 02:42:48,870 --> 02:42:48,880 to do different stuff like turn the 8200 02:42:48,880 --> 02:42:52,389 to do different stuff like turn the string literal to uppercase or 8201 02:42:52,389 --> 02:42:52,399 string literal to uppercase or 8202 02:42:52,399 --> 02:42:55,190 string literal to uppercase or replace a letter for example in that 8203 02:42:55,190 --> 02:42:55,200 replace a letter for example in that 8204 02:42:55,200 --> 02:42:56,230 replace a letter for example in that string 8205 02:42:56,230 --> 02:42:56,240 string 8206 02:42:56,240 --> 02:42:58,150 string and so on but the main point here is 8207 02:42:58,150 --> 02:42:58,160 and so on but the main point here is 8208 02:42:58,160 --> 02:43:00,469 and so on but the main point here is that those functions 8209 02:43:00,469 --> 02:43:00,479 that those functions 8210 02:43:00,479 --> 02:43:03,830 that those functions are only for string but as i said 8211 02:43:03,830 --> 02:43:03,840 are only for string but as i said 8212 02:43:03,840 --> 02:43:06,150 are only for string but as i said each data type has its own list of 8213 02:43:06,150 --> 02:43:06,160 each data type has its own list of 8214 02:43:06,160 --> 02:43:07,030 each data type has its own list of functions 8215 02:43:07,030 --> 02:43:07,040 functions 8216 02:43:07,040 --> 02:43:10,630 functions that can be called on that data type so 8217 02:43:10,630 --> 02:43:10,640 that can be called on that data type so 8218 02:43:10,640 --> 02:43:15,269 that can be called on that data type so for a demonstration let's take a list 8219 02:43:18,710 --> 02:43:18,720 and if i do dot here 8220 02:43:18,720 --> 02:43:21,990 and if i do dot here again you see a list of functions that i 8221 02:43:21,990 --> 02:43:22,000 again you see a list of functions that i 8222 02:43:22,000 --> 02:43:23,590 again you see a list of functions that i can execute specifically 8223 02:43:23,590 --> 02:43:23,600 can execute specifically 8224 02:43:23,600 --> 02:43:26,790 can execute specifically on list values and there are lots of 8225 02:43:26,790 --> 02:43:26,800 on list values and there are lots of 8226 02:43:26,800 --> 02:43:28,710 on list values and there are lots of things that you can do with lists like 8227 02:43:28,710 --> 02:43:28,720 things that you can do with lists like 8228 02:43:28,720 --> 02:43:31,349 things that you can do with lists like add elements to it remove elements from 8229 02:43:31,349 --> 02:43:31,359 add elements to it remove elements from 8230 02:43:31,359 --> 02:43:32,070 add elements to it remove elements from it 8231 02:43:32,070 --> 02:43:32,080 it 8232 02:43:32,080 --> 02:43:35,110 it sort the list copy and so on 8233 02:43:35,110 --> 02:43:35,120 sort the list copy and so on 8234 02:43:35,120 --> 02:43:37,429 sort the list copy and so on so that's basically a major difference 8235 02:43:37,429 --> 02:43:37,439 so that's basically a major difference 8236 02:43:37,439 --> 02:43:38,230 so that's basically a major difference between 8237 02:43:38,230 --> 02:43:38,240 between 8238 02:43:38,240 --> 02:43:40,710 between these type of functions and functions 8239 02:43:40,710 --> 02:43:40,720 these type of functions and functions 8240 02:43:40,720 --> 02:43:42,630 these type of functions and functions that can be executed on 8241 02:43:42,630 --> 02:43:42,640 that can be executed on 8242 02:43:42,640 --> 02:43:45,429 that can be executed on specific data type values but the 8243 02:43:45,429 --> 02:43:45,439 specific data type values but the 8244 02:43:45,439 --> 02:43:47,349 specific data type values but the concept is the same here 8245 02:43:47,349 --> 02:43:47,359 concept is the same here 8246 02:43:47,359 --> 02:43:49,349 concept is the same here you also have a function that gets a 8247 02:43:49,349 --> 02:43:49,359 you also have a function that gets a 8248 02:43:49,359 --> 02:43:51,190 you also have a function that gets a parameter an input 8249 02:43:51,190 --> 02:43:51,200 parameter an input 8250 02:43:51,200 --> 02:43:53,429 parameter an input and gives you an output and the 8251 02:43:53,429 --> 02:43:53,439 and gives you an output and the 8252 02:43:53,439 --> 02:43:55,990 and gives you an output and the parameter for this type of functions 8253 02:43:55,990 --> 02:43:56,000 parameter for this type of functions 8254 02:43:56,000 --> 02:43:57,910 parameter for this type of functions is actually the value that we are 8255 02:43:57,910 --> 02:43:57,920 is actually the value that we are 8256 02:43:57,920 --> 02:43:59,349 is actually the value that we are calling that function 8257 02:43:59,349 --> 02:43:59,359 calling that function 8258 02:43:59,359 --> 02:44:02,710 calling that function on so this string here 2 3 8259 02:44:02,710 --> 02:44:02,720 on so this string here 2 3 8260 02:44:02,720 --> 02:44:05,670 on so this string here 2 3 is going to be parameter of the split 8261 02:44:05,670 --> 02:44:05,680 is going to be parameter of the split 8262 02:44:05,680 --> 02:44:07,349 is going to be parameter of the split and in addition to that we can also 8263 02:44:07,349 --> 02:44:07,359 and in addition to that we can also 8264 02:44:07,359 --> 02:44:07,910 and in addition to that we can also provide 8265 02:44:07,910 --> 02:44:07,920 provide 8266 02:44:07,920 --> 02:44:10,070 provide additional parameters for example for 8267 02:44:10,070 --> 02:44:10,080 additional parameters for example for 8268 02:44:10,080 --> 02:44:12,469 additional parameters for example for split you saw here that we were able to 8269 02:44:12,469 --> 02:44:12,479 split you saw here that we were able to 8270 02:44:12,479 --> 02:44:13,269 split you saw here that we were able to add 8271 02:44:13,269 --> 02:44:13,279 add 8272 02:44:13,279 --> 02:44:16,389 add a comma space to basically tell 8273 02:44:16,389 --> 02:44:16,399 a comma space to basically tell 8274 02:44:16,399 --> 02:44:19,269 a comma space to basically tell the split function on which character to 8275 02:44:19,269 --> 02:44:19,279 the split function on which character to 8276 02:44:19,279 --> 02:44:20,790 the split function on which character to split that text 8277 02:44:20,790 --> 02:44:20,800 split that text 8278 02:44:20,800 --> 02:44:23,750 split that text so that was function comparisons in a 8279 02:44:23,750 --> 02:44:23,760 so that was function comparisons in a 8280 02:44:23,760 --> 02:44:27,670 so that was function comparisons in a nutshell 8281 02:44:29,990 --> 02:44:30,000 in this part we're going to learn a new 8282 02:44:30,000 --> 02:44:31,590 in this part we're going to learn a new data type in python 8283 02:44:31,590 --> 02:44:31,600 data type in python 8284 02:44:31,600 --> 02:44:34,389 data type in python called a dictionary and we're going to 8285 02:44:34,389 --> 02:44:34,399 called a dictionary and we're going to 8286 02:44:34,399 --> 02:44:37,190 called a dictionary and we're going to do that by modifying our application 8287 02:44:37,190 --> 02:44:37,200 do that by modifying our application 8288 02:44:37,200 --> 02:44:39,910 do that by modifying our application and modifying how users can actually 8289 02:44:39,910 --> 02:44:39,920 and modifying how users can actually 8290 02:44:39,920 --> 02:44:40,790 and modifying how users can actually input 8291 02:44:40,790 --> 02:44:40,800 input 8292 02:44:40,800 --> 02:44:44,309 input the values now our program currently 8293 02:44:44,309 --> 02:44:44,319 the values now our program currently 8294 02:44:44,319 --> 02:44:46,389 the values now our program currently takes the number of days and turns it 8295 02:44:46,389 --> 02:44:46,399 takes the number of days and turns it 8296 02:44:46,399 --> 02:44:47,830 takes the number of days and turns it into a number of hours 8297 02:44:47,830 --> 02:44:47,840 into a number of hours 8298 02:44:47,840 --> 02:44:49,670 into a number of hours what if we wanted to make our program a 8299 02:44:49,670 --> 02:44:49,680 what if we wanted to make our program a 8300 02:44:49,680 --> 02:44:51,510 what if we wanted to make our program a little bit more advanced 8301 02:44:51,510 --> 02:44:51,520 little bit more advanced 8302 02:44:51,520 --> 02:44:54,309 little bit more advanced a little fancier and basically allow 8303 02:44:54,309 --> 02:44:54,319 a little fancier and basically allow 8304 02:44:54,319 --> 02:44:56,309 a little fancier and basically allow users to also decide 8305 02:44:56,309 --> 02:44:56,319 users to also decide 8306 02:44:56,319 --> 02:44:58,790 users to also decide what units it should be converted to so 8307 02:44:58,790 --> 02:44:58,800 what units it should be converted to so 8308 02:44:58,800 --> 02:45:01,030 what units it should be converted to so user gives us the number of days 8309 02:45:01,030 --> 02:45:01,040 user gives us the number of days 8310 02:45:01,040 --> 02:45:03,349 user gives us the number of days and tells us whether to convert it into 8311 02:45:03,349 --> 02:45:03,359 and tells us whether to convert it into 8312 02:45:03,359 --> 02:45:04,230 and tells us whether to convert it into hours 8313 02:45:04,230 --> 02:45:04,240 hours 8314 02:45:04,240 --> 02:45:08,550 hours or minutes so instead of the whole list 8315 02:45:08,550 --> 02:45:08,560 or minutes so instead of the whole list 8316 02:45:08,560 --> 02:45:10,469 or minutes so instead of the whole list now we're going to get just number of 8317 02:45:10,469 --> 02:45:10,479 now we're going to get just number of 8318 02:45:10,479 --> 02:45:11,670 now we're going to get just number of days and 8319 02:45:11,670 --> 02:45:11,680 days and 8320 02:45:11,680 --> 02:45:14,150 days and the conversion units and this change may 8321 02:45:14,150 --> 02:45:14,160 the conversion units and this change may 8322 02:45:14,160 --> 02:45:15,990 the conversion units and this change may be a little bit complex 8323 02:45:15,990 --> 02:45:16,000 be a little bit complex 8324 02:45:16,000 --> 02:45:18,070 be a little bit complex in terms of syntax so i will try to 8325 02:45:18,070 --> 02:45:18,080 in terms of syntax so i will try to 8326 02:45:18,080 --> 02:45:19,990 in terms of syntax so i will try to explain everything step by step 8327 02:45:19,990 --> 02:45:20,000 explain everything step by step 8328 02:45:20,000 --> 02:45:22,150 explain everything step by step so the first thing we need to do is 8329 02:45:22,150 --> 02:45:22,160 so the first thing we need to do is 8330 02:45:22,160 --> 02:45:23,110 so the first thing we need to do is adjust 8331 02:45:23,110 --> 02:45:23,120 adjust 8332 02:45:23,120 --> 02:45:26,150 adjust how we get input from the user so now we 8333 02:45:26,150 --> 02:45:26,160 how we get input from the user so now we 8334 02:45:26,160 --> 02:45:27,510 how we get input from the user so now we want the user to 8335 02:45:27,510 --> 02:45:27,520 want the user to 8336 02:45:27,520 --> 02:45:30,550 want the user to be able to give us the number of days 8337 02:45:30,550 --> 02:45:30,560 be able to give us the number of days 8338 02:45:30,560 --> 02:45:33,590 be able to give us the number of days and units in one input so 8339 02:45:33,590 --> 02:45:33,600 and units in one input so 8340 02:45:33,600 --> 02:45:34,950 and units in one input so first of all i'm going to adjust the 8341 02:45:34,950 --> 02:45:34,960 first of all i'm going to adjust the 8342 02:45:34,960 --> 02:45:37,030 first of all i'm going to adjust the text here 8343 02:45:37,030 --> 02:45:37,040 text here 8344 02:45:37,040 --> 02:45:41,990 text here enter a number of days 8345 02:45:41,990 --> 02:45:42,000 enter a number of days 8346 02:45:42,000 --> 02:45:45,830 enter a number of days and conversion unit 8347 02:45:45,830 --> 02:45:45,840 and conversion unit 8348 02:45:45,840 --> 02:45:47,510 and conversion unit now there are a lot of different ways we 8349 02:45:47,510 --> 02:45:47,520 now there are a lot of different ways we 8350 02:45:47,520 --> 02:45:49,429 now there are a lot of different ways we can allow a user to do that 8351 02:45:49,429 --> 02:45:49,439 can allow a user to do that 8352 02:45:49,439 --> 02:45:54,550 can allow a user to do that but what we want to do is something like 8353 02:45:57,910 --> 02:45:57,920 this as an input so basically number of 8354 02:45:57,920 --> 02:45:59,349 this as an input so basically number of days 8355 02:45:59,349 --> 02:45:59,359 days 8356 02:45:59,359 --> 02:46:03,190 days colon and minutes or 8357 02:46:03,190 --> 02:46:03,200 colon and minutes or 8358 02:46:03,200 --> 02:46:06,150 colon and minutes or number of days and hours again this is 8359 02:46:06,150 --> 02:46:06,160 number of days and hours again this is 8360 02:46:06,160 --> 02:46:07,590 number of days and hours again this is our own decision 8361 02:46:07,590 --> 02:46:07,600 our own decision 8362 02:46:07,600 --> 02:46:09,910 our own decision we decide how the user input should look 8363 02:46:09,910 --> 02:46:09,920 we decide how the user input should look 8364 02:46:09,920 --> 02:46:10,630 we decide how the user input should look like 8365 02:46:10,630 --> 02:46:10,640 like 8366 02:46:10,640 --> 02:46:13,190 like but this should be a nice way of 8367 02:46:13,190 --> 02:46:13,200 but this should be a nice way of 8368 02:46:13,200 --> 02:46:15,190 but this should be a nice way of providing both of those values 8369 02:46:15,190 --> 02:46:15,200 providing both of those values 8370 02:46:15,200 --> 02:46:18,070 providing both of those values basically colon separated so instead of 8371 02:46:18,070 --> 02:46:18,080 basically colon separated so instead of 8372 02:46:18,080 --> 02:46:19,190 basically colon separated so instead of a list 8373 02:46:19,190 --> 02:46:19,200 a list 8374 02:46:19,200 --> 02:46:21,269 a list we're going to have a single input with 8375 02:46:21,269 --> 02:46:21,279 we're going to have a single input with 8376 02:46:21,279 --> 02:46:23,030 we're going to have a single input with two values that are 8377 02:46:23,030 --> 02:46:23,040 two values that are 8378 02:46:23,040 --> 02:46:25,990 two values that are separated by a colon so on the next line 8379 02:46:25,990 --> 02:46:26,000 separated by a colon so on the next line 8380 02:46:26,000 --> 02:46:28,550 separated by a colon so on the next line i'm going to change this split here 8381 02:46:28,550 --> 02:46:28,560 i'm going to change this split here 8382 02:46:28,560 --> 02:46:31,990 i'm going to change this split here into a column and this will give us 8383 02:46:31,990 --> 02:46:32,000 into a column and this will give us 8384 02:46:32,000 --> 02:46:35,349 into a column and this will give us user input this whole value split into 8385 02:46:35,349 --> 02:46:35,359 user input this whole value split into 8386 02:46:35,359 --> 02:46:39,030 user input this whole value split into two values as a list this is going to be 8387 02:46:39,030 --> 02:46:39,040 two values as a list this is going to be 8388 02:46:39,040 --> 02:46:42,469 two values as a list this is going to be day and days and 8389 02:46:42,469 --> 02:46:42,479 day and days and 8390 02:46:42,479 --> 02:46:46,550 day and days and unit so least with these two 8391 02:46:46,550 --> 02:46:46,560 unit so least with these two 8392 02:46:46,560 --> 02:46:48,950 unit so least with these two values and let's actually get rid of 8393 02:46:48,950 --> 02:46:48,960 values and let's actually get rid of 8394 02:46:48,960 --> 02:46:50,830 values and let's actually get rid of this for loop because we're not 8395 02:46:50,830 --> 02:46:50,840 this for loop because we're not 8396 02:46:50,840 --> 02:46:53,190 this for loop because we're not iterating through a list of numbers 8397 02:46:53,190 --> 02:46:53,200 iterating through a list of numbers 8398 02:46:53,200 --> 02:46:54,150 iterating through a list of numbers anymore 8399 02:46:54,150 --> 02:46:54,160 anymore 8400 02:46:54,160 --> 02:46:57,910 anymore and to begin with let's just print out 8401 02:46:57,910 --> 02:46:57,920 and to begin with let's just print out 8402 02:46:57,920 --> 02:47:01,030 and to begin with let's just print out the output or the result 8403 02:47:01,030 --> 02:47:01,040 the output or the result 8404 02:47:01,040 --> 02:47:04,469 the output or the result of days and unit variable 8405 02:47:04,469 --> 02:47:04,479 of days and unit variable 8406 02:47:04,479 --> 02:47:08,309 of days and unit variable so i'm gonna refresh and let's do 8407 02:47:08,309 --> 02:47:08,319 so i'm gonna refresh and let's do 8408 02:47:08,319 --> 02:47:11,590 so i'm gonna refresh and let's do two hours and enter 8409 02:47:11,590 --> 02:47:11,600 two hours and enter 8410 02:47:11,600 --> 02:47:13,750 two hours and enter and this is what we get so basically 8411 02:47:13,750 --> 02:47:13,760 and this is what we get so basically 8412 02:47:13,760 --> 02:47:15,349 and this is what we get so basically splitting this string 8413 02:47:15,349 --> 02:47:15,359 splitting this string 8414 02:47:15,359 --> 02:47:17,830 splitting this string on column will give us a list with 8415 02:47:17,830 --> 02:47:17,840 on column will give us a list with 8416 02:47:17,840 --> 02:47:18,469 on column will give us a list with elements 8417 02:47:18,469 --> 02:47:18,479 elements 8418 02:47:18,479 --> 02:47:21,510 elements 20 and hours and note that 20 is still 8419 02:47:21,510 --> 02:47:21,520 20 and hours and note that 20 is still 8420 02:47:21,520 --> 02:47:23,510 20 and hours and note that 20 is still a string right because that's how we get 8421 02:47:23,510 --> 02:47:23,520 a string right because that's how we get 8422 02:47:23,520 --> 02:47:25,030 a string right because that's how we get the input and now 8423 02:47:25,030 --> 02:47:25,040 the input and now 8424 02:47:25,040 --> 02:47:27,349 the input and now from those two values we're going to 8425 02:47:27,349 --> 02:47:27,359 from those two values we're going to 8426 02:47:27,359 --> 02:47:28,070 from those two values we're going to create 8427 02:47:28,070 --> 02:47:28,080 create 8428 02:47:28,080 --> 02:47:31,590 create a value of a data type called 8429 02:47:31,590 --> 02:47:31,600 a value of a data type called 8430 02:47:31,600 --> 02:47:34,710 a value of a data type called dictionary so in python we have another 8431 02:47:34,710 --> 02:47:34,720 dictionary so in python we have another 8432 02:47:34,720 --> 02:47:35,590 dictionary so in python we have another data type 8433 02:47:35,590 --> 02:47:35,600 data type 8434 02:47:35,600 --> 02:47:38,150 data type called the dictionary which basically 8435 02:47:38,150 --> 02:47:38,160 called the dictionary which basically 8436 02:47:38,160 --> 02:47:38,710 called the dictionary which basically looks 8437 02:47:38,710 --> 02:47:38,720 looks 8438 02:47:38,720 --> 02:47:42,389 looks like this so you have curly braces just 8439 02:47:42,389 --> 02:47:42,399 like this so you have curly braces just 8440 02:47:42,399 --> 02:47:43,269 like this so you have curly braces just like we had for 8441 02:47:43,269 --> 02:47:43,279 like we had for 8442 02:47:43,279 --> 02:47:46,630 like we had for a set and inside we have key 8443 02:47:46,630 --> 02:47:46,640 a set and inside we have key 8444 02:47:46,640 --> 02:47:48,950 a set and inside we have key value pairs so we don't have just single 8445 02:47:48,950 --> 02:47:48,960 value pairs so we don't have just single 8446 02:47:48,960 --> 02:47:49,910 value pairs so we don't have just single elements 8447 02:47:49,910 --> 02:47:49,920 elements 8448 02:47:49,920 --> 02:47:53,110 elements like this but rather we have key value 8449 02:47:53,110 --> 02:47:53,120 like this but rather we have key value 8450 02:47:53,120 --> 02:47:53,830 like this but rather we have key value pairs 8451 02:47:53,830 --> 02:47:53,840 pairs 8452 02:47:53,840 --> 02:47:57,590 pairs so key in our case is 8453 02:47:57,590 --> 02:47:57,600 so key in our case is 8454 02:47:57,600 --> 02:48:01,269 so key in our case is days and the value of that key 8455 02:48:01,269 --> 02:48:01,279 days and the value of that key 8456 02:48:01,279 --> 02:48:04,469 days and the value of that key in our case would be 20. and then comma 8457 02:48:04,469 --> 02:48:04,479 in our case would be 20. and then comma 8458 02:48:04,479 --> 02:48:07,429 in our case would be 20. and then comma separated another value would be 8459 02:48:07,429 --> 02:48:07,439 separated another value would be 8460 02:48:07,439 --> 02:48:11,349 separated another value would be unit and 8461 02:48:11,349 --> 02:48:11,359 unit and 8462 02:48:11,359 --> 02:48:15,110 unit and a string hours so basically this is 8463 02:48:15,110 --> 02:48:15,120 a string hours so basically this is 8464 02:48:15,120 --> 02:48:18,790 a string hours so basically this is the syntax of a dictionary and obviously 8465 02:48:18,790 --> 02:48:18,800 the syntax of a dictionary and obviously 8466 02:48:18,800 --> 02:48:19,269 the syntax of a dictionary and obviously the 8467 02:48:19,269 --> 02:48:19,279 the 8468 02:48:19,279 --> 02:48:21,429 the difference between a list and a 8469 02:48:21,429 --> 02:48:21,439 difference between a list and a 8470 02:48:21,439 --> 02:48:23,110 difference between a list and a dictionary is that we have 8471 02:48:23,110 --> 02:48:23,120 dictionary is that we have 8472 02:48:23,120 --> 02:48:26,309 dictionary is that we have descriptions for each of our values 8473 02:48:26,309 --> 02:48:26,319 descriptions for each of our values 8474 02:48:26,319 --> 02:48:29,590 descriptions for each of our values represented as key value pairs so we 8475 02:48:29,590 --> 02:48:29,600 represented as key value pairs so we 8476 02:48:29,600 --> 02:48:29,990 represented as key value pairs so we want to 8477 02:48:29,990 --> 02:48:30,000 want to 8478 02:48:30,000 --> 02:48:32,870 want to create this construct right here from 8479 02:48:32,870 --> 02:48:32,880 create this construct right here from 8480 02:48:32,880 --> 02:48:33,990 create this construct right here from those two values 8481 02:48:33,990 --> 02:48:34,000 those two values 8482 02:48:34,000 --> 02:48:36,150 those two values and since this is a data type we can 8483 02:48:36,150 --> 02:48:36,160 and since this is a data type we can 8484 02:48:36,160 --> 02:48:37,429 and since this is a data type we can create a value and 8485 02:48:37,429 --> 02:48:37,439 create a value and 8486 02:48:37,439 --> 02:48:40,230 create a value and assign it to a variable of that data 8487 02:48:40,230 --> 02:48:40,240 assign it to a variable of that data 8488 02:48:40,240 --> 02:48:42,830 assign it to a variable of that data type so let's call it 8489 02:48:42,830 --> 02:48:42,840 type so let's call it 8490 02:48:42,840 --> 02:48:45,990 type so let's call it days and unit 8491 02:48:45,990 --> 02:48:46,000 days and unit 8492 02:48:46,000 --> 02:48:49,590 days and unit dictionary 8493 02:48:52,550 --> 02:48:52,560 equals and obviously we don't want those 8494 02:48:52,560 --> 02:48:53,349 equals and obviously we don't want those values to be 8495 02:48:53,349 --> 02:48:53,359 values to be 8496 02:48:53,359 --> 02:48:55,750 values to be hard coded here we want to get it from 8497 02:48:55,750 --> 02:48:55,760 hard coded here we want to get it from 8498 02:48:55,760 --> 02:48:56,790 hard coded here we want to get it from the list 8499 02:48:56,790 --> 02:48:56,800 the list 8500 02:48:56,800 --> 02:48:59,910 the list now how do we access an element 8501 02:48:59,910 --> 02:48:59,920 now how do we access an element 8502 02:48:59,920 --> 02:49:02,710 now how do we access an element of a list how do we grab the first value 8503 02:49:02,710 --> 02:49:02,720 of a list how do we grab the first value 8504 02:49:02,720 --> 02:49:03,269 of a list how do we grab the first value which is 8505 02:49:03,269 --> 02:49:03,279 which is 8506 02:49:03,279 --> 02:49:06,550 which is 20 out of that list 8507 02:49:06,550 --> 02:49:06,560 20 out of that list 8508 02:49:06,560 --> 02:49:09,349 20 out of that list and to do that there is a syntax to 8509 02:49:09,349 --> 02:49:09,359 and to do that there is a syntax to 8510 02:49:09,359 --> 02:49:10,630 and to do that there is a syntax to access the elements 8511 02:49:10,630 --> 02:49:10,640 access the elements 8512 02:49:10,640 --> 02:49:12,950 access the elements in the list the list name and then you 8513 02:49:12,950 --> 02:49:12,960 in the list the list name and then you 8514 02:49:12,960 --> 02:49:13,670 in the list the list name and then you have 8515 02:49:13,670 --> 02:49:13,680 have 8516 02:49:13,680 --> 02:49:17,269 have square brackets and index of the element 8517 02:49:17,269 --> 02:49:17,279 square brackets and index of the element 8518 02:49:17,279 --> 02:49:19,030 square brackets and index of the element which if you remember you already 8519 02:49:19,030 --> 02:49:19,040 which if you remember you already 8520 02:49:19,040 --> 02:49:20,469 which if you remember you already learned in the section 8521 02:49:20,469 --> 02:49:20,479 learned in the section 8522 02:49:20,479 --> 02:49:24,710 learned in the section of lists so again days of unit 8523 02:49:24,710 --> 02:49:24,720 of lists so again days of unit 8524 02:49:24,720 --> 02:49:28,150 of lists so again days of unit list is this one right here and with 8525 02:49:28,150 --> 02:49:28,160 list is this one right here and with 8526 02:49:28,160 --> 02:49:30,630 list is this one right here and with index 0 we are accessing the first 8527 02:49:30,630 --> 02:49:30,640 index 0 we are accessing the first 8528 02:49:30,640 --> 02:49:31,429 index 0 we are accessing the first element 8529 02:49:31,429 --> 02:49:31,439 element 8530 02:49:31,439 --> 02:49:34,790 element index 1 is the second element and so on 8531 02:49:34,790 --> 02:49:34,800 index 1 is the second element and so on 8532 02:49:34,800 --> 02:49:35,110 index 1 is the second element and so on and 8533 02:49:35,110 --> 02:49:35,120 and 8534 02:49:35,120 --> 02:49:36,950 and index is basically just location this is 8535 02:49:36,950 --> 02:49:36,960 index is basically just location this is 8536 02:49:36,960 --> 02:49:38,630 index is basically just location this is location 0 location 8537 02:49:38,630 --> 02:49:38,640 location 0 location 8538 02:49:38,640 --> 02:49:41,830 location 0 location 1 and so on so this will give us the 8539 02:49:41,830 --> 02:49:41,840 1 and so on so this will give us the 8540 02:49:41,840 --> 02:49:43,030 1 and so on so this will give us the first value 8541 02:49:43,030 --> 02:49:43,040 first value 8542 02:49:43,040 --> 02:49:45,349 first value and obviously the second value is going 8543 02:49:45,349 --> 02:49:45,359 and obviously the second value is going 8544 02:49:45,359 --> 02:49:48,150 and obviously the second value is going to be with the same syntax with index 8545 02:49:48,150 --> 02:49:48,160 to be with the same syntax with index 8546 02:49:48,160 --> 02:49:51,830 to be with the same syntax with index one and let's actually print 8547 02:49:51,830 --> 02:49:51,840 one and let's actually print 8548 02:49:51,840 --> 02:49:55,269 one and let's actually print that one out as well 8549 02:49:55,269 --> 02:49:55,279 that one out as well 8550 02:49:55,279 --> 02:49:58,630 that one out as well so that we see the results restart the 8551 02:49:58,630 --> 02:49:58,640 so that we see the results restart the 8552 02:49:58,640 --> 02:50:00,950 so that we see the results restart the application 8553 02:50:00,950 --> 02:50:00,960 application 8554 02:50:00,960 --> 02:50:04,230 application let's do 20 hours 8555 02:50:04,230 --> 02:50:04,240 let's do 20 hours 8556 02:50:04,240 --> 02:50:07,269 let's do 20 hours so again this is our list 20 8557 02:50:07,269 --> 02:50:07,279 so again this is our list 20 8558 02:50:07,279 --> 02:50:10,389 so again this is our list 20 hours as two separate values and this is 8559 02:50:10,389 --> 02:50:10,399 hours as two separate values and this is 8560 02:50:10,399 --> 02:50:12,150 hours as two separate values and this is a dictionary that we 8561 02:50:12,150 --> 02:50:12,160 a dictionary that we 8562 02:50:12,160 --> 02:50:16,389 a dictionary that we created using those two values 8563 02:50:16,389 --> 02:50:16,399 created using those two values 8564 02:50:16,399 --> 02:50:19,590 created using those two values so we have key value pairs basically and 8565 02:50:19,590 --> 02:50:19,600 so we have key value pairs basically and 8566 02:50:19,600 --> 02:50:21,030 so we have key value pairs basically and the same way 8567 02:50:21,030 --> 02:50:21,040 the same way 8568 02:50:21,040 --> 02:50:23,510 the same way for minutes we would end up with a 8569 02:50:23,510 --> 02:50:23,520 for minutes we would end up with a 8570 02:50:23,520 --> 02:50:25,670 for minutes we would end up with a dictionary that looks like this 8571 02:50:25,670 --> 02:50:25,680 dictionary that looks like this 8572 02:50:25,680 --> 02:50:28,469 dictionary that looks like this so now we have these two pieces of 8573 02:50:28,469 --> 02:50:28,479 so now we have these two pieces of 8574 02:50:28,479 --> 02:50:30,710 so now we have these two pieces of information in one variable 8575 02:50:30,710 --> 02:50:30,720 information in one variable 8576 02:50:30,720 --> 02:50:32,790 information in one variable and now we can give that variable to our 8577 02:50:32,790 --> 02:50:32,800 and now we can give that variable to our 8578 02:50:32,800 --> 02:50:35,830 and now we can give that variable to our function so that it does the validation 8579 02:50:35,830 --> 02:50:35,840 function so that it does the validation 8580 02:50:35,840 --> 02:50:39,190 function so that it does the validation first of all of the number and 8581 02:50:39,190 --> 02:50:39,200 first of all of the number and 8582 02:50:39,200 --> 02:50:42,790 first of all of the number and calculation based on the units so 8583 02:50:42,790 --> 02:50:42,800 calculation based on the units so 8584 02:50:42,800 --> 02:50:45,830 calculation based on the units so on the next line we're going to call our 8585 02:50:45,830 --> 02:50:45,840 on the next line we're going to call our 8586 02:50:45,840 --> 02:50:50,070 on the next line we're going to call our validate and execute function 8587 02:50:50,070 --> 02:50:50,080 validate and execute function 8588 02:50:50,080 --> 02:50:52,469 validate and execute function and as you see we have this red line 8589 02:50:52,469 --> 02:50:52,479 and as you see we have this red line 8590 02:50:52,479 --> 02:50:53,910 and as you see we have this red line here because something 8591 02:50:53,910 --> 02:50:53,920 here because something 8592 02:50:53,920 --> 02:50:57,110 here because something is wrong first of all we don't have this 8593 02:50:57,110 --> 02:50:57,120 is wrong first of all we don't have this 8594 02:50:57,120 --> 02:50:59,349 is wrong first of all we don't have this variable called num of days element 8595 02:50:59,349 --> 02:50:59,359 variable called num of days element 8596 02:50:59,359 --> 02:51:00,309 variable called num of days element anymore 8597 02:51:00,309 --> 02:51:00,319 anymore 8598 02:51:00,319 --> 02:51:04,389 anymore because we deleted the for loop instead 8599 02:51:04,389 --> 02:51:04,399 because we deleted the for loop instead 8600 02:51:04,399 --> 02:51:07,510 because we deleted the for loop instead we have days and 8601 02:51:07,510 --> 02:51:07,520 we have days and 8602 02:51:07,520 --> 02:51:10,469 we have days and unit dictionary and here we are 8603 02:51:10,469 --> 02:51:10,479 unit dictionary and here we are 8604 02:51:10,479 --> 02:51:11,590 unit dictionary and here we are validating 8605 02:51:11,590 --> 02:51:11,600 validating 8606 02:51:11,600 --> 02:51:14,870 validating the integer value of the input number 8607 02:51:14,870 --> 02:51:14,880 the integer value of the input number 8608 02:51:14,880 --> 02:51:16,550 the integer value of the input number and the same way we need to validate 8609 02:51:16,550 --> 02:51:16,560 and the same way we need to validate 8610 02:51:16,560 --> 02:51:17,990 and the same way we need to validate this input number here 8611 02:51:17,990 --> 02:51:18,000 this input number here 8612 02:51:18,000 --> 02:51:21,030 this input number here as well so now the question is 8613 02:51:21,030 --> 02:51:21,040 as well so now the question is 8614 02:51:21,040 --> 02:51:24,070 as well so now the question is how do we access a specific value in 8615 02:51:24,070 --> 02:51:24,080 how do we access a specific value in 8616 02:51:24,080 --> 02:51:25,190 how do we access a specific value in this case 8617 02:51:25,190 --> 02:51:25,200 this case 8618 02:51:25,200 --> 02:51:28,790 this case the value of days here in a dictionary 8619 02:51:28,790 --> 02:51:28,800 the value of days here in a dictionary 8620 02:51:28,800 --> 02:51:30,630 the value of days here in a dictionary because we have to validate this value 8621 02:51:30,630 --> 02:51:30,640 because we have to validate this value 8622 02:51:30,640 --> 02:51:32,389 because we have to validate this value as well because i might as well 8623 02:51:32,389 --> 02:51:32,399 as well because i might as well 8624 02:51:32,399 --> 02:51:35,990 as well because i might as well have entered text instead of this number 8625 02:51:35,990 --> 02:51:36,000 have entered text instead of this number 8626 02:51:36,000 --> 02:51:39,349 have entered text instead of this number so the way to access values 8627 02:51:39,349 --> 02:51:39,359 so the way to access values 8628 02:51:39,359 --> 02:51:42,790 so the way to access values inside a dictionary is again 8629 02:51:42,790 --> 02:51:42,800 inside a dictionary is again 8630 02:51:42,800 --> 02:51:45,110 inside a dictionary is again using the square brackets just like we 8631 02:51:45,110 --> 02:51:45,120 using the square brackets just like we 8632 02:51:45,120 --> 02:51:46,550 using the square brackets just like we did for list 8633 02:51:46,550 --> 02:51:46,560 did for list 8634 02:51:46,560 --> 02:51:49,990 did for list but instead of an index index 0 or index 8635 02:51:49,990 --> 02:51:50,000 but instead of an index index 0 or index 8636 02:51:50,000 --> 02:51:52,710 but instead of an index index 0 or index 1 we don't need to use an index because 8637 02:51:52,710 --> 02:51:52,720 1 we don't need to use an index because 8638 02:51:52,720 --> 02:51:53,030 1 we don't need to use an index because we 8639 02:51:53,030 --> 02:51:53,040 we 8640 02:51:53,040 --> 02:51:55,990 we actually have a key so instead of index 8641 02:51:55,990 --> 02:51:56,000 actually have a key so instead of index 8642 02:51:56,000 --> 02:51:56,710 actually have a key so instead of index we're going to 8643 02:51:56,710 --> 02:51:56,720 we're going to 8644 02:51:56,720 --> 02:51:59,990 we're going to use the key like days or 8645 02:51:59,990 --> 02:52:00,000 use the key like days or 8646 02:52:00,000 --> 02:52:03,190 use the key like days or unit and this will give us 8647 02:52:03,190 --> 02:52:03,200 unit and this will give us 8648 02:52:03,200 --> 02:52:06,389 unit and this will give us value of 40 which will then be 8649 02:52:06,389 --> 02:52:06,399 value of 40 which will then be 8650 02:52:06,399 --> 02:52:08,389 value of 40 which will then be converted into an integer and then 8651 02:52:08,389 --> 02:52:08,399 converted into an integer and then 8652 02:52:08,399 --> 02:52:10,150 converted into an integer and then validated right here 8653 02:52:10,150 --> 02:52:10,160 validated right here 8654 02:52:10,160 --> 02:52:13,670 validated right here so again i'm gonna copy this 8655 02:52:13,670 --> 02:52:13,680 so again i'm gonna copy this 8656 02:52:13,680 --> 02:52:17,510 so again i'm gonna copy this for comparison so to access 8657 02:52:17,510 --> 02:52:17,520 for comparison so to access 8658 02:52:17,520 --> 02:52:21,030 for comparison so to access an element of a list let's say 8659 02:52:21,030 --> 02:52:21,040 an element of a list let's say 8660 02:52:21,040 --> 02:52:24,790 an element of a list let's say my list here and let's do 8661 02:52:24,790 --> 02:52:24,800 my list here and let's do 8662 02:52:24,800 --> 02:52:29,030 my list here and let's do 20 30 doesn't matter in order to access 8663 02:52:29,030 --> 02:52:29,040 20 30 doesn't matter in order to access 8664 02:52:29,040 --> 02:52:30,389 20 30 doesn't matter in order to access the elements 8665 02:52:30,389 --> 02:52:30,399 the elements 8666 02:52:30,399 --> 02:52:36,070 the elements of that list 8667 02:52:38,870 --> 02:52:38,880 we can do that using an index so this 8668 02:52:38,880 --> 02:52:42,070 we can do that using an index so this will basically 8669 02:52:42,070 --> 02:52:42,080 will basically 8670 02:52:42,080 --> 02:52:46,950 will basically print number 30. again if we had 8671 02:52:46,950 --> 02:52:46,960 print number 30. again if we had 8672 02:52:46,960 --> 02:52:50,150 print number 30. again if we had other elements here we can do index 8673 02:52:50,150 --> 02:52:50,160 other elements here we can do index 8674 02:52:50,160 --> 02:52:53,030 other elements here we can do index 2 so that will print out 100 and let's 8675 02:52:53,030 --> 02:52:53,040 2 so that will print out 100 and let's 8676 02:52:53,040 --> 02:52:54,070 2 so that will print out 100 and let's actually 8677 02:52:54,070 --> 02:52:54,080 actually 8678 02:52:54,080 --> 02:52:57,349 actually check that and remember to comment out 8679 02:52:57,349 --> 02:52:57,359 check that and remember to comment out 8680 02:52:57,359 --> 02:53:00,630 check that and remember to comment out a multi-line code we can use 8681 02:53:00,630 --> 02:53:00,640 a multi-line code we can use 8682 02:53:00,640 --> 02:53:03,110 a multi-line code we can use three quotes at the beginning and at the 8683 02:53:03,110 --> 02:53:03,120 three quotes at the beginning and at the 8684 02:53:03,120 --> 02:53:04,790 three quotes at the beginning and at the end 8685 02:53:04,790 --> 02:53:04,800 end 8686 02:53:04,800 --> 02:53:08,070 end let's refresh and there you go 100 8687 02:53:08,070 --> 02:53:08,080 let's refresh and there you go 100 8688 02:53:08,080 --> 02:53:09,990 let's refresh and there you go 100 was printed let's do the same with the 8689 02:53:09,990 --> 02:53:10,000 was printed let's do the same with the 8690 02:53:10,000 --> 02:53:13,190 was printed let's do the same with the dictionary 8691 02:53:24,950 --> 02:53:24,960 days 8692 02:53:24,960 --> 02:53:28,150 days like this and 8693 02:53:28,150 --> 02:53:28,160 like this and 8694 02:53:28,160 --> 02:53:31,590 like this and to access an element inside 8695 02:53:31,590 --> 02:53:31,600 to access an element inside 8696 02:53:31,600 --> 02:53:34,469 to access an element inside that dictionary we use the square 8697 02:53:34,469 --> 02:53:34,479 that dictionary we use the square 8698 02:53:34,479 --> 02:53:35,349 that dictionary we use the square brackets 8699 02:53:35,349 --> 02:53:35,359 brackets 8700 02:53:35,359 --> 02:53:38,150 brackets and instead of the index like here on 8701 02:53:38,150 --> 02:53:38,160 and instead of the index like here on 8702 02:53:38,160 --> 02:53:39,110 and instead of the index like here on the list 8703 02:53:39,110 --> 02:53:39,120 the list 8704 02:53:39,120 --> 02:53:42,230 the list we use the key itself 8705 02:53:42,230 --> 02:53:42,240 we use the key itself 8706 02:53:42,240 --> 02:53:47,910 we use the key itself and again i'm going to print this 8707 02:53:52,309 --> 02:53:52,319 and there you go you see 8708 02:53:52,319 --> 02:53:57,670 and there you go you see value 20 and i can also access 8709 02:53:57,670 --> 02:53:57,680 value 20 and i can also access 8710 02:53:57,680 --> 02:54:01,590 value 20 and i can also access unit value and if i execute it i see 8711 02:54:01,590 --> 02:54:01,600 unit value and if i execute it i see 8712 02:54:01,600 --> 02:54:04,630 unit value and if i execute it i see hours and so on and i can 8713 02:54:04,630 --> 02:54:04,640 hours and so on and i can 8714 02:54:04,640 --> 02:54:07,830 hours and so on and i can add any number of key value pairs in my 8715 02:54:07,830 --> 02:54:07,840 add any number of key value pairs in my 8716 02:54:07,840 --> 02:54:09,910 add any number of key value pairs in my dictionary as i want 8717 02:54:09,910 --> 02:54:09,920 dictionary as i want 8718 02:54:09,920 --> 02:54:13,830 dictionary as i want so for example i can add a message here 8719 02:54:13,830 --> 02:54:13,840 so for example i can add a message here 8720 02:54:13,840 --> 02:54:16,870 so for example i can add a message here all good and 8721 02:54:16,870 --> 02:54:16,880 all good and 8722 02:54:16,880 --> 02:54:19,990 all good and i can access that message 8723 02:54:19,990 --> 02:54:20,000 i can access that message 8724 02:54:20,000 --> 02:54:22,630 i can access that message like this so this is how you create a 8725 02:54:22,630 --> 02:54:22,640 like this so this is how you create a 8726 02:54:22,640 --> 02:54:24,630 like this so this is how you create a dictionary and that's how you 8727 02:54:24,630 --> 02:54:24,640 dictionary and that's how you 8728 02:54:24,640 --> 02:54:27,910 dictionary and that's how you access the values in a list or in a 8729 02:54:27,910 --> 02:54:27,920 access the values in a list or in a 8730 02:54:27,920 --> 02:54:28,950 access the values in a list or in a dictionary 8731 02:54:28,950 --> 02:54:28,960 dictionary 8732 02:54:28,960 --> 02:54:32,469 dictionary so let's clean this up 8733 02:54:36,790 --> 02:54:36,800 comment in our code again like this 8734 02:54:36,800 --> 02:54:39,830 comment in our code again like this and get back to our code 8735 02:54:39,830 --> 02:54:39,840 and get back to our code 8736 02:54:39,840 --> 02:54:42,630 and get back to our code so basically again this is how we access 8737 02:54:42,630 --> 02:54:42,640 so basically again this is how we access 8738 02:54:42,640 --> 02:54:43,190 so basically again this is how we access the 8739 02:54:43,190 --> 02:54:43,200 the 8740 02:54:43,200 --> 02:54:46,870 the number of days in our dictionary and 8741 02:54:46,870 --> 02:54:46,880 number of days in our dictionary and 8742 02:54:46,880 --> 02:54:50,230 number of days in our dictionary and in our days to units function we need 8743 02:54:50,230 --> 02:54:50,240 in our days to units function we need 8744 02:54:50,240 --> 02:54:54,309 in our days to units function we need both of those values and we can 8745 02:54:54,309 --> 02:54:54,319 both of those values and we can 8746 02:54:54,319 --> 02:54:56,950 both of those values and we can pass in those values separately so we 8747 02:54:56,950 --> 02:54:56,960 pass in those values separately so we 8748 02:54:56,960 --> 02:54:59,190 pass in those values separately so we already have a user input number 8749 02:54:59,190 --> 02:54:59,200 already have a user input number 8750 02:54:59,200 --> 02:55:01,750 already have a user input number from the dictionary and the second value 8751 02:55:01,750 --> 02:55:01,760 from the dictionary and the second value 8752 02:55:01,760 --> 02:55:07,750 from the dictionary and the second value would be 8753 02:55:11,190 --> 02:55:11,200 the unit from the dictionary 8754 02:55:11,200 --> 02:55:13,510 the unit from the dictionary however we have to add that second 8755 02:55:13,510 --> 02:55:13,520 however we have to add that second 8756 02:55:13,520 --> 02:55:15,349 however we have to add that second parameter to our function 8757 02:55:15,349 --> 02:55:15,359 parameter to our function 8758 02:55:15,359 --> 02:55:18,790 parameter to our function so let's do that unit 8759 02:55:18,790 --> 02:55:18,800 so let's do that unit 8760 02:55:18,800 --> 02:55:22,550 so let's do that unit let's call it conversion unit 8761 02:55:22,550 --> 02:55:22,560 let's call it conversion unit 8762 02:55:22,560 --> 02:55:24,630 let's call it conversion unit so now we are passing both of these 8763 02:55:24,630 --> 02:55:24,640 so now we are passing both of these 8764 02:55:24,640 --> 02:55:25,590 so now we are passing both of these values 8765 02:55:25,590 --> 02:55:25,600 values 8766 02:55:25,600 --> 02:55:28,230 values to our function so we have the user 8767 02:55:28,230 --> 02:55:28,240 to our function so we have the user 8768 02:55:28,240 --> 02:55:29,429 to our function so we have the user input number here 8769 02:55:29,429 --> 02:55:29,439 input number here 8770 02:55:29,439 --> 02:55:31,670 input number here which is already converted into an 8771 02:55:31,670 --> 02:55:31,680 which is already converted into an 8772 02:55:31,680 --> 02:55:32,710 which is already converted into an integer 8773 02:55:32,710 --> 02:55:32,720 integer 8774 02:55:32,720 --> 02:55:35,030 integer and the second one which is the 8775 02:55:35,030 --> 02:55:35,040 and the second one which is the 8776 02:55:35,040 --> 02:55:35,910 and the second one which is the conversion 8777 02:55:35,910 --> 02:55:35,920 conversion 8778 02:55:35,920 --> 02:55:39,269 conversion unit and now we can finish 8779 02:55:39,269 --> 02:55:39,279 unit and now we can finish 8780 02:55:39,279 --> 02:55:42,389 unit and now we can finish the logic in this function here 8781 02:55:42,389 --> 02:55:42,399 the logic in this function here 8782 02:55:42,399 --> 02:55:45,110 the logic in this function here right now we are using this hard-coded 8783 02:55:45,110 --> 02:55:45,120 right now we are using this hard-coded 8784 02:55:45,120 --> 02:55:47,349 right now we are using this hard-coded calculation to units which is 8785 02:55:47,349 --> 02:55:47,359 calculation to units which is 8786 02:55:47,359 --> 02:55:49,990 calculation to units which is 24 and number of units which is 8787 02:55:49,990 --> 02:55:50,000 24 and number of units which is 8788 02:55:50,000 --> 02:55:51,429 24 and number of units which is hard-coded hours 8789 02:55:51,429 --> 02:55:51,439 hard-coded hours 8790 02:55:51,439 --> 02:55:52,950 hard-coded hours so first of all i'm going to remove 8791 02:55:52,950 --> 02:55:52,960 so first of all i'm going to remove 8792 02:55:52,960 --> 02:55:54,870 so first of all i'm going to remove those two we don't need them anymore 8793 02:55:54,870 --> 02:55:54,880 those two we don't need them anymore 8794 02:55:54,880 --> 02:55:56,550 those two we don't need them anymore because we get those values from the 8795 02:55:56,550 --> 02:55:56,560 because we get those values from the 8796 02:55:56,560 --> 02:55:57,510 because we get those values from the user 8797 02:55:57,510 --> 02:55:57,520 user 8798 02:55:57,520 --> 02:56:00,550 user and now we have to substitute 8799 02:56:00,550 --> 02:56:00,560 and now we have to substitute 8800 02:56:00,560 --> 02:56:03,110 and now we have to substitute those two so here we're going to check 8801 02:56:03,110 --> 02:56:03,120 those two so here we're going to check 8802 02:56:03,120 --> 02:56:04,790 those two so here we're going to check if the conversion unit is 8803 02:56:04,790 --> 02:56:04,800 if the conversion unit is 8804 02:56:04,800 --> 02:56:09,830 if the conversion unit is hours 8805 02:56:13,510 --> 02:56:13,520 equals hours 8806 02:56:13,520 --> 02:56:16,230 equals hours then we're going to return calculation 8807 02:56:16,230 --> 02:56:16,240 then we're going to return calculation 8808 02:56:16,240 --> 02:56:16,630 then we're going to return calculation with 8809 02:56:16,630 --> 02:56:16,640 with 8810 02:56:16,640 --> 02:56:20,150 with hours it's going to be 24 and 8811 02:56:20,150 --> 02:56:20,160 hours it's going to be 24 and 8812 02:56:20,160 --> 02:56:23,269 hours it's going to be 24 and conversion unit here we can also hard 8813 02:56:23,269 --> 02:56:23,279 conversion unit here we can also hard 8814 02:56:23,279 --> 02:56:23,750 conversion unit here we can also hard code 8815 02:56:23,750 --> 02:56:23,760 code 8816 02:56:23,760 --> 02:56:28,150 code hours here because we know it's hours 8817 02:56:35,910 --> 02:56:35,920 so if the conversion unit is 8818 02:56:35,920 --> 02:56:39,030 so if the conversion unit is minutes 8819 02:56:46,389 --> 02:56:46,399 calculation for minutes and a text like 8820 02:56:46,399 --> 02:56:47,429 calculation for minutes and a text like this 8821 02:56:47,429 --> 02:56:47,439 this 8822 02:56:47,439 --> 02:56:49,990 this and it could also be that the conversion 8823 02:56:49,990 --> 02:56:50,000 and it could also be that the conversion 8824 02:56:50,000 --> 02:56:51,590 and it could also be that the conversion unit that was provided 8825 02:56:51,590 --> 02:56:51,600 unit that was provided 8826 02:56:51,600 --> 02:56:54,710 unit that was provided is none of those or maybe some invalid 8827 02:56:54,710 --> 02:56:54,720 is none of those or maybe some invalid 8828 02:56:54,720 --> 02:56:55,429 is none of those or maybe some invalid text 8829 02:56:55,429 --> 02:56:55,439 text 8830 02:56:55,439 --> 02:56:57,670 text and in this case we're gonna add final 8831 02:56:57,670 --> 02:56:57,680 and in this case we're gonna add final 8832 02:56:57,680 --> 02:56:58,710 and in this case we're gonna add final validation so 8833 02:56:58,710 --> 02:56:58,720 validation so 8834 02:56:58,720 --> 02:57:02,790 validation so if it's neither hours nor minutes 8835 02:57:02,790 --> 02:57:02,800 if it's neither hours nor minutes 8836 02:57:02,800 --> 02:57:06,830 if it's neither hours nor minutes then we're just gonna say you know what 8837 02:57:06,830 --> 02:57:06,840 then we're just gonna say you know what 8838 02:57:06,840 --> 02:57:09,990 then we're just gonna say you know what unsupported 8839 02:57:16,309 --> 02:57:16,319 so basically we don't do conversions 8840 02:57:16,319 --> 02:57:17,910 so basically we don't do conversions other than those two 8841 02:57:17,910 --> 02:57:17,920 other than those two 8842 02:57:17,920 --> 02:57:20,309 other than those two so we just tell the user that's an 8843 02:57:20,309 --> 02:57:20,319 so we just tell the user that's an 8844 02:57:20,319 --> 02:57:21,910 so we just tell the user that's an unsupported unit 8845 02:57:21,910 --> 02:57:21,920 unsupported unit 8846 02:57:21,920 --> 02:57:25,510 unsupported unit and now if we execute our 8847 02:57:25,510 --> 02:57:25,520 and now if we execute our 8848 02:57:25,520 --> 02:57:29,190 and now if we execute our program and enter 8849 02:57:29,190 --> 02:57:29,200 program and enter 8850 02:57:29,200 --> 02:57:33,030 program and enter value there you go we have 8851 02:57:33,030 --> 02:57:33,040 value there you go we have 8852 02:57:33,040 --> 02:57:38,070 value there you go we have our output and same way if we do 8853 02:57:38,070 --> 02:57:38,080 our output and same way if we do 8854 02:57:38,080 --> 02:57:41,269 our output and same way if we do 90 days to hours 8855 02:57:41,269 --> 02:57:41,279 90 days to hours 8856 02:57:41,279 --> 02:57:44,469 90 days to hours we have our calculation in hours so 8857 02:57:44,469 --> 02:57:44,479 we have our calculation in hours so 8858 02:57:44,479 --> 02:57:46,950 we have our calculation in hours so that's how dictionaries work we can do 8859 02:57:46,950 --> 02:57:46,960 that's how dictionaries work we can do 8860 02:57:46,960 --> 02:57:49,670 that's how dictionaries work we can do one final thing here and 8861 02:57:49,670 --> 02:57:49,680 one final thing here and 8862 02:57:49,680 --> 02:57:54,790 one final thing here and as usual print out the type 8863 02:57:54,790 --> 02:57:54,800 as usual print out the type 8864 02:57:54,800 --> 02:58:02,070 as usual print out the type of our dictionary 8865 02:58:04,870 --> 02:58:04,880 and there you go you see class of type 8866 02:58:04,880 --> 02:58:06,070 and there you go you see class of type dictionary here 8867 02:58:06,070 --> 02:58:06,080 dictionary here 8868 02:58:06,080 --> 02:58:08,710 dictionary here which is another data type and at this 8869 02:58:08,710 --> 02:58:08,720 which is another data type and at this 8870 02:58:08,720 --> 02:58:09,750 which is another data type and at this point we can actually 8871 02:58:09,750 --> 02:58:09,760 point we can actually 8872 02:58:09,760 --> 02:58:11,590 point we can actually summarize all the data types that we 8873 02:58:11,590 --> 02:58:11,600 summarize all the data types that we 8874 02:58:11,600 --> 02:58:13,349 summarize all the data types that we have learned so far 8875 02:58:13,349 --> 02:58:13,359 have learned so far 8876 02:58:13,359 --> 02:58:16,550 have learned so far so let's give us some space here so 8877 02:58:16,550 --> 02:58:16,560 so let's give us some space here so 8878 02:58:16,560 --> 02:58:19,670 so let's give us some space here so first one was string so basically 8879 02:58:19,670 --> 02:58:19,680 first one was string so basically 8880 02:58:19,680 --> 02:58:26,389 first one was string so basically a message or some output 8881 02:58:34,870 --> 02:58:34,880 that's our string then we have integers 8882 02:58:34,880 --> 02:58:37,910 that's our string then we have integers example of that we saw already days 8883 02:58:37,910 --> 02:58:37,920 example of that we saw already days 8884 02:58:37,920 --> 02:58:40,469 example of that we saw already days then we have float numbers which for 8885 02:58:40,469 --> 02:58:40,479 then we have float numbers which for 8886 02:58:40,479 --> 02:58:42,150 then we have float numbers which for example can be used for 8887 02:58:42,150 --> 02:58:42,160 example can be used for 8888 02:58:42,160 --> 02:58:45,349 example can be used for price or 8889 02:58:45,349 --> 02:58:45,359 price or 8890 02:58:45,359 --> 02:58:49,510 price or weight of a product etc we also have 8891 02:58:49,510 --> 02:58:49,520 weight of a product etc we also have 8892 02:58:49,520 --> 02:58:52,790 weight of a product etc we also have learned boolean data types when we check 8893 02:58:52,790 --> 02:58:52,800 learned boolean data types when we check 8894 02:58:52,800 --> 02:58:55,349 learned boolean data types when we check some kind of condition whether if it's 8895 02:58:55,349 --> 02:58:55,359 some kind of condition whether if it's 8896 02:58:55,359 --> 02:58:56,150 some kind of condition whether if it's true or not 8897 02:58:56,150 --> 02:58:56,160 true or not 8898 02:58:56,160 --> 02:59:02,550 true or not so for example is it a valid number 8899 02:59:05,590 --> 02:59:05,600 or is the user input 8900 02:59:05,600 --> 02:59:09,110 or is the user input exit 8901 02:59:13,030 --> 02:59:13,040 we also learned a data type of lists 8902 02:59:13,040 --> 02:59:16,070 we also learned a data type of lists so for example usage list 8903 02:59:16,070 --> 02:59:16,080 so for example usage list 8904 02:59:16,080 --> 02:59:23,349 so for example usage list of days 8905 02:59:27,349 --> 02:59:27,359 like this including duplicate values 8906 02:59:27,359 --> 02:59:30,230 like this including duplicate values and list data type can be used for 8907 02:59:30,230 --> 02:59:30,240 and list data type can be used for 8908 02:59:30,240 --> 02:59:31,190 and list data type can be used for strings as well 8909 02:59:31,190 --> 02:59:31,200 strings as well 8910 02:59:31,200 --> 02:59:35,030 strings as well not only for numbers so for example we 8911 02:59:35,030 --> 02:59:35,040 not only for numbers so for example we 8912 02:59:35,040 --> 02:59:37,670 not only for numbers so for example we can have list of month 8913 02:59:37,670 --> 02:59:37,680 can have list of month 8914 02:59:37,680 --> 02:59:41,030 can have list of month like january 8915 02:59:43,910 --> 02:59:43,920 doesn't really matter we also learned a 8916 02:59:43,920 --> 02:59:45,349 doesn't really matter we also learned a data type 8917 02:59:45,349 --> 02:59:45,359 data type 8918 02:59:45,359 --> 02:59:49,750 data type called set and set basically 8919 02:59:49,750 --> 02:59:49,760 called set and set basically 8920 02:59:49,760 --> 02:59:53,349 called set and set basically is very similar to list but it doesn't 8921 02:59:53,349 --> 02:59:53,359 is very similar to list but it doesn't 8922 02:59:53,359 --> 02:59:53,750 is very similar to list but it doesn't allow 8923 02:59:53,750 --> 02:59:53,760 allow 8924 02:59:53,760 --> 02:59:57,670 allow duplicate values and its syntax is 8925 02:59:57,670 --> 02:59:57,680 duplicate values and its syntax is 8926 02:59:57,680 --> 03:00:01,030 duplicate values and its syntax is with curly braces so the same way we can 8927 03:00:01,030 --> 03:00:01,040 with curly braces so the same way we can 8928 03:00:01,040 --> 03:00:02,309 with curly braces so the same way we can have 8929 03:00:02,309 --> 03:00:02,319 have 8930 03:00:02,319 --> 03:00:05,990 have numbers or strings or booleans or any 8931 03:00:05,990 --> 03:00:06,000 numbers or strings or booleans or any 8932 03:00:06,000 --> 03:00:07,190 numbers or strings or booleans or any other data types 8933 03:00:07,190 --> 03:00:07,200 other data types 8934 03:00:07,200 --> 03:00:09,590 other data types inside a set and the last one that we 8935 03:00:09,590 --> 03:00:09,600 inside a set and the last one that we 8936 03:00:09,600 --> 03:00:10,469 inside a set and the last one that we learned 8937 03:00:10,469 --> 03:00:10,479 learned 8938 03:00:10,479 --> 03:00:13,990 learned was a dictionary 8939 03:00:13,990 --> 03:00:14,000 was a dictionary 8940 03:00:14,000 --> 03:00:17,030 was a dictionary and let's take our own example 8941 03:00:17,030 --> 03:00:17,040 and let's take our own example 8942 03:00:17,040 --> 03:00:21,110 and let's take our own example day in unit 8943 03:00:25,429 --> 03:00:25,439 and dictionary is basically a collection 8944 03:00:25,439 --> 03:00:29,110 and dictionary is basically a collection of key value pairs and the syntax 8945 03:00:29,110 --> 03:00:29,120 of key value pairs and the syntax 8946 03:00:29,120 --> 03:00:32,389 of key value pairs and the syntax is written like 8947 03:00:32,389 --> 03:00:32,399 is written like 8948 03:00:32,399 --> 03:00:35,590 is written like this so why do we need all these 8949 03:00:35,590 --> 03:00:35,600 this so why do we need all these 8950 03:00:35,600 --> 03:00:37,190 this so why do we need all these different data types 8951 03:00:37,190 --> 03:00:37,200 different data types 8952 03:00:37,200 --> 03:00:40,070 different data types well depending on the use case or what 8953 03:00:40,070 --> 03:00:40,080 well depending on the use case or what 8954 03:00:40,080 --> 03:00:42,150 well depending on the use case or what exactly you are trying to achieve in the 8955 03:00:42,150 --> 03:00:42,160 exactly you are trying to achieve in the 8956 03:00:42,160 --> 03:00:43,030 exactly you are trying to achieve in the program 8957 03:00:43,030 --> 03:00:43,040 program 8958 03:00:43,040 --> 03:00:45,910 program you're gonna need a different data type 8959 03:00:45,910 --> 03:00:45,920 you're gonna need a different data type 8960 03:00:45,920 --> 03:00:48,070 you're gonna need a different data type to achieve exactly that 8961 03:00:48,070 --> 03:00:48,080 to achieve exactly that 8962 03:00:48,080 --> 03:00:51,030 to achieve exactly that so each data type has its own specific 8963 03:00:51,030 --> 03:00:51,040 so each data type has its own specific 8964 03:00:51,040 --> 03:00:52,389 so each data type has its own specific purpose 8965 03:00:52,389 --> 03:00:52,399 purpose 8966 03:00:52,399 --> 03:00:54,389 purpose and throughout these days to units 8967 03:00:54,389 --> 03:00:54,399 and throughout these days to units 8968 03:00:54,399 --> 03:00:56,469 and throughout these days to units calculator i try to 8969 03:00:56,469 --> 03:00:56,479 calculator i try to 8970 03:00:56,479 --> 03:01:00,070 calculator i try to demonstrate the purpose of each data 8971 03:01:00,070 --> 03:01:00,080 demonstrate the purpose of each data 8972 03:01:00,080 --> 03:01:00,790 demonstrate the purpose of each data type 8973 03:01:00,790 --> 03:01:00,800 type 8974 03:01:00,800 --> 03:01:03,910 type and when we need to use them so these 8975 03:01:03,910 --> 03:01:03,920 and when we need to use them so these 8976 03:01:03,920 --> 03:01:05,429 and when we need to use them so these are all the data types that we learned 8977 03:01:05,429 --> 03:01:05,439 are all the data types that we learned 8978 03:01:05,439 --> 03:01:06,309 are all the data types that we learned these are also 8979 03:01:06,309 --> 03:01:06,319 these are also 8980 03:01:06,319 --> 03:01:08,710 these are also most of the data types available in 8981 03:01:08,710 --> 03:01:08,720 most of the data types available in 8982 03:01:08,720 --> 03:01:10,630 most of the data types available in python and the main ones 8983 03:01:10,630 --> 03:01:10,640 python and the main ones 8984 03:01:10,640 --> 03:01:12,870 python and the main ones that you're going to be working with so 8985 03:01:12,870 --> 03:01:12,880 that you're going to be working with so 8986 03:01:12,880 --> 03:01:14,710 that you're going to be working with so this should give you a good foundational 8987 03:01:14,710 --> 03:01:14,720 this should give you a good foundational 8988 03:01:14,720 --> 03:01:16,309 this should give you a good foundational knowledge about data types 8989 03:01:16,309 --> 03:01:16,319 knowledge about data types 8990 03:01:16,319 --> 03:01:19,429 knowledge about data types in python and also note that most of 8991 03:01:19,429 --> 03:01:19,439 in python and also note that most of 8992 03:01:19,439 --> 03:01:19,990 in python and also note that most of these data 8993 03:01:19,990 --> 03:01:20,000 these data 8994 03:01:20,000 --> 03:01:23,190 these data types you will also encounter in any 8995 03:01:23,190 --> 03:01:23,200 types you will also encounter in any 8996 03:01:23,200 --> 03:01:24,710 types you will also encounter in any other programming languages 8997 03:01:24,710 --> 03:01:24,720 other programming languages 8998 03:01:24,720 --> 03:01:26,309 other programming languages because as i said these are the core 8999 03:01:26,309 --> 03:01:26,319 because as i said these are the core 9000 03:01:26,319 --> 03:01:28,309 because as i said these are the core data types and most of the programming 9001 03:01:28,309 --> 03:01:28,319 data types and most of the programming 9002 03:01:28,319 --> 03:01:30,950 data types and most of the programming languages actually support these data 9003 03:01:30,950 --> 03:01:30,960 languages actually support these data 9004 03:01:30,960 --> 03:01:35,030 languages actually support these data types as well 9005 03:01:35,030 --> 03:01:35,040 types as well 9006 03:01:35,040 --> 03:01:37,910 types as well till now we have been writing all our 9007 03:01:37,910 --> 03:01:37,920 till now we have been writing all our 9008 03:01:37,920 --> 03:01:38,469 till now we have been writing all our code 9009 03:01:38,469 --> 03:01:38,479 code 9010 03:01:38,479 --> 03:01:41,990 code in one single file so basically we have 9011 03:01:41,990 --> 03:01:42,000 in one single file so basically we have 9012 03:01:42,000 --> 03:01:42,790 in one single file so basically we have a project 9013 03:01:42,790 --> 03:01:42,800 a project 9014 03:01:42,800 --> 03:01:45,030 a project with just one python file and we're 9015 03:01:45,030 --> 03:01:45,040 with just one python file and we're 9016 03:01:45,040 --> 03:01:46,870 with just one python file and we're writing all the logic 9017 03:01:46,870 --> 03:01:46,880 writing all the logic 9018 03:01:46,880 --> 03:01:49,750 writing all the logic inside that file however you can imagine 9019 03:01:49,750 --> 03:01:49,760 inside that file however you can imagine 9020 03:01:49,760 --> 03:01:50,309 inside that file however you can imagine that 9021 03:01:50,309 --> 03:01:50,319 that 9022 03:01:50,319 --> 03:01:51,990 that if you're writing a little bit more 9023 03:01:51,990 --> 03:01:52,000 if you're writing a little bit more 9024 03:01:52,000 --> 03:01:53,590 if you're writing a little bit more complex applications 9025 03:01:53,590 --> 03:01:53,600 complex applications 9026 03:01:53,600 --> 03:01:56,309 complex applications that have much more complex logic so 9027 03:01:56,309 --> 03:01:56,319 that have much more complex logic so 9028 03:01:56,319 --> 03:01:57,429 that have much more complex logic so they end up having 9029 03:01:57,429 --> 03:01:57,439 they end up having 9030 03:01:57,439 --> 03:02:00,550 they end up having lots of functions obviously you're gonna 9031 03:02:00,550 --> 03:02:00,560 lots of functions obviously you're gonna 9032 03:02:00,560 --> 03:02:03,910 lots of functions obviously you're gonna end up with a python file that has 9033 03:02:03,910 --> 03:02:03,920 end up with a python file that has 9034 03:02:03,920 --> 03:02:05,830 end up with a python file that has hundreds of lines of code maybe 9035 03:02:05,830 --> 03:02:05,840 hundreds of lines of code maybe 9036 03:02:05,840 --> 03:02:07,510 hundreds of lines of code maybe thousands of lines of code 9037 03:02:07,510 --> 03:02:07,520 thousands of lines of code 9038 03:02:07,520 --> 03:02:10,469 thousands of lines of code and it's not very practical to manage 9039 03:02:10,469 --> 03:02:10,479 and it's not very practical to manage 9040 03:02:10,479 --> 03:02:12,710 and it's not very practical to manage all this logic and all this code in just 9041 03:02:12,710 --> 03:02:12,720 all this logic and all this code in just 9042 03:02:12,720 --> 03:02:15,190 all this logic and all this code in just one file so instead you need to 9043 03:02:15,190 --> 03:02:15,200 one file so instead you need to 9044 03:02:15,200 --> 03:02:16,070 one file so instead you need to structure your 9045 03:02:16,070 --> 03:02:16,080 structure your 9046 03:02:16,080 --> 03:02:19,349 structure your code and divide your logic between 9047 03:02:19,349 --> 03:02:19,359 code and divide your logic between 9048 03:02:19,359 --> 03:02:21,990 code and divide your logic between multiple different python files and you 9049 03:02:21,990 --> 03:02:22,000 multiple different python files and you 9050 03:02:22,000 --> 03:02:22,630 multiple different python files and you do that 9051 03:02:22,630 --> 03:02:22,640 do that 9052 03:02:22,640 --> 03:02:25,750 do that with modules to give an example 9053 03:02:25,750 --> 03:02:25,760 with modules to give an example 9054 03:02:25,760 --> 03:02:28,550 with modules to give an example imagine a web application that has 9055 03:02:28,550 --> 03:02:28,560 imagine a web application that has 9056 03:02:28,560 --> 03:02:30,230 imagine a web application that has basically many features like facebook 9057 03:02:30,230 --> 03:02:30,240 basically many features like facebook 9058 03:02:30,240 --> 03:02:31,190 basically many features like facebook for example 9059 03:02:31,190 --> 03:02:31,200 for example 9060 03:02:31,200 --> 03:02:33,510 for example obviously you can put all the facebook 9061 03:02:33,510 --> 03:02:33,520 obviously you can put all the facebook 9062 03:02:33,520 --> 03:02:34,309 obviously you can put all the facebook logic in 9063 03:02:34,309 --> 03:02:34,319 logic in 9064 03:02:34,319 --> 03:02:36,630 logic in one single python file right you will 9065 03:02:36,630 --> 03:02:36,640 one single python file right you will 9066 03:02:36,640 --> 03:02:38,389 one single python file right you will have a structure 9067 03:02:38,389 --> 03:02:38,399 have a structure 9068 03:02:38,399 --> 03:02:42,389 have a structure of facebook project with subfolders in 9069 03:02:42,389 --> 03:02:42,399 of facebook project with subfolders in 9070 03:02:42,399 --> 03:02:43,190 of facebook project with subfolders in your project 9071 03:02:43,190 --> 03:02:43,200 your project 9072 03:02:43,200 --> 03:02:46,150 your project which all contain multiple python files 9073 03:02:46,150 --> 03:02:46,160 which all contain multiple python files 9074 03:02:46,160 --> 03:02:47,269 which all contain multiple python files so you would have 9075 03:02:47,269 --> 03:02:47,279 so you would have 9076 03:02:47,279 --> 03:02:50,790 so you would have maybe packages for each feature 9077 03:02:50,790 --> 03:02:50,800 maybe packages for each feature 9078 03:02:50,800 --> 03:02:52,950 maybe packages for each feature and each such feature has a lot of 9079 03:02:52,950 --> 03:02:52,960 and each such feature has a lot of 9080 03:02:52,960 --> 03:02:53,910 and each such feature has a lot of functionalities 9081 03:02:53,910 --> 03:02:53,920 functionalities 9082 03:02:53,920 --> 03:02:55,910 functionalities so they will be all grouped then again 9083 03:02:55,910 --> 03:02:55,920 so they will be all grouped then again 9084 03:02:55,920 --> 03:02:57,269 so they will be all grouped then again in multiple 9085 03:02:57,269 --> 03:02:57,279 in multiple 9086 03:02:57,279 --> 03:02:59,990 in multiple python files right so you would end up 9087 03:02:59,990 --> 03:03:00,000 python files right so you would end up 9088 03:03:00,000 --> 03:03:00,389 python files right so you would end up with 9089 03:03:00,389 --> 03:03:00,399 with 9090 03:03:00,399 --> 03:03:03,750 with a project with a hierarchy of folders 9091 03:03:03,750 --> 03:03:03,760 a project with a hierarchy of folders 9092 03:03:03,760 --> 03:03:06,950 a project with a hierarchy of folders and lots of lots of python files inside 9093 03:03:06,950 --> 03:03:06,960 and lots of lots of python files inside 9094 03:03:06,960 --> 03:03:10,389 and lots of lots of python files inside now the question is if i 9095 03:03:10,389 --> 03:03:10,399 now the question is if i 9096 03:03:10,399 --> 03:03:13,670 now the question is if i have multiple python files in my project 9097 03:03:13,670 --> 03:03:13,680 have multiple python files in my project 9098 03:03:13,680 --> 03:03:16,070 have multiple python files in my project how do i connect them together so for 9099 03:03:16,070 --> 03:03:16,080 how do i connect them together so for 9100 03:03:16,080 --> 03:03:17,750 how do i connect them together so for example if i have 9101 03:03:17,750 --> 03:03:17,760 example if i have 9102 03:03:17,760 --> 03:03:20,710 example if i have another file here and let's call it 9103 03:03:20,710 --> 03:03:20,720 another file here and let's call it 9104 03:03:20,720 --> 03:03:21,750 another file here and let's call it helper 9105 03:03:21,750 --> 03:03:21,760 helper 9106 03:03:21,760 --> 03:03:25,510 helper dot py 9107 03:03:25,510 --> 03:03:25,520 dot py 9108 03:03:25,520 --> 03:03:28,790 dot py and if i have some logic here basically 9109 03:03:28,790 --> 03:03:28,800 and if i have some logic here basically 9110 03:03:28,800 --> 03:03:31,670 and if i have some logic here basically functions defined here how do i use them 9111 03:03:31,670 --> 03:03:31,680 functions defined here how do i use them 9112 03:03:31,680 --> 03:03:33,750 functions defined here how do i use them or how do i reference them 9113 03:03:33,750 --> 03:03:33,760 or how do i reference them 9114 03:03:33,760 --> 03:03:37,190 or how do i reference them in another file and the way it works in 9115 03:03:37,190 --> 03:03:37,200 in another file and the way it works in 9116 03:03:37,200 --> 03:03:40,230 in another file and the way it works in python is using the concept 9117 03:03:40,230 --> 03:03:40,240 python is using the concept 9118 03:03:40,240 --> 03:03:43,910 python is using the concept called modules so a module is basically 9119 03:03:43,910 --> 03:03:43,920 called modules so a module is basically 9120 03:03:43,920 --> 03:03:46,950 called modules so a module is basically a python file that contains 9121 03:03:46,950 --> 03:03:46,960 a python file that contains 9122 03:03:46,960 --> 03:03:49,990 a python file that contains functions or variables that 9123 03:03:49,990 --> 03:03:50,000 functions or variables that 9124 03:03:50,000 --> 03:03:53,510 functions or variables that you can use in another python file 9125 03:03:53,510 --> 03:03:53,520 you can use in another python file 9126 03:03:53,520 --> 03:03:55,750 you can use in another python file so basically any python file that you 9127 03:03:55,750 --> 03:03:55,760 so basically any python file that you 9128 03:03:55,760 --> 03:03:57,190 so basically any python file that you have in your project 9129 03:03:57,190 --> 03:03:57,200 have in your project 9130 03:03:57,200 --> 03:03:59,750 have in your project both of these in this case are modules 9131 03:03:59,750 --> 03:03:59,760 both of these in this case are modules 9132 03:03:59,760 --> 03:04:01,269 both of these in this case are modules and you can reference 9133 03:04:01,269 --> 03:04:01,279 and you can reference 9134 03:04:01,279 --> 03:04:04,950 and you can reference one module from another so basically 9135 03:04:04,950 --> 03:04:04,960 one module from another so basically 9136 03:04:04,960 --> 03:04:07,349 one module from another so basically the idea is that you can structure your 9137 03:04:07,349 --> 03:04:07,359 the idea is that you can structure your 9138 03:04:07,359 --> 03:04:08,150 the idea is that you can structure your application 9139 03:04:08,150 --> 03:04:08,160 application 9140 03:04:08,160 --> 03:04:11,269 application your program using modules so you can 9141 03:04:11,269 --> 03:04:11,279 your program using modules so you can 9142 03:04:11,279 --> 03:04:12,309 your program using modules so you can make your project 9143 03:04:12,309 --> 03:04:12,319 make your project 9144 03:04:12,319 --> 03:04:14,710 make your project modular so in this part we're going to 9145 03:04:14,710 --> 03:04:14,720 modular so in this part we're going to 9146 03:04:14,720 --> 03:04:16,389 modular so in this part we're going to create our own module 9147 03:04:16,389 --> 03:04:16,399 create our own module 9148 03:04:16,399 --> 03:04:18,230 create our own module in helper file and we're going to 9149 03:04:18,230 --> 03:04:18,240 in helper file and we're going to 9150 03:04:18,240 --> 03:04:20,830 in helper file and we're going to reference that in main dot 9151 03:04:20,830 --> 03:04:20,840 reference that in main dot 9152 03:04:20,840 --> 03:04:23,590 reference that in main dot python 9153 03:04:23,590 --> 03:04:23,600 python 9154 03:04:23,600 --> 03:04:26,389 python and let's say in main.python i only want 9155 03:04:26,389 --> 03:04:26,399 and let's say in main.python i only want 9156 03:04:26,399 --> 03:04:27,190 and let's say in main.python i only want the code 9157 03:04:27,190 --> 03:04:27,200 the code 9158 03:04:27,200 --> 03:04:29,590 the code that basically starts the program right 9159 03:04:29,590 --> 03:04:29,600 that basically starts the program right 9160 03:04:29,600 --> 03:04:30,790 that basically starts the program right all the functions 9161 03:04:30,790 --> 03:04:30,800 all the functions 9162 03:04:30,800 --> 03:04:33,429 all the functions all the logic i kind of want it hidden 9163 03:04:33,429 --> 03:04:33,439 all the logic i kind of want it hidden 9164 03:04:33,439 --> 03:04:33,990 all the logic i kind of want it hidden away 9165 03:04:33,990 --> 03:04:34,000 away 9166 03:04:34,000 --> 03:04:37,590 away and grouped together in a separate file 9167 03:04:37,590 --> 03:04:37,600 and grouped together in a separate file 9168 03:04:37,600 --> 03:04:40,389 and grouped together in a separate file so what we're going to do is copy this 9169 03:04:40,389 --> 03:04:40,399 so what we're going to do is copy this 9170 03:04:40,399 --> 03:04:41,830 so what we're going to do is copy this entire thing 9171 03:04:41,830 --> 03:04:41,840 entire thing 9172 03:04:41,840 --> 03:04:45,590 entire thing so both of these functions basically and 9173 03:04:45,590 --> 03:04:45,600 so both of these functions basically and 9174 03:04:45,600 --> 03:04:49,110 so both of these functions basically and paste it in here so now you already see 9175 03:04:49,110 --> 03:04:49,120 paste it in here so now you already see 9176 03:04:49,120 --> 03:04:50,150 paste it in here so now you already see a couple of 9177 03:04:50,150 --> 03:04:50,160 a couple of 9178 03:04:50,160 --> 03:04:53,429 a couple of red lines here because now the reference 9179 03:04:53,429 --> 03:04:53,439 red lines here because now the reference 9180 03:04:53,439 --> 03:04:55,110 red lines here because now the reference is obviously broken right 9181 03:04:55,110 --> 03:04:55,120 is obviously broken right 9182 03:04:55,120 --> 03:04:57,510 is obviously broken right so main.python obviously doesn't know 9183 03:04:57,510 --> 03:04:57,520 so main.python obviously doesn't know 9184 03:04:57,520 --> 03:04:58,309 so main.python obviously doesn't know anything about 9185 03:04:58,309 --> 03:04:58,319 anything about 9186 03:04:58,319 --> 03:05:00,950 anything about validate and execute function right it 9187 03:05:00,950 --> 03:05:00,960 validate and execute function right it 9188 03:05:00,960 --> 03:05:02,309 validate and execute function right it says unresolved 9189 03:05:02,309 --> 03:05:02,319 says unresolved 9190 03:05:02,319 --> 03:05:05,750 says unresolved reference and the same way face to unit 9191 03:05:05,750 --> 03:05:05,760 reference and the same way face to unit 9192 03:05:05,760 --> 03:05:08,070 reference and the same way face to unit dictionary is unresolved for helper 9193 03:05:08,070 --> 03:05:08,080 dictionary is unresolved for helper 9194 03:05:08,080 --> 03:05:10,230 dictionary is unresolved for helper because it doesn't know anything about 9195 03:05:10,230 --> 03:05:10,240 because it doesn't know anything about 9196 03:05:10,240 --> 03:05:13,429 because it doesn't know anything about main.python and the variables defined 9197 03:05:13,429 --> 03:05:13,439 main.python and the variables defined 9198 03:05:13,439 --> 03:05:15,429 main.python and the variables defined right here so the first thing we need to 9199 03:05:15,429 --> 03:05:15,439 right here so the first thing we need to 9200 03:05:15,439 --> 03:05:17,190 right here so the first thing we need to do is we need to tell 9201 03:05:17,190 --> 03:05:17,200 do is we need to tell 9202 03:05:17,200 --> 03:05:20,870 do is we need to tell main note python file where to find this 9203 03:05:20,870 --> 03:05:20,880 main note python file where to find this 9204 03:05:20,880 --> 03:05:21,830 main note python file where to find this validate and 9205 03:05:21,830 --> 03:05:21,840 validate and 9206 03:05:21,840 --> 03:05:24,070 validate and execute function right we have defined 9207 03:05:24,070 --> 03:05:24,080 execute function right we have defined 9208 03:05:24,080 --> 03:05:25,910 execute function right we have defined it in helper python so 9209 03:05:25,910 --> 03:05:25,920 it in helper python so 9210 03:05:25,920 --> 03:05:29,110 it in helper python so that's what we need to define how we 9211 03:05:29,110 --> 03:05:29,120 that's what we need to define how we 9212 03:05:29,120 --> 03:05:31,910 that's what we need to define how we do that is using something called an 9213 03:05:31,910 --> 03:05:31,920 do that is using something called an 9214 03:05:31,920 --> 03:05:32,469 do that is using something called an import 9215 03:05:32,469 --> 03:05:32,479 import 9216 03:05:32,479 --> 03:05:35,510 import statement so we basically import 9217 03:05:35,510 --> 03:05:35,520 statement so we basically import 9218 03:05:35,520 --> 03:05:39,590 statement so we basically import this whole helper.pi module 9219 03:05:39,590 --> 03:05:39,600 this whole helper.pi module 9220 03:05:39,600 --> 03:05:43,510 this whole helper.pi module inside main.python and we do that 9221 03:05:43,510 --> 03:05:43,520 inside main.python and we do that 9222 03:05:43,520 --> 03:05:47,190 inside main.python and we do that very simply using import 9223 03:05:47,190 --> 03:05:47,200 very simply using import 9224 03:05:47,200 --> 03:05:50,309 very simply using import helper right helper is the name of the 9225 03:05:50,309 --> 03:05:50,319 helper right helper is the name of the 9226 03:05:50,319 --> 03:05:50,870 helper right helper is the name of the file 9227 03:05:50,870 --> 03:05:50,880 file 9228 03:05:50,880 --> 03:05:54,070 file and therefore name of the module and 9229 03:05:54,070 --> 03:05:54,080 and therefore name of the module and 9230 03:05:54,080 --> 03:05:56,389 and therefore name of the module and right now it's grey because we're not 9231 03:05:56,389 --> 03:05:56,399 right now it's grey because we're not 9232 03:05:56,399 --> 03:05:57,110 right now it's grey because we're not using it 9233 03:05:57,110 --> 03:05:57,120 using it 9234 03:05:57,120 --> 03:06:00,710 using it and the way to use it is helper dot 9235 03:06:00,710 --> 03:06:00,720 and the way to use it is helper dot 9236 03:06:00,720 --> 03:06:02,790 and the way to use it is helper dot and the function name and you see the 9237 03:06:02,790 --> 03:06:02,800 and the function name and you see the 9238 03:06:02,800 --> 03:06:04,230 and the function name and you see the red line disappeared 9239 03:06:04,230 --> 03:06:04,240 red line disappeared 9240 03:06:04,240 --> 03:06:06,670 red line disappeared so again what we did is we told 9241 03:06:06,670 --> 03:06:06,680 so again what we did is we told 9242 03:06:06,680 --> 03:06:07,910 so again what we did is we told main.python 9243 03:06:07,910 --> 03:06:07,920 main.python 9244 03:06:07,920 --> 03:06:11,349 main.python there is a helper module in this project 9245 03:06:11,349 --> 03:06:11,359 there is a helper module in this project 9246 03:06:11,359 --> 03:06:14,630 there is a helper module in this project and please import this whole module 9247 03:06:14,630 --> 03:06:14,640 and please import this whole module 9248 03:06:14,640 --> 03:06:16,790 and please import this whole module and all the functions that this module 9249 03:06:16,790 --> 03:06:16,800 and all the functions that this module 9250 03:06:16,800 --> 03:06:19,110 and all the functions that this module has and make it available 9251 03:06:19,110 --> 03:06:19,120 has and make it available 9252 03:06:19,120 --> 03:06:22,710 has and make it available in main.pi and then once we have that 9253 03:06:22,710 --> 03:06:22,720 in main.pi and then once we have that 9254 03:06:22,720 --> 03:06:23,910 in main.pi and then once we have that helper module 9255 03:06:23,910 --> 03:06:23,920 helper module 9256 03:06:23,920 --> 03:06:27,190 helper module we can reference any functions if we had 9257 03:06:27,190 --> 03:06:27,200 we can reference any functions if we had 9258 03:06:27,200 --> 03:06:28,389 we can reference any functions if we had any variables 9259 03:06:28,389 --> 03:06:28,399 any variables 9260 03:06:28,399 --> 03:06:31,750 any variables using module name dot 9261 03:06:31,750 --> 03:06:31,760 using module name dot 9262 03:06:31,760 --> 03:06:35,190 using module name dot function so this has to be the name and 9263 03:06:35,190 --> 03:06:35,200 function so this has to be the name and 9264 03:06:35,200 --> 03:06:38,630 function so this has to be the name and if i hover over it you see that pycharm 9265 03:06:38,630 --> 03:06:38,640 if i hover over it you see that pycharm 9266 03:06:38,640 --> 03:06:41,990 if i hover over it you see that pycharm actually displays the whole path 9267 03:06:41,990 --> 03:06:42,000 actually displays the whole path 9268 03:06:42,000 --> 03:06:45,510 actually displays the whole path to that helper.pi file 9269 03:06:45,510 --> 03:06:45,520 to that helper.pi file 9270 03:06:45,520 --> 03:06:48,230 to that helper.pi file and now note that here we still have 9271 03:06:48,230 --> 03:06:48,240 and now note that here we still have 9272 03:06:48,240 --> 03:06:49,190 and now note that here we still have redline 9273 03:06:49,190 --> 03:06:49,200 redline 9274 03:06:49,200 --> 03:06:52,230 redline because this is a variable which is 9275 03:06:52,230 --> 03:06:52,240 because this is a variable which is 9276 03:06:52,240 --> 03:06:53,670 because this is a variable which is defined in main 9277 03:06:53,670 --> 03:06:53,680 defined in main 9278 03:06:53,680 --> 03:06:57,190 defined in main dot pi but a helper module doesn't know 9279 03:06:57,190 --> 03:06:57,200 dot pi but a helper module doesn't know 9280 03:06:57,200 --> 03:06:58,950 dot pi but a helper module doesn't know anything about it and that's an 9281 03:06:58,950 --> 03:06:58,960 anything about it and that's an 9282 03:06:58,960 --> 03:07:00,309 anything about it and that's an important distinction here 9283 03:07:00,309 --> 03:07:00,319 important distinction here 9284 03:07:00,319 --> 03:07:02,870 important distinction here because we imported helper module inside 9285 03:07:02,870 --> 03:07:02,880 because we imported helper module inside 9286 03:07:02,880 --> 03:07:03,429 because we imported helper module inside main 9287 03:07:03,429 --> 03:07:03,439 main 9288 03:07:03,439 --> 03:07:05,349 main so helper modules functions are 9289 03:07:05,349 --> 03:07:05,359 so helper modules functions are 9290 03:07:05,359 --> 03:07:08,070 so helper modules functions are available here but not the other way 9291 03:07:08,070 --> 03:07:08,080 available here but not the other way 9292 03:07:08,080 --> 03:07:10,870 available here but not the other way so in order to make this dictionary 9293 03:07:10,870 --> 03:07:10,880 so in order to make this dictionary 9294 03:07:10,880 --> 03:07:11,750 so in order to make this dictionary available 9295 03:07:11,750 --> 03:07:11,760 available 9296 03:07:11,760 --> 03:07:14,389 available invalidate and execute function we would 9297 03:07:14,389 --> 03:07:14,399 invalidate and execute function we would 9298 03:07:14,399 --> 03:07:14,950 invalidate and execute function we would need to 9299 03:07:14,950 --> 03:07:14,960 need to 9300 03:07:14,960 --> 03:07:19,750 need to pass it in as a variable like this 9301 03:07:19,750 --> 03:07:19,760 pass it in as a variable like this 9302 03:07:19,760 --> 03:07:22,950 pass it in as a variable like this and this will work now now 9303 03:07:22,950 --> 03:07:22,960 and this will work now now 9304 03:07:22,960 --> 03:07:26,469 and this will work now now note that in main.python 9305 03:07:26,469 --> 03:07:26,479 note that in main.python 9306 03:07:26,479 --> 03:07:29,110 note that in main.python we actually only need this validate and 9307 03:07:29,110 --> 03:07:29,120 we actually only need this validate and 9308 03:07:29,120 --> 03:07:30,309 we actually only need this validate and execute function 9309 03:07:30,309 --> 03:07:30,319 execute function 9310 03:07:30,319 --> 03:07:32,710 execute function we don't need the days to units function 9311 03:07:32,710 --> 03:07:32,720 we don't need the days to units function 9312 03:07:32,720 --> 03:07:33,429 we don't need the days to units function because 9313 03:07:33,429 --> 03:07:33,439 because 9314 03:07:33,439 --> 03:07:36,710 because this function is only used by validate 9315 03:07:36,710 --> 03:07:36,720 this function is only used by validate 9316 03:07:36,720 --> 03:07:38,070 this function is only used by validate and execute function 9317 03:07:38,070 --> 03:07:38,080 and execute function 9318 03:07:38,080 --> 03:07:41,349 and execute function so that means that we don't need to 9319 03:07:41,349 --> 03:07:41,359 so that means that we don't need to 9320 03:07:41,359 --> 03:07:44,150 so that means that we don't need to import the whole entire module inside 9321 03:07:44,150 --> 03:07:44,160 import the whole entire module inside 9322 03:07:44,160 --> 03:07:45,590 import the whole entire module inside main.pi 9323 03:07:45,590 --> 03:07:45,600 main.pi 9324 03:07:45,600 --> 03:07:48,070 main.pi we actually only need the validated 9325 03:07:48,070 --> 03:07:48,080 we actually only need the validated 9326 03:07:48,080 --> 03:07:49,510 we actually only need the validated execute function 9327 03:07:49,510 --> 03:07:49,520 execute function 9328 03:07:49,520 --> 03:07:52,309 execute function and this is a small example but if you 9329 03:07:52,309 --> 03:07:52,319 and this is a small example but if you 9330 03:07:52,319 --> 03:07:53,750 and this is a small example but if you had a module with 9331 03:07:53,750 --> 03:07:53,760 had a module with 9332 03:07:53,760 --> 03:07:56,950 had a module with 20 30 functions and you just needed one 9333 03:07:56,950 --> 03:07:56,960 20 30 functions and you just needed one 9334 03:07:56,960 --> 03:07:57,510 20 30 functions and you just needed one of them 9335 03:07:57,510 --> 03:07:57,520 of them 9336 03:07:57,520 --> 03:07:59,750 of them you wouldn't need to import the whole 9337 03:07:59,750 --> 03:07:59,760 you wouldn't need to import the whole 9338 03:07:59,760 --> 03:08:02,070 you wouldn't need to import the whole module just for that one function 9339 03:08:02,070 --> 03:08:02,080 module just for that one function 9340 03:08:02,080 --> 03:08:04,870 module just for that one function so what you could do is you can pick and 9341 03:08:04,870 --> 03:08:04,880 so what you could do is you can pick and 9342 03:08:04,880 --> 03:08:06,469 so what you could do is you can pick and choose which 9343 03:08:06,469 --> 03:08:06,479 choose which 9344 03:08:06,479 --> 03:08:10,070 choose which specific functions you want to 9345 03:08:10,070 --> 03:08:10,080 specific functions you want to 9346 03:08:10,080 --> 03:08:13,110 specific functions you want to make available inside another file 9347 03:08:13,110 --> 03:08:13,120 make available inside another file 9348 03:08:13,120 --> 03:08:15,590 make available inside another file or another module and you can do that 9349 03:08:15,590 --> 03:08:15,600 or another module and you can do that 9350 03:08:15,600 --> 03:08:16,950 or another module and you can do that very easily 9351 03:08:16,950 --> 03:08:16,960 very easily 9352 03:08:16,960 --> 03:08:20,309 very easily using the following syntax we say from 9353 03:08:20,309 --> 03:08:20,319 using the following syntax we say from 9354 03:08:20,319 --> 03:08:24,309 using the following syntax we say from helper that's the module again import 9355 03:08:24,309 --> 03:08:24,319 helper that's the module again import 9356 03:08:24,319 --> 03:08:29,110 helper that's the module again import and the name of the function 9357 03:08:31,750 --> 03:08:31,760 like this and now because we are 9358 03:08:31,760 --> 03:08:32,469 like this and now because we are accessing 9359 03:08:32,469 --> 03:08:32,479 accessing 9360 03:08:32,479 --> 03:08:35,110 accessing and importing that specific function we 9361 03:08:35,110 --> 03:08:35,120 and importing that specific function we 9362 03:08:35,120 --> 03:08:35,670 and importing that specific function we don't need 9363 03:08:35,670 --> 03:08:35,680 don't need 9364 03:08:35,680 --> 03:08:38,389 don't need to use module name anymore we have that 9365 03:08:38,389 --> 03:08:38,399 to use module name anymore we have that 9366 03:08:38,399 --> 03:08:38,950 to use module name anymore we have that function 9367 03:08:38,950 --> 03:08:38,960 function 9368 03:08:38,960 --> 03:08:41,510 function available directly so we can delete the 9369 03:08:41,510 --> 03:08:41,520 available directly so we can delete the 9370 03:08:41,520 --> 03:08:42,230 available directly so we can delete the module 9371 03:08:42,230 --> 03:08:42,240 module 9372 03:08:42,240 --> 03:08:44,710 module reference here and we have that function 9373 03:08:44,710 --> 03:08:44,720 reference here and we have that function 9374 03:08:44,720 --> 03:08:45,590 reference here and we have that function available 9375 03:08:45,590 --> 03:08:45,600 available 9376 03:08:45,600 --> 03:08:48,150 available like this so again instead of having 9377 03:08:48,150 --> 03:08:48,160 like this so again instead of having 9378 03:08:48,160 --> 03:08:48,710 like this so again instead of having entire 9379 03:08:48,710 --> 03:08:48,720 entire 9380 03:08:48,720 --> 03:08:51,190 entire helper module with all of its functions 9381 03:08:51,190 --> 03:08:51,200 helper module with all of its functions 9382 03:08:51,200 --> 03:08:51,830 helper module with all of its functions and 9383 03:08:51,830 --> 03:08:51,840 and 9384 03:08:51,840 --> 03:08:55,190 and other stuff we only have one specific 9385 03:08:55,190 --> 03:08:55,200 other stuff we only have one specific 9386 03:08:55,200 --> 03:08:55,670 other stuff we only have one specific function 9387 03:08:55,670 --> 03:08:55,680 function 9388 03:08:55,680 --> 03:08:58,150 function available here so that means we wouldn't 9389 03:08:58,150 --> 03:08:58,160 available here so that means we wouldn't 9390 03:08:58,160 --> 03:08:59,349 available here so that means we wouldn't be able to use 9391 03:08:59,349 --> 03:08:59,359 be able to use 9392 03:08:59,359 --> 03:09:01,670 be able to use these two units for example now we saw 9393 03:09:01,670 --> 03:09:01,680 these two units for example now we saw 9394 03:09:01,680 --> 03:09:02,550 these two units for example now we saw an example 9395 03:09:02,550 --> 03:09:02,560 an example 9396 03:09:02,560 --> 03:09:05,429 an example of a module that has just functions 9397 03:09:05,429 --> 03:09:05,439 of a module that has just functions 9398 03:09:05,439 --> 03:09:05,910 of a module that has just functions right 9399 03:09:05,910 --> 03:09:05,920 right 9400 03:09:05,920 --> 03:09:08,870 right however module can have many other stuff 9401 03:09:08,870 --> 03:09:08,880 however module can have many other stuff 9402 03:09:08,880 --> 03:09:09,830 however module can have many other stuff for example 9403 03:09:09,830 --> 03:09:09,840 for example 9404 03:09:09,840 --> 03:09:11,910 for example variables and you can make those 9405 03:09:11,910 --> 03:09:11,920 variables and you can make those 9406 03:09:11,920 --> 03:09:13,830 variables and you can make those variables also available 9407 03:09:13,830 --> 03:09:13,840 variables also available 9408 03:09:13,840 --> 03:09:16,309 variables also available for another program and that's an 9409 03:09:16,309 --> 03:09:16,319 for another program and that's an 9410 03:09:16,319 --> 03:09:17,750 for another program and that's an example here 9411 03:09:17,750 --> 03:09:17,760 example here 9412 03:09:17,760 --> 03:09:21,269 example here i'm going to create a variable called 9413 03:09:21,269 --> 03:09:21,279 i'm going to create a variable called 9414 03:09:21,279 --> 03:09:28,830 i'm going to create a variable called user input 9415 03:09:30,950 --> 03:09:30,960 message 9416 03:09:30,960 --> 03:09:33,429 message and this is our user input message and 9417 03:09:33,429 --> 03:09:33,439 and this is our user input message and 9418 03:09:33,439 --> 03:09:34,550 and this is our user input message and we can actually 9419 03:09:34,550 --> 03:09:34,560 we can actually 9420 03:09:34,560 --> 03:09:37,110 we can actually put it into a variable instead of having 9421 03:09:37,110 --> 03:09:37,120 put it into a variable instead of having 9422 03:09:37,120 --> 03:09:38,870 put it into a variable instead of having it defined like that 9423 03:09:38,870 --> 03:09:38,880 it defined like that 9424 03:09:38,880 --> 03:09:41,910 it defined like that so i'm going to copy it 9425 03:09:41,910 --> 03:09:41,920 so i'm going to copy it 9426 03:09:41,920 --> 03:09:45,670 so i'm going to copy it and paste it here so now we have 9427 03:09:45,670 --> 03:09:45,680 and paste it here so now we have 9428 03:09:45,680 --> 03:09:48,950 and paste it here so now we have the user input in a variable in another 9429 03:09:48,950 --> 03:09:48,960 the user input in a variable in another 9430 03:09:48,960 --> 03:09:49,590 the user input in a variable in another file 9431 03:09:49,590 --> 03:09:49,600 file 9432 03:09:49,600 --> 03:09:53,030 file again how do we access it in main dot pi 9433 03:09:53,030 --> 03:09:53,040 again how do we access it in main dot pi 9434 03:09:53,040 --> 03:09:55,269 again how do we access it in main dot pi in this statement at the top we can 9435 03:09:55,269 --> 03:09:55,279 in this statement at the top we can 9436 03:09:55,279 --> 03:09:56,630 in this statement at the top we can actually import 9437 03:09:56,630 --> 03:09:56,640 actually import 9438 03:09:56,640 --> 03:09:59,830 actually import several things from a module 9439 03:09:59,830 --> 03:09:59,840 several things from a module 9440 03:09:59,840 --> 03:10:02,950 several things from a module right now we are importing a function we 9441 03:10:02,950 --> 03:10:02,960 right now we are importing a function we 9442 03:10:02,960 --> 03:10:03,750 right now we are importing a function we can also 9443 03:10:03,750 --> 03:10:03,760 can also 9444 03:10:03,760 --> 03:10:06,950 can also import our variable and we can do that 9445 03:10:06,950 --> 03:10:06,960 import our variable and we can do that 9446 03:10:06,960 --> 03:10:09,190 import our variable and we can do that also very easily 9447 03:10:09,190 --> 03:10:09,200 also very easily 9448 03:10:09,200 --> 03:10:12,309 also very easily like this and we can use that 9449 03:10:12,309 --> 03:10:12,319 like this and we can use that 9450 03:10:12,319 --> 03:10:15,830 like this and we can use that user input message here so basically if 9451 03:10:15,830 --> 03:10:15,840 user input message here so basically if 9452 03:10:15,840 --> 03:10:16,790 user input message here so basically if you have 9453 03:10:16,790 --> 03:10:16,800 you have 9454 03:10:16,800 --> 03:10:19,910 you have again 20 functions and variables 9455 03:10:19,910 --> 03:10:19,920 again 20 functions and variables 9456 03:10:19,920 --> 03:10:22,469 again 20 functions and variables from a module and you just need maybe 9457 03:10:22,469 --> 03:10:22,479 from a module and you just need maybe 9458 03:10:22,479 --> 03:10:23,349 from a module and you just need maybe five of them 9459 03:10:23,349 --> 03:10:23,359 five of them 9460 03:10:23,359 --> 03:10:26,389 five of them you can import them individually 9461 03:10:26,389 --> 03:10:26,399 you can import them individually 9462 03:10:26,399 --> 03:10:29,269 you can import them individually like this just basically just list the 9463 03:10:29,269 --> 03:10:29,279 like this just basically just list the 9464 03:10:29,279 --> 03:10:29,830 like this just basically just list the names 9465 03:10:29,830 --> 03:10:29,840 names 9466 03:10:29,840 --> 03:10:32,389 names of functions and variables what you can 9467 03:10:32,389 --> 03:10:32,399 of functions and variables what you can 9468 03:10:32,399 --> 03:10:33,590 of functions and variables what you can also do 9469 03:10:33,590 --> 03:10:33,600 also do 9470 03:10:33,600 --> 03:10:37,590 also do is import all this is what this 9471 03:10:37,590 --> 03:10:37,600 is import all this is what this 9472 03:10:37,600 --> 03:10:40,469 is import all this is what this asterisk sign represents so we're 9473 03:10:40,469 --> 03:10:40,479 asterisk sign represents so we're 9474 03:10:40,479 --> 03:10:41,590 asterisk sign represents so we're basically importing 9475 03:10:41,590 --> 03:10:41,600 basically importing 9476 03:10:41,600 --> 03:10:44,870 basically importing everything from the helper module again 9477 03:10:44,870 --> 03:10:44,880 everything from the helper module again 9478 03:10:44,880 --> 03:10:47,510 everything from the helper module again this is kind of a waste if you just need 9479 03:10:47,510 --> 03:10:47,520 this is kind of a waste if you just need 9480 03:10:47,520 --> 03:10:48,870 this is kind of a waste if you just need a couple of 9481 03:10:48,870 --> 03:10:48,880 a couple of 9482 03:10:48,880 --> 03:10:51,590 a couple of functions and variables from that module 9483 03:10:51,590 --> 03:10:51,600 functions and variables from that module 9484 03:10:51,600 --> 03:10:53,349 functions and variables from that module and not the entire thing 9485 03:10:53,349 --> 03:10:53,359 and not the entire thing 9486 03:10:53,359 --> 03:10:56,150 and not the entire thing however with this syntax you can import 9487 03:10:56,150 --> 03:10:56,160 however with this syntax you can import 9488 03:10:56,160 --> 03:10:56,710 however with this syntax you can import everything 9489 03:10:56,710 --> 03:10:56,720 everything 9490 03:10:56,720 --> 03:10:58,710 everything and now you may be wondering what is a 9491 03:10:58,710 --> 03:10:58,720 and now you may be wondering what is a 9492 03:10:58,720 --> 03:11:00,070 and now you may be wondering what is a difference between 9493 03:11:00,070 --> 03:11:00,080 difference between 9494 03:11:00,080 --> 03:11:02,550 difference between importing everything from the module and 9495 03:11:02,550 --> 03:11:02,560 importing everything from the module and 9496 03:11:02,560 --> 03:11:04,309 importing everything from the module and importing the whole module 9497 03:11:04,309 --> 03:11:04,319 importing the whole module 9498 03:11:04,319 --> 03:11:06,389 importing the whole module because in both cases you have 9499 03:11:06,389 --> 03:11:06,399 because in both cases you have 9500 03:11:06,399 --> 03:11:08,389 because in both cases you have everything in the module available 9501 03:11:08,389 --> 03:11:08,399 everything in the module available 9502 03:11:08,399 --> 03:11:10,870 everything in the module available the difference is in the syntax because 9503 03:11:10,870 --> 03:11:10,880 the difference is in the syntax because 9504 03:11:10,880 --> 03:11:12,229 the difference is in the syntax because note that if we 9505 03:11:12,229 --> 03:11:12,239 note that if we 9506 03:11:12,239 --> 03:11:15,429 note that if we use this from import statement 9507 03:11:15,429 --> 03:11:15,439 use this from import statement 9508 03:11:15,439 --> 03:11:18,070 use this from import statement you don't need to use name of the module 9509 03:11:18,070 --> 03:11:18,080 you don't need to use name of the module 9510 03:11:18,080 --> 03:11:19,190 you don't need to use name of the module every time you're 9511 03:11:19,190 --> 03:11:19,200 every time you're 9512 03:11:19,200 --> 03:11:21,429 every time you're accessing something defined in that 9513 03:11:21,429 --> 03:11:21,439 accessing something defined in that 9514 03:11:21,439 --> 03:11:22,309 accessing something defined in that module right 9515 03:11:22,309 --> 03:11:22,319 module right 9516 03:11:22,319 --> 03:11:24,710 module right so we don't need to do helper dot 9517 03:11:24,710 --> 03:11:24,720 so we don't need to do helper dot 9518 03:11:24,720 --> 03:11:26,469 so we don't need to do helper dot function name or helper dot 9519 03:11:26,469 --> 03:11:26,479 function name or helper dot 9520 03:11:26,479 --> 03:11:30,469 function name or helper dot variable name whereas if we imported 9521 03:11:30,469 --> 03:11:30,479 variable name whereas if we imported 9522 03:11:30,479 --> 03:11:33,510 variable name whereas if we imported the module like this you see 9523 03:11:33,510 --> 03:11:33,520 the module like this you see 9524 03:11:33,520 --> 03:11:35,670 the module like this you see we have red lines because we would need 9525 03:11:35,670 --> 03:11:35,680 we have red lines because we would need 9526 03:11:35,680 --> 03:11:37,349 we have red lines because we would need to do 9527 03:11:37,349 --> 03:11:37,359 to do 9528 03:11:37,359 --> 03:11:40,630 to do helper dot or module name dot 9529 03:11:40,630 --> 03:11:40,640 helper dot or module name dot 9530 03:11:40,640 --> 03:11:42,630 helper dot or module name dot whenever we use something from the 9531 03:11:42,630 --> 03:11:42,640 whenever we use something from the 9532 03:11:42,640 --> 03:11:44,150 whenever we use something from the module now this could be 9533 03:11:44,150 --> 03:11:44,160 module now this could be 9534 03:11:44,160 --> 03:11:47,269 module now this could be a matter of taste so basically which one 9535 03:11:47,269 --> 03:11:47,279 a matter of taste so basically which one 9536 03:11:47,279 --> 03:11:52,150 a matter of taste so basically which one you want to use i personally think that 9537 03:11:52,150 --> 03:11:52,160 you want to use i personally think that 9538 03:11:52,160 --> 03:11:54,790 you want to use i personally think that this is the most efficient and also 9539 03:11:54,790 --> 03:11:54,800 this is the most efficient and also 9540 03:11:54,800 --> 03:11:56,389 this is the most efficient and also cleaner way of 9541 03:11:56,389 --> 03:11:56,399 cleaner way of 9542 03:11:56,399 --> 03:11:59,830 cleaner way of using specific functions variables etc 9543 03:11:59,830 --> 03:11:59,840 using specific functions variables etc 9544 03:11:59,840 --> 03:12:01,190 using specific functions variables etc defined in a module 9545 03:12:01,190 --> 03:12:01,200 defined in a module 9546 03:12:01,200 --> 03:12:04,309 defined in a module and as a side note the things that are 9547 03:12:04,309 --> 03:12:04,319 and as a side note the things that are 9548 03:12:04,319 --> 03:12:05,590 and as a side note the things that are defined in a module 9549 03:12:05,590 --> 03:12:05,600 defined in a module 9550 03:12:05,600 --> 03:12:07,990 defined in a module that you can use basically in another 9551 03:12:07,990 --> 03:12:08,000 that you can use basically in another 9552 03:12:08,000 --> 03:12:09,429 that you can use basically in another file are called 9553 03:12:09,429 --> 03:12:09,439 file are called 9554 03:12:09,439 --> 03:12:12,630 file are called definitions so all these those three 9555 03:12:12,630 --> 03:12:12,640 definitions so all these those three 9556 03:12:12,640 --> 03:12:13,429 definitions so all these those three elements here 9557 03:12:13,429 --> 03:12:13,439 elements here 9558 03:12:13,439 --> 03:12:16,389 elements here are definitions of a module and you can 9559 03:12:16,389 --> 03:12:16,399 are definitions of a module and you can 9560 03:12:16,399 --> 03:12:16,790 are definitions of a module and you can use 9561 03:12:16,790 --> 03:12:16,800 use 9562 03:12:16,800 --> 03:12:19,910 use any of those definitions in a file where 9563 03:12:19,910 --> 03:12:19,920 any of those definitions in a file where 9564 03:12:19,920 --> 03:12:20,309 any of those definitions in a file where you 9565 03:12:20,309 --> 03:12:20,319 you 9566 03:12:20,319 --> 03:12:23,269 you import that module what you can also do 9567 03:12:23,269 --> 03:12:23,279 import that module what you can also do 9568 03:12:23,279 --> 03:12:24,630 import that module what you can also do when importing a module 9569 03:12:24,630 --> 03:12:24,640 when importing a module 9570 03:12:24,640 --> 03:12:27,349 when importing a module is you can rename that module basically 9571 03:12:27,349 --> 03:12:27,359 is you can rename that module basically 9572 03:12:27,359 --> 03:12:27,750 is you can rename that module basically to 9573 03:12:27,750 --> 03:12:27,760 to 9574 03:12:27,760 --> 03:12:30,309 to whatever you want so if the name of the 9575 03:12:30,309 --> 03:12:30,319 whatever you want so if the name of the 9576 03:12:30,319 --> 03:12:30,870 whatever you want so if the name of the module 9577 03:12:30,870 --> 03:12:30,880 module 9578 03:12:30,880 --> 03:12:33,269 module is too long or you just want to use a 9579 03:12:33,269 --> 03:12:33,279 is too long or you just want to use a 9580 03:12:33,279 --> 03:12:34,150 is too long or you just want to use a different name 9581 03:12:34,150 --> 03:12:34,160 different name 9582 03:12:34,160 --> 03:12:37,190 different name you can do as and then basically write a 9583 03:12:37,190 --> 03:12:37,200 you can do as and then basically write a 9584 03:12:37,200 --> 03:12:39,269 you can do as and then basically write a name whatever you want 9585 03:12:39,269 --> 03:12:39,279 name whatever you want 9586 03:12:39,279 --> 03:12:42,229 name whatever you want like h for example and then obviously 9587 03:12:42,229 --> 03:12:42,239 like h for example and then obviously 9588 03:12:42,239 --> 03:12:43,510 like h for example and then obviously you need to use that 9589 03:12:43,510 --> 03:12:43,520 you need to use that 9590 03:12:43,520 --> 03:12:47,510 you need to use that new name everywhere you access 9591 03:12:47,510 --> 03:12:47,520 new name everywhere you access 9592 03:12:47,520 --> 03:12:50,550 new name everywhere you access functions or variables of that module 9593 03:12:50,550 --> 03:12:50,560 functions or variables of that module 9594 03:12:50,560 --> 03:12:53,269 functions or variables of that module so basically how you import a module and 9595 03:12:53,269 --> 03:12:53,279 so basically how you import a module and 9596 03:12:53,279 --> 03:12:54,710 so basically how you import a module and whether you rename it 9597 03:12:54,710 --> 03:12:54,720 whether you rename it 9598 03:12:54,720 --> 03:12:57,429 whether you rename it is a matter of taste basically how you 9599 03:12:57,429 --> 03:12:57,439 is a matter of taste basically how you 9600 03:12:57,439 --> 03:12:57,910 is a matter of taste basically how you want 9601 03:12:57,910 --> 03:12:57,920 want 9602 03:12:57,920 --> 03:13:01,510 want to do that in your code 9603 03:13:01,510 --> 03:13:01,520 to do that in your code 9604 03:13:01,520 --> 03:13:05,269 to do that in your code however i think that importing specific 9605 03:13:05,269 --> 03:13:05,279 however i think that importing specific 9606 03:13:05,279 --> 03:13:08,710 however i think that importing specific elements from a module like this is 9607 03:13:08,710 --> 03:13:08,720 elements from a module like this is 9608 03:13:08,720 --> 03:13:11,670 elements from a module like this is most efficient and also cleanest way to 9609 03:13:11,670 --> 03:13:11,680 most efficient and also cleanest way to 9610 03:13:11,680 --> 03:13:12,630 most efficient and also cleanest way to do that 9611 03:13:12,630 --> 03:13:12,640 do that 9612 03:13:12,640 --> 03:13:16,150 do that so we saw how to create our own module 9613 03:13:16,150 --> 03:13:16,160 so we saw how to create our own module 9614 03:13:16,160 --> 03:13:19,110 so we saw how to create our own module and use it in another file so basically 9615 03:13:19,110 --> 03:13:19,120 and use it in another file so basically 9616 03:13:19,120 --> 03:13:21,750 and use it in another file so basically if you had hundred python files here 9617 03:13:21,750 --> 03:13:21,760 if you had hundred python files here 9618 03:13:21,760 --> 03:13:23,429 if you had hundred python files here with each one of them having their own 9619 03:13:23,429 --> 03:13:23,439 with each one of them having their own 9620 03:13:23,439 --> 03:13:25,030 with each one of them having their own functions and variables you can cross 9621 03:13:25,030 --> 03:13:25,040 functions and variables you can cross 9622 03:13:25,040 --> 03:13:28,630 functions and variables you can cross reference them from each other using 9623 03:13:28,630 --> 03:13:28,640 reference them from each other using 9624 03:13:28,640 --> 03:13:33,990 reference them from each other using the import statement very easily 9625 03:13:36,550 --> 03:13:36,560 now in addition to creating your own 9626 03:13:36,560 --> 03:13:37,590 now in addition to creating your own modules 9627 03:13:37,590 --> 03:13:37,600 modules 9628 03:13:37,600 --> 03:13:40,870 modules we can actually use modules that python 9629 03:13:40,870 --> 03:13:40,880 we can actually use modules that python 9630 03:13:40,880 --> 03:13:43,269 we can actually use modules that python itself already includes so just like we 9631 03:13:43,269 --> 03:13:43,279 itself already includes so just like we 9632 03:13:43,279 --> 03:13:44,070 itself already includes so just like we used some 9633 03:13:44,070 --> 03:13:44,080 used some 9634 03:13:44,080 --> 03:13:47,190 used some functions that python gives us out of 9635 03:13:47,190 --> 03:13:47,200 functions that python gives us out of 9636 03:13:47,200 --> 03:13:48,070 functions that python gives us out of the box 9637 03:13:48,070 --> 03:13:48,080 the box 9638 03:13:48,080 --> 03:13:50,790 the box like inputs or ins so basically all of 9639 03:13:50,790 --> 03:13:50,800 like inputs or ins so basically all of 9640 03:13:50,800 --> 03:13:51,510 like inputs or ins so basically all of those 9641 03:13:51,510 --> 03:13:51,520 those 9642 03:13:51,520 --> 03:13:54,309 those the same way python also gives us 9643 03:13:54,309 --> 03:13:54,319 the same way python also gives us 9644 03:13:54,319 --> 03:13:55,349 the same way python also gives us modules 9645 03:13:55,349 --> 03:13:55,359 modules 9646 03:13:55,359 --> 03:13:58,389 modules for different scenarios so that we don't 9647 03:13:58,389 --> 03:13:58,399 for different scenarios so that we don't 9648 03:13:58,399 --> 03:13:59,910 for different scenarios so that we don't have to write this logic 9649 03:13:59,910 --> 03:13:59,920 have to write this logic 9650 03:13:59,920 --> 03:14:03,110 have to write this logic ourselves and there are a lot of useful 9651 03:14:03,110 --> 03:14:03,120 ourselves and there are a lot of useful 9652 03:14:03,120 --> 03:14:06,309 ourselves and there are a lot of useful modules that python actually includes 9653 03:14:06,309 --> 03:14:06,319 modules that python actually includes 9654 03:14:06,319 --> 03:14:09,349 modules that python actually includes for example math module for mathematical 9655 03:14:09,349 --> 03:14:09,359 for example math module for mathematical 9656 03:14:09,359 --> 03:14:10,630 for example math module for mathematical operations 9657 03:14:10,630 --> 03:14:10,640 operations 9658 03:14:10,640 --> 03:14:13,910 operations its own module for working with dates or 9659 03:14:13,910 --> 03:14:13,920 its own module for working with dates or 9660 03:14:13,920 --> 03:14:15,190 its own module for working with dates or date times 9661 03:14:15,190 --> 03:14:15,200 date times 9662 03:14:15,200 --> 03:14:18,150 date times module for working with specific files 9663 03:14:18,150 --> 03:14:18,160 module for working with specific files 9664 03:14:18,160 --> 03:14:19,590 module for working with specific files and so on so basically 9665 03:14:19,590 --> 03:14:19,600 and so on so basically 9666 03:14:19,600 --> 03:14:21,830 and so on so basically for many different use cases python 9667 03:14:21,830 --> 03:14:21,840 for many different use cases python 9668 03:14:21,840 --> 03:14:23,269 for many different use cases python already gives you 9669 03:14:23,269 --> 03:14:23,279 already gives you 9670 03:14:23,279 --> 03:14:25,429 already gives you ready modules and these modules will 9671 03:14:25,429 --> 03:14:25,439 ready modules and these modules will 9672 03:14:25,439 --> 03:14:27,510 ready modules and these modules will then contain multiple functions 9673 03:14:27,510 --> 03:14:27,520 then contain multiple functions 9674 03:14:27,520 --> 03:14:30,389 then contain multiple functions and variables for that specific use case 9675 03:14:30,389 --> 03:14:30,399 and variables for that specific use case 9676 03:14:30,399 --> 03:14:32,630 and variables for that specific use case again if we take an example of a date 9677 03:14:32,630 --> 03:14:32,640 again if we take an example of a date 9678 03:14:32,640 --> 03:14:35,110 again if we take an example of a date so if you have an application that works 9679 03:14:35,110 --> 03:14:35,120 so if you have an application that works 9680 03:14:35,120 --> 03:14:36,469 so if you have an application that works with dates 9681 03:14:36,469 --> 03:14:36,479 with dates 9682 03:14:36,479 --> 03:14:38,870 with dates and times you have this module from a 9683 03:14:38,870 --> 03:14:38,880 and times you have this module from a 9684 03:14:38,880 --> 03:14:39,910 and times you have this module from a python 9685 03:14:39,910 --> 03:14:39,920 python 9686 03:14:39,920 --> 03:14:42,150 python that gives you a bunch of useful 9687 03:14:42,150 --> 03:14:42,160 that gives you a bunch of useful 9688 03:14:42,160 --> 03:14:43,030 that gives you a bunch of useful functions 9689 03:14:43,030 --> 03:14:43,040 functions 9690 03:14:43,040 --> 03:14:44,950 functions for working with dates and again this 9691 03:14:44,950 --> 03:14:44,960 for working with dates and again this 9692 03:14:44,960 --> 03:14:47,670 for working with dates and again this means you don't have to write this logic 9693 03:14:47,670 --> 03:14:47,680 means you don't have to write this logic 9694 03:14:47,680 --> 03:14:53,510 means you don't have to write this logic yourself but rather use the existing one 9695 03:14:53,510 --> 03:14:53,520 yourself but rather use the existing one 9696 03:14:53,520 --> 03:14:56,469 yourself but rather use the existing one so to give you some examples of modules 9697 03:14:56,469 --> 03:14:56,479 so to give you some examples of modules 9698 03:14:56,479 --> 03:14:56,790 so to give you some examples of modules that 9699 03:14:56,790 --> 03:14:56,800 that 9700 03:14:56,800 --> 03:14:59,190 that python provides us with for example if 9701 03:14:59,190 --> 03:14:59,200 python provides us with for example if 9702 03:14:59,200 --> 03:14:59,910 python provides us with for example if you want to 9703 03:14:59,910 --> 03:14:59,920 you want to 9704 03:14:59,920 --> 03:15:02,469 you want to work with operating system there is an 9705 03:15:02,469 --> 03:15:02,479 work with operating system there is an 9706 03:15:02,479 --> 03:15:02,950 work with operating system there is an os 9707 03:15:02,950 --> 03:15:02,960 os 9708 03:15:02,960 --> 03:15:06,070 os module so 9709 03:15:06,070 --> 03:15:06,080 module so 9710 03:15:06,080 --> 03:15:09,910 module so we can print out we can get the name 9711 03:15:09,910 --> 03:15:09,920 we can print out we can get the name 9712 03:15:09,920 --> 03:15:14,790 we can print out we can get the name of the os for example 9713 03:15:23,910 --> 03:15:23,920 and run and you see the name of the os 9714 03:15:23,920 --> 03:15:27,030 and run and you see the name of the os another useful module python offers is 9715 03:15:27,030 --> 03:15:27,040 another useful module python offers is 9716 03:15:27,040 --> 03:15:29,429 another useful module python offers is logging so if you want to use logging in 9717 03:15:29,429 --> 03:15:29,439 logging so if you want to use logging in 9718 03:15:29,439 --> 03:15:31,030 logging so if you want to use logging in your application 9719 03:15:31,030 --> 03:15:31,040 your application 9720 03:15:31,040 --> 03:15:33,429 your application the logging module gives you different 9721 03:15:33,429 --> 03:15:33,439 the logging module gives you different 9722 03:15:33,439 --> 03:15:34,550 the logging module gives you different functions to log 9723 03:15:34,550 --> 03:15:34,560 functions to log 9724 03:15:34,560 --> 03:15:38,229 functions to log an error message or warning etc 9725 03:15:38,229 --> 03:15:38,239 an error message or warning etc 9726 03:15:38,239 --> 03:15:41,190 an error message or warning etc as well as basically just configure how 9727 03:15:41,190 --> 03:15:41,200 as well as basically just configure how 9728 03:15:41,200 --> 03:15:42,790 as well as basically just configure how the login will look like 9729 03:15:42,790 --> 03:15:42,800 the login will look like 9730 03:15:42,800 --> 03:15:49,030 the login will look like again to see an example 9731 03:15:49,030 --> 03:15:49,040 again to see an example 9732 03:15:49,040 --> 03:15:51,269 again to see an example again it may look a little bit complex 9733 03:15:51,269 --> 03:15:51,279 again it may look a little bit complex 9734 03:15:51,279 --> 03:15:52,950 again it may look a little bit complex here but essentially 9735 03:15:52,950 --> 03:15:52,960 here but essentially 9736 03:15:52,960 --> 03:15:55,349 here but essentially just using the name of the module and 9737 03:15:55,349 --> 03:15:55,359 just using the name of the module and 9738 03:15:55,359 --> 03:15:56,870 just using the name of the module and then functions that 9739 03:15:56,870 --> 03:15:56,880 then functions that 9740 03:15:56,880 --> 03:15:59,110 then functions that it gives you obviously you need to know 9741 03:15:59,110 --> 03:15:59,120 it gives you obviously you need to know 9742 03:15:59,120 --> 03:16:00,229 it gives you obviously you need to know the functions 9743 03:16:00,229 --> 03:16:00,239 the functions 9744 03:16:00,239 --> 03:16:02,309 the functions and you need to know how to use them and 9745 03:16:02,309 --> 03:16:02,319 and you need to know how to use them and 9746 03:16:02,319 --> 03:16:04,150 and you need to know how to use them and you can get that information from 9747 03:16:04,150 --> 03:16:04,160 you can get that information from 9748 03:16:04,160 --> 03:16:05,429 you can get that information from documentation 9749 03:16:05,429 --> 03:16:05,439 documentation 9750 03:16:05,439 --> 03:16:08,550 documentation or if you're using pycharm 9751 03:16:08,550 --> 03:16:08,560 or if you're using pycharm 9752 03:16:08,560 --> 03:16:10,070 or if you're using pycharm it actually gives you all the 9753 03:16:10,070 --> 03:16:10,080 it actually gives you all the 9754 03:16:10,080 --> 03:16:11,910 it actually gives you all the information about these functions and 9755 03:16:11,910 --> 03:16:11,920 information about these functions and 9756 03:16:11,920 --> 03:16:12,630 information about these functions and the module 9757 03:16:12,630 --> 03:16:12,640 the module 9758 03:16:12,640 --> 03:16:15,349 the module if you just hover on it so you don't 9759 03:16:15,349 --> 03:16:15,359 if you just hover on it so you don't 9760 03:16:15,359 --> 03:16:16,229 if you just hover on it so you don't even need to 9761 03:16:16,229 --> 03:16:16,239 even need to 9762 03:16:16,239 --> 03:16:18,309 even need to google or check out the documentation 9763 03:16:18,309 --> 03:16:18,319 google or check out the documentation 9764 03:16:18,319 --> 03:16:20,229 google or check out the documentation and basically we're 9765 03:16:20,229 --> 03:16:20,239 and basically we're 9766 03:16:20,239 --> 03:16:22,309 and basically we're creating a logger and we're logging an 9767 03:16:22,309 --> 03:16:22,319 creating a logger and we're logging an 9768 03:16:22,319 --> 03:16:23,349 creating a logger and we're logging an error message 9769 03:16:23,349 --> 03:16:23,359 error message 9770 03:16:23,359 --> 03:16:25,830 error message so if i execute this now and here you 9771 03:16:25,830 --> 03:16:25,840 so if i execute this now and here you 9772 03:16:25,840 --> 03:16:26,469 so if i execute this now and here you see 9773 03:16:26,469 --> 03:16:26,479 see 9774 03:16:26,479 --> 03:16:29,830 see the output of the logger error happened 9775 03:16:29,830 --> 03:16:29,840 the output of the logger error happened 9776 03:16:29,840 --> 03:16:32,229 the output of the logger error happened in the app and logging in application is 9777 03:16:32,229 --> 03:16:32,239 in the app and logging in application is 9778 03:16:32,239 --> 03:16:33,110 in the app and logging in application is actually 9779 03:16:33,110 --> 03:16:33,120 actually 9780 03:16:33,120 --> 03:16:35,750 actually a very important feature so that's why 9781 03:16:35,750 --> 03:16:35,760 a very important feature so that's why 9782 03:16:35,760 --> 03:16:37,990 a very important feature so that's why logging module is available 9783 03:16:37,990 --> 03:16:38,000 logging module is available 9784 03:16:38,000 --> 03:16:41,269 logging module is available by default in python any use case 9785 03:16:41,269 --> 03:16:41,279 by default in python any use case 9786 03:16:41,279 --> 03:16:44,389 by default in python any use case in our application would be right here 9787 03:16:44,389 --> 03:16:44,399 in our application would be right here 9788 03:16:44,399 --> 03:16:44,870 in our application would be right here if an 9789 03:16:44,870 --> 03:16:44,880 if an 9790 03:16:44,880 --> 03:16:47,670 if an error happened for example instead of 9791 03:16:47,670 --> 03:16:47,680 error happened for example instead of 9792 03:16:47,680 --> 03:16:49,429 error happened for example instead of using a print basically just 9793 03:16:49,429 --> 03:16:49,439 using a print basically just 9794 03:16:49,439 --> 03:16:52,950 using a print basically just log and error so these were just 9795 03:16:52,950 --> 03:16:52,960 log and error so these were just 9796 03:16:52,960 --> 03:16:55,429 log and error so these were just some basic examples but as i said python 9797 03:16:55,429 --> 03:16:55,439 some basic examples but as i said python 9798 03:16:55,439 --> 03:16:56,150 some basic examples but as i said python comes 9799 03:16:56,150 --> 03:16:56,160 comes 9800 03:16:56,160 --> 03:16:58,630 comes with lots of very useful modules that 9801 03:16:58,630 --> 03:16:58,640 with lots of very useful modules that 9802 03:16:58,640 --> 03:16:59,510 with lots of very useful modules that you can 9803 03:16:59,510 --> 03:16:59,520 you can 9804 03:16:59,520 --> 03:17:01,990 you can use in your applications for different 9805 03:17:01,990 --> 03:17:02,000 use in your applications for different 9806 03:17:02,000 --> 03:17:03,030 use in your applications for different use cases 9807 03:17:03,030 --> 03:17:03,040 use cases 9808 03:17:03,040 --> 03:17:05,349 use cases and that of course makes your work 9809 03:17:05,349 --> 03:17:05,359 and that of course makes your work 9810 03:17:05,359 --> 03:17:06,150 and that of course makes your work easier 9811 03:17:06,150 --> 03:17:06,160 easier 9812 03:17:06,160 --> 03:17:07,830 easier because you can just use the logic 9813 03:17:07,830 --> 03:17:07,840 because you can just use the logic 9814 03:17:07,840 --> 03:17:09,510 because you can just use the logic instead of having to write it 9815 03:17:09,510 --> 03:17:09,520 instead of having to write it 9816 03:17:09,520 --> 03:17:13,030 instead of having to write it yourself in the modules that are part of 9817 03:17:13,030 --> 03:17:13,040 yourself in the modules that are part of 9818 03:17:13,040 --> 03:17:16,070 yourself in the modules that are part of python so that you can import them like 9819 03:17:16,070 --> 03:17:16,080 python so that you can import them like 9820 03:17:16,080 --> 03:17:16,790 python so that you can import them like this 9821 03:17:16,790 --> 03:17:16,800 this 9822 03:17:16,800 --> 03:17:19,910 this directly are called built-in modules we 9823 03:17:19,910 --> 03:17:19,920 directly are called built-in modules we 9824 03:17:19,920 --> 03:17:21,670 directly are called built-in modules we learned about built-in functions 9825 03:17:21,670 --> 03:17:21,680 learned about built-in functions 9826 03:17:21,680 --> 03:17:23,670 learned about built-in functions so these are the functions that python 9827 03:17:23,670 --> 03:17:23,680 so these are the functions that python 9828 03:17:23,680 --> 03:17:25,429 so these are the functions that python makes available to us 9829 03:17:25,429 --> 03:17:25,439 makes available to us 9830 03:17:25,439 --> 03:17:28,389 makes available to us directly and there are built-in modules 9831 03:17:28,389 --> 03:17:28,399 directly and there are built-in modules 9832 03:17:28,399 --> 03:17:29,670 directly and there are built-in modules that we get from python 9833 03:17:29,670 --> 03:17:29,680 that we get from python 9834 03:17:29,680 --> 03:17:32,870 that we get from python and by the way if you're wondering where 9835 03:17:32,870 --> 03:17:32,880 and by the way if you're wondering where 9836 03:17:32,880 --> 03:17:34,870 and by the way if you're wondering where this module actually comes from so where 9837 03:17:34,870 --> 03:17:34,880 this module actually comes from so where 9838 03:17:34,880 --> 03:17:36,389 this module actually comes from so where is the physical location 9839 03:17:36,389 --> 03:17:36,399 is the physical location 9840 03:17:36,399 --> 03:17:39,190 is the physical location on our machine or where this module 9841 03:17:39,190 --> 03:17:39,200 on our machine or where this module 9842 03:17:39,200 --> 03:17:40,070 on our machine or where this module files actually 9843 03:17:40,070 --> 03:17:40,080 files actually 9844 03:17:40,080 --> 03:17:43,349 files actually leave if you're using pycharm you can 9845 03:17:43,349 --> 03:17:43,359 leave if you're using pycharm you can 9846 03:17:43,359 --> 03:17:44,150 leave if you're using pycharm you can actually hover 9847 03:17:44,150 --> 03:17:44,160 actually hover 9848 03:17:44,160 --> 03:17:46,950 actually hover over it and hold down a control key or 9849 03:17:46,950 --> 03:17:46,960 over it and hold down a control key or 9850 03:17:46,960 --> 03:17:47,910 over it and hold down a control key or if you're a mac 9851 03:17:47,910 --> 03:17:47,920 if you're a mac 9852 03:17:47,920 --> 03:17:51,030 if you're a mac command key and click inside 9853 03:17:51,030 --> 03:17:51,040 command key and click inside 9854 03:17:51,040 --> 03:17:53,349 command key and click inside you see the file opens up which is the 9855 03:17:53,349 --> 03:17:53,359 you see the file opens up which is the 9856 03:17:53,359 --> 03:17:55,349 you see the file opens up which is the module the logging module 9857 03:17:55,349 --> 03:17:55,359 module the logging module 9858 03:17:55,359 --> 03:17:57,670 module the logging module since i said module is basically just a 9859 03:17:57,670 --> 03:17:57,680 since i said module is basically just a 9860 03:17:57,680 --> 03:17:59,269 since i said module is basically just a python file that has 9861 03:17:59,269 --> 03:17:59,279 python file that has 9862 03:17:59,279 --> 03:18:01,269 python file that has multiple functions variables etc 9863 03:18:01,269 --> 03:18:01,279 multiple functions variables etc 9864 03:18:01,279 --> 03:18:03,429 multiple functions variables etc available and you see right here 9865 03:18:03,429 --> 03:18:03,439 available and you see right here 9866 03:18:03,439 --> 03:18:06,550 available and you see right here on this top line the whole path 9867 03:18:06,550 --> 03:18:06,560 on this top line the whole path 9868 03:18:06,560 --> 03:18:08,790 on this top line the whole path for that python file so that's the 9869 03:18:08,790 --> 03:18:08,800 for that python file so that's the 9870 03:18:08,800 --> 03:18:10,150 for that python file so that's the location 9871 03:18:10,150 --> 03:18:10,160 location 9872 03:18:10,160 --> 03:18:12,950 location of that module file locally on my 9873 03:18:12,950 --> 03:18:12,960 of that module file locally on my 9874 03:18:12,960 --> 03:18:14,150 of that module file locally on my computer 9875 03:18:14,150 --> 03:18:14,160 computer 9876 03:18:14,160 --> 03:18:16,309 computer and inside this python file basically 9877 03:18:16,309 --> 03:18:16,319 and inside this python file basically 9878 03:18:16,319 --> 03:18:18,389 and inside this python file basically you again have python code 9879 03:18:18,389 --> 03:18:18,399 you again have python code 9880 03:18:18,399 --> 03:18:22,229 you again have python code and if we look for get logger function 9881 03:18:22,229 --> 03:18:22,239 and if we look for get logger function 9882 03:18:22,239 --> 03:18:26,630 and if we look for get logger function here like this 9883 03:18:30,229 --> 03:18:30,239 right here you will find the definition 9884 03:18:30,239 --> 03:18:32,630 right here you will find the definition of that function right so somebody 9885 03:18:32,630 --> 03:18:32,640 of that function right so somebody 9886 03:18:32,640 --> 03:18:34,790 of that function right so somebody implemented this function 9887 03:18:34,790 --> 03:18:34,800 implemented this function 9888 03:18:34,800 --> 03:18:38,950 implemented this function and called it get logger 9889 03:18:41,190 --> 03:18:41,200 and this is basically the logic all the 9890 03:18:41,200 --> 03:18:42,389 and this is basically the logic all the things that get 9891 03:18:42,389 --> 03:18:42,399 things that get 9892 03:18:42,399 --> 03:18:45,590 things that get executed behind the scenes and 9893 03:18:45,590 --> 03:18:45,600 executed behind the scenes and 9894 03:18:45,600 --> 03:18:48,550 executed behind the scenes and you as a user of python basically can 9895 03:18:48,550 --> 03:18:48,560 you as a user of python basically can 9896 03:18:48,560 --> 03:18:50,389 you as a user of python basically can use the name of the function 9897 03:18:50,389 --> 03:18:50,399 use the name of the function 9898 03:18:50,399 --> 03:18:54,309 use the name of the function and write your own programs with it 9899 03:18:54,309 --> 03:18:54,319 and write your own programs with it 9900 03:18:54,319 --> 03:18:58,469 and write your own programs with it and let's also look for error 9901 03:18:58,469 --> 03:18:58,479 and let's also look for error 9902 03:18:58,479 --> 03:19:00,550 and let's also look for error and there you go we have error function 9903 03:19:00,550 --> 03:19:00,560 and there you go we have error function 9904 03:19:00,560 --> 03:19:02,389 and there you go we have error function as well right here 9905 03:19:02,389 --> 03:19:02,399 as well right here 9906 03:19:02,399 --> 03:19:04,870 as well right here and obviously this is a more complex 9907 03:19:04,870 --> 03:19:04,880 and obviously this is a more complex 9908 03:19:04,880 --> 03:19:06,229 and obviously this is a more complex code here 9909 03:19:06,229 --> 03:19:06,239 code here 9910 03:19:06,239 --> 03:19:09,269 code here than what we write but just 9911 03:19:09,269 --> 03:19:09,279 than what we write but just 9912 03:19:09,279 --> 03:19:11,190 than what we write but just to give you an idea that this is 9913 03:19:11,190 --> 03:19:11,200 to give you an idea that this is 9914 03:19:11,200 --> 03:19:13,750 to give you an idea that this is actually a file on your machine 9915 03:19:13,750 --> 03:19:13,760 actually a file on your machine 9916 03:19:13,760 --> 03:19:16,150 actually a file on your machine that comes with the python version that 9917 03:19:16,150 --> 03:19:16,160 that comes with the python version that 9918 03:19:16,160 --> 03:19:16,950 that comes with the python version that you 9919 03:19:16,950 --> 03:19:16,960 you 9920 03:19:16,960 --> 03:19:20,229 you install locally and all the functions 9921 03:19:20,229 --> 03:19:20,239 install locally and all the functions 9922 03:19:20,239 --> 03:19:22,710 install locally and all the functions are defined already there by python 9923 03:19:22,710 --> 03:19:22,720 are defined already there by python 9924 03:19:22,720 --> 03:19:23,670 are defined already there by python developers 9925 03:19:23,670 --> 03:19:23,680 developers 9926 03:19:23,680 --> 03:19:26,469 developers and you can just use them like this 9927 03:19:26,469 --> 03:19:26,479 and you can just use them like this 9928 03:19:26,479 --> 03:19:27,670 and you can just use them like this without worrying about 9929 03:19:27,670 --> 03:19:27,680 without worrying about 9930 03:19:27,680 --> 03:19:30,950 without worrying about how the logic is actually implemented 9931 03:19:30,950 --> 03:19:30,960 how the logic is actually implemented 9932 03:19:30,960 --> 03:19:33,750 how the logic is actually implemented and another interesting thing is if i 9933 03:19:33,750 --> 03:19:33,760 and another interesting thing is if i 9934 03:19:33,760 --> 03:19:34,870 and another interesting thing is if i click here 9935 03:19:34,870 --> 03:19:34,880 click here 9936 03:19:34,880 --> 03:19:38,469 click here in this python 3.9 9937 03:19:38,469 --> 03:19:38,479 in this python 3.9 9938 03:19:38,479 --> 03:19:41,190 in this python 3.9 like this logging is basically one 9939 03:19:41,190 --> 03:19:41,200 like this logging is basically one 9940 03:19:41,200 --> 03:19:41,910 like this logging is basically one module 9941 03:19:41,910 --> 03:19:41,920 module 9942 03:19:41,920 --> 03:19:45,349 module that we used and here you will see 9943 03:19:45,349 --> 03:19:45,359 that we used and here you will see 9944 03:19:45,359 --> 03:19:48,309 that we used and here you will see the list of the complete list of all the 9945 03:19:48,309 --> 03:19:48,319 the list of the complete list of all the 9946 03:19:48,319 --> 03:19:49,670 the list of the complete list of all the built-in modules 9947 03:19:49,670 --> 03:19:49,680 built-in modules 9948 03:19:49,680 --> 03:19:52,550 built-in modules that you get from python so some of them 9949 03:19:52,550 --> 03:19:52,560 that you get from python so some of them 9950 03:19:52,560 --> 03:19:53,590 that you get from python so some of them are folders 9951 03:19:53,590 --> 03:19:53,600 are folders 9952 03:19:53,600 --> 03:19:56,630 are folders like logging for example email and bunch 9953 03:19:56,630 --> 03:19:56,640 like logging for example email and bunch 9954 03:19:56,640 --> 03:19:57,830 like logging for example email and bunch of other stuff 9955 03:19:57,830 --> 03:19:57,840 of other stuff 9956 03:19:57,840 --> 03:19:59,990 of other stuff and the operating system module for 9957 03:19:59,990 --> 03:20:00,000 and the operating system module for 9958 03:20:00,000 --> 03:20:01,110 and the operating system module for example that we used 9959 03:20:01,110 --> 03:20:01,120 example that we used 9960 03:20:01,120 --> 03:20:04,550 example that we used is a python file then you can find 9961 03:20:04,550 --> 03:20:04,560 is a python file then you can find 9962 03:20:04,560 --> 03:20:07,990 is a python file then you can find right here so these are the built-in 9963 03:20:07,990 --> 03:20:08,000 right here so these are the built-in 9964 03:20:08,000 --> 03:20:12,229 right here so these are the built-in modules 9965 03:20:14,070 --> 03:20:14,080 so now that we know what built-in 9966 03:20:14,080 --> 03:20:16,229 so now that we know what built-in modules are and how to use them 9967 03:20:16,229 --> 03:20:16,239 modules are and how to use them 9968 03:20:16,239 --> 03:20:19,190 modules are and how to use them let's actually see a realistic example 9969 03:20:19,190 --> 03:20:19,200 let's actually see a realistic example 9970 03:20:19,200 --> 03:20:19,510 let's actually see a realistic example and 9971 03:20:19,510 --> 03:20:19,520 and 9972 03:20:19,520 --> 03:20:21,590 and also write a little more interesting 9973 03:20:21,590 --> 03:20:21,600 also write a little more interesting 9974 03:20:21,600 --> 03:20:23,110 also write a little more interesting application using 9975 03:20:23,110 --> 03:20:23,120 application using 9976 03:20:23,120 --> 03:20:26,870 application using built-in module 9977 03:20:28,950 --> 03:20:28,960 so what i'm going to do is in my python 9978 03:20:28,960 --> 03:20:31,670 so what i'm going to do is in my python project i'm going to create a new file 9979 03:20:31,670 --> 03:20:31,680 project i'm going to create a new file 9980 03:20:31,680 --> 03:20:34,870 project i'm going to create a new file and i'm going to call this time to 9981 03:20:34,870 --> 03:20:34,880 and i'm going to call this time to 9982 03:20:34,880 --> 03:20:38,309 and i'm going to call this time to deadline dot pi y 9983 03:20:38,309 --> 03:20:38,319 deadline dot pi y 9984 03:20:38,319 --> 03:20:40,309 deadline dot pi y and we're going to write an application 9985 03:20:40,309 --> 03:20:40,319 and we're going to write an application 9986 03:20:40,319 --> 03:20:42,790 and we're going to write an application that basically accepts a user input 9987 03:20:42,790 --> 03:20:42,800 that basically accepts a user input 9988 03:20:42,800 --> 03:20:46,229 that basically accepts a user input of a goal and a date like a deadline 9989 03:20:46,229 --> 03:20:46,239 of a goal and a date like a deadline 9990 03:20:46,239 --> 03:20:46,710 of a goal and a date like a deadline date 9991 03:20:46,710 --> 03:20:46,720 date 9992 03:20:46,720 --> 03:20:48,790 date and then we're going to print out back 9993 03:20:48,790 --> 03:20:48,800 and then we're going to print out back 9994 03:20:48,800 --> 03:20:49,830 and then we're going to print out back to the user 9995 03:20:49,830 --> 03:20:49,840 to the user 9996 03:20:49,840 --> 03:20:52,229 to the user how much time it is remaining till that 9997 03:20:52,229 --> 03:20:52,239 how much time it is remaining till that 9998 03:20:52,239 --> 03:20:52,870 how much time it is remaining till that deadline 9999 03:20:52,870 --> 03:20:52,880 deadline 10000 03:20:52,880 --> 03:20:56,389 deadline and that deadline will be a date right 10001 03:20:56,389 --> 03:20:56,399 and that deadline will be a date right 10002 03:20:56,399 --> 03:20:58,950 and that deadline will be a date right some date in the future so that means 10003 03:20:58,950 --> 03:20:58,960 some date in the future so that means 10004 03:20:58,960 --> 03:21:00,950 some date in the future so that means that we're going to be working with 10005 03:21:00,950 --> 03:21:00,960 that we're going to be working with 10006 03:21:00,960 --> 03:21:04,389 that we're going to be working with dates 10007 03:21:07,030 --> 03:21:07,040 and in order to work with dates we are 10008 03:21:07,040 --> 03:21:07,830 and in order to work with dates we are going to need 10009 03:21:07,830 --> 03:21:07,840 going to need 10010 03:21:07,840 --> 03:21:11,190 going to need python's built-in module that allows us 10011 03:21:11,190 --> 03:21:11,200 python's built-in module that allows us 10012 03:21:11,200 --> 03:21:14,550 python's built-in module that allows us to call functions and do some processing 10013 03:21:14,550 --> 03:21:14,560 to call functions and do some processing 10014 03:21:14,560 --> 03:21:15,429 to call functions and do some processing and stuff 10015 03:21:15,429 --> 03:21:15,439 and stuff 10016 03:21:15,439 --> 03:21:18,870 and stuff on date values and that module 10017 03:21:18,870 --> 03:21:18,880 on date values and that module 10018 03:21:18,880 --> 03:21:22,150 on date values and that module is called date time so 10019 03:21:22,150 --> 03:21:22,160 is called date time so 10020 03:21:22,160 --> 03:21:25,830 is called date time so import date time 10021 03:21:25,830 --> 03:21:25,840 import date time 10022 03:21:25,840 --> 03:21:27,429 import date time so let's have that import statement 10023 03:21:27,429 --> 03:21:27,439 so let's have that import statement 10024 03:21:27,439 --> 03:21:29,349 so let's have that import statement right there and we're going to use it 10025 03:21:29,349 --> 03:21:29,359 right there and we're going to use it 10026 03:21:29,359 --> 03:21:31,269 right there and we're going to use it in our program so the first thing we 10027 03:21:31,269 --> 03:21:31,279 in our program so the first thing we 10028 03:21:31,279 --> 03:21:32,469 in our program so the first thing we want to do is 10029 03:21:32,469 --> 03:21:32,479 want to do is 10030 03:21:32,479 --> 03:21:35,429 want to do is let the user give us an input about 10031 03:21:35,429 --> 03:21:35,439 let the user give us an input about 10032 03:21:35,439 --> 03:21:36,550 let the user give us an input about their goal 10033 03:21:36,550 --> 03:21:36,560 their goal 10034 03:21:36,560 --> 03:21:41,349 their goal and a date or deadline for that goal 10035 03:21:41,349 --> 03:21:41,359 and a date or deadline for that goal 10036 03:21:41,359 --> 03:21:44,710 and a date or deadline for that goal so let's do that first 10037 03:21:44,710 --> 03:21:44,720 so let's do that first 10038 03:21:44,720 --> 03:21:46,950 so let's do that first we already know how to ask for user 10039 03:21:46,950 --> 03:21:46,960 we already know how to ask for user 10040 03:21:46,960 --> 03:21:47,750 we already know how to ask for user input 10041 03:21:47,750 --> 03:21:47,760 input 10042 03:21:47,760 --> 03:21:51,429 input with a message so we're gonna say enter 10043 03:21:51,429 --> 03:21:51,439 with a message so we're gonna say enter 10044 03:21:51,439 --> 03:21:56,070 with a message so we're gonna say enter your goal with a deadline 10045 03:21:56,070 --> 03:21:56,080 your goal with a deadline 10046 03:21:56,080 --> 03:22:00,150 your goal with a deadline separated by colon and we also know this 10047 03:22:00,150 --> 03:22:00,160 separated by colon and we also know this 10048 03:22:00,160 --> 03:22:01,670 separated by colon and we also know this already 10049 03:22:01,670 --> 03:22:01,680 already 10050 03:22:01,680 --> 03:22:04,630 already basically what we want to do is user to 10051 03:22:04,630 --> 03:22:04,640 basically what we want to do is user to 10052 03:22:04,640 --> 03:22:05,830 basically what we want to do is user to be able to 10053 03:22:05,830 --> 03:22:05,840 be able to 10054 03:22:05,840 --> 03:22:09,030 be able to enter their goal like learn python 10055 03:22:09,030 --> 03:22:09,040 enter their goal like learn python 10056 03:22:09,040 --> 03:22:12,229 enter their goal like learn python column and a date and let's say 10057 03:22:12,229 --> 03:22:12,239 column and a date and let's say 10058 03:22:12,239 --> 03:22:15,750 column and a date and let's say again this is totally up to us to decide 10059 03:22:15,750 --> 03:22:15,760 again this is totally up to us to decide 10060 03:22:15,760 --> 03:22:17,750 again this is totally up to us to decide we're the ones basically setting the 10061 03:22:17,750 --> 03:22:17,760 we're the ones basically setting the 10062 03:22:17,760 --> 03:22:20,870 we're the ones basically setting the rules here so let's say we want the date 10063 03:22:20,870 --> 03:22:20,880 rules here so let's say we want the date 10064 03:22:20,880 --> 03:22:24,630 rules here so let's say we want the date to be entered in following format 10065 03:22:24,630 --> 03:22:24,640 to be entered in following format 10066 03:22:24,640 --> 03:22:28,550 to be entered in following format day month 10067 03:22:28,550 --> 03:22:28,560 day month 10068 03:22:28,560 --> 03:22:31,910 day month and a full year like this 10069 03:22:31,910 --> 03:22:31,920 and a full year like this 10070 03:22:31,920 --> 03:22:33,670 and a full year like this so that's the format that we're looking 10071 03:22:33,670 --> 03:22:33,680 so that's the format that we're looking 10072 03:22:33,680 --> 03:22:36,469 so that's the format that we're looking for and this is how user 10073 03:22:36,469 --> 03:22:36,479 for and this is how user 10074 03:22:36,479 --> 03:22:39,349 for and this is how user should input the value otherwise with a 10075 03:22:39,349 --> 03:22:39,359 should input the value otherwise with a 10076 03:22:39,359 --> 03:22:42,229 should input the value otherwise with a different format it's not going to work 10077 03:22:42,229 --> 03:22:42,239 different format it's not going to work 10078 03:22:42,239 --> 03:22:44,630 different format it's not going to work so we're going to save that input value 10079 03:22:44,630 --> 03:22:44,640 so we're going to save that input value 10080 03:22:44,640 --> 03:22:45,670 so we're going to save that input value into a variable 10081 03:22:45,670 --> 03:22:45,680 into a variable 10082 03:22:45,680 --> 03:22:50,309 into a variable let's call it user input 10083 03:22:53,429 --> 03:22:53,439 so we have the user input let's do the 10084 03:22:53,439 --> 03:22:55,190 so we have the user input let's do the split again 10085 03:22:55,190 --> 03:22:55,200 split again 10086 03:22:55,200 --> 03:22:58,389 split again on a colon remember we have this whole 10087 03:22:58,389 --> 03:22:58,399 on a colon remember we have this whole 10088 03:22:58,399 --> 03:23:00,150 on a colon remember we have this whole thing as a string as one 10089 03:23:00,150 --> 03:23:00,160 thing as a string as one 10090 03:23:00,160 --> 03:23:02,790 thing as a string as one string so we want to split it into two 10091 03:23:02,790 --> 03:23:02,800 string so we want to split it into two 10092 03:23:02,800 --> 03:23:03,990 string so we want to split it into two parts 10093 03:23:03,990 --> 03:23:04,000 parts 10094 03:23:04,000 --> 03:23:05,590 parts so we have the goal here and the 10095 03:23:05,590 --> 03:23:05,600 so we have the goal here and the 10096 03:23:05,600 --> 03:23:07,510 so we have the goal here and the deadline and this will give 10097 03:23:07,510 --> 03:23:07,520 deadline and this will give 10098 03:23:07,520 --> 03:23:10,950 deadline and this will give us a list with those two values 10099 03:23:10,950 --> 03:23:10,960 us a list with those two values 10100 03:23:10,960 --> 03:23:15,670 us a list with those two values and let's call it input list 10101 03:23:15,670 --> 03:23:15,680 and let's call it input list 10102 03:23:15,680 --> 03:23:18,150 and let's call it input list and now from that list we can actually 10103 03:23:18,150 --> 03:23:18,160 and now from that list we can actually 10104 03:23:18,160 --> 03:23:19,190 and now from that list we can actually extract 10105 03:23:19,190 --> 03:23:19,200 extract 10106 03:23:19,200 --> 03:23:22,550 extract or get those individual values using 10107 03:23:22,550 --> 03:23:22,560 or get those individual values using 10108 03:23:22,560 --> 03:23:25,670 or get those individual values using a list syntax so accessing the elements 10109 03:23:25,670 --> 03:23:25,680 a list syntax so accessing the elements 10110 03:23:25,680 --> 03:23:27,030 a list syntax so accessing the elements from a list 10111 03:23:27,030 --> 03:23:27,040 from a list 10112 03:23:27,040 --> 03:23:29,670 from a list which is what we learned already using 10113 03:23:29,670 --> 03:23:29,680 which is what we learned already using 10114 03:23:29,680 --> 03:23:30,710 which is what we learned already using an index 10115 03:23:30,710 --> 03:23:30,720 an index 10116 03:23:30,720 --> 03:23:34,070 an index right so we have input list index 10117 03:23:34,070 --> 03:23:34,080 right so we have input list index 10118 03:23:34,080 --> 03:23:38,070 right so we have input list index 0 which is going to give us learn python 10119 03:23:38,070 --> 03:23:38,080 0 which is going to give us learn python 10120 03:23:38,080 --> 03:23:41,750 0 which is going to give us learn python and let's save it as a goal variable 10121 03:23:41,750 --> 03:23:41,760 and let's save it as a goal variable 10122 03:23:41,760 --> 03:23:44,150 and let's save it as a goal variable and let's create another variable which 10123 03:23:44,150 --> 03:23:44,160 and let's create another variable which 10124 03:23:44,160 --> 03:23:45,110 and let's create another variable which is going to be 10125 03:23:45,110 --> 03:23:45,120 is going to be 10126 03:23:45,120 --> 03:23:51,190 is going to be date let's call it deadline 10127 03:23:54,309 --> 03:23:54,319 and this will be the second 10128 03:23:54,319 --> 03:23:57,349 and this will be the second value in our list now 10129 03:23:57,349 --> 03:23:57,359 value in our list now 10130 03:23:57,359 --> 03:24:02,309 value in our list now let's actually print this out 10131 03:24:10,389 --> 03:24:10,399 now note that we are actually in a 10132 03:24:10,399 --> 03:24:12,950 now note that we are actually in a different file we're not in the main.pi 10133 03:24:12,950 --> 03:24:12,960 different file we're not in the main.pi 10134 03:24:12,960 --> 03:24:15,910 different file we're not in the main.pi anymore and we don't want to execute 10135 03:24:15,910 --> 03:24:15,920 anymore and we don't want to execute 10136 03:24:15,920 --> 03:24:16,710 anymore and we don't want to execute main 10137 03:24:16,710 --> 03:24:16,720 main 10138 03:24:16,720 --> 03:24:18,950 main python file instead we want to execute 10139 03:24:18,950 --> 03:24:18,960 python file instead we want to execute 10140 03:24:18,960 --> 03:24:20,469 python file instead we want to execute this one right here we basically just 10141 03:24:20,469 --> 03:24:20,479 this one right here we basically just 10142 03:24:20,479 --> 03:24:22,229 this one right here we basically just want to ignore everything else in this 10143 03:24:22,229 --> 03:24:22,239 want to ignore everything else in this 10144 03:24:22,239 --> 03:24:22,870 want to ignore everything else in this project 10145 03:24:22,870 --> 03:24:22,880 project 10146 03:24:22,880 --> 03:24:26,150 project so how do i go from main to this file 10147 03:24:26,150 --> 03:24:26,160 so how do i go from main to this file 10148 03:24:26,160 --> 03:24:27,269 so how do i go from main to this file execution 10149 03:24:27,269 --> 03:24:27,279 execution 10150 03:24:27,279 --> 03:24:30,070 execution very easy in this editor just to right 10151 03:24:30,070 --> 03:24:30,080 very easy in this editor just to right 10152 03:24:30,080 --> 03:24:31,030 very easy in this editor just to right click 10153 03:24:31,030 --> 03:24:31,040 click 10154 03:24:31,040 --> 03:24:34,070 click and you see here run time till deadline 10155 03:24:34,070 --> 03:24:34,080 and you see here run time till deadline 10156 03:24:34,080 --> 03:24:35,990 and you see here run time till deadline and i'm going to execute this everything 10157 03:24:35,990 --> 03:24:36,000 and i'm going to execute this everything 10158 03:24:36,000 --> 03:24:37,750 and i'm going to execute this everything else is ignored in the project we are 10159 03:24:37,750 --> 03:24:37,760 else is ignored in the project we are 10160 03:24:37,760 --> 03:24:39,670 else is ignored in the project we are basically just working on this one right 10161 03:24:39,670 --> 03:24:39,680 basically just working on this one right 10162 03:24:39,680 --> 03:24:40,469 basically just working on this one right here 10163 03:24:40,469 --> 03:24:40,479 here 10164 03:24:40,479 --> 03:24:42,389 here so enter your goal with the deadline 10165 03:24:42,389 --> 03:24:42,399 so enter your goal with the deadline 10166 03:24:42,399 --> 03:24:44,309 so enter your goal with the deadline separated by colon 10167 03:24:44,309 --> 03:24:44,319 separated by colon 10168 03:24:44,319 --> 03:24:47,510 separated by colon let's do that i'm going to do pi learn 10169 03:24:47,510 --> 03:24:47,520 let's do that i'm going to do pi learn 10170 03:24:47,520 --> 03:24:48,710 let's do that i'm going to do pi learn python 10171 03:24:48,710 --> 03:24:48,720 python 10172 03:24:48,720 --> 03:24:52,870 python colon and then 10173 03:24:56,469 --> 03:24:56,479 let's enter some date and 10174 03:24:56,479 --> 03:25:00,389 let's enter some date and enter and this is the output so we 10175 03:25:00,389 --> 03:25:00,399 enter and this is the output so we 10176 03:25:00,399 --> 03:25:02,070 enter and this is the output so we basically split that into 10177 03:25:02,070 --> 03:25:02,080 basically split that into 10178 03:25:02,080 --> 03:25:04,950 basically split that into two values and put it in a list right 10179 03:25:04,950 --> 03:25:04,960 two values and put it in a list right 10180 03:25:04,960 --> 03:25:05,830 two values and put it in a list right here 10181 03:25:05,830 --> 03:25:05,840 here 10182 03:25:05,840 --> 03:25:09,190 here and very important to note here that 10183 03:25:09,190 --> 03:25:09,200 and very important to note here that 10184 03:25:09,200 --> 03:25:12,389 and very important to note here that both of these elements in this list 10185 03:25:12,389 --> 03:25:12,399 both of these elements in this list 10186 03:25:12,399 --> 03:25:14,870 both of these elements in this list are strings because again user input is 10187 03:25:14,870 --> 03:25:14,880 are strings because again user input is 10188 03:25:14,880 --> 03:25:15,670 are strings because again user input is always 10189 03:25:15,670 --> 03:25:15,680 always 10190 03:25:15,680 --> 03:25:18,870 always interpreted as strings so this was a 10191 03:25:18,870 --> 03:25:18,880 interpreted as strings so this was a 10192 03:25:18,880 --> 03:25:21,670 interpreted as strings so this was a string and it was split into two strings 10193 03:25:21,670 --> 03:25:21,680 string and it was split into two strings 10194 03:25:21,680 --> 03:25:24,389 string and it was split into two strings which are learn python and this date 10195 03:25:24,389 --> 03:25:24,399 which are learn python and this date 10196 03:25:24,399 --> 03:25:25,030 which are learn python and this date here 10197 03:25:25,030 --> 03:25:25,040 here 10198 03:25:25,040 --> 03:25:28,309 here however we don't want date or deadline 10199 03:25:28,309 --> 03:25:28,319 however we don't want date or deadline 10200 03:25:28,319 --> 03:25:31,110 however we don't want date or deadline as a string we want deadline as a date 10201 03:25:31,110 --> 03:25:31,120 as a string we want deadline as a date 10202 03:25:31,120 --> 03:25:33,670 as a string we want deadline as a date and exactly for that functionality we 10203 03:25:33,670 --> 03:25:33,680 and exactly for that functionality we 10204 03:25:33,680 --> 03:25:34,229 and exactly for that functionality we need 10205 03:25:34,229 --> 03:25:34,239 need 10206 03:25:34,239 --> 03:25:37,190 need this date time module because we don't 10207 03:25:37,190 --> 03:25:37,200 this date time module because we don't 10208 03:25:37,200 --> 03:25:38,710 this date time module because we don't want to implement it ourselves 10209 03:25:38,710 --> 03:25:38,720 want to implement it ourselves 10210 03:25:38,720 --> 03:25:41,030 want to implement it ourselves we want python to give us a ready 10211 03:25:41,030 --> 03:25:41,040 we want python to give us a ready 10212 03:25:41,040 --> 03:25:41,830 we want python to give us a ready function 10213 03:25:41,830 --> 03:25:41,840 function 10214 03:25:41,840 --> 03:25:44,469 function from a module that will basically just 10215 03:25:44,469 --> 03:25:44,479 from a module that will basically just 10216 03:25:44,479 --> 03:25:46,229 from a module that will basically just let us convert this string 10217 03:25:46,229 --> 03:25:46,239 let us convert this string 10218 03:25:46,239 --> 03:25:49,510 let us convert this string into a date value and converting string 10219 03:25:49,510 --> 03:25:49,520 into a date value and converting string 10220 03:25:49,520 --> 03:25:53,269 into a date value and converting string to date is just one example usage of 10221 03:25:53,269 --> 03:25:53,279 to date is just one example usage of 10222 03:25:53,279 --> 03:25:55,910 to date is just one example usage of date time module but you can use this 10223 03:25:55,910 --> 03:25:55,920 date time module but you can use this 10224 03:25:55,920 --> 03:25:57,830 date time module but you can use this module to work with dates 10225 03:25:57,830 --> 03:25:57,840 module to work with dates 10226 03:25:57,840 --> 03:26:01,670 module to work with dates generally like creating new dates 10227 03:26:01,670 --> 03:26:01,680 generally like creating new dates 10228 03:26:01,680 --> 03:26:04,469 generally like creating new dates formatting the dates updating the value 10229 03:26:04,469 --> 03:26:04,479 formatting the dates updating the value 10230 03:26:04,479 --> 03:26:05,510 formatting the dates updating the value etc 10231 03:26:05,510 --> 03:26:05,520 etc 10232 03:26:05,520 --> 03:26:07,429 etc and we're gonna see some of those 10233 03:26:07,429 --> 03:26:07,439 and we're gonna see some of those 10234 03:26:07,439 --> 03:26:09,110 and we're gonna see some of those examples in this section 10235 03:26:09,110 --> 03:26:09,120 examples in this section 10236 03:26:09,120 --> 03:26:10,550 examples in this section now if you're learning this type of 10237 03:26:10,550 --> 03:26:10,560 now if you're learning this type of 10238 03:26:10,560 --> 03:26:12,229 now if you're learning this type of thing alone you don't have 10239 03:26:12,229 --> 03:26:12,239 thing alone you don't have 10240 03:26:12,239 --> 03:26:14,070 thing alone you don't have me basically teaching you and giving you 10241 03:26:14,070 --> 03:26:14,080 me basically teaching you and giving you 10242 03:26:14,080 --> 03:26:16,309 me basically teaching you and giving you an example the way you would do that 10243 03:26:16,309 --> 03:26:16,319 an example the way you would do that 10244 03:26:16,319 --> 03:26:18,150 an example the way you would do that is you would basically research and 10245 03:26:18,150 --> 03:26:18,160 is you would basically research and 10246 03:26:18,160 --> 03:26:20,710 is you would basically research and maybe google how this is done 10247 03:26:20,710 --> 03:26:20,720 maybe google how this is done 10248 03:26:20,720 --> 03:26:22,550 maybe google how this is done in python and you would basically see 10249 03:26:22,550 --> 03:26:22,560 in python and you would basically see 10250 03:26:22,560 --> 03:26:24,229 in python and you would basically see some examples 10251 03:26:24,229 --> 03:26:24,239 some examples 10252 03:26:24,239 --> 03:26:26,469 some examples of using this date time and what the 10253 03:26:26,469 --> 03:26:26,479 of using this date time and what the 10254 03:26:26,479 --> 03:26:28,389 of using this date time and what the name of this function is and how to use 10255 03:26:28,389 --> 03:26:28,399 name of this function is and how to use 10256 03:26:28,399 --> 03:26:29,269 name of this function is and how to use that 10257 03:26:29,269 --> 03:26:29,279 that 10258 03:26:29,279 --> 03:26:31,510 that as well as each module has its own 10259 03:26:31,510 --> 03:26:31,520 as well as each module has its own 10260 03:26:31,520 --> 03:26:33,190 as well as each module has its own documentation page 10261 03:26:33,190 --> 03:26:33,200 documentation page 10262 03:26:33,200 --> 03:26:35,990 documentation page where you can look up the syntax and 10263 03:26:35,990 --> 03:26:36,000 where you can look up the syntax and 10264 03:26:36,000 --> 03:26:37,429 where you can look up the syntax and usage examples 10265 03:26:37,429 --> 03:26:37,439 usage examples 10266 03:26:37,439 --> 03:26:39,349 usage examples because obviously you're not going to 10267 03:26:39,349 --> 03:26:39,359 because obviously you're not going to 10268 03:26:39,359 --> 03:26:41,030 because obviously you're not going to know how to do that 10269 03:26:41,030 --> 03:26:41,040 know how to do that 10270 03:26:41,040 --> 03:26:43,990 know how to do that by yourself so the way we convert a 10271 03:26:43,990 --> 03:26:44,000 by yourself so the way we convert a 10272 03:26:44,000 --> 03:26:44,469 by yourself so the way we convert a string 10273 03:26:44,469 --> 03:26:44,479 string 10274 03:26:44,479 --> 03:26:47,590 string into a date using this date 10275 03:26:47,590 --> 03:26:47,600 into a date using this date 10276 03:26:47,600 --> 03:26:52,309 into a date using this date time module is on this datetime module 10277 03:26:52,309 --> 03:26:52,319 time module is on this datetime module 10278 03:26:52,319 --> 03:26:55,590 time module is on this datetime module if i type in dot 10279 03:26:55,590 --> 03:26:55,600 if i type in dot 10280 03:26:55,600 --> 03:26:59,190 if i type in dot i will see a list of all the definitions 10281 03:26:59,190 --> 03:26:59,200 i will see a list of all the definitions 10282 03:26:59,200 --> 03:27:02,309 i will see a list of all the definitions that daytime module gives me right 10283 03:27:02,309 --> 03:27:02,319 that daytime module gives me right 10284 03:27:02,319 --> 03:27:05,830 that daytime module gives me right so i have date daytime time etc 10285 03:27:05,830 --> 03:27:05,840 so i have date daytime time etc 10286 03:27:05,840 --> 03:27:08,389 so i have date daytime time etc the one that we need is date time 10287 03:27:08,389 --> 03:27:08,399 the one that we need is date time 10288 03:27:08,399 --> 03:27:09,910 the one that we need is date time because the function 10289 03:27:09,910 --> 03:27:09,920 because the function 10290 03:27:09,920 --> 03:27:12,550 because the function that we need for conversion is inside 10291 03:27:12,550 --> 03:27:12,560 that we need for conversion is inside 10292 03:27:12,560 --> 03:27:15,110 that we need for conversion is inside that definition and don't be confused 10293 03:27:15,110 --> 03:27:15,120 that definition and don't be confused 10294 03:27:15,120 --> 03:27:16,950 that definition and don't be confused here because we have date time twice 10295 03:27:16,950 --> 03:27:16,960 here because we have date time twice 10296 03:27:16,960 --> 03:27:17,510 here because we have date time twice here 10297 03:27:17,510 --> 03:27:17,520 here 10298 03:27:17,520 --> 03:27:19,990 here the first one is a module and the second 10299 03:27:19,990 --> 03:27:20,000 the first one is a module and the second 10300 03:27:20,000 --> 03:27:22,229 the first one is a module and the second one is a definition in that module and 10301 03:27:22,229 --> 03:27:22,239 one is a definition in that module and 10302 03:27:22,239 --> 03:27:24,150 one is a definition in that module and we can actually check that as well 10303 03:27:24,150 --> 03:27:24,160 we can actually check that as well 10304 03:27:24,160 --> 03:27:27,510 we can actually check that as well so if i jump into this date time module 10305 03:27:27,510 --> 03:27:27,520 so if i jump into this date time module 10306 03:27:27,520 --> 03:27:31,269 so if i jump into this date time module and inside that if i look for 10307 03:27:31,269 --> 03:27:31,279 and inside that if i look for 10308 03:27:31,279 --> 03:27:34,790 and inside that if i look for date time again so right here you see 10309 03:27:34,790 --> 03:27:34,800 date time again so right here you see 10310 03:27:34,800 --> 03:27:35,190 date time again so right here you see this 10311 03:27:35,190 --> 03:27:35,200 this 10312 03:27:35,200 --> 03:27:38,309 this date time definition and on that daytime 10313 03:27:38,309 --> 03:27:38,319 date time definition and on that daytime 10314 03:27:38,319 --> 03:27:39,269 date time definition and on that daytime definition 10315 03:27:39,269 --> 03:27:39,279 definition 10316 03:27:39,279 --> 03:27:42,469 definition we have now functions that we can use 10317 03:27:42,469 --> 03:27:42,479 we have now functions that we can use 10318 03:27:42,479 --> 03:27:44,630 we have now functions that we can use and as you see this is not a function or 10319 03:27:44,630 --> 03:27:44,640 and as you see this is not a function or 10320 03:27:44,640 --> 03:27:45,510 and as you see this is not a function or variable 10321 03:27:45,510 --> 03:27:45,520 variable 10322 03:27:45,520 --> 03:27:47,510 variable it says class here which is another 10323 03:27:47,510 --> 03:27:47,520 it says class here which is another 10324 03:27:47,520 --> 03:27:49,030 it says class here which is another concept in programming 10325 03:27:49,030 --> 03:27:49,040 concept in programming 10326 03:27:49,040 --> 03:27:52,070 concept in programming we're gonna see later so just for now 10327 03:27:52,070 --> 03:27:52,080 we're gonna see later so just for now 10328 03:27:52,080 --> 03:27:54,870 we're gonna see later so just for now think about this as a container of 10329 03:27:54,870 --> 03:27:54,880 think about this as a container of 10330 03:27:54,880 --> 03:27:55,510 think about this as a container of functions 10331 03:27:55,510 --> 03:27:55,520 functions 10332 03:27:55,520 --> 03:27:58,710 functions and variables inside that module 10333 03:27:58,710 --> 03:27:58,720 and variables inside that module 10334 03:27:58,720 --> 03:28:01,110 and variables inside that module and that's why we have to access it like 10335 03:28:01,110 --> 03:28:01,120 and that's why we have to access it like 10336 03:28:01,120 --> 03:28:02,309 and that's why we have to access it like this 10337 03:28:02,309 --> 03:28:02,319 this 10338 03:28:02,319 --> 03:28:05,269 this and then on that daytime definition this 10339 03:28:05,269 --> 03:28:05,279 and then on that daytime definition this 10340 03:28:05,279 --> 03:28:06,070 and then on that daytime definition this class 10341 03:28:06,070 --> 03:28:06,080 class 10342 03:28:06,080 --> 03:28:08,710 class we now have functions that we can use to 10343 03:28:08,710 --> 03:28:08,720 we now have functions that we can use to 10344 03:28:08,720 --> 03:28:09,750 we now have functions that we can use to do the conversion 10345 03:28:09,750 --> 03:28:09,760 do the conversion 10346 03:28:09,760 --> 03:28:13,429 do the conversion so the function we need is called str 10347 03:28:13,429 --> 03:28:13,439 so the function we need is called str 10348 03:28:13,439 --> 03:28:16,950 so the function we need is called str so string p time and this function will 10349 03:28:16,950 --> 03:28:16,960 so string p time and this function will 10350 03:28:16,960 --> 03:28:18,229 so string p time and this function will take a string 10351 03:28:18,229 --> 03:28:18,239 take a string 10352 03:28:18,239 --> 03:28:20,229 take a string representation of a date and we'll 10353 03:28:20,229 --> 03:28:20,239 representation of a date and we'll 10354 03:28:20,239 --> 03:28:22,630 representation of a date and we'll convert it into a date format 10355 03:28:22,630 --> 03:28:22,640 convert it into a date format 10356 03:28:22,640 --> 03:28:26,309 convert it into a date format so our string 10357 03:28:26,309 --> 03:28:26,319 so our string 10358 03:28:26,319 --> 03:28:29,590 so our string representation is deadline and 10359 03:28:29,590 --> 03:28:29,600 representation is deadline and 10360 03:28:29,600 --> 03:28:32,150 representation is deadline and we need to pass in the second parameter 10361 03:28:32,150 --> 03:28:32,160 we need to pass in the second parameter 10362 03:28:32,160 --> 03:28:33,190 we need to pass in the second parameter because remember 10363 03:28:33,190 --> 03:28:33,200 because remember 10364 03:28:33,200 --> 03:28:36,550 because remember i said we basically decided that the 10365 03:28:36,550 --> 03:28:36,560 i said we basically decided that the 10366 03:28:36,560 --> 03:28:38,389 i said we basically decided that the date should be entered like this with 10367 03:28:38,389 --> 03:28:38,399 date should be entered like this with 10368 03:28:38,399 --> 03:28:41,110 date should be entered like this with points and a full year here 10369 03:28:41,110 --> 03:28:41,120 points and a full year here 10370 03:28:41,120 --> 03:28:43,190 points and a full year here and as you know there are lots of 10371 03:28:43,190 --> 03:28:43,200 and as you know there are lots of 10372 03:28:43,200 --> 03:28:45,750 and as you know there are lots of different formats and types for dates 10373 03:28:45,750 --> 03:28:45,760 different formats and types for dates 10374 03:28:45,760 --> 03:28:46,229 different formats and types for dates right 10375 03:28:46,229 --> 03:28:46,239 right 10376 03:28:46,239 --> 03:28:49,110 right depending on a country or a language or 10377 03:28:49,110 --> 03:28:49,120 depending on a country or a language or 10378 03:28:49,120 --> 03:28:50,550 depending on a country or a language or even within that language 10379 03:28:50,550 --> 03:28:50,560 even within that language 10380 03:28:50,560 --> 03:28:52,389 even within that language we basically have multiple different 10381 03:28:52,389 --> 03:28:52,399 we basically have multiple different 10382 03:28:52,399 --> 03:28:55,349 we basically have multiple different formats right we have formats 10383 03:28:55,349 --> 03:28:55,359 formats right we have formats 10384 03:28:55,359 --> 03:29:02,229 formats right we have formats like this or we could also have 10385 03:29:05,030 --> 03:29:05,040 a shorter version of the ear etc so we 10386 03:29:05,040 --> 03:29:07,349 a shorter version of the ear etc so we need to define here the format 10387 03:29:07,349 --> 03:29:07,359 need to define here the format 10388 03:29:07,359 --> 03:29:10,710 need to define here the format that we want python or this method here 10389 03:29:10,710 --> 03:29:10,720 that we want python or this method here 10390 03:29:10,720 --> 03:29:13,830 that we want python or this method here to use when converting this string into 10391 03:29:13,830 --> 03:29:13,840 to use when converting this string into 10392 03:29:13,840 --> 03:29:14,469 to use when converting this string into a date 10393 03:29:14,469 --> 03:29:14,479 a date 10394 03:29:14,479 --> 03:29:16,150 a date again because there are so many 10395 03:29:16,150 --> 03:29:16,160 again because there are so many 10396 03:29:16,160 --> 03:29:17,510 again because there are so many different formats available 10397 03:29:17,510 --> 03:29:17,520 different formats available 10398 03:29:17,520 --> 03:29:20,710 different formats available so what we have here is a day then we 10399 03:29:20,710 --> 03:29:20,720 so what we have here is a day then we 10400 03:29:20,720 --> 03:29:21,269 so what we have here is a day then we have a 10401 03:29:21,269 --> 03:29:21,279 have a 10402 03:29:21,279 --> 03:29:24,469 have a dot then we have a month again a dot 10403 03:29:24,469 --> 03:29:24,479 dot then we have a month again a dot 10404 03:29:24,479 --> 03:29:27,590 dot then we have a month again a dot and then we have an ear so this is kind 10405 03:29:27,590 --> 03:29:27,600 and then we have an ear so this is kind 10406 03:29:27,600 --> 03:29:28,309 and then we have an ear so this is kind of a 10407 03:29:28,309 --> 03:29:28,319 of a 10408 03:29:28,319 --> 03:29:31,429 of a main structure of a format however 10409 03:29:31,429 --> 03:29:31,439 main structure of a format however 10410 03:29:31,439 --> 03:29:33,190 main structure of a format however formats for dates have their own 10411 03:29:33,190 --> 03:29:33,200 formats for dates have their own 10412 03:29:33,200 --> 03:29:34,550 formats for dates have their own specific syntax 10413 03:29:34,550 --> 03:29:34,560 specific syntax 10414 03:29:34,560 --> 03:29:36,630 specific syntax and this is actually for all programming 10415 03:29:36,630 --> 03:29:36,640 and this is actually for all programming 10416 03:29:36,640 --> 03:29:38,710 and this is actually for all programming languages so what we need to do 10417 03:29:38,710 --> 03:29:38,720 languages so what we need to do 10418 03:29:38,720 --> 03:29:41,990 languages so what we need to do is put this percentage sign in front of 10419 03:29:41,990 --> 03:29:42,000 is put this percentage sign in front of 10420 03:29:42,000 --> 03:29:43,670 is put this percentage sign in front of every 10421 03:29:43,670 --> 03:29:43,680 every 10422 03:29:43,680 --> 03:29:46,469 every letter so again we have day month year 10423 03:29:46,469 --> 03:29:46,479 letter so again we have day month year 10424 03:29:46,479 --> 03:29:46,870 letter so again we have day month year and 10425 03:29:46,870 --> 03:29:46,880 and 10426 03:29:46,880 --> 03:29:48,469 and there is one more thing about this 10427 03:29:48,469 --> 03:29:48,479 there is one more thing about this 10428 03:29:48,479 --> 03:29:50,710 there is one more thing about this format this format right here 10429 03:29:50,710 --> 03:29:50,720 format this format right here 10430 03:29:50,720 --> 03:29:55,269 format this format right here matches 10431 03:29:58,550 --> 03:29:58,560 this date however we want the full date 10432 03:29:58,560 --> 03:29:59,269 this date however we want the full date not just 10433 03:29:59,269 --> 03:29:59,279 not just 10434 03:29:59,279 --> 03:30:02,229 not just the last two and the format for that 10435 03:30:02,229 --> 03:30:02,239 the last two and the format for that 10436 03:30:02,239 --> 03:30:03,910 the last two and the format for that would be a capital y 10437 03:30:03,910 --> 03:30:03,920 would be a capital y 10438 03:30:03,920 --> 03:30:05,590 would be a capital y again this is something that you would 10439 03:30:05,590 --> 03:30:05,600 again this is something that you would 10440 03:30:05,600 --> 03:30:07,190 again this is something that you would look up in the documentation 10441 03:30:07,190 --> 03:30:07,200 look up in the documentation 10442 03:30:07,200 --> 03:30:10,229 look up in the documentation of the module instead of knowing it by 10443 03:30:10,229 --> 03:30:10,239 of the module instead of knowing it by 10444 03:30:10,239 --> 03:30:13,190 of the module instead of knowing it by heart but just know that this type of 10445 03:30:13,190 --> 03:30:13,200 heart but just know that this type of 10446 03:30:13,200 --> 03:30:13,830 heart but just know that this type of formats 10447 03:30:13,830 --> 03:30:13,840 formats 10448 03:30:13,840 --> 03:30:16,309 formats are used when working with dates and 10449 03:30:16,309 --> 03:30:16,319 are used when working with dates and 10450 03:30:16,319 --> 03:30:18,309 are used when working with dates and this is not specific to python 10451 03:30:18,309 --> 03:30:18,319 this is not specific to python 10452 03:30:18,319 --> 03:30:20,070 this is not specific to python you will actually see something very 10453 03:30:20,070 --> 03:30:20,080 you will actually see something very 10454 03:30:20,080 --> 03:30:22,469 you will actually see something very similar in all the other different 10455 03:30:22,469 --> 03:30:22,479 similar in all the other different 10456 03:30:22,479 --> 03:30:25,750 similar in all the other different programming languages and that will 10457 03:30:25,750 --> 03:30:25,760 programming languages and that will 10458 03:30:25,760 --> 03:30:27,670 programming languages and that will do exactly what we want it will take 10459 03:30:27,670 --> 03:30:27,680 do exactly what we want it will take 10460 03:30:27,680 --> 03:30:29,590 do exactly what we want it will take this date here 10461 03:30:29,590 --> 03:30:29,600 this date here 10462 03:30:29,600 --> 03:30:33,750 this date here and give us a proper date format from it 10463 03:30:33,750 --> 03:30:33,760 and give us a proper date format from it 10464 03:30:33,760 --> 03:30:36,550 and give us a proper date format from it let's actually test this so i'm going to 10465 03:30:36,550 --> 03:30:36,560 let's actually test this so i'm going to 10466 03:30:36,560 --> 03:30:40,469 let's actually test this so i'm going to print this first 10467 03:30:43,670 --> 03:30:43,680 and i'm also going to print a type 10468 03:30:43,680 --> 03:30:46,550 and i'm also going to print a type a data type of that value so let's 10469 03:30:46,550 --> 03:30:46,560 a data type of that value so let's 10470 03:30:46,560 --> 03:30:56,229 a data type of that value so let's execute 10471 03:30:57,830 --> 03:30:57,840 i'm actually going to copy that so i 10472 03:30:57,840 --> 03:30:59,750 i'm actually going to copy that so i don't have to retype it over and over 10473 03:30:59,750 --> 03:30:59,760 don't have to retype it over and over 10474 03:30:59,760 --> 03:31:00,630 don't have to retype it over and over again 10475 03:31:00,630 --> 03:31:00,640 again 10476 03:31:00,640 --> 03:31:03,830 again and enter 10477 03:31:06,469 --> 03:31:06,479 and here you see we printed first of all 10478 03:31:06,479 --> 03:31:07,110 and here you see we printed first of all the 10479 03:31:07,110 --> 03:31:07,120 the 10480 03:31:07,120 --> 03:31:10,229 the date not a string and now this looks 10481 03:31:10,229 --> 03:31:10,239 date not a string and now this looks 10482 03:31:10,239 --> 03:31:10,790 date not a string and now this looks like a 10483 03:31:10,790 --> 03:31:10,800 like a 10484 03:31:10,800 --> 03:31:13,269 like a proper date and not a string anymore 10485 03:31:13,269 --> 03:31:13,279 proper date and not a string anymore 10486 03:31:13,279 --> 03:31:14,229 proper date and not a string anymore note the 10487 03:31:14,229 --> 03:31:14,239 note the 10488 03:31:14,239 --> 03:31:16,469 note the change in the format plus we have these 10489 03:31:16,469 --> 03:31:16,479 change in the format plus we have these 10490 03:31:16,479 --> 03:31:17,510 change in the format plus we have these zeros here 10491 03:31:17,510 --> 03:31:17,520 zeros here 10492 03:31:17,520 --> 03:31:19,670 zeros here which represent hours minutes and 10493 03:31:19,670 --> 03:31:19,680 which represent hours minutes and 10494 03:31:19,680 --> 03:31:20,550 which represent hours minutes and seconds 10495 03:31:20,550 --> 03:31:20,560 seconds 10496 03:31:20,560 --> 03:31:22,389 seconds we didn't set any of those so these are 10497 03:31:22,389 --> 03:31:22,399 we didn't set any of those so these are 10498 03:31:22,399 --> 03:31:24,870 we didn't set any of those so these are all zero and we have the date 10499 03:31:24,870 --> 03:31:24,880 all zero and we have the date 10500 03:31:24,880 --> 03:31:28,630 all zero and we have the date time type again note date time 10501 03:31:28,630 --> 03:31:28,640 time type again note date time 10502 03:31:28,640 --> 03:31:30,870 time type again note date time for a module name and date time of the 10503 03:31:30,870 --> 03:31:30,880 for a module name and date time of the 10504 03:31:30,880 --> 03:31:31,990 for a module name and date time of the class name 10505 03:31:31,990 --> 03:31:32,000 class name 10506 03:31:32,000 --> 03:31:35,269 class name so this is the type of our converted 10507 03:31:35,269 --> 03:31:35,279 so this is the type of our converted 10508 03:31:35,279 --> 03:31:37,910 so this is the type of our converted date and the reason why we needed to 10509 03:31:37,910 --> 03:31:37,920 date and the reason why we needed to 10510 03:31:37,920 --> 03:31:38,950 date and the reason why we needed to convert that 10511 03:31:38,950 --> 03:31:38,960 convert that 10512 03:31:38,960 --> 03:31:41,830 convert that string into a date is because we want to 10513 03:31:41,830 --> 03:31:41,840 string into a date is because we want to 10514 03:31:41,840 --> 03:31:42,870 string into a date is because we want to calculate 10515 03:31:42,870 --> 03:31:42,880 calculate 10516 03:31:42,880 --> 03:31:45,670 calculate how many days or how many hours are 10517 03:31:45,670 --> 03:31:45,680 how many days or how many hours are 10518 03:31:45,680 --> 03:31:46,389 how many days or how many hours are remaining 10519 03:31:46,389 --> 03:31:46,399 remaining 10520 03:31:46,399 --> 03:31:48,870 remaining until the deadline from now starting 10521 03:31:48,870 --> 03:31:48,880 until the deadline from now starting 10522 03:31:48,880 --> 03:31:49,429 until the deadline from now starting from 10523 03:31:49,429 --> 03:31:49,439 from 10524 03:31:49,439 --> 03:31:52,870 from today and to do that calculation 10525 03:31:52,870 --> 03:31:52,880 today and to do that calculation 10526 03:31:52,880 --> 03:31:55,990 today and to do that calculation we need to have date type because we 10527 03:31:55,990 --> 03:31:56,000 we need to have date type because we 10528 03:31:56,000 --> 03:31:57,510 we need to have date type because we can't do that on a string 10529 03:31:57,510 --> 03:31:57,520 can't do that on a string 10530 03:31:57,520 --> 03:32:00,469 can't do that on a string great so now we have our deadline 10531 03:32:00,469 --> 03:32:00,479 great so now we have our deadline 10532 03:32:00,479 --> 03:32:01,670 great so now we have our deadline represented as 10533 03:32:01,670 --> 03:32:01,680 represented as 10534 03:32:01,680 --> 03:32:04,469 represented as a date so let's actually assign this to 10535 03:32:04,469 --> 03:32:04,479 a date so let's actually assign this to 10536 03:32:04,479 --> 03:32:05,429 a date so let's actually assign this to a variable 10537 03:32:05,429 --> 03:32:05,439 a variable 10538 03:32:05,439 --> 03:32:08,950 a variable it's a deadline date 10539 03:32:08,950 --> 03:32:08,960 it's a deadline date 10540 03:32:08,960 --> 03:32:13,190 it's a deadline date like this and remove this 10541 03:32:13,190 --> 03:32:13,200 like this and remove this 10542 03:32:13,200 --> 03:32:18,710 like this and remove this and now we need to do a calculation 10543 03:32:23,269 --> 03:32:23,279 how many days from now 10544 03:32:23,279 --> 03:32:27,110 how many days from now till the deadline 10545 03:32:27,110 --> 03:32:27,120 till the deadline 10546 03:32:27,120 --> 03:32:30,309 till the deadline we already have the deadline we need now 10547 03:32:30,309 --> 03:32:30,319 we already have the deadline we need now 10548 03:32:30,319 --> 03:32:34,550 we already have the deadline we need now again now is or today is also a date 10549 03:32:34,550 --> 03:32:34,560 again now is or today is also a date 10550 03:32:34,560 --> 03:32:36,950 again now is or today is also a date and since we have this module date time 10551 03:32:36,950 --> 03:32:36,960 and since we have this module date time 10552 03:32:36,960 --> 03:32:37,590 and since we have this module date time we can 10553 03:32:37,590 --> 03:32:37,600 we can 10554 03:32:37,600 --> 03:32:40,070 we can also assume that this module will give 10555 03:32:40,070 --> 03:32:40,080 also assume that this module will give 10556 03:32:40,080 --> 03:32:41,590 also assume that this module will give us some function 10557 03:32:41,590 --> 03:32:41,600 us some function 10558 03:32:41,600 --> 03:32:45,510 us some function to tell us the date of today 10559 03:32:45,510 --> 03:32:45,520 to tell us the date of today 10560 03:32:45,520 --> 03:32:48,950 to tell us the date of today and if i do date time 10561 03:32:48,950 --> 03:32:48,960 and if i do date time 10562 03:32:48,960 --> 03:32:53,110 and if i do date time again daytime class 10563 03:32:53,110 --> 03:32:53,120 again daytime class 10564 03:32:53,120 --> 03:32:56,389 again daytime class and today you see that we have this 10565 03:32:56,389 --> 03:32:56,399 and today you see that we have this 10566 03:32:56,399 --> 03:32:57,750 and today you see that we have this function available 10567 03:32:57,750 --> 03:32:57,760 function available 10568 03:32:57,760 --> 03:33:00,870 function available and this will basically give us the date 10569 03:33:00,870 --> 03:33:00,880 and this will basically give us the date 10570 03:33:00,880 --> 03:33:03,670 and this will basically give us the date of today so depending obviously when you 10571 03:33:03,670 --> 03:33:03,680 of today so depending obviously when you 10572 03:33:03,680 --> 03:33:04,950 of today so depending obviously when you execute this program 10573 03:33:04,950 --> 03:33:04,960 execute this program 10574 03:33:04,960 --> 03:33:09,190 execute this program it will give you always the current date 10575 03:33:12,229 --> 03:33:12,239 so let's print it today 10576 03:33:12,239 --> 03:33:15,030 so let's print it today for me it's 7th of february so if i 10577 03:33:15,030 --> 03:33:15,040 for me it's 7th of february so if i 10578 03:33:15,040 --> 03:33:18,070 for me it's 7th of february so if i execute it now 10579 03:33:18,070 --> 03:33:18,080 execute it now 10580 03:33:18,080 --> 03:33:21,429 execute it now i'm going to enter this and today is 10581 03:33:21,429 --> 03:33:21,439 i'm going to enter this and today is 10582 03:33:21,439 --> 03:33:24,389 i'm going to enter this and today is 7th of february for me so if i execute 10583 03:33:24,389 --> 03:33:24,399 7th of february for me so if i execute 10584 03:33:24,399 --> 03:33:24,950 7th of february for me so if i execute this 10585 03:33:24,950 --> 03:33:24,960 this 10586 03:33:24,960 --> 03:33:30,469 this let's actually comment this out 10587 03:33:32,870 --> 03:33:32,880 here i have the date for today which is 10588 03:33:32,880 --> 03:33:34,950 here i have the date for today which is 7th of february 10589 03:33:34,950 --> 03:33:34,960 7th of february 10590 03:33:34,960 --> 03:33:37,670 7th of february plus the exact time it is now but we 10591 03:33:37,670 --> 03:33:37,680 plus the exact time it is now but we 10592 03:33:37,680 --> 03:33:39,349 plus the exact time it is now but we don't care about the hours and minutes 10593 03:33:39,349 --> 03:33:39,359 don't care about the hours and minutes 10594 03:33:39,359 --> 03:33:40,389 don't care about the hours and minutes and seconds 10595 03:33:40,389 --> 03:33:40,399 and seconds 10596 03:33:40,399 --> 03:33:45,670 and seconds we just care about the day 10597 03:33:49,590 --> 03:33:49,600 so that means we already have deadline 10598 03:33:49,600 --> 03:33:53,750 so that means we already have deadline and we have today let's also 10599 03:33:53,750 --> 03:33:53,760 and we have today let's also 10600 03:33:53,760 --> 03:34:01,269 and we have today let's also add it to a variable 10601 03:34:01,269 --> 03:34:01,279 add it to a variable 10602 03:34:01,279 --> 03:34:04,309 add it to a variable like this and now we can actually 10603 03:34:04,309 --> 03:34:04,319 like this and now we can actually 10604 03:34:04,319 --> 03:34:07,429 like this and now we can actually do the calculation calculation is 10605 03:34:07,429 --> 03:34:07,439 do the calculation calculation is 10606 03:34:07,439 --> 03:34:11,910 do the calculation calculation is super easy we just say deadline date 10607 03:34:11,910 --> 03:34:11,920 super easy we just say deadline date 10608 03:34:11,920 --> 03:34:14,870 super easy we just say deadline date minus today date and this will actually 10609 03:34:14,870 --> 03:34:14,880 minus today date and this will actually 10610 03:34:14,880 --> 03:34:15,990 minus today date and this will actually give us 10611 03:34:15,990 --> 03:34:16,000 give us 10612 03:34:16,000 --> 03:34:22,389 give us the difference between 10613 03:34:26,229 --> 03:34:26,239 or time difference between today and 10614 03:34:26,239 --> 03:34:29,910 or time difference between today and the deadline date in the future 10615 03:34:29,910 --> 03:34:29,920 the deadline date in the future 10616 03:34:29,920 --> 03:34:36,790 the deadline date in the future again let's actually try this out 10617 03:34:40,150 --> 03:34:40,160 and you see that so this is 12th of 10618 03:34:40,160 --> 03:34:43,510 and you see that so this is 12th of august for me today is 7th of february 10619 03:34:43,510 --> 03:34:43,520 august for me today is 7th of february 10620 03:34:43,520 --> 03:34:46,910 august for me today is 7th of february so the program calculated that there are 10621 03:34:46,910 --> 03:34:46,920 so the program calculated that there are 10622 03:34:46,920 --> 03:34:48,790 so the program calculated that there are 185 days 10623 03:34:48,790 --> 03:34:48,800 185 days 10624 03:34:48,800 --> 03:34:51,750 185 days until the time plus how many hours 10625 03:34:51,750 --> 03:34:51,760 until the time plus how many hours 10626 03:34:51,760 --> 03:34:52,469 until the time plus how many hours minutes 10627 03:34:52,469 --> 03:34:52,479 minutes 10628 03:34:52,479 --> 03:34:55,190 minutes seconds and milliseconds so that was a 10629 03:34:55,190 --> 03:34:55,200 seconds and milliseconds so that was a 10630 03:34:55,200 --> 03:34:57,190 seconds and milliseconds so that was a pretty easy calculation 10631 03:34:57,190 --> 03:34:57,200 pretty easy calculation 10632 03:34:57,200 --> 03:35:00,229 pretty easy calculation now what we want to do is 10633 03:35:00,229 --> 03:35:00,239 now what we want to do is 10634 03:35:00,239 --> 03:35:02,870 now what we want to do is tell the user some kind of message and 10635 03:35:02,870 --> 03:35:02,880 tell the user some kind of message and 10636 03:35:02,880 --> 03:35:04,550 tell the user some kind of message and we want the message to be 10637 03:35:04,550 --> 03:35:04,560 we want the message to be 10638 03:35:04,560 --> 03:35:07,269 we want the message to be dear user the time remaining until the 10639 03:35:07,269 --> 03:35:07,279 dear user the time remaining until the 10640 03:35:07,279 --> 03:35:07,990 dear user the time remaining until the deadline 10641 03:35:07,990 --> 03:35:08,000 deadline 10642 03:35:08,000 --> 03:35:11,670 deadline for your goal whatever the goal was is 10643 03:35:11,670 --> 03:35:11,680 for your goal whatever the goal was is 10644 03:35:11,680 --> 03:35:14,070 for your goal whatever the goal was is this so let's actually put that text and 10645 03:35:14,070 --> 03:35:14,080 this so let's actually put that text and 10646 03:35:14,080 --> 03:35:15,349 this so let's actually put that text and message together 10647 03:35:15,349 --> 03:35:15,359 message together 10648 03:35:15,359 --> 03:35:19,510 message together and bring it back to the user 10649 03:35:22,830 --> 03:35:22,840 so first i'm going to save it into a 10650 03:35:22,840 --> 03:35:24,710 so first i'm going to save it into a variable 10651 03:35:24,710 --> 03:35:24,720 variable 10652 03:35:24,720 --> 03:35:28,150 variable let's call it time 10653 03:35:28,150 --> 03:35:28,160 let's call it time 10654 03:35:28,160 --> 03:35:31,670 let's call it time till 10655 03:35:38,229 --> 03:35:38,239 and the message dear user 10656 03:35:38,239 --> 03:35:41,510 and the message dear user time remaining 10657 03:35:45,269 --> 03:35:45,279 for your goal and here we want to print 10658 03:35:45,279 --> 03:35:47,349 for your goal and here we want to print what the goal actually is and you 10659 03:35:47,349 --> 03:35:47,359 what the goal actually is and you 10660 03:35:47,359 --> 03:35:49,429 what the goal actually is and you remember how we format 10661 03:35:49,429 --> 03:35:49,439 remember how we format 10662 03:35:49,439 --> 03:35:52,950 remember how we format a string when we want to use a variable 10663 03:35:52,950 --> 03:35:52,960 a string when we want to use a variable 10664 03:35:52,960 --> 03:35:57,030 a string when we want to use a variable we put an f here and in curly braces now 10665 03:35:57,030 --> 03:35:57,040 we put an f here and in curly braces now 10666 03:35:57,040 --> 03:35:57,750 we put an f here and in curly braces now we can use 10667 03:35:57,750 --> 03:35:57,760 we can use 10668 03:35:57,760 --> 03:36:01,269 we can use variables or numbers or some other 10669 03:36:01,269 --> 03:36:01,279 variables or numbers or some other 10670 03:36:01,279 --> 03:36:02,309 variables or numbers or some other expressions 10671 03:36:02,309 --> 03:36:02,319 expressions 10672 03:36:02,319 --> 03:36:05,030 expressions which are not string so first of all 10673 03:36:05,030 --> 03:36:05,040 which are not string so first of all 10674 03:36:05,040 --> 03:36:06,229 which are not string so first of all we're printing back 10675 03:36:06,229 --> 03:36:06,239 we're printing back 10676 03:36:06,239 --> 03:36:08,950 we're printing back the goal so time remaining for your goal 10677 03:36:08,950 --> 03:36:08,960 the goal so time remaining for your goal 10678 03:36:08,960 --> 03:36:10,870 the goal so time remaining for your goal whatever goal they entered 10679 03:36:10,870 --> 03:36:10,880 whatever goal they entered 10680 03:36:10,880 --> 03:36:16,150 whatever goal they entered is time till 10681 03:36:27,750 --> 03:36:27,760 and let's give it some other value 10682 03:36:27,760 --> 03:36:30,870 and let's give it some other value like this and enter and here we have 10683 03:36:30,870 --> 03:36:30,880 like this and enter and here we have 10684 03:36:30,880 --> 03:36:34,070 like this and enter and here we have our message dear user time remaining for 10685 03:36:34,070 --> 03:36:34,080 our message dear user time remaining for 10686 03:36:34,080 --> 03:36:35,190 our message dear user time remaining for your goal 10687 03:36:35,190 --> 03:36:35,200 your goal 10688 03:36:35,200 --> 03:36:39,670 your goal learn python is 132 days 10689 03:36:39,670 --> 03:36:39,680 learn python is 132 days 10690 03:36:39,680 --> 03:36:42,870 learn python is 132 days and this many hours minutes etc 10691 03:36:42,870 --> 03:36:42,880 and this many hours minutes etc 10692 03:36:42,880 --> 03:36:45,190 and this many hours minutes etc now let's say we don't care about this 10693 03:36:45,190 --> 03:36:45,200 now let's say we don't care about this 10694 03:36:45,200 --> 03:36:46,950 now let's say we don't care about this whole thing here we just want to know 10695 03:36:46,950 --> 03:36:46,960 whole thing here we just want to know 10696 03:36:46,960 --> 03:36:47,590 whole thing here we just want to know how many 10697 03:36:47,590 --> 03:36:47,600 how many 10698 03:36:47,600 --> 03:36:50,550 how many days are remaining so how do we get rid 10699 03:36:50,550 --> 03:36:50,560 days are remaining so how do we get rid 10700 03:36:50,560 --> 03:36:50,870 days are remaining so how do we get rid of 10701 03:36:50,870 --> 03:36:50,880 of 10702 03:36:50,880 --> 03:36:54,389 of this part here again very easy 10703 03:36:54,389 --> 03:36:54,399 this part here again very easy 10704 03:36:54,399 --> 03:36:57,990 this part here again very easy and the time till if i do dot here 10705 03:36:57,990 --> 03:36:58,000 and the time till if i do dot here 10706 03:36:58,000 --> 03:37:01,110 and the time till if i do dot here i get a list of suggestions for 10707 03:37:01,110 --> 03:37:01,120 i get a list of suggestions for 10708 03:37:01,120 --> 03:37:03,349 i get a list of suggestions for functions or variables that i have 10709 03:37:03,349 --> 03:37:03,359 functions or variables that i have 10710 03:37:03,359 --> 03:37:04,150 functions or variables that i have available 10711 03:37:04,150 --> 03:37:04,160 available 10712 03:37:04,160 --> 03:37:07,030 available and one of them is days as you see here 10713 03:37:07,030 --> 03:37:07,040 and one of them is days as you see here 10714 03:37:07,040 --> 03:37:08,950 and one of them is days as you see here so if i click here 10715 03:37:08,950 --> 03:37:08,960 so if i click here 10716 03:37:08,960 --> 03:37:12,150 so if i click here and save and i'm going to reuse these 10717 03:37:12,150 --> 03:37:12,160 and save and i'm going to reuse these 10718 03:37:12,160 --> 03:37:13,110 and save and i'm going to reuse these inputs 10719 03:37:13,110 --> 03:37:13,120 inputs 10720 03:37:13,120 --> 03:37:16,389 inputs because i don't want to type and 10721 03:37:16,389 --> 03:37:16,399 because i don't want to type and 10722 03:37:16,399 --> 03:37:18,630 because i don't want to type and as you see we got rid of this whole 10723 03:37:18,630 --> 03:37:18,640 as you see we got rid of this whole 10724 03:37:18,640 --> 03:37:20,630 as you see we got rid of this whole thing here and we just have 10725 03:37:20,630 --> 03:37:20,640 thing here and we just have 10726 03:37:20,640 --> 03:37:28,790 thing here and we just have days and let's actually write days 10727 03:37:31,030 --> 03:37:31,040 and there you go we have a cleaner 10728 03:37:31,040 --> 03:37:32,150 and there you go we have a cleaner output now for 10729 03:37:32,150 --> 03:37:32,160 output now for 10730 03:37:32,160 --> 03:37:34,710 output now for our user and finally what if the 10731 03:37:34,710 --> 03:37:34,720 our user and finally what if the 10732 03:37:34,720 --> 03:37:35,990 our user and finally what if the deadline was 10733 03:37:35,990 --> 03:37:36,000 deadline was 10734 03:37:36,000 --> 03:37:39,190 deadline was just a couple of days in the future and 10735 03:37:39,190 --> 03:37:39,200 just a couple of days in the future and 10736 03:37:39,200 --> 03:37:40,950 just a couple of days in the future and the user wanted to know how many 10737 03:37:40,950 --> 03:37:40,960 the user wanted to know how many 10738 03:37:40,960 --> 03:37:43,670 the user wanted to know how many hours are remaining till that deadline 10739 03:37:43,670 --> 03:37:43,680 hours are remaining till that deadline 10740 03:37:43,680 --> 03:37:44,790 hours are remaining till that deadline we can do that 10741 03:37:44,790 --> 03:37:44,800 we can do that 10742 03:37:44,800 --> 03:37:47,990 we can do that by getting rid of these days and again 10743 03:37:47,990 --> 03:37:48,000 by getting rid of these days and again 10744 03:37:48,000 --> 03:37:51,110 by getting rid of these days and again type in dot and we have something called 10745 03:37:51,110 --> 03:37:51,120 type in dot and we have something called 10746 03:37:51,120 --> 03:37:53,349 type in dot and we have something called total seconds here which gives us the 10747 03:37:53,349 --> 03:37:53,359 total seconds here which gives us the 10748 03:37:53,359 --> 03:37:54,309 total seconds here which gives us the time different 10749 03:37:54,309 --> 03:37:54,319 time different 10750 03:37:54,319 --> 03:37:58,070 time different in total seconds and now we can 10751 03:37:58,070 --> 03:37:58,080 in total seconds and now we can 10752 03:37:58,080 --> 03:38:00,229 in total seconds and now we can reverse engineer and calculate the 10753 03:38:00,229 --> 03:38:00,239 reverse engineer and calculate the 10754 03:38:00,239 --> 03:38:01,590 reverse engineer and calculate the number of hours 10755 03:38:01,590 --> 03:38:01,600 number of hours 10756 03:38:01,600 --> 03:38:03,750 number of hours from this total seconds which is pretty 10757 03:38:03,750 --> 03:38:03,760 from this total seconds which is pretty 10758 03:38:03,760 --> 03:38:05,510 from this total seconds which is pretty easy 10759 03:38:05,510 --> 03:38:05,520 easy 10760 03:38:05,520 --> 03:38:08,790 easy like this calculate minutes and then 10761 03:38:08,790 --> 03:38:08,800 like this calculate minutes and then 10762 03:38:08,800 --> 03:38:11,510 like this calculate minutes and then calculate hours 10763 03:38:11,510 --> 03:38:11,520 calculate hours 10764 03:38:11,520 --> 03:38:16,469 calculate hours and i'm gonna execute this again 10765 03:38:20,309 --> 03:38:20,319 and here you see the number of hours 10766 03:38:20,319 --> 03:38:25,030 and here you see the number of hours with a decimal precision so we have 4450 10767 03:38:25,030 --> 03:38:25,040 with a decimal precision so we have 4450 10768 03:38:25,040 --> 03:38:27,030 with a decimal precision so we have 4450 hours point 10769 03:38:27,030 --> 03:38:27,040 hours point 10770 03:38:27,040 --> 03:38:29,269 hours point some fraction number here again we want 10771 03:38:29,269 --> 03:38:29,279 some fraction number here again we want 10772 03:38:29,279 --> 03:38:30,550 some fraction number here again we want to get rid of this 10773 03:38:30,550 --> 03:38:30,560 to get rid of this 10774 03:38:30,560 --> 03:38:33,590 to get rid of this extra stuff and as you see from the 10775 03:38:33,590 --> 03:38:33,600 extra stuff and as you see from the 10776 03:38:33,600 --> 03:38:34,309 extra stuff and as you see from the syntax 10777 03:38:34,309 --> 03:38:34,319 syntax 10778 03:38:34,319 --> 03:38:36,870 syntax it is actually a float number with a dot 10779 03:38:36,870 --> 03:38:36,880 it is actually a float number with a dot 10780 03:38:36,880 --> 03:38:37,670 it is actually a float number with a dot here 10781 03:38:37,670 --> 03:38:37,680 here 10782 03:38:37,680 --> 03:38:40,710 here so what we could do is basically convert 10783 03:38:40,710 --> 03:38:40,720 so what we could do is basically convert 10784 03:38:40,720 --> 03:38:41,830 so what we could do is basically convert this whole thing 10785 03:38:41,830 --> 03:38:41,840 this whole thing 10786 03:38:41,840 --> 03:38:45,030 this whole thing this float number into an integer so 10787 03:38:45,030 --> 03:38:45,040 this float number into an integer so 10788 03:38:45,040 --> 03:38:47,030 this float number into an integer so convert this whole thing into an integer 10789 03:38:47,030 --> 03:38:47,040 convert this whole thing into an integer 10790 03:38:47,040 --> 03:38:47,670 convert this whole thing into an integer using 10791 03:38:47,670 --> 03:38:47,680 using 10792 03:38:47,680 --> 03:38:51,110 using int function and we need this whole 10793 03:38:51,110 --> 03:38:51,120 int function and we need this whole 10794 03:38:51,120 --> 03:38:54,630 int function and we need this whole calculation here inside the int function 10795 03:38:54,630 --> 03:38:54,640 calculation here inside the int function 10796 03:38:54,640 --> 03:38:58,229 calculation here inside the int function and let's execute it again learn 10797 03:38:58,229 --> 03:38:58,239 and let's execute it again learn 10798 03:38:58,239 --> 03:39:01,189 and let's execute it again learn python and let's choose a date which is 10799 03:39:01,189 --> 03:39:01,199 python and let's choose a date which is 10800 03:39:01,199 --> 03:39:03,349 python and let's choose a date which is near 10801 03:39:03,349 --> 03:39:03,359 near 10802 03:39:03,359 --> 03:39:05,429 near and there you go we have a whole number 10803 03:39:05,429 --> 03:39:05,439 and there you go we have a whole number 10804 03:39:05,439 --> 03:39:06,870 and there you go we have a whole number 57 again 10805 03:39:06,870 --> 03:39:06,880 57 again 10806 03:39:06,880 --> 03:39:10,469 57 again cleaner output and as a code 10807 03:39:10,469 --> 03:39:10,479 cleaner output and as a code 10808 03:39:10,479 --> 03:39:11,750 cleaner output and as a code optimization 10809 03:39:11,750 --> 03:39:11,760 optimization 10810 03:39:11,760 --> 03:39:14,870 optimization we could take this whole thing out 10811 03:39:14,870 --> 03:39:14,880 we could take this whole thing out 10812 03:39:14,880 --> 03:39:18,790 we could take this whole thing out into a variable and call it hours 10813 03:39:18,790 --> 03:39:18,800 into a variable and call it hours 10814 03:39:18,800 --> 03:39:23,750 into a variable and call it hours till to make our code a little bit 10815 03:39:23,750 --> 03:39:23,760 till to make our code a little bit 10816 03:39:23,760 --> 03:39:24,469 till to make our code a little bit cleaner 10817 03:39:24,469 --> 03:39:24,479 cleaner 10818 03:39:24,479 --> 03:39:26,710 cleaner so now we have the whole program that 10819 03:39:26,710 --> 03:39:26,720 so now we have the whole program that 10820 03:39:26,720 --> 03:39:27,990 so now we have the whole program that takes user input 10821 03:39:27,990 --> 03:39:28,000 takes user input 10822 03:39:28,000 --> 03:39:31,110 takes user input and basically prints back to them how 10823 03:39:31,110 --> 03:39:31,120 and basically prints back to them how 10824 03:39:31,120 --> 03:39:31,830 and basically prints back to them how many 10825 03:39:31,830 --> 03:39:31,840 many 10826 03:39:31,840 --> 03:39:34,309 many hours are remaining till the deadline 10827 03:39:34,309 --> 03:39:34,319 hours are remaining till the deadline 10828 03:39:34,319 --> 03:39:35,590 hours are remaining till the deadline for their goal 10829 03:39:35,590 --> 03:39:35,600 for their goal 10830 03:39:35,600 --> 03:39:39,110 for their goal and for this program we used a date time 10831 03:39:39,110 --> 03:39:39,120 and for this program we used a date time 10832 03:39:39,120 --> 03:39:39,910 and for this program we used a date time module 10833 03:39:39,910 --> 03:39:39,920 module 10834 03:39:39,920 --> 03:39:42,870 module a built-in date time module from python 10835 03:39:42,870 --> 03:39:42,880 a built-in date time module from python 10836 03:39:42,880 --> 03:39:45,349 a built-in date time module from python and we also learned a new data type 10837 03:39:45,349 --> 03:39:45,359 and we also learned a new data type 10838 03:39:45,359 --> 03:39:48,309 and we also learned a new data type which is date time and as we learned 10839 03:39:48,309 --> 03:39:48,319 which is date time and as we learned 10840 03:39:48,319 --> 03:39:49,750 which is date time and as we learned from the module section 10841 03:39:49,750 --> 03:39:49,760 from the module section 10842 03:39:49,760 --> 03:39:52,070 from the module section we can actually optimize the import of 10843 03:39:52,070 --> 03:39:52,080 we can actually optimize the import of 10844 03:39:52,080 --> 03:39:53,030 we can actually optimize the import of the module because 10845 03:39:53,030 --> 03:39:53,040 the module because 10846 03:39:53,040 --> 03:39:55,590 the module because obviously we're just using the date time 10847 03:39:55,590 --> 03:39:55,600 obviously we're just using the date time 10848 03:39:55,600 --> 03:39:56,630 obviously we're just using the date time definition 10849 03:39:56,630 --> 03:39:56,640 definition 10850 03:39:56,640 --> 03:39:59,910 definition and nothing else from that module 10851 03:39:59,910 --> 03:39:59,920 and nothing else from that module 10852 03:39:59,920 --> 03:40:03,030 and nothing else from that module so what we could do is from date time 10853 03:40:03,030 --> 03:40:03,040 so what we could do is from date time 10854 03:40:03,040 --> 03:40:03,990 so what we could do is from date time module 10855 03:40:03,990 --> 03:40:04,000 module 10856 03:40:04,000 --> 03:40:07,750 module import date time definition 10857 03:40:07,750 --> 03:40:07,760 import date time definition 10858 03:40:07,760 --> 03:40:11,110 import date time definition which is a class in this case so 10859 03:40:11,110 --> 03:40:11,120 which is a class in this case so 10860 03:40:11,120 --> 03:40:13,510 which is a class in this case so now you don't need to use the module 10861 03:40:13,510 --> 03:40:13,520 now you don't need to use the module 10862 03:40:13,520 --> 03:40:14,309 now you don't need to use the module name 10863 03:40:14,309 --> 03:40:14,319 name 10864 03:40:14,319 --> 03:40:17,750 name so let's get rid of those and this could 10865 03:40:17,750 --> 03:40:17,760 so let's get rid of those and this could 10866 03:40:17,760 --> 03:40:18,389 so let's get rid of those and this could make 10867 03:40:18,389 --> 03:40:18,399 make 10868 03:40:18,399 --> 03:40:21,110 make the code cleaner as well as make the 10869 03:40:21,110 --> 03:40:21,120 the code cleaner as well as make the 10870 03:40:21,120 --> 03:40:23,030 the code cleaner as well as make the import more efficient because we're not 10871 03:40:23,030 --> 03:40:23,040 import more efficient because we're not 10872 03:40:23,040 --> 03:40:24,710 import more efficient because we're not importing the whole module even though 10873 03:40:24,710 --> 03:40:24,720 importing the whole module even though 10874 03:40:24,720 --> 03:40:29,750 importing the whole module even though we just need one definition from there 10875 03:40:31,910 --> 03:40:31,920 when you install python it comes with a 10876 03:40:31,920 --> 03:40:32,870 when you install python it comes with a set of 10877 03:40:32,870 --> 03:40:32,880 set of 10878 03:40:32,880 --> 03:40:36,070 set of modules that are built in into python 10879 03:40:36,070 --> 03:40:36,080 modules that are built in into python 10880 03:40:36,080 --> 03:40:39,110 modules that are built in into python however there are many more modules 10881 03:40:39,110 --> 03:40:39,120 however there are many more modules 10882 03:40:39,120 --> 03:40:42,229 however there are many more modules for other different use cases like web 10883 03:40:42,229 --> 03:40:42,239 for other different use cases like web 10884 03:40:42,239 --> 03:40:44,150 for other different use cases like web development or data science and machine 10885 03:40:44,150 --> 03:40:44,160 development or data science and machine 10886 03:40:44,160 --> 03:40:45,590 development or data science and machine learning etc 10887 03:40:45,590 --> 03:40:45,600 learning etc 10888 03:40:45,600 --> 03:40:48,229 learning etc that are not part of that installation 10889 03:40:48,229 --> 03:40:48,239 that are not part of that installation 10890 03:40:48,239 --> 03:40:49,510 that are not part of that installation and these are basically 10891 03:40:49,510 --> 03:40:49,520 and these are basically 10892 03:40:49,520 --> 03:40:52,229 and these are basically external modules not built-in modules 10893 03:40:52,229 --> 03:40:52,239 external modules not built-in modules 10894 03:40:52,239 --> 03:40:53,590 external modules not built-in modules that you have to 10895 03:40:53,590 --> 03:40:53,600 that you have to 10896 03:40:53,600 --> 03:40:56,389 that you have to install as you need and this makes sense 10897 03:40:56,389 --> 03:40:56,399 install as you need and this makes sense 10898 03:40:56,399 --> 03:40:58,150 install as you need and this makes sense because the built-in modules are the 10899 03:40:58,150 --> 03:40:58,160 because the built-in modules are the 10900 03:40:58,160 --> 03:40:59,189 because the built-in modules are the ones that 10901 03:40:59,189 --> 03:40:59,199 ones that 10902 03:40:59,199 --> 03:41:01,990 ones that most of python programs will probably 10903 03:41:01,990 --> 03:41:02,000 most of python programs will probably 10904 03:41:02,000 --> 03:41:02,710 most of python programs will probably need 10905 03:41:02,710 --> 03:41:02,720 need 10906 03:41:02,720 --> 03:41:05,110 need and depending on what specifically you 10907 03:41:05,110 --> 03:41:05,120 and depending on what specifically you 10908 03:41:05,120 --> 03:41:06,469 and depending on what specifically you are doing with your program 10909 03:41:06,469 --> 03:41:06,479 are doing with your program 10910 03:41:06,479 --> 03:41:08,309 are doing with your program whether you are developing a web 10911 03:41:08,309 --> 03:41:08,319 whether you are developing a web 10912 03:41:08,319 --> 03:41:10,389 whether you are developing a web application or creating some machine 10913 03:41:10,389 --> 03:41:10,399 application or creating some machine 10914 03:41:10,399 --> 03:41:11,030 application or creating some machine learning 10915 03:41:11,030 --> 03:41:11,040 learning 10916 03:41:11,040 --> 03:41:13,510 learning program you can then add and install 10917 03:41:13,510 --> 03:41:13,520 program you can then add and install 10918 03:41:13,520 --> 03:41:15,110 program you can then add and install them as you need 10919 03:41:15,110 --> 03:41:15,120 them as you need 10920 03:41:15,120 --> 03:41:17,750 them as you need and there are hundreds of such external 10921 03:41:17,750 --> 03:41:17,760 and there are hundreds of such external 10922 03:41:17,760 --> 03:41:18,550 and there are hundreds of such external modules 10923 03:41:18,550 --> 03:41:18,560 modules 10924 03:41:18,560 --> 03:41:21,030 modules for python out there and obviously it 10925 03:41:21,030 --> 03:41:21,040 for python out there and obviously it 10926 03:41:21,040 --> 03:41:22,309 for python out there and obviously it wouldn't be practical 10927 03:41:22,309 --> 03:41:22,319 wouldn't be practical 10928 03:41:22,319 --> 03:41:25,429 wouldn't be practical to have them all on your laptop when 10929 03:41:25,429 --> 03:41:25,439 to have them all on your laptop when 10930 03:41:25,439 --> 03:41:27,750 to have them all on your laptop when you're just gonna use maybe a handful of 10931 03:41:27,750 --> 03:41:27,760 you're just gonna use maybe a handful of 10932 03:41:27,760 --> 03:41:28,630 you're just gonna use maybe a handful of them right 10933 03:41:28,630 --> 03:41:28,640 them right 10934 03:41:28,640 --> 03:41:32,389 them right now if i need to install an additional 10935 03:41:32,389 --> 03:41:32,399 now if i need to install an additional 10936 03:41:32,399 --> 03:41:35,590 now if i need to install an additional module for example django for web 10937 03:41:35,590 --> 03:41:35,600 module for example django for web 10938 03:41:35,600 --> 03:41:36,630 module for example django for web development 10939 03:41:36,630 --> 03:41:36,640 development 10940 03:41:36,640 --> 03:41:38,870 development where do i find these modules and how do 10941 03:41:38,870 --> 03:41:38,880 where do i find these modules and how do 10942 03:41:38,880 --> 03:41:40,070 where do i find these modules and how do i install them 10943 03:41:40,070 --> 03:41:40,080 i install them 10944 03:41:40,080 --> 03:41:42,550 i install them python modules actually live in a module 10945 03:41:42,550 --> 03:41:42,560 python modules actually live in a module 10946 03:41:42,560 --> 03:41:43,510 python modules actually live in a module repository 10947 03:41:43,510 --> 03:41:43,520 repository 10948 03:41:43,520 --> 03:41:45,590 repository where you can find them and that module 10949 03:41:45,590 --> 03:41:45,600 where you can find them and that module 10950 03:41:45,600 --> 03:41:47,269 where you can find them and that module repository is called 10951 03:41:47,269 --> 03:41:47,279 repository is called 10952 03:41:47,279 --> 03:41:50,630 repository is called pipey so if i look for pipey 10953 03:41:50,630 --> 03:41:50,640 pipey so if i look for pipey 10954 03:41:50,640 --> 03:41:53,510 pipey so if i look for pipey right here you see the python package 10955 03:41:53,510 --> 03:41:53,520 right here you see the python package 10956 03:41:53,520 --> 03:41:54,790 right here you see the python package index 10957 03:41:54,790 --> 03:41:54,800 index 10958 03:41:54,800 --> 03:41:58,469 index if i click inside you can search for any 10959 03:41:58,469 --> 03:41:58,479 if i click inside you can search for any 10960 03:41:58,479 --> 03:42:01,830 if i click inside you can search for any module that you want to add or install 10961 03:42:01,830 --> 03:42:01,840 module that you want to add or install 10962 03:42:01,840 --> 03:42:04,790 module that you want to add or install additionally for your application and 10963 03:42:04,790 --> 03:42:04,800 additionally for your application and 10964 03:42:04,800 --> 03:42:06,070 additionally for your application and here you see this word 10965 03:42:06,070 --> 03:42:06,080 here you see this word 10966 03:42:06,080 --> 03:42:09,269 here you see this word package everywhere instead of a module 10967 03:42:09,269 --> 03:42:09,279 package everywhere instead of a module 10968 03:42:09,279 --> 03:42:11,110 package everywhere instead of a module so what is a package or what is the 10969 03:42:11,110 --> 03:42:11,120 so what is a package or what is the 10970 03:42:11,120 --> 03:42:12,309 so what is a package or what is the difference between 10971 03:42:12,309 --> 03:42:12,319 difference between 10972 03:42:12,319 --> 03:42:17,110 difference between package and a module 10973 03:42:20,070 --> 03:42:20,080 to give you a simple comparison module 10974 03:42:20,080 --> 03:42:21,110 to give you a simple comparison module is basically 10975 03:42:21,110 --> 03:42:21,120 is basically 10976 03:42:21,120 --> 03:42:23,830 is basically a python file like this one right here 10977 03:42:23,830 --> 03:42:23,840 a python file like this one right here 10978 03:42:23,840 --> 03:42:24,550 a python file like this one right here that has 10979 03:42:24,550 --> 03:42:24,560 that has 10980 03:42:24,560 --> 03:42:27,349 that has a name of that file right so we have an 10981 03:42:27,349 --> 03:42:27,359 a name of that file right so we have an 10982 03:42:27,359 --> 03:42:28,309 a name of that file right so we have an ssl 10983 03:42:28,309 --> 03:42:28,319 ssl 10984 03:42:28,319 --> 03:42:31,670 ssl module or the one that we used 10985 03:42:31,670 --> 03:42:31,680 module or the one that we used 10986 03:42:31,680 --> 03:42:34,950 module or the one that we used earlier we have this os module right 10987 03:42:34,950 --> 03:42:34,960 earlier we have this os module right 10988 03:42:34,960 --> 03:42:37,990 earlier we have this os module right so module is one python file that 10989 03:42:37,990 --> 03:42:38,000 so module is one python file that 10990 03:42:38,000 --> 03:42:39,830 so module is one python file that contains all these functions and 10991 03:42:39,830 --> 03:42:39,840 contains all these functions and 10992 03:42:39,840 --> 03:42:42,070 contains all these functions and variables that you can use 10993 03:42:42,070 --> 03:42:42,080 variables that you can use 10994 03:42:42,080 --> 03:42:45,349 variables that you can use package is a collection of modules 10995 03:42:45,349 --> 03:42:45,359 package is a collection of modules 10996 03:42:45,359 --> 03:42:48,950 package is a collection of modules so if we scroll up and logging 10997 03:42:48,950 --> 03:42:48,960 so if we scroll up and logging 10998 03:42:48,960 --> 03:42:52,309 so if we scroll up and logging is actually one our example 10999 03:42:52,309 --> 03:42:52,319 is actually one our example 11000 03:42:52,319 --> 03:42:56,070 is actually one our example so these are actually packages and 11001 03:42:56,070 --> 03:42:56,080 so these are actually packages and 11002 03:42:56,080 --> 03:42:58,790 so these are actually packages and again let's go to logging so package 11003 03:42:58,790 --> 03:42:58,800 again let's go to logging so package 11004 03:42:58,800 --> 03:43:00,150 again let's go to logging so package basically contains 11005 03:43:00,150 --> 03:43:00,160 basically contains 11006 03:43:00,160 --> 03:43:03,590 basically contains multiple python files and use it in the 11007 03:43:03,590 --> 03:43:03,600 multiple python files and use it in the 11008 03:43:03,600 --> 03:43:05,030 multiple python files and use it in the same way you basically 11009 03:43:05,030 --> 03:43:05,040 same way you basically 11010 03:43:05,040 --> 03:43:06,950 same way you basically import the functions and definitions 11011 03:43:06,950 --> 03:43:06,960 import the functions and definitions 11012 03:43:06,960 --> 03:43:08,229 import the functions and definitions from the module 11013 03:43:08,229 --> 03:43:08,239 from the module 11014 03:43:08,239 --> 03:43:10,229 from the module and as you see clearly the difference is 11015 03:43:10,229 --> 03:43:10,239 and as you see clearly the difference is 11016 03:43:10,239 --> 03:43:12,309 and as you see clearly the difference is that package 11017 03:43:12,309 --> 03:43:12,319 that package 11018 03:43:12,319 --> 03:43:14,630 that package is more structured so for example the 11019 03:43:14,630 --> 03:43:14,640 is more structured so for example the 11020 03:43:14,640 --> 03:43:16,950 is more structured so for example the code is not available in just one 11021 03:43:16,950 --> 03:43:16,960 code is not available in just one 11022 03:43:16,960 --> 03:43:19,830 code is not available in just one single python file but it's divided like 11023 03:43:19,830 --> 03:43:19,840 single python file but it's divided like 11024 03:43:19,840 --> 03:43:20,229 single python file but it's divided like this 11025 03:43:20,229 --> 03:43:20,239 this 11026 03:43:20,239 --> 03:43:22,790 this in our case we have two python files and 11027 03:43:22,790 --> 03:43:22,800 in our case we have two python files and 11028 03:43:22,800 --> 03:43:23,429 in our case we have two python files and package 11029 03:43:23,429 --> 03:43:23,439 package 11030 03:43:23,439 --> 03:43:26,870 package always has this init python file 11031 03:43:26,870 --> 03:43:26,880 always has this init python file 11032 03:43:26,880 --> 03:43:29,910 always has this init python file and this file basically differentiates a 11033 03:43:29,910 --> 03:43:29,920 and this file basically differentiates a 11034 03:43:29,920 --> 03:43:31,110 and this file basically differentiates a normal folder 11035 03:43:31,110 --> 03:43:31,120 normal folder 11036 03:43:31,120 --> 03:43:33,349 normal folder like we have right here with bunch of 11037 03:43:33,349 --> 03:43:33,359 like we have right here with bunch of 11038 03:43:33,359 --> 03:43:34,389 like we have right here with bunch of python files 11039 03:43:34,389 --> 03:43:34,399 python files 11040 03:43:34,399 --> 03:43:37,670 python files from an actual package with python files 11041 03:43:37,670 --> 03:43:37,680 from an actual package with python files 11042 03:43:37,680 --> 03:43:40,070 from an actual package with python files so that's the difference between modules 11043 03:43:40,070 --> 03:43:40,080 so that's the difference between modules 11044 03:43:40,080 --> 03:43:41,510 so that's the difference between modules and packages 11045 03:43:41,510 --> 03:43:41,520 and packages 11046 03:43:41,520 --> 03:43:44,950 and packages and many external modules basically that 11047 03:43:44,950 --> 03:43:44,960 and many external modules basically that 11048 03:43:44,960 --> 03:43:46,710 and many external modules basically that we want to use in our projects are 11049 03:43:46,710 --> 03:43:46,720 we want to use in our projects are 11050 03:43:46,720 --> 03:43:48,870 we want to use in our projects are actually packages so basically package 11051 03:43:48,870 --> 03:43:48,880 actually packages so basically package 11052 03:43:48,880 --> 03:43:49,349 actually packages so basically package is a 11053 03:43:49,349 --> 03:43:49,359 is a 11054 03:43:49,359 --> 03:43:51,510 is a good way to define some hierarchy and 11055 03:43:51,510 --> 03:43:51,520 good way to define some hierarchy and 11056 03:43:51,520 --> 03:43:53,110 good way to define some hierarchy and structure for your modules 11057 03:43:53,110 --> 03:43:53,120 structure for your modules 11058 03:43:53,120 --> 03:43:55,349 structure for your modules and kind of group them together so 11059 03:43:55,349 --> 03:43:55,359 and kind of group them together so 11060 03:43:55,359 --> 03:43:56,710 and kind of group them together so that's why you see 11061 03:43:56,710 --> 03:43:56,720 that's why you see 11062 03:43:56,720 --> 03:44:00,229 that's why you see package here as a name instead of module 11063 03:44:00,229 --> 03:44:00,239 package here as a name instead of module 11064 03:44:00,239 --> 03:44:02,070 package here as a name instead of module so now that we know the difference let's 11065 03:44:02,070 --> 03:44:02,080 so now that we know the difference let's 11066 03:44:02,080 --> 03:44:03,429 so now that we know the difference let's actually search 11067 03:44:03,429 --> 03:44:03,439 actually search 11068 03:44:03,439 --> 03:44:06,550 actually search for a package for our project so for 11069 03:44:06,550 --> 03:44:06,560 for a package for our project so for 11070 03:44:06,560 --> 03:44:09,189 for a package for our project so for example if i type here 11071 03:44:09,189 --> 03:44:09,199 example if i type here 11072 03:44:09,199 --> 03:44:13,030 example if i type here django you see django packages that we 11073 03:44:13,030 --> 03:44:13,040 django you see django packages that we 11074 03:44:13,040 --> 03:44:13,750 django you see django packages that we can 11075 03:44:13,750 --> 03:44:13,760 can 11076 03:44:13,760 --> 03:44:18,469 can use from here we also have numpy 11077 03:44:18,469 --> 03:44:18,479 use from here we also have numpy 11078 03:44:18,479 --> 03:44:21,910 use from here we also have numpy and so on however in programming when 11079 03:44:21,910 --> 03:44:21,920 and so on however in programming when 11080 03:44:21,920 --> 03:44:24,070 and so on however in programming when working with and using these external 11081 03:44:24,070 --> 03:44:24,080 working with and using these external 11082 03:44:24,080 --> 03:44:26,389 working with and using these external packages a typical example would be 11083 03:44:26,389 --> 03:44:26,399 packages a typical example would be 11084 03:44:26,399 --> 03:44:26,870 packages a typical example would be where 11085 03:44:26,870 --> 03:44:26,880 where 11086 03:44:26,880 --> 03:44:29,990 where you need to implement some logic for 11087 03:44:29,990 --> 03:44:30,000 you need to implement some logic for 11088 03:44:30,000 --> 03:44:31,349 you need to implement some logic for example you want 11089 03:44:31,349 --> 03:44:31,359 example you want 11090 03:44:31,359 --> 03:44:33,349 example you want to write a program that basically talks 11091 03:44:33,349 --> 03:44:33,359 to write a program that basically talks 11092 03:44:33,359 --> 03:44:35,189 to write a program that basically talks to aws maybe 11093 03:44:35,189 --> 03:44:35,199 to aws maybe 11094 03:44:35,199 --> 03:44:37,670 to aws maybe and you don't know exactly the name of 11095 03:44:37,670 --> 03:44:37,680 and you don't know exactly the name of 11096 03:44:37,680 --> 03:44:38,710 and you don't know exactly the name of that package 11097 03:44:38,710 --> 03:44:38,720 that package 11098 03:44:38,720 --> 03:44:41,510 that package but you know what you're looking for so 11099 03:44:41,510 --> 03:44:41,520 but you know what you're looking for so 11100 03:44:41,520 --> 03:44:42,229 but you know what you're looking for so in this case 11101 03:44:42,229 --> 03:44:42,239 in this case 11102 03:44:42,239 --> 03:44:44,309 in this case instead of the exact name you would 11103 03:44:44,309 --> 03:44:44,319 instead of the exact name you would 11104 03:44:44,319 --> 03:44:46,389 instead of the exact name you would actually type in here in the search 11105 03:44:46,389 --> 03:44:46,399 actually type in here in the search 11106 03:44:46,399 --> 03:44:47,429 actually type in here in the search projects box 11107 03:44:47,429 --> 03:44:47,439 projects box 11108 03:44:47,439 --> 03:44:50,070 projects box a description of what you're looking for 11109 03:44:50,070 --> 03:44:50,080 a description of what you're looking for 11110 03:44:50,080 --> 03:44:51,830 a description of what you're looking for so let's say we're looking for 11111 03:44:51,830 --> 03:44:51,840 so let's say we're looking for 11112 03:44:51,840 --> 03:44:55,990 so let's say we're looking for an aws api package right 11113 03:44:55,990 --> 03:44:56,000 an aws api package right 11114 03:44:56,000 --> 03:44:57,990 an aws api package right something that will allow us to connect 11115 03:44:57,990 --> 03:44:58,000 something that will allow us to connect 11116 03:44:58,000 --> 03:45:00,309 something that will allow us to connect to the aws api 11117 03:45:00,309 --> 03:45:00,319 to the aws api 11118 03:45:00,319 --> 03:45:03,510 to the aws api and as you see here we get a list of 11119 03:45:03,510 --> 03:45:03,520 and as you see here we get a list of 11120 03:45:03,520 --> 03:45:05,750 and as you see here we get a list of different packages for that to choose 11121 03:45:05,750 --> 03:45:05,760 different packages for that to choose 11122 03:45:05,760 --> 03:45:06,790 different packages for that to choose from 11123 03:45:06,790 --> 03:45:06,800 from 11124 03:45:06,800 --> 03:45:10,150 from so basically pipey is a repository 11125 03:45:10,150 --> 03:45:10,160 so basically pipey is a repository 11126 03:45:10,160 --> 03:45:12,469 so basically pipey is a repository or storage for all of those modules and 11127 03:45:12,469 --> 03:45:12,479 or storage for all of those modules and 11128 03:45:12,479 --> 03:45:13,510 or storage for all of those modules and packages 11129 03:45:13,510 --> 03:45:13,520 packages 11130 03:45:13,520 --> 03:45:15,590 packages and people can also publish their own 11131 03:45:15,590 --> 03:45:15,600 and people can also publish their own 11132 03:45:15,600 --> 03:45:17,670 and people can also publish their own libraries like individual developers for 11133 03:45:17,670 --> 03:45:17,680 libraries like individual developers for 11134 03:45:17,680 --> 03:45:18,710 libraries like individual developers for example 11135 03:45:18,710 --> 03:45:18,720 example 11136 03:45:18,720 --> 03:45:20,870 example they can publish their own packages and 11137 03:45:20,870 --> 03:45:20,880 they can publish their own packages and 11138 03:45:20,880 --> 03:45:22,229 they can publish their own packages and modules there 11139 03:45:22,229 --> 03:45:22,239 modules there 11140 03:45:22,239 --> 03:45:23,990 modules there and make it available for other 11141 03:45:23,990 --> 03:45:24,000 and make it available for other 11142 03:45:24,000 --> 03:45:25,269 and make it available for other programmers to use 11143 03:45:25,269 --> 03:45:25,279 programmers to use 11144 03:45:25,279 --> 03:45:27,189 programmers to use and that's one reason why large 11145 03:45:27,189 --> 03:45:27,199 and that's one reason why large 11146 03:45:27,199 --> 03:45:28,389 and that's one reason why large community is 11147 03:45:28,389 --> 03:45:28,399 community is 11148 03:45:28,399 --> 03:45:30,710 community is so great for a programming language 11149 03:45:30,710 --> 03:45:30,720 so great for a programming language 11150 03:45:30,720 --> 03:45:31,910 so great for a programming language because then you can make 11151 03:45:31,910 --> 03:45:31,920 because then you can make 11152 03:45:31,920 --> 03:45:35,510 because then you can make use of all these modules and packages 11153 03:45:35,510 --> 03:45:35,520 use of all these modules and packages 11154 03:45:35,520 --> 03:45:37,349 use of all these modules and packages that others in the community have 11155 03:45:37,349 --> 03:45:37,359 that others in the community have 11156 03:45:37,359 --> 03:45:39,269 that others in the community have developed so for any kind of 11157 03:45:39,269 --> 03:45:39,279 developed so for any kind of 11158 03:45:39,279 --> 03:45:40,550 developed so for any kind of functionality you need in your 11159 03:45:40,550 --> 03:45:40,560 functionality you need in your 11160 03:45:40,560 --> 03:45:41,590 functionality you need in your application 11161 03:45:41,590 --> 03:45:41,600 application 11162 03:45:41,600 --> 03:45:44,870 application you could imagine that there is a module 11163 03:45:44,870 --> 03:45:44,880 you could imagine that there is a module 11164 03:45:44,880 --> 03:45:47,670 you could imagine that there is a module or package that helps you do exactly 11165 03:45:47,670 --> 03:45:47,680 or package that helps you do exactly 11166 03:45:47,680 --> 03:45:51,670 or package that helps you do exactly that 11167 03:45:54,309 --> 03:45:54,319 now let's say i need a django package 11168 03:45:54,319 --> 03:45:55,110 now let's say i need a django package for my 11169 03:45:55,110 --> 03:45:55,120 for my 11170 03:45:55,120 --> 03:45:57,830 for my web application so first i find the 11171 03:45:57,830 --> 03:45:57,840 web application so first i find the 11172 03:45:57,840 --> 03:45:58,870 web application so first i find the package 11173 03:45:58,870 --> 03:45:58,880 package 11174 03:45:58,880 --> 03:46:01,189 package and now i can actually check some of the 11175 03:46:01,189 --> 03:46:01,199 and now i can actually check some of the 11176 03:46:01,199 --> 03:46:03,990 and now i can actually check some of the documentation for that specific package 11177 03:46:03,990 --> 03:46:04,000 documentation for that specific package 11178 03:46:04,000 --> 03:46:07,189 documentation for that specific package so if i click inside i see some 11179 03:46:07,189 --> 03:46:07,199 so if i click inside i see some 11180 03:46:07,199 --> 03:46:07,990 so if i click inside i see some description 11181 03:46:07,990 --> 03:46:08,000 description 11182 03:46:08,000 --> 03:46:10,790 description for the project as well as documentation 11183 03:46:10,790 --> 03:46:10,800 for the project as well as documentation 11184 03:46:10,800 --> 03:46:12,389 for the project as well as documentation and some other links 11185 03:46:12,389 --> 03:46:12,399 and some other links 11186 03:46:12,399 --> 03:46:15,349 and some other links now the question is how do i actually 11187 03:46:15,349 --> 03:46:15,359 now the question is how do i actually 11188 03:46:15,359 --> 03:46:16,870 now the question is how do i actually install this package 11189 03:46:16,870 --> 03:46:16,880 install this package 11190 03:46:16,880 --> 03:46:19,429 install this package locally so that i can use it in my 11191 03:46:19,429 --> 03:46:19,439 locally so that i can use it in my 11192 03:46:19,439 --> 03:46:20,469 locally so that i can use it in my project 11193 03:46:20,469 --> 03:46:20,479 project 11194 03:46:20,479 --> 03:46:23,750 project in python we install packages 11195 03:46:23,750 --> 03:46:23,760 in python we install packages 11196 03:46:23,760 --> 03:46:27,110 in python we install packages using a package manager tool called peep 11197 03:46:27,110 --> 03:46:27,120 using a package manager tool called peep 11198 03:46:27,120 --> 03:46:29,670 using a package manager tool called peep and right here on top below the package 11199 03:46:29,670 --> 03:46:29,680 and right here on top below the package 11200 03:46:29,680 --> 03:46:32,150 and right here on top below the package name you actually see a command 11201 03:46:32,150 --> 03:46:32,160 name you actually see a command 11202 03:46:32,160 --> 03:46:35,269 name you actually see a command peep install django so this is actually 11203 03:46:35,269 --> 03:46:35,279 peep install django so this is actually 11204 03:46:35,279 --> 03:46:36,150 peep install django so this is actually a command 11205 03:46:36,150 --> 03:46:36,160 a command 11206 03:46:36,160 --> 03:46:38,150 a command that will install that package locally 11207 03:46:38,150 --> 03:46:38,160 that will install that package locally 11208 03:46:38,160 --> 03:46:39,510 that will install that package locally on my laptop 11209 03:46:39,510 --> 03:46:39,520 on my laptop 11210 03:46:39,520 --> 03:46:43,110 on my laptop so we install packages in python using 11211 03:46:43,110 --> 03:46:43,120 so we install packages in python using 11212 03:46:43,120 --> 03:46:46,229 so we install packages in python using this pip command so 11213 03:46:46,229 --> 03:46:46,239 this pip command so 11214 03:46:46,239 --> 03:46:48,070 this pip command so what is this command or where does it 11215 03:46:48,070 --> 03:46:48,080 what is this command or where does it 11216 03:46:48,080 --> 03:46:49,429 what is this command or where does it come from 11217 03:46:49,429 --> 03:46:49,439 come from 11218 03:46:49,439 --> 03:46:52,790 come from pip is a package manager for python 11219 03:46:52,790 --> 03:46:52,800 pip is a package manager for python 11220 03:46:52,800 --> 03:46:54,469 pip is a package manager for python and if you know any other programming 11221 03:46:54,469 --> 03:46:54,479 and if you know any other programming 11222 03:46:54,479 --> 03:46:55,830 and if you know any other programming language basically 11223 03:46:55,830 --> 03:46:55,840 language basically 11224 03:46:55,840 --> 03:46:57,990 language basically the concept is the same every 11225 03:46:57,990 --> 03:46:58,000 the concept is the same every 11226 03:46:58,000 --> 03:46:59,189 the concept is the same every programming language 11227 03:46:59,189 --> 03:46:59,199 programming language 11228 03:46:59,199 --> 03:47:02,469 programming language has its own package manager tool 11229 03:47:02,469 --> 03:47:02,479 has its own package manager tool 11230 03:47:02,479 --> 03:47:05,510 has its own package manager tool for javascript it's npm for java 11231 03:47:05,510 --> 03:47:05,520 for javascript it's npm for java 11232 03:47:05,520 --> 03:47:08,389 for javascript it's npm for java it's maven or gradle and for python it 11233 03:47:08,389 --> 03:47:08,399 it's maven or gradle and for python it 11234 03:47:08,399 --> 03:47:08,790 it's maven or gradle and for python it is 11235 03:47:08,790 --> 03:47:08,800 is 11236 03:47:08,800 --> 03:47:12,150 is pip and one of the main tasks or usages 11237 03:47:12,150 --> 03:47:12,160 pip and one of the main tasks or usages 11238 03:47:12,160 --> 03:47:13,910 pip and one of the main tasks or usages of a package manager tool 11239 03:47:13,910 --> 03:47:13,920 of a package manager tool 11240 03:47:13,920 --> 03:47:17,110 of a package manager tool is to install external packages or 11241 03:47:17,110 --> 03:47:17,120 is to install external packages or 11242 03:47:17,120 --> 03:47:18,229 is to install external packages or libraries 11243 03:47:18,229 --> 03:47:18,239 libraries 11244 03:47:18,239 --> 03:47:21,110 libraries or also called dependencies for your 11245 03:47:21,110 --> 03:47:21,120 or also called dependencies for your 11246 03:47:21,120 --> 03:47:22,070 or also called dependencies for your project 11247 03:47:22,070 --> 03:47:22,080 project 11248 03:47:22,080 --> 03:47:26,070 project so if python needs this django package 11249 03:47:26,070 --> 03:47:26,080 so if python needs this django package 11250 03:47:26,080 --> 03:47:28,309 so if python needs this django package basically it's the job of the package 11251 03:47:28,309 --> 03:47:28,319 basically it's the job of the package 11252 03:47:28,319 --> 03:47:29,110 basically it's the job of the package manager 11253 03:47:29,110 --> 03:47:29,120 manager 11254 03:47:29,120 --> 03:47:30,950 manager to install that package and make 11255 03:47:30,950 --> 03:47:30,960 to install that package and make 11256 03:47:30,960 --> 03:47:32,550 to install that package and make available for python 11257 03:47:32,550 --> 03:47:32,560 available for python 11258 03:47:32,560 --> 03:47:35,030 available for python now where did this command come from do 11259 03:47:35,030 --> 03:47:35,040 now where did this command come from do 11260 03:47:35,040 --> 03:47:37,269 now where did this command come from do we have pip command available 11261 03:47:37,269 --> 03:47:37,279 we have pip command available 11262 03:47:37,279 --> 03:47:40,550 we have pip command available well in python version 3 actually 11263 03:47:40,550 --> 03:47:40,560 well in python version 3 actually 11264 03:47:40,560 --> 03:47:43,349 well in python version 3 actually pip is packaged inside the python so 11265 03:47:43,349 --> 03:47:43,359 pip is packaged inside the python so 11266 03:47:43,359 --> 03:47:45,990 pip is packaged inside the python so when we install the python we actually 11267 03:47:45,990 --> 03:47:46,000 when we install the python we actually 11268 03:47:46,000 --> 03:47:49,189 when we install the python we actually installed pip as well so basically we're 11269 03:47:49,189 --> 03:47:49,199 installed pip as well so basically we're 11270 03:47:49,199 --> 03:47:51,590 installed pip as well so basically we're going to copy this command 11271 03:47:51,590 --> 03:47:51,600 going to copy this command 11272 03:47:51,600 --> 03:47:54,630 going to copy this command peep install django and we're going to 11273 03:47:54,630 --> 03:47:54,640 peep install django and we're going to 11274 03:47:54,640 --> 03:47:56,870 peep install django and we're going to execute it actually from the terminal 11275 03:47:56,870 --> 03:47:56,880 execute it actually from the terminal 11276 03:47:56,880 --> 03:48:00,550 execute it actually from the terminal of pycharm so in pycharm editor we have 11277 03:48:00,550 --> 03:48:00,560 of pycharm so in pycharm editor we have 11278 03:48:00,560 --> 03:48:00,870 of pycharm so in pycharm editor we have this 11279 03:48:00,870 --> 03:48:00,880 this 11280 03:48:00,880 --> 03:48:03,750 this integrated terminal so this is actually 11281 03:48:03,750 --> 03:48:03,760 integrated terminal so this is actually 11282 03:48:03,760 --> 03:48:04,950 integrated terminal so this is actually pretty much the same 11283 03:48:04,950 --> 03:48:04,960 pretty much the same 11284 03:48:04,960 --> 03:48:08,630 pretty much the same terminal as you have outside like this 11285 03:48:08,630 --> 03:48:08,640 terminal as you have outside like this 11286 03:48:08,640 --> 03:48:10,309 terminal as you have outside like this so we are going to execute this pip 11287 03:48:10,309 --> 03:48:10,319 so we are going to execute this pip 11288 03:48:10,319 --> 03:48:12,150 so we are going to execute this pip install command directly 11289 03:48:12,150 --> 03:48:12,160 install command directly 11290 03:48:12,160 --> 03:48:15,189 install command directly in this pycharm terminal so i'm going to 11291 03:48:15,189 --> 03:48:15,199 in this pycharm terminal so i'm going to 11292 03:48:15,199 --> 03:48:15,750 in this pycharm terminal so i'm going to copy it 11293 03:48:15,750 --> 03:48:15,760 copy it 11294 03:48:15,760 --> 03:48:19,189 copy it here and do peep install django 11295 03:48:19,189 --> 03:48:19,199 here and do peep install django 11296 03:48:19,199 --> 03:48:21,429 here and do peep install django and you see it is downloading and 11297 03:48:21,429 --> 03:48:21,439 and you see it is downloading and 11298 03:48:21,439 --> 03:48:22,229 and you see it is downloading and successfully 11299 03:48:22,229 --> 03:48:22,239 successfully 11300 03:48:22,239 --> 03:48:25,830 successfully installed django 3.1.6 11301 03:48:25,830 --> 03:48:25,840 installed django 3.1.6 11302 03:48:25,840 --> 03:48:28,309 installed django 3.1.6 and we can actually see that package 11303 03:48:28,309 --> 03:48:28,319 and we can actually see that package 11304 03:48:28,319 --> 03:48:30,389 and we can actually see that package from our editor directly 11305 03:48:30,389 --> 03:48:30,399 from our editor directly 11306 03:48:30,399 --> 03:48:33,750 from our editor directly if i expand these external libraries 11307 03:48:33,750 --> 03:48:33,760 if i expand these external libraries 11308 03:48:33,760 --> 03:48:37,349 if i expand these external libraries and site packages 11309 03:48:41,189 --> 03:48:41,199 and scroll a bit down here i have django 11310 03:48:41,199 --> 03:48:45,030 and scroll a bit down here i have django 316 version installed so i see that the 11311 03:48:45,030 --> 03:48:45,040 316 version installed so i see that the 11312 03:48:45,040 --> 03:48:46,150 316 version installed so i see that the package is now 11313 03:48:46,150 --> 03:48:46,160 package is now 11314 03:48:46,160 --> 03:48:49,910 package is now available in my project and to also test 11315 03:48:49,910 --> 03:48:49,920 available in my project and to also test 11316 03:48:49,920 --> 03:48:50,309 available in my project and to also test it 11317 03:48:50,309 --> 03:48:50,319 it 11318 03:48:50,319 --> 03:48:55,030 it in the code i can do import and 11319 03:48:55,030 --> 03:48:55,040 in the code i can do import and 11320 03:48:55,040 --> 03:48:58,389 in the code i can do import and django and you see that pycharm actually 11321 03:48:58,389 --> 03:48:58,399 django and you see that pycharm actually 11322 03:48:58,399 --> 03:49:01,030 django and you see that pycharm actually recognize that i have django packaged 11323 03:49:01,030 --> 03:49:01,040 recognize that i have django packaged 11324 03:49:01,040 --> 03:49:01,830 recognize that i have django packaged locally 11325 03:49:01,830 --> 03:49:01,840 locally 11326 03:49:01,840 --> 03:49:03,990 locally so it gives me that package as a 11327 03:49:03,990 --> 03:49:04,000 so it gives me that package as a 11328 03:49:04,000 --> 03:49:04,950 so it gives me that package as a suggestion 11329 03:49:04,950 --> 03:49:04,960 suggestion 11330 03:49:04,960 --> 03:49:07,990 suggestion so that will basically import the whole 11331 03:49:07,990 --> 03:49:08,000 so that will basically import the whole 11332 03:49:08,000 --> 03:49:09,269 so that will basically import the whole django package 11333 03:49:09,269 --> 03:49:09,279 django package 11334 03:49:09,279 --> 03:49:11,510 django package so we can now use it in our application 11335 03:49:11,510 --> 03:49:11,520 so we can now use it in our application 11336 03:49:11,520 --> 03:49:13,030 so we can now use it in our application here you see pycharm 11337 03:49:13,030 --> 03:49:13,040 here you see pycharm 11338 03:49:13,040 --> 03:49:15,670 here you see pycharm actually noticed you are using or want 11339 03:49:15,670 --> 03:49:15,680 actually noticed you are using or want 11340 03:49:15,680 --> 03:49:16,229 actually noticed you are using or want to use 11341 03:49:16,229 --> 03:49:16,239 to use 11342 03:49:16,239 --> 03:49:18,469 to use django web framework as i mentioned in 11343 03:49:18,469 --> 03:49:18,479 django web framework as i mentioned in 11344 03:49:18,479 --> 03:49:20,550 django web framework as i mentioned in the beginning the pycharm professional 11345 03:49:20,550 --> 03:49:20,560 the beginning the pycharm professional 11346 03:49:20,560 --> 03:49:21,269 the beginning the pycharm professional edition 11347 03:49:21,269 --> 03:49:21,279 edition 11348 03:49:21,279 --> 03:49:23,830 edition has special support for different python 11349 03:49:23,830 --> 03:49:23,840 has special support for different python 11350 03:49:23,840 --> 03:49:25,349 has special support for different python web frameworks 11351 03:49:25,349 --> 03:49:25,359 web frameworks 11352 03:49:25,359 --> 03:49:28,229 web frameworks supporting you with syntax highlighting 11353 03:49:28,229 --> 03:49:28,239 supporting you with syntax highlighting 11354 03:49:28,239 --> 03:49:29,429 supporting you with syntax highlighting suggestions 11355 03:49:29,429 --> 03:49:29,439 suggestions 11356 03:49:29,439 --> 03:49:32,229 suggestions database integration and so on so again 11357 03:49:32,229 --> 03:49:32,239 database integration and so on so again 11358 03:49:32,239 --> 03:49:33,910 database integration and so on so again if you want to try it out for free for 11359 03:49:33,910 --> 03:49:33,920 if you want to try it out for free for 11360 03:49:33,920 --> 03:49:35,910 if you want to try it out for free for three months just use my code in the 11361 03:49:35,910 --> 03:49:35,920 three months just use my code in the 11362 03:49:35,920 --> 03:49:37,269 three months just use my code in the video description 11363 03:49:37,269 --> 03:49:37,279 video description 11364 03:49:37,279 --> 03:49:39,910 video description in the same way as we install the 11365 03:49:39,910 --> 03:49:39,920 in the same way as we install the 11366 03:49:39,920 --> 03:49:40,630 in the same way as we install the package 11367 03:49:40,630 --> 03:49:40,640 package 11368 03:49:40,640 --> 03:49:44,469 package we can also uninstall packages using pip 11369 03:49:44,469 --> 03:49:44,479 we can also uninstall packages using pip 11370 03:49:44,479 --> 03:49:47,990 we can also uninstall packages using pip and let's also actually demonstrate that 11371 03:49:47,990 --> 03:49:48,000 and let's also actually demonstrate that 11372 03:49:48,000 --> 03:49:51,750 and let's also actually demonstrate that pip uninstall 11373 03:49:51,750 --> 03:49:51,760 pip uninstall 11374 03:49:51,760 --> 03:49:55,110 pip uninstall django and 11375 03:49:55,110 --> 03:49:55,120 django and 11376 03:49:55,120 --> 03:49:58,469 django and let's confirm that 11377 03:49:58,469 --> 03:49:58,479 let's confirm that 11378 03:49:58,479 --> 03:50:02,229 let's confirm that successfully uninstalled django now if 11379 03:50:02,229 --> 03:50:02,239 successfully uninstalled django now if 11380 03:50:02,239 --> 03:50:05,349 successfully uninstalled django now if in the site packages i click inside 11381 03:50:05,349 --> 03:50:05,359 in the site packages i click inside 11382 03:50:05,359 --> 03:50:08,790 in the site packages i click inside you see that django packages are gone so 11383 03:50:08,790 --> 03:50:08,800 you see that django packages are gone so 11384 03:50:08,800 --> 03:50:11,590 you see that django packages are gone so this site packages folder got updated 11385 03:50:11,590 --> 03:50:11,600 this site packages folder got updated 11386 03:50:11,600 --> 03:50:12,870 this site packages folder got updated django was removed 11387 03:50:12,870 --> 03:50:12,880 django was removed 11388 03:50:12,880 --> 03:50:14,950 django was removed and you also see that in the code editor 11389 03:50:14,950 --> 03:50:14,960 and you also see that in the code editor 11390 03:50:14,960 --> 03:50:16,469 and you also see that in the code editor now i have this 11391 03:50:16,469 --> 03:50:16,479 now i have this 11392 03:50:16,479 --> 03:50:19,670 now i have this red line under django because pycharm 11393 03:50:19,670 --> 03:50:19,680 red line under django because pycharm 11394 03:50:19,680 --> 03:50:20,790 red line under django because pycharm cannot find 11395 03:50:20,790 --> 03:50:20,800 cannot find 11396 03:50:20,800 --> 03:50:24,150 cannot find a module called django and also if i do 11397 03:50:24,150 --> 03:50:24,160 a module called django and also if i do 11398 03:50:24,160 --> 03:50:25,189 a module called django and also if i do this 11399 03:50:25,189 --> 03:50:25,199 this 11400 03:50:25,199 --> 03:50:27,269 this obviously it won't give me any auto 11401 03:50:27,269 --> 03:50:27,279 obviously it won't give me any auto 11402 03:50:27,279 --> 03:50:28,469 obviously it won't give me any auto suggestion for that 11403 03:50:28,469 --> 03:50:28,479 suggestion for that 11404 03:50:28,479 --> 03:50:30,870 suggestion for that so that's how you can use peep to 11405 03:50:30,870 --> 03:50:30,880 so that's how you can use peep to 11406 03:50:30,880 --> 03:50:33,349 so that's how you can use peep to install packages and also to uninstall 11407 03:50:33,349 --> 03:50:33,359 install packages and also to uninstall 11408 03:50:33,359 --> 03:50:34,150 install packages and also to uninstall packages 11409 03:50:34,150 --> 03:50:34,160 packages 11410 03:50:34,160 --> 03:50:38,469 packages for your application 11411 03:50:41,269 --> 03:50:41,279 now here i want to show you another cool 11412 03:50:41,279 --> 03:50:43,189 now here i want to show you another cool alternative to installing and 11413 03:50:43,189 --> 03:50:43,199 alternative to installing and 11414 03:50:43,199 --> 03:50:46,070 alternative to installing and uninstalling packages directly in the 11415 03:50:46,070 --> 03:50:46,080 uninstalling packages directly in the 11416 03:50:46,080 --> 03:50:47,990 uninstalling packages directly in the pycharm ide 11417 03:50:47,990 --> 03:50:48,000 pycharm ide 11418 03:50:48,000 --> 03:50:50,389 pycharm ide and this is actually a feature in the 11419 03:50:50,389 --> 03:50:50,399 and this is actually a feature in the 11420 03:50:50,399 --> 03:50:52,309 and this is actually a feature in the latest pycharm release 11421 03:50:52,309 --> 03:50:52,319 latest pycharm release 11422 03:50:52,319 --> 03:50:55,670 latest pycharm release and for this i need to switch to an 11423 03:50:55,670 --> 03:50:55,680 and for this i need to switch to an 11424 03:50:55,680 --> 03:50:58,550 and for this i need to switch to an early access pycharm version so you see 11425 03:50:58,550 --> 03:50:58,560 early access pycharm version so you see 11426 03:50:58,560 --> 03:50:58,950 early access pycharm version so you see here 11427 03:50:58,950 --> 03:50:58,960 here 11428 03:50:58,960 --> 03:51:02,389 here it says pycharm eap early access 11429 03:51:02,389 --> 03:51:02,399 it says pycharm eap early access 11430 03:51:02,399 --> 03:51:04,710 it says pycharm eap early access to show you the feature however when you 11431 03:51:04,710 --> 03:51:04,720 to show you the feature however when you 11432 03:51:04,720 --> 03:51:06,790 to show you the feature however when you watch the tutorial it probably will 11433 03:51:06,790 --> 03:51:06,800 watch the tutorial it probably will 11434 03:51:06,800 --> 03:51:08,790 watch the tutorial it probably will already be included in the latest 11435 03:51:08,790 --> 03:51:08,800 already be included in the latest 11436 03:51:08,800 --> 03:51:11,110 already be included in the latest official pycharm version so you should 11437 03:51:11,110 --> 03:51:11,120 official pycharm version so you should 11438 03:51:11,120 --> 03:51:12,469 official pycharm version so you should have that already 11439 03:51:12,469 --> 03:51:12,479 have that already 11440 03:51:12,479 --> 03:51:15,830 have that already so instead of us basically finding this 11441 03:51:15,830 --> 03:51:15,840 so instead of us basically finding this 11442 03:51:15,840 --> 03:51:17,189 so instead of us basically finding this package in pipey 11443 03:51:17,189 --> 03:51:17,199 package in pipey 11444 03:51:17,199 --> 03:51:21,030 package in pipey and then executing peep install commands 11445 03:51:21,030 --> 03:51:21,040 and then executing peep install commands 11446 03:51:21,040 --> 03:51:24,229 and then executing peep install commands right here what you can do is 11447 03:51:24,229 --> 03:51:24,239 right here what you can do is 11448 03:51:24,239 --> 03:51:26,469 right here what you can do is down here you have another tab called 11449 03:51:26,469 --> 03:51:26,479 down here you have another tab called 11450 03:51:26,479 --> 03:51:29,030 down here you have another tab called python packages so if we click inside 11451 03:51:29,030 --> 03:51:29,040 python packages so if we click inside 11452 03:51:29,040 --> 03:51:31,429 python packages so if we click inside this is a place where you have 11453 03:51:31,429 --> 03:51:31,439 this is a place where you have 11454 03:51:31,439 --> 03:51:32,790 this is a place where you have everything that you need to know 11455 03:51:32,790 --> 03:51:32,800 everything that you need to know 11456 03:51:32,800 --> 03:51:35,510 everything that you need to know about the package the package search and 11457 03:51:35,510 --> 03:51:35,520 about the package the package search and 11458 03:51:35,520 --> 03:51:36,309 about the package the package search and all these 11459 03:51:36,309 --> 03:51:36,319 all these 11460 03:51:36,319 --> 03:51:38,950 all these features basically in one place so for 11461 03:51:38,950 --> 03:51:38,960 features basically in one place so for 11462 03:51:38,960 --> 03:51:39,670 features basically in one place so for example 11463 03:51:39,670 --> 03:51:39,680 example 11464 03:51:39,680 --> 03:51:42,550 example in order to install django we can just 11465 03:51:42,550 --> 03:51:42,560 in order to install django we can just 11466 03:51:42,560 --> 03:51:43,030 in order to install django we can just search 11467 03:51:43,030 --> 03:51:43,040 search 11468 03:51:43,040 --> 03:51:46,070 search for django right here and you see that 11469 03:51:46,070 --> 03:51:46,080 for django right here and you see that 11470 03:51:46,080 --> 03:51:47,910 for django right here and you see that when i type in the first couple of 11471 03:51:47,910 --> 03:51:47,920 when i type in the first couple of 11472 03:51:47,920 --> 03:51:48,630 when i type in the first couple of letters 11473 03:51:48,630 --> 03:51:48,640 letters 11474 03:51:48,640 --> 03:51:50,870 letters i already get suggestions so this is a 11475 03:51:50,870 --> 03:51:50,880 i already get suggestions so this is a 11476 03:51:50,880 --> 03:51:52,710 i already get suggestions so this is a list of all the packages 11477 03:51:52,710 --> 03:51:52,720 list of all the packages 11478 03:51:52,720 --> 03:51:54,469 list of all the packages that start with this name that are 11479 03:51:54,469 --> 03:51:54,479 that start with this name that are 11480 03:51:54,479 --> 03:51:56,790 that start with this name that are actually available in pipi 11481 03:51:56,790 --> 03:51:56,800 actually available in pipi 11482 03:51:56,800 --> 03:51:59,910 actually available in pipi so let's type in django and we see that 11483 03:51:59,910 --> 03:51:59,920 so let's type in django and we see that 11484 03:51:59,920 --> 03:52:01,030 so let's type in django and we see that right here 11485 03:52:01,030 --> 03:52:01,040 right here 11486 03:52:01,040 --> 03:52:03,469 right here and on the right you see the 11487 03:52:03,469 --> 03:52:03,479 and on the right you see the 11488 03:52:03,479 --> 03:52:04,950 and on the right you see the documentation 11489 03:52:04,950 --> 03:52:04,960 documentation 11490 03:52:04,960 --> 03:52:07,429 documentation of the package that you would actually 11491 03:52:07,429 --> 03:52:07,439 of the package that you would actually 11492 03:52:07,439 --> 03:52:08,070 of the package that you would actually see in 11493 03:52:08,070 --> 03:52:08,080 see in 11494 03:52:08,080 --> 03:52:11,349 see in pipey ui so you have that in place as 11495 03:52:11,349 --> 03:52:11,359 pipey ui so you have that in place as 11496 03:52:11,359 --> 03:52:12,229 pipey ui so you have that in place as well 11497 03:52:12,229 --> 03:52:12,239 well 11498 03:52:12,239 --> 03:52:15,030 well and in addition to that what they added 11499 03:52:15,030 --> 03:52:15,040 and in addition to that what they added 11500 03:52:15,040 --> 03:52:16,229 and in addition to that what they added is the documentation 11501 03:52:16,229 --> 03:52:16,239 is the documentation 11502 03:52:16,239 --> 03:52:18,630 is the documentation link so this is actually the package 11503 03:52:18,630 --> 03:52:18,640 link so this is actually the package 11504 03:52:18,640 --> 03:52:19,750 link so this is actually the package how-to guide 11505 03:52:19,750 --> 03:52:19,760 how-to guide 11506 03:52:19,760 --> 03:52:22,950 how-to guide and the full documentation with examples 11507 03:52:22,950 --> 03:52:22,960 and the full documentation with examples 11508 03:52:22,960 --> 03:52:23,990 and the full documentation with examples etc 11509 03:52:23,990 --> 03:52:24,000 etc 11510 03:52:24,000 --> 03:52:26,870 etc so very convenient way to basically get 11511 03:52:26,870 --> 03:52:26,880 so very convenient way to basically get 11512 03:52:26,880 --> 03:52:28,630 so very convenient way to basically get all the information about the package 11513 03:52:28,630 --> 03:52:28,640 all the information about the package 11514 03:52:28,640 --> 03:52:31,030 all the information about the package search the package and then to install 11515 03:52:31,030 --> 03:52:31,040 search the package and then to install 11516 03:52:31,040 --> 03:52:32,150 search the package and then to install the package 11517 03:52:32,150 --> 03:52:32,160 the package 11518 03:52:32,160 --> 03:52:35,030 the package we can choose the version here so either 11519 03:52:35,030 --> 03:52:35,040 we can choose the version here so either 11520 03:52:35,040 --> 03:52:36,469 we can choose the version here so either you can leave the latest 11521 03:52:36,469 --> 03:52:36,479 you can leave the latest 11522 03:52:36,479 --> 03:52:39,510 you can leave the latest or basically select the specific version 11523 03:52:39,510 --> 03:52:39,520 or basically select the specific version 11524 03:52:39,520 --> 03:52:42,150 or basically select the specific version and then once you have selected that you 11525 03:52:42,150 --> 03:52:42,160 and then once you have selected that you 11526 03:52:42,160 --> 03:52:42,950 and then once you have selected that you can just click 11527 03:52:42,950 --> 03:52:42,960 can just click 11528 03:52:42,960 --> 03:52:45,910 can just click install and here you see installing 11529 03:52:45,910 --> 03:52:45,920 install and here you see installing 11530 03:52:45,920 --> 03:52:47,189 install and here you see installing package 11531 03:52:47,189 --> 03:52:47,199 package 11532 03:52:47,199 --> 03:52:51,110 package and there you go so now in installed 11533 03:52:51,110 --> 03:52:51,120 and there you go so now in installed 11534 03:52:51,120 --> 03:52:53,990 and there you go so now in installed view here so we just had pip and setup 11535 03:52:53,990 --> 03:52:54,000 view here so we just had pip and setup 11536 03:52:54,000 --> 03:52:54,950 view here so we just had pip and setup tools 11537 03:52:54,950 --> 03:52:54,960 tools 11538 03:52:54,960 --> 03:52:56,950 tools these two things installed and right 11539 03:52:56,950 --> 03:52:56,960 these two things installed and right 11540 03:52:56,960 --> 03:52:58,070 these two things installed and right here we have now 11541 03:52:58,070 --> 03:52:58,080 here we have now 11542 03:52:58,080 --> 03:53:01,510 here we have now django in the installed packages list 11543 03:53:01,510 --> 03:53:01,520 django in the installed packages list 11544 03:53:01,520 --> 03:53:03,990 django in the installed packages list and again while you're now using the 11545 03:53:03,990 --> 03:53:04,000 and again while you're now using the 11546 03:53:04,000 --> 03:53:04,630 and again while you're now using the installed 11547 03:53:04,630 --> 03:53:04,640 installed 11548 03:53:04,640 --> 03:53:07,030 installed package or library in your code and 11549 03:53:07,030 --> 03:53:07,040 package or library in your code and 11550 03:53:07,040 --> 03:53:07,990 package or library in your code and basically you want to look 11551 03:53:07,990 --> 03:53:08,000 basically you want to look 11552 03:53:08,000 --> 03:53:10,229 basically you want to look up some examples or you want to check 11553 03:53:10,229 --> 03:53:10,239 up some examples or you want to check 11554 03:53:10,239 --> 03:53:11,750 up some examples or you want to check some documentation 11555 03:53:11,750 --> 03:53:11,760 some documentation 11556 03:53:11,760 --> 03:53:15,030 some documentation right you go back to the package click 11557 03:53:15,030 --> 03:53:15,040 right you go back to the package click 11558 03:53:15,040 --> 03:53:16,550 right you go back to the package click inside and you have link to 11559 03:53:16,550 --> 03:53:16,560 inside and you have link to 11560 03:53:16,560 --> 03:53:18,710 inside and you have link to documentation and 11561 03:53:18,710 --> 03:53:18,720 documentation and 11562 03:53:18,720 --> 03:53:22,550 documentation and the package information as well and also 11563 03:53:22,550 --> 03:53:22,560 the package information as well and also 11564 03:53:22,560 --> 03:53:24,309 the package information as well and also just by looking at this list you know 11565 03:53:24,309 --> 03:53:24,319 just by looking at this list you know 11566 03:53:24,319 --> 03:53:27,110 just by looking at this list you know which versions of which packages you 11567 03:53:27,110 --> 03:53:27,120 which versions of which packages you 11568 03:53:27,120 --> 03:53:29,110 which versions of which packages you have installed so i think it's really 11569 03:53:29,110 --> 03:53:29,120 have installed so i think it's really 11570 03:53:29,120 --> 03:53:31,670 have installed so i think it's really cool way to manage all your packages to 11571 03:53:31,670 --> 03:53:31,680 cool way to manage all your packages to 11572 03:53:31,680 --> 03:53:32,950 cool way to manage all your packages to install packages 11573 03:53:32,950 --> 03:53:32,960 install packages 11574 03:53:32,960 --> 03:53:35,269 install packages and for example if you want to uninstall 11575 03:53:35,269 --> 03:53:35,279 and for example if you want to uninstall 11576 03:53:35,279 --> 03:53:36,229 and for example if you want to uninstall packages 11577 03:53:36,229 --> 03:53:36,239 packages 11578 03:53:36,239 --> 03:53:38,870 packages from your project then again just 11579 03:53:38,870 --> 03:53:38,880 from your project then again just 11580 03:53:38,880 --> 03:53:39,670 from your project then again just clicking 11581 03:53:39,670 --> 03:53:39,680 clicking 11582 03:53:39,680 --> 03:53:43,110 clicking to that specific package right here 11583 03:53:43,110 --> 03:53:43,120 to that specific package right here 11584 03:53:43,120 --> 03:53:44,950 to that specific package right here you can just delete it and it will be 11585 03:53:44,950 --> 03:53:44,960 you can just delete it and it will be 11586 03:53:44,960 --> 03:53:49,670 you can just delete it and it will be removed from your application 11587 03:53:54,070 --> 03:53:54,080 like this and no django anymore here 11588 03:53:54,080 --> 03:53:56,790 like this and no django anymore here so a very cool addition to pycharm 11589 03:53:56,790 --> 03:53:56,800 so a very cool addition to pycharm 11590 03:53:56,800 --> 03:53:58,389 so a very cool addition to pycharm because this will be very convenient to 11591 03:53:58,389 --> 03:53:58,399 because this will be very convenient to 11592 03:53:58,399 --> 03:54:00,229 because this will be very convenient to work with the packages 11593 03:54:00,229 --> 03:54:00,239 work with the packages 11594 03:54:00,239 --> 03:54:02,229 work with the packages so now i will switch back to my other 11595 03:54:02,229 --> 03:54:02,239 so now i will switch back to my other 11596 03:54:02,239 --> 03:54:03,670 so now i will switch back to my other editor again 11597 03:54:03,670 --> 03:54:03,680 editor again 11598 03:54:03,680 --> 03:54:11,030 editor again and continue from there 11599 03:54:14,229 --> 03:54:14,239 so basically i have just cleaned up my 11600 03:54:14,239 --> 03:54:17,349 so basically i have just cleaned up my python project we have this main.pi 11601 03:54:17,349 --> 03:54:17,359 python project we have this main.pi 11602 03:54:17,359 --> 03:54:17,830 python project we have this main.pi which is 11603 03:54:17,830 --> 03:54:17,840 which is 11604 03:54:17,840 --> 03:54:19,830 which is empty and we're gonna write an 11605 03:54:19,830 --> 03:54:19,840 empty and we're gonna write an 11606 03:54:19,840 --> 03:54:21,590 empty and we're gonna write an application that will read 11607 03:54:21,590 --> 03:54:21,600 application that will read 11608 03:54:21,600 --> 03:54:24,150 application that will read a spreadsheet file from our local file 11609 03:54:24,150 --> 03:54:24,160 a spreadsheet file from our local file 11610 03:54:24,160 --> 03:54:24,950 a spreadsheet file from our local file system 11611 03:54:24,950 --> 03:54:24,960 system 11612 03:54:24,960 --> 03:54:26,870 system it will read some information from that 11613 03:54:26,870 --> 03:54:26,880 it will read some information from that 11614 03:54:26,880 --> 03:54:28,309 it will read some information from that spreadsheet file and do 11615 03:54:28,309 --> 03:54:28,319 spreadsheet file and do 11616 03:54:28,319 --> 03:54:30,630 spreadsheet file and do something with that data and this could 11617 03:54:30,630 --> 03:54:30,640 something with that data and this could 11618 03:54:30,640 --> 03:54:32,469 something with that data and this could be a very useful 11619 03:54:32,469 --> 03:54:32,479 be a very useful 11620 03:54:32,479 --> 03:54:35,269 be a very useful use case if you're working with lots of 11621 03:54:35,269 --> 03:54:35,279 use case if you're working with lots of 11622 03:54:35,279 --> 03:54:37,510 use case if you're working with lots of files and you want to do some 11623 03:54:37,510 --> 03:54:37,520 files and you want to do some 11624 03:54:37,520 --> 03:54:39,510 files and you want to do some data processing in those files and you 11625 03:54:39,510 --> 03:54:39,520 data processing in those files and you 11626 03:54:39,520 --> 03:54:41,030 data processing in those files and you don't want to do that manually 11627 03:54:41,030 --> 03:54:41,040 don't want to do that manually 11628 03:54:41,040 --> 03:54:43,349 don't want to do that manually by automating or writing a program in 11629 03:54:43,349 --> 03:54:43,359 by automating or writing a program in 11630 03:54:43,359 --> 03:54:44,150 by automating or writing a program in python 11631 03:54:44,150 --> 03:54:44,160 python 11632 03:54:44,160 --> 03:54:47,269 python that basically can do anything in a file 11633 03:54:47,269 --> 03:54:47,279 that basically can do anything in a file 11634 03:54:47,279 --> 03:54:50,070 that basically can do anything in a file or across multiple files so let's see 11635 03:54:50,070 --> 03:54:50,080 or across multiple files so let's see 11636 03:54:50,080 --> 03:54:50,870 or across multiple files so let's see exactly 11637 03:54:50,870 --> 03:54:50,880 exactly 11638 03:54:50,880 --> 03:54:52,870 exactly what we are going to be doing with this 11639 03:54:52,870 --> 03:54:52,880 what we are going to be doing with this 11640 03:54:52,880 --> 03:54:54,710 what we are going to be doing with this program so first of all 11641 03:54:54,710 --> 03:54:54,720 program so first of all 11642 03:54:54,720 --> 03:54:56,710 program so first of all we're going to have an input file a 11643 03:54:56,710 --> 03:54:56,720 we're going to have an input file a 11644 03:54:56,720 --> 03:54:58,309 we're going to have an input file a spreadsheet file that we're going to be 11645 03:54:58,309 --> 03:54:58,319 spreadsheet file that we're going to be 11646 03:54:58,319 --> 03:54:59,269 spreadsheet file that we're going to be working with 11647 03:54:59,269 --> 03:54:59,279 working with 11648 03:54:59,279 --> 03:55:02,389 working with and that spreadsheet will look like this 11649 03:55:02,389 --> 03:55:02,399 and that spreadsheet will look like this 11650 03:55:02,399 --> 03:55:05,670 and that spreadsheet will look like this it's called inventory that's how it's 11651 03:55:05,670 --> 03:55:05,680 it's called inventory that's how it's 11652 03:55:05,680 --> 03:55:06,550 it's called inventory that's how it's going to look like 11653 03:55:06,550 --> 03:55:06,560 going to look like 11654 03:55:06,560 --> 03:55:08,870 going to look like so basically this file simulates 11655 03:55:08,870 --> 03:55:08,880 so basically this file simulates 11656 03:55:08,880 --> 03:55:11,269 so basically this file simulates something that many companies would have 11657 03:55:11,269 --> 03:55:11,279 something that many companies would have 11658 03:55:11,279 --> 03:55:13,670 something that many companies would have and employees of that company would be 11659 03:55:13,670 --> 03:55:13,680 and employees of that company would be 11660 03:55:13,680 --> 03:55:14,790 and employees of that company would be working with 11661 03:55:14,790 --> 03:55:14,800 working with 11662 03:55:14,800 --> 03:55:18,950 working with so we have this list of product numbers 11663 03:55:18,950 --> 03:55:18,960 so we have this list of product numbers 11664 03:55:18,960 --> 03:55:21,910 so we have this list of product numbers inventory for each product price for the 11665 03:55:21,910 --> 03:55:21,920 inventory for each product price for the 11666 03:55:21,920 --> 03:55:22,469 inventory for each product price for the product 11667 03:55:22,469 --> 03:55:22,479 product 11668 03:55:22,479 --> 03:55:24,389 product and a supplier so this could be an 11669 03:55:24,389 --> 03:55:24,399 and a supplier so this could be an 11670 03:55:24,399 --> 03:55:26,469 and a supplier so this could be an example file from a company that is 11671 03:55:26,469 --> 03:55:26,479 example file from a company that is 11672 03:55:26,479 --> 03:55:27,750 example file from a company that is basically dealing with 11673 03:55:27,750 --> 03:55:27,760 basically dealing with 11674 03:55:27,760 --> 03:55:30,070 basically dealing with selling or buying products so what we're 11675 03:55:30,070 --> 03:55:30,080 selling or buying products so what we're 11676 03:55:30,080 --> 03:55:31,110 selling or buying products so what we're going to do is 11677 03:55:31,110 --> 03:55:31,120 going to do is 11678 03:55:31,120 --> 03:55:32,790 going to do is we're going to read the information from 11679 03:55:32,790 --> 03:55:32,800 we're going to read the information from 11680 03:55:32,800 --> 03:55:34,150 we're going to read the information from this file and we're going to do 11681 03:55:34,150 --> 03:55:34,160 this file and we're going to do 11682 03:55:34,160 --> 03:55:35,910 this file and we're going to do something with that information 11683 03:55:35,910 --> 03:55:35,920 something with that information 11684 03:55:35,920 --> 03:55:38,870 something with that information first we're going to write logic that 11685 03:55:38,870 --> 03:55:38,880 first we're going to write logic that 11686 03:55:38,880 --> 03:55:40,070 first we're going to write logic that calculates 11687 03:55:40,070 --> 03:55:40,080 calculates 11688 03:55:40,080 --> 03:55:43,429 calculates how many products we have per supplier 11689 03:55:43,429 --> 03:55:43,439 how many products we have per supplier 11690 03:55:43,439 --> 03:55:45,590 how many products we have per supplier so we have three supplier companies here 11691 03:55:45,590 --> 03:55:45,600 so we have three supplier companies here 11692 03:55:45,600 --> 03:55:48,229 so we have three supplier companies here and per supplier we're gonna calculate 11693 03:55:48,229 --> 03:55:48,239 and per supplier we're gonna calculate 11694 03:55:48,239 --> 03:55:49,269 and per supplier we're gonna calculate number of 11695 03:55:49,269 --> 03:55:49,279 number of 11696 03:55:49,279 --> 03:55:51,830 number of products from that specific company and 11697 03:55:51,830 --> 03:55:51,840 products from that specific company and 11698 03:55:51,840 --> 03:55:53,830 products from that specific company and as a result we're gonna list 11699 03:55:53,830 --> 03:55:53,840 as a result we're gonna list 11700 03:55:53,840 --> 03:55:56,389 as a result we're gonna list the company so all three companies with 11701 03:55:56,389 --> 03:55:56,399 the company so all three companies with 11702 03:55:56,399 --> 03:55:57,670 the company so all three companies with their respective 11703 03:55:57,670 --> 03:55:57,680 their respective 11704 03:55:57,680 --> 03:56:00,229 their respective number of products then we're going to 11705 03:56:00,229 --> 03:56:00,239 number of products then we're going to 11706 03:56:00,239 --> 03:56:01,590 number of products then we're going to write another logic that 11707 03:56:01,590 --> 03:56:01,600 write another logic that 11708 03:56:01,600 --> 03:56:04,630 write another logic that lists inventory products that have 11709 03:56:04,630 --> 03:56:04,640 lists inventory products that have 11710 03:56:04,640 --> 03:56:05,910 lists inventory products that have inventory which is 11711 03:56:05,910 --> 03:56:05,920 inventory which is 11712 03:56:05,920 --> 03:56:09,670 inventory which is less than 10 so basically those ones 11713 03:56:09,670 --> 03:56:09,680 less than 10 so basically those ones 11714 03:56:09,680 --> 03:56:12,550 less than 10 so basically those ones the third exercise is going to be to 11715 03:56:12,550 --> 03:56:12,560 the third exercise is going to be to 11716 03:56:12,560 --> 03:56:13,189 the third exercise is going to be to list 11717 03:56:13,189 --> 03:56:13,199 list 11718 03:56:13,199 --> 03:56:16,550 list each company with their respective total 11719 03:56:16,550 --> 03:56:16,560 each company with their respective total 11720 03:56:16,560 --> 03:56:18,070 each company with their respective total inventory value 11721 03:56:18,070 --> 03:56:18,080 inventory value 11722 03:56:18,080 --> 03:56:21,269 inventory value and finally in the last exercise we will 11723 03:56:21,269 --> 03:56:21,279 and finally in the last exercise we will 11724 03:56:21,279 --> 03:56:23,750 and finally in the last exercise we will calculate the inventory value for 11725 03:56:23,750 --> 03:56:23,760 calculate the inventory value for 11726 03:56:23,760 --> 03:56:27,110 calculate the inventory value for each product so product count times 11727 03:56:27,110 --> 03:56:27,120 each product so product count times 11728 03:56:27,120 --> 03:56:29,349 each product so product count times price and we're going to write that 11729 03:56:29,349 --> 03:56:29,359 price and we're going to write that 11730 03:56:29,359 --> 03:56:30,309 price and we're going to write that value to 11731 03:56:30,309 --> 03:56:30,319 value to 11732 03:56:30,319 --> 03:56:32,950 value to an additional column in the spreadsheet 11733 03:56:32,950 --> 03:56:32,960 an additional column in the spreadsheet 11734 03:56:32,960 --> 03:56:33,510 an additional column in the spreadsheet and 11735 03:56:33,510 --> 03:56:33,520 and 11736 03:56:33,520 --> 03:56:35,269 and after that we're going to save that 11737 03:56:35,269 --> 03:56:35,279 after that we're going to save that 11738 03:56:35,279 --> 03:56:36,950 after that we're going to save that updated spreadsheet file 11739 03:56:36,950 --> 03:56:36,960 updated spreadsheet file 11740 03:56:36,960 --> 03:56:39,670 updated spreadsheet file programmatically using python so we're 11741 03:56:39,670 --> 03:56:39,680 programmatically using python so we're 11742 03:56:39,680 --> 03:56:40,790 programmatically using python so we're gonna see how to 11743 03:56:40,790 --> 03:56:40,800 gonna see how to 11744 03:56:40,800 --> 03:56:43,189 gonna see how to update a file and then save it 11745 03:56:43,189 --> 03:56:43,199 update a file and then save it 11746 03:56:43,199 --> 03:56:44,229 update a file and then save it programmatically 11747 03:56:44,229 --> 03:56:44,239 programmatically 11748 03:56:44,239 --> 03:56:46,790 programmatically in python if any of these sounds a 11749 03:56:46,790 --> 03:56:46,800 in python if any of these sounds a 11750 03:56:46,800 --> 03:56:48,710 in python if any of these sounds a little bit too complicated for you then 11751 03:56:48,710 --> 03:56:48,720 little bit too complicated for you then 11752 03:56:48,720 --> 03:56:50,229 little bit too complicated for you then just bear with me 11753 03:56:50,229 --> 03:56:50,239 just bear with me 11754 03:56:50,239 --> 03:56:52,150 just bear with me i'm gonna explain everything step by 11755 03:56:52,150 --> 03:56:52,160 i'm gonna explain everything step by 11756 03:56:52,160 --> 03:56:53,590 i'm gonna explain everything step by step and 11757 03:56:53,590 --> 03:56:53,600 step and 11758 03:56:53,600 --> 03:56:55,750 step and it's gonna become much clearer when we 11759 03:56:55,750 --> 03:56:55,760 it's gonna become much clearer when we 11760 03:56:55,760 --> 03:56:57,670 it's gonna become much clearer when we actually start writing the 11761 03:56:57,670 --> 03:56:57,680 actually start writing the 11762 03:56:57,680 --> 03:57:01,110 actually start writing the logic 11763 03:57:03,510 --> 03:57:03,520 so the first thing what i'm gonna do is 11764 03:57:03,520 --> 03:57:04,790 so the first thing what i'm gonna do is i'm gonna take this 11765 03:57:04,790 --> 03:57:04,800 i'm gonna take this 11766 03:57:04,800 --> 03:57:07,590 i'm gonna take this file that i have in the downloads folder 11767 03:57:07,590 --> 03:57:07,600 file that i have in the downloads folder 11768 03:57:07,600 --> 03:57:08,710 file that i have in the downloads folder and i'm actually gonna 11769 03:57:08,710 --> 03:57:08,720 and i'm actually gonna 11770 03:57:08,720 --> 03:57:10,630 and i'm actually gonna move that into my project so i'm gonna 11771 03:57:10,630 --> 03:57:10,640 move that into my project so i'm gonna 11772 03:57:10,640 --> 03:57:13,510 move that into my project so i'm gonna copy that and i'm gonna drop it in here 11773 03:57:13,510 --> 03:57:13,520 copy that and i'm gonna drop it in here 11774 03:57:13,520 --> 03:57:16,950 copy that and i'm gonna drop it in here so that we have the file right in our 11775 03:57:16,950 --> 03:57:16,960 so that we have the file right in our 11776 03:57:16,960 --> 03:57:19,510 so that we have the file right in our project and so we can basically just 11777 03:57:19,510 --> 03:57:19,520 project and so we can basically just 11778 03:57:19,520 --> 03:57:19,990 project and so we can basically just read it 11779 03:57:19,990 --> 03:57:20,000 read it 11780 03:57:20,000 --> 03:57:23,910 read it easily and okay and here is 11781 03:57:23,910 --> 03:57:23,920 easily and okay and here is 11782 03:57:23,920 --> 03:57:26,389 easily and okay and here is our inventory file so that's taken care 11783 03:57:26,389 --> 03:57:26,399 our inventory file so that's taken care 11784 03:57:26,399 --> 03:57:28,870 our inventory file so that's taken care of so obviously what we want to do now 11785 03:57:28,870 --> 03:57:28,880 of so obviously what we want to do now 11786 03:57:28,880 --> 03:57:32,070 of so obviously what we want to do now is read that file so basically let our 11787 03:57:32,070 --> 03:57:32,080 is read that file so basically let our 11788 03:57:32,080 --> 03:57:33,349 is read that file so basically let our python program 11789 03:57:33,349 --> 03:57:33,359 python program 11790 03:57:33,359 --> 03:57:35,990 python program read the contents of that file right 11791 03:57:35,990 --> 03:57:36,000 read the contents of that file right 11792 03:57:36,000 --> 03:57:36,469 read the contents of that file right here 11793 03:57:36,469 --> 03:57:36,479 here 11794 03:57:36,479 --> 03:57:38,309 here because we want to write some logic 11795 03:57:38,309 --> 03:57:38,319 because we want to write some logic 11796 03:57:38,319 --> 03:57:40,630 because we want to write some logic based on the values 11797 03:57:40,630 --> 03:57:40,640 based on the values 11798 03:57:40,640 --> 03:57:42,870 based on the values that are in this inventory file right we 11799 03:57:42,870 --> 03:57:42,880 that are in this inventory file right we 11800 03:57:42,880 --> 03:57:44,630 that are in this inventory file right we want to calculate stuff we want to 11801 03:57:44,630 --> 03:57:44,640 want to calculate stuff we want to 11802 03:57:44,640 --> 03:57:46,389 want to calculate stuff we want to list some stuff and so on so basically 11803 03:57:46,389 --> 03:57:46,399 list some stuff and so on so basically 11804 03:57:46,399 --> 03:57:48,630 list some stuff and so on so basically we want to work with these values and in 11805 03:57:48,630 --> 03:57:48,640 we want to work with these values and in 11806 03:57:48,640 --> 03:57:50,550 we want to work with these values and in order to do that we need to 11807 03:57:50,550 --> 03:57:50,560 order to do that we need to 11808 03:57:50,560 --> 03:57:52,630 order to do that we need to read all of these values into our 11809 03:57:52,630 --> 03:57:52,640 read all of these values into our 11810 03:57:52,640 --> 03:57:55,030 read all of these values into our program so that we have them available 11811 03:57:55,030 --> 03:57:55,040 program so that we have them available 11812 03:57:55,040 --> 03:57:57,429 program so that we have them available so how do we do that now there is 11813 03:57:57,429 --> 03:57:57,439 so how do we do that now there is 11814 03:57:57,439 --> 03:57:58,229 so how do we do that now there is actually a 11815 03:57:58,229 --> 03:57:58,239 actually a 11816 03:57:58,239 --> 03:58:00,710 actually a built-in module in python that allows 11817 03:58:00,710 --> 03:58:00,720 built-in module in python that allows 11818 03:58:00,720 --> 03:58:02,469 built-in module in python that allows you to work with files 11819 03:58:02,469 --> 03:58:02,479 you to work with files 11820 03:58:02,479 --> 03:58:05,030 you to work with files generally right it's not specific for a 11821 03:58:05,030 --> 03:58:05,040 generally right it's not specific for a 11822 03:58:05,040 --> 03:58:05,830 generally right it's not specific for a spreadsheet 11823 03:58:05,830 --> 03:58:05,840 spreadsheet 11824 03:58:05,840 --> 03:58:08,389 spreadsheet or for any other file type it's for 11825 03:58:08,389 --> 03:58:08,399 or for any other file type it's for 11826 03:58:08,399 --> 03:58:09,830 or for any other file type it's for different types of files 11827 03:58:09,830 --> 03:58:09,840 different types of files 11828 03:58:09,840 --> 03:58:13,189 different types of files generally however there is an external 11829 03:58:13,189 --> 03:58:13,199 generally however there is an external 11830 03:58:13,199 --> 03:58:14,309 generally however there is an external package 11831 03:58:14,309 --> 03:58:14,319 package 11832 03:58:14,319 --> 03:58:16,389 package that allows you to work with 11833 03:58:16,389 --> 03:58:16,399 that allows you to work with 11834 03:58:16,399 --> 03:58:17,349 that allows you to work with spreadsheets 11835 03:58:17,349 --> 03:58:17,359 spreadsheets 11836 03:58:17,359 --> 03:58:20,389 spreadsheets specifically and the obvious advantage 11837 03:58:20,389 --> 03:58:20,399 specifically and the obvious advantage 11838 03:58:20,399 --> 03:58:21,030 specifically and the obvious advantage is that 11839 03:58:21,030 --> 03:58:21,040 is that 11840 03:58:21,040 --> 03:58:22,950 is that that external module that allows you to 11841 03:58:22,950 --> 03:58:22,960 that external module that allows you to 11842 03:58:22,960 --> 03:58:24,389 that external module that allows you to work with spreadsheets or 11843 03:58:24,389 --> 03:58:24,399 work with spreadsheets or 11844 03:58:24,399 --> 03:58:26,630 work with spreadsheets or was created to work with spreadsheets 11845 03:58:26,630 --> 03:58:26,640 was created to work with spreadsheets 11846 03:58:26,640 --> 03:58:27,510 was created to work with spreadsheets specifically 11847 03:58:27,510 --> 03:58:27,520 specifically 11848 03:58:27,520 --> 03:58:30,389 specifically has much more functions and is much 11849 03:58:30,389 --> 03:58:30,399 has much more functions and is much 11850 03:58:30,399 --> 03:58:31,830 has much more functions and is much easier to use 11851 03:58:31,830 --> 03:58:31,840 easier to use 11852 03:58:31,840 --> 03:58:33,830 easier to use if you are working with spreadsheets 11853 03:58:33,830 --> 03:58:33,840 if you are working with spreadsheets 11854 03:58:33,840 --> 03:58:35,990 if you are working with spreadsheets compared to this built-in file module 11855 03:58:35,990 --> 03:58:36,000 compared to this built-in file module 11856 03:58:36,000 --> 03:58:37,910 compared to this built-in file module so that's one of the cases where you may 11857 03:58:37,910 --> 03:58:37,920 so that's one of the cases where you may 11858 03:58:37,920 --> 03:58:39,990 so that's one of the cases where you may have multiple ways of 11859 03:58:39,990 --> 03:58:40,000 have multiple ways of 11860 03:58:40,000 --> 03:58:42,710 have multiple ways of actually implementing some functionality 11861 03:58:42,710 --> 03:58:42,720 actually implementing some functionality 11862 03:58:42,720 --> 03:58:43,030 actually implementing some functionality for 11863 03:58:43,030 --> 03:58:43,040 for 11864 03:58:43,040 --> 03:58:45,110 for application and then you have to make 11865 03:58:45,110 --> 03:58:45,120 application and then you have to make 11866 03:58:45,120 --> 03:58:47,429 application and then you have to make this decision of maybe finding a better 11867 03:58:47,429 --> 03:58:47,439 this decision of maybe finding a better 11868 03:58:47,439 --> 03:58:49,189 this decision of maybe finding a better package or better module 11869 03:58:49,189 --> 03:58:49,199 package or better module 11870 03:58:49,199 --> 03:58:51,830 package or better module which is available externally that will 11871 03:58:51,830 --> 03:58:51,840 which is available externally that will 11872 03:58:51,840 --> 03:58:53,590 which is available externally that will make it easier for you 11873 03:58:53,590 --> 03:58:53,600 make it easier for you 11874 03:58:53,600 --> 03:58:55,830 make it easier for you to implement that functionality so 11875 03:58:55,830 --> 03:58:55,840 to implement that functionality so 11876 03:58:55,840 --> 03:58:57,510 to implement that functionality so that's what we're gonna do for our 11877 03:58:57,510 --> 03:58:57,520 that's what we're gonna do for our 11878 03:58:57,520 --> 03:58:58,150 that's what we're gonna do for our project 11879 03:58:58,150 --> 03:58:58,160 project 11880 03:58:58,160 --> 03:58:59,910 project we're going to choose the package that 11881 03:58:59,910 --> 03:58:59,920 we're going to choose the package that 11882 03:58:59,920 --> 03:59:01,670 we're going to choose the package that is actually made for working with 11883 03:59:01,670 --> 03:59:01,680 is actually made for working with 11884 03:59:01,680 --> 03:59:02,550 is actually made for working with spreadsheets 11885 03:59:02,550 --> 03:59:02,560 spreadsheets 11886 03:59:02,560 --> 03:59:04,070 spreadsheets we're going to use that one and it's 11887 03:59:04,070 --> 03:59:04,080 we're going to use that one and it's 11888 03:59:04,080 --> 03:59:05,990 we're going to use that one and it's called open 11889 03:59:05,990 --> 03:59:06,000 called open 11890 03:59:06,000 --> 03:59:09,670 called open pi xl and if i 11891 03:59:09,670 --> 03:59:09,680 pi xl and if i 11892 03:59:09,680 --> 03:59:11,830 pi xl and if i search for it this is the package that 11893 03:59:11,830 --> 03:59:11,840 search for it this is the package that 11894 03:59:11,840 --> 03:59:12,870 search for it this is the package that we're looking for 11895 03:59:12,870 --> 03:59:12,880 we're looking for 11896 03:59:12,880 --> 03:59:15,590 we're looking for and if i click inside basically we have 11897 03:59:15,590 --> 03:59:15,600 and if i click inside basically we have 11898 03:59:15,600 --> 03:59:16,870 and if i click inside basically we have some information 11899 03:59:16,870 --> 03:59:16,880 some information 11900 03:59:16,880 --> 03:59:19,590 some information about this package so here we see a 11901 03:59:19,590 --> 03:59:19,600 about this package so here we see a 11902 03:59:19,600 --> 03:59:20,630 about this package so here we see a description 11903 03:59:20,630 --> 03:59:20,640 description 11904 03:59:20,640 --> 03:59:22,550 description let's actually make this bigger 11905 03:59:22,550 --> 03:59:22,560 let's actually make this bigger 11906 03:59:22,560 --> 03:59:23,990 let's actually make this bigger description 11907 03:59:23,990 --> 03:59:24,000 description 11908 03:59:24,000 --> 03:59:27,189 description library to read write excel 11909 03:59:27,189 --> 03:59:27,199 library to read write excel 11910 03:59:27,199 --> 03:59:30,630 library to read write excel files with all these formats 11911 03:59:30,630 --> 03:59:30,640 files with all these formats 11912 03:59:30,640 --> 03:59:32,070 files with all these formats so this is the library that we're going 11913 03:59:32,070 --> 03:59:32,080 so this is the library that we're going 11914 03:59:32,080 --> 03:59:34,630 so this is the library that we're going to be using in the same way as we did 11915 03:59:34,630 --> 03:59:34,640 to be using in the same way as we did 11916 03:59:34,640 --> 03:59:35,349 to be using in the same way as we did before 11917 03:59:35,349 --> 03:59:35,359 before 11918 03:59:35,359 --> 03:59:37,189 before we're going to copy that command and 11919 03:59:37,189 --> 03:59:37,199 we're going to copy that command and 11920 03:59:37,199 --> 03:59:39,429 we're going to copy that command and execute it from pycharms 11921 03:59:39,429 --> 03:59:39,439 execute it from pycharms 11922 03:59:39,439 --> 03:59:42,150 execute it from pycharms integrated terminal so from here i'm 11923 03:59:42,150 --> 03:59:42,160 integrated terminal so from here i'm 11924 03:59:42,160 --> 03:59:43,189 integrated terminal so from here i'm gonna 11925 03:59:43,189 --> 03:59:43,199 gonna 11926 03:59:43,199 --> 03:59:46,469 gonna execute this pip command and install 11927 03:59:46,469 --> 03:59:46,479 execute this pip command and install 11928 03:59:46,479 --> 03:59:50,469 execute this pip command and install our module and as you see 11929 03:59:50,469 --> 03:59:50,479 our module and as you see 11930 03:59:50,479 --> 03:59:53,670 our module and as you see successfully installed open pi xl 11931 03:59:53,670 --> 03:59:53,680 successfully installed open pi xl 11932 03:59:53,680 --> 03:59:55,349 successfully installed open pi xl and this is the version of the module 11933 03:59:55,349 --> 03:59:55,359 and this is the version of the module 11934 03:59:55,359 --> 03:59:57,110 and this is the version of the module that we installed and 11935 03:59:57,110 --> 03:59:57,120 that we installed and 11936 03:59:57,120 --> 04:00:00,229 that we installed and in external libraries site packages you 11937 04:00:00,229 --> 04:00:00,239 in external libraries site packages you 11938 04:00:00,239 --> 04:00:01,510 in external libraries site packages you should be able to see 11939 04:00:01,510 --> 04:00:01,520 should be able to see 11940 04:00:01,520 --> 04:00:05,030 should be able to see our open pi excel package 11941 04:00:05,030 --> 04:00:05,040 our open pi excel package 11942 04:00:05,040 --> 04:00:07,189 our open pi excel package and now because the package is available 11943 04:00:07,189 --> 04:00:07,199 and now because the package is available 11944 04:00:07,199 --> 04:00:08,550 and now because the package is available locally i can do 11945 04:00:08,550 --> 04:00:08,560 locally i can do 11946 04:00:08,560 --> 04:00:11,750 locally i can do import and open 11947 04:00:11,750 --> 04:00:11,760 import and open 11948 04:00:11,760 --> 04:00:14,389 import and open pi excel again i get a suggestion from 11949 04:00:14,389 --> 04:00:14,399 pi excel again i get a suggestion from 11950 04:00:14,399 --> 04:00:16,309 pi excel again i get a suggestion from pycharm because the module is there 11951 04:00:16,309 --> 04:00:16,319 pycharm because the module is there 11952 04:00:16,319 --> 04:00:19,429 pycharm because the module is there and now we are able to use that package 11953 04:00:19,429 --> 04:00:19,439 and now we are able to use that package 11954 04:00:19,439 --> 04:00:21,910 and now we are able to use that package for our application and one small note 11955 04:00:21,910 --> 04:00:21,920 for our application and one small note 11956 04:00:21,920 --> 04:00:23,670 for our application and one small note here if you're wondering 11957 04:00:23,670 --> 04:00:23,680 here if you're wondering 11958 04:00:23,680 --> 04:00:26,389 here if you're wondering why there are some packages with 11959 04:00:26,389 --> 04:00:26,399 why there are some packages with 11960 04:00:26,399 --> 04:00:27,429 why there are some packages with basically a dot 11961 04:00:27,429 --> 04:00:27,439 basically a dot 11962 04:00:27,439 --> 04:00:30,150 basically a dot inside and some without these are the 11963 04:00:30,150 --> 04:00:30,160 inside and some without these are the 11964 04:00:30,160 --> 04:00:31,269 inside and some without these are the packages 11965 04:00:31,269 --> 04:00:31,279 packages 11966 04:00:31,279 --> 04:00:33,910 packages that we install python packages and we 11967 04:00:33,910 --> 04:00:33,920 that we install python packages and we 11968 04:00:33,920 --> 04:00:35,269 that we install python packages and we know that because there's this 11969 04:00:35,269 --> 04:00:35,279 know that because there's this 11970 04:00:35,279 --> 04:00:38,550 know that because there's this init python file inside and the ones 11971 04:00:38,550 --> 04:00:38,560 init python file inside and the ones 11972 04:00:38,560 --> 04:00:41,990 init python file inside and the ones without the dot they're just folders 11973 04:00:41,990 --> 04:00:42,000 without the dot they're just folders 11974 04:00:42,000 --> 04:00:43,990 without the dot they're just folders with bunch of files inside but they're 11975 04:00:43,990 --> 04:00:44,000 with bunch of files inside but they're 11976 04:00:44,000 --> 04:00:46,389 with bunch of files inside but they're not python packages so to say 11977 04:00:46,389 --> 04:00:46,399 not python packages so to say 11978 04:00:46,399 --> 04:00:50,229 not python packages so to say and inside some of those packages we see 11979 04:00:50,229 --> 04:00:50,239 and inside some of those packages we see 11980 04:00:50,239 --> 04:00:52,710 and inside some of those packages we see other packages as well with their own 11981 04:00:52,710 --> 04:00:52,720 other packages as well with their own 11982 04:00:52,720 --> 04:00:53,750 other packages as well with their own init file 11983 04:00:53,750 --> 04:00:53,760 init file 11984 04:00:53,760 --> 04:00:56,389 init file so basically hierarchy of multiple 11985 04:00:56,389 --> 04:00:56,399 so basically hierarchy of multiple 11986 04:00:56,399 --> 04:00:57,670 so basically hierarchy of multiple packages 11987 04:00:57,670 --> 04:00:57,680 packages 11988 04:00:57,680 --> 04:01:00,309 packages and at this point i'm going to say that 11989 04:01:00,309 --> 04:01:00,319 and at this point i'm going to say that 11990 04:01:00,319 --> 04:01:00,950 and at this point i'm going to say that the word 11991 04:01:00,950 --> 04:01:00,960 the word 11992 04:01:00,960 --> 04:01:04,389 the word library basically describes package 11993 04:01:04,389 --> 04:01:04,399 library basically describes package 11994 04:01:04,399 --> 04:01:07,510 library basically describes package that includes multiple other packages so 11995 04:01:07,510 --> 04:01:07,520 that includes multiple other packages so 11996 04:01:07,520 --> 04:01:09,269 that includes multiple other packages so basically which has a hierarchy of 11997 04:01:09,269 --> 04:01:09,279 basically which has a hierarchy of 11998 04:01:09,279 --> 04:01:09,990 basically which has a hierarchy of packages 11999 04:01:09,990 --> 04:01:10,000 packages 12000 04:01:10,000 --> 04:01:12,550 packages so we have module which is basically 12001 04:01:12,550 --> 04:01:12,560 so we have module which is basically 12002 04:01:12,560 --> 04:01:14,229 so we have module which is basically just one python file 12003 04:01:14,229 --> 04:01:14,239 just one python file 12004 04:01:14,239 --> 04:01:16,550 just one python file that we can use in our project then we 12005 04:01:16,550 --> 04:01:16,560 that we can use in our project then we 12006 04:01:16,560 --> 04:01:18,150 that we can use in our project then we have package which is 12007 04:01:18,150 --> 04:01:18,160 have package which is 12008 04:01:18,160 --> 04:01:21,590 have package which is a hierarchy of multiple modules with an 12009 04:01:21,590 --> 04:01:21,600 a hierarchy of multiple modules with an 12010 04:01:21,600 --> 04:01:24,150 a hierarchy of multiple modules with an init python file inside and then we have 12011 04:01:24,150 --> 04:01:24,160 init python file inside and then we have 12012 04:01:24,160 --> 04:01:25,990 init python file inside and then we have library which is basically 12013 04:01:25,990 --> 04:01:26,000 library which is basically 12014 04:01:26,000 --> 04:01:28,150 library which is basically multiple packages together in a 12015 04:01:28,150 --> 04:01:28,160 multiple packages together in a 12016 04:01:28,160 --> 04:01:29,110 multiple packages together in a hierarchy 12017 04:01:29,110 --> 04:01:29,120 hierarchy 12018 04:01:29,120 --> 04:01:32,150 hierarchy just like we see right here so note the 12019 04:01:32,150 --> 04:01:32,160 just like we see right here so note the 12020 04:01:32,160 --> 04:01:32,950 just like we see right here so note the difference 12021 04:01:32,950 --> 04:01:32,960 difference 12022 04:01:32,960 --> 04:01:34,550 difference so you don't get confused when you see 12023 04:01:34,550 --> 04:01:34,560 so you don't get confused when you see 12024 04:01:34,560 --> 04:01:36,550 so you don't get confused when you see library package and module 12025 04:01:36,550 --> 04:01:36,560 library package and module 12026 04:01:36,560 --> 04:01:42,309 library package and module especially if used interchangeably 12027 04:01:46,229 --> 04:01:46,239 great so now we have our module in place 12028 04:01:46,239 --> 04:01:48,229 great so now we have our module in place so let's use it now to read our 12029 04:01:48,229 --> 04:01:48,239 so let's use it now to read our 12030 04:01:48,239 --> 04:01:49,429 so let's use it now to read our spreadsheet file 12031 04:01:49,429 --> 04:01:49,439 spreadsheet file 12032 04:01:49,439 --> 04:01:51,750 spreadsheet file and again you basically have to know the 12033 04:01:51,750 --> 04:01:51,760 and again you basically have to know the 12034 04:01:51,760 --> 04:01:52,870 and again you basically have to know the function names 12035 04:01:52,870 --> 04:01:52,880 function names 12036 04:01:52,880 --> 04:01:55,510 function names to do that if you don't you can do dot 12037 04:01:55,510 --> 04:01:55,520 to do that if you don't you can do dot 12038 04:01:55,520 --> 04:01:57,510 to do that if you don't you can do dot and get suggestions 12039 04:01:57,510 --> 04:01:57,520 and get suggestions 12040 04:01:57,520 --> 04:01:59,429 and get suggestions and load workbook is actually the 12041 04:01:59,429 --> 04:01:59,439 and load workbook is actually the 12042 04:01:59,439 --> 04:02:00,710 and load workbook is actually the function that we need 12043 04:02:00,710 --> 04:02:00,720 function that we need 12044 04:02:00,720 --> 04:02:02,710 function that we need in order to read our spreadsheet file so 12045 04:02:02,710 --> 04:02:02,720 in order to read our spreadsheet file so 12046 04:02:02,720 --> 04:02:04,309 in order to read our spreadsheet file so i'm going to choose this 12047 04:02:04,309 --> 04:02:04,319 i'm going to choose this 12048 04:02:04,319 --> 04:02:07,110 i'm going to choose this function and obviously we need to tell 12049 04:02:07,110 --> 04:02:07,120 function and obviously we need to tell 12050 04:02:07,120 --> 04:02:07,990 function and obviously we need to tell this function 12051 04:02:07,990 --> 04:02:08,000 this function 12052 04:02:08,000 --> 04:02:10,870 this function which file it should read so as a 12053 04:02:10,870 --> 04:02:10,880 which file it should read so as a 12054 04:02:10,880 --> 04:02:11,750 which file it should read so as a parameter 12055 04:02:11,750 --> 04:02:11,760 parameter 12056 04:02:11,760 --> 04:02:14,870 parameter we're going to say please 12057 04:02:14,870 --> 04:02:14,880 we're going to say please 12058 04:02:14,880 --> 04:02:17,030 we're going to say please load inventory file and we even get a 12059 04:02:17,030 --> 04:02:17,040 load inventory file and we even get a 12060 04:02:17,040 --> 04:02:18,389 load inventory file and we even get a suggestion because we have this 12061 04:02:18,389 --> 04:02:18,399 suggestion because we have this 12062 04:02:18,399 --> 04:02:20,070 suggestion because we have this inventory file here 12063 04:02:20,070 --> 04:02:20,080 inventory file here 12064 04:02:20,080 --> 04:02:22,950 inventory file here and there you go now this function will 12065 04:02:22,950 --> 04:02:22,960 and there you go now this function will 12066 04:02:22,960 --> 04:02:25,110 and there you go now this function will load the workbook and all its contents 12067 04:02:25,110 --> 04:02:25,120 load the workbook and all its contents 12068 04:02:25,120 --> 04:02:27,670 load the workbook and all its contents and later we obviously want to do 12069 04:02:27,670 --> 04:02:27,680 and later we obviously want to do 12070 04:02:27,680 --> 04:02:29,189 and later we obviously want to do something with that content 12071 04:02:29,189 --> 04:02:29,199 something with that content 12072 04:02:29,199 --> 04:02:31,110 something with that content so in order to be able to do that we 12073 04:02:31,110 --> 04:02:31,120 so in order to be able to do that we 12074 04:02:31,120 --> 04:02:33,189 so in order to be able to do that we need to save it first as a variable 12075 04:02:33,189 --> 04:02:33,199 need to save it first as a variable 12076 04:02:33,199 --> 04:02:36,630 need to save it first as a variable and let's actually call it inventory 12077 04:02:36,630 --> 04:02:36,640 and let's actually call it inventory 12078 04:02:36,640 --> 04:02:40,070 and let's actually call it inventory file like this and this will give us the 12079 04:02:40,070 --> 04:02:40,080 file like this and this will give us the 12080 04:02:40,080 --> 04:02:41,269 file like this and this will give us the file contents 12081 04:02:41,269 --> 04:02:41,279 file contents 12082 04:02:41,279 --> 04:02:45,830 file contents now let's actually open that file again 12083 04:02:47,990 --> 04:02:48,000 and let's see exactly what we need so we 12084 04:02:48,000 --> 04:02:49,269 and let's see exactly what we need so we can have multiple 12085 04:02:49,269 --> 04:02:49,279 can have multiple 12086 04:02:49,279 --> 04:02:52,469 can have multiple such sheets basically per file so we 12087 04:02:52,469 --> 04:02:52,479 such sheets basically per file so we 12088 04:02:52,479 --> 04:02:54,150 such sheets basically per file so we need to tell the program which one it 12089 04:02:54,150 --> 04:02:54,160 need to tell the program which one it 12090 04:02:54,160 --> 04:02:54,630 need to tell the program which one it should use 12091 04:02:54,630 --> 04:02:54,640 should use 12092 04:02:54,640 --> 04:02:57,750 should use exactly so for example if this was 12093 04:02:57,750 --> 04:02:57,760 exactly so for example if this was 12094 04:02:57,760 --> 04:03:01,030 exactly so for example if this was called a product list 12095 04:03:01,030 --> 04:03:01,040 called a product list 12096 04:03:01,040 --> 04:03:02,870 called a product list you would use that name but we're gonna 12097 04:03:02,870 --> 04:03:02,880 you would use that name but we're gonna 12098 04:03:02,880 --> 04:03:04,150 you would use that name but we're gonna go with sheet 12099 04:03:04,150 --> 04:03:04,160 go with sheet 12100 04:03:04,160 --> 04:03:06,950 go with sheet one so we're gonna use that name 12101 04:03:06,950 --> 04:03:06,960 one so we're gonna use that name 12102 04:03:06,960 --> 04:03:08,950 one so we're gonna use that name basically 12103 04:03:08,950 --> 04:03:08,960 basically 12104 04:03:08,960 --> 04:03:12,550 basically and we're gonna grab that using 12105 04:03:12,550 --> 04:03:12,560 and we're gonna grab that using 12106 04:03:12,560 --> 04:03:14,710 and we're gonna grab that using following syntax and you remember this 12107 04:03:14,710 --> 04:03:14,720 following syntax and you remember this 12108 04:03:14,720 --> 04:03:16,790 following syntax and you remember this syntax probably from using a dictionary 12109 04:03:16,790 --> 04:03:16,800 syntax probably from using a dictionary 12110 04:03:16,800 --> 04:03:19,670 syntax probably from using a dictionary so this will give us this one specific 12111 04:03:19,670 --> 04:03:19,680 so this will give us this one specific 12112 04:03:19,680 --> 04:03:21,910 so this will give us this one specific sheet and all the information inside 12113 04:03:21,910 --> 04:03:21,920 sheet and all the information inside 12114 04:03:21,920 --> 04:03:23,670 sheet and all the information inside and we can also save that into a 12115 04:03:23,670 --> 04:03:23,680 and we can also save that into a 12116 04:03:23,680 --> 04:03:25,990 and we can also save that into a variable so let's actually call that 12117 04:03:25,990 --> 04:03:26,000 variable so let's actually call that 12118 04:03:26,000 --> 04:03:29,910 variable so let's actually call that product list so now we have read the 12119 04:03:29,910 --> 04:03:29,920 product list so now we have read the 12120 04:03:29,920 --> 04:03:31,990 product list so now we have read the whole file then we have read this 12121 04:03:31,990 --> 04:03:32,000 whole file then we have read this 12122 04:03:32,000 --> 04:03:33,830 whole file then we have read this specific sheet of that file 12123 04:03:33,830 --> 04:03:33,840 specific sheet of that file 12124 04:03:33,840 --> 04:03:36,229 specific sheet of that file and now we have all this information in 12125 04:03:36,229 --> 04:03:36,239 and now we have all this information in 12126 04:03:36,239 --> 04:03:37,429 and now we have all this information in that variable 12127 04:03:37,429 --> 04:03:37,439 that variable 12128 04:03:37,439 --> 04:03:39,910 that variable so now we can read any of those values 12129 04:03:39,910 --> 04:03:39,920 so now we can read any of those values 12130 04:03:39,920 --> 04:03:40,550 so now we can read any of those values and 12131 04:03:40,550 --> 04:03:40,560 and 12132 04:03:40,560 --> 04:03:46,710 and do calculations etc using that variable 12133 04:03:49,510 --> 04:03:49,520 so let's get to our first task and the 12134 04:03:49,520 --> 04:03:52,630 so let's get to our first task and the first task is basically to calculate 12135 04:03:52,630 --> 04:03:52,640 first task is basically to calculate 12136 04:03:52,640 --> 04:03:56,309 first task is basically to calculate how many products we have per supplier 12137 04:03:56,309 --> 04:03:56,319 how many products we have per supplier 12138 04:03:56,319 --> 04:03:59,110 how many products we have per supplier and then list the names of the suppliers 12139 04:03:59,110 --> 04:03:59,120 and then list the names of the suppliers 12140 04:03:59,120 --> 04:03:59,750 and then list the names of the suppliers with that 12141 04:03:59,750 --> 04:03:59,760 with that 12142 04:03:59,760 --> 04:04:02,469 with that respective number of products so let's 12143 04:04:02,469 --> 04:04:02,479 respective number of products so let's 12144 04:04:02,479 --> 04:04:05,189 respective number of products so let's go back and do that 12145 04:04:05,189 --> 04:04:05,199 go back and do that 12146 04:04:05,199 --> 04:04:07,590 go back and do that so the results what we want to get is 12147 04:04:07,590 --> 04:04:07,600 so the results what we want to get is 12148 04:04:07,600 --> 04:04:08,469 so the results what we want to get is basically 12149 04:04:08,469 --> 04:04:08,479 basically 12150 04:04:08,479 --> 04:04:11,750 basically products or number of products 12151 04:04:11,750 --> 04:04:11,760 products or number of products 12152 04:04:11,760 --> 04:04:15,189 products or number of products per supplier right that's basically what 12153 04:04:15,189 --> 04:04:15,199 per supplier right that's basically what 12154 04:04:15,199 --> 04:04:16,870 per supplier right that's basically what we want to get as a result 12155 04:04:16,870 --> 04:04:16,880 we want to get as a result 12156 04:04:16,880 --> 04:04:18,790 we want to get as a result so we're going to create that variable 12157 04:04:18,790 --> 04:04:18,800 so we're going to create that variable 12158 04:04:18,800 --> 04:04:19,990 so we're going to create that variable and we're going to set it 12159 04:04:19,990 --> 04:04:20,000 and we're going to set it 12160 04:04:20,000 --> 04:04:23,030 and we're going to set it to an empty dictionary so 12161 04:04:23,030 --> 04:04:23,040 to an empty dictionary so 12162 04:04:23,040 --> 04:04:25,590 to an empty dictionary so by the end our program should give us 12163 04:04:25,590 --> 04:04:25,600 by the end our program should give us 12164 04:04:25,600 --> 04:04:27,030 by the end our program should give us something like this 12165 04:04:27,030 --> 04:04:27,040 something like this 12166 04:04:27,040 --> 04:04:29,189 something like this a dictionary where the name of the 12167 04:04:29,189 --> 04:04:29,199 a dictionary where the name of the 12168 04:04:29,199 --> 04:04:30,710 a dictionary where the name of the company is the key 12169 04:04:30,710 --> 04:04:30,720 company is the key 12170 04:04:30,720 --> 04:04:34,229 company is the key and the value is basically product count 12171 04:04:34,229 --> 04:04:34,239 and the value is basically product count 12172 04:04:34,239 --> 04:04:37,349 and the value is basically product count for that company and since we have 12173 04:04:37,349 --> 04:04:37,359 for that company and since we have 12174 04:04:37,359 --> 04:04:39,750 for that company and since we have three suppliers or three companies we're 12175 04:04:39,750 --> 04:04:39,760 three suppliers or three companies we're 12176 04:04:39,760 --> 04:04:40,710 three suppliers or three companies we're gonna end up with 12177 04:04:40,710 --> 04:04:40,720 gonna end up with 12178 04:04:40,720 --> 04:04:43,510 gonna end up with a dictionary with three key value pairs 12179 04:04:43,510 --> 04:04:43,520 a dictionary with three key value pairs 12180 04:04:43,520 --> 04:04:44,070 a dictionary with three key value pairs per 12181 04:04:44,070 --> 04:04:44,080 per 12182 04:04:44,080 --> 04:04:47,590 per company so we're starting with an empty 12183 04:04:47,590 --> 04:04:47,600 company so we're starting with an empty 12184 04:04:47,600 --> 04:04:50,150 company so we're starting with an empty dictionary for products per supplier and 12185 04:04:50,150 --> 04:04:50,160 dictionary for products per supplier and 12186 04:04:50,160 --> 04:04:51,830 dictionary for products per supplier and now let's see how we can 12187 04:04:51,830 --> 04:04:51,840 now let's see how we can 12188 04:04:51,840 --> 04:04:55,030 now let's see how we can programmatically calculate this 12189 04:04:55,030 --> 04:04:55,040 programmatically calculate this 12190 04:04:55,040 --> 04:04:58,150 programmatically calculate this first of all what we need is we need to 12191 04:04:58,150 --> 04:04:58,160 first of all what we need is we need to 12192 04:04:58,160 --> 04:05:01,670 first of all what we need is we need to go through each of these lines basically 12193 04:05:01,670 --> 04:05:01,680 go through each of these lines basically 12194 04:05:01,680 --> 04:05:03,670 go through each of these lines basically so we have these rows so we need to go 12195 04:05:03,670 --> 04:05:03,680 so we have these rows so we need to go 12196 04:05:03,680 --> 04:05:05,429 so we have these rows so we need to go through each and every 12197 04:05:05,429 --> 04:05:05,439 through each and every 12198 04:05:05,439 --> 04:05:09,189 through each and every row in order in sequence and we need to 12199 04:05:09,189 --> 04:05:09,199 row in order in sequence and we need to 12200 04:05:09,199 --> 04:05:09,910 row in order in sequence and we need to get 12201 04:05:09,910 --> 04:05:09,920 get 12202 04:05:09,920 --> 04:05:13,269 get or check a supplier name for that row 12203 04:05:13,269 --> 04:05:13,279 or check a supplier name for that row 12204 04:05:13,279 --> 04:05:16,070 or check a supplier name for that row and you remember whenever we execute a 12205 04:05:16,070 --> 04:05:16,080 and you remember whenever we execute a 12206 04:05:16,080 --> 04:05:16,950 and you remember whenever we execute a logic 12207 04:05:16,950 --> 04:05:16,960 logic 12208 04:05:16,960 --> 04:05:20,710 logic on multiple values over and over again 12209 04:05:20,710 --> 04:05:20,720 on multiple values over and over again 12210 04:05:20,720 --> 04:05:22,790 on multiple values over and over again so basically same logic or same function 12211 04:05:22,790 --> 04:05:22,800 so basically same logic or same function 12212 04:05:22,800 --> 04:05:23,990 so basically same logic or same function gets executed 12213 04:05:23,990 --> 04:05:24,000 gets executed 12214 04:05:24,000 --> 04:05:26,950 gets executed for multiple different values for a 12215 04:05:26,950 --> 04:05:26,960 for multiple different values for a 12216 04:05:26,960 --> 04:05:28,150 for multiple different values for a number of times 12217 04:05:28,150 --> 04:05:28,160 number of times 12218 04:05:28,160 --> 04:05:30,469 number of times that's basically a use case for a loop 12219 04:05:30,469 --> 04:05:30,479 that's basically a use case for a loop 12220 04:05:30,479 --> 04:05:32,070 that's basically a use case for a loop right so we're looping 12221 04:05:32,070 --> 04:05:32,080 right so we're looping 12222 04:05:32,080 --> 04:05:35,110 right so we're looping through those rows and we're doing the 12223 04:05:35,110 --> 04:05:35,120 through those rows and we're doing the 12224 04:05:35,120 --> 04:05:36,070 through those rows and we're doing the same thing 12225 04:05:36,070 --> 04:05:36,080 same thing 12226 04:05:36,080 --> 04:05:38,550 same thing per row which is getting the name of the 12227 04:05:38,550 --> 04:05:38,560 per row which is getting the name of the 12228 04:05:38,560 --> 04:05:39,750 per row which is getting the name of the supplier now 12229 04:05:39,750 --> 04:05:39,760 supplier now 12230 04:05:39,760 --> 04:05:42,229 supplier now as you also remember loops have 12231 04:05:42,229 --> 04:05:42,239 as you also remember loops have 12232 04:05:42,239 --> 04:05:43,349 as you also remember loops have conditions right 12233 04:05:43,349 --> 04:05:43,359 conditions right 12234 04:05:43,359 --> 04:05:45,670 conditions right we need to tell the loop how many times 12235 04:05:45,670 --> 04:05:45,680 we need to tell the loop how many times 12236 04:05:45,680 --> 04:05:47,030 we need to tell the loop how many times it should execute 12237 04:05:47,030 --> 04:05:47,040 it should execute 12238 04:05:47,040 --> 04:05:49,670 it should execute that specific logic and if we check our 12239 04:05:49,670 --> 04:05:49,680 that specific logic and if we check our 12240 04:05:49,680 --> 04:05:50,710 that specific logic and if we check our file here 12241 04:05:50,710 --> 04:05:50,720 file here 12242 04:05:50,720 --> 04:05:52,550 file here how many times we want to execute the 12243 04:05:52,550 --> 04:05:52,560 how many times we want to execute the 12244 04:05:52,560 --> 04:05:55,030 how many times we want to execute the logic the answer is 12245 04:05:55,030 --> 04:05:55,040 logic the answer is 12246 04:05:55,040 --> 04:05:57,910 logic the answer is as many times as the number of products 12247 04:05:57,910 --> 04:05:57,920 as many times as the number of products 12248 04:05:57,920 --> 04:05:58,309 as many times as the number of products so 12249 04:05:58,309 --> 04:05:58,319 so 12250 04:05:58,319 --> 04:06:02,950 so if we scroll down we have 74 12251 04:06:02,950 --> 04:06:02,960 if we scroll down we have 74 12252 04:06:02,960 --> 04:06:07,110 if we scroll down we have 74 products so we need to do that 74 times 12253 04:06:07,110 --> 04:06:07,120 products so we need to do that 74 times 12254 04:06:07,120 --> 04:06:09,990 products so we need to do that 74 times for each product so basically as many 12255 04:06:09,990 --> 04:06:10,000 for each product so basically as many 12256 04:06:10,000 --> 04:06:10,469 for each product so basically as many times 12257 04:06:10,469 --> 04:06:10,479 times 12258 04:06:10,479 --> 04:06:12,389 times as the number of product and obviously 12259 04:06:12,389 --> 04:06:12,399 as the number of product and obviously 12260 04:06:12,399 --> 04:06:14,150 as the number of product and obviously we want this program to work for 12261 04:06:14,150 --> 04:06:14,160 we want this program to work for 12262 04:06:14,160 --> 04:06:16,950 we want this program to work for any spreadsheet file right with any 12263 04:06:16,950 --> 04:06:16,960 any spreadsheet file right with any 12264 04:06:16,960 --> 04:06:18,710 any spreadsheet file right with any number of products so we need to 12265 04:06:18,710 --> 04:06:18,720 number of products so we need to 12266 04:06:18,720 --> 04:06:21,189 number of products so we need to calculate or we need to read that value 12267 04:06:21,189 --> 04:06:21,199 calculate or we need to read that value 12268 04:06:21,199 --> 04:06:22,469 calculate or we need to read that value also from the file 12269 04:06:22,469 --> 04:06:22,479 also from the file 12270 04:06:22,479 --> 04:06:24,630 also from the file so basically we need to read how many 12271 04:06:24,630 --> 04:06:24,640 so basically we need to read how many 12272 04:06:24,640 --> 04:06:26,389 so basically we need to read how many products are on this list 12273 04:06:26,389 --> 04:06:26,399 products are on this list 12274 04:06:26,399 --> 04:06:28,630 products are on this list so let's see how we can do that first of 12275 04:06:28,630 --> 04:06:28,640 so let's see how we can do that first of 12276 04:06:28,640 --> 04:06:29,830 so let's see how we can do that first of all we're using 12277 04:06:29,830 --> 04:06:29,840 all we're using 12278 04:06:29,840 --> 04:06:32,710 all we're using for loop to execute the logic for 12279 04:06:32,710 --> 04:06:32,720 for loop to execute the logic for 12280 04:06:32,720 --> 04:06:33,429 for loop to execute the logic for specific 12281 04:06:33,429 --> 04:06:33,439 specific 12282 04:06:33,439 --> 04:06:36,150 specific number of times and if you remember from 12283 04:06:36,150 --> 04:06:36,160 number of times and if you remember from 12284 04:06:36,160 --> 04:06:37,670 number of times and if you remember from for loop syntax 12285 04:06:37,670 --> 04:06:37,680 for loop syntax 12286 04:06:37,680 --> 04:06:40,950 for loop syntax four then we have the specific item 12287 04:06:40,950 --> 04:06:40,960 four then we have the specific item 12288 04:06:40,960 --> 04:06:44,469 four then we have the specific item so what is an item in our case our item 12289 04:06:44,469 --> 04:06:44,479 so what is an item in our case our item 12290 04:06:44,479 --> 04:06:47,349 so what is an item in our case our item is a row right product row is going to 12291 04:06:47,349 --> 04:06:47,359 is a row right product row is going to 12292 04:06:47,359 --> 04:06:47,750 is a row right product row is going to be an 12293 04:06:47,750 --> 04:06:47,760 be an 12294 04:06:47,760 --> 04:06:51,590 be an item of iteration so looping basically 12295 04:06:51,590 --> 04:06:51,600 item of iteration so looping basically 12296 04:06:51,600 --> 04:06:55,189 item of iteration so looping basically so we can call our item 12297 04:06:55,189 --> 04:06:55,199 so we can call our item 12298 04:06:55,199 --> 04:06:59,750 so we can call our item products row and then comes in 12299 04:06:59,750 --> 04:06:59,760 products row and then comes in 12300 04:06:59,760 --> 04:07:03,189 products row and then comes in and now we need that condition how many 12301 04:07:03,189 --> 04:07:03,199 and now we need that condition how many 12302 04:07:03,199 --> 04:07:06,469 and now we need that condition how many times and again this should be generic 12303 04:07:06,469 --> 04:07:06,479 times and again this should be generic 12304 04:07:06,479 --> 04:07:08,550 times and again this should be generic so we need to calculate or we need to 12305 04:07:08,550 --> 04:07:08,560 so we need to calculate or we need to 12306 04:07:08,560 --> 04:07:09,030 so we need to calculate or we need to read 12307 04:07:09,030 --> 04:07:09,040 read 12308 04:07:09,040 --> 04:07:11,670 read the number of lines here number of rows 12309 04:07:11,670 --> 04:07:11,680 the number of lines here number of rows 12310 04:07:11,680 --> 04:07:12,790 the number of lines here number of rows here from the file 12311 04:07:12,790 --> 04:07:12,800 here from the file 12312 04:07:12,800 --> 04:07:15,990 here from the file and the way we can read that is remember 12313 04:07:15,990 --> 04:07:16,000 and the way we can read that is remember 12314 04:07:16,000 --> 04:07:17,750 and the way we can read that is remember we have all the information we need in 12315 04:07:17,750 --> 04:07:17,760 we have all the information we need in 12316 04:07:17,760 --> 04:07:18,150 we have all the information we need in that 12317 04:07:18,150 --> 04:07:18,160 that 12318 04:07:18,160 --> 04:07:20,830 that one specific variable which is product 12319 04:07:20,830 --> 04:07:20,840 one specific variable which is product 12320 04:07:20,840 --> 04:07:22,309 one specific variable which is product list 12321 04:07:22,309 --> 04:07:22,319 list 12322 04:07:22,319 --> 04:07:25,590 list and that variable has 12323 04:07:25,590 --> 04:07:25,600 and that variable has 12324 04:07:25,600 --> 04:07:28,389 and that variable has the value for number of rows which is 12325 04:07:28,389 --> 04:07:28,399 the value for number of rows which is 12326 04:07:28,399 --> 04:07:29,269 the value for number of rows which is called 12327 04:07:29,269 --> 04:07:29,279 called 12328 04:07:29,279 --> 04:07:32,950 called max row now how do i know that 12329 04:07:32,950 --> 04:07:32,960 max row now how do i know that 12330 04:07:32,960 --> 04:07:35,590 max row now how do i know that max row attribute is available for 12331 04:07:35,590 --> 04:07:35,600 max row attribute is available for 12332 04:07:35,600 --> 04:07:36,070 max row attribute is available for product 12333 04:07:36,070 --> 04:07:36,080 product 12334 04:07:36,080 --> 04:07:38,389 product list i basically just looked it up on 12335 04:07:38,389 --> 04:07:38,399 list i basically just looked it up on 12336 04:07:38,399 --> 04:07:40,469 list i basically just looked it up on the documentation of the module 12337 04:07:40,469 --> 04:07:40,479 the documentation of the module 12338 04:07:40,479 --> 04:07:42,389 the documentation of the module and as i previously also mentioned 12339 04:07:42,389 --> 04:07:42,399 and as i previously also mentioned 12340 04:07:42,399 --> 04:07:43,830 and as i previously also mentioned whenever you're using a 12341 04:07:43,830 --> 04:07:43,840 whenever you're using a 12342 04:07:43,840 --> 04:07:45,830 whenever you're using a module this module will have a 12343 04:07:45,830 --> 04:07:45,840 module this module will have a 12344 04:07:45,840 --> 04:07:47,349 module this module will have a documentation so 12345 04:07:47,349 --> 04:07:47,359 documentation so 12346 04:07:47,359 --> 04:07:49,189 documentation so if you need some functionality if you 12347 04:07:49,189 --> 04:07:49,199 if you need some functionality if you 12348 04:07:49,199 --> 04:07:50,790 if you need some functionality if you need some values 12349 04:07:50,790 --> 04:07:50,800 need some values 12350 04:07:50,800 --> 04:07:53,110 need some values you can basically just search inside the 12351 04:07:53,110 --> 04:07:53,120 you can basically just search inside the 12352 04:07:53,120 --> 04:07:54,229 you can basically just search inside the documentation 12353 04:07:54,229 --> 04:07:54,239 documentation 12354 04:07:54,239 --> 04:07:56,389 documentation which functions and variables are 12355 04:07:56,389 --> 04:07:56,399 which functions and variables are 12356 04:07:56,399 --> 04:07:57,670 which functions and variables are available to 12357 04:07:57,670 --> 04:07:57,680 available to 12358 04:07:57,680 --> 04:08:00,630 available to get the functionality or values that you 12359 04:08:00,630 --> 04:08:00,640 get the functionality or values that you 12360 04:08:00,640 --> 04:08:01,269 get the functionality or values that you need 12361 04:08:01,269 --> 04:08:01,279 need 12362 04:08:01,279 --> 04:08:03,990 need and we can actually test it we can print 12363 04:08:03,990 --> 04:08:04,000 and we can actually test it we can print 12364 04:08:04,000 --> 04:08:05,269 and we can actually test it we can print it out 12365 04:08:05,269 --> 04:08:05,279 it out 12366 04:08:05,279 --> 04:08:08,710 it out like this 12367 04:08:12,630 --> 04:08:12,640 and as you see here 75 so basically max 12368 04:08:12,640 --> 04:08:15,429 and as you see here 75 so basically max row will always give us the number of 12369 04:08:15,429 --> 04:08:15,439 row will always give us the number of 12370 04:08:15,439 --> 04:08:17,429 row will always give us the number of lines or number of rows 12371 04:08:17,429 --> 04:08:17,439 lines or number of rows 12372 04:08:17,439 --> 04:08:20,389 lines or number of rows in that specific sheet so we know how 12373 04:08:20,389 --> 04:08:20,399 in that specific sheet so we know how 12374 04:08:20,399 --> 04:08:21,189 in that specific sheet so we know how many times to 12375 04:08:21,189 --> 04:08:21,199 many times to 12376 04:08:21,199 --> 04:08:23,670 many times to iterate now whenever we're providing a 12377 04:08:23,670 --> 04:08:23,680 iterate now whenever we're providing a 12378 04:08:23,680 --> 04:08:24,469 iterate now whenever we're providing a specific 12379 04:08:24,469 --> 04:08:24,479 specific 12380 04:08:24,479 --> 04:08:28,149 specific number in a for loop like 75 for example 12381 04:08:28,149 --> 04:08:28,159 number in a for loop like 75 for example 12382 04:08:28,159 --> 04:08:31,189 number in a for loop like 75 for example in this case we need to 12383 04:08:31,189 --> 04:08:31,199 in this case we need to 12384 04:08:31,199 --> 04:08:35,030 in this case we need to put that number in a range like this 12385 04:08:35,030 --> 04:08:35,040 put that number in a range like this 12386 04:08:35,040 --> 04:08:38,229 put that number in a range like this so we can't just say 70 or in this case 12387 04:08:38,229 --> 04:08:38,239 so we can't just say 70 or in this case 12388 04:08:38,239 --> 04:08:41,670 so we can't just say 70 or in this case max row now why do we need a range here 12389 04:08:41,670 --> 04:08:41,680 max row now why do we need a range here 12390 04:08:41,680 --> 04:08:45,030 max row now why do we need a range here and why is number just not enough 12391 04:08:45,030 --> 04:08:45,040 and why is number just not enough 12392 04:08:45,040 --> 04:08:48,710 and why is number just not enough because the for loop is for iterating 12393 04:08:48,710 --> 04:08:48,720 because the for loop is for iterating 12394 04:08:48,720 --> 04:08:51,910 because the for loop is for iterating over a list and the range will create 12395 04:08:51,910 --> 04:08:51,920 over a list and the range will create 12396 04:08:51,920 --> 04:08:54,950 over a list and the range will create a list of numbers to iterate through 12397 04:08:54,950 --> 04:08:54,960 a list of numbers to iterate through 12398 04:08:54,960 --> 04:08:57,990 a list of numbers to iterate through in our case range of 75 12399 04:08:57,990 --> 04:08:58,000 in our case range of 75 12400 04:08:58,000 --> 04:09:00,149 in our case range of 75 will create a list of numbers or 12401 04:09:00,149 --> 04:09:00,159 will create a list of numbers or 12402 04:09:00,159 --> 04:09:01,429 will create a list of numbers or sequence of numbers 12403 04:09:01,429 --> 04:09:01,439 sequence of numbers 12404 04:09:01,439 --> 04:09:04,309 sequence of numbers from 0 to 74. and with that we're going 12405 04:09:04,309 --> 04:09:04,319 from 0 to 74. and with that we're going 12406 04:09:04,319 --> 04:09:05,189 from 0 to 74. and with that we're going to have 12407 04:09:05,189 --> 04:09:05,199 to have 12408 04:09:05,199 --> 04:09:08,309 to have a valid for loop where for each 12409 04:09:08,309 --> 04:09:08,319 a valid for loop where for each 12410 04:09:08,319 --> 04:09:11,670 a valid for loop where for each item in this list of numbers 12411 04:09:11,670 --> 04:09:11,680 item in this list of numbers 12412 04:09:11,680 --> 04:09:13,910 item in this list of numbers some logic will be executed so that's 12413 04:09:13,910 --> 04:09:13,920 some logic will be executed so that's 12414 04:09:13,920 --> 04:09:15,750 some logic will be executed so that's why we need a range here 12415 04:09:15,750 --> 04:09:15,760 why we need a range here 12416 04:09:15,760 --> 04:09:17,429 why we need a range here and now there's one more thing that we 12417 04:09:17,429 --> 04:09:17,439 and now there's one more thing that we 12418 04:09:17,439 --> 04:09:19,670 and now there's one more thing that we need to fix we go back to our 12419 04:09:19,670 --> 04:09:19,680 need to fix we go back to our 12420 04:09:19,680 --> 04:09:20,790 need to fix we go back to our spreadsheet 12421 04:09:20,790 --> 04:09:20,800 spreadsheet 12422 04:09:20,800 --> 04:09:23,189 spreadsheet you see that the first row so this is 12423 04:09:23,189 --> 04:09:23,199 you see that the first row so this is 12424 04:09:23,199 --> 04:09:25,349 you see that the first row so this is going to be the first row basically 12425 04:09:25,349 --> 04:09:25,359 going to be the first row basically 12426 04:09:25,359 --> 04:09:27,750 going to be the first row basically does not actually include the product 12427 04:09:27,750 --> 04:09:27,760 does not actually include the product 12428 04:09:27,760 --> 04:09:28,710 does not actually include the product information 12429 04:09:28,710 --> 04:09:28,720 information 12430 04:09:28,720 --> 04:09:31,189 information it just includes the titles for each 12431 04:09:31,189 --> 04:09:31,199 it just includes the titles for each 12432 04:09:31,199 --> 04:09:32,469 it just includes the titles for each column 12433 04:09:32,469 --> 04:09:32,479 column 12434 04:09:32,479 --> 04:09:35,670 column right so we actually do not want to read 12435 04:09:35,670 --> 04:09:35,680 right so we actually do not want to read 12436 04:09:35,680 --> 04:09:38,309 right so we actually do not want to read this line we want to skip it and we want 12437 04:09:38,309 --> 04:09:38,319 this line we want to skip it and we want 12438 04:09:38,319 --> 04:09:41,269 this line we want to skip it and we want to start from the second row 12439 04:09:41,269 --> 04:09:41,279 to start from the second row 12440 04:09:41,279 --> 04:09:44,630 to start from the second row so instead of starting for loop from the 12441 04:09:44,630 --> 04:09:44,640 so instead of starting for loop from the 12442 04:09:44,640 --> 04:09:45,750 so instead of starting for loop from the first row 12443 04:09:45,750 --> 04:09:45,760 first row 12444 04:09:45,760 --> 04:09:47,990 first row we want to start it from the second row 12445 04:09:47,990 --> 04:09:48,000 we want to start it from the second row 12446 04:09:48,000 --> 04:09:49,269 we want to start it from the second row and in order to 12447 04:09:49,269 --> 04:09:49,279 and in order to 12448 04:09:49,279 --> 04:09:52,469 and in order to tell python to start at row 2 12449 04:09:52,469 --> 04:09:52,479 tell python to start at row 2 12450 04:09:52,479 --> 04:09:54,550 tell python to start at row 2 in the range function we're going to 12451 04:09:54,550 --> 04:09:54,560 in the range function we're going to 12452 04:09:54,560 --> 04:09:56,469 in the range function we're going to pass first parameter 12453 04:09:56,469 --> 04:09:56,479 pass first parameter 12454 04:09:56,479 --> 04:09:59,269 pass first parameter 2. so basically this will give us a new 12455 04:09:59,269 --> 04:09:59,279 2. so basically this will give us a new 12456 04:09:59,279 --> 04:10:00,389 2. so basically this will give us a new range of numbers 12457 04:10:00,389 --> 04:10:00,399 range of numbers 12458 04:10:00,399 --> 04:10:02,630 range of numbers starting from 2 instead of starting from 12459 04:10:02,630 --> 04:10:02,640 starting from 2 instead of starting from 12460 04:10:02,640 --> 04:10:04,790 starting from 2 instead of starting from 0. and since we're using those 12461 04:10:04,790 --> 04:10:04,800 0. and since we're using those 12462 04:10:04,800 --> 04:10:07,830 0. and since we're using those numbers in the range as an index for the 12463 04:10:07,830 --> 04:10:07,840 numbers in the range as an index for the 12464 04:10:07,840 --> 04:10:08,469 numbers in the range as an index for the rows 12465 04:10:08,469 --> 04:10:08,479 rows 12466 04:10:08,479 --> 04:10:10,070 rows the first number is going to be 2 so 12467 04:10:10,070 --> 04:10:10,080 the first number is going to be 2 so 12468 04:10:10,080 --> 04:10:12,149 the first number is going to be 2 so we're going to start iterating from the 12469 04:10:12,149 --> 04:10:12,159 we're going to start iterating from the 12470 04:10:12,159 --> 04:10:13,269 we're going to start iterating from the second row 12471 04:10:13,269 --> 04:10:13,279 second row 12472 04:10:13,279 --> 04:10:15,510 second row so this will be the start point and this 12473 04:10:15,510 --> 04:10:15,520 so this will be the start point and this 12474 04:10:15,520 --> 04:10:17,349 so this will be the start point and this will be the end point 12475 04:10:17,349 --> 04:10:17,359 will be the end point 12476 04:10:17,359 --> 04:10:21,429 will be the end point so basically from here to the end 12477 04:10:21,429 --> 04:10:21,439 so basically from here to the end 12478 04:10:21,439 --> 04:10:24,790 so basically from here to the end now there are two things specific 12479 04:10:24,790 --> 04:10:24,800 now there are two things specific 12480 04:10:24,800 --> 04:10:28,950 now there are two things specific to a range that you should be aware of 12481 04:10:28,950 --> 04:10:28,960 to a range that you should be aware of 12482 04:10:28,960 --> 04:10:32,710 to a range that you should be aware of first of all when we do not 12483 04:10:32,710 --> 04:10:32,720 first of all when we do not 12484 04:10:32,720 --> 04:10:36,070 first of all when we do not provide the start index basically 12485 04:10:36,070 --> 04:10:36,080 provide the start index basically 12486 04:10:36,080 --> 04:10:39,510 provide the start index basically the start number in the range by default 12487 04:10:39,510 --> 04:10:39,520 the start number in the range by default 12488 04:10:39,520 --> 04:10:40,550 the start number in the range by default it's actually 12489 04:10:40,550 --> 04:10:40,560 it's actually 12490 04:10:40,560 --> 04:10:43,750 it's actually zero so it's not one but it's zero 12491 04:10:43,750 --> 04:10:43,760 zero so it's not one but it's zero 12492 04:10:43,760 --> 04:10:46,389 zero so it's not one but it's zero and obviously we don't have a line zero 12493 04:10:46,389 --> 04:10:46,399 and obviously we don't have a line zero 12494 04:10:46,399 --> 04:10:47,110 and obviously we don't have a line zero here 12495 04:10:47,110 --> 04:10:47,120 here 12496 04:10:47,120 --> 04:10:49,830 here so if we executed it with the default 12497 04:10:49,830 --> 04:10:49,840 so if we executed it with the default 12498 04:10:49,840 --> 04:10:50,630 so if we executed it with the default one 12499 04:10:50,630 --> 04:10:50,640 one 12500 04:10:50,640 --> 04:10:53,110 one we would get an error so that's one 12501 04:10:53,110 --> 04:10:53,120 we would get an error so that's one 12502 04:10:53,120 --> 04:10:54,229 we would get an error so that's one thing to consider that 12503 04:10:54,229 --> 04:10:54,239 thing to consider that 12504 04:10:54,239 --> 04:10:57,269 thing to consider that range actually by default starts at 0 12505 04:10:57,269 --> 04:10:57,279 range actually by default starts at 0 12506 04:10:57,279 --> 04:11:00,389 range actually by default starts at 0 and not 1. but for us it doesn't matter 12507 04:11:00,389 --> 04:11:00,399 and not 1. but for us it doesn't matter 12508 04:11:00,399 --> 04:11:01,990 and not 1. but for us it doesn't matter because we're skipping the first one 12509 04:11:01,990 --> 04:11:02,000 because we're skipping the first one 12510 04:11:02,000 --> 04:11:04,389 because we're skipping the first one anyways and we're starting from line 2 12511 04:11:04,389 --> 04:11:04,399 anyways and we're starting from line 2 12512 04:11:04,399 --> 04:11:07,349 anyways and we're starting from line 2 because our spreadsheet doesn't have 12513 04:11:07,349 --> 04:11:07,359 because our spreadsheet doesn't have 12514 04:11:07,359 --> 04:11:08,149 because our spreadsheet doesn't have line 0 12515 04:11:08,149 --> 04:11:08,159 line 0 12516 04:11:08,159 --> 04:11:10,950 line 0 obviously another specific of the range 12517 04:11:10,950 --> 04:11:10,960 obviously another specific of the range 12518 04:11:10,960 --> 04:11:11,510 obviously another specific of the range is that 12519 04:11:11,510 --> 04:11:11,520 is that 12520 04:11:11,520 --> 04:11:15,110 is that the second value here basically the last 12521 04:11:15,110 --> 04:11:15,120 the second value here basically the last 12522 04:11:15,120 --> 04:11:18,070 the second value here basically the last number of execution in the loop in our 12523 04:11:18,070 --> 04:11:18,080 number of execution in the loop in our 12524 04:11:18,080 --> 04:11:20,309 number of execution in the loop in our case this is going to be 75 12525 04:11:20,309 --> 04:11:20,319 case this is going to be 75 12526 04:11:20,319 --> 04:11:23,189 case this is going to be 75 because we have 75 lines and we printed 12527 04:11:23,189 --> 04:11:23,199 because we have 75 lines and we printed 12528 04:11:23,199 --> 04:11:24,550 because we have 75 lines and we printed that out here 12529 04:11:24,550 --> 04:11:24,560 that out here 12530 04:11:24,560 --> 04:11:27,910 that out here that number is actually exclusive 12531 04:11:27,910 --> 04:11:27,920 that number is actually exclusive 12532 04:11:27,920 --> 04:11:31,349 that number is actually exclusive it's not inclusive that means that 12533 04:11:31,349 --> 04:11:31,359 it's not inclusive that means that 12534 04:11:31,359 --> 04:11:34,710 it's not inclusive that means that the range will execute from line 2 12535 04:11:34,710 --> 04:11:34,720 the range will execute from line 2 12536 04:11:34,720 --> 04:11:38,630 the range will execute from line 2 to 75 exclusive so basically 12537 04:11:38,630 --> 04:11:38,640 to 75 exclusive so basically 12538 04:11:38,640 --> 04:11:42,710 to 75 exclusive so basically till here this line will not be included 12539 04:11:42,710 --> 04:11:42,720 till here this line will not be included 12540 04:11:42,720 --> 04:11:43,590 till here this line will not be included in the loop 12541 04:11:43,590 --> 04:11:43,600 in the loop 12542 04:11:43,600 --> 04:11:46,469 in the loop again that's a specification of the 12543 04:11:46,469 --> 04:11:46,479 again that's a specification of the 12544 04:11:46,479 --> 04:11:47,269 again that's a specification of the range 12545 04:11:47,269 --> 04:11:47,279 range 12546 04:11:47,279 --> 04:11:50,309 range which we need to fix and 12547 04:11:50,309 --> 04:11:50,319 which we need to fix and 12548 04:11:50,319 --> 04:11:52,469 which we need to fix and basically want to tell you know what we 12549 04:11:52,469 --> 04:11:52,479 basically want to tell you know what we 12550 04:11:52,479 --> 04:11:53,910 basically want to tell you know what we want that iteration 12551 04:11:53,910 --> 04:11:53,920 want that iteration 12552 04:11:53,920 --> 04:11:56,550 want that iteration including the last number as well 12553 04:11:56,550 --> 04:11:56,560 including the last number as well 12554 04:11:56,560 --> 04:11:58,229 including the last number as well including that max row 12555 04:11:58,229 --> 04:11:58,239 including that max row 12556 04:11:58,239 --> 04:12:00,950 including that max row and a simple fix for that is going to be 12557 04:12:00,950 --> 04:12:00,960 and a simple fix for that is going to be 12558 04:12:00,960 --> 04:12:01,670 and a simple fix for that is going to be to 12559 04:12:01,670 --> 04:12:01,680 to 12560 04:12:01,680 --> 04:12:05,429 to do plus one here so basically whatever 12561 04:12:05,429 --> 04:12:05,439 do plus one here so basically whatever 12562 04:12:05,439 --> 04:12:07,670 do plus one here so basically whatever the max row is we want to include that 12563 04:12:07,670 --> 04:12:07,680 the max row is we want to include that 12564 04:12:07,680 --> 04:12:08,469 the max row is we want to include that one as well 12565 04:12:08,469 --> 04:12:08,479 one as well 12566 04:12:08,479 --> 04:12:11,429 one as well so we want to add one to it so now we 12567 04:12:11,429 --> 04:12:11,439 so we want to add one to it so now we 12568 04:12:11,439 --> 04:12:12,309 so we want to add one to it so now we have a range 12569 04:12:12,309 --> 04:12:12,319 have a range 12570 04:12:12,319 --> 04:12:16,309 have a range starting from two and ending in 76 12571 04:12:16,309 --> 04:12:16,319 starting from two and ending in 76 12572 04:12:16,319 --> 04:12:19,510 starting from two and ending in 76 exclusive so obviously the 76th 12573 04:12:19,510 --> 04:12:19,520 exclusive so obviously the 76th 12574 04:12:19,520 --> 04:12:22,710 exclusive so obviously the 76th line will not be red and 12575 04:12:22,710 --> 04:12:22,720 line will not be red and 12576 04:12:22,720 --> 04:12:25,110 line will not be red and this will now give us a range that we 12577 04:12:25,110 --> 04:12:25,120 this will now give us a range that we 12578 04:12:25,120 --> 04:12:28,149 this will now give us a range that we need 12579 04:12:30,550 --> 04:12:30,560 and now that we have condition for the 12580 04:12:30,560 --> 04:12:32,149 and now that we have condition for the loop and we have set 12581 04:12:32,149 --> 04:12:32,159 loop and we have set 12582 04:12:32,159 --> 04:12:34,309 loop and we have set how many times it should execute let's 12583 04:12:34,309 --> 04:12:34,319 how many times it should execute let's 12584 04:12:34,319 --> 04:12:36,229 how many times it should execute let's actually execute the logic 12585 04:12:36,229 --> 04:12:36,239 actually execute the logic 12586 04:12:36,239 --> 04:12:38,630 actually execute the logic itself so what is the first information 12587 04:12:38,630 --> 04:12:38,640 itself so what is the first information 12588 04:12:38,640 --> 04:12:39,990 itself so what is the first information we need from that 12589 04:12:39,990 --> 04:12:40,000 we need from that 12590 04:12:40,000 --> 04:12:42,309 we need from that product row for each row we basically 12591 04:12:42,309 --> 04:12:42,319 product row for each row we basically 12592 04:12:42,319 --> 04:12:44,070 product row for each row we basically need the supplier name 12593 04:12:44,070 --> 04:12:44,080 need the supplier name 12594 04:12:44,080 --> 04:12:46,469 need the supplier name so that we can increment or start 12595 04:12:46,469 --> 04:12:46,479 so that we can increment or start 12596 04:12:46,479 --> 04:12:47,750 so that we can increment or start counting how many 12597 04:12:47,750 --> 04:12:47,760 counting how many 12598 04:12:47,760 --> 04:12:50,070 counting how many products this supplier has so we need 12599 04:12:50,070 --> 04:12:50,080 products this supplier has so we need 12600 04:12:50,080 --> 04:12:51,110 products this supplier has so we need this 12601 04:12:51,110 --> 04:12:51,120 this 12602 04:12:51,120 --> 04:12:53,830 this one two three fourth column and the 12603 04:12:53,830 --> 04:12:53,840 one two three fourth column and the 12604 04:12:53,840 --> 04:12:55,590 one two three fourth column and the value in that fourth column 12605 04:12:55,590 --> 04:12:55,600 value in that fourth column 12606 04:12:55,600 --> 04:12:58,790 value in that fourth column for each and every row right 12607 04:12:58,790 --> 04:12:58,800 for each and every row right 12608 04:12:58,800 --> 04:13:01,510 for each and every row right let's go back to editor how do we get a 12609 04:13:01,510 --> 04:13:01,520 let's go back to editor how do we get a 12610 04:13:01,520 --> 04:13:02,389 let's go back to editor how do we get a value 12611 04:13:02,389 --> 04:13:02,399 value 12612 04:13:02,399 --> 04:13:04,550 value in the cell you have to imagine when we 12613 04:13:04,550 --> 04:13:04,560 in the cell you have to imagine when we 12614 04:13:04,560 --> 04:13:05,910 in the cell you have to imagine when we iterate we have 12615 04:13:05,910 --> 04:13:05,920 iterate we have 12616 04:13:05,920 --> 04:13:09,510 iterate we have one row per iteration 12617 04:13:09,510 --> 04:13:09,520 one row per iteration 12618 04:13:09,520 --> 04:13:11,189 one row per iteration so right here we actually have this 12619 04:13:11,189 --> 04:13:11,199 so right here we actually have this 12620 04:13:11,199 --> 04:13:12,870 so right here we actually have this product row which is just 12621 04:13:12,870 --> 04:13:12,880 product row which is just 12622 04:13:12,880 --> 04:13:15,269 product row which is just one row and we have four columns here 12623 04:13:15,269 --> 04:13:15,279 one row and we have four columns here 12624 04:13:15,279 --> 04:13:16,070 one row and we have four columns here and we want 12625 04:13:16,070 --> 04:13:16,080 and we want 12626 04:13:16,080 --> 04:13:19,189 and we want value in this specific cell and 12627 04:13:19,189 --> 04:13:19,199 value in this specific cell and 12628 04:13:19,199 --> 04:13:22,149 value in this specific cell and we can get it using first of all product 12629 04:13:22,149 --> 04:13:22,159 we can get it using first of all product 12630 04:13:22,159 --> 04:13:22,710 we can get it using first of all product list 12631 04:13:22,710 --> 04:13:22,720 list 12632 04:13:22,720 --> 04:13:23,750 list because again we have all the 12633 04:13:23,750 --> 04:13:23,760 because again we have all the 12634 04:13:23,760 --> 04:13:27,030 because again we have all the information here so in this list 12635 04:13:27,030 --> 04:13:27,040 information here so in this list 12636 04:13:27,040 --> 04:13:29,990 information here so in this list we need a cell right we need a value of 12637 04:13:29,990 --> 04:13:30,000 we need a cell right we need a value of 12638 04:13:30,000 --> 04:13:30,229 we need a cell right we need a value of a 12639 04:13:30,229 --> 04:13:30,239 a 12640 04:13:30,239 --> 04:13:33,269 a cell so that's the name of the function 12641 04:13:33,269 --> 04:13:33,279 cell so that's the name of the function 12642 04:13:33,279 --> 04:13:36,389 cell so that's the name of the function and the cell basically takes two 12643 04:13:36,389 --> 04:13:36,399 and the cell basically takes two 12644 04:13:36,399 --> 04:13:39,590 and the cell basically takes two parameters again product list 12645 04:13:39,590 --> 04:13:39,600 parameters again product list 12646 04:13:39,600 --> 04:13:42,309 parameters again product list contains the whole sheet here so the 12647 04:13:42,309 --> 04:13:42,319 contains the whole sheet here so the 12648 04:13:42,319 --> 04:13:43,349 contains the whole sheet here so the whole list 12649 04:13:43,349 --> 04:13:43,359 whole list 12650 04:13:43,359 --> 04:13:46,550 whole list with all the rows and columns and we can 12651 04:13:46,550 --> 04:13:46,560 with all the rows and columns and we can 12652 04:13:46,560 --> 04:13:48,389 with all the rows and columns and we can get a specific 12653 04:13:48,389 --> 04:13:48,399 get a specific 12654 04:13:48,399 --> 04:13:51,030 get a specific cell value so whatever we are doesn't 12655 04:13:51,030 --> 04:13:51,040 cell value so whatever we are doesn't 12656 04:13:51,040 --> 04:13:52,389 cell value so whatever we are doesn't really matter 12657 04:13:52,389 --> 04:13:52,399 really matter 12658 04:13:52,399 --> 04:13:55,510 really matter from that variable by providing two 12659 04:13:55,510 --> 04:13:55,520 from that variable by providing two 12660 04:13:55,520 --> 04:13:56,309 from that variable by providing two values 12661 04:13:56,309 --> 04:13:56,319 values 12662 04:13:56,319 --> 04:13:59,030 values the row number and the column number 12663 04:13:59,030 --> 04:13:59,040 the row number and the column number 12664 04:13:59,040 --> 04:13:59,910 the row number and the column number that's it 12665 04:13:59,910 --> 04:13:59,920 that's it 12666 04:13:59,920 --> 04:14:03,750 that's it so row nine column one basically will be 12667 04:14:03,750 --> 04:14:03,760 so row nine column one basically will be 12668 04:14:03,760 --> 04:14:07,510 so row nine column one basically will be this specific value row five column 12669 04:14:07,510 --> 04:14:07,520 this specific value row five column 12670 04:14:07,520 --> 04:14:10,950 this specific value row five column four will be this specific value so 12671 04:14:10,950 --> 04:14:10,960 four will be this specific value so 12672 04:14:10,960 --> 04:14:13,910 four will be this specific value so for each iteration we're gonna do 12673 04:14:13,910 --> 04:14:13,920 for each iteration we're gonna do 12674 04:14:13,920 --> 04:14:14,630 for each iteration we're gonna do exactly 12675 04:14:14,630 --> 04:14:14,640 exactly 12676 04:14:14,640 --> 04:14:16,950 exactly that so for our case the supplier is 12677 04:14:16,950 --> 04:14:16,960 that so for our case the supplier is 12678 04:14:16,960 --> 04:14:18,870 that so for our case the supplier is always column four 12679 04:14:18,870 --> 04:14:18,880 always column four 12680 04:14:18,880 --> 04:14:21,030 always column four and the row is dynamic because we are 12681 04:14:21,030 --> 04:14:21,040 and the row is dynamic because we are 12682 04:14:21,040 --> 04:14:22,149 and the row is dynamic because we are iterating 12683 04:14:22,149 --> 04:14:22,159 iterating 12684 04:14:22,159 --> 04:14:25,429 iterating and therefore we're going to use 12685 04:14:25,429 --> 04:14:25,439 and therefore we're going to use 12686 04:14:25,439 --> 04:14:28,229 and therefore we're going to use whatever row we're at at the current 12687 04:14:28,229 --> 04:14:28,239 whatever row we're at at the current 12688 04:14:28,239 --> 04:14:29,189 whatever row we're at at the current iteration 12689 04:14:29,189 --> 04:14:29,199 iteration 12690 04:14:29,199 --> 04:14:32,309 iteration so that's the first parameter and column 12691 04:14:32,309 --> 04:14:32,319 so that's the first parameter and column 12692 04:14:32,319 --> 04:14:36,389 so that's the first parameter and column 4 as i said and this will give us 12693 04:14:36,389 --> 04:14:36,399 4 as i said and this will give us 12694 04:14:36,399 --> 04:14:40,149 4 as i said and this will give us the supplier name for each and every 12695 04:14:40,149 --> 04:14:40,159 the supplier name for each and every 12696 04:14:40,159 --> 04:14:42,870 the supplier name for each and every row so we can grab that value like this 12697 04:14:42,870 --> 04:14:42,880 row so we can grab that value like this 12698 04:14:42,880 --> 04:14:46,950 row so we can grab that value like this and this is going to be supplier 12699 04:14:50,389 --> 04:14:50,399 name so we can save it in a variable 12700 04:14:50,399 --> 04:14:52,550 name so we can save it in a variable as a next step we're going to start 12701 04:14:52,550 --> 04:14:52,560 as a next step we're going to start 12702 04:14:52,560 --> 04:14:53,590 as a next step we're going to start building 12703 04:14:53,590 --> 04:14:53,600 building 12704 04:14:53,600 --> 04:14:56,630 building how many products each supplier has 12705 04:14:56,630 --> 04:14:56,640 how many products each supplier has 12706 04:14:56,640 --> 04:14:58,309 how many products each supplier has we're going to start building a 12707 04:14:58,309 --> 04:14:58,319 we're going to start building a 12708 04:14:58,319 --> 04:14:59,670 we're going to start building a dictionary 12709 04:14:59,670 --> 04:14:59,680 dictionary 12710 04:14:59,680 --> 04:15:01,590 dictionary with the name of the supplier and then 12711 04:15:01,590 --> 04:15:01,600 with the name of the supplier and then 12712 04:15:01,600 --> 04:15:03,510 with the name of the supplier and then how many products they have 12713 04:15:03,510 --> 04:15:03,520 how many products they have 12714 04:15:03,520 --> 04:15:05,429 how many products they have so we're going to be building this 12715 04:15:05,429 --> 04:15:05,439 so we're going to be building this 12716 04:15:05,439 --> 04:15:06,710 so we're going to be building this dictionary here 12717 04:15:06,710 --> 04:15:06,720 dictionary here 12718 04:15:06,720 --> 04:15:09,429 dictionary here so this is a reminder now for what i 12719 04:15:09,429 --> 04:15:09,439 so this is a reminder now for what i 12720 04:15:09,439 --> 04:15:10,710 so this is a reminder now for what i said previously 12721 04:15:10,710 --> 04:15:10,720 said previously 12722 04:15:10,720 --> 04:15:13,030 said previously that you don't need knowledge of math in 12723 04:15:13,030 --> 04:15:13,040 that you don't need knowledge of math in 12724 04:15:13,040 --> 04:15:14,070 that you don't need knowledge of math in programming 12725 04:15:14,070 --> 04:15:14,080 programming 12726 04:15:14,080 --> 04:15:16,710 programming rather you need logical thinking right 12727 04:15:16,710 --> 04:15:16,720 rather you need logical thinking right 12728 04:15:16,720 --> 04:15:18,790 rather you need logical thinking right so you're going to get tasks like this 12729 04:15:18,790 --> 04:15:18,800 so you're going to get tasks like this 12730 04:15:18,800 --> 04:15:19,750 so you're going to get tasks like this where you have to 12731 04:15:19,750 --> 04:15:19,760 where you have to 12732 04:15:19,760 --> 04:15:22,630 where you have to basically logically decide how you are 12733 04:15:22,630 --> 04:15:22,640 basically logically decide how you are 12734 04:15:22,640 --> 04:15:24,389 basically logically decide how you are going to do a certain task 12735 04:15:24,389 --> 04:15:24,399 going to do a certain task 12736 04:15:24,399 --> 04:15:27,590 going to do a certain task and think all this through right so 12737 04:15:27,590 --> 04:15:27,600 and think all this through right so 12738 04:15:27,600 --> 04:15:29,590 and think all this through right so programming is more about logic rather 12739 04:15:29,590 --> 04:15:29,600 programming is more about logic rather 12740 04:15:29,600 --> 04:15:32,149 programming is more about logic rather than pure calculation or math 12741 04:15:32,149 --> 04:15:32,159 than pure calculation or math 12742 04:15:32,159 --> 04:15:34,070 than pure calculation or math which is actually more interesting and 12743 04:15:34,070 --> 04:15:34,080 which is actually more interesting and 12744 04:15:34,080 --> 04:15:36,070 which is actually more interesting and cooler and that's exactly 12745 04:15:36,070 --> 04:15:36,080 cooler and that's exactly 12746 04:15:36,080 --> 04:15:38,070 cooler and that's exactly what we're going to need in this example 12747 04:15:38,070 --> 04:15:38,080 what we're going to need in this example 12748 04:15:38,080 --> 04:15:39,110 what we're going to need in this example we're going to need some 12749 04:15:39,110 --> 04:15:39,120 we're going to need some 12750 04:15:39,120 --> 04:15:42,070 we're going to need some logical thinking to basically build this 12751 04:15:42,070 --> 04:15:42,080 logical thinking to basically build this 12752 04:15:42,080 --> 04:15:43,030 logical thinking to basically build this application 12753 04:15:43,030 --> 04:15:43,040 application 12754 04:15:43,040 --> 04:15:45,429 application so bear with me on this one the first 12755 04:15:45,429 --> 04:15:45,439 so bear with me on this one the first 12756 04:15:45,439 --> 04:15:47,189 so bear with me on this one the first thing we need to check here 12757 04:15:47,189 --> 04:15:47,199 thing we need to check here 12758 04:15:47,199 --> 04:15:49,429 thing we need to check here so think about this iteration on the 12759 04:15:49,429 --> 04:15:49,439 so think about this iteration on the 12760 04:15:49,439 --> 04:15:50,389 so think about this iteration on the first time 12761 04:15:50,389 --> 04:15:50,399 first time 12762 04:15:50,399 --> 04:15:53,269 first time and second time the first time the list 12763 04:15:53,269 --> 04:15:53,279 and second time the first time the list 12764 04:15:53,279 --> 04:15:54,790 and second time the first time the list or the dictionary is actually 12765 04:15:54,790 --> 04:15:54,800 or the dictionary is actually 12766 04:15:54,800 --> 04:15:58,550 or the dictionary is actually empty so we want to add the first 12767 04:15:58,550 --> 04:15:58,560 empty so we want to add the first 12768 04:15:58,560 --> 04:16:01,750 empty so we want to add the first supplier to the list right away right 12769 04:16:01,750 --> 04:16:01,760 supplier to the list right away right 12770 04:16:01,760 --> 04:16:05,510 supplier to the list right away right so we're gonna grab that and the syntax 12771 04:16:05,510 --> 04:16:05,520 so we're gonna grab that and the syntax 12772 04:16:05,520 --> 04:16:05,830 so we're gonna grab that and the syntax for 12773 04:16:05,830 --> 04:16:05,840 for 12774 04:16:05,840 --> 04:16:09,429 for adding a new entry in a dictionary is 12775 04:16:09,429 --> 04:16:09,439 adding a new entry in a dictionary is 12776 04:16:09,439 --> 04:16:14,469 adding a new entry in a dictionary is like this where we have a key 12777 04:16:14,469 --> 04:16:14,479 like this where we have a key 12778 04:16:14,479 --> 04:16:17,349 like this where we have a key and a value here so basically what we 12779 04:16:17,349 --> 04:16:17,359 and a value here so basically what we 12780 04:16:17,359 --> 04:16:18,710 and a value here so basically what we want to end up with 12781 04:16:18,710 --> 04:16:18,720 want to end up with 12782 04:16:18,720 --> 04:16:21,830 want to end up with is supplier name like a 12783 04:16:21,830 --> 04:16:21,840 is supplier name like a 12784 04:16:21,840 --> 04:16:25,030 is supplier name like a company and 12785 04:16:25,030 --> 04:16:25,040 company and 12786 04:16:25,040 --> 04:16:27,510 company and number of products for that supplier 12787 04:16:27,510 --> 04:16:27,520 number of products for that supplier 12788 04:16:27,520 --> 04:16:28,870 number of products for that supplier that's the 12789 04:16:28,870 --> 04:16:28,880 that's the 12790 04:16:28,880 --> 04:16:30,870 that's the dictionary that we want to end up with 12791 04:16:30,870 --> 04:16:30,880 dictionary that we want to end up with 12792 04:16:30,880 --> 04:16:33,030 dictionary that we want to end up with then it's going to be 12793 04:16:33,030 --> 04:16:33,040 then it's going to be 12794 04:16:33,040 --> 04:16:38,630 then it's going to be bbb company and so on 12795 04:16:40,950 --> 04:16:40,960 so the very first supplier goes directly 12796 04:16:40,960 --> 04:16:42,469 so the very first supplier goes directly into the list 12797 04:16:42,469 --> 04:16:42,479 into the list 12798 04:16:42,479 --> 04:16:44,389 into the list and we're going to need the name of that 12799 04:16:44,389 --> 04:16:44,399 and we're going to need the name of that 12800 04:16:44,399 --> 04:16:45,830 and we're going to need the name of that supplier we don't know what it's going 12801 04:16:45,830 --> 04:16:45,840 supplier we don't know what it's going 12802 04:16:45,840 --> 04:16:46,710 supplier we don't know what it's going to be 12803 04:16:46,710 --> 04:16:46,720 to be 12804 04:16:46,720 --> 04:16:50,630 to be so name as a key 12805 04:16:50,630 --> 04:16:50,640 so name as a key 12806 04:16:50,640 --> 04:16:53,910 so name as a key and value is going to be 12807 04:16:53,910 --> 04:16:53,920 and value is going to be 12808 04:16:53,920 --> 04:16:55,510 and value is going to be 1 at the beginning right this is the 12809 04:16:55,510 --> 04:16:55,520 1 at the beginning right this is the 12810 04:16:55,520 --> 04:16:57,189 1 at the beginning right this is the very first iteration 12811 04:16:57,189 --> 04:16:57,199 very first iteration 12812 04:16:57,199 --> 04:16:59,189 very first iteration so after the first it iteration we're 12813 04:16:59,189 --> 04:16:59,199 so after the first it iteration we're 12814 04:16:59,199 --> 04:17:00,229 so after the first it iteration we're gonna have 12815 04:17:00,229 --> 04:17:00,239 gonna have 12816 04:17:00,239 --> 04:17:03,429 gonna have the first company name supplier name and 12817 04:17:03,429 --> 04:17:03,439 the first company name supplier name and 12818 04:17:03,439 --> 04:17:06,790 the first company name supplier name and count one for that on the second loop 12819 04:17:06,790 --> 04:17:06,800 count one for that on the second loop 12820 04:17:06,800 --> 04:17:10,630 count one for that on the second loop second iteration basically if 12821 04:17:10,630 --> 04:17:10,640 second iteration basically if 12822 04:17:10,640 --> 04:17:13,990 second iteration basically if the next line is a different supplier 12823 04:17:13,990 --> 04:17:14,000 the next line is a different supplier 12824 04:17:14,000 --> 04:17:17,510 the next line is a different supplier like here for example then a new entry 12825 04:17:17,510 --> 04:17:17,520 like here for example then a new entry 12826 04:17:17,520 --> 04:17:18,389 like here for example then a new entry will be added 12827 04:17:18,389 --> 04:17:18,399 will be added 12828 04:17:18,399 --> 04:17:21,429 will be added because we have a new key now with 12829 04:17:21,429 --> 04:17:21,439 because we have a new key now with 12830 04:17:21,439 --> 04:17:23,990 because we have a new key now with count one right so now we're gonna have 12831 04:17:23,990 --> 04:17:24,000 count one right so now we're gonna have 12832 04:17:24,000 --> 04:17:25,110 count one right so now we're gonna have company a 12833 04:17:25,110 --> 04:17:25,120 company a 12834 04:17:25,120 --> 04:17:27,349 company a with one product company b with one 12835 04:17:27,349 --> 04:17:27,359 with one product company b with one 12836 04:17:27,359 --> 04:17:28,149 with one product company b with one product 12837 04:17:28,149 --> 04:17:28,159 product 12838 04:17:28,159 --> 04:17:30,630 product now what happens when on the next 12839 04:17:30,630 --> 04:17:30,640 now what happens when on the next 12840 04:17:30,640 --> 04:17:31,910 now what happens when on the next iteration 12841 04:17:31,910 --> 04:17:31,920 iteration 12842 04:17:31,920 --> 04:17:35,429 iteration we get company a again right 12843 04:17:35,429 --> 04:17:35,439 we get company a again right 12844 04:17:35,439 --> 04:17:38,790 we get company a again right what we want to happen is 12845 04:17:38,790 --> 04:17:38,800 what we want to happen is 12846 04:17:38,800 --> 04:17:42,309 what we want to happen is company a the product count to 12847 04:17:42,309 --> 04:17:42,319 company a the product count to 12848 04:17:42,319 --> 04:17:44,469 company a the product count to increase to two right because now we 12849 04:17:44,469 --> 04:17:44,479 increase to two right because now we 12850 04:17:44,479 --> 04:17:46,229 increase to two right because now we found another product that 12851 04:17:46,229 --> 04:17:46,239 found another product that 12852 04:17:46,239 --> 04:17:49,189 found another product that is supplied by the same company however 12853 04:17:49,189 --> 04:17:49,199 is supplied by the same company however 12854 04:17:49,199 --> 04:17:50,630 is supplied by the same company however with this land we are actually 12855 04:17:50,630 --> 04:17:50,640 with this land we are actually 12856 04:17:50,640 --> 04:17:52,149 with this land we are actually overriding and setting it 12857 04:17:52,149 --> 04:17:52,159 overriding and setting it 12858 04:17:52,159 --> 04:17:56,070 overriding and setting it back to one so how do we make sure that 12859 04:17:56,070 --> 04:17:56,080 back to one so how do we make sure that 12860 04:17:56,080 --> 04:17:58,229 back to one so how do we make sure that number of products gets incremented 12861 04:17:58,229 --> 04:17:58,239 number of products gets incremented 12862 04:17:58,239 --> 04:18:00,630 number of products gets incremented instead of always setting it to one 12863 04:18:00,630 --> 04:18:00,640 instead of always setting it to one 12864 04:18:00,640 --> 04:18:03,030 instead of always setting it to one what we're going to do is before we 12865 04:18:03,030 --> 04:18:03,040 what we're going to do is before we 12866 04:18:03,040 --> 04:18:04,309 what we're going to do is before we execute this line 12867 04:18:04,309 --> 04:18:04,319 execute this line 12868 04:18:04,319 --> 04:18:06,070 execute this line we're going to check is it a new 12869 04:18:06,070 --> 04:18:06,080 we're going to check is it a new 12870 04:18:06,080 --> 04:18:07,429 we're going to check is it a new supplier or 12871 04:18:07,429 --> 04:18:07,439 supplier or 12872 04:18:07,439 --> 04:18:09,670 supplier or an existing one because that makes a 12873 04:18:09,670 --> 04:18:09,680 an existing one because that makes a 12874 04:18:09,680 --> 04:18:10,550 an existing one because that makes a difference 12875 04:18:10,550 --> 04:18:10,560 difference 12876 04:18:10,560 --> 04:18:13,429 difference so how do we know if it's a new one or 12877 04:18:13,429 --> 04:18:13,439 so how do we know if it's a new one or 12878 04:18:13,439 --> 04:18:14,550 so how do we know if it's a new one or an existing one 12879 04:18:14,550 --> 04:18:14,560 an existing one 12880 04:18:14,560 --> 04:18:17,349 an existing one we can look that name up in the 12881 04:18:17,349 --> 04:18:17,359 we can look that name up in the 12882 04:18:17,359 --> 04:18:18,229 we can look that name up in the dictionary 12883 04:18:18,229 --> 04:18:18,239 dictionary 12884 04:18:18,239 --> 04:18:20,389 dictionary if we have already edited that name in 12885 04:18:20,389 --> 04:18:20,399 if we have already edited that name in 12886 04:18:20,399 --> 04:18:21,830 if we have already edited that name in the dictionary then it's going to be 12887 04:18:21,830 --> 04:18:21,840 the dictionary then it's going to be 12888 04:18:21,840 --> 04:18:22,630 the dictionary then it's going to be there 12889 04:18:22,630 --> 04:18:22,640 there 12890 04:18:22,640 --> 04:18:25,189 there and we can do that very easily again 12891 04:18:25,189 --> 04:18:25,199 and we can do that very easily again 12892 04:18:25,199 --> 04:18:26,550 and we can do that very easily again with the syntax 12893 04:18:26,550 --> 04:18:26,560 with the syntax 12894 04:18:26,560 --> 04:18:29,990 with the syntax if supplier name in 12895 04:18:29,990 --> 04:18:30,000 if supplier name in 12896 04:18:30,000 --> 04:18:33,030 if supplier name in the dictionary it's actually very 12897 04:18:33,030 --> 04:18:33,040 the dictionary it's actually very 12898 04:18:33,040 --> 04:18:36,149 the dictionary it's actually very readable syntax that says is the 12899 04:18:36,149 --> 04:18:36,159 readable syntax that says is the 12900 04:18:36,159 --> 04:18:36,870 readable syntax that says is the supplier 12901 04:18:36,870 --> 04:18:36,880 supplier 12902 04:18:36,880 --> 04:18:39,429 supplier already added to the list or is it a new 12903 04:18:39,429 --> 04:18:39,439 already added to the list or is it a new 12904 04:18:39,439 --> 04:18:40,550 already added to the list or is it a new one 12905 04:18:40,550 --> 04:18:40,560 one 12906 04:18:40,560 --> 04:18:43,670 one so if this is true again 12907 04:18:43,670 --> 04:18:43,680 so if this is true again 12908 04:18:43,680 --> 04:18:47,590 so if this is true again remember if conditional so if this 12909 04:18:47,590 --> 04:18:47,600 remember if conditional so if this 12910 04:18:47,600 --> 04:18:50,710 remember if conditional so if this is true statement if the supplier name 12911 04:18:50,710 --> 04:18:50,720 is true statement if the supplier name 12912 04:18:50,720 --> 04:18:51,670 is true statement if the supplier name is already there 12913 04:18:51,670 --> 04:18:51,680 is already there 12914 04:18:51,680 --> 04:18:54,550 is already there then it is an existing one so we need to 12915 04:18:54,550 --> 04:18:54,560 then it is an existing one so we need to 12916 04:18:54,560 --> 04:18:55,670 then it is an existing one so we need to increment 12917 04:18:55,670 --> 04:18:55,680 increment 12918 04:18:55,680 --> 04:18:57,590 increment the product number instead of setting it 12919 04:18:57,590 --> 04:18:57,600 the product number instead of setting it 12920 04:18:57,600 --> 04:18:58,790 the product number instead of setting it to one 12921 04:18:58,790 --> 04:18:58,800 to one 12922 04:18:58,800 --> 04:19:01,429 to one so instead of assigning a new value we 12923 04:19:01,429 --> 04:19:01,439 so instead of assigning a new value we 12924 04:19:01,439 --> 04:19:02,229 so instead of assigning a new value we want to 12925 04:19:02,229 --> 04:19:02,239 want to 12926 04:19:02,239 --> 04:19:05,030 want to grab that value the existing one and 12927 04:19:05,030 --> 04:19:05,040 grab that value the existing one and 12928 04:19:05,040 --> 04:19:06,070 grab that value the existing one and basically add 12929 04:19:06,070 --> 04:19:06,080 basically add 12930 04:19:06,080 --> 04:19:09,750 basically add one to it right just increment by one so 12931 04:19:09,750 --> 04:19:09,760 one to it right just increment by one so 12932 04:19:09,760 --> 04:19:12,149 one to it right just increment by one so getting a value from a dictionary you 12933 04:19:12,149 --> 04:19:12,159 getting a value from a dictionary you 12934 04:19:12,159 --> 04:19:14,469 getting a value from a dictionary you probably remember the syntax already 12935 04:19:14,469 --> 04:19:14,479 probably remember the syntax already 12936 04:19:14,479 --> 04:19:17,590 probably remember the syntax already using the key and we can save it into 12937 04:19:17,590 --> 04:19:17,600 using the key and we can save it into 12938 04:19:17,600 --> 04:19:22,229 using the key and we can save it into a variable let's call it current 12939 04:19:22,229 --> 04:19:22,239 a variable let's call it current 12940 04:19:22,239 --> 04:19:26,229 a variable let's call it current number of products 12941 04:19:29,510 --> 04:19:29,520 like this remember we're using a key 12942 04:19:29,520 --> 04:19:31,429 like this remember we're using a key in order to get the value and the key is 12943 04:19:31,429 --> 04:19:31,439 in order to get the value and the key is 12944 04:19:31,439 --> 04:19:32,550 in order to get the value and the key is the supplier name 12945 04:19:32,550 --> 04:19:32,560 the supplier name 12946 04:19:32,560 --> 04:19:34,950 the supplier name value is the product count so this will 12947 04:19:34,950 --> 04:19:34,960 value is the product count so this will 12948 04:19:34,960 --> 04:19:35,830 value is the product count so this will give us 12949 04:19:35,830 --> 04:19:35,840 give us 12950 04:19:35,840 --> 04:19:37,990 give us the current number of products on the 12951 04:19:37,990 --> 04:19:38,000 the current number of products on the 12952 04:19:38,000 --> 04:19:39,910 the current number of products on the first iteration this will be one 12953 04:19:39,910 --> 04:19:39,920 first iteration this will be one 12954 04:19:39,920 --> 04:19:41,910 first iteration this will be one or after the first iteration we're going 12955 04:19:41,910 --> 04:19:41,920 or after the first iteration we're going 12956 04:19:41,920 --> 04:19:43,830 or after the first iteration we're going to have one product for that specific 12957 04:19:43,830 --> 04:19:43,840 to have one product for that specific 12958 04:19:43,840 --> 04:19:44,950 to have one product for that specific supplier 12959 04:19:44,950 --> 04:19:44,960 supplier 12960 04:19:44,960 --> 04:19:49,349 supplier and if we already have that supplier 12961 04:19:49,349 --> 04:19:49,359 and if we already have that supplier 12962 04:19:49,359 --> 04:19:52,550 and if we already have that supplier in the dictionary we want to increment 12963 04:19:52,550 --> 04:19:52,560 in the dictionary we want to increment 12964 04:19:52,560 --> 04:19:54,950 in the dictionary we want to increment the number of products for that specific 12965 04:19:54,950 --> 04:19:54,960 the number of products for that specific 12966 04:19:54,960 --> 04:19:56,229 the number of products for that specific supplier by one 12967 04:19:56,229 --> 04:19:56,239 supplier by one 12968 04:19:56,239 --> 04:19:58,309 supplier by one because we just found another product 12969 04:19:58,309 --> 04:19:58,319 because we just found another product 12970 04:19:58,319 --> 04:19:59,830 because we just found another product from that supplier 12971 04:19:59,830 --> 04:19:59,840 from that supplier 12972 04:19:59,840 --> 04:20:03,269 from that supplier so we want this value to now be 12973 04:20:03,269 --> 04:20:03,279 so we want this value to now be 12974 04:20:03,279 --> 04:20:06,389 so we want this value to now be plus one right so current number of 12975 04:20:06,389 --> 04:20:06,399 plus one right so current number of 12976 04:20:06,399 --> 04:20:07,429 plus one right so current number of products 12977 04:20:07,429 --> 04:20:07,439 products 12978 04:20:07,439 --> 04:20:10,309 products plus one so that's the new value that we 12979 04:20:10,309 --> 04:20:10,319 plus one so that's the new value that we 12980 04:20:10,319 --> 04:20:11,030 plus one so that's the new value that we want 12981 04:20:11,030 --> 04:20:11,040 want 12982 04:20:11,040 --> 04:20:14,149 want for the existing for this current 12983 04:20:14,149 --> 04:20:14,159 for the existing for this current 12984 04:20:14,159 --> 04:20:17,510 for the existing for this current supplier and how do we assign it back 12985 04:20:17,510 --> 04:20:17,520 supplier and how do we assign it back 12986 04:20:17,520 --> 04:20:21,910 supplier and how do we assign it back to the dictionary again we grab that 12987 04:20:21,910 --> 04:20:21,920 to the dictionary again we grab that 12988 04:20:21,920 --> 04:20:25,349 to the dictionary again we grab that and assign it so as you see 12989 04:20:25,349 --> 04:20:25,359 and assign it so as you see 12990 04:20:25,359 --> 04:20:27,590 and assign it so as you see taking the value from the dictionary has 12991 04:20:27,590 --> 04:20:27,600 taking the value from the dictionary has 12992 04:20:27,600 --> 04:20:29,590 taking the value from the dictionary has the same syntax as 12993 04:20:29,590 --> 04:20:29,600 the same syntax as 12994 04:20:29,600 --> 04:20:32,630 the same syntax as setting that value in the dictionary 12995 04:20:32,630 --> 04:20:32,640 setting that value in the dictionary 12996 04:20:32,640 --> 04:20:35,510 setting that value in the dictionary in fact we could actually use a shortcut 12997 04:20:35,510 --> 04:20:35,520 in fact we could actually use a shortcut 12998 04:20:35,520 --> 04:20:36,070 in fact we could actually use a shortcut here 12999 04:20:36,070 --> 04:20:36,080 here 13000 04:20:36,080 --> 04:20:38,309 here so instead of current numproducts we 13001 04:20:38,309 --> 04:20:38,319 so instead of current numproducts we 13002 04:20:38,319 --> 04:20:39,110 so instead of current numproducts we could just 13003 04:20:39,110 --> 04:20:39,120 could just 13004 04:20:39,120 --> 04:20:41,910 could just take that value and add plus to it and 13005 04:20:41,910 --> 04:20:41,920 take that value and add plus to it and 13006 04:20:41,920 --> 04:20:42,469 take that value and add plus to it and then 13007 04:20:42,469 --> 04:20:42,479 then 13008 04:20:42,479 --> 04:20:46,070 then set it back as a new value and 13009 04:20:46,070 --> 04:20:46,080 set it back as a new value and 13010 04:20:46,080 --> 04:20:47,750 set it back as a new value and this will basically just give us a 13011 04:20:47,750 --> 04:20:47,760 this will basically just give us a 13012 04:20:47,760 --> 04:20:50,070 this will basically just give us a one-liner for the logic 13013 04:20:50,070 --> 04:20:50,080 one-liner for the logic 13014 04:20:50,080 --> 04:20:52,229 one-liner for the logic depends on the taste whether this looks 13015 04:20:52,229 --> 04:20:52,239 depends on the taste whether this looks 13016 04:20:52,239 --> 04:20:53,429 depends on the taste whether this looks nice or not 13017 04:20:53,429 --> 04:20:53,439 nice or not 13018 04:20:53,439 --> 04:20:55,510 nice or not or whether it's better to have a new 13019 04:20:55,510 --> 04:20:55,520 or whether it's better to have a new 13020 04:20:55,520 --> 04:20:56,550 or whether it's better to have a new variable and 13021 04:20:56,550 --> 04:20:56,560 variable and 13022 04:20:56,560 --> 04:20:58,309 variable and increment the value like this let's 13023 04:20:58,309 --> 04:20:58,319 increment the value like this let's 13024 04:20:58,319 --> 04:21:00,389 increment the value like this let's actually leave it like this 13025 04:21:00,389 --> 04:21:00,399 actually leave it like this 13026 04:21:00,399 --> 04:21:03,110 actually leave it like this so this logic will take care of adding a 13027 04:21:03,110 --> 04:21:03,120 so this logic will take care of adding a 13028 04:21:03,120 --> 04:21:03,990 so this logic will take care of adding a product count 13029 04:21:03,990 --> 04:21:04,000 product count 13030 04:21:04,000 --> 04:21:05,830 product count every time we find another product for 13031 04:21:05,830 --> 04:21:05,840 every time we find another product for 13032 04:21:05,840 --> 04:21:07,110 every time we find another product for the same supplier 13033 04:21:07,110 --> 04:21:07,120 the same supplier 13034 04:21:07,120 --> 04:21:09,590 the same supplier however now we have to decide what 13035 04:21:09,590 --> 04:21:09,600 however now we have to decide what 13036 04:21:09,600 --> 04:21:10,309 however now we have to decide what happens 13037 04:21:10,309 --> 04:21:10,319 happens 13038 04:21:10,319 --> 04:21:13,349 happens when it's a new supplier so if this 13039 04:21:13,349 --> 04:21:13,359 when it's a new supplier so if this 13040 04:21:13,359 --> 04:21:13,990 when it's a new supplier so if this condition 13041 04:21:13,990 --> 04:21:14,000 condition 13042 04:21:14,000 --> 04:21:16,710 condition is false if the supplier name is not on 13043 04:21:16,710 --> 04:21:16,720 is false if the supplier name is not on 13044 04:21:16,720 --> 04:21:17,429 is false if the supplier name is not on the list 13045 04:21:17,429 --> 04:21:17,439 the list 13046 04:21:17,439 --> 04:21:18,950 the list and this is going to be the case on the 13047 04:21:18,950 --> 04:21:18,960 and this is going to be the case on the 13048 04:21:18,960 --> 04:21:20,469 and this is going to be the case on the very first iteration 13049 04:21:20,469 --> 04:21:20,479 very first iteration 13050 04:21:20,479 --> 04:21:23,030 very first iteration as well because the dictionary is 13051 04:21:23,030 --> 04:21:23,040 as well because the dictionary is 13052 04:21:23,040 --> 04:21:23,510 as well because the dictionary is basically 13053 04:21:23,510 --> 04:21:23,520 basically 13054 04:21:23,520 --> 04:21:26,630 basically empty so there are no supplier names and 13055 04:21:26,630 --> 04:21:26,640 empty so there are no supplier names and 13056 04:21:26,640 --> 04:21:28,790 empty so there are no supplier names and for that case 13057 04:21:28,790 --> 04:21:28,800 for that case 13058 04:21:28,800 --> 04:21:32,149 for that case else we're going to do what we had 13059 04:21:32,149 --> 04:21:32,159 else we're going to do what we had 13060 04:21:32,159 --> 04:21:32,710 else we're going to do what we had before 13061 04:21:32,710 --> 04:21:32,720 before 13062 04:21:32,720 --> 04:21:35,910 before which is just setting that number to one 13063 04:21:35,910 --> 04:21:35,920 which is just setting that number to one 13064 04:21:35,920 --> 04:21:37,510 which is just setting that number to one right this is going to be the first 13065 04:21:37,510 --> 04:21:37,520 right this is going to be the first 13066 04:21:37,520 --> 04:21:39,670 right this is going to be the first value so this will do 13067 04:21:39,670 --> 04:21:39,680 value so this will do 13068 04:21:39,680 --> 04:21:42,710 value so this will do two things basically it will create 13069 04:21:42,710 --> 04:21:42,720 two things basically it will create 13070 04:21:42,720 --> 04:21:44,950 two things basically it will create a new entry in this dictionary for this 13071 04:21:44,950 --> 04:21:44,960 a new entry in this dictionary for this 13072 04:21:44,960 --> 04:21:46,229 a new entry in this dictionary for this new supplier 13073 04:21:46,229 --> 04:21:46,239 new supplier 13074 04:21:46,239 --> 04:21:49,349 new supplier and it will set the product count number 13075 04:21:49,349 --> 04:21:49,359 and it will set the product count number 13076 04:21:49,359 --> 04:21:51,990 and it will set the product count number to one for that new supplier and that's 13077 04:21:51,990 --> 04:21:52,000 to one for that new supplier and that's 13078 04:21:52,000 --> 04:21:54,070 to one for that new supplier and that's it that's actually our logic 13079 04:21:54,070 --> 04:21:54,080 it that's actually our logic 13080 04:21:54,080 --> 04:21:56,229 it that's actually our logic and let's actually try this out and 13081 04:21:56,229 --> 04:21:56,239 and let's actually try this out and 13082 04:21:56,239 --> 04:21:57,269 and let's actually try this out and print it out 13083 04:21:57,269 --> 04:21:57,279 print it out 13084 04:21:57,279 --> 04:22:01,110 print it out so right here i'm gonna print 13085 04:22:01,110 --> 04:22:01,120 so right here i'm gonna print 13086 04:22:01,120 --> 04:22:04,790 so right here i'm gonna print adding a new supplier 13087 04:22:04,790 --> 04:22:04,800 adding a new supplier 13088 04:22:04,800 --> 04:22:06,550 adding a new supplier and this is going to happen three times 13089 04:22:06,550 --> 04:22:06,560 and this is going to happen three times 13090 04:22:06,560 --> 04:22:08,550 and this is going to happen three times because we have three suppliers 13091 04:22:08,550 --> 04:22:08,560 because we have three suppliers 13092 04:22:08,560 --> 04:22:10,950 because we have three suppliers so we can safely print it because just 13093 04:22:10,950 --> 04:22:10,960 so we can safely print it because just 13094 04:22:10,960 --> 04:22:12,469 so we can safely print it because just gonna happen three times 13095 04:22:12,469 --> 04:22:12,479 gonna happen three times 13096 04:22:12,479 --> 04:22:14,630 gonna happen three times there is one more thing we need to fix 13097 04:22:14,630 --> 04:22:14,640 there is one more thing we need to fix 13098 04:22:14,640 --> 04:22:16,149 there is one more thing we need to fix here and that is 13099 04:22:16,149 --> 04:22:16,159 here and that is 13100 04:22:16,159 --> 04:22:18,630 here and that is getting the value from the cell so if we 13101 04:22:18,630 --> 04:22:18,640 getting the value from the cell so if we 13102 04:22:18,640 --> 04:22:19,349 getting the value from the cell so if we actually 13103 04:22:19,349 --> 04:22:19,359 actually 13104 04:22:19,359 --> 04:22:21,910 actually execute this now let's comment this out 13105 04:22:21,910 --> 04:22:21,920 execute this now let's comment this out 13106 04:22:21,920 --> 04:22:23,910 execute this now let's comment this out and actually print out 13107 04:22:23,910 --> 04:22:23,920 and actually print out 13108 04:22:23,920 --> 04:22:27,590 and actually print out what the supplier name here is 13109 04:22:27,590 --> 04:22:27,600 what the supplier name here is 13110 04:22:27,600 --> 04:22:29,429 what the supplier name here is let's actually get rid of this line we 13111 04:22:29,429 --> 04:22:29,439 let's actually get rid of this line we 13112 04:22:29,439 --> 04:22:30,630 let's actually get rid of this line we don't need this 13113 04:22:30,630 --> 04:22:30,640 don't need this 13114 04:22:30,640 --> 04:22:34,870 don't need this and run the program you see here we have 13115 04:22:34,870 --> 04:22:34,880 and run the program you see here we have 13116 04:22:34,880 --> 04:22:36,950 and run the program you see here we have cell information so it's not actually 13117 04:22:36,950 --> 04:22:36,960 cell information so it's not actually 13118 04:22:36,960 --> 04:22:37,910 cell information so it's not actually the 13119 04:22:37,910 --> 04:22:37,920 the 13120 04:22:37,920 --> 04:22:40,309 the the value the name of the supplier but 13121 04:22:40,309 --> 04:22:40,319 the value the name of the supplier but 13122 04:22:40,319 --> 04:22:41,429 the value the name of the supplier but it's just 13123 04:22:41,429 --> 04:22:41,439 it's just 13124 04:22:41,439 --> 04:22:44,469 it's just the object cell and the reason for that 13125 04:22:44,469 --> 04:22:44,479 the object cell and the reason for that 13126 04:22:44,479 --> 04:22:47,349 the object cell and the reason for that is because we're accessing a cell but 13127 04:22:47,349 --> 04:22:47,359 is because we're accessing a cell but 13128 04:22:47,359 --> 04:22:49,590 is because we're accessing a cell but we're not actually extracting or getting 13129 04:22:49,590 --> 04:22:49,600 we're not actually extracting or getting 13130 04:22:49,600 --> 04:22:51,030 we're not actually extracting or getting the value out of it 13131 04:22:51,030 --> 04:22:51,040 the value out of it 13132 04:22:51,040 --> 04:22:54,870 the value out of it and we can do that using this value 13133 04:22:54,870 --> 04:22:54,880 and we can do that using this value 13134 04:22:54,880 --> 04:22:58,309 and we can do that using this value attribute on that complete object 13135 04:22:58,309 --> 04:22:58,319 attribute on that complete object 13136 04:22:58,319 --> 04:23:00,070 attribute on that complete object again something that you can look up in 13137 04:23:00,070 --> 04:23:00,080 again something that you can look up in 13138 04:23:00,080 --> 04:23:02,229 again something that you can look up in the documentation of 13139 04:23:02,229 --> 04:23:02,239 the documentation of 13140 04:23:02,239 --> 04:23:05,910 the documentation of this open pi xl module 13141 04:23:05,910 --> 04:23:05,920 this open pi xl module 13142 04:23:05,920 --> 04:23:08,389 this open pi xl module so now let's run it again and now we 13143 04:23:08,389 --> 04:23:08,399 so now let's run it again and now we 13144 04:23:08,399 --> 04:23:09,349 so now let's run it again and now we have 13145 04:23:09,349 --> 04:23:09,359 have 13146 04:23:09,359 --> 04:23:12,710 have the actual values of that cell 13147 04:23:12,710 --> 04:23:12,720 the actual values of that cell 13148 04:23:12,720 --> 04:23:16,309 the actual values of that cell and this will take care of that small 13149 04:23:16,309 --> 04:23:16,319 and this will take care of that small 13150 04:23:16,319 --> 04:23:19,750 and this will take care of that small problem and now we are ready to 13151 04:23:19,750 --> 04:23:19,760 problem and now we are ready to 13152 04:23:19,760 --> 04:23:23,590 problem and now we are ready to execute our 13153 04:23:23,590 --> 04:23:23,600 execute our 13154 04:23:23,600 --> 04:23:26,630 execute our program and after the for loop actually 13155 04:23:26,630 --> 04:23:26,640 program and after the for loop actually 13156 04:23:26,640 --> 04:23:27,990 program and after the for loop actually let's print out the 13157 04:23:27,990 --> 04:23:28,000 let's print out the 13158 04:23:28,000 --> 04:23:31,030 let's print out the dictionary because we want to see the 13159 04:23:31,030 --> 04:23:31,040 dictionary because we want to see the 13160 04:23:31,040 --> 04:23:32,790 dictionary because we want to see the results of the dictionary that we are 13161 04:23:32,790 --> 04:23:32,800 results of the dictionary that we are 13162 04:23:32,800 --> 04:23:33,990 results of the dictionary that we are building here 13163 04:23:33,990 --> 04:23:34,000 building here 13164 04:23:34,000 --> 04:23:37,110 building here and i'm going to execute it now 13165 04:23:37,110 --> 04:23:37,120 and i'm going to execute it now 13166 04:23:37,120 --> 04:23:39,750 and i'm going to execute it now and there you go first of all we have 13167 04:23:39,750 --> 04:23:39,760 and there you go first of all we have 13168 04:23:39,760 --> 04:23:42,229 and there you go first of all we have three times adding a new supplier 13169 04:23:42,229 --> 04:23:42,239 three times adding a new supplier 13170 04:23:42,239 --> 04:23:44,710 three times adding a new supplier because we have three suppliers and this 13171 04:23:44,710 --> 04:23:44,720 because we have three suppliers and this 13172 04:23:44,720 --> 04:23:45,750 because we have three suppliers and this is the 13173 04:23:45,750 --> 04:23:45,760 is the 13174 04:23:45,760 --> 04:23:48,469 is the resulting dictionary and it looks 13175 04:23:48,469 --> 04:23:48,479 resulting dictionary and it looks 13176 04:23:48,479 --> 04:23:49,670 resulting dictionary and it looks actually very good 13177 04:23:49,670 --> 04:23:49,680 actually very good 13178 04:23:49,680 --> 04:23:53,349 actually very good first we have company a because this was 13179 04:23:53,349 --> 04:23:53,359 first we have company a because this was 13180 04:23:53,359 --> 04:23:55,030 first we have company a because this was the first on the list 13181 04:23:55,030 --> 04:23:55,040 the first on the list 13182 04:23:55,040 --> 04:23:57,910 the first on the list and we have number of products that were 13183 04:23:57,910 --> 04:23:57,920 and we have number of products that were 13184 04:23:57,920 --> 04:23:58,870 and we have number of products that were counted 13185 04:23:58,870 --> 04:23:58,880 counted 13186 04:23:58,880 --> 04:24:01,750 counted for that company then we have the second 13187 04:24:01,750 --> 04:24:01,760 for that company then we have the second 13188 04:24:01,760 --> 04:24:02,229 for that company then we have the second one 13189 04:24:02,229 --> 04:24:02,239 one 13190 04:24:02,239 --> 04:24:04,950 one with number of products and the third 13191 04:24:04,950 --> 04:24:04,960 with number of products and the third 13192 04:24:04,960 --> 04:24:05,830 with number of products and the third one 13193 04:24:05,830 --> 04:24:05,840 one 13194 04:24:05,840 --> 04:24:07,990 one so it looks like our program did exactly 13195 04:24:07,990 --> 04:24:08,000 so it looks like our program did exactly 13196 04:24:08,000 --> 04:24:12,710 so it looks like our program did exactly what we wanted 13197 04:24:15,670 --> 04:24:15,680 so that takes care of the first exercise 13198 04:24:15,680 --> 04:24:17,750 so that takes care of the first exercise now i want to note here 13199 04:24:17,750 --> 04:24:17,760 now i want to note here 13200 04:24:17,760 --> 04:24:21,030 now i want to note here one small thing which is an alternative 13201 04:24:21,030 --> 04:24:21,040 one small thing which is an alternative 13202 04:24:21,040 --> 04:24:21,910 one small thing which is an alternative syntax for 13203 04:24:21,910 --> 04:24:21,920 syntax for 13204 04:24:21,920 --> 04:24:24,389 syntax for getting values from a dictionary which 13205 04:24:24,389 --> 04:24:24,399 getting values from a dictionary which 13206 04:24:24,399 --> 04:24:25,349 getting values from a dictionary which is actually 13207 04:24:25,349 --> 04:24:25,359 is actually 13208 04:24:25,359 --> 04:24:28,710 is actually a more recommended way of doing it which 13209 04:24:28,710 --> 04:24:28,720 a more recommended way of doing it which 13210 04:24:28,720 --> 04:24:29,670 a more recommended way of doing it which is instead of 13211 04:24:29,670 --> 04:24:29,680 is instead of 13212 04:24:29,680 --> 04:24:32,870 is instead of having these brackets here 13213 04:24:32,870 --> 04:24:32,880 having these brackets here 13214 04:24:32,880 --> 04:24:36,309 having these brackets here to have a get method right 13215 04:24:36,309 --> 04:24:36,319 to have a get method right 13216 04:24:36,319 --> 04:24:40,550 to have a get method right to use a get function 13217 04:24:44,149 --> 04:24:44,159 with the key name so now you see the 13218 04:24:44,159 --> 04:24:45,990 with the key name so now you see the difference between those two 13219 04:24:45,990 --> 04:24:46,000 difference between those two 13220 04:24:46,000 --> 04:24:49,510 difference between those two so this is setting the value of that key 13221 04:24:49,510 --> 04:24:49,520 so this is setting the value of that key 13222 04:24:49,520 --> 04:24:52,790 so this is setting the value of that key again remember key is this one here and 13223 04:24:52,790 --> 04:24:52,800 again remember key is this one here and 13224 04:24:52,800 --> 04:24:54,070 again remember key is this one here and this is the value 13225 04:24:54,070 --> 04:24:54,080 this is the value 13226 04:24:54,080 --> 04:24:55,670 this is the value so we are accessing the value of the 13227 04:24:55,670 --> 04:24:55,680 so we are accessing the value of the 13228 04:24:55,680 --> 04:24:57,830 so we are accessing the value of the dictionary using that key 13229 04:24:57,830 --> 04:24:57,840 dictionary using that key 13230 04:24:57,840 --> 04:25:01,349 dictionary using that key and get function is actually 13231 04:25:01,349 --> 04:25:01,359 and get function is actually 13232 04:25:01,359 --> 04:25:05,030 and get function is actually another way of grabbing this value out 13233 04:25:05,030 --> 04:25:05,040 another way of grabbing this value out 13234 04:25:05,040 --> 04:25:07,670 another way of grabbing this value out of a dictionary using the key name 13235 04:25:07,670 --> 04:25:07,680 of a dictionary using the key name 13236 04:25:07,680 --> 04:25:11,110 of a dictionary using the key name again if i execute this i should see 13237 04:25:11,110 --> 04:25:11,120 again if i execute this i should see 13238 04:25:11,120 --> 04:25:14,790 again if i execute this i should see the same result 13239 04:25:16,710 --> 04:25:16,720 after the first exercise basically we 13240 04:25:16,720 --> 04:25:18,469 after the first exercise basically we see from which company 13241 04:25:18,469 --> 04:25:18,479 see from which company 13242 04:25:18,479 --> 04:25:20,149 see from which company from which supplier we have the most 13243 04:25:20,149 --> 04:25:20,159 from which supplier we have the most 13244 04:25:20,159 --> 04:25:22,550 from which supplier we have the most product or the highest number of 13245 04:25:22,550 --> 04:25:22,560 product or the highest number of 13246 04:25:22,560 --> 04:25:24,950 product or the highest number of products now in the second exercise 13247 04:25:24,950 --> 04:25:24,960 products now in the second exercise 13248 04:25:24,960 --> 04:25:26,389 products now in the second exercise we're going to calculate 13249 04:25:26,389 --> 04:25:26,399 we're going to calculate 13250 04:25:26,399 --> 04:25:29,510 we're going to calculate the total inventory value per supplier 13251 04:25:29,510 --> 04:25:29,520 the total inventory value per supplier 13252 04:25:29,520 --> 04:25:32,309 the total inventory value per supplier meaning in our list for each product we 13253 04:25:32,309 --> 04:25:32,319 meaning in our list for each product we 13254 04:25:32,319 --> 04:25:33,030 meaning in our list for each product we have 13255 04:25:33,030 --> 04:25:33,040 have 13256 04:25:33,040 --> 04:25:35,110 have number of units for the product and the 13257 04:25:35,110 --> 04:25:35,120 number of units for the product and the 13258 04:25:35,120 --> 04:25:36,790 number of units for the product and the price so basically for 13259 04:25:36,790 --> 04:25:36,800 price so basically for 13260 04:25:36,800 --> 04:25:39,750 price so basically for each supplier we want to calculate how 13261 04:25:39,750 --> 04:25:39,760 each supplier we want to calculate how 13262 04:25:39,760 --> 04:25:40,870 each supplier we want to calculate how much is the total 13263 04:25:40,870 --> 04:25:40,880 much is the total 13264 04:25:40,880 --> 04:25:43,910 much is the total value of inventory of their products 13265 04:25:43,910 --> 04:25:43,920 value of inventory of their products 13266 04:25:43,920 --> 04:25:46,309 value of inventory of their products of all their products and again as a 13267 04:25:46,309 --> 04:25:46,319 of all their products and again as a 13268 04:25:46,319 --> 04:25:47,030 of all their products and again as a result 13269 04:25:47,030 --> 04:25:47,040 result 13270 04:25:47,040 --> 04:25:48,870 result we want to create a dictionary that 13271 04:25:48,870 --> 04:25:48,880 we want to create a dictionary that 13272 04:25:48,880 --> 04:25:50,309 we want to create a dictionary that basically tells 13273 04:25:50,309 --> 04:25:50,319 basically tells 13274 04:25:50,319 --> 04:25:53,750 basically tells us that value per company let's go ahead 13275 04:25:53,750 --> 04:25:53,760 us that value per company let's go ahead 13276 04:25:53,760 --> 04:25:55,349 us that value per company let's go ahead and do that 13277 04:25:55,349 --> 04:25:55,359 and do that 13278 04:25:55,359 --> 04:26:00,830 and do that so this was calculation 13279 04:26:03,110 --> 04:26:03,120 calculation for number 13280 04:26:03,120 --> 04:26:07,269 calculation for number of products per 13281 04:26:07,269 --> 04:26:07,279 of products per 13282 04:26:07,279 --> 04:26:12,070 of products per supplier 13283 04:26:14,830 --> 04:26:14,840 and here we're going to give us some 13284 04:26:14,840 --> 04:26:18,630 and here we're going to give us some space 13285 04:26:21,830 --> 04:26:21,840 and do calculation 13286 04:26:21,840 --> 04:26:25,269 and do calculation total value per 13287 04:26:25,269 --> 04:26:25,279 total value per 13288 04:26:25,279 --> 04:26:31,269 total value per supplier or total value of inventory 13289 04:26:31,269 --> 04:26:31,279 supplier or total value of inventory 13290 04:26:31,279 --> 04:26:33,189 supplier or total value of inventory per supplier that's what we want to 13291 04:26:33,189 --> 04:26:33,199 per supplier that's what we want to 13292 04:26:33,199 --> 04:26:34,870 per supplier that's what we want to calculate 13293 04:26:34,870 --> 04:26:34,880 calculate 13294 04:26:34,880 --> 04:26:36,710 calculate so just like we did before we're going 13295 04:26:36,710 --> 04:26:36,720 so just like we did before we're going 13296 04:26:36,720 --> 04:26:38,469 so just like we did before we're going to create a new dictionary now 13297 04:26:38,469 --> 04:26:38,479 to create a new dictionary now 13298 04:26:38,479 --> 04:26:41,750 to create a new dictionary now and we're going to call it appropriately 13299 04:26:41,750 --> 04:26:41,760 and we're going to call it appropriately 13300 04:26:41,760 --> 04:26:44,790 and we're going to call it appropriately total value 13301 04:26:44,790 --> 04:26:44,800 total value 13302 04:26:44,800 --> 04:26:48,229 total value per supplier 13303 04:26:48,229 --> 04:26:48,239 per supplier 13304 04:26:48,239 --> 04:26:52,070 per supplier and start with an empty dictionary 13305 04:26:52,070 --> 04:26:52,080 and start with an empty dictionary 13306 04:26:52,080 --> 04:26:55,349 and start with an empty dictionary again for starting in an easy way let's 13307 04:26:55,349 --> 04:26:55,359 again for starting in an easy way let's 13308 04:26:55,359 --> 04:26:56,710 again for starting in an easy way let's consider the first 13309 04:26:56,710 --> 04:26:56,720 consider the first 13310 04:26:56,720 --> 04:26:58,790 consider the first very first iteration for the first 13311 04:26:58,790 --> 04:26:58,800 very first iteration for the first 13312 04:26:58,800 --> 04:26:59,990 very first iteration for the first supplier 13313 04:26:59,990 --> 04:27:00,000 supplier 13314 04:27:00,000 --> 04:27:02,630 supplier how are we going to calculate for the 13315 04:27:02,630 --> 04:27:02,640 how are we going to calculate for the 13316 04:27:02,640 --> 04:27:03,830 how are we going to calculate for the first supplier 13317 04:27:03,830 --> 04:27:03,840 first supplier 13318 04:27:03,840 --> 04:27:07,830 first supplier for the first product so i'm going to 13319 04:27:07,830 --> 04:27:07,840 for the first product so i'm going to 13320 04:27:07,840 --> 04:27:12,710 for the first product so i'm going to take this new dictionary and 13321 04:27:12,710 --> 04:27:12,720 take this new dictionary and 13322 04:27:12,720 --> 04:27:16,229 take this new dictionary and with our familiar syntax i'm gonna do 13323 04:27:16,229 --> 04:27:16,239 with our familiar syntax i'm gonna do 13324 04:27:16,239 --> 04:27:18,870 with our familiar syntax i'm gonna do supplier name so that's gonna be our key 13325 04:27:18,870 --> 04:27:18,880 supplier name so that's gonna be our key 13326 04:27:18,880 --> 04:27:20,389 supplier name so that's gonna be our key and the value 13327 04:27:20,389 --> 04:27:20,399 and the value 13328 04:27:20,399 --> 04:27:22,229 and the value of the very first iteration for the 13329 04:27:22,229 --> 04:27:22,239 of the very first iteration for the 13330 04:27:22,239 --> 04:27:23,590 of the very first iteration for the first product 13331 04:27:23,590 --> 04:27:23,600 first product 13332 04:27:23,600 --> 04:27:27,670 first product is going to be inventory 13333 04:27:27,670 --> 04:27:27,680 is going to be inventory 13334 04:27:27,680 --> 04:27:31,030 is going to be inventory times price so for the first product 13335 04:27:31,030 --> 04:27:31,040 times price so for the first product 13336 04:27:31,040 --> 04:27:33,110 times price so for the first product we're going to calculate how much 13337 04:27:33,110 --> 04:27:33,120 we're going to calculate how much 13338 04:27:33,120 --> 04:27:35,990 we're going to calculate how much or how many of the product items we have 13339 04:27:35,990 --> 04:27:36,000 or how many of the product items we have 13340 04:27:36,000 --> 04:27:36,950 or how many of the product items we have and 13341 04:27:36,950 --> 04:27:36,960 and 13342 04:27:36,960 --> 04:27:39,269 and number of price right that will give us 13343 04:27:39,269 --> 04:27:39,279 number of price right that will give us 13344 04:27:39,279 --> 04:27:41,349 number of price right that will give us value of the total inventory for 13345 04:27:41,349 --> 04:27:41,359 value of the total inventory for 13346 04:27:41,359 --> 04:27:44,710 value of the total inventory for that one specific product and that means 13347 04:27:44,710 --> 04:27:44,720 that one specific product and that means 13348 04:27:44,720 --> 04:27:47,750 that one specific product and that means we need those two values 13349 04:27:47,750 --> 04:27:47,760 we need those two values 13350 04:27:47,760 --> 04:27:49,429 we need those two values right now we're just getting the value 13351 04:27:49,429 --> 04:27:49,439 right now we're just getting the value 13352 04:27:49,439 --> 04:27:51,910 right now we're just getting the value of the supplier 13353 04:27:51,910 --> 04:27:51,920 of the supplier 13354 04:27:51,920 --> 04:27:58,229 of the supplier so we need inventory 13355 04:28:01,590 --> 04:28:01,600 i'm actually going to copy this so we 13356 04:28:01,600 --> 04:28:01,990 i'm actually going to copy this so we need 13357 04:28:01,990 --> 04:28:02,000 need 13358 04:28:02,000 --> 04:28:05,030 need cell for product row and 13359 04:28:05,030 --> 04:28:05,040 cell for product row and 13360 04:28:05,040 --> 04:28:09,189 cell for product row and column inventory is on column two 13361 04:28:09,189 --> 04:28:09,199 column inventory is on column two 13362 04:28:09,199 --> 04:28:13,110 column inventory is on column two and value so whatever the product row is 13363 04:28:13,110 --> 04:28:13,120 and value so whatever the product row is 13364 04:28:13,120 --> 04:28:14,790 and value so whatever the product row is going to be so for each product 13365 04:28:14,790 --> 04:28:14,800 going to be so for each product 13366 04:28:14,800 --> 04:28:16,469 going to be so for each product basically for each row 13367 04:28:16,469 --> 04:28:16,479 basically for each row 13368 04:28:16,479 --> 04:28:18,790 basically for each row we need always the second column so all 13369 04:28:18,790 --> 04:28:18,800 we need always the second column so all 13370 04:28:18,800 --> 04:28:20,229 we need always the second column so all these values here 13371 04:28:20,229 --> 04:28:20,239 these values here 13372 04:28:20,239 --> 04:28:23,510 these values here and then we need price which 13373 04:28:23,510 --> 04:28:23,520 and then we need price which 13374 04:28:23,520 --> 04:28:27,429 and then we need price which going to be product list cell 13375 04:28:27,429 --> 04:28:27,439 going to be product list cell 13376 04:28:27,439 --> 04:28:31,990 going to be product list cell and we are looking for 13377 04:28:36,469 --> 04:28:36,479 the third column for every row 13378 04:28:36,479 --> 04:28:39,990 the third column for every row number three and value 13379 04:28:39,990 --> 04:28:40,000 number three and value 13380 04:28:40,000 --> 04:28:43,189 number three and value so now we have inventory and price per 13381 04:28:43,189 --> 04:28:43,199 so now we have inventory and price per 13382 04:28:43,199 --> 04:28:46,309 so now we have inventory and price per product and the way to calculate 13383 04:28:46,309 --> 04:28:46,319 product and the way to calculate 13384 04:28:46,319 --> 04:28:49,590 product and the way to calculate value is basically inventory that's the 13385 04:28:49,590 --> 04:28:49,600 value is basically inventory that's the 13386 04:28:49,600 --> 04:28:50,469 value is basically inventory that's the number of 13387 04:28:50,469 --> 04:28:50,479 number of 13388 04:28:50,479 --> 04:28:53,750 number of product items times price very easy 13389 04:28:53,750 --> 04:28:53,760 product items times price very easy 13390 04:28:53,760 --> 04:28:57,429 product items times price very easy that will give us the first value 13391 04:28:57,429 --> 04:28:57,439 that will give us the first value 13392 04:28:57,439 --> 04:29:00,309 that will give us the first value for the first supplier now again the 13393 04:29:00,309 --> 04:29:00,319 for the first supplier now again the 13394 04:29:00,319 --> 04:29:01,269 for the first supplier now again the same way 13395 04:29:01,269 --> 04:29:01,279 same way 13396 04:29:01,279 --> 04:29:03,990 same way if we are getting a new supplier so 13397 04:29:03,990 --> 04:29:04,000 if we are getting a new supplier so 13398 04:29:04,000 --> 04:29:05,830 if we are getting a new supplier so basically in the next iteration 13399 04:29:05,830 --> 04:29:05,840 basically in the next iteration 13400 04:29:05,840 --> 04:29:08,710 basically in the next iteration if it's a new supplier then this line 13401 04:29:08,710 --> 04:29:08,720 if it's a new supplier then this line 13402 04:29:08,720 --> 04:29:11,030 if it's a new supplier then this line will get executed and everything is fine 13403 04:29:11,030 --> 04:29:11,040 will get executed and everything is fine 13404 04:29:11,040 --> 04:29:13,269 will get executed and everything is fine however if it's an existing supplier 13405 04:29:13,269 --> 04:29:13,279 however if it's an existing supplier 13406 04:29:13,279 --> 04:29:15,110 however if it's an existing supplier that we already have in the dictionary 13407 04:29:15,110 --> 04:29:15,120 that we already have in the dictionary 13408 04:29:15,120 --> 04:29:18,950 that we already have in the dictionary then we have to add to that previous 13409 04:29:18,950 --> 04:29:18,960 then we have to add to that previous 13410 04:29:18,960 --> 04:29:23,590 then we have to add to that previous value right instead of setting a new one 13411 04:29:23,590 --> 04:29:23,600 value right instead of setting a new one 13412 04:29:23,600 --> 04:29:26,309 value right instead of setting a new one so we're going to do very similar logic 13413 04:29:26,309 --> 04:29:26,319 so we're going to do very similar logic 13414 04:29:26,319 --> 04:29:27,189 so we're going to do very similar logic as we did here 13415 04:29:27,189 --> 04:29:27,199 as we did here 13416 04:29:27,199 --> 04:29:29,910 as we did here so we have the supplier name we're 13417 04:29:29,910 --> 04:29:29,920 so we have the supplier name we're 13418 04:29:29,920 --> 04:29:30,790 so we have the supplier name we're checking 13419 04:29:30,790 --> 04:29:30,800 checking 13420 04:29:30,800 --> 04:29:33,670 checking is it a new supplier or an old one an 13421 04:29:33,670 --> 04:29:33,680 is it a new supplier or an old one an 13422 04:29:33,680 --> 04:29:35,910 is it a new supplier or an old one an existing one 13423 04:29:35,910 --> 04:29:35,920 existing one 13424 04:29:35,920 --> 04:29:39,990 existing one this time in our new dictionary 13425 04:29:39,990 --> 04:29:40,000 this time in our new dictionary 13426 04:29:40,000 --> 04:29:43,189 this time in our new dictionary and if it is we're gonna 13427 04:29:43,189 --> 04:29:43,199 and if it is we're gonna 13428 04:29:43,199 --> 04:29:47,510 and if it is we're gonna grab that old or existing value 13429 04:29:47,510 --> 04:29:47,520 grab that old or existing value 13430 04:29:47,520 --> 04:29:51,910 grab that old or existing value again using this get syntax here 13431 04:29:55,269 --> 04:29:55,279 existing value now is hundred we want to 13432 04:29:55,279 --> 04:29:57,269 existing value now is hundred we want to add to that hundred right 13433 04:29:57,269 --> 04:29:57,279 add to that hundred right 13434 04:29:57,279 --> 04:29:59,110 add to that hundred right so we're gonna grab that value this is 13435 04:29:59,110 --> 04:29:59,120 so we're gonna grab that value this is 13436 04:29:59,120 --> 04:30:01,830 so we're gonna grab that value this is going to be current 13437 04:30:01,830 --> 04:30:01,840 going to be current 13438 04:30:01,840 --> 04:30:05,269 going to be current total value 13439 04:30:05,269 --> 04:30:05,279 total value 13440 04:30:05,279 --> 04:30:08,469 total value and then we're going to add to that 13441 04:30:08,469 --> 04:30:08,479 and then we're going to add to that 13442 04:30:08,479 --> 04:30:12,710 and then we're going to add to that current total value 13443 04:30:15,830 --> 04:30:15,840 the inventory value for the current 13444 04:30:15,840 --> 04:30:19,189 the inventory value for the current product and assign it back to 13445 04:30:19,189 --> 04:30:19,199 product and assign it back to 13446 04:30:19,199 --> 04:30:23,349 product and assign it back to our dictionary 13447 04:30:26,469 --> 04:30:26,479 now our variable names a little bit 13448 04:30:26,479 --> 04:30:29,349 now our variable names a little bit long so the code kind of looks a bit 13449 04:30:29,349 --> 04:30:29,359 long so the code kind of looks a bit 13450 04:30:29,359 --> 04:30:30,389 long so the code kind of looks a bit cluttered 13451 04:30:30,389 --> 04:30:30,399 cluttered 13452 04:30:30,399 --> 04:30:34,070 cluttered but it's easy to read and descriptive so 13453 04:30:34,070 --> 04:30:34,080 but it's easy to read and descriptive so 13454 04:30:34,080 --> 04:30:36,070 but it's easy to read and descriptive so you can also go for shorter variable 13455 04:30:36,070 --> 04:30:36,080 you can also go for shorter variable 13456 04:30:36,080 --> 04:30:37,910 you can also go for shorter variable names to have a cleaner code 13457 04:30:37,910 --> 04:30:37,920 names to have a cleaner code 13458 04:30:37,920 --> 04:30:40,710 names to have a cleaner code again matter of taste i usually name the 13459 04:30:40,710 --> 04:30:40,720 again matter of taste i usually name the 13460 04:30:40,720 --> 04:30:41,750 again matter of taste i usually name the variables 13461 04:30:41,750 --> 04:30:41,760 variables 13462 04:30:41,760 --> 04:30:43,349 variables something descriptive something that 13463 04:30:43,349 --> 04:30:43,359 something descriptive something that 13464 04:30:43,359 --> 04:30:44,790 something descriptive something that basically really 13465 04:30:44,790 --> 04:30:44,800 basically really 13466 04:30:44,800 --> 04:30:46,950 basically really differentiates or says what the value is 13467 04:30:46,950 --> 04:30:46,960 differentiates or says what the value is 13468 04:30:46,960 --> 04:30:48,469 differentiates or says what the value is about 13469 04:30:48,469 --> 04:30:48,479 about 13470 04:30:48,479 --> 04:30:52,790 about and that basically takes care of 13471 04:30:52,790 --> 04:30:52,800 and that basically takes care of 13472 04:30:52,800 --> 04:30:55,590 and that basically takes care of existing suppliers or the suppliers that 13473 04:30:55,590 --> 04:30:55,600 existing suppliers or the suppliers that 13474 04:30:55,600 --> 04:30:55,990 existing suppliers or the suppliers that we already 13475 04:30:55,990 --> 04:30:56,000 we already 13476 04:30:56,000 --> 04:30:59,269 we already have in the dictionary else we do 13477 04:30:59,269 --> 04:30:59,279 have in the dictionary else we do 13478 04:30:59,279 --> 04:31:03,590 have in the dictionary else we do this and this is complaining about 13479 04:31:03,590 --> 04:31:03,600 this and this is complaining about 13480 04:31:03,600 --> 04:31:06,149 this and this is complaining about too many blank lines so let's fix that 13481 04:31:06,149 --> 04:31:06,159 too many blank lines so let's fix that 13482 04:31:06,159 --> 04:31:07,110 too many blank lines so let's fix that and 13483 04:31:07,110 --> 04:31:07,120 and 13484 04:31:07,120 --> 04:31:09,510 and that's basically our logic again to go 13485 04:31:09,510 --> 04:31:09,520 that's basically our logic again to go 13486 04:31:09,520 --> 04:31:10,469 that's basically our logic again to go through it once 13487 04:31:10,469 --> 04:31:10,479 through it once 13488 04:31:10,479 --> 04:31:12,550 through it once for new suppliers again this is going to 13489 04:31:12,550 --> 04:31:12,560 for new suppliers again this is going to 13490 04:31:12,560 --> 04:31:14,309 for new suppliers again this is going to happen three times because we have three 13491 04:31:14,309 --> 04:31:14,319 happen three times because we have three 13492 04:31:14,319 --> 04:31:15,110 happen three times because we have three suppliers 13493 04:31:15,110 --> 04:31:15,120 suppliers 13494 04:31:15,120 --> 04:31:18,389 suppliers we are basically setting the total 13495 04:31:18,389 --> 04:31:18,399 we are basically setting the total 13496 04:31:18,399 --> 04:31:20,950 we are basically setting the total inventory price or inventory value for 13497 04:31:20,950 --> 04:31:20,960 inventory price or inventory value for 13498 04:31:20,960 --> 04:31:22,469 inventory price or inventory value for that specific product 13499 04:31:22,469 --> 04:31:22,479 that specific product 13500 04:31:22,479 --> 04:31:24,950 that specific product because remember we are iterating 13501 04:31:24,950 --> 04:31:24,960 because remember we are iterating 13502 04:31:24,960 --> 04:31:26,309 because remember we are iterating through products 13503 04:31:26,309 --> 04:31:26,319 through products 13504 04:31:26,319 --> 04:31:29,990 through products and then every time a new product 13505 04:31:29,990 --> 04:31:30,000 and then every time a new product 13506 04:31:30,000 --> 04:31:32,630 and then every time a new product iteration happens for the same supplier 13507 04:31:32,630 --> 04:31:32,640 iteration happens for the same supplier 13508 04:31:32,640 --> 04:31:33,670 iteration happens for the same supplier we basically just 13509 04:31:33,670 --> 04:31:33,680 we basically just 13510 04:31:33,680 --> 04:31:36,870 we basically just add an inventory price or total value 13511 04:31:36,870 --> 04:31:36,880 add an inventory price or total value 13512 04:31:36,880 --> 04:31:38,790 add an inventory price or total value for that specific product 13513 04:31:38,790 --> 04:31:38,800 for that specific product 13514 04:31:38,800 --> 04:31:41,429 for that specific product for what we already have in the 13515 04:31:41,429 --> 04:31:41,439 for what we already have in the 13516 04:31:41,439 --> 04:31:42,389 for what we already have in the dictionary 13517 04:31:42,389 --> 04:31:42,399 dictionary 13518 04:31:42,399 --> 04:31:45,910 dictionary for that specific supplier so now 13519 04:31:45,910 --> 04:31:45,920 for that specific supplier so now 13520 04:31:45,920 --> 04:31:49,510 for that specific supplier so now let's again print out 13521 04:31:49,510 --> 04:31:49,520 let's again print out 13522 04:31:49,520 --> 04:31:54,229 let's again print out our dictionary 13523 04:31:54,229 --> 04:31:54,239 our dictionary 13524 04:31:54,239 --> 04:31:59,750 our dictionary let's actually print both values 13525 04:32:02,229 --> 04:32:02,239 so the first dictionary is this one 13526 04:32:02,239 --> 04:32:03,269 so the first dictionary is this one right here 13527 04:32:03,269 --> 04:32:03,279 right here 13528 04:32:03,279 --> 04:32:06,070 right here supplier and number of products second 13529 04:32:06,070 --> 04:32:06,080 supplier and number of products second 13530 04:32:06,080 --> 04:32:06,389 supplier and number of products second one 13531 04:32:06,389 --> 04:32:06,399 one 13532 04:32:06,399 --> 04:32:09,670 one is going to be supplier and total value 13533 04:32:09,670 --> 04:32:09,680 is going to be supplier and total value 13534 04:32:09,680 --> 04:32:12,070 is going to be supplier and total value of all the products they have in the 13535 04:32:12,070 --> 04:32:12,080 of all the products they have in the 13536 04:32:12,080 --> 04:32:13,110 of all the products they have in the inventory 13537 04:32:13,110 --> 04:32:13,120 inventory 13538 04:32:13,120 --> 04:32:16,630 inventory with us execute and there you go we have 13539 04:32:16,630 --> 04:32:16,640 with us execute and there you go we have 13540 04:32:16,640 --> 04:32:19,510 with us execute and there you go we have both dictionaries printed here and here 13541 04:32:19,510 --> 04:32:19,520 both dictionaries printed here and here 13542 04:32:19,520 --> 04:32:20,070 both dictionaries printed here and here you see 13543 04:32:20,070 --> 04:32:20,080 you see 13544 04:32:20,080 --> 04:32:23,750 you see for each company we have the value 13545 04:32:23,750 --> 04:32:23,760 for each company we have the value 13546 04:32:23,760 --> 04:32:27,429 for each company we have the value in price basically right here the value 13547 04:32:27,429 --> 04:32:27,439 in price basically right here the value 13548 04:32:27,439 --> 04:32:29,670 in price basically right here the value for the total inventory of all the 13549 04:32:29,670 --> 04:32:29,680 for the total inventory of all the 13550 04:32:29,680 --> 04:32:31,269 for the total inventory of all the products they have 13551 04:32:31,269 --> 04:32:31,279 products they have 13552 04:32:31,279 --> 04:32:35,349 products they have on this list and we see that value 13553 04:32:35,349 --> 04:32:35,359 on this list and we see that value 13554 04:32:35,359 --> 04:32:38,469 on this list and we see that value per supplier and the values are 13555 04:32:38,469 --> 04:32:38,479 per supplier and the values are 13556 04:32:38,479 --> 04:32:41,510 per supplier and the values are decimal numbers with cent precision so 13557 04:32:41,510 --> 04:32:41,520 decimal numbers with cent precision so 13558 04:32:41,520 --> 04:32:42,389 decimal numbers with cent precision so 95 13559 04:32:42,389 --> 04:32:42,399 95 13560 04:32:42,399 --> 04:32:45,429 95 cents 47 cents because the prices 13561 04:32:45,429 --> 04:32:45,439 cents 47 cents because the prices 13562 04:32:45,439 --> 04:32:48,229 cents 47 cents because the prices are obviously like this as well and if 13563 04:32:48,229 --> 04:32:48,239 are obviously like this as well and if 13564 04:32:48,239 --> 04:32:49,510 are obviously like this as well and if you're wondering this 13565 04:32:49,510 --> 04:32:49,520 you're wondering this 13566 04:32:49,520 --> 04:32:52,870 you're wondering this comma here is actually a german format 13567 04:32:52,870 --> 04:32:52,880 comma here is actually a german format 13568 04:32:52,880 --> 04:32:55,750 comma here is actually a german format for number precision so this is going to 13569 04:32:55,750 --> 04:32:55,760 for number precision so this is going to 13570 04:32:55,760 --> 04:32:57,349 for number precision so this is going to be actually equivalent to 13571 04:32:57,349 --> 04:32:57,359 be actually equivalent to 13572 04:32:57,359 --> 04:33:00,550 be actually equivalent to english dot and we don't have to worry 13573 04:33:00,550 --> 04:33:00,560 english dot and we don't have to worry 13574 04:33:00,560 --> 04:33:01,750 english dot and we don't have to worry about this actually because 13575 04:33:01,750 --> 04:33:01,760 about this actually because 13576 04:33:01,760 --> 04:33:05,510 about this actually because python reads it and 13577 04:33:05,510 --> 04:33:05,520 python reads it and 13578 04:33:05,520 --> 04:33:08,310 python reads it and interprets it correctly so no problem 13579 04:33:08,310 --> 04:33:08,320 interprets it correctly so no problem 13580 04:33:08,320 --> 04:33:08,709 interprets it correctly so no problem with 13581 04:33:08,709 --> 04:33:08,719 with 13582 04:33:08,719 --> 04:33:11,750 with different language formats so that takes 13583 04:33:11,750 --> 04:33:11,760 different language formats so that takes 13584 04:33:11,760 --> 04:33:12,390 different language formats so that takes care of 13585 04:33:12,390 --> 04:33:12,400 care of 13586 04:33:12,400 --> 04:33:16,869 care of our second calculation 13587 04:33:16,869 --> 04:33:16,879 our second calculation 13588 04:33:16,879 --> 04:33:18,629 our second calculation now the third logic we're going to write 13589 04:33:18,629 --> 04:33:18,639 now the third logic we're going to write 13590 04:33:18,639 --> 04:33:20,629 now the third logic we're going to write is basically printing out 13591 04:33:20,629 --> 04:33:20,639 is basically printing out 13592 04:33:20,639 --> 04:33:23,590 is basically printing out all the products that have inventory 13593 04:33:23,590 --> 04:33:23,600 all the products that have inventory 13594 04:33:23,600 --> 04:33:25,109 all the products that have inventory less than 10 13595 04:33:25,109 --> 04:33:25,119 less than 10 13596 04:33:25,119 --> 04:33:28,470 less than 10 like this ones here for example so 13597 04:33:28,470 --> 04:33:28,480 like this ones here for example so 13598 04:33:28,480 --> 04:33:30,230 like this ones here for example so the logic for that is actually going to 13599 04:33:30,230 --> 04:33:30,240 the logic for that is actually going to 13600 04:33:30,240 --> 04:33:31,670 the logic for that is actually going to be pretty easy 13601 04:33:31,670 --> 04:33:31,680 be pretty easy 13602 04:33:31,680 --> 04:33:33,990 be pretty easy what we need as a result is again a 13603 04:33:33,990 --> 04:33:34,000 what we need as a result is again a 13604 04:33:34,000 --> 04:33:35,670 what we need as a result is again a dictionary 13605 04:33:35,670 --> 04:33:35,680 dictionary 13606 04:33:35,680 --> 04:33:39,109 dictionary let's call it products which have 13607 04:33:39,109 --> 04:33:39,119 let's call it products which have 13608 04:33:39,119 --> 04:33:43,109 let's call it products which have inventory under 10 13609 04:33:45,750 --> 04:33:45,760 like this and the value in the 13610 04:33:45,760 --> 04:33:47,029 like this and the value in the dictionary 13611 04:33:47,029 --> 04:33:47,039 dictionary 13612 04:33:47,039 --> 04:33:50,070 dictionary should be the product number 13613 04:33:50,070 --> 04:33:50,080 should be the product number 13614 04:33:50,080 --> 04:33:53,189 should be the product number which we have in the first column and 13615 04:33:53,189 --> 04:33:53,199 which we have in the first column and 13616 04:33:53,199 --> 04:33:56,629 which we have in the first column and the inventory count so let's get rid of 13617 04:33:56,629 --> 04:33:56,639 the inventory count so let's get rid of 13618 04:33:56,639 --> 04:33:57,990 the inventory count so let's get rid of these print statements 13619 04:33:57,990 --> 04:33:58,000 these print statements 13620 04:33:58,000 --> 04:34:01,429 these print statements and let's do calculation 13621 04:34:01,429 --> 04:34:01,439 and let's do calculation 13622 04:34:01,439 --> 04:34:05,590 and let's do calculation or we can do logic products 13623 04:34:05,590 --> 04:34:05,600 or we can do logic products 13624 04:34:05,600 --> 04:34:09,189 or we can do logic products with inventory less than 13625 04:34:09,189 --> 04:34:09,199 with inventory less than 13626 04:34:09,199 --> 04:34:12,551 with inventory less than 10. so basically as i said for each 13627 04:34:12,551 --> 04:34:12,561 10. so basically as i said for each 13628 04:34:12,561 --> 04:34:13,590 10. so basically as i said for each product 13629 04:34:13,590 --> 04:34:13,600 product 13630 04:34:13,600 --> 04:34:15,750 product which has inventory under 10 we want to 13631 04:34:15,750 --> 04:34:15,760 which has inventory under 10 we want to 13632 04:34:15,760 --> 04:34:16,789 which has inventory under 10 we want to print out 13633 04:34:16,789 --> 04:34:16,799 print out 13634 04:34:16,799 --> 04:34:19,029 print out or we want to save in a dictionary the 13635 04:34:19,029 --> 04:34:19,039 or we want to save in a dictionary the 13636 04:34:19,039 --> 04:34:19,830 or we want to save in a dictionary the product number 13637 04:34:19,830 --> 04:34:19,840 product number 13638 04:34:19,840 --> 04:34:23,750 product number and the inventory count so 13639 04:34:23,750 --> 04:34:23,760 and the inventory count so 13640 04:34:23,760 --> 04:34:26,709 and the inventory count so we have the inventory count already the 13641 04:34:26,709 --> 04:34:26,719 we have the inventory count already the 13642 04:34:26,719 --> 04:34:27,269 we have the inventory count already the value 13643 04:34:27,269 --> 04:34:27,279 value 13644 04:34:27,279 --> 04:34:29,990 value from the cell but we don't have the 13645 04:34:29,990 --> 04:34:30,000 from the cell but we don't have the 13646 04:34:30,000 --> 04:34:30,869 from the cell but we don't have the product number 13647 04:34:30,869 --> 04:34:30,879 product number 13648 04:34:30,879 --> 04:34:33,590 product number we're not accessing it so let's actually 13649 04:34:33,590 --> 04:34:33,600 we're not accessing it so let's actually 13650 04:34:33,600 --> 04:34:35,029 we're not accessing it so let's actually do that 13651 04:34:35,029 --> 04:34:35,039 do that 13652 04:34:35,039 --> 04:34:40,789 do that product number 13653 04:34:40,789 --> 04:34:40,799 product number 13654 04:34:40,799 --> 04:34:43,910 product number and we already know how this works 13655 04:34:43,910 --> 04:34:43,920 and we already know how this works 13656 04:34:43,920 --> 04:34:46,310 and we already know how this works this is going to be the first column 13657 04:34:46,310 --> 04:34:46,320 this is going to be the first column 13658 04:34:46,320 --> 04:34:47,189 this is going to be the first column right 13659 04:34:47,189 --> 04:34:47,199 right 13660 04:34:47,199 --> 04:34:50,629 right this one here and this gives us 13661 04:34:50,629 --> 04:34:50,639 this one here and this gives us 13662 04:34:50,639 --> 04:34:55,750 this one here and this gives us product number and now in our dictionary 13663 04:34:55,750 --> 04:34:55,760 product number and now in our dictionary 13664 04:34:55,760 --> 04:34:59,029 product number and now in our dictionary products under 10 13665 04:34:59,029 --> 04:34:59,039 products under 10 13666 04:34:59,039 --> 04:35:02,310 products under 10 we want to add value like this product 13667 04:35:02,310 --> 04:35:02,320 we want to add value like this product 13668 04:35:02,320 --> 04:35:04,629 we want to add value like this product number 13669 04:35:04,629 --> 04:35:04,639 number 13670 04:35:04,639 --> 04:35:07,590 number and it's going to be set to value of the 13671 04:35:07,590 --> 04:35:07,600 and it's going to be set to value of the 13672 04:35:07,600 --> 04:35:09,189 and it's going to be set to value of the inventory 13673 04:35:09,189 --> 04:35:09,199 inventory 13674 04:35:09,199 --> 04:35:11,910 inventory like this however we don't want it for 13675 04:35:11,910 --> 04:35:11,920 like this however we don't want it for 13676 04:35:11,920 --> 04:35:12,470 like this however we don't want it for every 13677 04:35:12,470 --> 04:35:12,480 every 13678 04:35:12,480 --> 04:35:14,869 every product we wanted only for products with 13679 04:35:14,869 --> 04:35:14,879 product we wanted only for products with 13680 04:35:14,879 --> 04:35:17,109 product we wanted only for products with inventory less than 10 13681 04:35:17,109 --> 04:35:17,119 inventory less than 10 13682 04:35:17,119 --> 04:35:19,269 inventory less than 10 and that's going to be an easy if 13683 04:35:19,269 --> 04:35:19,279 and that's going to be an easy if 13684 04:35:19,279 --> 04:35:20,629 and that's going to be an easy if conditional here 13685 04:35:20,629 --> 04:35:20,639 conditional here 13686 04:35:20,639 --> 04:35:23,830 conditional here if inventory again remember 13687 04:35:23,830 --> 04:35:23,840 if inventory again remember 13688 04:35:23,840 --> 04:35:27,189 if inventory again remember this logic all this logic happens for 13689 04:35:27,189 --> 04:35:27,199 this logic all this logic happens for 13690 04:35:27,199 --> 04:35:29,990 this logic all this logic happens for each product row right so all these get 13691 04:35:29,990 --> 04:35:30,000 each product row right so all these get 13692 04:35:30,000 --> 04:35:30,869 each product row right so all these get executed 13693 04:35:30,869 --> 04:35:30,879 executed 13694 04:35:30,879 --> 04:35:33,510 executed for each of these rows so basically we 13695 04:35:33,510 --> 04:35:33,520 for each of these rows so basically we 13696 04:35:33,520 --> 04:35:35,109 for each of these rows so basically we have inventory number 13697 04:35:35,109 --> 04:35:35,119 have inventory number 13698 04:35:35,119 --> 04:35:37,189 have inventory number on each iteration for each specific 13699 04:35:37,189 --> 04:35:37,199 on each iteration for each specific 13700 04:35:37,199 --> 04:35:38,470 on each iteration for each specific product 13701 04:35:38,470 --> 04:35:38,480 product 13702 04:35:38,480 --> 04:35:41,590 product and that's why we can just say if 13703 04:35:41,590 --> 04:35:41,600 and that's why we can just say if 13704 04:35:41,600 --> 04:35:44,470 and that's why we can just say if inventory is less than 10 13705 04:35:44,470 --> 04:35:44,480 inventory is less than 10 13706 04:35:44,480 --> 04:35:47,670 inventory is less than 10 so if the value on that specific row is 13707 04:35:47,670 --> 04:35:47,680 so if the value on that specific row is 13708 04:35:47,680 --> 04:35:48,789 so if the value on that specific row is less than 10 13709 04:35:48,789 --> 04:35:48,799 less than 10 13710 04:35:48,799 --> 04:35:52,070 less than 10 we want to add that product 13711 04:35:52,070 --> 04:35:52,080 we want to add that product 13712 04:35:52,080 --> 04:35:54,230 we want to add that product the current product that we are 13713 04:35:54,230 --> 04:35:54,240 the current product that we are 13714 04:35:54,240 --> 04:35:55,510 the current product that we are iterating on 13715 04:35:55,510 --> 04:35:55,520 iterating on 13716 04:35:55,520 --> 04:35:58,470 iterating on on the list and set the value of 13717 04:35:58,470 --> 04:35:58,480 on the list and set the value of 13718 04:35:58,480 --> 04:35:59,670 on the list and set the value of inventory as well 13719 04:35:59,670 --> 04:35:59,680 inventory as well 13720 04:35:59,680 --> 04:36:01,670 inventory as well again we have some complaining here 13721 04:36:01,670 --> 04:36:01,680 again we have some complaining here 13722 04:36:01,680 --> 04:36:03,670 again we have some complaining here because of the lines 13723 04:36:03,670 --> 04:36:03,680 because of the lines 13724 04:36:03,680 --> 04:36:06,789 because of the lines and this will be the logic basically 13725 04:36:06,789 --> 04:36:06,799 and this will be the logic basically 13726 04:36:06,799 --> 04:36:09,029 and this will be the logic basically and a use case for this type of 13727 04:36:09,029 --> 04:36:09,039 and a use case for this type of 13728 04:36:09,039 --> 04:36:10,470 and a use case for this type of calculation would be 13729 04:36:10,470 --> 04:36:10,480 calculation would be 13730 04:36:10,480 --> 04:36:13,670 calculation would be if we find products that have inventory 13731 04:36:13,670 --> 04:36:13,680 if we find products that have inventory 13732 04:36:13,680 --> 04:36:15,269 if we find products that have inventory which are less than 10 13733 04:36:15,269 --> 04:36:15,279 which are less than 10 13734 04:36:15,279 --> 04:36:17,429 which are less than 10 means we need to reorder them right 13735 04:36:17,429 --> 04:36:17,439 means we need to reorder them right 13736 04:36:17,439 --> 04:36:18,470 means we need to reorder them right because they're going to get out of 13737 04:36:18,470 --> 04:36:18,480 because they're going to get out of 13738 04:36:18,480 --> 04:36:19,590 because they're going to get out of stock soon 13739 04:36:19,590 --> 04:36:19,600 stock soon 13740 04:36:19,600 --> 04:36:23,029 stock soon and now at the end 13741 04:36:23,029 --> 04:36:23,039 and now at the end 13742 04:36:23,039 --> 04:36:25,590 and now at the end let's print the list of all the products 13743 04:36:25,590 --> 04:36:25,600 let's print the list of all the products 13744 04:36:25,600 --> 04:36:26,551 let's print the list of all the products that have 13745 04:36:26,551 --> 04:36:26,561 that have 13746 04:36:26,561 --> 04:36:29,429 that have inventory less than 10. so i'm going to 13747 04:36:29,429 --> 04:36:29,439 inventory less than 10. so i'm going to 13748 04:36:29,439 --> 04:36:30,949 inventory less than 10. so i'm going to execute it 13749 04:36:30,949 --> 04:36:30,959 execute it 13750 04:36:30,959 --> 04:36:34,551 execute it and here we have the product number and 13751 04:36:34,551 --> 04:36:34,561 and here we have the product number and 13752 04:36:34,561 --> 04:36:36,869 and here we have the product number and inventory count so we have three 13753 04:36:36,869 --> 04:36:36,879 inventory count so we have three 13754 04:36:36,879 --> 04:36:38,629 inventory count so we have three products basically 13755 04:36:38,629 --> 04:36:38,639 products basically 13756 04:36:38,639 --> 04:36:41,670 products basically which have inventory less than 10 and 13757 04:36:41,670 --> 04:36:41,680 which have inventory less than 10 and 13758 04:36:41,680 --> 04:36:42,869 which have inventory less than 10 and let's actually 13759 04:36:42,869 --> 04:36:42,879 let's actually 13760 04:36:42,879 --> 04:36:46,789 let's actually check that product number 25 right here 13761 04:36:46,789 --> 04:36:46,799 check that product number 25 right here 13762 04:36:46,799 --> 04:36:50,310 check that product number 25 right here which has inventory of seven and product 13763 04:36:50,310 --> 04:36:50,320 which has inventory of seven and product 13764 04:36:50,320 --> 04:36:51,029 which has inventory of seven and product number 13765 04:36:51,029 --> 04:36:51,039 number 13766 04:36:51,039 --> 04:36:54,310 number 30 inventory of six 13767 04:36:54,310 --> 04:36:54,320 30 inventory of six 13768 04:36:54,320 --> 04:36:56,070 30 inventory of six and the third one as well now you're 13769 04:36:56,070 --> 04:36:56,080 and the third one as well now you're 13770 04:36:56,080 --> 04:36:58,070 and the third one as well now you're probably wondering why we have this dot 13771 04:36:58,070 --> 04:36:58,080 probably wondering why we have this dot 13772 04:36:58,080 --> 04:37:00,629 probably wondering why we have this dot zero here because by default those 13773 04:37:00,629 --> 04:37:00,639 zero here because by default those 13774 04:37:00,639 --> 04:37:03,109 zero here because by default those values are interpreted as 13775 04:37:03,109 --> 04:37:03,119 values are interpreted as 13776 04:37:03,119 --> 04:37:05,910 values are interpreted as float numbers and not integers if we 13777 04:37:05,910 --> 04:37:05,920 float numbers and not integers if we 13778 04:37:05,920 --> 04:37:08,629 float numbers and not integers if we wanted to we can actually fix that 13779 04:37:08,629 --> 04:37:08,639 wanted to we can actually fix that 13780 04:37:08,639 --> 04:37:13,429 wanted to we can actually fix that using the integer function 13781 04:37:13,429 --> 04:37:13,439 using the integer function 13782 04:37:13,439 --> 04:37:16,551 using the integer function in both cases like this 13783 04:37:16,551 --> 04:37:16,561 in both cases like this 13784 04:37:16,561 --> 04:37:19,990 in both cases like this let's execute it again and we have the 13785 04:37:19,990 --> 04:37:20,000 let's execute it again and we have the 13786 04:37:20,000 --> 04:37:24,551 let's execute it again and we have the integers and not floats 13787 04:37:27,510 --> 04:37:27,520 and finally as a last exercise what 13788 04:37:27,520 --> 04:37:29,109 and finally as a last exercise what we're going to do is we're going to 13789 04:37:29,109 --> 04:37:29,119 we're going to do is we're going to 13790 04:37:29,119 --> 04:37:29,750 we're going to do is we're going to actually 13791 04:37:29,750 --> 04:37:29,760 actually 13792 04:37:29,760 --> 04:37:32,789 actually add some value inside that spreadsheet 13793 04:37:32,789 --> 04:37:32,799 add some value inside that spreadsheet 13794 04:37:32,799 --> 04:37:34,869 add some value inside that spreadsheet till now we have been reading the values 13795 04:37:34,869 --> 04:37:34,879 till now we have been reading the values 13796 04:37:34,879 --> 04:37:36,949 till now we have been reading the values and doing some calculations and just 13797 04:37:36,949 --> 04:37:36,959 and doing some calculations and just 13798 04:37:36,959 --> 04:37:37,910 and doing some calculations and just printing the result 13799 04:37:37,910 --> 04:37:37,920 printing the result 13800 04:37:37,920 --> 04:37:40,551 printing the result on the terminal as the last exercise 13801 04:37:40,551 --> 04:37:40,561 on the terminal as the last exercise 13802 04:37:40,561 --> 04:37:41,990 on the terminal as the last exercise we're actually going to create a new 13803 04:37:41,990 --> 04:37:42,000 we're actually going to create a new 13804 04:37:42,000 --> 04:37:44,949 we're actually going to create a new column here for every row and we're 13805 04:37:44,949 --> 04:37:44,959 column here for every row and we're 13806 04:37:44,959 --> 04:37:45,510 column here for every row and we're going to 13807 04:37:45,510 --> 04:37:45,520 going to 13808 04:37:45,520 --> 04:37:48,470 going to calculate basically the total price of 13809 04:37:48,470 --> 04:37:48,480 calculate basically the total price of 13810 04:37:48,480 --> 04:37:49,189 calculate basically the total price of inventory 13811 04:37:49,189 --> 04:37:49,199 inventory 13812 04:37:49,199 --> 04:37:51,349 inventory right the number of units times the 13813 04:37:51,349 --> 04:37:51,359 right the number of units times the 13814 04:37:51,359 --> 04:37:53,189 right the number of units times the price and we're going to 13815 04:37:53,189 --> 04:37:53,199 price and we're going to 13816 04:37:53,199 --> 04:37:56,629 price and we're going to basically set the value for each product 13817 04:37:56,629 --> 04:37:56,639 basically set the value for each product 13818 04:37:56,639 --> 04:38:00,070 basically set the value for each product inventory multiplied by price so 13819 04:38:00,070 --> 04:38:00,080 inventory multiplied by price so 13820 04:38:00,080 --> 04:38:03,269 inventory multiplied by price so how do we add a column or how do we make 13821 04:38:03,269 --> 04:38:03,279 how do we add a column or how do we make 13822 04:38:03,279 --> 04:38:04,230 how do we add a column or how do we make changes 13823 04:38:04,230 --> 04:38:04,240 changes 13824 04:38:04,240 --> 04:38:07,269 changes to a file it's actually pretty easy 13825 04:38:07,269 --> 04:38:07,279 to a file it's actually pretty easy 13826 04:38:07,279 --> 04:38:09,349 to a file it's actually pretty easy the same way as we were grabbing the 13827 04:38:09,349 --> 04:38:09,359 the same way as we were grabbing the 13828 04:38:09,359 --> 04:38:10,310 the same way as we were grabbing the value from this 13829 04:38:10,310 --> 04:38:10,320 value from this 13830 04:38:10,320 --> 04:38:12,949 value from this file and basically reading the values we 13831 04:38:12,949 --> 04:38:12,959 file and basically reading the values we 13832 04:38:12,959 --> 04:38:13,590 file and basically reading the values we can 13833 04:38:13,590 --> 04:38:13,600 can 13834 04:38:13,600 --> 04:38:15,910 can add values to it and add columns and 13835 04:38:15,910 --> 04:38:15,920 add values to it and add columns and 13836 04:38:15,920 --> 04:38:17,029 add values to it and add columns and rows etc 13837 04:38:17,029 --> 04:38:17,039 rows etc 13838 04:38:17,039 --> 04:38:20,310 rows etc so to add a fifth column 13839 04:38:20,310 --> 04:38:20,320 so to add a fifth column 13840 04:38:20,320 --> 04:38:25,510 so to add a fifth column we're gonna do product list cell 13841 04:38:25,510 --> 04:38:25,520 we're gonna do product list cell 13842 04:38:25,520 --> 04:38:27,189 we're gonna do product list cell product row this is going to be the 13843 04:38:27,189 --> 04:38:27,199 product row this is going to be the 13844 04:38:27,199 --> 04:38:28,789 product row this is going to be the number of the row and 13845 04:38:28,789 --> 04:38:28,799 number of the row and 13846 04:38:28,799 --> 04:38:31,349 number of the row and a column number so the same way we 13847 04:38:31,349 --> 04:38:31,359 a column number so the same way we 13848 04:38:31,359 --> 04:38:32,070 a column number so the same way we accessed 13849 04:38:32,070 --> 04:38:32,080 accessed 13850 04:38:32,080 --> 04:38:35,349 accessed the cells for all other values we can 13851 04:38:35,349 --> 04:38:35,359 the cells for all other values we can 13852 04:38:35,359 --> 04:38:36,070 the cells for all other values we can basically 13853 04:38:36,070 --> 04:38:36,080 basically 13854 04:38:36,080 --> 04:38:39,910 basically access the cell on column five 13855 04:38:39,910 --> 04:38:39,920 access the cell on column five 13856 04:38:39,920 --> 04:38:43,109 access the cell on column five which has an empty value right so 13857 04:38:43,109 --> 04:38:43,119 which has an empty value right so 13858 04:38:43,119 --> 04:38:45,029 which has an empty value right so we're not actually creating a new column 13859 04:38:45,029 --> 04:38:45,039 we're not actually creating a new column 13860 04:38:45,039 --> 04:38:46,789 we're not actually creating a new column we're just grabbing 13861 04:38:46,789 --> 04:38:46,799 we're just grabbing 13862 04:38:46,799 --> 04:38:50,070 we're just grabbing a value of a column five which happens 13863 04:38:50,070 --> 04:38:50,080 a value of a column five which happens 13864 04:38:50,080 --> 04:38:50,551 a value of a column five which happens to be 13865 04:38:50,551 --> 04:38:50,561 to be 13866 04:38:50,561 --> 04:38:52,949 to be empty and we are overriding that value 13867 04:38:52,949 --> 04:38:52,959 empty and we are overriding that value 13868 04:38:52,959 --> 04:38:53,590 empty and we are overriding that value and we could 13869 04:38:53,590 --> 04:38:53,600 and we could 13870 04:38:53,600 --> 04:38:55,990 and we could do the same actually for any other 13871 04:38:55,990 --> 04:38:56,000 do the same actually for any other 13872 04:38:56,000 --> 04:38:57,590 do the same actually for any other columns here right we can overwrite all 13873 04:38:57,590 --> 04:38:57,600 columns here right we can overwrite all 13874 04:38:57,600 --> 04:38:58,470 columns here right we can overwrite all these values 13875 04:38:58,470 --> 04:38:58,480 these values 13876 04:38:58,480 --> 04:39:00,551 these values if we wanted to so that's basically what 13877 04:39:00,551 --> 04:39:00,561 if we wanted to so that's basically what 13878 04:39:00,561 --> 04:39:01,830 if we wanted to so that's basically what we're doing 13879 04:39:01,830 --> 04:39:01,840 we're doing 13880 04:39:01,840 --> 04:39:04,551 we're doing so we're grabbing that cell and we can 13881 04:39:04,551 --> 04:39:04,561 so we're grabbing that cell and we can 13882 04:39:04,561 --> 04:39:06,470 so we're grabbing that cell and we can now save it into a variable 13883 04:39:06,470 --> 04:39:06,480 now save it into a variable 13884 04:39:06,480 --> 04:39:10,551 now save it into a variable let's actually call it inventory 13885 04:39:14,150 --> 04:39:14,160 price so now that cell 13886 04:39:14,160 --> 04:39:16,789 price so now that cell is saved into that variable so we can 13887 04:39:16,789 --> 04:39:16,799 is saved into that variable so we can 13888 04:39:16,799 --> 04:39:17,910 is saved into that variable so we can reference it 13889 04:39:17,910 --> 04:39:17,920 reference it 13890 04:39:17,920 --> 04:39:20,150 reference it and note here that i didn't add dot 13891 04:39:20,150 --> 04:39:20,160 and note here that i didn't add dot 13892 04:39:20,160 --> 04:39:21,830 and note here that i didn't add dot value at the end 13893 04:39:21,830 --> 04:39:21,840 value at the end 13894 04:39:21,840 --> 04:39:24,869 value at the end because if we want to update the cell 13895 04:39:24,869 --> 04:39:24,879 because if we want to update the cell 13896 04:39:24,879 --> 04:39:27,269 because if we want to update the cell we need the whole cell object right so 13897 04:39:27,269 --> 04:39:27,279 we need the whole cell object right so 13898 04:39:27,279 --> 04:39:27,990 we need the whole cell object right so that we can 13899 04:39:27,990 --> 04:39:28,000 that we can 13900 04:39:28,000 --> 04:39:30,629 that we can actually set a value on that so how do 13901 04:39:30,629 --> 04:39:30,639 actually set a value on that so how do 13902 04:39:30,639 --> 04:39:31,910 actually set a value on that so how do we set a value 13903 04:39:31,910 --> 04:39:31,920 we set a value 13904 04:39:31,920 --> 04:39:34,709 we set a value for that specific cell so again note 13905 04:39:34,709 --> 04:39:34,719 for that specific cell so again note 13906 04:39:34,719 --> 04:39:35,349 for that specific cell so again note that this is 13907 04:39:35,349 --> 04:39:35,359 that this is 13908 04:39:35,359 --> 04:39:38,948 that this is iteration so for each product row 13909 04:39:38,948 --> 04:39:38,958 iteration so for each product row 13910 04:39:38,958 --> 04:39:42,070 iteration so for each product row the value will be set so how do we set 13911 04:39:42,070 --> 04:39:42,080 the value will be set so how do we set 13912 04:39:42,080 --> 04:39:44,708 the value will be set so how do we set the cell value i'm just going to grab 13913 04:39:44,708 --> 04:39:44,718 the cell value i'm just going to grab 13914 04:39:44,718 --> 04:39:45,190 the cell value i'm just going to grab this 13915 04:39:45,190 --> 04:39:45,200 this 13916 04:39:45,200 --> 04:39:47,670 this variable here inventory price which is 13917 04:39:47,670 --> 04:39:47,680 variable here inventory price which is 13918 04:39:47,680 --> 04:39:49,190 variable here inventory price which is representing the cell 13919 04:39:49,190 --> 04:39:49,200 representing the cell 13920 04:39:49,200 --> 04:39:52,230 representing the cell in column five for each iteration 13921 04:39:52,230 --> 04:39:52,240 in column five for each iteration 13922 04:39:52,240 --> 04:39:53,990 in column five for each iteration and right here at the end because this 13923 04:39:53,990 --> 04:39:54,000 and right here at the end because this 13924 04:39:54,000 --> 04:39:55,830 and right here at the end because this is our last exercise 13925 04:39:55,830 --> 04:39:55,840 is our last exercise 13926 04:39:55,840 --> 04:39:59,430 is our last exercise let's write this is a logic 13927 04:39:59,430 --> 04:39:59,440 let's write this is a logic 13928 04:39:59,440 --> 04:40:02,948 let's write this is a logic or basically add value for 13929 04:40:02,948 --> 04:40:02,958 or basically add value for 13930 04:40:02,958 --> 04:40:06,868 or basically add value for total inventory price 13931 04:40:06,868 --> 04:40:06,878 total inventory price 13932 04:40:06,878 --> 04:40:10,628 total inventory price and the way we set the value in a cell 13933 04:40:10,628 --> 04:40:10,638 and the way we set the value in a cell 13934 04:40:10,638 --> 04:40:13,910 and the way we set the value in a cell is dot value equals 13935 04:40:13,910 --> 04:40:13,920 is dot value equals 13936 04:40:13,920 --> 04:40:16,868 is dot value equals and the calculation for that is actually 13937 04:40:16,868 --> 04:40:16,878 and the calculation for that is actually 13938 04:40:16,878 --> 04:40:18,788 and the calculation for that is actually very easy we already did it here 13939 04:40:18,788 --> 04:40:18,798 very easy we already did it here 13940 04:40:18,798 --> 04:40:21,670 very easy we already did it here inventory times the price for that 13941 04:40:21,670 --> 04:40:21,680 inventory times the price for that 13942 04:40:21,680 --> 04:40:23,030 inventory times the price for that specific product 13943 04:40:23,030 --> 04:40:23,040 specific product 13944 04:40:23,040 --> 04:40:25,430 specific product and that's it so we're using that dot 13945 04:40:25,430 --> 04:40:25,440 and that's it so we're using that dot 13946 04:40:25,440 --> 04:40:26,310 and that's it so we're using that dot value here 13947 04:40:26,310 --> 04:40:26,320 value here 13948 04:40:26,320 --> 04:40:28,390 value here in order to set the value instead of 13949 04:40:28,390 --> 04:40:28,400 in order to set the value instead of 13950 04:40:28,400 --> 04:40:29,750 in order to set the value instead of grabbing the value 13951 04:40:29,750 --> 04:40:29,760 grabbing the value 13952 04:40:29,760 --> 04:40:33,030 grabbing the value and that will actually update and 13953 04:40:33,030 --> 04:40:33,040 and that will actually update and 13954 04:40:33,040 --> 04:40:36,150 and that will actually update and add this calculation a result of the 13955 04:40:36,150 --> 04:40:36,160 add this calculation a result of the 13956 04:40:36,160 --> 04:40:37,350 add this calculation a result of the calculation 13957 04:40:37,350 --> 04:40:37,360 calculation 13958 04:40:37,360 --> 04:40:40,470 calculation on each line on this column but note 13959 04:40:40,470 --> 04:40:40,480 on each line on this column but note 13960 04:40:40,480 --> 04:40:41,830 on each line on this column but note that this will only 13961 04:40:41,830 --> 04:40:41,840 that this will only 13962 04:40:41,840 --> 04:40:44,628 that this will only change the value in a temporary file but 13963 04:40:44,628 --> 04:40:44,638 change the value in a temporary file but 13964 04:40:44,638 --> 04:40:45,750 change the value in a temporary file but it's not going to save 13965 04:40:45,750 --> 04:40:45,760 it's not going to save 13966 04:40:45,760 --> 04:40:48,470 it's not going to save anything right so what we want to do at 13967 04:40:48,470 --> 04:40:48,480 anything right so what we want to do at 13968 04:40:48,480 --> 04:40:49,670 anything right so what we want to do at the end 13969 04:40:49,670 --> 04:40:49,680 the end 13970 04:40:49,680 --> 04:40:52,550 the end if we want this change to persist to 13971 04:40:52,550 --> 04:40:52,560 if we want this change to persist to 13972 04:40:52,560 --> 04:40:53,510 if we want this change to persist to actually be 13973 04:40:53,510 --> 04:40:53,520 actually be 13974 04:40:53,520 --> 04:40:56,390 actually be saved we want to explicitly save the 13975 04:40:56,390 --> 04:40:56,400 saved we want to explicitly save the 13976 04:40:56,400 --> 04:40:56,948 saved we want to explicitly save the file 13977 04:40:56,948 --> 04:40:56,958 file 13978 04:40:56,958 --> 04:40:59,910 file so for example if i manually did 13979 04:40:59,910 --> 04:40:59,920 so for example if i manually did 13980 04:40:59,920 --> 04:41:01,750 so for example if i manually did something here added some value 13981 04:41:01,750 --> 04:41:01,760 something here added some value 13982 04:41:01,760 --> 04:41:03,510 something here added some value i would need to save it here as well 13983 04:41:03,510 --> 04:41:03,520 i would need to save it here as well 13984 04:41:03,520 --> 04:41:05,350 i would need to save it here as well right so that's exactly what we need to 13985 04:41:05,350 --> 04:41:05,360 right so that's exactly what we need to 13986 04:41:05,360 --> 04:41:05,670 right so that's exactly what we need to do 13987 04:41:05,670 --> 04:41:05,680 do 13988 04:41:05,680 --> 04:41:09,030 do here but programmatically using python 13989 04:41:09,030 --> 04:41:09,040 here but programmatically using python 13990 04:41:09,040 --> 04:41:11,670 here but programmatically using python so how do we save a file using python 13991 04:41:11,670 --> 04:41:11,680 so how do we save a file using python 13992 04:41:11,680 --> 04:41:12,390 so how do we save a file using python again 13993 04:41:12,390 --> 04:41:12,400 again 13994 04:41:12,400 --> 04:41:15,350 again this package or this module that we use 13995 04:41:15,350 --> 04:41:15,360 this package or this module that we use 13996 04:41:15,360 --> 04:41:16,070 this package or this module that we use here 13997 04:41:16,070 --> 04:41:16,080 here 13998 04:41:16,080 --> 04:41:19,030 here also gives us a function that we can use 13999 04:41:19,030 --> 04:41:19,040 also gives us a function that we can use 14000 04:41:19,040 --> 04:41:20,550 also gives us a function that we can use to save the file 14001 04:41:20,550 --> 04:41:20,560 to save the file 14002 04:41:20,560 --> 04:41:22,868 to save the file and since we're doing an operation on a 14003 04:41:22,868 --> 04:41:22,878 and since we're doing an operation on a 14004 04:41:22,878 --> 04:41:24,390 and since we're doing an operation on a file and not a sheet here 14005 04:41:24,390 --> 04:41:24,400 file and not a sheet here 14006 04:41:24,400 --> 04:41:26,470 file and not a sheet here we're going to grab that variable in 14007 04:41:26,470 --> 04:41:26,480 we're going to grab that variable in 14008 04:41:26,480 --> 04:41:27,830 we're going to grab that variable in file 14009 04:41:27,830 --> 04:41:27,840 file 14010 04:41:27,840 --> 04:41:31,190 file and here at the end we're going to call 14011 04:41:31,190 --> 04:41:31,200 and here at the end we're going to call 14012 04:41:31,200 --> 04:41:34,070 and here at the end we're going to call a save function on it and this will save 14013 04:41:34,070 --> 04:41:34,080 a save function on it and this will save 14014 04:41:34,080 --> 04:41:35,670 a save function on it and this will save the file changes 14015 04:41:35,670 --> 04:41:35,680 the file changes 14016 04:41:35,680 --> 04:41:37,910 the file changes however we're not overriding the same 14017 04:41:37,910 --> 04:41:37,920 however we're not overriding the same 14018 04:41:37,920 --> 04:41:40,390 however we're not overriding the same file the existing inventory file 14019 04:41:40,390 --> 04:41:40,400 file the existing inventory file 14020 04:41:40,400 --> 04:41:42,628 file the existing inventory file we're creating a new one and because of 14021 04:41:42,628 --> 04:41:42,638 we're creating a new one and because of 14022 04:41:42,638 --> 04:41:43,990 we're creating a new one and because of that we need to provide 14023 04:41:43,990 --> 04:41:44,000 that we need to provide 14024 04:41:44,000 --> 04:41:46,550 that we need to provide a name of the new file that is going to 14025 04:41:46,550 --> 04:41:46,560 a name of the new file that is going to 14026 04:41:46,560 --> 04:41:47,830 a name of the new file that is going to be created 14027 04:41:47,830 --> 04:41:47,840 be created 14028 04:41:47,840 --> 04:41:50,948 be created with the save function and we're going 14029 04:41:50,948 --> 04:41:50,958 with the save function and we're going 14030 04:41:50,958 --> 04:41:52,390 with the save function and we're going to call that 14031 04:41:52,390 --> 04:41:52,400 to call that 14032 04:41:52,400 --> 04:41:56,708 to call that file let's say inventory 14033 04:42:00,390 --> 04:42:00,400 with total value 14034 04:42:00,400 --> 04:42:04,708 with total value and extension 14035 04:42:07,750 --> 04:42:07,760 the same extension as we have here so 14036 04:42:07,760 --> 04:42:10,788 the same extension as we have here so this line will now save the changes and 14037 04:42:10,788 --> 04:42:10,798 this line will now save the changes and 14038 04:42:10,798 --> 04:42:12,550 this line will now save the changes and create a new file 14039 04:42:12,550 --> 04:42:12,560 create a new file 14040 04:42:12,560 --> 04:42:15,750 create a new file from the original one which has these 14041 04:42:15,750 --> 04:42:15,760 from the original one which has these 14042 04:42:15,760 --> 04:42:17,830 from the original one which has these values generated basically 14043 04:42:17,830 --> 04:42:17,840 values generated basically 14044 04:42:17,840 --> 04:42:20,550 values generated basically so now that we are done with the fourth 14045 04:42:20,550 --> 04:42:20,560 so now that we are done with the fourth 14046 04:42:20,560 --> 04:42:22,470 so now that we are done with the fourth exercise let's actually print out 14047 04:42:22,470 --> 04:42:22,480 exercise let's actually print out 14048 04:42:22,480 --> 04:42:29,990 exercise let's actually print out everything 14049 04:42:33,110 --> 04:42:33,120 that we've done so far i'm gonna take 14050 04:42:33,120 --> 04:42:50,868 that we've done so far i'm gonna take all those values 14051 04:42:53,350 --> 04:42:53,360 so this is going to be execution of all 14052 04:42:53,360 --> 04:42:54,550 so this is going to be execution of all our logic 14053 04:42:54,550 --> 04:42:54,560 our logic 14054 04:42:54,560 --> 04:42:56,310 our logic printing these three dictionaries here 14055 04:42:56,310 --> 04:42:56,320 printing these three dictionaries here 14056 04:42:56,320 --> 04:42:58,390 printing these three dictionaries here and then updating 14057 04:42:58,390 --> 04:42:58,400 and then updating 14058 04:42:58,400 --> 04:43:00,788 and then updating the spreadsheet file and saving it into 14059 04:43:00,788 --> 04:43:00,798 the spreadsheet file and saving it into 14060 04:43:00,798 --> 04:43:01,990 the spreadsheet file and saving it into a new file 14061 04:43:01,990 --> 04:43:02,000 a new file 14062 04:43:02,000 --> 04:43:05,510 a new file so with this let's actually execute our 14063 04:43:05,510 --> 04:43:05,520 so with this let's actually execute our 14064 04:43:05,520 --> 04:43:08,948 so with this let's actually execute our program and see what happened 14065 04:43:08,948 --> 04:43:08,958 program and see what happened 14066 04:43:08,958 --> 04:43:10,550 program and see what happened first of all we have all those three 14067 04:43:10,550 --> 04:43:10,560 first of all we have all those three 14068 04:43:10,560 --> 04:43:12,470 first of all we have all those three dictionaries listed here 14069 04:43:12,470 --> 04:43:12,480 dictionaries listed here 14070 04:43:12,480 --> 04:43:15,830 dictionaries listed here or printed here with the values 14071 04:43:15,830 --> 04:43:15,840 or printed here with the values 14072 04:43:15,840 --> 04:43:19,190 or printed here with the values and if we pull this aside 14073 04:43:19,190 --> 04:43:19,200 and if we pull this aside 14074 04:43:19,200 --> 04:43:21,750 and if we pull this aside here you see a new file got generated 14075 04:43:21,750 --> 04:43:21,760 here you see a new file got generated 14076 04:43:21,760 --> 04:43:22,470 here you see a new file got generated with the name 14077 04:43:22,470 --> 04:43:22,480 with the name 14078 04:43:22,480 --> 04:43:25,110 with the name inventory with total value and if we 14079 04:43:25,110 --> 04:43:25,120 inventory with total value and if we 14080 04:43:25,120 --> 04:43:26,230 inventory with total value and if we open this file 14081 04:43:26,230 --> 04:43:26,240 open this file 14082 04:43:26,240 --> 04:43:30,150 open this file we should see that for each row a new 14083 04:43:30,150 --> 04:43:30,160 we should see that for each row a new 14084 04:43:30,160 --> 04:43:32,550 we should see that for each row a new column was generated and filled with 14085 04:43:32,550 --> 04:43:32,560 column was generated and filled with 14086 04:43:32,560 --> 04:43:33,350 column was generated and filled with values 14087 04:43:33,350 --> 04:43:33,360 values 14088 04:43:33,360 --> 04:43:35,830 values which is calculated for each product's 14089 04:43:35,830 --> 04:43:35,840 which is calculated for each product's 14090 04:43:35,840 --> 04:43:38,550 which is calculated for each product's inventory and price 14091 04:43:38,550 --> 04:43:38,560 inventory and price 14092 04:43:38,560 --> 04:43:41,270 inventory and price so that's basically our project that's 14093 04:43:41,270 --> 04:43:41,280 so that's basically our project that's 14094 04:43:41,280 --> 04:43:42,550 so that's basically our project that's how you work with 14095 04:43:42,550 --> 04:43:42,560 how you work with 14096 04:43:42,560 --> 04:43:45,430 how you work with files in python specifically with 14097 04:43:45,430 --> 04:43:45,440 files in python specifically with 14098 04:43:45,440 --> 04:43:46,070 files in python specifically with spreadsheet 14099 04:43:46,070 --> 04:43:46,080 spreadsheet 14100 04:43:46,080 --> 04:43:48,230 spreadsheet files and as i said at the beginning 14101 04:43:48,230 --> 04:43:48,240 files and as i said at the beginning 14102 04:43:48,240 --> 04:43:50,628 files and as i said at the beginning this could be actually very useful 14103 04:43:50,628 --> 04:43:50,638 this could be actually very useful 14104 04:43:50,638 --> 04:43:53,030 this could be actually very useful automation logic when you're working at 14105 04:43:53,030 --> 04:43:53,040 automation logic when you're working at 14106 04:43:53,040 --> 04:43:54,948 automation logic when you're working at a company where there are lots of 14107 04:43:54,948 --> 04:43:54,958 a company where there are lots of 14108 04:43:54,958 --> 04:43:57,350 a company where there are lots of excel files or spreadsheet files that 14109 04:43:57,350 --> 04:43:57,360 excel files or spreadsheet files that 14110 04:43:57,360 --> 04:43:59,350 excel files or spreadsheet files that employees have to work with 14111 04:43:59,350 --> 04:43:59,360 employees have to work with 14112 04:43:59,360 --> 04:44:05,190 employees have to work with and manually update stuff inside 14113 04:44:06,868 --> 04:44:06,878 in this part we're going to learn the 14114 04:44:06,878 --> 04:44:09,030 in this part we're going to learn the concept of objects and 14115 04:44:09,030 --> 04:44:09,040 concept of objects and 14116 04:44:09,040 --> 04:44:12,230 concept of objects and classes in python and generally object 14117 04:44:12,230 --> 04:44:12,240 classes in python and generally object 14118 04:44:12,240 --> 04:44:13,830 classes in python and generally object oriented 14119 04:44:13,830 --> 04:44:13,840 oriented 14120 04:44:13,840 --> 04:44:16,070 oriented let's consider an example of an 14121 04:44:16,070 --> 04:44:16,080 let's consider an example of an 14122 04:44:16,080 --> 04:44:17,350 let's consider an example of an application with 14123 04:44:17,350 --> 04:44:17,360 application with 14124 04:44:17,360 --> 04:44:19,830 application with lots of users for example linkedin right 14125 04:44:19,830 --> 04:44:19,840 lots of users for example linkedin right 14126 04:44:19,840 --> 04:44:20,628 lots of users for example linkedin right we have 14127 04:44:20,628 --> 04:44:20,638 we have 14128 04:44:20,638 --> 04:44:23,510 we have users and each user will have some 14129 04:44:23,510 --> 04:44:23,520 users and each user will have some 14130 04:44:23,520 --> 04:44:25,430 users and each user will have some information for example 14131 04:44:25,430 --> 04:44:25,440 information for example 14132 04:44:25,440 --> 04:44:31,910 information for example email address 14133 04:44:42,550 --> 04:44:42,560 password 14134 04:44:42,560 --> 04:44:56,948 password maybe a current job title 14135 04:44:56,948 --> 04:44:56,958 maybe a current job title 14136 04:44:56,958 --> 04:45:00,230 maybe a current job title work experience a set of skills and so 14137 04:45:00,230 --> 04:45:00,240 work experience a set of skills and so 14138 04:45:00,240 --> 04:45:00,948 work experience a set of skills and so on 14139 04:45:00,948 --> 04:45:00,958 on 14140 04:45:00,958 --> 04:45:03,350 on right so each user will have all this 14141 04:45:03,350 --> 04:45:03,360 right so each user will have all this 14142 04:45:03,360 --> 04:45:04,310 right so each user will have all this information but 14143 04:45:04,310 --> 04:45:04,320 information but 14144 04:45:04,320 --> 04:45:06,948 information but obviously the actual values the actual 14145 04:45:06,948 --> 04:45:06,958 obviously the actual values the actual 14146 04:45:06,958 --> 04:45:09,030 obviously the actual values the actual information will be different 14147 04:45:09,030 --> 04:45:09,040 information will be different 14148 04:45:09,040 --> 04:45:12,070 information will be different for each user in addition to that users 14149 04:45:12,070 --> 04:45:12,080 for each user in addition to that users 14150 04:45:12,080 --> 04:45:14,150 for each user in addition to that users are able to do something with their own 14151 04:45:14,150 --> 04:45:14,160 are able to do something with their own 14152 04:45:14,160 --> 04:45:15,110 are able to do something with their own information right 14153 04:45:15,110 --> 04:45:15,120 information right 14154 04:45:15,120 --> 04:45:17,590 information right so for example a user can change their 14155 04:45:17,590 --> 04:45:17,600 so for example a user can change their 14156 04:45:17,600 --> 04:45:22,708 so for example a user can change their password 14157 04:45:25,670 --> 04:45:25,680 change their current job title add a new 14158 04:45:25,680 --> 04:45:34,868 change their current job title add a new skill 14159 04:45:37,510 --> 04:45:37,520 and again basically do stuff with their 14160 04:45:37,520 --> 04:45:38,230 and again basically do stuff with their own 14161 04:45:38,230 --> 04:45:38,240 own 14162 04:45:38,240 --> 04:45:40,948 own personal information and our program 14163 04:45:40,948 --> 04:45:40,958 personal information and our program 14164 04:45:40,958 --> 04:45:41,350 personal information and our program will be 14165 04:45:41,350 --> 04:45:41,360 will be 14166 04:45:41,360 --> 04:45:43,990 will be able to handle this user information 14167 04:45:43,990 --> 04:45:44,000 able to handle this user information 14168 04:45:44,000 --> 04:45:44,390 able to handle this user information plus 14169 04:45:44,390 --> 04:45:44,400 plus 14170 04:45:44,400 --> 04:45:47,350 plus user changing their information right so 14171 04:45:47,350 --> 04:45:47,360 user changing their information right so 14172 04:45:47,360 --> 04:45:48,310 user changing their information right so this will be 14173 04:45:48,310 --> 04:45:48,320 this will be 14174 04:45:48,320 --> 04:45:52,070 this will be user data and in order to do something 14175 04:45:52,070 --> 04:45:52,080 user data and in order to do something 14176 04:45:52,080 --> 04:45:54,628 user data and in order to do something so to perform some action we would have 14177 04:45:54,628 --> 04:45:54,638 so to perform some action we would have 14178 04:45:54,638 --> 04:45:56,070 so to perform some action we would have functions for that right 14179 04:45:56,070 --> 04:45:56,080 functions for that right 14180 04:45:56,080 --> 04:45:59,510 functions for that right so all of these will actually be 14181 04:45:59,510 --> 04:45:59,520 so all of these will actually be 14182 04:45:59,520 --> 04:46:03,270 so all of these will actually be functions however as i mentioned 14183 04:46:03,270 --> 04:46:03,280 functions however as i mentioned 14184 04:46:03,280 --> 04:46:05,510 functions however as i mentioned every user will have their own data and 14185 04:46:05,510 --> 04:46:05,520 every user will have their own data and 14186 04:46:05,520 --> 04:46:08,070 every user will have their own data and whenever a new user basically registers 14187 04:46:08,070 --> 04:46:08,080 whenever a new user basically registers 14188 04:46:08,080 --> 04:46:09,670 whenever a new user basically registers for an application 14189 04:46:09,670 --> 04:46:09,680 for an application 14190 04:46:09,680 --> 04:46:11,590 for an application all these data should be gathered for 14191 04:46:11,590 --> 04:46:11,600 all these data should be gathered for 14192 04:46:11,600 --> 04:46:13,030 all these data should be gathered for that new user 14193 04:46:13,030 --> 04:46:13,040 that new user 14194 04:46:13,040 --> 04:46:15,750 that new user and saved in the application so 14195 04:46:15,750 --> 04:46:15,760 and saved in the application so 14196 04:46:15,760 --> 04:46:17,270 and saved in the application so basically that means that 14197 04:46:17,270 --> 04:46:17,280 basically that means that 14198 04:46:17,280 --> 04:46:20,230 basically that means that in our program we need some way to 14199 04:46:20,230 --> 04:46:20,240 in our program we need some way to 14200 04:46:20,240 --> 04:46:20,868 in our program we need some way to define 14201 04:46:20,868 --> 04:46:20,878 define 14202 04:46:20,878 --> 04:46:23,910 define kind of a blueprint for a user for all 14203 04:46:23,910 --> 04:46:23,920 kind of a blueprint for a user for all 14204 04:46:23,920 --> 04:46:24,708 kind of a blueprint for a user for all the data 14205 04:46:24,708 --> 04:46:24,718 the data 14206 04:46:24,718 --> 04:46:28,788 the data user information and user behavior right 14207 04:46:28,788 --> 04:46:28,798 user information and user behavior right 14208 04:46:28,798 --> 04:46:30,868 user information and user behavior right things that the user can do in the 14209 04:46:30,868 --> 04:46:30,878 things that the user can do in the 14210 04:46:30,878 --> 04:46:31,830 things that the user can do in the application 14211 04:46:31,830 --> 04:46:31,840 application 14212 04:46:31,840 --> 04:46:33,910 application because if we have thousand users in our 14213 04:46:33,910 --> 04:46:33,920 because if we have thousand users in our 14214 04:46:33,920 --> 04:46:35,750 because if we have thousand users in our application obviously we can't 14215 04:46:35,750 --> 04:46:35,760 application obviously we can't 14216 04:46:35,760 --> 04:46:39,750 application obviously we can't write the same logic and same variables 14217 04:46:39,750 --> 04:46:39,760 write the same logic and same variables 14218 04:46:39,760 --> 04:46:41,750 write the same logic and same variables thousand times right we want to have a 14219 04:46:41,750 --> 04:46:41,760 thousand times right we want to have a 14220 04:46:41,760 --> 04:46:43,190 thousand times right we want to have a blueprint once 14221 04:46:43,190 --> 04:46:43,200 blueprint once 14222 04:46:43,200 --> 04:46:45,030 blueprint once and then we can use the blueprint for 14223 04:46:45,030 --> 04:46:45,040 and then we can use the blueprint for 14224 04:46:45,040 --> 04:46:47,270 and then we can use the blueprint for all those thousand users 14225 04:46:47,270 --> 04:46:47,280 all those thousand users 14226 04:46:47,280 --> 04:46:50,390 all those thousand users and that blueprint for a user is called 14227 04:46:50,390 --> 04:46:50,400 and that blueprint for a user is called 14228 04:46:50,400 --> 04:46:51,590 and that blueprint for a user is called a class 14229 04:46:51,590 --> 04:46:51,600 a class 14230 04:46:51,600 --> 04:46:54,550 a class and the specific implementation of that 14231 04:46:54,550 --> 04:46:54,560 and the specific implementation of that 14232 04:46:54,560 --> 04:46:55,510 and the specific implementation of that blueprint 14233 04:46:55,510 --> 04:46:55,520 blueprint 14234 04:46:55,520 --> 04:46:58,550 blueprint is called an object so think of this 14235 04:46:58,550 --> 04:46:58,560 is called an object so think of this 14236 04:46:58,560 --> 04:47:01,590 is called an object so think of this like a blueprint of a building right you 14237 04:47:01,590 --> 04:47:01,600 like a blueprint of a building right you 14238 04:47:01,600 --> 04:47:02,948 like a blueprint of a building right you can have a blueprint 14239 04:47:02,948 --> 04:47:02,958 can have a blueprint 14240 04:47:02,958 --> 04:47:05,590 can have a blueprint once which is like a general description 14241 04:47:05,590 --> 04:47:05,600 once which is like a general description 14242 04:47:05,600 --> 04:47:05,990 once which is like a general description of 14243 04:47:05,990 --> 04:47:06,000 of 14244 04:47:06,000 --> 04:47:08,470 of building with doors and windows and 14245 04:47:08,470 --> 04:47:08,480 building with doors and windows and 14246 04:47:08,480 --> 04:47:09,750 building with doors and windows and everything that 14247 04:47:09,750 --> 04:47:09,760 everything that 14248 04:47:09,760 --> 04:47:12,230 everything that every single building has and then the 14249 04:47:12,230 --> 04:47:12,240 every single building has and then the 14250 04:47:12,240 --> 04:47:13,910 every single building has and then the specific implementation 14251 04:47:13,910 --> 04:47:13,920 specific implementation 14252 04:47:13,920 --> 04:47:16,150 specific implementation of that blueprint will be the actual 14253 04:47:16,150 --> 04:47:16,160 of that blueprint will be the actual 14254 04:47:16,160 --> 04:47:18,150 of that blueprint will be the actual built ready buildings right 14255 04:47:18,150 --> 04:47:18,160 built ready buildings right 14256 04:47:18,160 --> 04:47:20,070 built ready buildings right so that's the same concept we're going 14257 04:47:20,070 --> 04:47:20,080 so that's the same concept we're going 14258 04:47:20,080 --> 04:47:21,750 so that's the same concept we're going to create a class 14259 04:47:21,750 --> 04:47:21,760 to create a class 14260 04:47:21,760 --> 04:47:24,628 to create a class blueprint for a user and the user class 14261 04:47:24,628 --> 04:47:24,638 blueprint for a user and the user class 14262 04:47:24,638 --> 04:47:26,390 blueprint for a user and the user class blueprint will define 14263 04:47:26,390 --> 04:47:26,400 blueprint will define 14264 04:47:26,400 --> 04:47:29,510 blueprint will define what information a user has 14265 04:47:29,510 --> 04:47:29,520 what information a user has 14266 04:47:29,520 --> 04:47:32,390 what information a user has and what actions user can perform in the 14267 04:47:32,390 --> 04:47:32,400 and what actions user can perform in the 14268 04:47:32,400 --> 04:47:33,430 and what actions user can perform in the application 14269 04:47:33,430 --> 04:47:33,440 application 14270 04:47:33,440 --> 04:47:35,910 application and object then will contain the actual 14271 04:47:35,910 --> 04:47:35,920 and object then will contain the actual 14272 04:47:35,920 --> 04:47:36,948 and object then will contain the actual information 14273 04:47:36,948 --> 04:47:36,958 information 14274 04:47:36,958 --> 04:47:40,150 information like this information right here 14275 04:47:40,150 --> 04:47:40,160 like this information right here 14276 04:47:40,160 --> 04:47:43,350 like this information right here for each specific user so let's clean 14277 04:47:43,350 --> 04:47:43,360 for each specific user so let's clean 14278 04:47:43,360 --> 04:47:44,230 for each specific user so let's clean all these up 14279 04:47:44,230 --> 04:47:44,240 all these up 14280 04:47:44,240 --> 04:47:47,270 all these up and let's now actually create class 14281 04:47:47,270 --> 04:47:47,280 and let's now actually create class 14282 04:47:47,280 --> 04:47:50,550 and let's now actually create class user 14283 04:47:52,868 --> 04:47:52,878 so let's create a new file in our 14284 04:47:52,878 --> 04:47:55,030 so let's create a new file in our project and let's actually call it 14285 04:47:55,030 --> 04:47:55,040 project and let's actually call it 14286 04:47:55,040 --> 04:47:58,150 project and let's actually call it user dot pi so this is going to be our 14287 04:47:58,150 --> 04:47:58,160 user dot pi so this is going to be our 14288 04:47:58,160 --> 04:47:59,990 user dot pi so this is going to be our user class 14289 04:47:59,990 --> 04:48:00,000 user class 14290 04:48:00,000 --> 04:48:03,350 user class and inside that i'm going to paste in 14291 04:48:03,350 --> 04:48:03,360 and inside that i'm going to paste in 14292 04:48:03,360 --> 04:48:06,550 and inside that i'm going to paste in this piece of code that basically will 14293 04:48:06,550 --> 04:48:06,560 this piece of code that basically will 14294 04:48:06,560 --> 04:48:07,590 this piece of code that basically will represent 14295 04:48:07,590 --> 04:48:07,600 represent 14296 04:48:07,600 --> 04:48:11,110 represent data for the user and some behavior 14297 04:48:11,110 --> 04:48:11,120 data for the user and some behavior 14298 04:48:11,120 --> 04:48:13,350 data for the user and some behavior these pieces of data are also called 14299 04:48:13,350 --> 04:48:13,360 these pieces of data are also called 14300 04:48:13,360 --> 04:48:14,230 these pieces of data are also called attributes 14301 04:48:14,230 --> 04:48:14,240 attributes 14302 04:48:14,240 --> 04:48:17,350 attributes for that class so now let's turn 14303 04:48:17,350 --> 04:48:17,360 for that class so now let's turn 14304 04:48:17,360 --> 04:48:20,788 for that class so now let's turn all of these into a class so first of 14305 04:48:20,788 --> 04:48:20,798 all of these into a class so first of 14306 04:48:20,798 --> 04:48:21,190 all of these into a class so first of all 14307 04:48:21,190 --> 04:48:21,200 all 14308 04:48:21,200 --> 04:48:23,750 all we create a class using class special 14309 04:48:23,750 --> 04:48:23,760 we create a class using class special 14310 04:48:23,760 --> 04:48:25,350 we create a class using class special work and you also see the syntax 14311 04:48:25,350 --> 04:48:25,360 work and you also see the syntax 14312 04:48:25,360 --> 04:48:26,230 work and you also see the syntax highlighting 14313 04:48:26,230 --> 04:48:26,240 highlighting 14314 04:48:26,240 --> 04:48:29,270 highlighting and we're going to call that user 14315 04:48:29,270 --> 04:48:29,280 and we're going to call that user 14316 04:48:29,280 --> 04:48:30,948 and we're going to call that user and you know the syntax already for 14317 04:48:30,948 --> 04:48:30,958 and you know the syntax already for 14318 04:48:30,958 --> 04:48:33,270 and you know the syntax already for functions um etc 14319 04:48:33,270 --> 04:48:33,280 functions um etc 14320 04:48:33,280 --> 04:48:35,590 functions um etc with indentation so this is going to be 14321 04:48:35,590 --> 04:48:35,600 with indentation so this is going to be 14322 04:48:35,600 --> 04:48:37,670 with indentation so this is going to be where our class definition goes 14323 04:48:37,670 --> 04:48:37,680 where our class definition goes 14324 04:48:37,680 --> 04:48:39,910 where our class definition goes now note here the capital letter for u 14325 04:48:39,910 --> 04:48:39,920 now note here the capital letter for u 14326 04:48:39,920 --> 04:48:41,110 now note here the capital letter for u for user 14327 04:48:41,110 --> 04:48:41,120 for user 14328 04:48:41,120 --> 04:48:44,470 for user and lowercase user in the 14329 04:48:44,470 --> 04:48:44,480 and lowercase user in the 14330 04:48:44,480 --> 04:48:47,750 and lowercase user in the python file name so a standard 14331 04:48:47,750 --> 04:48:47,760 python file name so a standard 14332 04:48:47,760 --> 04:48:50,628 python file name so a standard convention is that we call classes with 14333 04:48:50,628 --> 04:48:50,638 convention is that we call classes with 14334 04:48:50,638 --> 04:48:51,830 convention is that we call classes with a capital letter 14335 04:48:51,830 --> 04:48:51,840 a capital letter 14336 04:48:51,840 --> 04:48:53,590 a capital letter and the file names are written in 14337 04:48:53,590 --> 04:48:53,600 and the file names are written in 14338 04:48:53,600 --> 04:48:54,868 and the file names are written in lowercase letters 14339 04:48:54,868 --> 04:48:54,878 lowercase letters 14340 04:48:54,878 --> 04:48:57,430 lowercase letters and now all of these should actually go 14341 04:48:57,430 --> 04:48:57,440 and now all of these should actually go 14342 04:48:57,440 --> 04:48:58,390 and now all of these should actually go inside that 14343 04:48:58,390 --> 04:48:58,400 inside that 14344 04:48:58,400 --> 04:49:01,190 inside that indentation right like this now we said 14345 04:49:01,190 --> 04:49:01,200 indentation right like this now we said 14346 04:49:01,200 --> 04:49:01,590 indentation right like this now we said that 14347 04:49:01,590 --> 04:49:01,600 that 14348 04:49:01,600 --> 04:49:04,150 that class is a blueprint for specific 14349 04:49:04,150 --> 04:49:04,160 class is a blueprint for specific 14350 04:49:04,160 --> 04:49:04,868 class is a blueprint for specific objects 14351 04:49:04,868 --> 04:49:04,878 objects 14352 04:49:04,878 --> 04:49:07,350 objects and blueprint cannot actually have 14353 04:49:07,350 --> 04:49:07,360 and blueprint cannot actually have 14354 04:49:07,360 --> 04:49:08,070 and blueprint cannot actually have specific 14355 04:49:08,070 --> 04:49:08,080 specific 14356 04:49:08,080 --> 04:49:11,270 specific values right so all these needs to 14357 04:49:11,270 --> 04:49:11,280 values right so all these needs to 14358 04:49:11,280 --> 04:49:13,430 values right so all these needs to be removed so in the blueprint we don't 14359 04:49:13,430 --> 04:49:13,440 be removed so in the blueprint we don't 14360 04:49:13,440 --> 04:49:15,430 be removed so in the blueprint we don't have any specific values we just have 14361 04:49:15,430 --> 04:49:15,440 have any specific values we just have 14362 04:49:15,440 --> 04:49:16,550 have any specific values we just have the attributes 14363 04:49:16,550 --> 04:49:16,560 the attributes 14364 04:49:16,560 --> 04:49:19,670 the attributes so basically we say this user will have 14365 04:49:19,670 --> 04:49:19,680 so basically we say this user will have 14366 04:49:19,680 --> 04:49:20,788 so basically we say this user will have an email 14367 04:49:20,788 --> 04:49:20,798 an email 14368 04:49:20,798 --> 04:49:23,990 an email name password and current job title the 14369 04:49:23,990 --> 04:49:24,000 name password and current job title the 14370 04:49:24,000 --> 04:49:27,110 name password and current job title the actual values of those attributes 14371 04:49:27,110 --> 04:49:27,120 actual values of those attributes 14372 04:49:27,120 --> 04:49:29,430 actual values of those attributes will be then set when we create an 14373 04:49:29,430 --> 04:49:29,440 will be then set when we create an 14374 04:49:29,440 --> 04:49:31,190 will be then set when we create an object from the blueprint 14375 04:49:31,190 --> 04:49:31,200 object from the blueprint 14376 04:49:31,200 --> 04:49:34,150 object from the blueprint however we need a function that will 14377 04:49:34,150 --> 04:49:34,160 however we need a function that will 14378 04:49:34,160 --> 04:49:34,628 however we need a function that will actually 14379 04:49:34,628 --> 04:49:34,638 actually 14380 04:49:34,638 --> 04:49:37,510 actually take those specific values and assign 14381 04:49:37,510 --> 04:49:37,520 take those specific values and assign 14382 04:49:37,520 --> 04:49:38,070 take those specific values and assign them 14383 04:49:38,070 --> 04:49:38,080 them 14384 04:49:38,080 --> 04:49:40,628 them to an object which is created from the 14385 04:49:40,628 --> 04:49:40,638 to an object which is created from the 14386 04:49:40,638 --> 04:49:41,590 to an object which is created from the blueprint 14387 04:49:41,590 --> 04:49:41,600 blueprint 14388 04:49:41,600 --> 04:49:44,310 blueprint and we're gonna create that function 14389 04:49:44,310 --> 04:49:44,320 and we're gonna create that function 14390 04:49:44,320 --> 04:49:45,830 and we're gonna create that function right here in the class 14391 04:49:45,830 --> 04:49:45,840 right here in the class 14392 04:49:45,840 --> 04:49:48,830 right here in the class and that function actually is called 14393 04:49:48,830 --> 04:49:48,840 and that function actually is called 14394 04:49:48,840 --> 04:49:50,390 and that function actually is called init with 14395 04:49:50,390 --> 04:49:50,400 init with 14396 04:49:50,400 --> 04:49:53,030 init with underscore or two underscores at the 14397 04:49:53,030 --> 04:49:53,040 underscore or two underscores at the 14398 04:49:53,040 --> 04:49:53,910 underscore or two underscores at the beginning and 14399 04:49:53,910 --> 04:49:53,920 beginning and 14400 04:49:53,920 --> 04:49:55,750 beginning and at the end a couple of notes here first 14401 04:49:55,750 --> 04:49:55,760 at the end a couple of notes here first 14402 04:49:55,760 --> 04:49:57,830 at the end a couple of notes here first of all you see the syntax highlighting 14403 04:49:57,830 --> 04:49:57,840 of all you see the syntax highlighting 14404 04:49:57,840 --> 04:49:58,868 of all you see the syntax highlighting just changed 14405 04:49:58,868 --> 04:49:58,878 just changed 14406 04:49:58,878 --> 04:50:01,270 just changed to this different color second note is 14407 04:50:01,270 --> 04:50:01,280 to this different color second note is 14408 04:50:01,280 --> 04:50:02,230 to this different color second note is that these 14409 04:50:02,230 --> 04:50:02,240 that these 14410 04:50:02,240 --> 04:50:04,550 that these functions that start with underscore in 14411 04:50:04,550 --> 04:50:04,560 functions that start with underscore in 14412 04:50:04,560 --> 04:50:06,708 functions that start with underscore in python are special functions 14413 04:50:06,708 --> 04:50:06,718 python are special functions 14414 04:50:06,718 --> 04:50:09,350 python are special functions so python basically gives them some 14415 04:50:09,350 --> 04:50:09,360 so python basically gives them some 14416 04:50:09,360 --> 04:50:11,270 so python basically gives them some special meaning so it knows 14417 04:50:11,270 --> 04:50:11,280 special meaning so it knows 14418 04:50:11,280 --> 04:50:13,510 special meaning so it knows exactly what this init function is and 14419 04:50:13,510 --> 04:50:13,520 exactly what this init function is and 14420 04:50:13,520 --> 04:50:15,590 exactly what this init function is and we also have to call it init we can't 14421 04:50:15,590 --> 04:50:15,600 we also have to call it init we can't 14422 04:50:15,600 --> 04:50:18,230 we also have to call it init we can't just call it whatever we want and final 14423 04:50:18,230 --> 04:50:18,240 just call it whatever we want and final 14424 04:50:18,240 --> 04:50:20,390 just call it whatever we want and final note is that this init function in 14425 04:50:20,390 --> 04:50:20,400 note is that this init function in 14426 04:50:20,400 --> 04:50:21,510 note is that this init function in python is 14427 04:50:21,510 --> 04:50:21,520 python is 14428 04:50:21,520 --> 04:50:24,628 python is something called a constructor again we 14429 04:50:24,628 --> 04:50:24,638 something called a constructor again we 14430 04:50:24,638 --> 04:50:27,190 something called a constructor again we have a blueprint and we're constructing 14431 04:50:27,190 --> 04:50:27,200 have a blueprint and we're constructing 14432 04:50:27,200 --> 04:50:29,350 have a blueprint and we're constructing objects from the blueprint and this init 14433 04:50:29,350 --> 04:50:29,360 objects from the blueprint and this init 14434 04:50:29,360 --> 04:50:30,230 objects from the blueprint and this init function 14435 04:50:30,230 --> 04:50:30,240 function 14436 04:50:30,240 --> 04:50:32,868 function the constructive function will help us 14437 04:50:32,868 --> 04:50:32,878 the constructive function will help us 14438 04:50:32,878 --> 04:50:33,670 the constructive function will help us construct 14439 04:50:33,670 --> 04:50:33,680 construct 14440 04:50:33,680 --> 04:50:37,270 construct objects from that user class and now 14441 04:50:37,270 --> 04:50:37,280 objects from that user class and now 14442 04:50:37,280 --> 04:50:39,910 objects from that user class and now for a function syntax you know that we 14443 04:50:39,910 --> 04:50:39,920 for a function syntax you know that we 14444 04:50:39,920 --> 04:50:40,788 for a function syntax you know that we use 14445 04:50:40,788 --> 04:50:40,798 use 14446 04:50:40,798 --> 04:50:44,470 use these brackets right and when i 14447 04:50:44,470 --> 04:50:44,480 these brackets right and when i 14448 04:50:44,480 --> 04:50:46,628 these brackets right and when i start writing the bracket you see that 14449 04:50:46,628 --> 04:50:46,638 start writing the bracket you see that 14450 04:50:46,638 --> 04:50:47,750 start writing the bracket you see that self 14451 04:50:47,750 --> 04:50:47,760 self 14452 04:50:47,760 --> 04:50:50,390 self got automatically created as the 14453 04:50:50,390 --> 04:50:50,400 got automatically created as the 14454 04:50:50,400 --> 04:50:51,430 got automatically created as the parameter here 14455 04:50:51,430 --> 04:50:51,440 parameter here 14456 04:50:51,440 --> 04:50:54,390 parameter here and the reason is as i mentioned python 14457 04:50:54,390 --> 04:50:54,400 and the reason is as i mentioned python 14458 04:50:54,400 --> 04:50:56,310 and the reason is as i mentioned python knows what the init function is and that 14459 04:50:56,310 --> 04:50:56,320 knows what the init function is and that 14460 04:50:56,320 --> 04:50:56,868 knows what the init function is and that it's a 14461 04:50:56,868 --> 04:50:56,878 it's a 14462 04:50:56,878 --> 04:50:59,750 it's a constructor so it knows that it needs 14463 04:50:59,750 --> 04:50:59,760 constructor so it knows that it needs 14464 04:50:59,760 --> 04:51:00,070 constructor so it knows that it needs this 14465 04:51:00,070 --> 04:51:00,080 this 14466 04:51:00,080 --> 04:51:03,990 this self as a parameter again self is also a 14467 04:51:03,990 --> 04:51:04,000 self as a parameter again self is also a 14468 04:51:04,000 --> 04:51:04,788 self as a parameter again self is also a special 14469 04:51:04,788 --> 04:51:04,798 special 14470 04:51:04,798 --> 04:51:07,350 special word in python it has a special meaning 14471 04:51:07,350 --> 04:51:07,360 word in python it has a special meaning 14472 04:51:07,360 --> 04:51:08,628 word in python it has a special meaning and it actually 14473 04:51:08,628 --> 04:51:08,638 and it actually 14474 04:51:08,638 --> 04:51:11,910 and it actually refers to this class here 14475 04:51:11,910 --> 04:51:11,920 refers to this class here 14476 04:51:11,920 --> 04:51:15,350 refers to this class here right this entire class if i hover over 14477 04:51:15,350 --> 04:51:15,360 right this entire class if i hover over 14478 04:51:15,360 --> 04:51:15,750 right this entire class if i hover over it 14479 04:51:15,750 --> 04:51:15,760 it 14480 04:51:15,760 --> 04:51:19,430 it you see self points to the user class 14481 04:51:19,430 --> 04:51:19,440 you see self points to the user class 14482 04:51:19,440 --> 04:51:21,990 you see self points to the user class and it will basically just help us 14483 04:51:21,990 --> 04:51:22,000 and it will basically just help us 14484 04:51:22,000 --> 04:51:22,708 and it will basically just help us access 14485 04:51:22,708 --> 04:51:22,718 access 14486 04:51:22,718 --> 04:51:24,550 access and reference all the attributes and 14487 04:51:24,550 --> 04:51:24,560 and reference all the attributes and 14488 04:51:24,560 --> 04:51:26,868 and reference all the attributes and functions within that class 14489 04:51:26,868 --> 04:51:26,878 functions within that class 14490 04:51:26,878 --> 04:51:29,910 functions within that class so it's for special usage within that 14491 04:51:29,910 --> 04:51:29,920 so it's for special usage within that 14492 04:51:29,920 --> 04:51:31,030 so it's for special usage within that user class 14493 04:51:31,030 --> 04:51:31,040 user class 14494 04:51:31,040 --> 04:51:32,948 user class and we're going to see examples of how 14495 04:51:32,948 --> 04:51:32,958 and we're going to see examples of how 14496 04:51:32,958 --> 04:51:34,868 and we're going to see examples of how to use that in a second 14497 04:51:34,868 --> 04:51:34,878 to use that in a second 14498 04:51:34,878 --> 04:51:37,030 to use that in a second now you can think of those attributes as 14499 04:51:37,030 --> 04:51:37,040 now you can think of those attributes as 14500 04:51:37,040 --> 04:51:37,990 now you can think of those attributes as variables 14501 04:51:37,990 --> 04:51:38,000 variables 14502 04:51:38,000 --> 04:51:40,470 variables within the class because they belong to 14503 04:51:40,470 --> 04:51:40,480 within the class because they belong to 14504 04:51:40,480 --> 04:51:42,788 within the class because they belong to the class right they describe basically 14505 04:51:42,788 --> 04:51:42,798 the class right they describe basically 14506 04:51:42,798 --> 04:51:45,350 the class right they describe basically what attributes or what characteristics 14507 04:51:45,350 --> 04:51:45,360 what attributes or what characteristics 14508 04:51:45,360 --> 04:51:45,830 what attributes or what characteristics this 14509 04:51:45,830 --> 04:51:45,840 this 14510 04:51:45,840 --> 04:51:48,230 this class has and in order to define that 14511 04:51:48,230 --> 04:51:48,240 class has and in order to define that 14512 04:51:48,240 --> 04:51:48,868 class has and in order to define that these 14513 04:51:48,868 --> 04:51:48,878 these 14514 04:51:48,878 --> 04:51:51,430 these variables belong to the class we need to 14515 04:51:51,430 --> 04:51:51,440 variables belong to the class we need to 14516 04:51:51,440 --> 04:51:51,990 variables belong to the class we need to use 14517 04:51:51,990 --> 04:51:52,000 use 14518 04:51:52,000 --> 04:51:58,230 use self here so 14519 04:52:00,310 --> 04:52:00,320 and you see again syntax highlighting 14520 04:52:00,320 --> 04:52:01,350 and you see again syntax highlighting changed 14521 04:52:01,350 --> 04:52:01,360 changed 14522 04:52:01,360 --> 04:52:03,750 changed and the red line disappeared so 14523 04:52:03,750 --> 04:52:03,760 and the red line disappeared so 14524 04:52:03,760 --> 04:52:05,430 and the red line disappeared so basically we are defining 14525 04:52:05,430 --> 04:52:05,440 basically we are defining 14526 04:52:05,440 --> 04:52:07,910 basically we are defining that email name password and current job 14527 04:52:07,910 --> 04:52:07,920 that email name password and current job 14528 04:52:07,920 --> 04:52:08,708 that email name password and current job title 14529 04:52:08,708 --> 04:52:08,718 title 14530 04:52:08,718 --> 04:52:12,150 title belong to this class using this self 14531 04:52:12,150 --> 04:52:12,160 belong to this class using this self 14532 04:52:12,160 --> 04:52:14,708 belong to this class using this self keyword and now the last thing remaining 14533 04:52:14,708 --> 04:52:14,718 keyword and now the last thing remaining 14534 04:52:14,718 --> 04:52:16,310 keyword and now the last thing remaining in this constructor again remember 14535 04:52:16,310 --> 04:52:16,320 in this constructor again remember 14536 04:52:16,320 --> 04:52:17,430 in this constructor again remember constructor 14537 04:52:17,430 --> 04:52:17,440 constructor 14538 04:52:17,440 --> 04:52:19,910 constructor is to construct new objects so whenever 14539 04:52:19,910 --> 04:52:19,920 is to construct new objects so whenever 14540 04:52:19,920 --> 04:52:21,990 is to construct new objects so whenever a new object is created 14541 04:52:21,990 --> 04:52:22,000 a new object is created 14542 04:52:22,000 --> 04:52:25,350 a new object is created the specific values will be assigned 14543 04:52:25,350 --> 04:52:25,360 the specific values will be assigned 14544 04:52:25,360 --> 04:52:28,150 the specific values will be assigned to all these four variables right and 14545 04:52:28,150 --> 04:52:28,160 to all these four variables right and 14546 04:52:28,160 --> 04:52:28,550 to all these four variables right and those 14547 04:52:28,550 --> 04:52:28,560 those 14548 04:52:28,560 --> 04:52:31,430 those values those specific values will be 14549 04:52:31,430 --> 04:52:31,440 values those specific values will be 14550 04:52:31,440 --> 04:52:33,510 values those specific values will be passed into the constructor as 14551 04:52:33,510 --> 04:52:33,520 passed into the constructor as 14552 04:52:33,520 --> 04:52:36,868 passed into the constructor as parameters so email name 14553 04:52:36,868 --> 04:52:36,878 parameters so email name 14554 04:52:36,878 --> 04:52:40,868 parameters so email name password and current 14555 04:52:40,868 --> 04:52:40,878 password and current 14556 04:52:40,878 --> 04:52:43,910 password and current job title those four values 14557 04:52:43,910 --> 04:52:43,920 job title those four values 14558 04:52:43,920 --> 04:52:46,390 job title those four values must be provided to the constructor 14559 04:52:46,390 --> 04:52:46,400 must be provided to the constructor 14560 04:52:46,400 --> 04:52:47,750 must be provided to the constructor whenever we're creating 14561 04:52:47,750 --> 04:52:47,760 whenever we're creating 14562 04:52:47,760 --> 04:52:51,110 whenever we're creating a new object note that these 14563 04:52:51,110 --> 04:52:51,120 a new object note that these 14564 04:52:51,120 --> 04:52:53,350 a new object note that these names here could be different from this 14565 04:52:53,350 --> 04:52:53,360 names here could be different from this 14566 04:52:53,360 --> 04:52:55,030 names here could be different from this these are not the same these are just 14567 04:52:55,030 --> 04:52:55,040 these are not the same these are just 14568 04:52:55,040 --> 04:52:57,830 these are not the same these are just parameters and using these parameter 14569 04:52:57,830 --> 04:52:57,840 parameters and using these parameter 14570 04:52:57,840 --> 04:52:59,510 parameters and using these parameter values we are going to 14571 04:52:59,510 --> 04:52:59,520 values we are going to 14572 04:52:59,520 --> 04:53:03,110 values we are going to basically set the variables or 14573 04:53:03,110 --> 04:53:03,120 basically set the variables or 14574 04:53:03,120 --> 04:53:03,910 basically set the variables or attributes 14575 04:53:03,910 --> 04:53:03,920 attributes 14576 04:53:03,920 --> 04:53:07,350 attributes of the class like this 14577 04:53:07,350 --> 04:53:07,360 of the class like this 14578 04:53:07,360 --> 04:53:10,628 of the class like this and the warning is gone as well again as 14579 04:53:10,628 --> 04:53:10,638 and the warning is gone as well again as 14580 04:53:10,638 --> 04:53:12,788 and the warning is gone as well again as i mentioned this could be something else 14581 04:53:12,788 --> 04:53:12,798 i mentioned this could be something else 14582 04:53:12,798 --> 04:53:15,590 i mentioned this could be something else we could call it user email so it 14583 04:53:15,590 --> 04:53:15,600 we could call it user email so it 14584 04:53:15,600 --> 04:53:16,948 we could call it user email so it doesn't actually have to be 14585 04:53:16,948 --> 04:53:16,958 doesn't actually have to be 14586 04:53:16,958 --> 04:53:20,150 doesn't actually have to be the same it's just for convenience so 14587 04:53:20,150 --> 04:53:20,160 the same it's just for convenience so 14588 04:53:20,160 --> 04:53:23,830 the same it's just for convenience so this function will construct an object 14589 04:53:23,830 --> 04:53:23,840 this function will construct an object 14590 04:53:23,840 --> 04:53:26,390 this function will construct an object with parameters that we provide when we 14591 04:53:26,390 --> 04:53:26,400 with parameters that we provide when we 14592 04:53:26,400 --> 04:53:27,430 with parameters that we provide when we actually create it 14593 04:53:27,430 --> 04:53:27,440 actually create it 14594 04:53:27,440 --> 04:53:29,430 actually create it and we're going to see how to create an 14595 04:53:29,430 --> 04:53:29,440 and we're going to see how to create an 14596 04:53:29,440 --> 04:53:31,990 and we're going to see how to create an object later this is just the definition 14597 04:53:31,990 --> 04:53:32,000 object later this is just the definition 14598 04:53:32,000 --> 04:53:33,830 object later this is just the definition as remember when you define a function 14599 04:53:33,830 --> 04:53:33,840 as remember when you define a function 14600 04:53:33,840 --> 04:53:35,270 as remember when you define a function nothing actually happens 14601 04:53:35,270 --> 04:53:35,280 nothing actually happens 14602 04:53:35,280 --> 04:53:38,230 nothing actually happens until you call or you use that function 14603 04:53:38,230 --> 04:53:38,240 until you call or you use that function 14604 04:53:38,240 --> 04:53:38,708 until you call or you use that function so 14605 04:53:38,708 --> 04:53:38,718 so 14606 04:53:38,718 --> 04:53:40,470 so right here we're just defining that 14607 04:53:40,470 --> 04:53:40,480 right here we're just defining that 14608 04:53:40,480 --> 04:53:42,550 right here we're just defining that function so that we can use it 14609 04:53:42,550 --> 04:53:42,560 function so that we can use it 14610 04:53:42,560 --> 04:53:45,750 function so that we can use it later so constructor logic is 14611 04:53:45,750 --> 04:53:45,760 later so constructor logic is 14612 04:53:45,760 --> 04:53:49,270 later so constructor logic is done now we have these two functions 14613 04:53:49,270 --> 04:53:49,280 done now we have these two functions 14614 04:53:49,280 --> 04:53:52,310 done now we have these two functions that any user in our application 14615 04:53:52,310 --> 04:53:52,320 that any user in our application 14616 04:53:52,320 --> 04:53:54,868 that any user in our application can do right any user can change their 14617 04:53:54,868 --> 04:53:54,878 can do right any user can change their 14618 04:53:54,878 --> 04:53:57,590 can do right any user can change their password or change their job title 14619 04:53:57,590 --> 04:53:57,600 password or change their job title 14620 04:53:57,600 --> 04:53:59,750 password or change their job title and logically when change password 14621 04:53:59,750 --> 04:53:59,760 and logically when change password 14622 04:53:59,760 --> 04:54:00,628 and logically when change password happens 14623 04:54:00,628 --> 04:54:00,638 happens 14624 04:54:00,638 --> 04:54:03,670 happens by user basically user provides a new 14625 04:54:03,670 --> 04:54:03,680 by user basically user provides a new 14626 04:54:03,680 --> 04:54:04,788 by user basically user provides a new password 14627 04:54:04,788 --> 04:54:04,798 password 14628 04:54:04,798 --> 04:54:07,350 password in order to override the old one so the 14629 04:54:07,350 --> 04:54:07,360 in order to override the old one so the 14630 04:54:07,360 --> 04:54:08,948 in order to override the old one so the flow will be following 14631 04:54:08,948 --> 04:54:08,958 flow will be following 14632 04:54:08,958 --> 04:54:11,430 flow will be following the object will be created for the 14633 04:54:11,430 --> 04:54:11,440 the object will be created for the 14634 04:54:11,440 --> 04:54:12,868 the object will be created for the specific user 14635 04:54:12,868 --> 04:54:12,878 specific user 14636 04:54:12,878 --> 04:54:15,350 specific user so the initial data for that object will 14637 04:54:15,350 --> 04:54:15,360 so the initial data for that object will 14638 04:54:15,360 --> 04:54:16,310 so the initial data for that object will be provided 14639 04:54:16,310 --> 04:54:16,320 be provided 14640 04:54:16,320 --> 04:54:18,390 be provided so we'll have the user email name 14641 04:54:18,390 --> 04:54:18,400 so we'll have the user email name 14642 04:54:18,400 --> 04:54:20,150 so we'll have the user email name password and current job title 14643 04:54:20,150 --> 04:54:20,160 password and current job title 14644 04:54:20,160 --> 04:54:22,470 password and current job title and later at some point user may decide 14645 04:54:22,470 --> 04:54:22,480 and later at some point user may decide 14646 04:54:22,480 --> 04:54:24,070 and later at some point user may decide to change their password 14647 04:54:24,070 --> 04:54:24,080 to change their password 14648 04:54:24,080 --> 04:54:26,628 to change their password and their current job title and that 14649 04:54:26,628 --> 04:54:26,638 and their current job title and that 14650 04:54:26,638 --> 04:54:27,190 and their current job title and that means the 14651 04:54:27,190 --> 04:54:27,200 means the 14652 04:54:27,200 --> 04:54:30,390 means the initial data will be changed and that 14653 04:54:30,390 --> 04:54:30,400 initial data will be changed and that 14654 04:54:30,400 --> 04:54:32,310 initial data will be changed and that means 14655 04:54:32,310 --> 04:54:32,320 means 14656 04:54:32,320 --> 04:54:34,788 means that we're actually changing the 14657 04:54:34,788 --> 04:54:34,798 that we're actually changing the 14658 04:54:34,798 --> 04:54:38,110 that we're actually changing the attributes 14659 04:54:41,270 --> 04:54:41,280 self.password with a new password 14660 04:54:41,280 --> 04:54:44,788 self.password with a new password right so logic will be like this 14661 04:54:44,788 --> 04:54:44,798 right so logic will be like this 14662 04:54:44,798 --> 04:54:47,830 right so logic will be like this now we have red lines here why because 14663 04:54:47,830 --> 04:54:47,840 now we have red lines here why because 14664 04:54:47,840 --> 04:54:48,390 now we have red lines here why because we need 14665 04:54:48,390 --> 04:54:48,400 we need 14666 04:54:48,400 --> 04:54:50,868 we need this self as a parameter first of all we 14667 04:54:50,868 --> 04:54:50,878 this self as a parameter first of all we 14668 04:54:50,878 --> 04:54:51,670 this self as a parameter first of all we also have that 14669 04:54:51,670 --> 04:54:51,680 also have that 14670 04:54:51,680 --> 04:54:56,470 also have that as um note right here 14671 04:54:56,470 --> 04:54:56,480 as um note right here 14672 04:54:56,480 --> 04:54:58,550 as um note right here so just like here we need to actually 14673 04:54:58,550 --> 04:54:58,560 so just like here we need to actually 14674 04:54:58,560 --> 04:55:00,230 so just like here we need to actually pass that self as a parameter that's 14675 04:55:00,230 --> 04:55:00,240 pass that self as a parameter that's 14676 04:55:00,240 --> 04:55:01,270 pass that self as a parameter that's just how it is 14677 04:55:01,270 --> 04:55:01,280 just how it is 14678 04:55:01,280 --> 04:55:04,550 just how it is because we need to access attributes 14679 04:55:04,550 --> 04:55:04,560 because we need to access attributes 14680 04:55:04,560 --> 04:55:07,750 because we need to access attributes of that class in that function and 14681 04:55:07,750 --> 04:55:07,760 of that class in that function and 14682 04:55:07,760 --> 04:55:11,990 of that class in that function and new password will be 14683 04:55:11,990 --> 04:55:12,000 new password will be 14684 04:55:12,000 --> 04:55:14,788 new password will be new password variable will be the new 14685 04:55:14,788 --> 04:55:14,798 new password variable will be the new 14686 04:55:14,798 --> 04:55:15,750 new password variable will be the new password 14687 04:55:15,750 --> 04:55:15,760 password 14688 04:55:15,760 --> 04:55:18,550 password basically that user wants to set so this 14689 04:55:18,550 --> 04:55:18,560 basically that user wants to set so this 14690 04:55:18,560 --> 04:55:19,830 basically that user wants to set so this will change 14691 04:55:19,830 --> 04:55:19,840 will change 14692 04:55:19,840 --> 04:55:22,470 will change the initial password with the new one 14693 04:55:22,470 --> 04:55:22,480 the initial password with the new one 14694 04:55:22,480 --> 04:55:23,510 the initial password with the new one and the same way 14695 04:55:23,510 --> 04:55:23,520 and the same way 14696 04:55:23,520 --> 04:55:26,310 and the same way in change.title we have self as a first 14697 04:55:26,310 --> 04:55:26,320 in change.title we have self as a first 14698 04:55:26,320 --> 04:55:27,030 in change.title we have self as a first parameter 14699 04:55:27,030 --> 04:55:27,040 parameter 14700 04:55:27,040 --> 04:55:29,350 parameter we always need it in all the functions 14701 04:55:29,350 --> 04:55:29,360 we always need it in all the functions 14702 04:55:29,360 --> 04:55:30,390 we always need it in all the functions because 14703 04:55:30,390 --> 04:55:30,400 because 14704 04:55:30,400 --> 04:55:32,150 because otherwise we cannot access the 14705 04:55:32,150 --> 04:55:32,160 otherwise we cannot access the 14706 04:55:32,160 --> 04:55:33,590 otherwise we cannot access the attributes in the class 14707 04:55:33,590 --> 04:55:33,600 attributes in the class 14708 04:55:33,600 --> 04:55:38,830 attributes in the class and new job 14709 04:55:47,510 --> 04:55:47,520 so now let's review this class that we 14710 04:55:47,520 --> 04:55:48,390 so now let's review this class that we created 14711 04:55:48,390 --> 04:55:48,400 created 14712 04:55:48,400 --> 04:55:50,868 created first of all we have this class keyword 14713 04:55:50,868 --> 04:55:50,878 first of all we have this class keyword 14714 04:55:50,878 --> 04:55:52,948 first of all we have this class keyword here with a capital letter 14715 04:55:52,948 --> 04:55:52,958 here with a capital letter 14716 04:55:52,958 --> 04:55:55,350 here with a capital letter for user you already know the syntax 14717 04:55:55,350 --> 04:55:55,360 for user you already know the syntax 14718 04:55:55,360 --> 04:55:56,788 for user you already know the syntax with colon and then 14719 04:55:56,788 --> 04:55:56,798 with colon and then 14720 04:55:56,798 --> 04:55:59,830 with colon and then indentation so this all of these 14721 04:55:59,830 --> 04:55:59,840 indentation so this all of these 14722 04:55:59,840 --> 04:56:03,270 indentation so this all of these inside this indentation is class body 14723 04:56:03,270 --> 04:56:03,280 inside this indentation is class body 14724 04:56:03,280 --> 04:56:05,910 inside this indentation is class body so part of the class logic first we have 14725 04:56:05,910 --> 04:56:05,920 so part of the class logic first we have 14726 04:56:05,920 --> 04:56:06,390 so part of the class logic first we have this 14727 04:56:06,390 --> 04:56:06,400 this 14728 04:56:06,400 --> 04:56:09,350 this init constructor that sets the initial 14729 04:56:09,350 --> 04:56:09,360 init constructor that sets the initial 14730 04:56:09,360 --> 04:56:09,990 init constructor that sets the initial values 14731 04:56:09,990 --> 04:56:10,000 values 14732 04:56:10,000 --> 04:56:13,350 values of that class attributes whenever we 14733 04:56:13,350 --> 04:56:13,360 of that class attributes whenever we 14734 04:56:13,360 --> 04:56:13,910 of that class attributes whenever we create 14735 04:56:13,910 --> 04:56:13,920 create 14736 04:56:13,920 --> 04:56:17,030 create a specific object for that class right 14737 04:56:17,030 --> 04:56:17,040 a specific object for that class right 14738 04:56:17,040 --> 04:56:18,948 a specific object for that class right so this happens only when we construct a 14739 04:56:18,948 --> 04:56:18,958 so this happens only when we construct a 14740 04:56:18,958 --> 04:56:20,150 so this happens only when we construct a new object 14741 04:56:20,150 --> 04:56:20,160 new object 14742 04:56:20,160 --> 04:56:22,788 new object and then on that constructed object we 14743 04:56:22,788 --> 04:56:22,798 and then on that constructed object we 14744 04:56:22,798 --> 04:56:24,708 and then on that constructed object we can change password we can change 14745 04:56:24,708 --> 04:56:24,718 can change password we can change 14746 04:56:24,718 --> 04:56:27,750 can change password we can change job title and note that right now we 14747 04:56:27,750 --> 04:56:27,760 job title and note that right now we 14748 04:56:27,760 --> 04:56:28,470 job title and note that right now we have 14749 04:56:28,470 --> 04:56:28,480 have 14750 04:56:28,480 --> 04:56:30,628 have nothing basically hard coded we have no 14751 04:56:30,628 --> 04:56:30,638 nothing basically hard coded we have no 14752 04:56:30,638 --> 04:56:31,910 nothing basically hard coded we have no specific 14753 04:56:31,910 --> 04:56:31,920 specific 14754 04:56:31,920 --> 04:56:34,830 specific values here right everything is just 14755 04:56:34,830 --> 04:56:34,840 values here right everything is just 14756 04:56:34,840 --> 04:56:36,628 values here right everything is just parameterized 14757 04:56:36,628 --> 04:56:36,638 parameterized 14758 04:56:36,638 --> 04:56:39,910 parameterized and also this is just a definition for 14759 04:56:39,910 --> 04:56:39,920 and also this is just a definition for 14760 04:56:39,920 --> 04:56:42,708 and also this is just a definition for class and its functions nothing will 14761 04:56:42,708 --> 04:56:42,718 class and its functions nothing will 14762 04:56:42,718 --> 04:56:44,550 class and its functions nothing will actually happen when we execute this 14763 04:56:44,550 --> 04:56:44,560 actually happen when we execute this 14764 04:56:44,560 --> 04:56:47,190 actually happen when we execute this because we're not creating any user 14765 04:56:47,190 --> 04:56:47,200 because we're not creating any user 14766 04:56:47,200 --> 04:56:48,310 because we're not creating any user objects 14767 04:56:48,310 --> 04:56:48,320 objects 14768 04:56:48,320 --> 04:56:51,110 objects so if i right click here and execute 14769 04:56:51,110 --> 04:56:51,120 so if i right click here and execute 14770 04:56:51,120 --> 04:56:51,750 so if i right click here and execute this 14771 04:56:51,750 --> 04:56:51,760 this 14772 04:56:51,760 --> 04:56:54,788 this run user you see that 14773 04:56:54,788 --> 04:56:54,798 run user you see that 14774 04:56:54,798 --> 04:56:56,788 run user you see that nothing happened because the class 14775 04:56:56,788 --> 04:56:56,798 nothing happened because the class 14776 04:56:56,798 --> 04:56:58,390 nothing happened because the class definition was created 14777 04:56:58,390 --> 04:56:58,400 definition was created 14778 04:56:58,400 --> 04:57:00,390 definition was created but we're not doing anything with that 14779 04:57:00,390 --> 04:57:00,400 but we're not doing anything with that 14780 04:57:00,400 --> 04:57:02,230 but we're not doing anything with that class definition we're not creating 14781 04:57:02,230 --> 04:57:02,240 class definition we're not creating 14782 04:57:02,240 --> 04:57:05,190 class definition we're not creating new users so now let's actually go ahead 14783 04:57:05,190 --> 04:57:05,200 new users so now let's actually go ahead 14784 04:57:05,200 --> 04:57:05,670 new users so now let's actually go ahead and 14785 04:57:05,670 --> 04:57:05,680 and 14786 04:57:05,680 --> 04:57:09,510 and do that 14787 04:57:13,750 --> 04:57:13,760 in the same file in user.py 14788 04:57:13,760 --> 04:57:15,350 in the same file in user.py i would actually use that class 14789 04:57:15,350 --> 04:57:15,360 i would actually use that class 14790 04:57:15,360 --> 04:57:17,270 i would actually use that class blueprint to construct a new 14791 04:57:17,270 --> 04:57:17,280 blueprint to construct a new 14792 04:57:17,280 --> 04:57:20,390 blueprint to construct a new user object and creating an object from 14793 04:57:20,390 --> 04:57:20,400 user object and creating an object from 14794 04:57:20,400 --> 04:57:22,390 user object and creating an object from a class is actually very simple 14795 04:57:22,390 --> 04:57:22,400 a class is actually very simple 14796 04:57:22,400 --> 04:57:25,510 a class is actually very simple we just write name of the class and 14797 04:57:25,510 --> 04:57:25,520 we just write name of the class and 14798 04:57:25,520 --> 04:57:28,150 we just write name of the class and parentheses this is actually the same 14799 04:57:28,150 --> 04:57:28,160 parentheses this is actually the same 14800 04:57:28,160 --> 04:57:29,110 parentheses this is actually the same syntax as 14801 04:57:29,110 --> 04:57:29,120 syntax as 14802 04:57:29,120 --> 04:57:32,150 syntax as calling the function with parameters 14803 04:57:32,150 --> 04:57:32,160 calling the function with parameters 14804 04:57:32,160 --> 04:57:34,788 calling the function with parameters and the parameters that we need to give 14805 04:57:34,788 --> 04:57:34,798 and the parameters that we need to give 14806 04:57:34,798 --> 04:57:35,350 and the parameters that we need to give that 14807 04:57:35,350 --> 04:57:35,360 that 14808 04:57:35,360 --> 04:57:39,110 that class are these four values here 14809 04:57:39,110 --> 04:57:39,120 class are these four values here 14810 04:57:39,120 --> 04:57:42,150 class are these four values here and note that calling this user 14811 04:57:42,150 --> 04:57:42,160 and note that calling this user 14812 04:57:42,160 --> 04:57:44,230 and note that calling this user class function basically in the 14813 04:57:44,230 --> 04:57:44,240 class function basically in the 14814 04:57:44,240 --> 04:57:45,750 class function basically in the background we'll call 14815 04:57:45,750 --> 04:57:45,760 background we'll call 14816 04:57:45,760 --> 04:57:48,230 background we'll call init function right so the constructor 14817 04:57:48,230 --> 04:57:48,240 init function right so the constructor 14818 04:57:48,240 --> 04:57:50,470 init function right so the constructor will be called whenever we write this 14819 04:57:50,470 --> 04:57:50,480 will be called whenever we write this 14820 04:57:50,480 --> 04:57:53,670 will be called whenever we write this syntax with class name and parentheses 14821 04:57:53,670 --> 04:57:53,680 syntax with class name and parentheses 14822 04:57:53,680 --> 04:57:56,628 syntax with class name and parentheses and this init constructor as you see 14823 04:57:56,628 --> 04:57:56,638 and this init constructor as you see 14824 04:57:56,638 --> 04:57:57,430 and this init constructor as you see expects 14825 04:57:57,430 --> 04:57:57,440 expects 14826 04:57:57,440 --> 04:57:59,830 expects four parameters so we have to provide 14827 04:57:59,830 --> 04:57:59,840 four parameters so we have to provide 14828 04:57:59,840 --> 04:58:01,190 four parameters so we have to provide all those parameters 14829 04:58:01,190 --> 04:58:01,200 all those parameters 14830 04:58:01,200 --> 04:58:03,910 all those parameters right here in the parenthesis so let's 14831 04:58:03,910 --> 04:58:03,920 right here in the parenthesis so let's 14832 04:58:03,920 --> 04:58:05,270 right here in the parenthesis so let's actually provide them 14833 04:58:05,270 --> 04:58:05,280 actually provide them 14834 04:58:05,280 --> 04:58:09,430 actually provide them let's do user email 14835 04:58:09,430 --> 04:58:09,440 let's do user email 14836 04:58:09,440 --> 04:58:13,430 let's do user email like this 14837 04:58:25,110 --> 04:58:25,120 and a current job title again very 14838 04:58:25,120 --> 04:58:27,110 and a current job title again very similar to calling a function 14839 04:58:27,110 --> 04:58:27,120 similar to calling a function 14840 04:58:27,120 --> 04:58:30,230 similar to calling a function and this will actually construct a new 14841 04:58:30,230 --> 04:58:30,240 and this will actually construct a new 14842 04:58:30,240 --> 04:58:33,830 and this will actually construct a new object from the user class which has 14843 04:58:33,830 --> 04:58:33,840 object from the user class which has 14844 04:58:33,840 --> 04:58:37,350 object from the user class which has these four attributes with 14845 04:58:37,350 --> 04:58:37,360 these four attributes with 14846 04:58:37,360 --> 04:58:39,750 these four attributes with values that we just provided here and 14847 04:58:39,750 --> 04:58:39,760 values that we just provided here and 14848 04:58:39,760 --> 04:58:40,708 values that we just provided here and has these 14849 04:58:40,708 --> 04:58:40,718 has these 14850 04:58:40,718 --> 04:58:44,070 has these two functions that we can use 14851 04:58:44,070 --> 04:58:44,080 two functions that we can use 14852 04:58:44,080 --> 04:58:46,390 two functions that we can use to either change a password or change 14853 04:58:46,390 --> 04:58:46,400 to either change a password or change 14854 04:58:46,400 --> 04:58:47,670 to either change a password or change job title 14855 04:58:47,670 --> 04:58:47,680 job title 14856 04:58:47,680 --> 04:58:50,628 job title one note here is that functions that 14857 04:58:50,628 --> 04:58:50,638 one note here is that functions that 14858 04:58:50,638 --> 04:58:52,310 one note here is that functions that belong to a class 14859 04:58:52,310 --> 04:58:52,320 belong to a class 14860 04:58:52,320 --> 04:58:54,788 belong to a class are actually called methods so there's a 14861 04:58:54,788 --> 04:58:54,798 are actually called methods so there's a 14862 04:58:54,798 --> 04:58:56,550 are actually called methods so there's a special name for functions 14863 04:58:56,550 --> 04:58:56,560 special name for functions 14864 04:58:56,560 --> 04:58:58,628 special name for functions which are part of a class so we can 14865 04:58:58,628 --> 04:58:58,638 which are part of a class so we can 14866 04:58:58,638 --> 04:59:00,150 which are part of a class so we can refer to them as 14867 04:59:00,150 --> 04:59:00,160 refer to them as 14868 04:59:00,160 --> 04:59:03,670 refer to them as methods so user object basically gives 14869 04:59:03,670 --> 04:59:03,680 methods so user object basically gives 14870 04:59:03,680 --> 04:59:04,310 methods so user object basically gives us 14871 04:59:04,310 --> 04:59:04,320 us 14872 04:59:04,320 --> 04:59:07,110 us two methods that we can use now again if 14873 04:59:07,110 --> 04:59:07,120 two methods that we can use now again if 14874 04:59:07,120 --> 04:59:08,948 two methods that we can use now again if we execute this program now 14875 04:59:08,948 --> 04:59:08,958 we execute this program now 14876 04:59:08,958 --> 04:59:11,110 we execute this program now we will not see anything even though 14877 04:59:11,110 --> 04:59:11,120 we will not see anything even though 14878 04:59:11,120 --> 04:59:12,948 we will not see anything even though user will be created because 14879 04:59:12,948 --> 04:59:12,958 user will be created because 14880 04:59:12,958 --> 04:59:14,788 user will be created because we're not printing anything to the 14881 04:59:14,788 --> 04:59:14,798 we're not printing anything to the 14882 04:59:14,798 --> 04:59:17,190 we're not printing anything to the console we're not doing anything so 14883 04:59:17,190 --> 04:59:17,200 console we're not doing anything so 14884 04:59:17,200 --> 04:59:20,708 console we're not doing anything so let's do that run user nothing happens 14885 04:59:20,708 --> 04:59:20,718 let's do that run user nothing happens 14886 04:59:20,718 --> 04:59:21,350 let's do that run user nothing happens because 14887 04:59:21,350 --> 04:59:21,360 because 14888 04:59:21,360 --> 04:59:23,590 because we need to print a message or some kind 14889 04:59:23,590 --> 04:59:23,600 we need to print a message or some kind 14890 04:59:23,600 --> 04:59:24,628 we need to print a message or some kind of information 14891 04:59:24,628 --> 04:59:24,638 of information 14892 04:59:24,638 --> 04:59:26,708 of information so what i'm going to do now is inside 14893 04:59:26,708 --> 04:59:26,718 so what i'm going to do now is inside 14894 04:59:26,718 --> 04:59:27,830 so what i'm going to do now is inside that class 14895 04:59:27,830 --> 04:59:27,840 that class 14896 04:59:27,840 --> 04:59:29,990 that class i'm going to create a function or a 14897 04:59:29,990 --> 04:59:30,000 i'm going to create a function or a 14898 04:59:30,000 --> 04:59:31,990 i'm going to create a function or a method as we learned now 14899 04:59:31,990 --> 04:59:32,000 method as we learned now 14900 04:59:32,000 --> 04:59:34,470 method as we learned now that basically prints back some user 14901 04:59:34,470 --> 04:59:34,480 that basically prints back some user 14902 04:59:34,480 --> 04:59:35,750 that basically prints back some user information right 14903 04:59:35,750 --> 04:59:35,760 information right 14904 04:59:35,760 --> 04:59:38,550 information right prints me the name email and current job 14905 04:59:38,550 --> 04:59:38,560 prints me the name email and current job 14906 04:59:38,560 --> 04:59:40,310 prints me the name email and current job title because we don't want to display 14907 04:59:40,310 --> 04:59:40,320 title because we don't want to display 14908 04:59:40,320 --> 04:59:43,270 title because we don't want to display password so let's give us some space 14909 04:59:43,270 --> 04:59:43,280 password so let's give us some space 14910 04:59:43,280 --> 04:59:43,670 password so let's give us some space here 14911 04:59:43,670 --> 04:59:43,680 here 14912 04:59:43,680 --> 04:59:47,030 here and let's create a function called get 14913 04:59:47,030 --> 04:59:47,040 and let's create a function called get 14914 04:59:47,040 --> 04:59:51,350 and let's create a function called get user info so that we can see something 14915 04:59:51,350 --> 04:59:51,360 user info so that we can see something 14916 04:59:51,360 --> 04:59:54,708 user info so that we can see something and again as soon as i typed in 14917 04:59:54,708 --> 04:59:54,718 and again as soon as i typed in 14918 04:59:54,718 --> 04:59:57,750 and again as soon as i typed in these first parentheses self got 14919 04:59:57,750 --> 04:59:57,760 these first parentheses self got 14920 04:59:57,760 --> 04:59:59,110 these first parentheses self got generated 14921 04:59:59,110 --> 04:59:59,120 generated 14922 04:59:59,120 --> 05:00:01,030 generated because we need self in every function 14923 05:00:01,030 --> 05:00:01,040 because we need self in every function 14924 05:00:01,040 --> 05:00:02,390 because we need self in every function within the class 14925 05:00:02,390 --> 05:00:02,400 within the class 14926 05:00:02,400 --> 05:00:06,470 within the class and in the function body we're gonna 14927 05:00:06,470 --> 05:00:06,480 and in the function body we're gonna 14928 05:00:06,480 --> 05:00:10,948 and in the function body we're gonna print user information 14929 05:00:10,948 --> 05:00:10,958 print user information 14930 05:00:10,958 --> 05:00:14,788 print user information so let's say user 14931 05:00:14,788 --> 05:00:14,798 so let's say user 14932 05:00:14,798 --> 05:00:17,350 so let's say user and name of the user which we can access 14933 05:00:17,350 --> 05:00:17,360 and name of the user which we can access 14934 05:00:17,360 --> 05:00:18,390 and name of the user which we can access using self 14935 05:00:18,390 --> 05:00:18,400 using self 14936 05:00:18,400 --> 05:00:20,948 using self remember all the attributes that the 14937 05:00:20,948 --> 05:00:20,958 remember all the attributes that the 14938 05:00:20,958 --> 05:00:23,190 remember all the attributes that the object has can be accessed with 14939 05:00:23,190 --> 05:00:23,200 object has can be accessed with 14940 05:00:23,200 --> 05:00:26,230 object has can be accessed with this special word here so self 14941 05:00:26,230 --> 05:00:26,240 this special word here so self 14942 05:00:26,240 --> 05:00:29,270 this special word here so self dot name 14943 05:00:29,270 --> 05:00:29,280 dot name 14944 05:00:29,280 --> 05:00:32,830 dot name so user whatever the user's name is 14945 05:00:32,830 --> 05:00:32,840 so user whatever the user's name is 14946 05:00:32,840 --> 05:00:35,670 so user whatever the user's name is currently works 14947 05:00:35,670 --> 05:00:35,680 currently works 14948 05:00:35,680 --> 05:00:40,948 currently works as a and now we need the job description 14949 05:00:40,948 --> 05:00:40,958 as a and now we need the job description 14950 05:00:40,958 --> 05:00:44,628 as a and now we need the job description or job title 14951 05:00:47,670 --> 05:00:47,680 and you can contact 14952 05:00:47,680 --> 05:00:51,350 and you can contact them at and now we can 14953 05:00:51,350 --> 05:00:51,360 them at and now we can 14954 05:00:51,360 --> 05:00:54,390 them at and now we can use the email 14955 05:00:57,190 --> 05:00:57,200 so this message will be printed for the 14956 05:00:57,200 --> 05:00:57,990 so this message will be printed for the user 14957 05:00:57,990 --> 05:00:58,000 user 14958 05:00:58,000 --> 05:01:01,430 user again because this will be used for 14959 05:01:01,430 --> 05:01:01,440 again because this will be used for 14960 05:01:01,440 --> 05:01:05,350 again because this will be used for any user of our application the message 14961 05:01:05,350 --> 05:01:05,360 any user of our application the message 14962 05:01:05,360 --> 05:01:07,430 any user of our application the message these parts will be the same but each 14963 05:01:07,430 --> 05:01:07,440 these parts will be the same but each 14964 05:01:07,440 --> 05:01:09,510 these parts will be the same but each user will have their own different name 14965 05:01:09,510 --> 05:01:09,520 user will have their own different name 14966 05:01:09,520 --> 05:01:11,830 user will have their own different name different job title and different email 14967 05:01:11,830 --> 05:01:11,840 different job title and different email 14968 05:01:11,840 --> 05:01:12,628 different job title and different email address 14969 05:01:12,628 --> 05:01:12,638 address 14970 05:01:12,638 --> 05:01:15,750 address so all of these are 14971 05:01:15,750 --> 05:01:15,760 so all of these are 14972 05:01:15,760 --> 05:01:17,670 so all of these are and written as variables because we 14973 05:01:17,670 --> 05:01:17,680 and written as variables because we 14974 05:01:17,680 --> 05:01:19,750 and written as variables because we don't know these values up front 14975 05:01:19,750 --> 05:01:19,760 don't know these values up front 14976 05:01:19,760 --> 05:01:23,670 don't know these values up front so now we can actually use this function 14977 05:01:23,670 --> 05:01:23,680 so now we can actually use this function 14978 05:01:23,680 --> 05:01:27,190 so now we can actually use this function or method to print out information of a 14979 05:01:27,190 --> 05:01:27,200 or method to print out information of a 14980 05:01:27,200 --> 05:01:28,070 or method to print out information of a specific 14981 05:01:28,070 --> 05:01:28,080 specific 14982 05:01:28,080 --> 05:01:31,750 specific user so how do we use or how do we call 14983 05:01:31,750 --> 05:01:31,760 user so how do we use or how do we call 14984 05:01:31,760 --> 05:01:33,510 user so how do we use or how do we call that function of the user 14985 05:01:33,510 --> 05:01:33,520 that function of the user 14986 05:01:33,520 --> 05:01:36,550 that function of the user we first save it into a variable 14987 05:01:36,550 --> 05:01:36,560 we first save it into a variable 14988 05:01:36,560 --> 05:01:40,310 we first save it into a variable app user one 14989 05:01:40,310 --> 05:01:40,320 app user one 14990 05:01:40,320 --> 05:01:42,390 app user one or nana doesn't really matter let's call 14991 05:01:42,390 --> 05:01:42,400 or nana doesn't really matter let's call 14992 05:01:42,400 --> 05:01:45,270 or nana doesn't really matter let's call it app user one so it's generic 14993 05:01:45,270 --> 05:01:45,280 it app user one so it's generic 14994 05:01:45,280 --> 05:01:49,030 it app user one so it's generic so how do we use that function 14995 05:01:49,030 --> 05:01:49,040 so how do we use that function 14996 05:01:49,040 --> 05:01:50,628 so how do we use that function to print out the information about the 14997 05:01:50,628 --> 05:01:50,638 to print out the information about the 14998 05:01:50,638 --> 05:01:52,470 to print out the information about the user if i do 14999 05:01:52,470 --> 05:01:52,480 user if i do 15000 05:01:52,480 --> 05:01:56,150 user if i do app user one and dot 15001 05:01:56,150 --> 05:01:56,160 app user one and dot 15002 05:01:56,160 --> 05:01:58,948 app user one and dot you see that i have the attributes here 15003 05:01:58,948 --> 05:01:58,958 you see that i have the attributes here 15004 05:01:58,958 --> 05:02:00,708 you see that i have the attributes here the four attributes that 15005 05:02:00,708 --> 05:02:00,718 the four attributes that 15006 05:02:00,718 --> 05:02:03,750 the four attributes that our user object has or user class 15007 05:02:03,750 --> 05:02:03,760 our user object has or user class 15008 05:02:03,760 --> 05:02:06,390 our user object has or user class and we have these three methods of the 15009 05:02:06,390 --> 05:02:06,400 and we have these three methods of the 15010 05:02:06,400 --> 05:02:07,750 and we have these three methods of the class get user infor 15011 05:02:07,750 --> 05:02:07,760 class get user infor 15012 05:02:07,760 --> 05:02:10,550 class get user infor change job title and change password so 15013 05:02:10,550 --> 05:02:10,560 change job title and change password so 15014 05:02:10,560 --> 05:02:11,270 change job title and change password so using get 15015 05:02:11,270 --> 05:02:11,280 using get 15016 05:02:11,280 --> 05:02:17,030 using get info we can call this function 15017 05:02:19,990 --> 05:02:20,000 and if i execute this right here you see 15018 05:02:20,000 --> 05:02:20,868 and if i execute this right here you see user 15019 05:02:20,868 --> 05:02:20,878 user 15020 05:02:20,878 --> 05:02:23,510 user nanogenasia currently works as a devops 15021 05:02:23,510 --> 05:02:23,520 nanogenasia currently works as a devops 15022 05:02:23,520 --> 05:02:24,230 nanogenasia currently works as a devops engineer 15023 05:02:24,230 --> 05:02:24,240 engineer 15024 05:02:24,240 --> 05:02:27,670 engineer you can contact them at this email 15025 05:02:27,670 --> 05:02:27,680 you can contact them at this email 15026 05:02:27,680 --> 05:02:30,948 you can contact them at this email and now let's say we want to change 15027 05:02:30,948 --> 05:02:30,958 and now let's say we want to change 15028 05:02:30,958 --> 05:02:33,990 and now let's say we want to change job title of that user we do that in the 15029 05:02:33,990 --> 05:02:34,000 job title of that user we do that in the 15030 05:02:34,000 --> 05:02:35,270 job title of that user we do that in the same way 15031 05:02:35,270 --> 05:02:35,280 same way 15032 05:02:35,280 --> 05:02:38,310 same way app user one dot 15033 05:02:38,310 --> 05:02:38,320 app user one dot 15034 05:02:38,320 --> 05:02:41,830 app user one dot change job title and 15035 05:02:41,830 --> 05:02:41,840 change job title and 15036 05:02:41,840 --> 05:02:44,390 change job title and we're gonna provide the job title 15037 05:02:44,390 --> 05:02:44,400 we're gonna provide the job title 15038 05:02:44,400 --> 05:02:45,190 we're gonna provide the job title parameter 15039 05:02:45,190 --> 05:02:45,200 parameter 15040 05:02:45,200 --> 05:02:47,030 parameter note that even though you see two 15041 05:02:47,030 --> 05:02:47,040 note that even though you see two 15042 05:02:47,040 --> 05:02:48,788 note that even though you see two parameters here on that function 15043 05:02:48,788 --> 05:02:48,798 parameters here on that function 15044 05:02:48,798 --> 05:02:50,948 parameters here on that function this first parameter is passed in 15045 05:02:50,948 --> 05:02:50,958 this first parameter is passed in 15046 05:02:50,958 --> 05:02:53,270 this first parameter is passed in automatically so we don't have to 15047 05:02:53,270 --> 05:02:53,280 automatically so we don't have to 15048 05:02:53,280 --> 05:02:55,110 automatically so we don't have to basically pass that self right it's 15049 05:02:55,110 --> 05:02:55,120 basically pass that self right it's 15050 05:02:55,120 --> 05:02:57,270 basically pass that self right it's already done automatically we just have 15051 05:02:57,270 --> 05:02:57,280 already done automatically we just have 15052 05:02:57,280 --> 05:02:59,350 already done automatically we just have to worry about these parameters 15053 05:02:59,350 --> 05:02:59,360 to worry about these parameters 15054 05:02:59,360 --> 05:03:03,190 to worry about these parameters so new job title is let's say 15055 05:03:03,190 --> 05:03:03,200 so new job title is let's say 15056 05:03:03,200 --> 05:03:07,030 so new job title is let's say devops trainer 15057 05:03:10,390 --> 05:03:10,400 and now we can call that 15058 05:03:10,400 --> 05:03:13,430 and now we can call that user info method again 15059 05:03:13,430 --> 05:03:13,440 user info method again 15060 05:03:13,440 --> 05:03:16,948 user info method again and execute and you see first 15061 05:03:16,948 --> 05:03:16,958 and execute and you see first 15062 05:03:16,958 --> 05:03:19,030 and execute and you see first message printed here before we change 15063 05:03:19,030 --> 05:03:19,040 message printed here before we change 15064 05:03:19,040 --> 05:03:20,390 message printed here before we change the job title 15065 05:03:20,390 --> 05:03:20,400 the job title 15066 05:03:20,400 --> 05:03:23,830 the job title now it's devops trainer 15067 05:03:23,830 --> 05:03:23,840 now it's devops trainer 15068 05:03:23,840 --> 05:03:26,948 now it's devops trainer so that's how we can create a new 15069 05:03:26,948 --> 05:03:26,958 so that's how we can create a new 15070 05:03:26,958 --> 05:03:30,070 so that's how we can create a new object from a class and we can 15071 05:03:30,070 --> 05:03:30,080 object from a class and we can 15072 05:03:30,080 --> 05:03:32,708 object from a class and we can use methods of that object by first 15073 05:03:32,708 --> 05:03:32,718 use methods of that object by first 15074 05:03:32,718 --> 05:03:34,470 use methods of that object by first saving that object into a variable and 15075 05:03:34,470 --> 05:03:34,480 saving that object into a variable and 15076 05:03:34,480 --> 05:03:36,310 saving that object into a variable and then calling that function 15077 05:03:36,310 --> 05:03:36,320 then calling that function 15078 05:03:36,320 --> 05:03:39,750 then calling that function on that variable and obviously now this 15079 05:03:39,750 --> 05:03:39,760 on that variable and obviously now this 15080 05:03:39,760 --> 05:03:40,310 on that variable and obviously now this is just 15081 05:03:40,310 --> 05:03:40,320 is just 15082 05:03:40,320 --> 05:03:45,910 is just one user but if we had another one 15083 05:03:50,868 --> 05:03:50,878 user two that's actually 15084 05:03:50,878 --> 05:03:54,550 user two that's actually clean this up we can create 15085 05:03:54,550 --> 05:03:54,560 clean this up we can create 15086 05:03:54,560 --> 05:03:57,990 clean this up we can create a new user with different values 15087 05:03:57,990 --> 05:03:58,000 a new user with different values 15088 05:03:58,000 --> 05:04:04,070 a new user with different values like this 15089 05:04:04,070 --> 05:04:04,080 like this 15090 05:04:04,080 --> 05:04:08,070 like this they have their own email 15091 05:04:19,430 --> 05:04:19,440 own password and on 15092 05:04:19,440 --> 05:04:23,990 own password and on job title and again 15093 05:04:27,670 --> 05:04:27,680 we can create that user and basically 15094 05:04:27,680 --> 05:04:30,628 we can create that user and basically just use the methods defined in the 15095 05:04:30,628 --> 05:04:30,638 just use the methods defined in the 15096 05:04:30,638 --> 05:04:31,590 just use the methods defined in the class 15097 05:04:31,590 --> 05:04:31,600 class 15098 05:04:31,600 --> 05:04:34,628 class and in two different cases or for two 15099 05:04:34,628 --> 05:04:34,638 and in two different cases or for two 15100 05:04:34,638 --> 05:04:35,830 and in two different cases or for two different users 15101 05:04:35,830 --> 05:04:35,840 different users 15102 05:04:35,840 --> 05:04:38,150 different users obviously the user info will be 15103 05:04:38,150 --> 05:04:38,160 obviously the user info will be 15104 05:04:38,160 --> 05:04:39,030 obviously the user info will be different 15105 05:04:39,030 --> 05:04:39,040 different 15106 05:04:39,040 --> 05:04:41,590 different so let's execute this and right here you 15107 05:04:41,590 --> 05:04:41,600 so let's execute this and right here you 15108 05:04:41,600 --> 05:04:43,670 so let's execute this and right here you see the user 15109 05:04:43,670 --> 05:04:43,680 see the user 15110 05:04:43,680 --> 05:04:46,708 see the user information for both users and obviously 15111 05:04:46,708 --> 05:04:46,718 information for both users and obviously 15112 05:04:46,718 --> 05:04:48,150 information for both users and obviously if you have an application like 15113 05:04:48,150 --> 05:04:48,160 if you have an application like 15114 05:04:48,160 --> 05:04:50,070 if you have an application like linkedin you don't have two users or a 15115 05:04:50,070 --> 05:04:50,080 linkedin you don't have two users or a 15116 05:04:50,080 --> 05:04:51,190 linkedin you don't have two users or a thousand users 15117 05:04:51,190 --> 05:04:51,200 thousand users 15118 05:04:51,200 --> 05:04:53,830 thousand users you probably have millions of users and 15119 05:04:53,830 --> 05:04:53,840 you probably have millions of users and 15120 05:04:53,840 --> 05:04:54,470 you probably have millions of users and having 15121 05:04:54,470 --> 05:04:54,480 having 15122 05:04:54,480 --> 05:04:57,910 having a user definition once and 15123 05:04:57,910 --> 05:04:57,920 a user definition once and 15124 05:04:57,920 --> 05:05:00,788 a user definition once and reusing it every time a new user gets 15125 05:05:00,788 --> 05:05:00,798 reusing it every time a new user gets 15126 05:05:00,798 --> 05:05:02,150 reusing it every time a new user gets created or 15127 05:05:02,150 --> 05:05:02,160 created or 15128 05:05:02,160 --> 05:05:04,948 created or basically existing users do something in 15129 05:05:04,948 --> 05:05:04,958 basically existing users do something in 15130 05:05:04,958 --> 05:05:06,230 basically existing users do something in application 15131 05:05:06,230 --> 05:05:06,240 application 15132 05:05:06,240 --> 05:05:09,350 application is only possible when using classes 15133 05:05:09,350 --> 05:05:09,360 is only possible when using classes 15134 05:05:09,360 --> 05:05:11,990 is only possible when using classes and objects instead of just having all 15135 05:05:11,990 --> 05:05:12,000 and objects instead of just having all 15136 05:05:12,000 --> 05:05:13,110 and objects instead of just having all these logic 15137 05:05:13,110 --> 05:05:13,120 these logic 15138 05:05:13,120 --> 05:05:16,550 these logic non-structured throughout the code and 15139 05:05:16,550 --> 05:05:16,560 non-structured throughout the code and 15140 05:05:16,560 --> 05:05:19,750 non-structured throughout the code and again in this type of applications 15141 05:05:19,750 --> 05:05:19,760 again in this type of applications 15142 05:05:19,760 --> 05:05:22,070 again in this type of applications you would not have four attributes and 15143 05:05:22,070 --> 05:05:22,080 you would not have four attributes and 15144 05:05:22,080 --> 05:05:23,750 you would not have four attributes and three methods you will have 15145 05:05:23,750 --> 05:05:23,760 three methods you will have 15146 05:05:23,760 --> 05:05:25,910 three methods you will have probably hundreds of attributes and 15147 05:05:25,910 --> 05:05:25,920 probably hundreds of attributes and 15148 05:05:25,920 --> 05:05:27,110 probably hundreds of attributes and hundreds of such 15149 05:05:27,110 --> 05:05:27,120 hundreds of such 15150 05:05:27,120 --> 05:05:30,788 hundreds of such methods now as you see here 15151 05:05:30,788 --> 05:05:30,798 methods now as you see here 15152 05:05:30,798 --> 05:05:34,310 methods now as you see here we have created this user.pi 15153 05:05:34,310 --> 05:05:34,320 we have created this user.pi 15154 05:05:34,320 --> 05:05:37,030 we have created this user.pi file for user class but we're also 15155 05:05:37,030 --> 05:05:37,040 file for user class but we're also 15156 05:05:37,040 --> 05:05:38,150 file for user class but we're also creating these 15157 05:05:38,150 --> 05:05:38,160 creating these 15158 05:05:38,160 --> 05:05:40,708 creating these objects in the same file which actually 15159 05:05:40,708 --> 05:05:40,718 objects in the same file which actually 15160 05:05:40,718 --> 05:05:41,990 objects in the same file which actually doesn't make sense because 15161 05:05:41,990 --> 05:05:42,000 doesn't make sense because 15162 05:05:42,000 --> 05:05:44,708 doesn't make sense because the file should be only for defining the 15163 05:05:44,708 --> 05:05:44,718 the file should be only for defining the 15164 05:05:44,718 --> 05:05:45,670 the file should be only for defining the class right 15165 05:05:45,670 --> 05:05:45,680 class right 15166 05:05:45,680 --> 05:05:47,750 class right so all of this logic actually needs to 15167 05:05:47,750 --> 05:05:47,760 so all of this logic actually needs to 15168 05:05:47,760 --> 05:05:49,830 so all of this logic actually needs to move out from here 15169 05:05:49,830 --> 05:05:49,840 move out from here 15170 05:05:49,840 --> 05:05:53,030 move out from here and this should be just only for class 15171 05:05:53,030 --> 05:05:53,040 and this should be just only for class 15172 05:05:53,040 --> 05:05:54,230 and this should be just only for class definition 15173 05:05:54,230 --> 05:05:54,240 definition 15174 05:05:54,240 --> 05:05:57,030 definition so in the application again using an 15175 05:05:57,030 --> 05:05:57,040 so in the application again using an 15176 05:05:57,040 --> 05:05:58,390 so in the application again using an example of linkedin 15177 05:05:58,390 --> 05:05:58,400 example of linkedin 15178 05:05:58,400 --> 05:06:01,190 example of linkedin we would have class user and then we 15179 05:06:01,190 --> 05:06:01,200 we would have class user and then we 15180 05:06:01,200 --> 05:06:01,990 we would have class user and then we would have 15181 05:06:01,990 --> 05:06:02,000 would have 15182 05:06:02,000 --> 05:06:05,110 would have a class post right whenever someone 15183 05:06:05,110 --> 05:06:05,120 a class post right whenever someone 15184 05:06:05,120 --> 05:06:07,030 a class post right whenever someone posts something 15185 05:06:07,030 --> 05:06:07,040 posts something 15186 05:06:07,040 --> 05:06:09,430 posts something each post will have their own attributes 15187 05:06:09,430 --> 05:06:09,440 each post will have their own attributes 15188 05:06:09,440 --> 05:06:11,030 each post will have their own attributes like the actual 15189 05:06:11,030 --> 05:06:11,040 like the actual 15190 05:06:11,040 --> 05:06:14,310 like the actual message or text in that post the author 15191 05:06:14,310 --> 05:06:14,320 message or text in that post the author 15192 05:06:14,320 --> 05:06:16,948 message or text in that post the author who wrote the post how many likes it has 15193 05:06:16,948 --> 05:06:16,958 who wrote the post how many likes it has 15194 05:06:16,958 --> 05:06:17,670 who wrote the post how many likes it has etc 15195 05:06:17,670 --> 05:06:17,680 etc 15196 05:06:17,680 --> 05:06:20,550 etc as well as specific functions right for 15197 05:06:20,550 --> 05:06:20,560 as well as specific functions right for 15198 05:06:20,560 --> 05:06:21,270 as well as specific functions right for example 15199 05:06:21,270 --> 05:06:21,280 example 15200 05:06:21,280 --> 05:06:23,750 example changing the post commenting on the post 15201 05:06:23,750 --> 05:06:23,760 changing the post commenting on the post 15202 05:06:23,760 --> 05:06:24,628 changing the post commenting on the post etc 15203 05:06:24,628 --> 05:06:24,638 etc 15204 05:06:24,638 --> 05:06:27,990 etc so you will have separate file for each 15205 05:06:27,990 --> 05:06:28,000 so you will have separate file for each 15206 05:06:28,000 --> 05:06:30,948 so you will have separate file for each such class right in the application and 15207 05:06:30,948 --> 05:06:30,958 such class right in the application and 15208 05:06:30,958 --> 05:06:32,070 such class right in the application and then you would have 15209 05:06:32,070 --> 05:06:32,080 then you would have 15210 05:06:32,080 --> 05:06:34,470 then you would have one file somewhere else this could be a 15211 05:06:34,470 --> 05:06:34,480 one file somewhere else this could be a 15212 05:06:34,480 --> 05:06:35,830 one file somewhere else this could be a main dot pi 15213 05:06:35,830 --> 05:06:35,840 main dot pi 15214 05:06:35,840 --> 05:06:37,590 main dot pi where you would actually use all those 15215 05:06:37,590 --> 05:06:37,600 where you would actually use all those 15216 05:06:37,600 --> 05:06:39,350 where you would actually use all those different classes and create 15217 05:06:39,350 --> 05:06:39,360 different classes and create 15218 05:06:39,360 --> 05:06:41,510 different classes and create objects from those classes and that 15219 05:06:41,510 --> 05:06:41,520 objects from those classes and that 15220 05:06:41,520 --> 05:06:44,070 objects from those classes and that means that logic that we wrote here 15221 05:06:44,070 --> 05:06:44,080 means that logic that we wrote here 15222 05:06:44,080 --> 05:06:46,310 means that logic that we wrote here constructing a user object and then 15223 05:06:46,310 --> 05:06:46,320 constructing a user object and then 15224 05:06:46,320 --> 05:06:48,150 constructing a user object and then calling some functions on that 15225 05:06:48,150 --> 05:06:48,160 calling some functions on that 15226 05:06:48,160 --> 05:06:51,110 calling some functions on that will actually happen in another file in 15227 05:06:51,110 --> 05:06:51,120 will actually happen in another file in 15228 05:06:51,120 --> 05:06:52,230 will actually happen in another file in our case let's use 15229 05:06:52,230 --> 05:06:52,240 our case let's use 15230 05:06:52,240 --> 05:06:54,788 our case let's use main.pi and now let's see how we're 15231 05:06:54,788 --> 05:06:54,798 main.pi and now let's see how we're 15232 05:06:54,798 --> 05:06:55,670 main.pi and now let's see how we're going to do that 15233 05:06:55,670 --> 05:06:55,680 going to do that 15234 05:06:55,680 --> 05:06:58,070 going to do that i'm going to paste in the code that i 15235 05:06:58,070 --> 05:06:58,080 i'm going to paste in the code that i 15236 05:06:58,080 --> 05:06:59,670 i'm going to paste in the code that i copied from there 15237 05:06:59,670 --> 05:06:59,680 copied from there 15238 05:06:59,680 --> 05:07:02,708 copied from there and as soon as i paste in you see those 15239 05:07:02,708 --> 05:07:02,718 and as soon as i paste in you see those 15240 05:07:02,718 --> 05:07:03,510 and as soon as i paste in you see those red lines 15241 05:07:03,510 --> 05:07:03,520 red lines 15242 05:07:03,520 --> 05:07:07,270 red lines so basically main.pi says that it cannot 15243 05:07:07,270 --> 05:07:07,280 so basically main.pi says that it cannot 15244 05:07:07,280 --> 05:07:07,910 so basically main.pi says that it cannot find 15245 05:07:07,910 --> 05:07:07,920 find 15246 05:07:07,920 --> 05:07:10,550 find a reference to user so this file doesn't 15247 05:07:10,550 --> 05:07:10,560 a reference to user so this file doesn't 15248 05:07:10,560 --> 05:07:12,868 a reference to user so this file doesn't know anything about the user class 15249 05:07:12,868 --> 05:07:12,878 know anything about the user class 15250 05:07:12,878 --> 05:07:15,350 know anything about the user class so how do we fix that or how do we make 15251 05:07:15,350 --> 05:07:15,360 so how do we fix that or how do we make 15252 05:07:15,360 --> 05:07:17,350 so how do we fix that or how do we make this user class available 15253 05:07:17,350 --> 05:07:17,360 this user class available 15254 05:07:17,360 --> 05:07:20,708 this user class available in another file and if you remember 15255 05:07:20,708 --> 05:07:20,718 in another file and if you remember 15256 05:07:20,718 --> 05:07:23,190 in another file and if you remember when we needed to use modules or 15257 05:07:23,190 --> 05:07:23,200 when we needed to use modules or 15258 05:07:23,200 --> 05:07:24,390 when we needed to use modules or basically functions 15259 05:07:24,390 --> 05:07:24,400 basically functions 15260 05:07:24,400 --> 05:07:26,868 basically functions variables whatever from other files in 15261 05:07:26,868 --> 05:07:26,878 variables whatever from other files in 15262 05:07:26,878 --> 05:07:27,750 variables whatever from other files in python 15263 05:07:27,750 --> 05:07:27,760 python 15264 05:07:27,760 --> 05:07:30,868 python we use import to basically import those 15265 05:07:30,868 --> 05:07:30,878 we use import to basically import those 15266 05:07:30,878 --> 05:07:31,590 we use import to basically import those functions 15267 05:07:31,590 --> 05:07:31,600 functions 15268 05:07:31,600 --> 05:07:34,150 functions and make them available here or import 15269 05:07:34,150 --> 05:07:34,160 and make them available here or import 15270 05:07:34,160 --> 05:07:35,350 and make them available here or import the whole module 15271 05:07:35,350 --> 05:07:35,360 the whole module 15272 05:07:35,360 --> 05:07:37,110 the whole module to make its functions and variables 15273 05:07:37,110 --> 05:07:37,120 to make its functions and variables 15274 05:07:37,120 --> 05:07:38,390 to make its functions and variables available here 15275 05:07:38,390 --> 05:07:38,400 available here 15276 05:07:38,400 --> 05:07:41,910 available here and the same way we can import classes 15277 05:07:41,910 --> 05:07:41,920 and the same way we can import classes 15278 05:07:41,920 --> 05:07:45,510 and the same way we can import classes from another file import 15279 05:07:45,510 --> 05:07:45,520 from another file import 15280 05:07:45,520 --> 05:07:48,708 from another file import user and note here that i'm using the 15281 05:07:48,708 --> 05:07:48,718 user and note here that i'm using the 15282 05:07:48,718 --> 05:07:50,310 user and note here that i'm using the name of the file 15283 05:07:50,310 --> 05:07:50,320 name of the file 15284 05:07:50,320 --> 05:07:53,190 name of the file user lowercase and not the class name 15285 05:07:53,190 --> 05:07:53,200 user lowercase and not the class name 15286 05:07:53,200 --> 05:07:54,708 user lowercase and not the class name with capital user right 15287 05:07:54,708 --> 05:07:54,718 with capital user right 15288 05:07:54,718 --> 05:07:58,150 with capital user right so we are importing that file so now we 15289 05:07:58,150 --> 05:07:58,160 so we are importing that file so now we 15290 05:07:58,160 --> 05:07:59,350 so we are importing that file so now we can use 15291 05:07:59,350 --> 05:07:59,360 can use 15292 05:07:59,360 --> 05:08:01,590 can use anything that is defined in that file 15293 05:08:01,590 --> 05:08:01,600 anything that is defined in that file 15294 05:08:01,600 --> 05:08:02,470 anything that is defined in that file and one of them 15295 05:08:02,470 --> 05:08:02,480 and one of them 15296 05:08:02,480 --> 05:08:06,628 and one of them is class called user and the way we can 15297 05:08:06,628 --> 05:08:06,638 is class called user and the way we can 15298 05:08:06,638 --> 05:08:10,150 is class called user and the way we can access that class now is using the name 15299 05:08:10,150 --> 05:08:10,160 access that class now is using the name 15300 05:08:10,160 --> 05:08:13,910 access that class now is using the name of module and not the class 15301 05:08:13,910 --> 05:08:13,920 of module and not the class 15302 05:08:13,920 --> 05:08:16,788 of module and not the class user itself and this is basically 15303 05:08:16,788 --> 05:08:16,798 user itself and this is basically 15304 05:08:16,798 --> 05:08:18,550 user itself and this is basically exactly the same concept as we saw 15305 05:08:18,550 --> 05:08:18,560 exactly the same concept as we saw 15306 05:08:18,560 --> 05:08:19,430 exactly the same concept as we saw before 15307 05:08:19,430 --> 05:08:19,440 before 15308 05:08:19,440 --> 05:08:22,550 before because we are importing a module called 15309 05:08:22,550 --> 05:08:22,560 because we are importing a module called 15310 05:08:22,560 --> 05:08:23,110 because we are importing a module called user 15311 05:08:23,110 --> 05:08:23,120 user 15312 05:08:23,120 --> 05:08:26,390 user remember every python file that has 15313 05:08:26,390 --> 05:08:26,400 remember every python file that has 15314 05:08:26,400 --> 05:08:29,990 remember every python file that has functions or variables or classes inside 15315 05:08:29,990 --> 05:08:30,000 functions or variables or classes inside 15316 05:08:30,000 --> 05:08:33,750 functions or variables or classes inside is a module so we are importing a module 15317 05:08:33,750 --> 05:08:33,760 is a module so we are importing a module 15318 05:08:33,760 --> 05:08:36,310 is a module so we are importing a module and once we have that module imported 15319 05:08:36,310 --> 05:08:36,320 and once we have that module imported 15320 05:08:36,320 --> 05:08:37,590 and once we have that module imported now we can use 15321 05:08:37,590 --> 05:08:37,600 now we can use 15322 05:08:37,600 --> 05:08:40,150 now we can use and access functions variables or 15323 05:08:40,150 --> 05:08:40,160 and access functions variables or 15324 05:08:40,160 --> 05:08:41,110 and access functions variables or classes 15325 05:08:41,110 --> 05:08:41,120 classes 15326 05:08:41,120 --> 05:08:43,430 classes of that module and we can do that by 15327 05:08:43,430 --> 05:08:43,440 of that module and we can do that by 15328 05:08:43,440 --> 05:08:45,590 of that module and we can do that by copying the name of the module 15329 05:08:45,590 --> 05:08:45,600 copying the name of the module 15330 05:08:45,600 --> 05:08:48,628 copying the name of the module dot and there you go in the same way 15331 05:08:48,628 --> 05:08:48,638 dot and there you go in the same way 15332 05:08:48,638 --> 05:08:51,910 dot and there you go in the same way here so exactly the same concept whether 15333 05:08:51,910 --> 05:08:51,920 here so exactly the same concept whether 15334 05:08:51,920 --> 05:08:54,788 here so exactly the same concept whether this is a function or a class doesn't 15335 05:08:54,788 --> 05:08:54,798 this is a function or a class doesn't 15336 05:08:54,798 --> 05:08:55,270 this is a function or a class doesn't matter 15337 05:08:55,270 --> 05:08:55,280 matter 15338 05:08:55,280 --> 05:08:57,510 matter we use it the same way remember when we 15339 05:08:57,510 --> 05:08:57,520 we use it the same way remember when we 15340 05:08:57,520 --> 05:08:58,470 we use it the same way remember when we use the date 15341 05:08:58,470 --> 05:08:58,480 use the date 15342 05:08:58,480 --> 05:09:01,230 use the date time module with the syntax 15343 05:09:01,230 --> 05:09:01,240 time module with the syntax 15344 05:09:01,240 --> 05:09:02,470 time module with the syntax datetime.daytime 15345 05:09:02,470 --> 05:09:02,480 datetime.daytime 15346 05:09:02,480 --> 05:09:06,390 datetime.daytime and that was an example of using a class 15347 05:09:06,390 --> 05:09:06,400 and that was an example of using a class 15348 05:09:06,400 --> 05:09:09,430 and that was an example of using a class from a module now user.user may 15349 05:09:09,430 --> 05:09:09,440 from a module now user.user may 15350 05:09:09,440 --> 05:09:12,310 from a module now user.user may look a little bit weird so we can use 15351 05:09:12,310 --> 05:09:12,320 look a little bit weird so we can use 15352 05:09:12,320 --> 05:09:13,590 look a little bit weird so we can use our 15353 05:09:13,590 --> 05:09:13,600 our 15354 05:09:13,600 --> 05:09:16,948 our familiar import statement where instead 15355 05:09:16,948 --> 05:09:16,958 familiar import statement where instead 15356 05:09:16,958 --> 05:09:17,190 familiar import statement where instead of 15357 05:09:17,190 --> 05:09:17,200 of 15358 05:09:17,200 --> 05:09:19,670 of importing the whole module we can pick 15359 05:09:19,670 --> 05:09:19,680 importing the whole module we can pick 15360 05:09:19,680 --> 05:09:21,910 importing the whole module we can pick and choose and import specific 15361 05:09:21,910 --> 05:09:21,920 and choose and import specific 15362 05:09:21,920 --> 05:09:24,550 and choose and import specific definitions or specific elements of that 15363 05:09:24,550 --> 05:09:24,560 definitions or specific elements of that 15364 05:09:24,560 --> 05:09:25,030 definitions or specific elements of that module 15365 05:09:25,030 --> 05:09:25,040 module 15366 05:09:25,040 --> 05:09:26,788 module in our case we just have one element 15367 05:09:26,788 --> 05:09:26,798 in our case we just have one element 15368 05:09:26,798 --> 05:09:28,070 in our case we just have one element which is the class 15369 05:09:28,070 --> 05:09:28,080 which is the class 15370 05:09:28,080 --> 05:09:30,788 which is the class so we're going to say from user module 15371 05:09:30,788 --> 05:09:30,798 so we're going to say from user module 15372 05:09:30,798 --> 05:09:31,750 so we're going to say from user module import 15373 05:09:31,750 --> 05:09:31,760 import 15374 05:09:31,760 --> 05:09:35,110 import user class and now we don't need the 15375 05:09:35,110 --> 05:09:35,120 user class and now we don't need the 15376 05:09:35,120 --> 05:09:37,670 user class and now we don't need the module name anymore because we imported 15377 05:09:37,670 --> 05:09:37,680 module name anymore because we imported 15378 05:09:37,680 --> 05:09:38,150 module name anymore because we imported the 15379 05:09:38,150 --> 05:09:38,160 the 15380 05:09:38,160 --> 05:09:41,670 the class itself and now if we 15381 05:09:41,670 --> 05:09:41,680 class itself and now if we 15382 05:09:41,680 --> 05:09:45,670 class itself and now if we execute main dot p y 15383 05:09:45,670 --> 05:09:45,680 execute main dot p y 15384 05:09:45,680 --> 05:09:48,628 execute main dot p y let's do it again here we have the same 15385 05:09:48,628 --> 05:09:48,638 let's do it again here we have the same 15386 05:09:48,638 --> 05:09:49,270 let's do it again here we have the same result 15387 05:09:49,270 --> 05:09:49,280 result 15388 05:09:49,280 --> 05:09:54,550 result for two of our users 15389 05:09:54,550 --> 05:09:54,560 for two of our users 15390 05:09:54,560 --> 05:09:57,030 for two of our users and again as i said in applications you 15391 05:09:57,030 --> 05:09:57,040 and again as i said in applications you 15392 05:09:57,040 --> 05:09:59,270 and again as i said in applications you will have multiple classes 15393 05:09:59,270 --> 05:09:59,280 will have multiple classes 15394 05:09:59,280 --> 05:10:01,750 will have multiple classes that are connected to each other so for 15395 05:10:01,750 --> 05:10:01,760 that are connected to each other so for 15396 05:10:01,760 --> 05:10:03,910 that are connected to each other so for example if we have a post here 15397 05:10:03,910 --> 05:10:03,920 example if we have a post here 15398 05:10:03,920 --> 05:10:06,788 example if we have a post here post blueprint basically whenever a new 15399 05:10:06,788 --> 05:10:06,798 post blueprint basically whenever a new 15400 05:10:06,798 --> 05:10:08,070 post blueprint basically whenever a new post gets created 15401 05:10:08,070 --> 05:10:08,080 post gets created 15402 05:10:08,080 --> 05:10:10,470 post gets created with some specific values like the 15403 05:10:10,470 --> 05:10:10,480 with some specific values like the 15404 05:10:10,480 --> 05:10:11,510 with some specific values like the actual message 15405 05:10:11,510 --> 05:10:11,520 actual message 15406 05:10:11,520 --> 05:10:14,628 actual message and creation date time etc 15407 05:10:14,628 --> 05:10:14,638 and creation date time etc 15408 05:10:14,638 --> 05:10:17,110 and creation date time etc it will also have an author and that 15409 05:10:17,110 --> 05:10:17,120 it will also have an author and that 15410 05:10:17,120 --> 05:10:17,830 it will also have an author and that author will 15411 05:10:17,830 --> 05:10:17,840 author will 15412 05:10:17,840 --> 05:10:20,310 author will actually be one of those user objects 15413 05:10:20,310 --> 05:10:20,320 actually be one of those user objects 15414 05:10:20,320 --> 05:10:21,190 actually be one of those user objects right 15415 05:10:21,190 --> 05:10:21,200 right 15416 05:10:21,200 --> 05:10:23,590 right so you will have some functions here 15417 05:10:23,590 --> 05:10:23,600 so you will have some functions here 15418 05:10:23,600 --> 05:10:24,788 so you will have some functions here that actually 15419 05:10:24,788 --> 05:10:24,798 that actually 15420 05:10:24,798 --> 05:10:28,150 that actually reference the post and we can also see 15421 05:10:28,150 --> 05:10:28,160 reference the post and we can also see 15422 05:10:28,160 --> 05:10:29,270 reference the post and we can also see that in action 15423 05:10:29,270 --> 05:10:29,280 that in action 15424 05:10:29,280 --> 05:10:35,990 that in action let's actually create a post class 15425 05:10:35,990 --> 05:10:36,000 let's actually create a post class 15426 05:10:36,000 --> 05:10:38,070 let's actually create a post class let's give it just two attributes to 15427 05:10:38,070 --> 05:10:38,080 let's give it just two attributes to 15428 05:10:38,080 --> 05:10:39,110 let's give it just two attributes to keep it simple 15429 05:10:39,110 --> 05:10:39,120 keep it simple 15430 05:10:39,120 --> 05:10:43,110 keep it simple so we need a constructor here 15431 05:10:43,110 --> 05:10:43,120 so we need a constructor here 15432 05:10:43,120 --> 05:10:47,270 so we need a constructor here in it 15433 05:10:50,948 --> 05:10:50,958 and we're gonna pass in message 15434 05:10:50,958 --> 05:10:53,430 and we're gonna pass in message and author right this is gonna be the 15435 05:10:53,430 --> 05:10:53,440 and author right this is gonna be the 15436 05:10:53,440 --> 05:10:55,750 and author right this is gonna be the user who wrote it 15437 05:10:55,750 --> 05:10:55,760 user who wrote it 15438 05:10:55,760 --> 05:11:09,430 user who wrote it and you know the drill already 15439 05:11:12,470 --> 05:11:12,480 and let's create another function 15440 05:11:12,480 --> 05:11:15,510 and let's create another function which displays a post with its 15441 05:11:15,510 --> 05:11:15,520 which displays a post with its 15442 05:11:15,520 --> 05:11:19,510 which displays a post with its respective author so let's do get 15443 05:11:19,510 --> 05:11:19,520 respective author so let's do get 15444 05:11:19,520 --> 05:11:23,030 respective author so let's do get post info 15445 05:11:23,030 --> 05:11:23,040 post info 15446 05:11:23,040 --> 05:11:30,830 post info again we have self here and let's print 15447 05:11:43,270 --> 05:11:43,280 and the author name so this is going to 15448 05:11:43,280 --> 05:11:44,390 and the author name so this is going to be our simple 15449 05:11:44,390 --> 05:11:44,400 be our simple 15450 05:11:44,400 --> 05:11:47,430 be our simple post class and user 15451 05:11:47,430 --> 05:11:47,440 post class and user 15452 05:11:47,440 --> 05:11:49,990 post class and user is able to create new posts so we have 15453 05:11:49,990 --> 05:11:50,000 is able to create new posts so we have 15454 05:11:50,000 --> 05:11:52,150 is able to create new posts so we have the blueprint for a post 15455 05:11:52,150 --> 05:11:52,160 the blueprint for a post 15456 05:11:52,160 --> 05:11:56,470 the blueprint for a post and the same way we can create that post 15457 05:11:56,470 --> 05:11:56,480 and the same way we can create that post 15458 05:11:56,480 --> 05:11:59,750 and the same way we can create that post inside the main dot pi so first let's 15459 05:11:59,750 --> 05:11:59,760 inside the main dot pi so first let's 15460 05:11:59,760 --> 05:12:02,788 inside the main dot pi so first let's import 15461 05:12:10,230 --> 05:12:10,240 and then here we're going to create a 15462 05:12:10,240 --> 05:12:11,590 and then here we're going to create a new post 15463 05:12:11,590 --> 05:12:11,600 new post 15464 05:12:11,600 --> 05:12:14,070 new post in pycharm you get this nice display of 15465 05:12:14,070 --> 05:12:14,080 in pycharm you get this nice display of 15466 05:12:14,080 --> 05:12:14,948 in pycharm you get this nice display of parameters 15467 05:12:14,948 --> 05:12:14,958 parameters 15468 05:12:14,958 --> 05:12:18,310 parameters that function or class basically 15469 05:12:18,310 --> 05:12:18,320 that function or class basically 15470 05:12:18,320 --> 05:12:21,510 that function or class basically expects so we have message and author 15471 05:12:21,510 --> 05:12:21,520 expects so we have message and author 15472 05:12:21,520 --> 05:12:27,430 expects so we have message and author let's do some 15473 05:12:29,910 --> 05:12:29,920 message or post and as a second 15474 05:12:29,920 --> 05:12:31,030 message or post and as a second parameter 15475 05:12:31,030 --> 05:12:31,040 parameter 15476 05:12:31,040 --> 05:12:36,230 parameter we have the author and we can use 15477 05:12:36,230 --> 05:12:36,240 we have the author and we can use 15478 05:12:36,240 --> 05:12:41,110 we have the author and we can use the name of a user so let's do 15479 05:12:41,110 --> 05:12:41,120 the name of a user so let's do 15480 05:12:41,120 --> 05:12:44,150 the name of a user so let's do app user to dot name and this will 15481 05:12:44,150 --> 05:12:44,160 app user to dot name and this will 15482 05:12:44,160 --> 05:12:44,948 app user to dot name and this will create 15483 05:12:44,948 --> 05:12:44,958 create 15484 05:12:44,958 --> 05:12:47,670 create an object also called instance in 15485 05:12:47,670 --> 05:12:47,680 an object also called instance in 15486 05:12:47,680 --> 05:12:48,788 an object also called instance in programming 15487 05:12:48,788 --> 05:12:48,798 programming 15488 05:12:48,798 --> 05:12:52,470 programming special instance of that post class 15489 05:12:52,470 --> 05:12:52,480 special instance of that post class 15490 05:12:52,480 --> 05:12:55,990 special instance of that post class and then we can print the information 15491 05:12:55,990 --> 05:12:56,000 and then we can print the information 15492 05:12:56,000 --> 05:12:59,350 and then we can print the information of that post first assign it 15493 05:12:59,350 --> 05:12:59,360 of that post first assign it 15494 05:12:59,360 --> 05:13:02,788 of that post first assign it to a variable let's say it's a new post 15495 05:13:02,788 --> 05:13:02,798 to a variable let's say it's a new post 15496 05:13:02,798 --> 05:13:06,070 to a variable let's say it's a new post and on a new post we're gonna call get 15497 05:13:06,070 --> 05:13:06,080 and on a new post we're gonna call get 15498 05:13:06,080 --> 05:13:07,990 and on a new post we're gonna call get post info let's actually run this 15499 05:13:07,990 --> 05:13:08,000 post info let's actually run this 15500 05:13:08,000 --> 05:13:10,550 post info let's actually run this application now and see the result 15501 05:13:10,550 --> 05:13:10,560 application now and see the result 15502 05:13:10,560 --> 05:13:13,750 application now and see the result and here we have our post message that 15503 05:13:13,750 --> 05:13:13,760 and here we have our post message that 15504 05:13:13,760 --> 05:13:14,230 and here we have our post message that gets 15505 05:13:14,230 --> 05:13:14,240 gets 15506 05:13:14,240 --> 05:13:18,070 gets printed by this get post info method 15507 05:13:18,070 --> 05:13:18,080 printed by this get post info method 15508 05:13:18,080 --> 05:13:22,230 printed by this get post info method in the post class 15509 05:13:24,788 --> 05:13:24,798 and at the beginning i mentioned object 15510 05:13:24,798 --> 05:13:26,070 and at the beginning i mentioned object oriented programming 15511 05:13:26,070 --> 05:13:26,080 oriented programming 15512 05:13:26,080 --> 05:13:27,750 oriented programming which basically means that when you're 15513 05:13:27,750 --> 05:13:27,760 which basically means that when you're 15514 05:13:27,760 --> 05:13:29,190 which basically means that when you're writing your code with 15515 05:13:29,190 --> 05:13:29,200 writing your code with 15516 05:13:29,200 --> 05:13:32,070 writing your code with objects and classes like this to create 15517 05:13:32,070 --> 05:13:32,080 objects and classes like this to create 15518 05:13:32,080 --> 05:13:33,510 objects and classes like this to create blueprints and then 15519 05:13:33,510 --> 05:13:33,520 blueprints and then 15520 05:13:33,520 --> 05:13:35,910 blueprints and then use those blueprints for specific 15521 05:13:35,910 --> 05:13:35,920 use those blueprints for specific 15522 05:13:35,920 --> 05:13:37,030 use those blueprints for specific instances 15523 05:13:37,030 --> 05:13:37,040 instances 15524 05:13:37,040 --> 05:13:38,708 instances that's called object-oriented 15525 05:13:38,708 --> 05:13:38,718 that's called object-oriented 15526 05:13:38,718 --> 05:13:40,390 that's called object-oriented programming and also an 15527 05:13:40,390 --> 05:13:40,400 programming and also an 15528 05:13:40,400 --> 05:13:43,350 programming and also an interesting note here is that in python 15529 05:13:43,350 --> 05:13:43,360 interesting note here is that in python 15530 05:13:43,360 --> 05:13:43,830 interesting note here is that in python almost 15531 05:13:43,830 --> 05:13:43,840 almost 15532 05:13:43,840 --> 05:13:46,310 almost everything is actually an object for 15533 05:13:46,310 --> 05:13:46,320 everything is actually an object for 15534 05:13:46,320 --> 05:13:49,110 everything is actually an object for example the data types like string 15535 05:13:49,110 --> 05:13:49,120 example the data types like string 15536 05:13:49,120 --> 05:13:52,708 example the data types like string integer list set etc when we printed 15537 05:13:52,708 --> 05:13:52,718 integer list set etc when we printed 15538 05:13:52,718 --> 05:13:54,070 integer list set etc when we printed them out we saw 15539 05:13:54,070 --> 05:13:54,080 them out we saw 15540 05:13:54,080 --> 05:13:57,190 them out we saw class of string or class of 15541 05:13:57,190 --> 05:13:57,200 class of string or class of 15542 05:13:57,200 --> 05:13:59,990 class of string or class of list so these data types are also 15543 05:13:59,990 --> 05:14:00,000 list so these data types are also 15544 05:14:00,000 --> 05:14:01,510 list so these data types are also classes in python 15545 05:14:01,510 --> 05:14:01,520 classes in python 15546 05:14:01,520 --> 05:14:05,910 classes in python and this int or sdr for string functions 15547 05:14:05,910 --> 05:14:05,920 and this int or sdr for string functions 15548 05:14:05,920 --> 05:14:06,948 and this int or sdr for string functions we called 15549 05:14:06,948 --> 05:14:06,958 we called 15550 05:14:06,958 --> 05:14:09,430 we called where actually the constructor we called 15551 05:14:09,430 --> 05:14:09,440 where actually the constructor we called 15552 05:14:09,440 --> 05:14:10,708 where actually the constructor we called to create a string 15553 05:14:10,708 --> 05:14:10,718 to create a string 15554 05:14:10,718 --> 05:14:14,390 to create a string or integer object and the constructor of 15555 05:14:14,390 --> 05:14:14,400 or integer object and the constructor of 15556 05:14:14,400 --> 05:14:16,628 or integer object and the constructor of int for example took a string 15557 05:14:16,628 --> 05:14:16,638 int for example took a string 15558 05:14:16,638 --> 05:14:18,390 int for example took a string representation of a number 15559 05:14:18,390 --> 05:14:18,400 representation of a number 15560 05:14:18,400 --> 05:14:21,670 representation of a number and in its init function and constructed 15561 05:14:21,670 --> 05:14:21,680 and in its init function and constructed 15562 05:14:21,680 --> 05:14:24,550 and in its init function and constructed an integer out of it now for us in terms 15563 05:14:24,550 --> 05:14:24,560 an integer out of it now for us in terms 15564 05:14:24,560 --> 05:14:24,788 an integer out of it now for us in terms of 15565 05:14:24,788 --> 05:14:24,798 of 15566 05:14:24,798 --> 05:14:28,310 of using these data types and variables etc 15567 05:14:28,310 --> 05:14:28,320 using these data types and variables etc 15568 05:14:28,320 --> 05:14:30,390 using these data types and variables etc it doesn't actually matter but it's just 15569 05:14:30,390 --> 05:14:30,400 it doesn't actually matter but it's just 15570 05:14:30,400 --> 05:14:32,470 it doesn't actually matter but it's just an interesting thing to know 15571 05:14:32,470 --> 05:14:32,480 an interesting thing to know 15572 05:14:32,480 --> 05:14:34,390 an interesting thing to know about how this whole thing works in 15573 05:14:34,390 --> 05:14:34,400 about how this whole thing works in 15574 05:14:34,400 --> 05:14:40,788 about how this whole thing works in python 15575 05:14:43,350 --> 05:14:43,360 in this part we're going to learn how to 15576 05:14:43,360 --> 05:14:43,830 in this part we're going to learn how to use 15577 05:14:43,830 --> 05:14:43,840 use 15578 05:14:43,840 --> 05:14:48,070 use python to talk to external applications 15579 05:14:48,070 --> 05:14:48,080 python to talk to external applications 15580 05:14:48,080 --> 05:14:49,830 python to talk to external applications in our case we're going to use gitlab 15581 05:14:49,830 --> 05:14:49,840 in our case we're going to use gitlab 15582 05:14:49,840 --> 05:14:51,510 in our case we're going to use gitlab and then application and just 15583 05:14:51,510 --> 05:14:51,520 and then application and just 15584 05:14:51,520 --> 05:14:54,868 and then application and just note here that communication between 15585 05:14:54,868 --> 05:14:54,878 note here that communication between 15586 05:14:54,878 --> 05:14:57,910 note here that communication between two applications in our case our python 15587 05:14:57,910 --> 05:14:57,920 two applications in our case our python 15588 05:14:57,920 --> 05:14:58,708 two applications in our case our python application 15589 05:14:58,708 --> 05:14:58,718 application 15590 05:14:58,718 --> 05:15:02,150 application and a gitlab application usually happens 15591 05:15:02,150 --> 05:15:02,160 and a gitlab application usually happens 15592 05:15:02,160 --> 05:15:05,430 and a gitlab application usually happens using a common protocol like http 15593 05:15:05,430 --> 05:15:05,440 using a common protocol like http 15594 05:15:05,440 --> 05:15:07,990 using a common protocol like http so basically our python application will 15595 05:15:07,990 --> 05:15:08,000 so basically our python application will 15596 05:15:08,000 --> 05:15:09,590 so basically our python application will send an http request 15597 05:15:09,590 --> 05:15:09,600 send an http request 15598 05:15:09,600 --> 05:15:12,070 send an http request to gitlab application and from the 15599 05:15:12,070 --> 05:15:12,080 to gitlab application and from the 15600 05:15:12,080 --> 05:15:13,990 to gitlab application and from the gitlab application it will get 15601 05:15:13,990 --> 05:15:14,000 gitlab application it will get 15602 05:15:14,000 --> 05:15:17,430 gitlab application it will get an http response for that request 15603 05:15:17,430 --> 05:15:17,440 an http response for that request 15604 05:15:17,440 --> 05:15:19,750 an http response for that request so just know that http is just a 15605 05:15:19,750 --> 05:15:19,760 so just know that http is just a 15606 05:15:19,760 --> 05:15:20,708 so just know that http is just a protocol 15607 05:15:20,708 --> 05:15:20,718 protocol 15608 05:15:20,718 --> 05:15:22,948 protocol that these two applications can 15609 05:15:22,948 --> 05:15:22,958 that these two applications can 15610 05:15:22,958 --> 05:15:24,150 that these two applications can communicate with 15611 05:15:24,150 --> 05:15:24,160 communicate with 15612 05:15:24,160 --> 05:15:26,150 communicate with over the internet i have a couple of 15613 05:15:26,150 --> 05:15:26,160 over the internet i have a couple of 15614 05:15:26,160 --> 05:15:27,510 over the internet i have a couple of projects on gitlab 15615 05:15:27,510 --> 05:15:27,520 projects on gitlab 15616 05:15:27,520 --> 05:15:29,270 projects on gitlab so we're gonna write a very simple 15617 05:15:29,270 --> 05:15:29,280 so we're gonna write a very simple 15618 05:15:29,280 --> 05:15:30,628 so we're gonna write a very simple python application 15619 05:15:30,628 --> 05:15:30,638 python application 15620 05:15:30,638 --> 05:15:33,270 python application that basically goes to gitlab and asks 15621 05:15:33,270 --> 05:15:33,280 that basically goes to gitlab and asks 15622 05:15:33,280 --> 05:15:34,230 that basically goes to gitlab and asks for the list 15623 05:15:34,230 --> 05:15:34,240 for the list 15624 05:15:34,240 --> 05:15:37,830 for the list of projects for my user and 15625 05:15:37,830 --> 05:15:37,840 of projects for my user and 15626 05:15:37,840 --> 05:15:40,708 of projects for my user and then just prints it here in our run 15627 05:15:40,708 --> 05:15:40,718 then just prints it here in our run 15628 05:15:40,718 --> 05:15:41,270 then just prints it here in our run window 15629 05:15:41,270 --> 05:15:41,280 window 15630 05:15:41,280 --> 05:15:44,868 window and the concept of one application 15631 05:15:44,868 --> 05:15:44,878 and the concept of one application 15632 05:15:44,878 --> 05:15:47,590 and the concept of one application talking to another is basically done 15633 05:15:47,590 --> 05:15:47,600 talking to another is basically done 15634 05:15:47,600 --> 05:15:48,230 talking to another is basically done using 15635 05:15:48,230 --> 05:15:48,240 using 15636 05:15:48,240 --> 05:15:51,510 using something called api requests so the 15637 05:15:51,510 --> 05:15:51,520 something called api requests so the 15638 05:15:51,520 --> 05:15:52,150 something called api requests so the remote 15639 05:15:52,150 --> 05:15:52,160 remote 15640 05:15:52,160 --> 05:15:54,948 remote application in this case gitlab has an 15641 05:15:54,948 --> 05:15:54,958 application in this case gitlab has an 15642 05:15:54,958 --> 05:15:55,910 application in this case gitlab has an api 15643 05:15:55,910 --> 05:15:55,920 api 15644 05:15:55,920 --> 05:15:58,150 api so these are functions basically that 15645 05:15:58,150 --> 05:15:58,160 so these are functions basically that 15646 05:15:58,160 --> 05:15:59,190 so these are functions basically that gitlab 15647 05:15:59,190 --> 05:15:59,200 gitlab 15648 05:15:59,200 --> 05:16:02,070 gitlab makes available for other applications 15649 05:16:02,070 --> 05:16:02,080 makes available for other applications 15650 05:16:02,080 --> 05:16:03,030 makes available for other applications to call 15651 05:16:03,030 --> 05:16:03,040 to call 15652 05:16:03,040 --> 05:16:04,868 to call and we're going to call those functions 15653 05:16:04,868 --> 05:16:04,878 and we're going to call those functions 15654 05:16:04,878 --> 05:16:06,708 and we're going to call those functions from our python application 15655 05:16:06,708 --> 05:16:06,718 from our python application 15656 05:16:06,718 --> 05:16:08,788 from our python application in order to get the list of projects for 15657 05:16:08,788 --> 05:16:08,798 in order to get the list of projects for 15658 05:16:08,798 --> 05:16:10,470 in order to get the list of projects for my user and that 15659 05:16:10,470 --> 05:16:10,480 my user and that 15660 05:16:10,480 --> 05:16:13,590 my user and that communication or python basically asking 15661 05:16:13,590 --> 05:16:13,600 communication or python basically asking 15662 05:16:13,600 --> 05:16:14,948 communication or python basically asking for this information 15663 05:16:14,948 --> 05:16:14,958 for this information 15664 05:16:14,958 --> 05:16:18,550 for this information is going to be an api request or api 15665 05:16:18,550 --> 05:16:18,560 is going to be an api request or api 15666 05:16:18,560 --> 05:16:20,788 is going to be an api request or api call and what we get in response from 15667 05:16:20,788 --> 05:16:20,798 call and what we get in response from 15668 05:16:20,798 --> 05:16:22,070 call and what we get in response from this gitlab 15669 05:16:22,070 --> 05:16:22,080 this gitlab 15670 05:16:22,080 --> 05:16:25,270 this gitlab api is going to be api response 15671 05:16:25,270 --> 05:16:25,280 api is going to be api response 15672 05:16:25,280 --> 05:16:30,070 api is going to be api response so let's go ahead and do that 15673 05:16:33,110 --> 05:16:33,120 in python in order to make those 15674 05:16:33,120 --> 05:16:34,390 in python in order to make those external requests 15675 05:16:34,390 --> 05:16:34,400 external requests 15676 05:16:34,400 --> 05:16:37,110 external requests to remote applications we're going to 15677 05:16:37,110 --> 05:16:37,120 to remote applications we're going to 15678 05:16:37,120 --> 05:16:38,708 to remote applications we're going to need a module 15679 05:16:38,708 --> 05:16:38,718 need a module 15680 05:16:38,718 --> 05:16:41,750 need a module called requests this is a generic module 15681 05:16:41,750 --> 05:16:41,760 called requests this is a generic module 15682 05:16:41,760 --> 05:16:42,788 called requests this is a generic module that you can use for 15683 05:16:42,788 --> 05:16:42,798 that you can use for 15684 05:16:42,798 --> 05:16:45,510 that you can use for any external application and as i 15685 05:16:45,510 --> 05:16:45,520 any external application and as i 15686 05:16:45,520 --> 05:16:46,708 any external application and as i mentioned at the beginning the 15687 05:16:46,708 --> 05:16:46,718 mentioned at the beginning the 15688 05:16:46,718 --> 05:16:48,470 mentioned at the beginning the communication happens 15689 05:16:48,470 --> 05:16:48,480 communication happens 15690 05:16:48,480 --> 05:16:50,868 communication happens using http protocol between two 15691 05:16:50,868 --> 05:16:50,878 using http protocol between two 15692 05:16:50,878 --> 05:16:52,150 using http protocol between two applications 15693 05:16:52,150 --> 05:16:52,160 applications 15694 05:16:52,160 --> 05:16:54,070 applications and as you see here also in the module 15695 05:16:54,070 --> 05:16:54,080 and as you see here also in the module 15696 05:16:54,080 --> 05:16:55,430 and as you see here also in the module description it says 15697 05:16:55,430 --> 05:16:55,440 description it says 15698 05:16:55,440 --> 05:16:58,868 description it says an http library which allows you to send 15699 05:16:58,868 --> 05:16:58,878 an http library which allows you to send 15700 05:16:58,878 --> 05:17:02,230 an http library which allows you to send http requests and then receive http 15701 05:17:02,230 --> 05:17:02,240 http requests and then receive http 15702 05:17:02,240 --> 05:17:03,030 http requests and then receive http responses 15703 05:17:03,030 --> 05:17:03,040 responses 15704 05:17:03,040 --> 05:17:05,030 responses from another application and that's 15705 05:17:05,030 --> 05:17:05,040 from another application and that's 15706 05:17:05,040 --> 05:17:07,190 from another application and that's exactly what we're going to be doing 15707 05:17:07,190 --> 05:17:07,200 exactly what we're going to be doing 15708 05:17:07,200 --> 05:17:10,628 exactly what we're going to be doing and this request module is not part of 15709 05:17:10,628 --> 05:17:10,638 and this request module is not part of 15710 05:17:10,638 --> 05:17:11,350 and this request module is not part of python 15711 05:17:11,350 --> 05:17:11,360 python 15712 05:17:11,360 --> 05:17:13,910 python so we're going to install it using pip 15713 05:17:13,910 --> 05:17:13,920 so we're going to install it using pip 15714 05:17:13,920 --> 05:17:16,390 so we're going to install it using pip again remember that we're using pip 15715 05:17:16,390 --> 05:17:16,400 again remember that we're using pip 15716 05:17:16,400 --> 05:17:18,708 again remember that we're using pip that actually comes packaged with the 15717 05:17:18,708 --> 05:17:18,718 that actually comes packaged with the 15718 05:17:18,718 --> 05:17:19,670 that actually comes packaged with the pycharm 15719 05:17:19,670 --> 05:17:19,680 pycharm 15720 05:17:19,680 --> 05:17:22,788 pycharm so in the terminal window of my ide of 15721 05:17:22,788 --> 05:17:22,798 so in the terminal window of my ide of 15722 05:17:22,798 --> 05:17:23,670 so in the terminal window of my ide of pycharm 15723 05:17:23,670 --> 05:17:23,680 pycharm 15724 05:17:23,680 --> 05:17:27,430 pycharm i'm going to execute peep install 15725 05:17:27,430 --> 05:17:27,440 i'm going to execute peep install 15726 05:17:27,440 --> 05:17:32,948 i'm going to execute peep install requests 15727 05:17:34,948 --> 05:17:34,958 successfully installed request this is 15728 05:17:34,958 --> 05:17:38,708 successfully installed request this is the version of that module 15729 05:17:41,430 --> 05:17:41,440 and if i expand this external library's 15730 05:17:41,440 --> 05:17:42,868 and if i expand this external library's site packages 15731 05:17:42,868 --> 05:17:42,878 site packages 15732 05:17:42,878 --> 05:17:46,948 site packages i'm going to see the requests package 15733 05:17:46,948 --> 05:17:46,958 i'm going to see the requests package 15734 05:17:46,958 --> 05:17:49,990 i'm going to see the requests package in the list great 15735 05:17:49,990 --> 05:17:50,000 in the list great 15736 05:17:50,000 --> 05:17:51,830 in the list great so once we have the module available 15737 05:17:51,830 --> 05:17:51,840 so once we have the module available 15738 05:17:51,840 --> 05:17:53,190 so once we have the module available locally we can 15739 05:17:53,190 --> 05:17:53,200 locally we can 15740 05:17:53,200 --> 05:17:56,788 locally we can import that module in our file 15741 05:17:56,788 --> 05:17:56,798 import that module in our file 15742 05:17:56,798 --> 05:17:59,350 import that module in our file and this requests module now has or 15743 05:17:59,350 --> 05:17:59,360 and this requests module now has or 15744 05:17:59,360 --> 05:18:00,470 and this requests module now has or package actually 15745 05:18:00,470 --> 05:18:00,480 package actually 15746 05:18:00,480 --> 05:18:04,070 package actually has functions variables and objects 15747 05:18:04,070 --> 05:18:04,080 has functions variables and objects 15748 05:18:04,080 --> 05:18:07,510 has functions variables and objects that we can use to talk to these remote 15749 05:18:07,510 --> 05:18:07,520 that we can use to talk to these remote 15750 05:18:07,520 --> 05:18:09,510 that we can use to talk to these remote applications like gitlab 15751 05:18:09,510 --> 05:18:09,520 applications like gitlab 15752 05:18:09,520 --> 05:18:11,350 applications like gitlab as i said gitlab is just one example you 15753 05:18:11,350 --> 05:18:11,360 as i said gitlab is just one example you 15754 05:18:11,360 --> 05:18:12,550 as i said gitlab is just one example you can talk to any 15755 05:18:12,550 --> 05:18:12,560 can talk to any 15756 05:18:12,560 --> 05:18:15,190 can talk to any remote application that has an api and 15757 05:18:15,190 --> 05:18:15,200 remote application that has an api and 15758 05:18:15,200 --> 05:18:16,470 remote application that has an api and we can not only do 15759 05:18:16,470 --> 05:18:16,480 we can not only do 15760 05:18:16,480 --> 05:18:18,550 we can not only do requests for getting the existing 15761 05:18:18,550 --> 05:18:18,560 requests for getting the existing 15762 05:18:18,560 --> 05:18:20,470 requests for getting the existing information but we can also make 15763 05:18:20,470 --> 05:18:20,480 information but we can also make 15764 05:18:20,480 --> 05:18:21,350 information but we can also make requests 15765 05:18:21,350 --> 05:18:21,360 requests 15766 05:18:21,360 --> 05:18:24,070 requests to change something in that remote 15767 05:18:24,070 --> 05:18:24,080 to change something in that remote 15768 05:18:24,080 --> 05:18:25,590 to change something in that remote application so for example 15769 05:18:25,590 --> 05:18:25,600 application so for example 15770 05:18:25,600 --> 05:18:27,510 application so for example i can write a python application that 15771 05:18:27,510 --> 05:18:27,520 i can write a python application that 15772 05:18:27,520 --> 05:18:29,110 i can write a python application that will actually create 15773 05:18:29,110 --> 05:18:29,120 will actually create 15774 05:18:29,120 --> 05:18:32,628 will actually create a new project on my gitlab account 15775 05:18:32,628 --> 05:18:32,638 a new project on my gitlab account 15776 05:18:32,638 --> 05:18:34,788 a new project on my gitlab account but to keep the demo simple we're just 15777 05:18:34,788 --> 05:18:34,798 but to keep the demo simple we're just 15778 05:18:34,798 --> 05:18:35,750 but to keep the demo simple we're just going to be 15779 05:18:35,750 --> 05:18:35,760 going to be 15780 05:18:35,760 --> 05:18:38,868 going to be fetching information from gitlab so 15781 05:18:38,868 --> 05:18:38,878 fetching information from gitlab so 15782 05:18:38,878 --> 05:18:42,150 fetching information from gitlab so how do we make requests to an api of an 15783 05:18:42,150 --> 05:18:42,160 how do we make requests to an api of an 15784 05:18:42,160 --> 05:18:44,230 how do we make requests to an api of an application 15785 05:18:44,230 --> 05:18:44,240 application 15786 05:18:44,240 --> 05:18:46,550 application with this requests module we get a 15787 05:18:46,550 --> 05:18:46,560 with this requests module we get a 15788 05:18:46,560 --> 05:18:47,350 with this requests module we get a function called 15789 05:18:47,350 --> 05:18:47,360 function called 15790 05:18:47,360 --> 05:18:51,110 function called get and get takes one main parameter 15791 05:18:51,110 --> 05:18:51,120 get and get takes one main parameter 15792 05:18:51,120 --> 05:18:54,628 get and get takes one main parameter which is url so basically we need to 15793 05:18:54,628 --> 05:18:54,638 which is url so basically we need to 15794 05:18:54,638 --> 05:18:56,788 which is url so basically we need to tell python where to find that remote 15795 05:18:56,788 --> 05:18:56,798 tell python where to find that remote 15796 05:18:56,798 --> 05:18:57,590 tell python where to find that remote application 15797 05:18:57,590 --> 05:18:57,600 application 15798 05:18:57,600 --> 05:19:00,150 application or again in our case where to find 15799 05:19:00,150 --> 05:19:00,160 or again in our case where to find 15800 05:19:00,160 --> 05:19:01,030 or again in our case where to find gitlab 15801 05:19:01,030 --> 05:19:01,040 gitlab 15802 05:19:01,040 --> 05:19:03,590 gitlab to talk to it so we need the url of 15803 05:19:03,590 --> 05:19:03,600 to talk to it so we need the url of 15804 05:19:03,600 --> 05:19:04,550 to talk to it so we need the url of gitlab 15805 05:19:04,550 --> 05:19:04,560 gitlab 15806 05:19:04,560 --> 05:19:07,030 gitlab and where do you find this url 15807 05:19:07,030 --> 05:19:07,040 and where do you find this url 15808 05:19:07,040 --> 05:19:09,270 and where do you find this url information of a remote application 15809 05:19:09,270 --> 05:19:09,280 information of a remote application 15810 05:19:09,280 --> 05:19:11,350 information of a remote application you can basically google that every 15811 05:19:11,350 --> 05:19:11,360 you can basically google that every 15812 05:19:11,360 --> 05:19:13,350 you can basically google that every application has their own documentation 15813 05:19:13,350 --> 05:19:13,360 application has their own documentation 15814 05:19:13,360 --> 05:19:14,868 application has their own documentation where you can see the urls 15815 05:19:14,868 --> 05:19:14,878 where you can see the urls 15816 05:19:14,878 --> 05:19:17,430 where you can see the urls so for example for gitlab i actually 15817 05:19:17,430 --> 05:19:17,440 so for example for gitlab i actually 15818 05:19:17,440 --> 05:19:18,470 so for example for gitlab i actually googled it 15819 05:19:18,470 --> 05:19:18,480 googled it 15820 05:19:18,480 --> 05:19:22,550 googled it so if i do gitlab api documentation 15821 05:19:22,550 --> 05:19:22,560 so if i do gitlab api documentation 15822 05:19:22,560 --> 05:19:27,190 so if i do gitlab api documentation like this 15823 05:19:29,430 --> 05:19:29,440 let's make it bigger so you have 15824 05:19:29,440 --> 05:19:30,868 let's make it bigger so you have basically description 15825 05:19:30,868 --> 05:19:30,878 basically description 15826 05:19:30,878 --> 05:19:34,550 basically description for the api and what type of information 15827 05:19:34,550 --> 05:19:34,560 for the api and what type of information 15828 05:19:34,560 --> 05:19:35,750 for the api and what type of information you can get from gitlab 15829 05:19:35,750 --> 05:19:35,760 you can get from gitlab 15830 05:19:35,760 --> 05:19:37,910 you can get from gitlab and also what kind of things you can 15831 05:19:37,910 --> 05:19:37,920 and also what kind of things you can 15832 05:19:37,920 --> 05:19:39,430 and also what kind of things you can create in gitlab 15833 05:19:39,430 --> 05:19:39,440 create in gitlab 15834 05:19:39,440 --> 05:19:42,550 create in gitlab and you see an example api here that 15835 05:19:42,550 --> 05:19:42,560 and you see an example api here that 15836 05:19:42,560 --> 05:19:43,190 and you see an example api here that basically 15837 05:19:43,190 --> 05:19:43,200 basically 15838 05:19:43,200 --> 05:19:45,430 basically just lists all the projects however we 15839 05:19:45,430 --> 05:19:45,440 just lists all the projects however we 15840 05:19:45,440 --> 05:19:46,550 just lists all the projects however we want to list 15841 05:19:46,550 --> 05:19:46,560 want to list 15842 05:19:46,560 --> 05:19:49,350 want to list projects of one specific user in this 15843 05:19:49,350 --> 05:19:49,360 projects of one specific user in this 15844 05:19:49,360 --> 05:19:51,830 projects of one specific user in this case i want to list my own projects 15845 05:19:51,830 --> 05:19:51,840 case i want to list my own projects 15846 05:19:51,840 --> 05:19:54,948 case i want to list my own projects and in this documentation i found this 15847 05:19:54,948 --> 05:19:54,958 and in this documentation i found this 15848 05:19:54,958 --> 05:19:56,150 and in this documentation i found this list user project 15849 05:19:56,150 --> 05:19:56,160 list user project 15850 05:19:56,160 --> 05:19:59,190 list user project section where i have an example 15851 05:19:59,190 --> 05:19:59,200 section where i have an example 15852 05:19:59,200 --> 05:20:02,070 section where i have an example of how to use projects for a specific 15853 05:20:02,070 --> 05:20:02,080 of how to use projects for a specific 15854 05:20:02,080 --> 05:20:02,628 of how to use projects for a specific user 15855 05:20:02,628 --> 05:20:02,638 user 15856 05:20:02,638 --> 05:20:05,350 user so we have slash users and the user id 15857 05:20:05,350 --> 05:20:05,360 so we have slash users and the user id 15858 05:20:05,360 --> 05:20:07,750 so we have slash users and the user id so that's going to be my gitlab user id 15859 05:20:07,750 --> 05:20:07,760 so that's going to be my gitlab user id 15860 05:20:07,760 --> 05:20:11,030 so that's going to be my gitlab user id and projects so basically the url will 15861 05:20:11,030 --> 05:20:11,040 and projects so basically the url will 15862 05:20:11,040 --> 05:20:12,310 and projects so basically the url will now look like this 15863 05:20:12,310 --> 05:20:12,320 now look like this 15864 05:20:12,320 --> 05:20:14,628 now look like this first we're gonna have this base url so 15865 05:20:14,628 --> 05:20:14,638 first we're gonna have this base url so 15866 05:20:14,638 --> 05:20:15,510 first we're gonna have this base url so that's basically 15867 05:20:15,510 --> 05:20:15,520 that's basically 15868 05:20:15,520 --> 05:20:18,948 that's basically https gitlab.com api v4 15869 05:20:18,948 --> 05:20:18,958 https gitlab.com api v4 15870 05:20:18,958 --> 05:20:21,430 https gitlab.com api v4 and all the things that we want to do is 15871 05:20:21,430 --> 05:20:21,440 and all the things that we want to do is 15872 05:20:21,440 --> 05:20:22,310 and all the things that we want to do is going to be 15873 05:20:22,310 --> 05:20:22,320 going to be 15874 05:20:22,320 --> 05:20:25,350 going to be at this base api and 15875 05:20:25,350 --> 05:20:25,360 at this base api and 15876 05:20:25,360 --> 05:20:27,990 at this base api and after that we can basically depending on 15877 05:20:27,990 --> 05:20:28,000 after that we can basically depending on 15878 05:20:28,000 --> 05:20:29,590 after that we can basically depending on what exactly we want to do 15879 05:20:29,590 --> 05:20:29,600 what exactly we want to do 15880 05:20:29,600 --> 05:20:32,708 what exactly we want to do we can choose one specific action 15881 05:20:32,708 --> 05:20:32,718 we can choose one specific action 15882 05:20:32,718 --> 05:20:36,150 we can choose one specific action and again going back this is 15883 05:20:36,150 --> 05:20:36,160 and again going back this is 15884 05:20:36,160 --> 05:20:39,510 and again going back this is the action we want to execute 15885 05:20:39,510 --> 05:20:39,520 the action we want to execute 15886 05:20:39,520 --> 05:20:43,110 the action we want to execute on this base url so from gitlab we want 15887 05:20:43,110 --> 05:20:43,120 on this base url so from gitlab we want 15888 05:20:43,120 --> 05:20:46,070 on this base url so from gitlab we want projects that belong to user and right 15889 05:20:46,070 --> 05:20:46,080 projects that belong to user and right 15890 05:20:46,080 --> 05:20:47,270 projects that belong to user and right here i'm going to add 15891 05:20:47,270 --> 05:20:47,280 here i'm going to add 15892 05:20:47,280 --> 05:20:51,270 here i'm going to add my own gitlab user id 15893 05:20:51,270 --> 05:20:51,280 my own gitlab user id 15894 05:20:51,280 --> 05:20:52,708 my own gitlab user id so if you have a github account you 15895 05:20:52,708 --> 05:20:52,718 so if you have a github account you 15896 05:20:52,718 --> 05:20:55,190 so if you have a github account you should add your own user id here 15897 05:20:55,190 --> 05:20:55,200 should add your own user id here 15898 05:20:55,200 --> 05:20:58,628 should add your own user id here and that's going to be an api url for 15899 05:20:58,628 --> 05:20:58,638 and that's going to be an api url for 15900 05:20:58,638 --> 05:21:01,670 and that's going to be an api url for user projects and this will actually 15901 05:21:01,670 --> 05:21:01,680 user projects and this will actually 15902 05:21:01,680 --> 05:21:02,230 user projects and this will actually give us 15903 05:21:02,230 --> 05:21:02,240 give us 15904 05:21:02,240 --> 05:21:05,030 give us some kind of response so requests.get 15905 05:21:05,030 --> 05:21:05,040 some kind of response so requests.get 15906 05:21:05,040 --> 05:21:06,150 some kind of response so requests.get will make that request 15907 05:21:06,150 --> 05:21:06,160 will make that request 15908 05:21:06,160 --> 05:21:08,708 will make that request to gitlab and it will return some kind 15909 05:21:08,708 --> 05:21:08,718 to gitlab and it will return some kind 15910 05:21:08,718 --> 05:21:10,628 to gitlab and it will return some kind of response and we can save that 15911 05:21:10,628 --> 05:21:10,638 of response and we can save that 15912 05:21:10,638 --> 05:21:12,310 of response and we can save that response into a variable 15913 05:21:12,310 --> 05:21:12,320 response into a variable 15914 05:21:12,320 --> 05:21:15,190 response into a variable so let's call this variable response 15915 05:21:15,190 --> 05:21:15,200 so let's call this variable response 15916 05:21:15,200 --> 05:21:17,670 so let's call this variable response because that's what it is 15917 05:21:17,670 --> 05:21:17,680 because that's what it is 15918 05:21:17,680 --> 05:21:19,590 because that's what it is and on the next line let's actually 15919 05:21:19,590 --> 05:21:19,600 and on the next line let's actually 15920 05:21:19,600 --> 05:21:27,350 and on the next line let's actually print and see what's in that response 15921 05:21:30,708 --> 05:21:30,718 let's run our application and 15922 05:21:30,718 --> 05:21:33,270 let's run our application and right here you see we have an object 15923 05:21:33,270 --> 05:21:33,280 right here you see we have an object 15924 05:21:33,280 --> 05:21:34,390 right here you see we have an object response 15925 05:21:34,390 --> 05:21:34,400 response 15926 05:21:34,400 --> 05:21:37,430 response with a code here 200 is a code for a 15927 05:21:37,430 --> 05:21:37,440 with a code here 200 is a code for a 15928 05:21:37,440 --> 05:21:38,230 with a code here 200 is a code for a successful 15929 05:21:38,230 --> 05:21:38,240 successful 15930 05:21:38,240 --> 05:21:41,030 successful request but we're not seeing the actual 15931 05:21:41,030 --> 05:21:41,040 request but we're not seeing the actual 15932 05:21:41,040 --> 05:21:42,708 request but we're not seeing the actual contents right we want to see the 15933 05:21:42,708 --> 05:21:42,718 contents right we want to see the 15934 05:21:42,718 --> 05:21:44,150 contents right we want to see the projects with their 15935 05:21:44,150 --> 05:21:44,160 projects with their 15936 05:21:44,160 --> 05:21:47,270 projects with their details and in order to get that we're 15937 05:21:47,270 --> 05:21:47,280 details and in order to get that we're 15938 05:21:47,280 --> 05:21:48,150 details and in order to get that we're gonna 15939 05:21:48,150 --> 05:21:48,160 gonna 15940 05:21:48,160 --> 05:21:51,430 gonna do dot and text and let's actually 15941 05:21:51,430 --> 05:21:51,440 do dot and text and let's actually 15942 05:21:51,440 --> 05:21:52,788 do dot and text and let's actually execute this now 15943 05:21:52,788 --> 05:21:52,798 execute this now 15944 05:21:52,798 --> 05:21:56,788 execute this now and now you see these square brackets 15945 05:21:56,788 --> 05:21:56,798 and now you see these square brackets 15946 05:21:56,798 --> 05:21:59,510 and now you see these square brackets which means it is a list because we have 15947 05:21:59,510 --> 05:21:59,520 which means it is a list because we have 15948 05:21:59,520 --> 05:22:01,270 which means it is a list because we have a list of projects 15949 05:22:01,270 --> 05:22:01,280 a list of projects 15950 05:22:01,280 --> 05:22:03,270 a list of projects and this whole bunch of information 15951 05:22:03,270 --> 05:22:03,280 and this whole bunch of information 15952 05:22:03,280 --> 05:22:05,030 and this whole bunch of information about projects there 15953 05:22:05,030 --> 05:22:05,040 about projects there 15954 05:22:05,040 --> 05:22:08,390 about projects there and you also see curly braces so this is 15955 05:22:08,390 --> 05:22:08,400 and you also see curly braces so this is 15956 05:22:08,400 --> 05:22:09,830 and you also see curly braces so this is a list of 15957 05:22:09,830 --> 05:22:09,840 a list of 15958 05:22:09,840 --> 05:22:12,708 a list of dictionaries and each dictionary holds 15959 05:22:12,708 --> 05:22:12,718 dictionaries and each dictionary holds 15960 05:22:12,718 --> 05:22:13,510 dictionaries and each dictionary holds information 15961 05:22:13,510 --> 05:22:13,520 information 15962 05:22:13,520 --> 05:22:16,948 information of one specific project now 15963 05:22:16,948 --> 05:22:16,958 of one specific project now 15964 05:22:16,958 --> 05:22:20,230 of one specific project now if i actually print the type of that 15965 05:22:20,230 --> 05:22:20,240 if i actually print the type of that 15966 05:22:20,240 --> 05:22:27,430 if i actually print the type of that response text 15967 05:22:30,948 --> 05:22:30,958 like this see that it is a 15968 05:22:30,958 --> 05:22:33,830 like this see that it is a string so even though we see the format 15969 05:22:33,830 --> 05:22:33,840 string so even though we see the format 15970 05:22:33,840 --> 05:22:35,190 string so even though we see the format is actually 15971 05:22:35,190 --> 05:22:35,200 is actually 15972 05:22:35,200 --> 05:22:38,150 is actually a list of dictionaries we're getting a 15973 05:22:38,150 --> 05:22:38,160 a list of dictionaries we're getting a 15974 05:22:38,160 --> 05:22:40,070 a list of dictionaries we're getting a string because we're accessing 15975 05:22:40,070 --> 05:22:40,080 string because we're accessing 15976 05:22:40,080 --> 05:22:43,350 string because we're accessing text attribute now there is actually 15977 05:22:43,350 --> 05:22:43,360 text attribute now there is actually 15978 05:22:43,360 --> 05:22:45,590 text attribute now there is actually another attribute which will give us 15979 05:22:45,590 --> 05:22:45,600 another attribute which will give us 15980 05:22:45,600 --> 05:22:49,190 another attribute which will give us the same thing but as an actual list of 15981 05:22:49,190 --> 05:22:49,200 the same thing but as an actual list of 15982 05:22:49,200 --> 05:22:52,390 the same thing but as an actual list of dictionaries instead of string and this 15983 05:22:52,390 --> 05:22:52,400 dictionaries instead of string and this 15984 05:22:52,400 --> 05:22:53,990 dictionaries instead of string and this will be actually a better way to get 15985 05:22:53,990 --> 05:22:54,000 will be actually a better way to get 15986 05:22:54,000 --> 05:22:55,830 will be actually a better way to get that information because then we can 15987 05:22:55,830 --> 05:22:55,840 that information because then we can 15988 05:22:55,840 --> 05:22:57,350 that information because then we can work on it so we can 15989 05:22:57,350 --> 05:22:57,360 work on it so we can 15990 05:22:57,360 --> 05:23:00,150 work on it so we can look through it and get the individual 15991 05:23:00,150 --> 05:23:00,160 look through it and get the individual 15992 05:23:00,160 --> 05:23:00,868 look through it and get the individual elements 15993 05:23:00,868 --> 05:23:00,878 elements 15994 05:23:00,878 --> 05:23:03,030 elements and access the values so what i'm gonna 15995 05:23:03,030 --> 05:23:03,040 and access the values so what i'm gonna 15996 05:23:03,040 --> 05:23:04,310 and access the values so what i'm gonna do now instead of 15997 05:23:04,310 --> 05:23:04,320 do now instead of 15998 05:23:04,320 --> 05:23:07,990 do now instead of dot text i'm gonna 15999 05:23:07,990 --> 05:23:08,000 dot text i'm gonna 16000 05:23:08,000 --> 05:23:12,548 dot text i'm gonna use json json is a standard format that 16001 05:23:12,548 --> 05:23:12,558 use json json is a standard format that 16002 05:23:12,558 --> 05:23:14,070 use json json is a standard format that all programming languages 16003 05:23:14,070 --> 05:23:14,080 all programming languages 16004 05:23:14,080 --> 05:23:16,230 all programming languages understand and usually when two 16005 05:23:16,230 --> 05:23:16,240 understand and usually when two 16006 05:23:16,240 --> 05:23:17,190 understand and usually when two applications 16007 05:23:17,190 --> 05:23:17,200 applications 16008 05:23:17,200 --> 05:23:19,030 applications communicate with each other which are 16009 05:23:19,030 --> 05:23:19,040 communicate with each other which are 16010 05:23:19,040 --> 05:23:20,948 communicate with each other which are written in different languages 16011 05:23:20,948 --> 05:23:20,958 written in different languages 16012 05:23:20,958 --> 05:23:23,910 written in different languages and with different technologies with 16013 05:23:23,910 --> 05:23:23,920 and with different technologies with 16014 05:23:23,920 --> 05:23:25,990 and with different technologies with json they have a common format 16015 05:23:25,990 --> 05:23:26,000 json they have a common format 16016 05:23:26,000 --> 05:23:28,548 json they have a common format for communication and this requests 16017 05:23:28,548 --> 05:23:28,558 for communication and this requests 16018 05:23:28,558 --> 05:23:30,548 for communication and this requests module basically gives us this 16019 05:23:30,548 --> 05:23:30,558 module basically gives us this 16020 05:23:30,558 --> 05:23:33,590 module basically gives us this json function to read the json format 16021 05:23:33,590 --> 05:23:33,600 json function to read the json format 16022 05:23:33,600 --> 05:23:33,910 json function to read the json format that 16023 05:23:33,910 --> 05:23:33,920 that 16024 05:23:33,920 --> 05:23:36,708 that gitlab sent us so json function will 16025 05:23:36,708 --> 05:23:36,718 gitlab sent us so json function will 16026 05:23:36,718 --> 05:23:38,310 gitlab sent us so json function will read the json response 16027 05:23:38,310 --> 05:23:38,320 read the json response 16028 05:23:38,320 --> 05:23:41,510 read the json response from gitlab and turn it into one of the 16029 05:23:41,510 --> 05:23:41,520 from gitlab and turn it into one of the 16030 05:23:41,520 --> 05:23:43,510 from gitlab and turn it into one of the python data types 16031 05:23:43,510 --> 05:23:43,520 python data types 16032 05:23:43,520 --> 05:23:46,708 python data types so i'm going to execute this now and now 16033 05:23:46,708 --> 05:23:46,718 so i'm going to execute this now and now 16034 05:23:46,718 --> 05:23:50,948 so i'm going to execute this now and now you see that response.json actually 16035 05:23:50,948 --> 05:23:50,958 you see that response.json actually 16036 05:23:50,958 --> 05:23:54,788 you see that response.json actually gave us list data type instead of string 16037 05:23:54,788 --> 05:23:54,798 gave us list data type instead of string 16038 05:23:54,798 --> 05:24:02,390 gave us list data type instead of string so again for demonstration 16039 05:24:05,830 --> 05:24:05,840 since this is a list i'm going to 16040 05:24:05,840 --> 05:24:09,190 since this is a list i'm going to access the first element of that list 16041 05:24:09,190 --> 05:24:09,200 access the first element of that list 16042 05:24:09,200 --> 05:24:12,230 access the first element of that list and print that out and right here you 16043 05:24:12,230 --> 05:24:12,240 and print that out and right here you 16044 05:24:12,240 --> 05:24:13,110 and print that out and right here you see 16045 05:24:13,110 --> 05:24:13,120 see 16046 05:24:13,120 --> 05:24:17,510 see that is actually the first element 16047 05:24:17,510 --> 05:24:17,520 that is actually the first element 16048 05:24:17,520 --> 05:24:19,910 that is actually the first element just the first one from the list and 16049 05:24:19,910 --> 05:24:19,920 just the first one from the list and 16050 05:24:19,920 --> 05:24:20,708 just the first one from the list and that element 16051 05:24:20,708 --> 05:24:20,718 that element 16052 05:24:20,718 --> 05:24:23,670 that element is a dictionary as you see so all these 16053 05:24:23,670 --> 05:24:23,680 is a dictionary as you see so all these 16054 05:24:23,680 --> 05:24:24,948 is a dictionary as you see so all these just to give you an idea 16055 05:24:24,948 --> 05:24:24,958 just to give you an idea 16056 05:24:24,958 --> 05:24:27,510 just to give you an idea of what we're getting back from that 16057 05:24:27,510 --> 05:24:27,520 of what we're getting back from that 16058 05:24:27,520 --> 05:24:28,230 of what we're getting back from that gitlab 16059 05:24:28,230 --> 05:24:28,240 gitlab 16060 05:24:28,240 --> 05:24:30,310 gitlab api and what we can do with that 16061 05:24:30,310 --> 05:24:30,320 api and what we can do with that 16062 05:24:30,320 --> 05:24:32,310 api and what we can do with that response or how we can actually work 16063 05:24:32,310 --> 05:24:32,320 response or how we can actually work 16064 05:24:32,320 --> 05:24:33,590 response or how we can actually work with that response 16065 05:24:33,590 --> 05:24:33,600 with that response 16066 05:24:33,600 --> 05:24:36,628 with that response so i'm gonna clean all this up and we 16067 05:24:36,628 --> 05:24:36,638 so i'm gonna clean all this up and we 16068 05:24:36,638 --> 05:24:37,708 so i'm gonna clean all this up and we saw that 16069 05:24:37,708 --> 05:24:37,718 saw that 16070 05:24:37,718 --> 05:24:40,310 saw that response.json gives us exactly what we 16071 05:24:40,310 --> 05:24:40,320 response.json gives us exactly what we 16072 05:24:40,320 --> 05:24:40,948 response.json gives us exactly what we want 16073 05:24:40,948 --> 05:24:40,958 want 16074 05:24:40,958 --> 05:24:44,150 want and that is a list of my projects so 16075 05:24:44,150 --> 05:24:44,160 and that is a list of my projects so 16076 05:24:44,160 --> 05:24:47,590 and that is a list of my projects so let's call this 16077 05:24:50,868 --> 05:24:50,878 variable my projects and now what i want 16078 05:24:50,878 --> 05:24:51,910 variable my projects and now what i want to do with this 16079 05:24:51,910 --> 05:24:51,920 to do with this 16080 05:24:51,920 --> 05:24:55,350 to do with this is i want to print out 16081 05:24:55,350 --> 05:24:55,360 is i want to print out 16082 05:24:55,360 --> 05:24:58,390 is i want to print out in our window for each project 16083 05:24:58,390 --> 05:24:58,400 in our window for each project 16084 05:24:58,400 --> 05:25:01,590 in our window for each project project name and project url so 16085 05:25:01,590 --> 05:25:01,600 project name and project url so 16086 05:25:01,600 --> 05:25:03,990 project name and project url so basically the repository url for that 16087 05:25:03,990 --> 05:25:04,000 basically the repository url for that 16088 05:25:04,000 --> 05:25:05,030 basically the repository url for that project 16089 05:25:05,030 --> 05:25:05,040 project 16090 05:25:05,040 --> 05:25:08,548 project so i don't want to have any other values 16091 05:25:08,548 --> 05:25:08,558 so i don't want to have any other values 16092 05:25:08,558 --> 05:25:09,270 so i don't want to have any other values like id 16093 05:25:09,270 --> 05:25:09,280 like id 16094 05:25:09,280 --> 05:25:12,310 like id or description or whatever 16095 05:25:12,310 --> 05:25:12,320 or description or whatever 16096 05:25:12,320 --> 05:25:14,390 or description or whatever other stuff i have in this dictionary i 16097 05:25:14,390 --> 05:25:14,400 other stuff i have in this dictionary i 16098 05:25:14,400 --> 05:25:15,590 other stuff i have in this dictionary i just want name 16099 05:25:15,590 --> 05:25:15,600 just want name 16100 05:25:15,600 --> 05:25:18,868 just want name and project url for every single 16101 05:25:18,868 --> 05:25:18,878 and project url for every single 16102 05:25:18,878 --> 05:25:20,788 and project url for every single project and i want that information 16103 05:25:20,788 --> 05:25:20,798 project and i want that information 16104 05:25:20,798 --> 05:25:22,070 project and i want that information printed out in this 16105 05:25:22,070 --> 05:25:22,080 printed out in this 16106 05:25:22,080 --> 05:25:25,430 printed out in this window so how do we do that 16107 05:25:25,430 --> 05:25:25,440 window so how do we do that 16108 05:25:25,440 --> 05:25:28,548 window so how do we do that we have a list so we're gonna loop 16109 05:25:28,548 --> 05:25:28,558 we have a list so we're gonna loop 16110 05:25:28,558 --> 05:25:29,830 we have a list so we're gonna loop through that list 16111 05:25:29,830 --> 05:25:29,840 through that list 16112 05:25:29,840 --> 05:25:33,510 through that list to access each element inside that list 16113 05:25:33,510 --> 05:25:33,520 to access each element inside that list 16114 05:25:33,520 --> 05:25:37,030 to access each element inside that list so you remember we have for loop to loop 16115 05:25:37,030 --> 05:25:37,040 so you remember we have for loop to loop 16116 05:25:37,040 --> 05:25:37,350 so you remember we have for loop to loop through 16117 05:25:37,350 --> 05:25:37,360 through 16118 05:25:37,360 --> 05:25:40,310 through or iterate through a list and give us 16119 05:25:40,310 --> 05:25:40,320 or iterate through a list and give us 16120 05:25:40,320 --> 05:25:42,230 or iterate through a list and give us access to each element 16121 05:25:42,230 --> 05:25:42,240 access to each element 16122 05:25:42,240 --> 05:25:45,750 access to each element one at a time so here i'm going to write 16123 05:25:45,750 --> 05:25:45,760 one at a time so here i'm going to write 16124 05:25:45,760 --> 05:25:47,750 one at a time so here i'm going to write for loop and if you remember the syntax 16125 05:25:47,750 --> 05:25:47,760 for loop and if you remember the syntax 16126 05:25:47,760 --> 05:25:49,510 for loop and if you remember the syntax of for loop we have 16127 05:25:49,510 --> 05:25:49,520 of for loop we have 16128 05:25:49,520 --> 05:25:51,830 of for loop we have four and then a variable which will 16129 05:25:51,830 --> 05:25:51,840 four and then a variable which will 16130 05:25:51,840 --> 05:25:53,670 four and then a variable which will represent the single element in that 16131 05:25:53,670 --> 05:25:53,680 represent the single element in that 16132 05:25:53,680 --> 05:25:54,310 represent the single element in that list 16133 05:25:54,310 --> 05:25:54,320 list 16134 05:25:54,320 --> 05:25:55,830 list and in this case it's going to be a 16135 05:25:55,830 --> 05:25:55,840 and in this case it's going to be a 16136 05:25:55,840 --> 05:25:58,470 and in this case it's going to be a project a single project 16137 05:25:58,470 --> 05:25:58,480 project a single project 16138 05:25:58,480 --> 05:26:02,150 project a single project and then we have in 16139 05:26:02,150 --> 05:26:02,160 and then we have in 16140 05:26:02,160 --> 05:26:06,390 and then we have in list so for project in my projects 16141 05:26:06,390 --> 05:26:06,400 list so for project in my projects 16142 05:26:06,400 --> 05:26:09,190 list so for project in my projects do something so for every project 16143 05:26:09,190 --> 05:26:09,200 do something so for every project 16144 05:26:09,200 --> 05:26:09,830 do something so for every project element 16145 05:26:09,830 --> 05:26:09,840 element 16146 05:26:09,840 --> 05:26:12,548 element in this my projects list we want to 16147 05:26:12,548 --> 05:26:12,558 in this my projects list we want to 16148 05:26:12,558 --> 05:26:15,030 in this my projects list we want to print out the name and the url 16149 05:26:15,030 --> 05:26:15,040 print out the name and the url 16150 05:26:15,040 --> 05:26:18,628 print out the name and the url so right here i will do print 16151 05:26:18,628 --> 05:26:18,638 so right here i will do print 16152 05:26:18,638 --> 05:26:21,750 so right here i will do print and let's do our formatted string here 16153 05:26:21,750 --> 05:26:21,760 and let's do our formatted string here 16154 05:26:21,760 --> 05:26:24,548 and let's do our formatted string here and let's start writing our message 16155 05:26:24,548 --> 05:26:24,558 and let's start writing our message 16156 05:26:24,558 --> 05:26:25,190 and let's start writing our message let's do 16157 05:26:25,190 --> 05:26:25,200 let's do 16158 05:26:25,200 --> 05:26:28,788 let's do project name 16159 05:26:28,788 --> 05:26:28,798 project name 16160 05:26:28,798 --> 05:26:31,350 project name and the project name will be this one 16161 05:26:31,350 --> 05:26:31,360 and the project name will be this one 16162 05:26:31,360 --> 05:26:32,230 and the project name will be this one right here 16163 05:26:32,230 --> 05:26:32,240 right here 16164 05:26:32,240 --> 05:26:35,350 right here now how do we actually access 16165 05:26:35,350 --> 05:26:35,360 now how do we actually access 16166 05:26:35,360 --> 05:26:39,190 now how do we actually access the name of the project in each project 16167 05:26:39,190 --> 05:26:39,200 the name of the project in each project 16168 05:26:39,200 --> 05:26:42,070 the name of the project in each project element as you see here these project 16169 05:26:42,070 --> 05:26:42,080 element as you see here these project 16170 05:26:42,080 --> 05:26:43,430 element as you see here these project elements are actually 16171 05:26:43,430 --> 05:26:43,440 elements are actually 16172 05:26:43,440 --> 05:26:46,868 elements are actually dictionaries and how do we access a 16173 05:26:46,868 --> 05:26:46,878 dictionaries and how do we access a 16174 05:26:46,878 --> 05:26:48,390 dictionaries and how do we access a value in a dictionary 16175 05:26:48,390 --> 05:26:48,400 value in a dictionary 16176 05:26:48,400 --> 05:26:51,190 value in a dictionary using the name of the dictionary in this 16177 05:26:51,190 --> 05:26:51,200 using the name of the dictionary in this 16178 05:26:51,200 --> 05:26:51,590 using the name of the dictionary in this case 16179 05:26:51,590 --> 05:26:51,600 case 16180 05:26:51,600 --> 05:26:54,070 case our variable project so this whole thing 16181 05:26:54,070 --> 05:26:54,080 our variable project so this whole thing 16182 05:26:54,080 --> 05:26:55,110 our variable project so this whole thing is going to be 16183 05:26:55,110 --> 05:26:55,120 is going to be 16184 05:26:55,120 --> 05:26:57,590 is going to be saved into a variable called project and 16185 05:26:57,590 --> 05:26:57,600 saved into a variable called project and 16186 05:26:57,600 --> 05:26:59,430 saved into a variable called project and then on that 16187 05:26:59,430 --> 05:26:59,440 then on that 16188 05:26:59,440 --> 05:27:01,430 then on that variable on the dictionary we're going 16189 05:27:01,430 --> 05:27:01,440 variable on the dictionary we're going 16190 05:27:01,440 --> 05:27:02,788 variable on the dictionary we're going to pass in 16191 05:27:02,788 --> 05:27:02,798 to pass in 16192 05:27:02,798 --> 05:27:06,070 to pass in the name of the key which is name 16193 05:27:06,070 --> 05:27:06,080 the name of the key which is name 16194 05:27:06,080 --> 05:27:07,990 the name of the key which is name now i've been using double quotes 16195 05:27:07,990 --> 05:27:08,000 now i've been using double quotes 16196 05:27:08,000 --> 05:27:09,590 now i've been using double quotes throughout our project 16197 05:27:09,590 --> 05:27:09,600 throughout our project 16198 05:27:09,600 --> 05:27:12,390 throughout our project and for a syntax for dictionaries as 16199 05:27:12,390 --> 05:27:12,400 and for a syntax for dictionaries as 16200 05:27:12,400 --> 05:27:13,030 and for a syntax for dictionaries as well 16201 05:27:13,030 --> 05:27:13,040 well 16202 05:27:13,040 --> 05:27:16,070 well like this 16203 05:27:19,430 --> 05:27:19,440 right however here we have a small 16204 05:27:19,440 --> 05:27:20,788 right however here we have a small problem which is 16205 05:27:20,788 --> 05:27:20,798 problem which is 16206 05:27:20,798 --> 05:27:23,190 problem which is we have double quotes inside the double 16207 05:27:23,190 --> 05:27:23,200 we have double quotes inside the double 16208 05:27:23,200 --> 05:27:25,670 we have double quotes inside the double quotes but as you remember 16209 05:27:25,670 --> 05:27:25,680 quotes but as you remember 16210 05:27:25,680 --> 05:27:27,670 quotes but as you remember for string representation we can 16211 05:27:27,670 --> 05:27:27,680 for string representation we can 16212 05:27:27,680 --> 05:27:28,868 for string representation we can actually use 16213 05:27:28,868 --> 05:27:28,878 actually use 16214 05:27:28,878 --> 05:27:31,030 actually use single quotes as well as double quotes 16215 05:27:31,030 --> 05:27:31,040 single quotes as well as double quotes 16216 05:27:31,040 --> 05:27:32,548 single quotes as well as double quotes and this is one of the 16217 05:27:32,548 --> 05:27:32,558 and this is one of the 16218 05:27:32,558 --> 05:27:35,750 and this is one of the really important use cases for why we 16219 05:27:35,750 --> 05:27:35,760 really important use cases for why we 16220 05:27:35,760 --> 05:27:36,708 really important use cases for why we can actually use 16221 05:27:36,708 --> 05:27:36,718 can actually use 16222 05:27:36,718 --> 05:27:39,270 can actually use both single and double quotes for a 16223 05:27:39,270 --> 05:27:39,280 both single and double quotes for a 16224 05:27:39,280 --> 05:27:39,990 both single and double quotes for a string 16225 05:27:39,990 --> 05:27:40,000 string 16226 05:27:40,000 --> 05:27:42,390 string and that is if we have a string inside 16227 05:27:42,390 --> 05:27:42,400 and that is if we have a string inside 16228 05:27:42,400 --> 05:27:43,670 and that is if we have a string inside another string 16229 05:27:43,670 --> 05:27:43,680 another string 16230 05:27:43,680 --> 05:27:47,110 another string like right here we can actually use that 16231 05:27:47,110 --> 05:27:47,120 like right here we can actually use that 16232 05:27:47,120 --> 05:27:49,830 like right here we can actually use that interchangeably so that we don't have 16233 05:27:49,830 --> 05:27:49,840 interchangeably so that we don't have 16234 05:27:49,840 --> 05:27:51,510 interchangeably so that we don't have this problem here 16235 05:27:51,510 --> 05:27:51,520 this problem here 16236 05:27:51,520 --> 05:27:53,750 this problem here so now as you see back to normal 16237 05:27:53,750 --> 05:27:53,760 so now as you see back to normal 16238 05:27:53,760 --> 05:27:55,670 so now as you see back to normal everything works because 16239 05:27:55,670 --> 05:27:55,680 everything works because 16240 05:27:55,680 --> 05:27:58,548 everything works because now python knows okay this is another 16241 05:27:58,548 --> 05:27:58,558 now python knows okay this is another 16242 05:27:58,558 --> 05:27:59,270 now python knows okay this is another string 16243 05:27:59,270 --> 05:27:59,280 string 16244 05:27:59,280 --> 05:28:02,310 string which we're using inside this string 16245 05:28:02,310 --> 05:28:02,320 which we're using inside this string 16246 05:28:02,320 --> 05:28:04,470 which we're using inside this string so we can use these interchangeably as 16247 05:28:04,470 --> 05:28:04,480 so we can use these interchangeably as 16248 05:28:04,480 --> 05:28:06,868 so we can use these interchangeably as we want so this could be single quotes 16249 05:28:06,868 --> 05:28:06,878 we want so this could be single quotes 16250 05:28:06,878 --> 05:28:08,390 we want so this could be single quotes and this could be double quotes 16251 05:28:08,390 --> 05:28:08,400 and this could be double quotes 16252 05:28:08,400 --> 05:28:10,150 and this could be double quotes wouldn't really matter but that's a 16253 05:28:10,150 --> 05:28:10,160 wouldn't really matter but that's a 16254 05:28:10,160 --> 05:28:11,830 wouldn't really matter but that's a really good use case why we need 16255 05:28:11,830 --> 05:28:11,840 really good use case why we need 16256 05:28:11,840 --> 05:28:15,350 really good use case why we need both types of quotes so we have the 16257 05:28:15,350 --> 05:28:15,360 both types of quotes so we have the 16258 05:28:15,360 --> 05:28:16,310 both types of quotes so we have the project name 16259 05:28:16,310 --> 05:28:16,320 project name 16260 05:28:16,320 --> 05:28:22,470 project name now we need a project url 16261 05:28:25,110 --> 05:28:25,120 and let's see where the project url is 16262 05:28:25,120 --> 05:28:26,390 and let's see where the project url is in our dictionary 16263 05:28:26,390 --> 05:28:26,400 in our dictionary 16264 05:28:26,400 --> 05:28:29,350 in our dictionary this is one element one dictionary right 16265 05:28:29,350 --> 05:28:29,360 this is one element one dictionary right 16266 05:28:29,360 --> 05:28:29,750 this is one element one dictionary right so 16267 05:28:29,750 --> 05:28:29,760 so 16268 05:28:29,760 --> 05:28:33,110 so i'm gonna scroll it to the left 16269 05:28:33,110 --> 05:28:33,120 i'm gonna scroll it to the left 16270 05:28:33,120 --> 05:28:35,750 i'm gonna scroll it to the left and we have web url this is what we 16271 05:28:35,750 --> 05:28:35,760 and we have web url this is what we 16272 05:28:35,760 --> 05:28:36,628 and we have web url this is what we could use 16273 05:28:36,628 --> 05:28:36,638 could use 16274 05:28:36,638 --> 05:28:40,708 could use or we could also use http url to repo 16275 05:28:40,708 --> 05:28:40,718 or we could also use http url to repo 16276 05:28:40,718 --> 05:28:43,910 or we could also use http url to repo let's go with the web url so again this 16277 05:28:43,910 --> 05:28:43,920 let's go with the web url so again this 16278 05:28:43,920 --> 05:28:44,470 let's go with the web url so again this is a 16279 05:28:44,470 --> 05:28:44,480 is a 16280 05:28:44,480 --> 05:28:47,270 is a key inside the dictionary so we can 16281 05:28:47,270 --> 05:28:47,280 key inside the dictionary so we can 16282 05:28:47,280 --> 05:28:48,230 key inside the dictionary so we can access 16283 05:28:48,230 --> 05:28:48,240 access 16284 05:28:48,240 --> 05:28:50,310 access the value so this is actually the value 16285 05:28:50,310 --> 05:28:50,320 the value so this is actually the value 16286 05:28:50,320 --> 05:28:53,110 the value so this is actually the value we need and we can access that using 16287 05:28:53,110 --> 05:28:53,120 we need and we can access that using 16288 05:28:53,120 --> 05:28:57,750 we need and we can access that using the dictionary name projects 16289 05:29:00,788 --> 05:29:00,798 and the key name which is web url and 16290 05:29:00,798 --> 05:29:02,310 and the key name which is web url and this is actually project 16291 05:29:02,310 --> 05:29:02,320 this is actually project 16292 05:29:02,320 --> 05:29:05,190 this is actually project not projects and this code will now 16293 05:29:05,190 --> 05:29:05,200 not projects and this code will now 16294 05:29:05,200 --> 05:29:05,910 not projects and this code will now print 16295 05:29:05,910 --> 05:29:05,920 print 16296 05:29:05,920 --> 05:29:08,230 print name and url for each project so let's 16297 05:29:08,230 --> 05:29:08,240 name and url for each project so let's 16298 05:29:08,240 --> 05:29:11,590 name and url for each project so let's actually execute our program 16299 05:29:11,590 --> 05:29:11,600 actually execute our program 16300 05:29:11,600 --> 05:29:14,830 actually execute our program and as you see we have project name and 16301 05:29:14,830 --> 05:29:14,840 and as you see we have project name and 16302 05:29:14,840 --> 05:29:16,868 and as you see we have project name and project url 16303 05:29:16,868 --> 05:29:16,878 project url 16304 05:29:16,878 --> 05:29:20,070 project url for each project we can make the output 16305 05:29:20,070 --> 05:29:20,080 for each project we can make the output 16306 05:29:20,080 --> 05:29:21,110 for each project we can make the output a little bit cleaner 16307 05:29:21,110 --> 05:29:21,120 a little bit cleaner 16308 05:29:21,120 --> 05:29:25,030 a little bit cleaner let's do a new line here 16309 05:29:25,030 --> 05:29:25,040 let's do a new line here 16310 05:29:25,040 --> 05:29:27,830 let's do a new line here and a new line here so we can separate 16311 05:29:27,830 --> 05:29:27,840 and a new line here so we can separate 16312 05:29:27,840 --> 05:29:30,548 and a new line here so we can separate the projects from each other and 16313 05:29:30,548 --> 05:29:30,558 the projects from each other and 16314 05:29:30,558 --> 05:29:33,030 the projects from each other and run again and there you go this looks a 16315 05:29:33,030 --> 05:29:33,040 run again and there you go this looks a 16316 05:29:33,040 --> 05:29:34,150 run again and there you go this looks a little bit cleaner 16317 05:29:34,150 --> 05:29:34,160 little bit cleaner 16318 05:29:34,160 --> 05:29:37,270 little bit cleaner for each project we have a name and a 16319 05:29:37,270 --> 05:29:37,280 for each project we have a name and a 16320 05:29:37,280 --> 05:29:38,070 for each project we have a name and a url 16321 05:29:38,070 --> 05:29:38,080 url 16322 05:29:38,080 --> 05:29:41,430 url so if i click inside i'll go directly to 16323 05:29:41,430 --> 05:29:41,440 so if i click inside i'll go directly to 16324 05:29:41,440 --> 05:29:42,830 so if i click inside i'll go directly to this 16325 05:29:42,830 --> 05:29:42,840 this 16326 05:29:42,840 --> 05:29:46,310 this project so that's basically a very 16327 05:29:46,310 --> 05:29:46,320 project so that's basically a very 16328 05:29:46,320 --> 05:29:49,030 project so that's basically a very simple example of how to use 16329 05:29:49,030 --> 05:29:49,040 simple example of how to use 16330 05:29:49,040 --> 05:29:52,390 simple example of how to use requests module to talk to external 16331 05:29:52,390 --> 05:29:52,400 requests module to talk to external 16332 05:29:52,400 --> 05:29:53,670 requests module to talk to external applications 16333 05:29:53,670 --> 05:29:53,680 applications 16334 05:29:53,680 --> 05:29:56,548 applications or external urls and then do something 16335 05:29:56,548 --> 05:29:56,558 or external urls and then do something 16336 05:29:56,558 --> 05:29:57,990 or external urls and then do something with the response that we get 16337 05:29:57,990 --> 05:29:58,000 with the response that we get 16338 05:29:58,000 --> 05:30:00,470 with the response that we get from that external application by first 16339 05:30:00,470 --> 05:30:00,480 from that external application by first 16340 05:30:00,480 --> 05:30:03,110 from that external application by first converting that into an actual data type 16341 05:30:03,110 --> 05:30:03,120 converting that into an actual data type 16342 05:30:03,120 --> 05:30:05,910 converting that into an actual data type that we're getting using json function 16343 05:30:05,910 --> 05:30:05,920 that we're getting using json function 16344 05:30:05,920 --> 05:30:07,670 that we're getting using json function so in our case it was a list 16345 05:30:07,670 --> 05:30:07,680 so in our case it was a list 16346 05:30:07,680 --> 05:30:09,910 so in our case it was a list and that's why json function actually 16347 05:30:09,910 --> 05:30:09,920 and that's why json function actually 16348 05:30:09,920 --> 05:30:11,350 and that's why json function actually converted it into 16349 05:30:11,350 --> 05:30:11,360 converted it into 16350 05:30:11,360 --> 05:30:14,470 converted it into a list if the response was a dictionary 16351 05:30:14,470 --> 05:30:14,480 a list if the response was a dictionary 16352 05:30:14,480 --> 05:30:15,590 a list if the response was a dictionary instead of at least 16353 05:30:15,590 --> 05:30:15,600 instead of at least 16354 05:30:15,600 --> 05:30:18,390 instead of at least then json would convert it into a 16355 05:30:18,390 --> 05:30:18,400 then json would convert it into a 16356 05:30:18,400 --> 05:30:19,110 then json would convert it into a dictionary 16357 05:30:19,110 --> 05:30:19,120 dictionary 16358 05:30:19,120 --> 05:30:20,868 dictionary and then we can do something with that 16359 05:30:20,868 --> 05:30:20,878 and then we can do something with that 16360 05:30:20,878 --> 05:30:25,670 and then we can do something with that response value 16361 05:30:27,910 --> 05:30:27,920 congratulations you made it till the end 16362 05:30:27,920 --> 05:30:29,590 congratulations you made it till the end i hope you learned a lot 16363 05:30:29,590 --> 05:30:29,600 i hope you learned a lot 16364 05:30:29,600 --> 05:30:31,430 i hope you learned a lot and got some valuable knowledge from 16365 05:30:31,430 --> 05:30:31,440 and got some valuable knowledge from 16366 05:30:31,440 --> 05:30:33,910 and got some valuable knowledge from this course if you like the course 16367 05:30:33,910 --> 05:30:33,920 this course if you like the course 16368 05:30:33,920 --> 05:30:36,788 this course if you like the course please leave a thumbs up on this video 16369 05:30:36,788 --> 05:30:36,798 please leave a thumbs up on this video 16370 05:30:36,798 --> 05:30:38,708 please leave a thumbs up on this video on my channel i actually cover 16371 05:30:38,708 --> 05:30:38,718 on my channel i actually cover 16372 05:30:38,718 --> 05:30:40,628 on my channel i actually cover lots of different devops topics like 16373 05:30:40,628 --> 05:30:40,638 lots of different devops topics like 16374 05:30:40,638 --> 05:30:41,910 lots of different devops topics like docker ci cd 16375 05:30:41,910 --> 05:30:41,920 docker ci cd 16376 05:30:41,920 --> 05:30:45,030 docker ci cd terraform and more so be sure to check 16377 05:30:45,030 --> 05:30:45,040 terraform and more so be sure to check 16378 05:30:45,040 --> 05:30:45,590 terraform and more so be sure to check out 16379 05:30:45,590 --> 05:30:45,600 out 16380 05:30:45,600 --> 05:30:47,990 out my tutorials if you're learning python 16381 05:30:47,990 --> 05:30:48,000 my tutorials if you're learning python 16382 05:30:48,000 --> 05:30:49,830 my tutorials if you're learning python to become a devops engineer 16383 05:30:49,830 --> 05:30:49,840 to become a devops engineer 16384 05:30:49,840 --> 05:30:52,230 to become a devops engineer i actually have a complete devops 16385 05:30:52,230 --> 05:30:52,240 i actually have a complete devops 16386 05:30:52,240 --> 05:30:53,190 i actually have a complete devops bootcamp 16387 05:30:53,190 --> 05:30:53,200 bootcamp 16388 05:30:53,200 --> 05:30:55,590 bootcamp with all the technologies you need to 16389 05:30:55,590 --> 05:30:55,600 with all the technologies you need to 16390 05:30:55,600 --> 05:30:57,750 with all the technologies you need to learn as a devops engineer 16391 05:30:57,750 --> 05:30:57,760 learn as a devops engineer 16392 05:30:57,760 --> 05:31:00,390 learn as a devops engineer which also includes a module for 16393 05:31:00,390 --> 05:31:00,400 which also includes a module for 16394 05:31:00,400 --> 05:31:02,548 which also includes a module for automation with python 16395 05:31:02,548 --> 05:31:02,558 automation with python 16396 05:31:02,558 --> 05:31:05,350 automation with python with several cool demo projects to 16397 05:31:05,350 --> 05:31:05,360 with several cool demo projects to 16398 05:31:05,360 --> 05:31:06,310 with several cool demo projects to automate some 16399 05:31:06,310 --> 05:31:06,320 automate some 16400 05:31:06,320 --> 05:31:10,150 automate some common devops tasks like application and 16401 05:31:10,150 --> 05:31:10,160 common devops tasks like application and 16402 05:31:10,160 --> 05:31:11,510 common devops tasks like application and server monitoring 16403 05:31:11,510 --> 05:31:11,520 server monitoring 16404 05:31:11,520 --> 05:31:14,548 server monitoring cloud automation tasks with aws 16405 05:31:14,548 --> 05:31:14,558 cloud automation tasks with aws 16406 05:31:14,558 --> 05:31:17,830 cloud automation tasks with aws jenkins etc so if you're interested 16407 05:31:17,830 --> 05:31:17,840 jenkins etc so if you're interested 16408 05:31:17,840 --> 05:31:20,548 jenkins etc so if you're interested check out more info in the description 16409 05:31:20,548 --> 05:31:20,558 check out more info in the description 16410 05:31:20,558 --> 05:31:22,470 check out more info in the description also happy to connect with you on social 16411 05:31:22,470 --> 05:31:22,480 also happy to connect with you on social 16412 05:31:22,480 --> 05:31:23,030 also happy to connect with you on social media 16413 05:31:23,030 --> 05:31:23,040 media 16414 05:31:23,040 --> 05:31:25,190 media so i would love to see you there with 16415 05:31:25,190 --> 05:31:25,200 so i would love to see you there with 16416 05:31:25,200 --> 05:31:26,230 so i would love to see you there with that said 16417 05:31:26,230 --> 05:31:26,240 that said 16418 05:31:26,240 --> 05:31:28,150 that said thank you for watching and see you in 16419 05:31:28,150 --> 05:31:28,160 thank you for watching and see you in 16420 05:31:28,160 --> 05:31:31,040 thank you for watching and see you in the next video 1371133

Can't find what you're looking for?
Get subtitles in any language from opensubtitles.com, and translate them here.