Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Brand new to programming
#5
Use Python3, don't learn 2.
With print statements, is it true you can not combine different types with a operator concatenation? You can only print out with a comma?
For example:
print('He', 110, ' World')
will work,
but,
print('He' + 110 + ' World)
will not.
I could try this out myself but I ran into an error this week with this and thought I'd throw it out there.

Actually, just cause now I'm curious, that is the correct result.
 print('He' + 110 + 'World)
  File "<stdin>", line 1
    print('He' + 110 + 'World)
    SyntaxError: EOL while scanning string literal
versus:
print('He',110, 'World')
He 110 World
Phil
Reply


Messages In This Thread
Brand new to programming - by joelarrabee - Sep-17-2018, 12:57 AM
RE: Brand new to programming - by ichabod801 - Sep-17-2018, 01:23 AM
RE: Brand new to programming - by joelarrabee - Sep-17-2018, 01:47 AM
RE: Brand new to programming - by ichabod801 - Sep-17-2018, 02:03 AM
RE: Brand new to programming - by pcsailor - Sep-17-2018, 03:03 AM
RE: Brand new to programming - by joelarrabee - Sep-17-2018, 03:16 AM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020