You are on page 1of 23

ia:py- D:/Deslctop data/Documents/Python/ count ind ia.py (3.7.

9)
Format Run Options Window Help
count INDIA () :
f= open ( "my file. txt" , 'r' )
count= 0
fo,;_ line in f:
for word in line.split():
if (word== "India" ) or (word== "india" }:
count= count +1
else :
continue

print (count)

count INDIA ()
I
X +
file ~It

Hi this is india. india is diverse. india has many festivals. india is good . india has a very big population . people of india are very
nice. food of india is delicious. India is nice .I
\D es kt .o p
Im~"!::'kiop data/Documents/Python/count vowel.py (3.7.9)

e [it Python 3. 7.9 Shell D )c


def "'
File Edit Shell ~ebug Options Window Help
Python 3.7.9 (tags/v3.7.9:13c947 47c7, Aug 17 2020, 16:30: 00 ) [MSC v~1900 64 bit
(AMD64)J on win32
Type nhelp 11 , ncopyright 11 , 11 credi ts" or nlicense O II for more information.
>>>
----------
----------- RESTART: D:/Desktop data/Documents/Pyth on/count vowel.py
l
i
l
i
i
a
o I
a
0
0
A
0
E
13
>>> I
~ count vowel.py - D:/Deslctop data/Documents/Python/count vowel.py (3.7.9)
)e Edit Format Run Options Window Help __ _
~f countVowel () :
f= open ("myfi le. t xt", ' r ')
count= 0
L line f:
word line.split() :
~ letter lis t(word):
f ((letter . upper()='A') ~r (letter.upper()='E') or (letter . upper()='!') or (letter . upper()='O') (letter . upper( ) ='U') ):
count= count +l
print (letter)

print (count)

countVowel ()
X +

indi a.I am good And HONEST.


VJ [}Jileskibp 65ta/OOWlll@lif!J?ytttdffffflfall!:r,r'l:rl':9li-------------------------,;;:--------------------------------=--;------------~-,-,,'711■■■-■

file Edit Format Run Options W~1~nd~o~w~- H~el~P'.___________________ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ __ _ __ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _...,....;;~


d I c:o•JNTLINES () :
f= ope n ( ",.,,ESTFILE . txt ", 'r 1
)

