repl.it
@JimSkon/

PogilReadingFiles

Python

No description

fork
loading
Files
  • main.py
  • sports.txt
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def main1():
  sportsList = open('sports.txt')
  sp=sportsList.read()
  print(sp)

def main2():
  sportsList = open('sports.txt')
  for index in range(1,21):
    sp=sportsList.readline()
    print(str(index)+". "+sp)

def main3():
  sportsList = open('sports.txt')
  for index in range(1,21):
    sp=sportsList.readline()
    print(str(index)+". "+sp.rstrip())

def main4():
  sportsList = open('sports.txt')
  for index in range(1,21):
    sp=sportsList.readline()
    if len(sp) >= 10:
      print(sp.rstrip())

def main5():
  sportsList = open('sports.txt')
  sp=sportsList.read()
  for ch in sp:
    if(ch=="\n"):
      print(ch)
    else:
      print(ch,end="")

def main6():
  sportsList = open('sports.txt')
  index=1;
  for sport in sportsList:
    print(str(index)+". "+sport.rstrip())
    index+=1


main5()
Fetching token
?