Python

Post Reply
User avatar
Troy
Posts: 7156
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

I know we have lots of coders on this board. I've been looking for a project recently and would love to start my baby steps towards coding. Python first. I'm a super newbie and these will seem dumb to a lot of you.

Working through an online exercise. I don't want to keep going until I can get the ouput i really want for this early problem. Messing with really basic functions.

message = "Where in the world is Carmen Sandiego"
print((message))
print("
" + "Carmen can be found at postion: ")
print(message.find("Carmen"))
print("
" + "Sandiego can be found at position: ")
print(message.find("Sandiego"))

The output is right, but not structured how I want it. I want it all in one line - when I try something like:

print("'Carmen' can be found at position " + (message.find("Carmen")) + ". " + "'Sandiego' can be found at position " + (message.find("Sandiego")) + ".")

It errors out. Any ideas? (that are super newbie friendly)




Edited By Troy on 1450896052
TheCatt
Site Admin
Posts: 53729
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

The
are newlines. Remove those and see if it's closer to what you want.
It's not me, it's someone else.
User avatar
Troy
Posts: 7156
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

I added those because they cleaned up earlier exercises.

The one I can't figure out doesn't have any. I guess i really want to know how to add a variable defined (or a function on a variable) into the same line of Print() that already has "text in it".




Edited By Troy on 1450896964
User avatar
Troy
Posts: 7156
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Found it. Without researching too far ahead what i wanted was the str() function.

This is what I wanted:

message = "Where in the world is Carmen Sandiego?"
print(message)
findcarmen = (message.find("Carmen"))
findsandiego = (message.find("Sandiego"))
print("Carmen can be found at postion: " + str(findcarmen))
print("Sandiego can be found at position: " + str(findsandiego))




Edited By Troy on 1450905148
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Ah python. That language was awesome until about a decade ago.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7156
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

Hopefully a good first one to learn and then translate to more topical languages. I'm buckling down for the learning part for now and will see if I still like it a month or two in.



Edited By Troy on 1450905373
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Ah, that. It's not a bad learning tool. Think they got the printf method in there now.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TheCatt
Site Admin
Posts: 53729
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Troy wrote:Hopefully a good first one to learn and then translate to more topical languages. I'm buckling down for the learning part for now and will see if I still like it a month or two in.
Ton of people use python, especially in the "data scientist" world. I've played around with it, but prefer other languages.
It's not me, it's someone else.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Data scientist? Wtf is that?
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
TheCatt
Site Admin
Posts: 53729
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Malcolm wrote:Data scientist? Wtf is that?
Can't tell if you are being serious.
It's not me, it's someone else.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

TheCatt wrote:
Malcolm wrote:Data scientist? Wtf is that?
Can't tell if you are being serious.
Is it a data specialist with delusions of grandeur.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
GORDON
Site Admin
Posts: 54400
Joined: Sun Jun 06, 2004 10:43 pm
Location: DTManistan
Contact:

Post by GORDON »

Troy wrote:Hopefully a good first one to learn and then translate to more topical languages. I'm buckling down for the learning part for now and will see if I still like it a month or two in.
Aren't you a lawyer? I'm curious why one of those would have any use for cross training in software development.
"Be bold, and mighty forces will come to your aid."
TheCatt
Site Admin
Posts: 53729
Joined: Thu May 20, 2004 11:15 pm
Location: Cary, NC

Post by TheCatt »

Malcolm wrote:Is it a data specialist with delusions of grandeur.
Uh, no. Generally someone with strong math background + computing. Generally master/phd level peeps.
It's not me, it's someone else.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

TheCatt wrote:
Malcolm wrote:Is it a data specialist with delusions of grandeur.

Uh, no. Generally someone with strong math background + computing. Generally master/phd level peeps.

So ... a normal computer scientist who sucks at designing processes and spends all their time analyzing info? Or are you speaking of what I'd call a numerical specialist? If that's the case, I wouldn't use Python due to performance reasons. I'd break out Matlab, Maple, or straight C.




Edited By Malcolm on 1450922730
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
User avatar
Troy
Posts: 7156
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

GORDON wrote:
Troy wrote:Hopefully a good first one to learn and then translate to more topical languages. I'm buckling down for the learning part for now and will see if I still like it a month or two in.

Aren't you a lawyer? I'm curious why one of those would have any use for cross training in software development.

I don't have a JD. I'm mostly graphic/technology support for intellectual property cases. Kind of like a specialized litigation paralegal.

I'm self taught on Adobe graphic products. I've dabbled in programming languages before, but never took the plunge to fully understand one. I think my furthest taught language before the last few weeks was HTML camp in HS.

I like my job but I also know the demand for people who can code in-demand languages is only going to keep growing. So far Python has been really fun, but ask me in a few months if I can keep up the learning.

e: and from what I have seen online, the public/free resources for learning are singularly available




Edited By Troy on 1450923271
User avatar
Troy
Posts: 7156
Joined: Mon Jun 07, 2004 8:00 am

Post by Troy »

And I've worked with a lot of IP Lawyers who can code. As recent as this 1st qtr and 3rd qtr this year, for 2 cases I worked on.



Edited By Troy on 1450928524
GORDON
Site Admin
Posts: 54400
Joined: Sun Jun 06, 2004 10:43 pm
Location: DTManistan
Contact:

Post by GORDON »

Consider me educated.
"Be bold, and mighty forces will come to your aid."
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Programming is all fun and games until you break into recursion. That's when it gets interesting.
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
thibodeaux
Posts: 8055
Joined: Thu May 20, 2004 7:32 pm

Post by thibodeaux »

TheCatt wrote:
Malcolm wrote:Is it a data specialist with delusions of grandeur.
Uh, no. Generally someone with strong math background + computing. Generally master/phd level peeps.
Best definition I've heard:

better at programming than a statistician, and better at stats than a programmer.
Malcolm
Posts: 32040
Joined: Fri May 21, 2004 1:04 pm
Location: Minneapolis

Post by Malcolm »

Is it a lot of actuarial computing, then?
Diogenes of Sinope: "It is not that I am mad, it is only that my head is different from yours."
Arnold Judas Rimmer, BSC, SSC: "Better dead than smeg."
Post Reply