├── .gitignore ├── Day 2 - Python Datetime objects and Timedelta ├── Thank you.png ├── Questions.txt ├── Q1_BeforeChristmas.py ├── README.md └── Q2_TimeDifference.py ├── Day 3 - Datetime strftime and strptime ├── day3_qns_1_solution.py ├── day3_qns_2_solution.py ├── Questions.txt └── README.md ├── Day 4 - Datetime Timezone and Unix Timestamp ├── questions.txt └── README.md ├── Day 1 - Python Logging ├── solution.py ├── convert_print_to_logging.py └── README.md ├── LICENSE └── README.md /.gitignore: -------------------------------------------------------------------------------- 1 | 2 | .idea/ 3 | .DS_Store/ 4 | -------------------------------------------------------------------------------- /Day 2 - Python Datetime objects and Timedelta/Thank you.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/pylenin/Python30/HEAD/Day 2 - Python Datetime objects and Timedelta/Thank you.png -------------------------------------------------------------------------------- /Day 3 - Datetime strftime and strptime/day3_qns_1_solution.py: -------------------------------------------------------------------------------- 1 | """ 2 | Solution provided by Mostapha Amenchar 3 | """ 4 | 5 | from datetime import datetime 6 | date_time = datetime(2020, 3, 8) 7 | date_string = datetime.strftime(date_time, "%A, %-d %B %Y") 8 | print(date_string) 9 | -------------------------------------------------------------------------------- /Day 3 - Datetime strftime and strptime/day3_qns_2_solution.py: -------------------------------------------------------------------------------- 1 | """ 2 | Solutions provided by Mostapha Amenchar 3 | """ 4 | from datetime import datetime 5 | date_string = "Jan 20, 2019 9:30 AM" 6 | date_time = datetime.strptime(date_string, "%b %d, %Y %I:%M %p") 7 | 8 | print(date_time) 9 | -------------------------------------------------------------------------------- /Day 4 - Datetime Timezone and Unix Timestamp/questions.txt: -------------------------------------------------------------------------------- 1 | 1) Write a Python program to convert the current unix timestamp 2 | string to readable date and time in the below format 3 | 4 | Desired format - "June 15, 2019 7.30 PM" 5 | 6 | 2) If you are living in New York, how sooner or later would you 7 | be celebrating New year compared to someone living in India. 8 | 9 | 10 | -------------------------------------------------------------------------------- /Day 3 - Datetime strftime and strptime/Questions.txt: -------------------------------------------------------------------------------- 1 | """ 2 | Provide your solutions for the questions below. 3 | The best solutions go into the #Python30 Hall of Fame. 4 | """ 5 | 1. Convert 9 AM of International Women's day of 2020 to the following format. 6 | --> "Sunday, 8 March 2020" 7 | 8 | 2. Convert the following date string to datetime object. 9 | --> "Jan 20, 2019 9:30 AM" 10 | -------------------------------------------------------------------------------- /Day 2 - Python Datetime objects and Timedelta/Questions.txt: -------------------------------------------------------------------------------- 1 | """ 2 | Provide your solutions for the questions below. 3 | The best solutions go into the #Python30 Hall of Fame. 4 | """ 5 | 1. What date is 3 weeks and 4 days before Christmas? 6 | 7 | 2. What is the time difference between January 1, 2019 11 AM 8 | and May 20, 2020 22.30 PM? Mention both the days and time 9 | in your solution. 10 | -------------------------------------------------------------------------------- /Day 2 - Python Datetime objects and Timedelta/Q1_BeforeChristmas.py: -------------------------------------------------------------------------------- 1 | """ 2 | 1. What date is 3 weeks and 4 days before Christmas? 3 | Solution provided by Sanjay Siddha 4 | """ 5 | 6 | 7 | 8 | from datetime import timedelta, date 9 | 10 | 11 | christmas_date = date(year=2019, month=12, day=25) 12 | three_weeks_before = timedelta(weeks=3, days=4) 13 | output = (christmas_date - three_weeks_before) 14 | print("3 weeks and 4 days before the christmast would be ", output) 15 | 16 | -------------------------------------------------------------------------------- /Day 3 - Datetime strftime and strptime/README.md: -------------------------------------------------------------------------------- 1 | # Day 3 - Understanding Python Datetime objects and Timedelta 2 | 3 | ## Related Youtube video - https://youtu.be/qk7qqbZxJGo 4 | ## Topics covered 5 | 6 | * strftime() 7 | * strptime() 8 | 9 | 10 | ## Support 11 | Hope you learnt a lot about strptime and strftime. 12 | 13 | Would you like to support this course? All you need to do is copy and paste it to Twitter and tweet it. 14 | 15 | ``Just finished Day 3 of #Python30 with @pylenin learning about python strftime and strptime. Here is the link to the Github repository 16 | https://github.com/pylenin/Python30`` 17 | 18 | **OR**.. just write your own tweet !! Please make sure to mention `#Python30` and me`@pylenin` in your tweet. 19 | -------------------------------------------------------------------------------- /Day 1 - Python Logging/solution.py: -------------------------------------------------------------------------------- 1 | import logging 2 | import requests 3 | import requests.exceptions 4 | 5 | logging.basicConfig(filename="requests.log", format='%(asctime)s :: %(levelname)s :: %(name)s :: Line No %(lineno)d :: %(message)s') 6 | 7 | def main(): 8 | try: 9 | requests.get("htt://www.0miles.com") 10 | except requests.exceptions.ConnectionError: 11 | logging.error("Could not find server. Check your network connection.") 12 | except requests.exceptions.InvalidSchema: 13 | logging.error("No connection adapters were found for your GET request") 14 | except Exception as x: 15 | logging.error("Oh that didn't work!: {}".format(x)) 16 | 17 | 18 | if __name__ == '__main__': 19 | main() 20 | -------------------------------------------------------------------------------- /Day 4 - Datetime Timezone and Unix Timestamp/README.md: -------------------------------------------------------------------------------- 1 | # Day 4 - Dealing with timezones and unix timestamp 2 | 3 | ## Related Youtube video - https://youtu.be/CVRkU5mB8YM 4 | ## Topics covered 5 | 6 | * Dealing with timezones 7 | * Converting unix timestamp to datetime and vice-versa 8 | 9 | 10 | ## Support 11 | Hope you learnt something useful. 12 | 13 | Would you like to support this course? All you need to do is copy and paste it to Twitter and tweet it. 14 | 15 | ``Just finished Day 4 of #Python30 with @pylenin learning about timezones and unix timestamp in python. Here is the link to the Github repository 16 | https://github.com/pylenin/Python30`` 17 | 18 | **OR**.. just write your own tweet !! Please make sure to mention `#Python30` and me`@pylenin` in your tweet. 19 | -------------------------------------------------------------------------------- /Day 1 - Python Logging/convert_print_to_logging.py: -------------------------------------------------------------------------------- 1 | """ 2 | Use logging in this example to print messages 3 | to a file called 'requests.log' in the 4 | following format 5 | 6 | > 2019-03-03 17:18:32,703 :: INFO :: Root :: Line No 1 :: This is the logging message! 7 | """ 8 | 9 | import requests 10 | import requests.exceptions 11 | 12 | def main(): 13 | try: 14 | requests.get("htt://www.0miles.com") 15 | except requests.exceptions.ConnectionError: 16 | print("Could not find server. Check your network connection.") 17 | except ValueError: 18 | print("No connection adapters were found for your GET request") 19 | except Exception as x: 20 | print("Oh that didn't work!: {}".format(x)) 21 | 22 | 23 | if __name__ == '__main__': 24 | main() 25 | -------------------------------------------------------------------------------- /Day 2 - Python Datetime objects and Timedelta/README.md: -------------------------------------------------------------------------------- 1 | # Day 2 - Understanding Python Datetime objects and Timedelta 2 | 3 | ## Related Youtube video - https://youtu.be/B4X1gidJzTs 4 | ## Topics covered 5 | 6 | * Understanding the datetime class 7 | * Getting current date and time 8 | * How to use timedelta? 9 | 10 | 11 | ## Support 12 | Hope you learnt a lot about datetime objects and timedelta class. 13 | 14 | Would you like to support this course? All you need to do is copy and paste it to Twitter and tweet it. 15 | 16 | ``Just finished Day 2 of #Python30 with @pylenin learning about datetime objects and timedelta in Python. Here is the link to the Github repository 17 | https://github.com/pylenin/Python30`` 18 | 19 | **OR**.. just write your own tweet !! Please make sure to mention `#Python30` and me`@pylenin` in your tweet. 20 | -------------------------------------------------------------------------------- /Day 1 - Python Logging/README.md: -------------------------------------------------------------------------------- 1 | # Day 1 - A simple guide to Python Logging 2 | 3 | ## Related Youtube video - https://youtu.be/HJIz1PTMmuE 4 | ## Topics covered 5 | 6 | * Catching exceptions with Print 7 | * Is Print sufficient? 8 | * Introduction to Python logging 9 | * Levels of Python Logging 10 | * Logging Basicconfig() method 11 | * Logging to a file 12 | * Why should we use a custom logger? 13 | * Advantages of a custom logger method. 14 | 15 | 16 | ## Support 17 | Hope you learnt a lot about logging. 18 | 19 | Would you like to support this course? All you need to do is copy and paste it to Twitter and tweet it. 20 | 21 | ``Just finished Day 1 of #Python30 with @pylenin learning about Logging in Python. Here is the link to the Github repository 22 | https://github.com/pylenin/Python30`` 23 | 24 | **OR**.. just write your own tweet !! Please make sure to mention `#Python30` and me`@pylenin` in your tweet. 25 | -------------------------------------------------------------------------------- /Day 2 - Python Datetime objects and Timedelta/Q2_TimeDifference.py: -------------------------------------------------------------------------------- 1 | """ 2 | 2. What is the time difference between January 1, 2019 11 AM 3 | and May 20, 2020 22.30 PM? Mention both the days and time 4 | in your solution. 5 | Solution provided by Sanjay Siddha 6 | """ 7 | 8 | 9 | from datetime import datetime, timedelta 10 | 11 | future_date = datetime(year=2020, month=5, day=20, hour=22, minute=30) 12 | old_date = datetime(year=2019, month=1, day=1, hour=11) 13 | 14 | time_difference = future_date - old_date 15 | 16 | print("Difference in days.. ", (time_difference.days*24 + time_difference.seconds/3600)/24) 17 | # Question is - what is the time difference, therefore my answer would be.. 18 | print("Difference in hours ", time_difference.days*24 + time_difference.seconds/3600) 19 | print("Differene in seconds", time_difference.total_seconds()) 20 | 21 | days = time_difference.days 22 | hours = divmod(time_difference.seconds, 3600) 23 | minutes = hours[1]/60 24 | 25 | # Expected Output. 26 | print("Time difference is ", days, " days, " , hours[0] ,"hours and ", minutes , "mins") 27 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | MIT License 2 | 3 | Copyright (c) 2019 pylenin 4 | 5 | Permission is hereby granted, free of charge, to any person obtaining a copy 6 | of this software and associated documentation files (the "Software"), to deal 7 | in the Software without restriction, including without limitation the rights 8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 9 | copies of the Software, and to permit persons to whom the Software is 10 | furnished to do so, subject to the following conditions: 11 | 12 | The above copyright notice and this permission notice shall be included in all 13 | copies or substantial portions of the Software. 14 | 15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE 21 | SOFTWARE. 22 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # #Python30 with Pylenin 2 | 3 | ## Course Summary 4 | 5 | Python30 is designed to help the beginners in Python to improve their skills and take them a notch further. This course is divided into videos and question sets. Within 30 days, you will subject yourself to varities of concepts, libraries and frameworks in Python. All of the materials will help you kickstart your search for a dream job in the field of Python. The course has been curated by taking into consideration the various Python topics that companies expect their candidates to be aware of. So join the course and get started. 6 | 7 | ## Python Topics covered 8 | 9 | This course is not just about its content. its also about having the will to push yourself in the new domains that you might find challenging and being active. Every time you come across a new topic or have doubts/concerns, reach out to me [@pylenin](https://twitter.com/pylenin). 10 | 11 | Here are the topics covered in this course. 12 | 13 | * A guide to logging in Python 14 | * Mastering Python Datetime 15 | * Regular Expressions 16 | * Python Error Handling 17 | * Building a game in Tkinter 18 | * Pytest 19 | * A concide guide to Requests 20 | 21 | Other topics are coming soon. They are in the preparation phase. 22 | 23 | ## Support 24 | I have put a lot of efforts into this course. In return, I request you to help spread the word about this course. Please tweet or post on your favorite social media platform with [#Python30](#Python30) and tag me in your posts, everytime you finish a day of coding. Challenge your friends and help everyone learn. 25 | --------------------------------------------------------------------------------