100-Days OF Python-Day-05

 Day-05


For doing repetitive task in computer we use 

loops.There are two types of loops:

1.For Loops

2.While Loops


WAP for calculatig the average height in a class:


print("Calculate Average Height of the class")  
Height_input=input("Please enter the height: ").split()

for n in range(0,len(Height_input)):
    Height_input[n]=int(Height_input[n])
print(Height_input)

height_sum=0
n=0
for i in Height_input:
    height_sum=i+height_sum
    n=n+1
    print(n)
print(height_sum)

average_height=height_sum/n
print(f"{average_height} is the average height in class")
# 🚨 Don't change the code below 👇
student_scores = input("Input a list of student scores ").split()
value_container=0
for n in range(0len(student_scores)):
  student_scores[n] = int(student_scores[n])


print(student_scores)
highest_scores=0
for score in student_scores:
    if score > highest_scores:
        highest_scores=score
print(f"The highest score in the class is:{highest_scores}")
print("What is the highest number:")
students_scores=input("Enetr students score:").split()
for n in range(0,len(students_scores)):
    students_scores[n]=int(students_scores[n])
print(students_scores)
highest_score=0
for score in students_scores:
    if score > highest_score:
        highest_score=score
print(f"The highest score is {highest_score}: ")

i=0
for number in range(2,101,2):
    i=i+number
print(f"The sum of even numbers from 1-100 is {i}: ")

i=0
for number in range(1,101):
    i=i+number
print(i)

print("Lets Play Fizz/buzz Game")
for i in range(1,101):
    if i % 3==0 and i % 5==0:
        print("FizzBuzz")
    elif i%3==0:
        print("Fizz")
    elif i%5==0:
        print("Buzz")
    else:
        print(i)



Comments

Popular posts from this blog

Top 5 Best Books For Python,Data Science & Machine Learning

How To Start A BLOG

Top 50 Most Innovative Companies in 2020

Why Should We learn C Programming?

Blogger Tutorial