Skip to main content
deleted 173 characters in body
Source Link
vvvvv
  • 33.1k
  • 19
  • 70
  • 104

I've started programming today and have this issue with Python. It's pretty dumb but I can't figure out how to do it. When I use the printprint command, it prints whatever I want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return:

this should be on the same line

but instead returns:

this should be
on the same line

More precisely I was trying to create a program with if that told me whether a number was a 2 or not

def test2(x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise the last (x) as the value entered, and rather prints exactly: "(x)" (the letter with the brackets). To make it work I have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. I enter test2(3) that gives:

Nope, that is not a two, that is a
3

So either iI need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If iI put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

I've started programming today and have this issue with Python. It's pretty dumb but I can't figure out how to do it. When I use the print command, it prints whatever I want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return:

this should be on the same line

but instead returns:

this should be
on the same line

More precisely I was trying to create a program with if that told me whether a number was a 2 or not

def test2(x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise the last (x) as the value entered, and rather prints exactly: "(x)" (the letter with the brackets). To make it work I have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. I enter test2(3) that gives:

Nope, that is not a two, that is a
3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

When I use the print command, it prints whatever I want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return:

this should be on the same line

but instead returns:

this should be
on the same line

More precisely I was trying to create a program with if that told me whether a number was a 2 or not

def test2(x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise the last (x) as the value entered, and rather prints exactly: "(x)" (the letter with the brackets). To make it work I have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. I enter test2(3) that gives:

Nope, that is not a two, that is a
3

So either I need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If I put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

corrected spelling and formatting of program output
Source Link

I've started programming today and have this issue with Python. It's pretty dumb but I can't fgurefigure out how to do it. When iI use the print command, it prints whatever iI want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return: this should be on the same line

this should be on the same line

but instead returns: this should be

on the same line

this should be
on the same line

More precisely I was trying to create a program with if that told me wheterwhether a number was a "22 or not

def test2 (x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise thatthe last (x)(x) as the value entered, and rather prints exactly: "(x)" (the letter with tethe brackets) And to. To make it work iI have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. iI enter test2 (3) that gives:

Nope, that is not a two, that is a

3

Nope, that is not a two, that is a
3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

I've started programming today and have this issue with Python. It's pretty dumb but I can't fgure out how to do it. When i use the print command, it prints whatever i want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return: this should be on the same line

but instead returns: this should be

on the same line

More precisely I was trying to create a program with if that told me wheter a number was a "2 or not

def test2 (x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise that last (x) as the value entered, and rather prints exactly: "(x)" (the letter with te brackets) And to make it work i have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. i enter test2 (3) that gives:

Nope, that is not a two, that is a

3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

I've started programming today and have this issue with Python. It's pretty dumb but I can't figure out how to do it. When I use the print command, it prints whatever I want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return:

this should be on the same line

but instead returns:

this should be
on the same line

More precisely I was trying to create a program with if that told me whether a number was a 2 or not

def test2(x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise the last (x) as the value entered, and rather prints exactly: "(x)" (the letter with the brackets). To make it work I have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. I enter test2(3) that gives:

Nope, that is not a two, that is a
3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

Post Closed as "Duplicate" by Baruch, Dirk, Ryan Bigg, falsetru, fedorqui
added 12 characters in body
Source Link
Levon
  • 144.2k
  • 35
  • 206
  • 194

I've started programming today and have this issue with Python. It's pretty dumb but I can't fgure out how to do it. When i use the print command, it prints whatever i want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return: this should be on the same line

but instead returns: this should be

on the same line

More precisely I was trying to create a program with if that told me wheter a number was a "2 or not

def test2 (x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise that last (x) as the value entered, and rather prints exactly: "(x)" (the letter with te brackets) And to make it work i have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. i enter test2 (3) that gives:

Nope, that is not a two, that is a

3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question. IMPORTANT NOTE

IMPORTANT NOTE: I am using version 2.5.4 Anotherversion 2.5.4

Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

I've started programming today and have this issue with Python. It's pretty dumb but I can't fgure out how to do it. When i use the print command, it prints whatever i want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return: this should be on the same line

but instead returns: this should be

on the same line

More precisely I was trying to create a program with if that told me wheter a number was a "2 or not

def test2 (x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise that last (x) as the value entered, and rather prints exactly: "(x)" (the letter with te brackets) And to make it work i have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. i enter test2 (3) that gives:

Nope, that is not a two, that is a

3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question. IMPORTANT NOTE: I am using version 2.5.4 Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

I've started programming today and have this issue with Python. It's pretty dumb but I can't fgure out how to do it. When i use the print command, it prints whatever i want and then goes to a different line. For example:

print "this should be"; print "on the same line"

Should return: this should be on the same line

but instead returns: this should be

on the same line

More precisely I was trying to create a program with if that told me wheter a number was a "2 or not

def test2 (x):
    if x == 2:
        print "Yeah bro, that's tottaly a two"
    else:
        print "Nope, that is not a two. That is a (x)"

But it doesn't recognise that last (x) as the value entered, and rather prints exactly: "(x)" (the letter with te brackets) And to make it work i have to write:

print "Nope, that is not a two. That is a"; print (x)

And if e.g. i enter test2 (3) that gives:

Nope, that is not a two, that is a

3

So either i need to make Python recognise my (x) inside a print line as the number; or to print two separate things but on the same line. Thanks in advance and sorry for such a stupid question.

IMPORTANT NOTE: I am using version 2.5.4

Another note: If i put print "Thing" , print "Thing2" it says "Syntax error" on the 2nd print.

added 16 characters in body
Source Link
Javicobos
  • 1.5k
  • 2
  • 10
  • 6
Loading
Source Link
Javicobos
  • 1.5k
  • 2
  • 10
  • 6
Loading