filmov
tv
Write a program that should prompts the user to type some sentence (s) followed by “enter ”.it shou
![preview_player](https://i.ytimg.com/vi/bfXU60RT2Fg/hqdefault.jpg)
Показать описание
Q. Write a program that should prompts the user to type some sentence (s) followed by “enter ”. it should then print the original sentence (s) and the following statistics relating to sentence (s):
(i) Number of words
(ii) Numbers of character (including white-space and punctuation )
(iii) Percentage of character that are alphanumeric.
Website Link :-
Q 2 || Type C || Python revision tour 2 || Sumita Arora || Class 12 || Computer science || IP
Python revision tour 2 Playlist link ---
Answer :-
sen = input("Enter a sentence = ")
count = 1
alp = 0
for j in sen :
if j == " " :
count += 1
alp += 1
print("Number of word is ",count)
print("Number of characters ",len(sen))
print("Percentage of alpha numeric = ", (alp / len(sen)) * 100)
Output :-
Enter a sentence = ? Welcome to our website Path Walla : )
Number of word is 9
Number of characters 39
Percentage of alpha numeric = 71.7948717948718
Enter a sentence = #Python is my Love?
Number of word is 4
Number of characters 19
Percentage of alpha numeric = 73.68421052631578
Tags --
python revision tour class 12
python revision tour class 12 notes
python revision tour class 12 ppt
(i) Number of words
(ii) Numbers of character (including white-space and punctuation )
(iii) Percentage of character that are alphanumeric.
Website Link :-
Q 2 || Type C || Python revision tour 2 || Sumita Arora || Class 12 || Computer science || IP
Python revision tour 2 Playlist link ---
Answer :-
sen = input("Enter a sentence = ")
count = 1
alp = 0
for j in sen :
if j == " " :
count += 1
alp += 1
print("Number of word is ",count)
print("Number of characters ",len(sen))
print("Percentage of alpha numeric = ", (alp / len(sen)) * 100)
Output :-
Enter a sentence = ? Welcome to our website Path Walla : )
Number of word is 9
Number of characters 39
Percentage of alpha numeric = 71.7948717948718
Enter a sentence = #Python is my Love?
Number of word is 4
Number of characters 19
Percentage of alpha numeric = 73.68421052631578
Tags --
python revision tour class 12
python revision tour class 12 notes
python revision tour class 12 ppt
-
Portal Express
-
Write a program that should prompts the user to type some sentence (s) followed by “enter ”
-
it should then print the original sentence (s) and the following statistics relating to sentence (s)
-
numbers of character (including white-space and punctuation )
-
percentage of character that are alphanumeric .
-
Python revision Tour 2