Questions tagged [raw-input]

The raw input API provides a stable and robust way for applications to accept raw input from any HID (Human Interface Devices), including the keyboard and mouse.

623 questions
-2
votes
3 answers

How to write a recursive function without calling for raw input more than once?

I want to write this recursively to encode other letters in the string with ord and chr, but when I write it recursively it calls for raw_input from user again. How do i fix this? def rawEncode(input): input= raw_input("GIVE ME SUPER SECRET…
-2
votes
2 answers

How to convert the raw_input text in Python to a label in Tkinter?

I am trying to create this program for a restaurant named Neelam. Here's a sample from Tkinter import * root=Tk() w=Label(root,text="**WELCOME TO NEELAM**")#THIS COMES AS A LABEL w.pack() s=Label(root,text="*FINE DINE RESTAURANT*")#SO DOES THIS…
-2
votes
2 answers

Python 2.7.7 Breaking?

I am trying to make a memory game in python 2.7.7 i need some help with My Code. Guess1_Easy_Removed = raw_input("Which Word Do You Think Was Removed?:") if Guess1_Easy_Removed == wordList[9]: print "Correct!" else: print "Try…
-2
votes
1 answer

How do I get python to only accept positive integer as raw_input?

I'm trying to ask the user to submit a positive integer because my question is "How old are you?"
-2
votes
1 answer

How to store an input(raw_input) in a variable to use it later in Python 2.7.9?

I will be more specific, this is a shortened edited bit of my code from my text based game: var = "" class example: def: example2(self): raw = raw_input("Enter something") if raw == "something": raw2 = raw_input("Enter something…
Hugius
  • 380
  • 1
  • 5
  • 15
-2
votes
3 answers

Using rawinput() to assign to variables until a certain keyword is given in Python

Not sure if this is a simple question or not, pretty new to Python. Let's say I want to gather data about a user, but don't know how much info they have. How would I make it so they can keep on entering data, and when they enter a keyword like "END"…
Bandito
  • 21
  • 2
-2
votes
1 answer

Indent placement?

I've tried to design a small (3 rooms) "adventure-like" mini-game, and when i run it i get: if answer == "restaurant": IndentationError: unindent does not match any outer indentation level # TRUMANIA v. 0.0.2 def Square(): print "You exit from…
Top8
  • 27
  • 4
-2
votes
3 answers

How to make a raw input a number?

I wanted to make a simple program on my raspberry pi that will let a LED flash as many times as the number you type in. My program is working, but is a bit repetitive: times = raw_input('Enter a number: ') if times == '1': times = 1 elif times…
Smartie
  • 13
  • 4
-2
votes
2 answers

Code for calculation of absolute error

I am trying to write a program whereby the user can enter two values, and the program will calculate the absolute error between the values. A sample input would be: 87.03 87 With the approximate value read in first and the correct value second.…
PythonNoob
  • 1
  • 1
  • 1
-2
votes
1 answer

If statement not working when using raw_input

The code works when I don't use raw_input. Not sure what I am doing wrong. I am using python 2.7.5 Here is my code: mark = raw_input('Enter Your Marks: ') x = mark if x > 80: grade = 'HD' elif x > 70: grade = 'D' elif x > 60: grade =…
user1951876
  • 294
  • 2
  • 5
  • 16
-2
votes
1 answer

Project to return a line in a text file in python from user input

code = raw_input("Enter Code: ') for line in open('test.txt', 'r'): if code in line: print line else: print 'Not in file' The test.txt file looks like this A 1234567 AB 2345678 ABC 3456789 ABC1 …
-2
votes
3 answers

In python, how do I make a raw_input of a list from one number?

I need some code that allows a user to input a number (ie. 5) that creates a list of all the numbers leading up to that number excluding zero (ie. [1,2,3,4,5])
G Warner
  • 1,309
  • 1
  • 15
  • 27
-2
votes
2 answers

Why do I get an infinite loop with raw_input in python?

Here is the code - pretty simple - but it gives me the first exception in the main part of the program infinitely - without even asking for user input where I assumed it should at- at the first input of raw_input - I'm a beginner with a good grasp…
-3
votes
1 answer

Why is my Python input overriding itself?

Context: I'm doing the Udemy "100-days-of-code" course and hit a weird stumbling block. Python version: 2.7-64 I ultimately solved it by using the "input" command (vs raw_input) and upgrade the version of Python to 3.X. The problem simply went away.…
devjc
  • 73
  • 8
-3
votes
1 answer

Regarding raw_input.split() function in python

How does this line exactly works in python raw_input().split() ?