Uploaded May 2021 | Updated November 2026, 1 week ago
CodingBat.com cigar_party solution explained in Python.
CodingBat Python Logic-1 cigar party answer.
Timestamps:
0:00-1:09 The Question
1:10-1:44 The Function
1:45-2:23 1st If Statement
2:24-3:15 2nd If Statement
3:16-4:25 Run the code
4:26-5:56 Refactor 1st If Statement
5:57-7:00 Refactor Second If Statement
7:01-7:38 Final code improvements
7:39 Final solution
cigar_party question:
When squirrels get together for a party, they like to have cigars. A squirrel party is successful when the number of cigars is between 40 and 60, inclusive. Unless it is the weekend, in which case there is no upper bound on the number of cigars. Return True if the party with the given values is successful, or False otherwise.
cigar_party(30, False) → False
cigar_party(50, False) → True
cigar_party(70, True) → True
💻 cigar_party - link to original answer on CodingBat.com:
codingbat.com/prob/p195669
💻 Python String Methods Course Playlist:
youtube.com/playlist?list=PL4eU-_ytIUt8Qa-90WL9LKTp8_4fvk6eS
💻 Python List Methods Course Playlist:
youtube.com/playlist?list=PL4eU-_ytIUt9vwky84Lp-5pK4ckzKbnTo
📖 Please check out my Udemy course here:
udemy.com/course/the-python-built-in-function-tutorial-series
⚙️ Recommended Computer Gear:
- Macbook Pro 13" amzn.to/39ZGrTb
- Macbook screen protector amzn.to/3s2a9x3
- Macbook USB-C adapter amzn.to/3dRICtd
- Macbook case amzn.to/3wMJhVk
- Foldable computer stand amzn.to/2QeCi76
- Airpods amzn.to/324gPAs
- Pixel 3a amzn.to/2PJa1Wr
- Pixel 3a screen protector amzn.to/3mytvcf
- Lapel Mic amzn.to/39Vf2lx
- Bluelight computer glasses amzn.to/3dSCIId
- Noise cancelling headphones amzn.to/2QhAR80
- JBL bluetooth speaker amzn.to/3dVfLEv
✈️ Recommended Digital Nomad Gear:
- Shorts with zippers amzn.to/3wHEepf
- Silicone earplugs amzn.to/3wSSzQ3
- Sleep mask amzn.to/3d6AUw5
- Packing cubes amzn.to/3uCbaOc
- Sink plug amzn.to/2QeiSzf
- Travel lock amzn.to/3t2Zsf4
- Nike sandals amzn.to/3d65FRV
- Nike freeruns amzn.to/3fZRWhi
- Thin no-show socks amzn.to/39Wa8og
- Quest bars amzn.to/3s8eWxd
- Incense amzn.to/3dPfEKF
- Electronics organizer bag amzn.to/3tbn3KO
CodingBat.com cigar_party solution explained in Python.
CodingBat Python Logic-1 cigar party answer.
Timestamps:
0:00-1:09 The Question
1:10-1:44 The Function
1:45-2:23 1st If Statement
2:24-3:15 2nd If Statement
3:16-4:25 Run the code
4:26-5:56 Refactor 1st If Statement
5:57-7:00 Refactor Second If Statement
7:01-7:38 Final code improvements
7:39 Final solution
cigar_party question:
When squirrels get together for a party, they like to have cigars. A squirrel party is successful when the number of cigars is between 40 and 60, inclusive. Unless it is the weekend, in which case there is no upper bound on the number of cigars. Return True if the party with the given values is successful, or False otherwise.
cigar_party(30, False) → False
cigar_party(50, False) → True
cigar_party(70, True) → True
💻 cigar_party - link to original answer on CodingBat.com:
codingbat.com/prob/p195669
💻 Python String Methods Course Playlist:
youtube.com/playlist?list=PL4eU-_ytIUt8Qa-90WL9LKTp8_4fvk6eS
💻 Python List Methods Course Playlist:
youtube.com/playlist?list=PL4eU-_ytIUt9vwky84Lp-5pK4ckzKbnTo
📖 Please check out my Udemy course here:
udemy.com/course/the-python-built-in-function-tutorial-series
⚙️ Recommended Computer Gear:
- Macbook Pro 13" amzn.to/39ZGrTb
- Macbook screen protector amzn.to/3s2a9x3
- Macbook USB-C adapter amzn.to/3dRICtd
- Macbook case amzn.to/3wMJhVk
- Foldable computer stand amzn.to/2QeCi76
- Airpods amzn.to/324gPAs
- Pixel 3a amzn.to/2PJa1Wr
- Pixel 3a screen protector amzn.to/3mytvcf
- Lapel Mic amzn.to/39Vf2lx
- Bluelight computer glasses amzn.to/3dSCIId
- Noise cancelling headphones amzn.to/2QhAR80
- JBL bluetooth speaker amzn.to/3dVfLEv
✈️ Recommended Digital Nomad Gear:
- Shorts with zippers amzn.to/3wHEepf
- Silicone earplugs amzn.to/3wSSzQ3
- Sleep mask amzn.to/3d6AUw5
- Packing cubes amzn.to/3uCbaOc
- Sink plug amzn.to/2QeiSzf
- Travel lock amzn.to/3t2Zsf4
- Nike sandals amzn.to/3d65FRV
- Nike freeruns amzn.to/3fZRWhi
- Thin no-show socks amzn.to/39Wa8og
- Quest bars amzn.to/3s8eWxd
- Incense amzn.to/3dPfEKF
- Electronics organizer bag amzn.to/3tbn3KO
![CodingBat sum3 answer - Python List 1
CodingBat.com sum3 solution explained in Python.
CodingBat Python sum3 answer. List 1.
Timestamps:
0:00-0:13 Intro
0:14-0:26 The Question
0:27-0:49 Analyze Question
0:50-1:26 First Solution with sum()
1:27-2:18 Second Solution with addition
2:19-3:49 Third Solution with for loop
3:50 Outro
sum3 Question:
Given an array of ints length 3, return the sum of all the elements.
sum3([1, 2, 3]) → 6
sum3([5, 11, 2]) → 18
sum3([7, 0, 0]) → 7
💻 sum3 - link to original question on CodingBat.com:
https://codingbat.com/prob/p191645
💻 Python String Methods Course Playlist:
https://www.youtube.com/playlist?list=PL4eU ytIUt8Qa-90WL9LKTp8_4fvk6eS
💻 Python List Methods Course Playlist:
https://www.youtube.com/playlist?list=PL4eU ytIUt9vwky84Lp-5pK4ckzKbnTo
📖 Please check out my Udemy course here:
https://www.udemy.com/course/the-python-built-in-function-tutorial-series/
⚙️ Recommended Computer Gear:
- Macbook Pro 13 https://amzn.to/39ZGrTb
- Macbook screen protector https://amzn.to/3s2a9x3
- Macbook USB-C adapter https://amzn.to/3dRICtd
- Macbook case https://amzn.to/3wMJhVk
- Foldable computer stand https://amzn.to/2QeCi76
- Airpods https://amzn.to/324gPAs
- Pixel 3a https://amzn.to/2PJa1Wr
- Pixel 3a screen protector https://amzn.to/3mytvcf
- Lapel Mic https://amzn.to/39Vf2lx
- Bluelight computer glasses https://amzn.to/3dSCIId
- Noise cancelling headphones https://amzn.to/2QhAR80
- JBL bluetooth speaker https://amzn.to/3dVfLEv
✈️ Recommended Digital Nomad Gear:
- Shorts with zippers https://amzn.to/3wHEepf
- Silicone earplugs https://amzn.to/3wSSzQ3
- Sleep mask https://amzn.to/3d6AUw5
- Packing cubes https://amzn.to/3uCbaOc
- Sink plug https://amzn.to/2QeiSzf
- Travel lock https://amzn.to/3t2Zsf4
- Nike sandals https://amzn.to/3d65FRV
- Nike freeruns https://amzn.to/3fZRWhi
- Thin no-show socks https://amzn.to/39Wa8og
- Quest bars https://amzn.to/3s8eWxd
- Incense https://amzn.to/3dPfEKF
- Electronics organizer bag https://amzn.to/3tbn3KO CodingBat sum3 answer - Python List 1](https://i.ytimg.com/vi/c8Q1n5LcYhQ/mqdefault.jpg)









