Python Little Goal 7

Python Day 13

Today we will try to work with Python Strings 

Task1:Python has built-in string validation methods for basic data. It can check if a string is composed of alphabetical characters, alphanumeric characters, digits, etc
Function: isalnum(), isalpha(), isdigit(), islower(), isupper()

Task2:You are given a string  and width Your task is to wrap the string into a paragraph of width 


String :ABCDEFGH, Max_width= 4

Output: ABCD

jplenio / Pixabay
s = input()
#alphanumerical characters
print (any(i.isalnum() for i in s))
print( any(i.isalpha() for i in s))
print( any(i.isdigit() for i in s))
print( any (i.islower() for i in s))
print ( any(i.isupper() for i in s))
#Note we need (any x for i in s)
def wrap(string, max_width):
for i in range(0, len(string), max_width)]))

Happy Studying!

  One thought on “Python Little Goal 7

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.

Social media & sharing icons powered by UltimatelySocial
%d bloggers like this: