How quick can I learn "python"???

andymc

Well-Known Member
Licensed User
Longtime User
I've got a phone interview for a new devops job but they're hot on people knowing python. I've never touched it, but I've got a few days before the phone interview. How quickly could I learn it so I can say I have a basic understanding of python programming? Maybe I could convert some of my b4a games to it using the pygame library as a way to learn it?
 

MarkusR

Well-Known Member
Licensed User
Longtime User
i know python from raspberry pi, its very difficult/terrible if you develop just with a text editor, if you have a IDE for it i think its more fun.
if you know other languages, python is a piece of s***
i can not understand why people favor or use this.
(if you like to make games see app game kit from tgc)
 

MaFu

Well-Known Member
Licensed User
Longtime User
Python is a very nice language imho. I use it on the Pi and in combination with the Kivy framework you can create very simple greatful GUI's for touch displays.
For coding i recommend VisualStudio Code. I use it for all script languages (Python, Lua, JavaScript/node.js) and coding/debugging is very comfortable.
 

MarkusR

Well-Known Member
Licensed User
Longtime User
python
B4X:
#!/usr/bin/python
# MR 13.01.2018 12:42

import RPi.GPIO as GPIO
import subprocess
import time

# Function
def capture(channel):
    print("capture")
    subprocess.call(['/home/pi/MyWebCam/capture.sh'])
    return;

PIR=14
GPIO.setmode(GPIO.BCM)
GPIO.setup(PIR,GPIO.IN)

GPIO.add_event_detect(PIR,GPIO.RISING, callback=capture)

print("await pir ...")
try:
        while True:
                time.sleep(1)

except KeyboardInterrupt:
    print("interrupted/end")
    GPIO.cleanup()

non python
B4X:
REM MR 13.01.2018 12:42

use RPi.GPIO as GPIO
use Shell
use Keyboard

Dim PIR as Integer = 14
GPIO.setmode GPIO.BCM
GPIO.setup PIR,GPIO.IN

GPIO.add_event_detect(PIR,GPIO.RISING, capture)

print "await pir ..."
do
     WaitEvent
    If Keyboard.Key.Pressed(Key.ESC) then
        print "interrupted/end"
         exit  
    endif
loop
GPIO.cleanup
end

sub capture(channel as integer)
    print "capture"
    execute "/home/pi/MyWebCam/capture.sh"
end sub
 

thedesolatesoul

Expert
Licensed User
Longtime User
I've got a phone interview for a new devops job but they're hot on people knowing python. I've never touched it, but I've got a few days before the phone interview. How quickly could I learn it so I can say I have a basic understanding of python programming? Maybe I could convert some of my b4a games to it using the pygame library as a way to learn it?

Python is pretty neat when it comes to syntax and data structures. Has good core libraries too.

However, it is geared for certain kind of applications (and currently gamedev isnt popular), so its quite popular in devops as a glue language.
You can hopefully skim through this: https://automatetheboringstuff.com/ and then some generic interview questions (decorators, generators, list/dict comprehensions) should be enough for the interview.
For gamedev this library seems new and interesting: https://github.com/kitao/pyxel However you may notice its not too sophisticated either.

As with most languages, python has some shortcomings. weak-typing, interpreted, hard to get performance etc. Async is only in python3 etc, packaging.
Its really all possible in python, its just too deep and introspective so it will allow everything (dynamic attributes, hot loading etc), but will have some caveat somewhere.

Python has a certain philosophy, so it expects things to be done in a certain way called 'pythonic' (this makes it easier to learn). Also concepts like 'better to ask forgiveness' than 'check for permission' that prefers the use of Exceptions.

For an IDE, I personally use emacs (free) and PyCharm (Community edition is free) , but VS Code (free) is quite popular too.
 

eurojam

Well-Known Member
Licensed User
Longtime User
Python is awesome (https://awesome-python.com/)!! It is powerful, easy to read and write. there are so much great libraries and a lot of great projects have a Python API. Don't hesitate to start with python - if you like B4A you will love Python. There are a lot of tutorials out there (...https://www.learnpython.org/...).

Python is my first choice....after B4A of courrse;-)
 
Top