The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Jul 2017 |
| Last Sign in: | 304 Weeks Ago, 1 Day Ago |
| Questions Answered: | 15833 |
| Tutorials Posted: | 15827 |
MBA,PHD, Juris Doctor
Strayer,Devery,Harvard University
Mar-1995 - Mar-2002
Manager Planning
WalMart
Mar-2001 - Feb-2009
I'm trying to write this problem, but when I run it nothing seems to happen. I've attached the python solution to problem 1. Just want to know what I am missing.
Â
2.  Problem 1: Write a program that will calculate the problem and stop after the condition has been met.Â
Â
a=number of loops (start with zero but will increase by 1 after each completed loop)
b=a+1
c=a+b
Â
a=1
b=a+1
c=a+b
while (c<=5):
     a=1
     b=a+1
     c=a+b
print("Loop had executed " + str(x) + " times")
#a is assigned value 1
#b is assigned value a+1
#c is assigned value a +b. That is c =a +b.
#The condition is checked if c is smaller than 5 the same procedure
#begin again and if c is greater than 5 loop will terminate.
#Only one loop is enough to complete this task.
#Only one loop is required to iterate all 3 statements again and again.
Â
Condition: If c is less than 5, then the loop will continue; else, it will end.
3.  Print a string variable that states the number of loops required to meet the condition for Problem 1.
----------- Â ----------- H-----------ell-----------o S-----------ir/-----------Mad-----------am ----------- Th-----------ank----------- yo-----------u f-----------or -----------you-----------r i-----------nte-----------res-----------t a-----------nd -----------buy-----------ing----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n. -----------Ple-----------ase----------- pi-----------ng -----------me -----------on -----------cha-----------t I----------- am----------- on-----------lin-----------e o-----------r i-----------nbo-----------x m-----------e a----------- me-----------ssa-----------ge -----------I w-----------ill----------- be----------- qu-----------ick-----------ly