Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code help?
#11
(May-21-2020, 01:57 PM)Beau Wrote: Ok well this has really blown my mind now im a beginner don't forget lol...
so I watched and read you cant have strings and numbers on the same print line??? that's first

secondly I am sure your version is heaps better although I have no idea what sep=' ' is or what the f' is after print(f' haha sorry not that far in yet....

In your simple code, you do need to convert numeric values to strings in order to use the '+' operator to concatenate (join them together to be printed by your print statement). If you don't convert the number to a string first, you would be trying to add a string value and a numeric value, which would result in an error.

As dean's post illustrates, there are a LOT of different ways of doing the same thing when you are writing code. When learning (and I say this as someone just starting out myself), step one is figuring out how to do something and get the result you want. Steps two through one million are figuring out how to do it more efficiently. Big Grin
Reply


Messages In This Thread
Code help? - by Beau - May-21-2020, 12:17 PM
RE: Code help? - by GOTO10 - May-21-2020, 12:30 PM
RE: Code help? - by Beau - May-21-2020, 12:56 PM
RE: Code help? - by GOTO10 - May-21-2020, 01:20 PM
RE: Code help? - by pyzyx3qwerty - May-21-2020, 01:34 PM
RE: Code help? - by GOTO10 - May-21-2020, 01:50 PM
RE: Code help? - by pyzyx3qwerty - May-22-2020, 10:06 AM
RE: Code help? - by Beau - May-21-2020, 01:38 PM
RE: Code help? - by deanhystad - May-21-2020, 01:48 PM
RE: Code help? - by Beau - May-21-2020, 01:48 PM
RE: Code help? - by Beau - May-21-2020, 02:00 PM
RE: Code help? - by GOTO10 - May-21-2020, 02:04 PM
RE: Code help? - by Beau - May-21-2020, 02:10 PM
RE: Code help? - by deanhystad - May-21-2020, 02:36 PM
RE: Code help? - by Beau - May-21-2020, 07:56 PM

Forum Jump:

User Panel Messages

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