Computer Science, asked by ProBroJokesMan, 8 months ago

*ANSWER AS SOON AS POSSIBLE TOMORROW IS MY EXAM AND IF YOU ANSWER IT YOU WILL GET BRAINLIEST* To enter a string and display the number of times it contains the substring ‘it’. ( string entered is : ‘italy STREET is littered with bits of paper’ Output should be displayed as a) ‘it’ occurs for times b) Length of the string c) String in Uppercase d) String in lowercase e) Capitalize the string f) Is string is alphanumeric

Answers

Answered by gaganadithyareddy9
1

#Hey! Here is your Python code...

x = input("Enter a string: ")

# To count 'it'

print("'it' occurs for", x.count('it'), "times")

# Length of string

print("Length of string = ", len(x))

# String in uppercase

print("String in uppercase: ", x.upper())

# String in lowercase

print("String in lowercase: ", x.lower())

# Capitalize the string

print("Capitalising the string: ", x.title())

# Is string alphanumeric??

if x.isalnum() == True:

   print('String is alphanumeric')

else:

   print("String is not alphanumeric")

# HOPE THIS HELPS!!

Similar questions