-4

On python my current code is:

Import random 
Import sys
Import os
Print ("Hello! What is your name traveller?")
    name = sys.stdin.readline ()
    training = ",we are in peril! Start your training 
    now!"
first_mission = (name + training)
    Print (first_mission)

It then runs like this: (example name: Dave)

Dave  
,We are under peril! Start your training now!

How do I make it run like this:

Dave , We are under peril! Start your training now!

Thanks!

DavidG
  • 24,279
  • 14
  • 89
  • 82

2 Answers2

1

I think it would be easier to do this:

import random 
import sys
import os

print("Hello! What is your name traveller?")

name = input()

training = " ,we are in peril! Start your training 
now!"

first_mission = (name + training)
print(first_mission)

Why?

It'd save you quite a bit of trouble. When you call the sys.stdin.readline() function, the text is read and a newline (\n) is put at the end of it. This is why your text is on different lines.

Hazim Sager
  • 82
  • 10
0

Unless theres a typo/misformat in there somewhere, just add a space after the comma?

training = ", we are in peril! Start your training 
Zulfiqaar
  • 603
  • 1
  • 6
  • 12