user-input

exception handling java user input

落花浮王杯 提交于 2019-12-12 03:27:28
问题 I'am trying to put an exception in my code. But it doesnt work fully. Im trying for user to enter integers and then adding it to a list. how come it only works for the first input? say if the first I enter 1.0 then it will raise the error. but if I put say 10, 1.0 it doesnt produce an error. and when i print the list. there is only the 10 well this is actually correct. but i want to make it so that if anything is entered other than integer it raise an error, and does not terminate. instead

Tic Tac Toe with a win and taken check - Matlab

拥有回忆 提交于 2019-12-12 02:49:46
问题 I'm making a tic tac toe game and I'm bombarded with various errors everytime I try to debug. I'm not sure where the problem is. The main error is either Index exceeds matrix dimensions or Subscript indices must either be real positive integers or logicals in line 8 of my 'checktaken' function. Below is my code, where tttGame is the main function, boardplot does the plotting, and checkwintest/check taken see if a position is taken or if there is a win. I have asked many people for help and

Way too slow wxPython application getting data from Google Spreadsheet and User input needs speed up solution

久未见 提交于 2019-12-12 02:25:43
问题 I want to make an application that reads out city names, road names, and distances between them from a Google Spreadsheet with several worksheets. So far I have the code bellow working right. It reads out from spreadsheet, receives input also from a user who wants to find out the road name (like Rode 60) between two cities and also the distance between them. However when I run the application it is incredibly SLOW. I think I have a server side-user side issue, but after reading tons of

python: Convert input to upper case on screen as it is typed

Deadly 提交于 2019-12-12 02:11:55
问题 How can my Python program convert the user's keyboard input to upper case, as though the user has CAPS LOCK enabled? I want to emulate a program running on a computer which doesn't have any lower-case letters (i.e. a character set more limited than ASCII). The text input, typed interactively by the user at the keyboard, should be forced to upper case in real time as though that's what the user typed. The command line interface could use Python's standard cmd library, or something else. The

Python | Stopping/Restarting a script after user_input

孤者浪人 提交于 2019-12-12 01:19:33
问题 Just before I ask the question I would like to say that I am very new to Python so what ever I ask might be simple to do. My question is this: How do I stop the script after this question has been answered. s1 = input("Is your phone freezing/stuttering? ") if s1 == "Yes" or s1 == "yes": print("Try deleting some apps and this might help with your problem") if s1 == "No" or s1 == "no": def foo(): while True: return False So what I exactly want here is when the user replies with 'Yes' I want the

java arraylist that stores userinput

 ̄綄美尐妖づ 提交于 2019-12-12 01:18:49
问题 how can I get it to go back to start another directory when the user types yes and also how do I print the arraylist out using a print format thanks import java.util.ArrayList; import java.util.Scanner; public class AAA { public static void main(String[] args) { ArrayList<String> name = new ArrayList<String>(); ArrayList<Integer> phone = new ArrayList<Integer>(); Scanner scanner = new Scanner(System.in); { System.out.println("Please enter your name: "); name.add(scanner.next()); System.out

Python 3 input and if statement

夙愿已清 提交于 2019-12-12 00:44:15
问题 I am having some trouble with an input question that is supposed to allow the player to choose one of 5 starting races. I used the following code. def racechoice(): players.race = input('After you get a chance to think, you choose to be...') #Here race is chosen if players.race == "dwarf" or "Dwarf": #Race starting stats players.race = "Dwarf" players.level = 1 players.strength = 12 players.agility = 6 players.inteligence = 8 players.vitality = 14 elif players.race == "Orc" or "orc": players

Segmentation fault in hash function (C)

狂风中的少年 提交于 2019-12-11 23:44:55
问题 I decided that I wanted to make a program in C that would take a user input and do things with a hash table... well I have hit a snag and I am completely lost as to what is going on. When I run my code everything is fine until I give an input then I get a segmentation fault. Is there anyone out there that can point out my mistake? When the user gives an input the program will decide where to put the word(s) by the total of the letters in ascii. Once I get this issue fixed I will add it in so

How to get user input from a popup control

徘徊边缘 提交于 2019-12-11 23:04:42
问题 I have a UserControl that utilizes a popup window in wp7. The user control has a text box for input, and a submit button. My issue is that the code does not halt once the popup is shown. It continues on through the code and does not wait for the user to press submit. What is a good practice for making the code "halt" similar to a message box with an "Okay" button? //my custom popup control InputBox.Show("New Highscore!", "Enter your name!", "Submit"); string name = InputBox.GetInput(); //it

Using Scanner to validate user input

两盒软妹~` 提交于 2019-12-11 21:36:27
问题 I have a hard time to figure out how to use the Scanner correctly to validate the user input. For example, the program need to have a user input of int, user can only input positive number, and if the user input "apple","delicious apple",or negative number, the problem will show error message. I have tried the code below, and then i found a disturbing questions, the "That's not a number!" are printed twice, I have no idea what caused this questions.... import java.util.*; public class input {