Professional Documents
Culture Documents
Nested Loops (Autosaved)
Nested Loops (Autosaved)
Nested Loops (Autosaved)
*
**
***
for x in range(0,10):
for y in range(0,x):
print("*",end=" ")
print()
• Write program to print following pattern:
**********
**********
**********
**********
for x in range(0,10):
for y in range(0,10):
print("*",end=" ")
print()
Q1
Some students have been carrying out 2
experiments; 5 temperature readings were
taken in each experiment
Write a program code, which inputs all the
temperature readings, and outputs the
average temperature for each experiment, the
average temperature for all 2 experiments and
the highest temperature recorded from all the
readings taken.
• max=0
• tt=0
• for i in range(0,2):
• total=0
• for j in range(0,5):
• a=int(input("enter temperature"))
• total=total+a
• tt=tt+a
• if a > max:
• max=a
• print("aVERAGE IS",total/5)
• print("MAXIMUN IS ",max)
• print("total average is ",tt/10)
highest=0
totalAll=0
for expt in range(0,2):
totalExp=0
for reading in range(0,5):
temp=int(input("Temperatue "))
totalExp = totalExp +temp
totalAll = totalAll + temp
if temp > highest:
highest = temp
averageExp = totalExp / 5
print averageExp
averageAll = totalAll / 10
print averageAll