Answer:
Kindly check explanation
Step-by-step explanation:
(1.)
n = 0
While n < 10 :
n+=1
print('fichoh')
# initiate counter n = 0 ; set condition, while n is not equal to 10 ; it print 'fichoh' and counter is increased by 1. This terminates once it reaches 10.
(2.)
for number in range(1,50):
if number%2 != 0 :
print(number)
#An odd number won't have a remainder of 0 when Divided by 2 ; so, for numbers 1 to 49 using the range function, if the number is divided by 2 and leaves a remainder other Than 0, such number is displayed
(3.)
for number in range(0,101,5):
print(number)
# Using the range function, starting from 0 to 100; it is number in the for loop is incremented by 5 and displayed.
(4.)
outfile = open('my_file.txt', 'w')
for n in range(0,11):
outfile.write(str(n))
outfile.close()
#open, 'w' creates a text file, my_text.txt and writes into it ; using the range function, numbers 0 to 10 is written into the created file.
5.)
name_file = open('People.txt', 'r')
While name_file:
out_file = name_file.readline()
if out_file = ' ' :
break
name_file.close()
names = name
#Open, 'r' ; opens and read from the file People.txt ;
#readline reads the content of the opened text file into a list out_file ; using the if ' ', the loop terminates once an empty content is read.