Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi, I have a question about Python. I don't have any experience in Python as I've only really ever coded in mostly C++ or C,

Hi, I have a question about Python. I don't have any experience in Python as I've only really ever coded in mostly C++ or C, and I'm confused about how to read a string from a printed statement. For example, if I print out a statement as follows: print(Home = + getHome(car, 45, mercedes)), I understand that this would call on the function getHome and do whatever that function tells the program to do. My question is, what do I do to be able to read those three words within the brackets and print out what is needed. Like for above, how would I be able to "read" that there is car in between the first quotations (anything can go in between these parentheses so how would i read the word in there), the numbers after the comma, and then the word within the next quotations. Here is an example using the above statement with a sort of psuedocode:

print(Home = + getHome(car, 45, mercedes))

def getHome

read the words and numbers within the parentheses

if (first word = car)

{

print("statement")

}

else if (second number > 40 || < 60)

{

print("statement")

}

else if (third word = mercedes)

{

print("statement")

}

I don't need an exact code or anything that needs to run, I more just want an explanation on how to read those statements and print out what is needed accordingly. I will be sure to rate if I find the answer helpful. Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database And Expert Systems Applications 33rd International Conference Dexa 2022 Vienna Austria August 22 24 2022 Proceedings Part 2 Lncs 13427

Authors: Christine Strauss ,Alfredo Cuzzocrea ,Gabriele Kotsis ,A Min Tjoa ,Ismail Khalil

1st Edition

3031124251, 978-3031124259

More Books

Students also viewed these Databases questions

Question

6. Be able to choose and prepare a training site.

Answered: 1 week ago