while loop and Do while loop example

 # i = 0    For loop

# while(i<=10):

#   print(i)

#   i = i + 1


# print("Done with the loop")


i = int(input("Enter the number: "))

print(i)

while(i<=38):

  i = int(input("Enter the number: "))

  print(i)


print("Done with the loop")


# count = 5

# while(count>0):

#   print(count)

#   count = count -1

# else:

#   print("I am inside else")


# do {

#   loop body;

# }while(condition);


Do while loop example:

while True:

  number = int(input("Enter a positive number: "))

  print(number)

  if not number > 0:

    break

  




Comments

Popular posts from this blog

According to Data Science Topic-13 Modules

Functions in Python:

According to Data Science Topic-12 If else program examples