Tag: Python

From Apple to Raspberry Pi: Using Strings

There are several ordered types in Python, one of the most common is the string. In Xcode, we defined a NSString this way: Objective-C has the @”…” indicators for a string. Python on the other hand can use the much easier “…” or ‘…’… Continue Reading “From Apple to Raspberry Pi: Using Strings”

From Apple to Raspberry Pi: Using Inheritance and Overrides

Object oriented languages have a  concept called inhertance. A class can give its methods and properties to another class, which then replaces or expands the inherited class. We call the new class a subclass. When we replace a function or method we override the… Continue Reading “From Apple to Raspberry Pi: Using Inheritance and Overrides”

From Apple to Raspberry Pi: Importing Classes and Disturbing Attributes.

I didn’t do as much As I thought I would today, as I was installing tightvnc on the Raspberry Pi. I then tried out acessing my RasPi on my Mac, Pc, and even my iPad mini. I wasn’t nuts enough t try it on… Continue Reading “From Apple to Raspberry Pi: Importing Classes and Disturbing Attributes.”

from Apple to Raspberry Pi: Making Classes in Python

Objective-C and Python are similar when it comes to defining new classes, but be careful with their differences. In Objective-C we would define a class with two files: a header and an implementation file. In the header we would declare properties like this And… Continue Reading “from Apple to Raspberry Pi: Making Classes in Python”

From Apple to Raspberry Pi: Transitioning into Functions.

When I started Making App Pie, one of my big frustrations was wrapping my head around defining methods. I was used to C++ and Java functions. Objective-C and its Smalltalk roots just threw me. Now going into Python is difficult too — but for… Continue Reading “From Apple to Raspberry Pi: Transitioning into Functions.”

From Apple to Raspberry Pi: While Loops

In Xcode, both in Objective-C and C, we have the while loop. The python equivalent is also while Since we already understand the block, know sometimes as a suite in Python, while loops in  Python are very simple to use. We can use break… Continue Reading “From Apple to Raspberry Pi: While Loops”

Apple to Raspberry Pi: Python’s If

In Objective-C, we would write an if statement like this: if(number1 == number2){ NSLog(@”equal”); } in Python it is this: if number1==number2 : print(‘equal’) There is no parentheses required around the logical expression. Instead of the {} to show the block to run, a… Continue Reading “Apple to Raspberry Pi: Python’s If”

From Apple to Raspberry Pi: Variables and Types

I’m trying to learn Python for my new Raspberry Pi — though with all the app development I do that is not so easy. I need to wrap my head around some very different concepts. The first concept that is obvious is the dynamic… Continue Reading “From Apple to Raspberry Pi: Variables and Types”