About 207,000 results
Open links in new tab
  1. python - Creating if/else statements dependent on user input - Stack ...

    python if-statement input edited Apr 9, 2024 at 18:49 Trenton McKinney 63.2k 41 170 213

  2. Python: How do I put print statement and input on same line?

    Sep 25, 2018 · How can I make it that when the user enters input its on the same line as the print statement like for example for the code snippet below. The output becomes: Enter grade for course …

  3. How to define default value if empty user input in Python?

    Here I have to set the default value if the user will enter the value from the keyboard. Here is the code that user can enter value: input = int(raw_input("Enter the inputs : ")) Here the value wi...

  4. python - How to go back to first if statement if no choices are valid ...

    a = int(raw_input("> ") if a == 1: print "this" if a == 2: print "that" else: print "you have made an invalid choice, try again." What I want is to prompt the user to make another choice for this if statement …

  5. variables - Two values from one input in python? - Stack Overflow

    6 If you need to take two integers say a,b in python you can use map function. Suppose input is, 1 5 3 1 2 3 4 5 where 1 represent test case, 5 represent number of values and 3 represents a task value and …

  6. python - How to put input statement inside a print function? - Stack ...

    Oct 7, 2022 · How to put input statement inside a print function? Asked 3 years, 2 months ago Modified 3 years, 2 months ago Viewed 847 times

  7. python - Loop on if-statement to reject invalid input - Stack Overflow

    Apr 30, 2014 · In python is there a way to redo a raw input and if statement if the answer is invalid? So for instance if you ask the user to guess 1 or 2, and they guess 3 you create the additional elif or else...

  8. python - How to redo an input if user enters invalid answer - Stack ...

    Closed last year. I'm new to programming, and I was wondering how I can repeat an input section, if the user types in invalid data. I want the application to just repeat the input section, instead of having to …

  9. Taking multiple integers on the same line as input from the user in …

    I know how to take a single input from user in python 2.5: raw_input("enter 1st number") This opens up one input screen and takes in the first number. If I want to take a second input I need to re...

  10. python - Can I use a variable inside of an input statement? - Stack ...

    Oct 1, 2016 · Can I use a variable inside of an input statement? [duplicate] Asked 9 years, 2 months ago Modified 9 years, 2 months ago Viewed 47k times