Python Forum
why is this variable not printing out properly?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
why is this variable not printing out properly?
#10
(Dec-27-2016, 07:16 AM)Mekire Wrote: The recommended way would be to use format.  String concatenation in general is not a great technique (though often the first thing taught >.>)

var1 = 2 + 2
 
print('The result of all calculations is {} and we are done.'.format(var1))

Could you please explain why that is?
To me, a simple typecast to string seems cleaner.
Reply


Messages In This Thread
RE: why is this variable not printing out properly? - by IAMK - Apr-08-2018, 04:21 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  Printing the variable from defined function jws 7 1,543 Sep-03-2023, 03:22 PM
Last Post: deanhystad

Forum Jump:

User Panel Messages

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