[Python] How do I input multiple arguments into strip() function?

Discussão em 'Python' iniciado por Stack, Fevereiro 22, 2025.

  1. Stack

    Stack Membro Participativo

    today I was tasked to create a program that takes a user input and prints out the vowels and constants of what the user input was. I thought I was doing good so far but then I got an error while trying to use strip(). The error said the max arguments it could take were 1 and I was putting in multiple. How should I go about this?


    lst1 = ['a','e','i','o','u']

    lst2 = ['b','c','d','f','g','j','k','l','m','n','p','q','s','t','v','x','z','h','r','w','y']

    lst3 = [] ### this is for vowels

    lst4 = [] ### this is for userinput

    lst5 = [] ### this is for constants

    def vowelstrip(lst4):




    maxlength = 1
    while len(lst4) < maxlength:
    lst4 = input('Enter a line of text: ')
    lst3 = lst4.strip('b','c','d','f','g','j','k','l','m','n','p','q','s','t','v','x','z','h','r','w','y')
    lst5 = lst4.strip('a','e','i','o','u')
    print(f'vowels are: {lst3}\n Constants are: {lst5}')

    Continue reading...

Compartilhe esta Página