Get Writing Help
WhatsApp
    ✍ ️Get Free Writing Help
WhatsApp

Introduction to programming Loops | My Assignment Tutor


Write My Assignment FREE

16/11/20171Introduction toprogrammingLoopsFlow chart – for loopfor (item in sequence)Statement blockYesNoFor each item in sequenceLast item checked?Statement blockTerminatefor x in range(1,20):print(x)16/11/20172Flow chart – while loopWhileLoop partLoopconditionTFWhile loop – repeat a block of statements as long as thecondition is truewhile test expression:statement blockyi =0while True:print(i)i = i+14Draw the flowchart for the following problem:– a positive number N … Continue reading “Introduction to programming Loops | My Assignment Tutor”

16/11/20171Introduction toprogrammingLoopsFlow chart – for loopfor (item in sequence)Statement blockYesNoFor each item in sequenceLast item checked?Statement blockTerminatefor x in range(1,20):print(x)16/11/20172Flow chart – while loopWhileLoop partLoopconditionTFWhile loop – repeat a block of statements as long as thecondition is truewhile test expression:statement blockyi =0while True:print(i)i = i+14Draw the flowchart for the following problem:– a positive number N is input– the sum from 1 to N is calculated– the sum is output to the screenFlow chart – example16/11/201735StartStopInput NOutput sumi = i + 1FTsum=0i = 0i 0Fact=Fact * iFactorial number – solutionExample code – for loop• digits = [0, 1, 5]• for i in digits:• print(i)• else:• print(“No items left.”)16/11/20175Example code – for loop• # Program to iterate through a listusing indexing• genre = [‘pop’, ‘rock’, ‘jazz’]• # iterate over the list using index• for i in range(len(genre)):• print(“I like”, genre[i])Factorial of a number• # Factorial of a number n! = n*(n‐1)!• num = int(input(“Enter a number: “))• factorial = 1• # check if the number is negative, positive or zero• if num

Plagiarism Free Assignment Help

Expert Help With This Assignment — On Your Terms

Native UK, USA & Australia writers Deadline from 3 hours 100% Plagiarism-Free — Turnitin included Unlimited free revisions Free to submit — compare quotes
Write My Assignment FREE Get A Free Quote →
Limited Offer     Get 25% off your first order — use code STUDYLINK25 at checkout    Claim Now
 
Don`t copy text!