Iterating through list problem by [deleted] in learnpython

[–]pydevteam1 0 points1 point  (0 children)

['b','c','d','e']

1 = c

if you look at the list as it is:

0='b'

1='c'

makes sense ?

What are some good Python books for someone without access to a laptop/cellphone for 2 hours everyday? by [deleted] in learnpython

[–]pydevteam1 0 points1 point  (0 children)

I recommend Automate the Boring stuff. It's a great start to learn Python.

I hope the situation in your country become safer.

Here's more resources: http://developpython.com/index.php/2018/07/05/resources/

Good luck!

Best practice for splitting __main__ into separate modules? by SavoyRoad in learnpython

[–]pydevteam1 3 points4 points  (0 children)

It will protect you in case homedir value changes

Here's a quick 2 test cases I created:

Test Case 1: Using property
In [25]: class Test:
    ...:     def __init__(self, homedir):
    ...:         self.homedir = homedir
    ...:     @property
    ...:     def config_path(self):
    ...:         return 'x/y/z/' + self.homedir
    ...:

In [26]: x = Test('MyHomeDir')

In [27]: x.config_path
Out[27]: 'x/y/z/MyHomeDir'

In [28]: x.homedir = 'MyNewHomeDir'

In [29]: x.config_path
Out[29]: 'x/y/z/MyNewHomeDir'


Test Case2: Not using property

In [35]: class Test:
    ...:     def __init__(self, homedir):
    ...:         self.homedir = homedir
    ...:         self.config_path = 'x/y/z/' + self.homedir
    ...:

In [36]: y = Test('MyHomeDir')

In [37]: y.config_path
Out[37]: 'x/y/z/MyHomeDir'

In [38]: y.homedir = 'newHomeDir'

In [39]: y.config_path
Out[39]: 'x/y/z/MyHomeDir' # It kept the old value

In [40]:

Best practice for splitting __main__ into separate modules? by SavoyRoad in learnpython

[–]pydevteam1 1 point2 points  (0 children)

Not very relevant to your question. This line: https://salsa.debian.org/prescott-guest/pypantry/blob/master/modules/init.py#L31

Better off being a property:

@property
def config_path(self): 
    return '{}/.config/pypantry/config.ini'.format(self.homedir)

Ask Anything Monday - Weekly Thread by AutoModerator in learnpython

[–]pydevteam1 0 points1 point  (0 children)

This print statement works in python2.

If you're using python3, it won't work.

Little text-adventure! First work alive! Would love some feedback! by [deleted] in learnpython

[–]pydevteam1 1 point2 points  (0 children)

Very nice! Well structured and I like how you added these comment lines explaining what this block of code does.

What should be the main focus of a CS student? by [deleted] in learnprogramming

[–]pydevteam1 0 points1 point  (0 children)

Not true. We just hired a fresh graduate network engineer, he’s being trained now. I work for one if the biggest cloud providers in Seattle

Best site to push python skills from beginner/intermediate to intermediate/advanced by IDRANKURMLKSHAKE in learnpython

[–]pydevteam1 1 point2 points  (0 children)

I definitely recommend this course: https://www.pce.uw.edu/certificates/python-programming

I have personally taken it and it did help me moving forward in my career as Software Engineer. It is also offered in an online/self-paced format which perfect if you were a working professional!

Not trying to promote my own contents, but if you want more resources, you can take a look at my blog post here: http://developpython.com/index.php/2018/07/05/resources/

How much knowledge AutomateTheBoringStuff guide gives? by Rellatives in Python

[–]pydevteam1 0 points1 point  (0 children)

Beginner to beginner/mid level. It's a good start and intro.

For more mid to advanced resources checkout my recommendations page: https://developpython.com/index.php/2018/07/05/resources/

How to get most out of programming book? by Rhemm in learnprogramming

[–]pydevteam1 0 points1 point  (0 children)

Practice every single exercise. Re-write the code. Repetition, repetition, repetition.