Why Is the Apt-Get Function Not Working in the Terminal on MAC Os X V10.9 (Mavericks)

Why can't I use apt-get on Mac even though wget is installed

macOS doesn't use apt as its package manager. Homebrew is the most popular package manager for macOS. Additionally, wget has no relation to the package manager, apt. See the awesome answer here for more information.

I would try this search for getting it ROS working with Mac. This SO question might be of relevance too.

How to get the mac terminal to be using UTF-8 encoding on the new macs?

.zshrc and .profile only exist if someone creates them. You do that in Terminal with

touch ~/.zshrc
touch ~/.profile

Check what shell you are using. In Terminal

echo $SHELL

It is recommended to use the Z shell, you change this with

chsh -s /bin/zsh

and then you need to restart Terminal for it to take effect. I think with the Z shell .profile may be ignored, and only .zshrc may be used.

Quite likely there is no real change how the M1 Macs work compared to Intel Macs; you just created these files on your old Mac many years ago and have all forgotten about it.

Why do I get invalid syntax assigning local variables AFTER an IF statement in a function?

You get invalid syntax because Python, unlike other languages, utilizes space/tab to keep track of block of codes. A proper Python if statement (with elif) looks like so:

a = 10

if a == 0:
b = 10
elif a == 1:
b = 100
else:
b = 1000

elif, as you might expect, requires an if statement before it can be used. When you break the spacing:

a = 10

if a == 0:
b = 10

a = 1

elif a == 1:
b = 100
else:
b = 1000

Python does not know where elif a == 1 is connected to, and thus gives you a syntax error. You likely meant:

def isIn(char, aStr):
if len(aStr) <= 1 and char != aStr:
return False

HALF = len(aStr) // 2

# 'if', not 'elif' here.
if char == aStr[HALF]:
return True
elif char < aStr[HALF]:
return isIn(char, aStr[:HALF])
else:
return isIn(char, aStr[HALF:])


print(isIn('a', ''))


Related Topics



Leave a reply



Submit