1

So I've been able to get printNow to show a single variable in a line but I need to display two in a single line, using the printNow feature (which I need to use over just the standard print feature). I can only get it to display one. I did a search and wasn't able to find any examples of multiple strings displayed on one line.

var1 = "text"
var2 = "this too"
   printNow ("Display this:" +str(var1) "And this:" +str(var2))

I am aware the above statement is wrong, but I wrote it like that to give a better example of what I am trying to do.

Pang
  • 9,564
  • 146
  • 81
  • 122
Countach
  • 597
  • 1
  • 10
  • 20
  • 2
    What is `printNow`? It's not a Python feature. – kindall Feb 14 '15 at 00:14
  • Ah, it's a JES feature. Which is a student environment program to learn Python. I've added the JES tag to the post. – Countach Feb 14 '15 at 00:17
  • 1
    When you say you know the statement is wrong, is that because it should be `"Display this:" +str(var1) + "And this:" +str(var2)` and you chose to not concatenate all the strings, or is that unintentional and thus most likely your problem? – Tom Feb 14 '15 at 00:23
  • Ah, it was unintentional and that was the issue. The code I added, I did it knowing it was wrong (by testing) whilst still trying to illustrate as best as I could what I was trying to do. I guess I could of worded it better, looks like I just forgot the + after the first variable and that was the issue it seems. Thanks a lot for your help. – Countach Feb 14 '15 at 00:33

0 Answers0