3 Replies - 576 Views - Last Post: 11 August 2012 - 09:05 PM Rate Topic: -----

#1 Rhysorourky  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 24
  • Joined: 01-May 12

user input help

Posted 10 August 2012 - 05:38 AM

ok im new so dont judge but i need help with the raw_input if thats what you call it


this is the program i just need help with the user input the rest i can do ?
whats your name? <user enters name>
hello <name>
Is This A Good Question/Topic? 0
  • +

Replies To: user input help

#2 duffman18  Icon User is offline

  • D.I.C Head

Reputation: 14
  • View blog
  • Posts: 54
  • Joined: 20-October 10

Re: user input help

Posted 10 August 2012 - 07:54 AM

I guess you are using Python v2.x since you are using raw_input(). So have you checked the python documentation yet? That is usually a good place to start for Built-in functions such as raw_input().

Here is a link to the documentation:
http://docs.python.o....html#raw_input

It gives you an explanation of what it does and all the arguments that are passed to it. It also shows a few examples that should help.
Was This Post Helpful? 1
  • +
  • -

#3 k3y  Icon User is offline

  • D.I.C Head

Reputation: 36
  • View blog
  • Posts: 205
  • Joined: 25-February 12

Re: user input help

Posted 11 August 2012 - 06:44 PM

#!/usr/bin/python3
name = input('Please enter your name: ')
print ('Hello', name)



This is probably the simplest way to answer your question. *Take note I am using Python 3*

#!/usr/bin/python3


This is called a shebang line *Explanation*

name = input('Please enter your name: ')


This is a simple input. In python 3 there is no raw_input. *More info*

print ('Hello', name)


This simply prints 'Hello' and the name of the user which we assigned to variable 'name'. *More Info,*

I hope that I assisted in some way

#!/usr/bin/python3
name = input('Please enter your name: ')
print ('Hello', name)



This is probably the simplest way to answer your question. *Take note I am using Python 3*

#!/usr/bin/python3


This is called a shebang line *Explanation*

name = input('Please enter your name: ')


This is a simple input. In python 3 there is no raw_input. *More info*

print ('Hello', name)


This simply prints 'Hello' and the name of the user which we assigned to variable 'name'. *More Info,*

I hope that I assisted in some way
Was This Post Helpful? 0
  • +
  • -

#4 atraub  Icon User is offline

  • Pythoneer
  • member icon

Reputation: 759
  • View blog
  • Posts: 2,010
  • Joined: 23-December 08

Re: user input help

Posted 11 August 2012 - 09:05 PM

Perhaps it didn't occur to you why we would refer a user to documentation rather than spoon feeding them... There's an analogy regarding fishing, you should research it. See what I did there?

This post has been edited by atraub: 11 August 2012 - 09:11 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1