PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Saturday, August 13, 2022

[FIXED] Why Python return 'None'

 August 13, 2022     list, python     No comments   

Issue

'''

  function 'text_strip_split(text)' delete special symbolsand
  whitespace in start and end string,after we enter number of word ,
  that it should write , and finally write this word.

'''

def text_strip_split(text):

    list = [ '!' , ',' , '.' , '?' , ':' , '/' , '*' , '#' , '%' , '\\' , '_' , '-' , '=' , '+' , '&' ,';']

    for i in list:
        text = text.replace( i  , ' ').strip()
    text = text.split()

    print()

    while True:
        x = int(input('Enter number word that i should print on console:\n')) - 1
        if x > len(list) or x < 0:
            print('Enter other number!')
        else:
            break

    print(text[x])


word = input('Write the something text with special symbols: \n')
print(text_strip_split(word))

Solution

You have no return statement in the function.



Answered By - RomaValcer
Answer Checked By - Marie Seifert (PHPFixing Admin)
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing