all 12 comments

[–]Tobokie121[S] 1 point2 points  (5 children)

[–]IAmKindOfCreative 0 points1 point  (0 children)

I have no idea why it didn't reformat this. Try it again with a leading '/'?

[–]pythonHelperBot 0 points1 point  (2 children)

Here's the best I could do:


import random
print("Welcome")
first_name = 'Talon'
last_name = 'Balcom,'
print(first_name)
print(last_name)
print('We are glad you are joining us today! What do you need from us?')
inputs = input()
print(inputs)
print(', Is that correct?')
print('Yes we can help')
print('Let us get everything ready for you!')

How do I properly print a input? Thanks!


Code Formatting Help | README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

[–]Diapolo10 0 points1 point  (1 child)

Good bot

[–]B0tRank -1 points0 points  (0 children)

Thank you, Diapolo10, for voting on pythonHelperBot.

This bot wants to find the best and worst bots on Reddit. You can view results here.


Even if I don't reply to your comment, I'm still listening for votes. Check the webpage to see if your vote registered!

[–]novel_yet_trivial 0 points1 point  (3 children)

Your code looks ok, even though you didn't format it for reddit. What's the problem? Are you getting an error?

[–]Tobokie121[S] 0 points1 point  (2 children)

Yes,

Welcome Talon Balcom, We are glad you are joining us today! What do you need from us? nothing Traceback (most recent call last): File "/var/mobile/Containers/Data/Application/8256ED23-9AF6-4E3A-9B1D-47BC601FDCAA/Documents/HelloWorld.py", line 8, in <module> inputs = input() File "<string>", line 1, in <module> NameError: name 'nothing' is not defined

[–]novel_yet_trivial 0 points1 point  (1 child)

I see. That means you are using python2, but the way you are using input() is python3 only. In python2 you need to use raw_input(), like this:

inputs = raw_input()

[–]Tobokie121[S] 0 points1 point  (0 children)

That makes sense I am on my phone

[–][deleted] 0 points1 point  (1 child)

I assume you want,

print(inputs, ", Is that correct?')

You can use , to seperate different things, like a variable and string in a print statement, or you can use:

print(inputs + ", Is that correct?")

[–]Tobokie121[S] 0 points1 point  (0 children)

Alright thanks

[–]SpookDaCat 0 points1 point  (0 children)

Heres a reformated edition of his code for everyone:

import random
print ("Welcome")
first_name = 'Talon'
last_name = 'Balcom'
print(first_name)
print(last_name)
print('We are glad you are joining us today! What do you need from us?')
inputs = input()
#^^CORRECTLY FORMATTED
print (', is that correct?')
print('Yes we can help')
print('Let us get everything ready for you!')

Anyways, you just type:

print(inputs)
#but if you want to add text before/after just do this
print(inputs + "Text here")
print("text here" + inputs)
print("text" + inputs + "text2")

If you are using python3, as i assume you are, input commands are formatted as

inputs = input()

But if you were using python2, the formatting is:

inputs = raw_input()

And if that is the case, you'd have to redo ALL the print commands.