0

Basically, after I have made an input, it prints the text on a new line. I want it to print the text after the user input on the same line. I don't want to get an input then print it back to the user, I want to just have an input that does nothing but lets the user type something. (I am new to python, so please keep it simple)

This is for a little choice game i'm making for fun. I've tried to do input("Blah", end = " ") but it just tells me input() takes no keywords.

import time

def type(str):
     for letter in str:
        print(letter, end='')
        time.sleep(0.02)

type("My card number is ")
input()
time.sleep(0.5)
type(" and the expiry date is ")
input()
time.sleep(0.5)
type(". Finally,")
time.sleep(0.5)
type(" the three numbers on the back are ")
input()
print(".")

I wanted it to end up like this:

My card number is 1234 and the expiry date is 1234. Finally, the three 
numbers on the back are 123.

Instead I got:

My card number is 1234
 and the expiry date is 1234
. Finally, the three numbers on the back are 123
.
Xyborg H.
  • 11
  • 1
  • 1
    Please do _not_ call your function `type`: `type()` is a built-in Python function for checking the type of an expression. As far as your question is concerned, you may be able to get what you want using `curses`. – DYZ May 29 '19 at 00:44
  • I'm afraid my searches have turned up bad news all around: https://stackoverflow.com/questions/7173850/possible-to-get-user-input-without-inserting-a-new-line/41436173#41436173 – Mike May 29 '19 at 00:55
  • Possible duplicate of [Possible to get user input without inserting a new line?](https://stackoverflow.com/questions/7173850/possible-to-get-user-input-without-inserting-a-new-line) – DYZ May 29 '19 at 01:33

0 Answers0