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
-1
votes
1 answer

Python input or raw input (2.7.15)

I'm new to python. I'm working on MacOS and I have python 2.7.15. I'm trying to get input from the user : #these two rows do not execute at the same time, it's just an example :) annee = raw_input("Saisissez une annee : ") #works if input is…
-1
votes
1 answer

Python Typecasting

I have taken a number as a raw_input and stored it in a variable port. However, I have to use this number(stored as a string) as a parameter in an "if" statement. I cannot take the number as "input" as I require that number as a string later. I…
-1
votes
2 answers

Adding values from a dictionary

I would like to know how can I, using a raw_input command, pick out the values of two user chosen keys to add together? What I have attempted is: dict = {"one" : 1, "two" : 2, "three" : 3} Total = Sum(v for v in dict.values() if raw_input1 and…
Black90
  • 21
  • 1
-1
votes
1 answer

raw_input not asking the user for an input

When I run this code, it is not asking the user for an input but just showing a black screen for less than a second. I don't get errors as well. What could be the problem? #Check an IP address validity while True: ip_address = raw_input("Enter…
Steve
  • 81
  • 1
  • 7
-1
votes
1 answer

Using raw_input to create a list of numbers and making the list an integer

I'm creating a bubble sort program and need need the raw_input list to be integers. alist=int(raw_input('Enter list of numbers---->') print(alist) for k in range(0,5): for i in range(0,5): if alist[i]>alist[i+1]: …
oad996
  • 11
  • 1
-1
votes
1 answer

'for in' stops working after raw_input

I am creating a program where the hero saves two hostages in 10 seconds. The first things he needs to do is decide who to save first, then type the code for bomb to rescue the hostage, if the user types the name of the hostage wrong he can type it…
Lame Fanello
  • 545
  • 1
  • 6
  • 15
-1
votes
4 answers

Python While Loop not registering raw_input from from previous variable

I'm using Python 2.7.13 and Windows Powershell. When I run the program, the first raw_input() isn't recognized, regardless of whether, "yes", "y", or "Yes", are entered. Ideally, I'm wanting the program to register whether any of these options are…
-1
votes
1 answer

raw_input not working after while loop

I have a question about the raw_input function. I made a small number-guessing game as a small project, and if you don't want to play it states "goodbye". However, I have put it as a raw_input so the program only closes after you press Enter. The…
Python
  • 1
  • 3
-1
votes
2 answers

Python Program that Prints Greeting + Entered Name, Special Cases - Nested Conditionals

In this program, I must ask the user What is your name?, and then respond by printing out a personalized greeting. In general, for a person named NAME, respond by printing Hello NAME. Eg. For a person named Maria, respond by printing Hello…
HappyHands31
  • 4,001
  • 17
  • 59
  • 109
-1
votes
1 answer

How to correctly take input using raw_input in python in below given conditions?

I tried using raw_input for taking input of a large string in python interpreter, It works fine. But when I tried doing the same by writing the raw_input in file. the received variable is not equal to the input. I tried to print the length of the…
Sheesh Mohsin
  • 1,455
  • 11
  • 28
-1
votes
1 answer

How to initialize a 2D integer array using raw_input() in PYTHON

I need to initialize a 2D integer array[10*10] taking input from user in PYTHON. What is the code for this? I have tried doing this but it shows error as list index out of range board = [[]] for i in range(0,10): for j in range(0,10): …
Ananth Upadhya
  • 253
  • 1
  • 3
  • 12
-1
votes
1 answer

Check input decimal number

I want to check if the input is a number(float with 0,one or two decimals) and greater than 0 def getnumber(): print ( "write a number: \n") isValid = False while not isValid: try: number =…
Jessica
  • 1
  • 1
-1
votes
2 answers

Check how many characters in input

I'm working on a Python script for school and I need it to check the input format in order to perform an action. Let me exemplify: The script will ask the user for an input that can either be an id number or a registration number, then, if it's an…
John Lisboa
  • 73
  • 1
  • 2
  • 12
-1
votes
2 answers

`JES - Python, Even and Odd

I need to write a program that asks if a random number is even or odd, the user inputs the answer and then the program tells you if it is correct or incorrect. I do not know what to put in ans=raw_input("is" [random number] "Odd or Even?") this is…
Lauren
  • 33
  • 4
-1
votes
3 answers

python input check function not being called properly

I'm working on a very simple temperature converter in Python (just for practice), and am struggling with some of the UX components. I'd like to have checks in place to continue prompting for variable input when invalid entries are made. My full code…
grrothman
  • 171
  • 1
  • 11