f line f :
f (line.startswith(' An' )) or (line. startswith(' an ')) cL (line . s tart s with(' a ')) r (line . startswi th (' A ' J J 01 (line. startswi th (•the')) o - (line. startswith (•The•)) :
p r i nt (line)

COONTLINES ()
IIIIIJJS aJ,nents/Pvtho
Run Options Wtndow Help
) :
'EST FILE. txt", 'r' )
. f:
~ _ a r t - ca.1i t-h i '.A.IL~\ L ----cu:'----- i 1 :i nP c::t ;:i rt" c::w-i r h ( 'r1n ' , \ n:r- l 1 i nP c::r rt rt- c.ui t" h I ';:1.' \..

I TESTFILE X +
File Edit View

A thing of beauty is a source of joy.


The little things in world.
An umbrella.
World is nice.
Good work
ocumeots/Pytbon/artrcle.py 3. 7.9)
Help

~
'· · indow HeJ I

.. . 94747c1-, : 30: 0()} [MSC I

~y:right" cT -ncredits" or - "license I i~ ror more inform

D; /Desktop data/Documents/'B~ bon/art:i-e:J:e ..;p y


a source of joy.
11,I I

1I I

In world.

>>> I
esktop·data/Documents/Python/count And.py (3].9)*
,te Edit Format Run Options Wigdo)N Help
def . COUNT_AND {}:
f= open {''5',I'ORY. txt" , ' r ·' )
count= 0
for line in f:
for word in line.split():
if" (word== ' AND ' ) or (word== 'and' ) or (word== 'And ' }:
,..count+=l
print ,( word)

prin t
• I
(count}

toUNT _AND ()
File Edit View
sneha and raj are goi ng somewhere. they are tired And hungry. with them are sonal AND Rahul. all are worki ng ANd st
school· and college respectively . AnD bored. I
17 2020, 1
""' ., '·
n·, · ·ncredits 11 YJt* 11 -li:~se ()" fo

'.Le~
· . ART: D: /Desktop data/Docume nts/Pytho
-1!1!1!1~'1".IIJesltlDo" data/DOcuments?Pyttion/word with tor T.py (3.7.9)
Edit Format Run Options Window Help
DISPLAYWORDS O :-
f= open (rrSTORY.txt" , 'r' )
count= 0
for line in f;
for word in line.split(): I
if (word.startswith( "T" )) or (word.startswith( "t" )):
count= count+ 1
print (word)

print(count)

ISPLAYWORDS ()
111' ryu JUI I J. I •J JJ"ICJ

Iii
FiJe Edit Shen Debug Options Window Help
Python 3.7.9 (tags/v3.7.9:13c947 47c7, Aug 17 2020
(AMD64)J on win32
Type "help", "copyr-igh:t:", "credits" or "license ( J
>>>
RESTART: D:/Desktop data/Documents/Pyt h
they
tired
em
ey

>> I

==
_,1,,u,••··•V.PY - 0-./0esktop data/Documents/Python/starting with P.py (3.7.9)
Run Options Window

- B () : '

i0cr s " txt" , •r ' }


...... __. . . . .· ~n :
(line.startswith( upn )):
_ print (lineJ

·s ta.'r ting-_ t.h


C P{)
ii - -

T
X +
:Etfn View

·ila:r rots are green .


.iH,a,tt\r'o t·s. have red beaks.
. l·, . b. d

·, r 't; ttt,·slS· :ll 1 r .
1

, U' ~- . = -~ -;,,,"'._
· }·~r.ots~v=i-s1t my school.
par.r ots are small.
.tions
. ... : ''····•-•·;,.;,m,, __ ,

7 .. 9:1 >

:/Desktop

my school.

>>> I
., y- . es op data/Documents/Python/cound ending
oOptiocis Window --
,() ; /
f- • - -· ·TEST FILE~ txt u , 1 r 1 )
count;:;;0;;,a
' -
for ,l. \ -- :.n : f:
.in line,. split (} :
; 1·1

word. ~ndswi th { 'e \ ) ,11, :i


count+=l ·1

, ; ... "Hf.
I~ 1- ljf,
lh

count words~~ ()
File , &.Ht Vi,ew
II

~ thiMg bf be,p1Uty is a source of joy.


The little things in world.
An umbrella.
r

world is nice.
Good work

,II

II I Iii
11/11111 1111/1 'I I I
a... 3 1.9 Shell
File Edrt Shell Debug Opbons Window He p
Python 3.7. 9 (tags 3.7.9:13c94747c7, Aug 1
(AMD64)] on win32
Type "help", "copyright", "credits " or "license (
>>>
--==
source
RESTART: D:/Desktop data/Documents/Pytho
The
little
3
>>> I
. lji I ' I " "]f/1.:1f:"

eJlt r
.,
\ r
• fi;:11 I I

~A thing of u~alfiy is a source of joy.


lhe little thiTI.gs in world.
.
An umbrella.-
. IIiu , -
~ fiti

Wor :Ld ,i s. ca lee' I •

Jrm . 1i '" lti ' ITTI ;


Good w.o rk · -
Help
Format Run Options Window
- - -__,.....,~--------"" " '" ". . __.. . .,. . ..........___...._._.,...............__
def. reverseFile ():
f= open ( "TEST FILE. txt" , 'r' )
for line in f:
print (line [:: -1]}

reverseFile ()
I
Cn-s_ ow Help
- -

·. V ~ :.9:<13c:94747c7, liug 17 2020, 16:30:00)


t: • :

f- :: •

yrigh.t ", · · "credits" or n-l icense ()" for more i

__ -TART: D: /Desktop data/Documents/Pyth on/reveFse

Ell.Os a si ytuaeb f 0 gniht A

i ht elttil ehT ·

. ecin si 119 now


krow dooG
>>> \·
-5-

3-

You might also like