top of page

What is While-Loop Statements ? | Programming and Data Structures Assignment Help | Realcode4you

realcode4you

The first while-loop example

 for i in range(0,10): 
	print(i)

Going backwards

 Times table example

for i in range(1,10): 
	print("{0} x {1} = {2}".format(i, 5, 5*i))

Friend of 10 table

for i in range(0,11): 
	print("{0:>2} + {1:>2} = {2:>2}".format(i, 10 - i, 10))


Questions

What is the output of the following codes?

Display equations


Enter start number: 4

Enter end number: 7


Equations:

4 + 4 = 8

5 + 5 = 10

6 + 6 = 12

7 + 7 = 14


# ask user for start number

# ask user for end number

# display equations between the two input numbers



while loop that runs forever

while True: 
	user_input = input("Enter something: ") 
	print("You have entered: " + user_input)

This program will run forever!


this while loop will stop if user enters q


Keep asking until user enters a positive number


Counting even and odd numbers



Green egg and ham?


Green egg and ham?


Comments


REALCODE4YOU

Realcode4you is the one of the best website where you can get all computer science and mathematics related help, we are offering python project help, java project help, Machine learning project help, and other programming language help i.e., C, C++, Data Structure, PHP, ReactJs, NodeJs, React Native and also providing all databases related help.

Hire Us to get Instant help from realcode4you expert with an affordable price.

USEFUL LINKS

Discount

ADDRESS

Noida, Sector 63, India 201301

Follows Us!

  • Facebook
  • Twitter
  • Instagram
  • LinkedIn

OUR CLIENTS BELONGS TO

  • india
  • australia
  • canada
  • hong-kong
  • ireland
  • jordan
  • malaysia
  • new-zealand
  • oman
  • qatar
  • saudi-arabia
  • singapore
  • south-africa
  • uae
  • uk
  • usa

© 2023 IT Services provided by Realcode4you.com

bottom of page