lundi 14 septembre 2020

How to put two lines to run in a if statement in a single line

How to add two lines of code to run in a if statement in python 3 but still in one line?

What I am trying to do is that i have two lines of code

print('Yes')
print('This is a dumb question')

And i have to run them in a if statement, like

if cat == "meow":
    print('Yes')
    print('This is a dumb question')

So i can do it in one line like

if cat == "meow":print('Yes')

Now i have to put the second print statement to the if statement while still maintaining it in 1 line, Can i do this?

Aucun commentaire:

Enregistrer un commentaire