[Solved] Checking user input python [closed]

You convert the user’s input to a string (str(input(‘What …’))) but compare it to integers in inputCheck. Since there is no else path in inputCheck, nothing happens when you enter a “valid” choice. Also, if you’re using Python 2, using input is not what you want, raw_input is the way to go (see, for example … Read more

[Solved] HOW to back for the beginning if the user press any key except 1 or 2 or 3? [closed]

Use do–while loop and set the condition to while(L != ‘1’ && L != ‘2’ && L != ‘3’);: do { L = getch(); switch (L) { case ‘1’ : system(“cls”); printf(“111111111111111”); break; case ‘2’ : system(“cls”); printf(“222222222222222”); break; case ‘3’ : system(“cls”); printf(“33333333”); break; default : sleep(0); } } while(L != ‘1’ && L … Read more

[Solved] Name cannot be display [closed]

I have modified your code. Please see the snipet code below #include <stdio.h> #include <conio.h> #define MAX 25 char welcomeMsg[]= “Please enter your name without ‘*’ or # ” ; char errorMsg[]= “\nError, please re-type your name. “; void main(void) { int j; char input; char name[MAX]; j=0; puts(welcomeMsg); do { input = getche(); if(input … Read more

[Solved] C# See If A Certain Key is Entered

Since you have read the user input into the variable input, check its content string input = Console.ReadLine().ToUpper(); switch (input) { case “S”: //TODO: Shake the Ball break; case “A”: //TODO: Ask a question break; case “G”: //TODO: Get the answer break; case “E”: //TODO: Exit the game break; default: // Unknown input break; } … Read more

[Solved] how to take (6+5) as a single input from user in python and display the result [closed]

Here is a simple calculator example to help get you started. while True: num1 = input(‘First Number: ‘) num2 = input(‘Second Number: ‘) op = input(‘Operator: ‘) try: num1 = int(num1) num2 = int(num2) except: print(‘Input a valid number!’) continue if op not in [‘+’, ‘-‘, ‘*’]: print(‘Invalid operator!’) continue if op == ‘+’: print(str(num1 … Read more

[Solved] Creating object using user input to store in Java array

Create a class student with variables for each of the fields: public class Student { public String strFirstName; public String strLastName; public String strMajor; public int intGPA; public int intUIN; public String strNetID; public String strAge; public String strGender; public static void Student(String strFirstName, String strLastName, String strMajor, int intGPA, int intUIN, String strNetID, String … Read more

[Solved] Read and print a user selected file’s contents [closed]

For what you are trying to do, a better method would be: import os def print_file_contents(file_path): assert os.path.exists(file_path), “File does not exist: {}”.format(file_path) with open(file_path) as f: print (f.read()) user_input = raw_input(“Enter a file path: “) # just input(…) in Python 3+ print_file_contents(user_input) solved Read and print a user selected file’s contents [closed]

[Solved] How to allow caps in this input box program for pygame?

If you change the corresponding code to: elif inkey <= 127: if pygame.key.get_mods() & KMOD_SHIFT or pygame.key.get_mods() & KMOD_CAPS: # if shift is pressed or caps is on current_string.append(chr(inkey).upper()) # make string uppercase else: current_string.append(chr(inkey)) # else input is lower That should work. If you want more info on keyboard modifier states look here 1 … Read more

[Solved] i cant get my calculator to work

Try using input.next(); instead of input.nextLine(); Because input.nextLine(); advances this scanner past the current line and returns the input that was skipped. so if your input was 20, +, and 24, your method calc would get 20,24,null. 2 solved i cant get my calculator to work

[Solved] Adding two arrays together to find the numbers of possible combinations of 10 [closed]

I’ll probably get down voted for providing an answer, because you are providing no clear question, and you aren’t showing any effort to solve your problem yourself before the community helps you. What I’m able to decipher from your sample result is there is no need for ArrayList if you’re given two inputs m and … Read more