Close Menu
Techs Slash

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    What's Hot

    How To Develop A Strategy That Works On Khelostar

    July 10, 2025

    Durable, Fast, and Accurate: Industrial-Grade Wrap Around Labeler

    July 10, 2025

    Unlocking the True Potential of Your Mitsubishi: A Guide to Performance Tuning

    July 9, 2025
    Facebook X (Twitter) Instagram
    Techs Slash
    • Home
    • News
      • Tech
      • Crypto News
      • Cryptocurrency
    • Entertainment
      • Actors
      • ANGEL NUMBER
      • Baby Names
      • Beauty
      • beauty-fashion
      • facebook Bio
      • Fitness
      • Dubai Tour
    • Business
      • Business Names
    • Review
      • Software
      • Smartphones & Apps
    • CONTRIBUTION
    Facebook X (Twitter) Instagram
    Techs Slash
    Home»python»Python 3 Script to Take Multiple Input Values in Command Line Using Split() & List Comprehension
    python

    Python 3 Script to Take Multiple Input Values in Command Line Using Split() & List Comprehension

    Ranveer KumarBy Ranveer KumarOctober 7, 2022No Comments2 Mins Read
    Facebook Twitter Pinterest LinkedIn Tumblr Email

    Warning: Trying to access array offset on value of type bool in /home/cadesimu/techsslash.com/wp-content/themes/smart-mag/partials/single/featured.php on line 78
    Share
    Facebook Twitter LinkedIn Pinterest Email

    You might feel somewhat unsure and disarrays in the article. We ensure that every one of your questions will be settled by means of the Python 3 Content to Take Various Info Values in Order Line Utilizing Split() and Rundown Cognizance article.

    Python 3 Script to Take Multiple Input Values in Command Line Using Split() & List Comprehension

    # Python program showing how to
    # multiple input using split
    
    # taking two inputs at a time
    x, y = input("Enter a two value: ").split()
    print("Number of boys: ", x)
    print("Number of girls: ", y)
    print()
    
    # taking three inputs at a time
    x, y, z = input("Enter a three value: ").split()
    print("Total number of students: ", x)
    print("Number of boys is : ", y)
    print("Number of girls is : ", z)
    print()
    
    # taking two inputs at a time
    a, b = input("Enter a two value: ").split()
    print("First number is {} and second number is {}".format(a, b))
    print()
    
    # taking multiple inputs at a time
    # and type casting using list() function
    x = list(map(int, input("Enter a multiple value: ").split()))
    print("List of students: ", x)
    # Python program showing
    # how to take multiple input
    # using List comprehension
    
    # taking two input at a time
    x, y = [int(x) for x in input("Enter two value: ").split()]
    print("First Number is: ", x)
    print("Second Number is: ", y)
    print()
    
    # taking three input at a time
    x, y, z = [int(x) for x in input("Enter three value: ").split()]
    print("First Number is: ", x)
    print("Second Number is: ", y)
    print("Third Number is: ", z)
    print()
    
    # taking two inputs at a time
    x, y = [int(x) for x in input("Enter two value: ").split()]
    print("First number is {} and second number is {}".format(x, y))
    print()
    
    # taking multiple inputs at a time
    x = [int(x) for x in input("Enter multiple value: ").split()]
    print("Number of list is: ", x)

    Final Words

    We trust the Python 3 Content to Take Various Info Values in Order Line Utilizing Split() and Rundown Appreciation article clears up your questions and disarray. See you again in a decent article. Much obliged.

    Share. Facebook Twitter Pinterest LinkedIn Tumblr Email
    Ranveer Kumar
    • Website

    Related Posts

    JSONDecodeError: Expecting value: line 1 column 1 (char 0)

    December 18, 2023

    Why does math.log result in ValueError: math domain error?

    December 17, 2023

    “inconsistent use of tabs and spaces in indentation” [duplicate]

    December 16, 2023
    Leave A Reply Cancel Reply

    Top Posts

    Sapne Me Nahane Ka Matlab

    March 18, 2024

    Sapne Me Nagn Stri Dekhna

    March 18, 2024

    Self Reliance: Release Date, Cast, Plot, Trailer, and More Information

    March 18, 2024

    Subscribe to Updates

    Get the latest creative news from FooBar about art, design and business.

    ABOUT TECHSSLASH

    Welcome to Techsslash! We're dedicated to providing you with the best of technology, finance, gaming, entertainment, lifestyle, health, and fitness news, all delivered with dependability.

    Our passion for tech and daily news drives us to create a booming online website where you can stay informed and entertained.

    Enjoy our content as much as we enjoy offering it to you

    Most Popular

    Sapne Me Nahane Ka Matlab

    March 18, 2024

    Sapne Me Nagn Stri Dekhna

    March 18, 2024

    Self Reliance: Release Date, Cast, Plot, Trailer, and More Information

    March 18, 2024
    CONTACT DETAILS

    Phone: +92-302-743-9438
    Email: contact@serpinsight.com

    Our Recommendation

    Here are some helpfull links for our user. hopefully you liked it.

    Techs Slash
    Facebook X (Twitter) Instagram Pinterest
    • Home
    • About us
    • contact us
    • Affiliate Disclosure
    • Privacy Policy
    • Disclaimer
    • Terms and Conditions
    • Write for us
    • Daman Game
    © 2025 Techsslash. All Rights Reserved

    Type above and press Enter to search. Press Esc to cancel.