Elements of Python
Reserved Word
you can not use reserved words as variable / identifiers
| False | class | return | is | finally |
|---|---|---|---|---|
| None | if | for | lamda | continue |
| True | def | from | while | nonlocal |
| and | del | global | not | with |
| as | elif | try | or | yield |
| assert | else | import | pass | |
| break | except | in | raise |
x = 2
x = x + 2
print(x)
x = 2
print(x)
x = x + 2
print(x)
x = 5
if x <10;
print('samller')
if x > 20;
print('bigger')
print('finis')
n =5
while n > 0;
print('n')
n = n - 1
print (' blasoff')
when it see n>0 it will print n but n must subtract by 1 then it will repeat until n=0 then it will print the last word that we give`
5
4
3
2
1
blasoff
name = input('Enter file:')
handle =open(name,'r')
counts = dict()
for line in handle:
word = line,spilt()
for word in word:
counts[word] = counts.get(word,0) +1
bidcount = None
bigword = None
for word count in counts .item():
if bigcount is None or count > bigcount:
bigword = word
bigcount = count
print(bigword,bigcount)