100% satisfaction guarantee Immediately available after payment Both online and in PDF No strings attached
logo-home
Edhesive 4.1 - 4.11 Questions and Answers £11.31
Add to cart

Exam (elaborations)

Edhesive 4.1 - 4.11 Questions and Answers

 3 views  0 purchase
  • Module
  • PTS
  • Institution
  • PTS

Edhesive 4.1 - 4.11 Questions and Answers 4.1 Lesson Practice We use loops to: Repeat blocks of code 4.1 Lesson Practice Consider the following code: num = int(input("Enter a number, negative to stop")) while (num >= 0): print ("You entered: " + str(num)) num = int(input("Ente...

[Show more]

Preview 2 out of 8  pages

  • January 3, 2025
  • 8
  • 2024/2025
  • Exam (elaborations)
  • Questions & answers
  • PTS
  • PTS
avatar-seller
Edhesive 4.1 - 4.11 Questions and
Answers
4.1 Lesson Practice

We use loops to: - answer Repeat blocks of code

4.1 Lesson Practice

Consider the following code:
num = int(input("Enter a number, negative to stop"))
while (num >= 0):
print ("You entered: " + str(num))
num = int(input("Enter a number, negative to stop"))
print ("Done.")
What is wrong? - answer The line num = int(input("Enter a number, negative to
stop")) should be indented so it is inside the loop

4.1 Lesson Practice - answer Complete the activity.

4.1 Code Practice - answer name = input("Please enter a name, Nope to end ")
while (name != "Nope"):
print ("Nice to meet you " + name)
name = input("Please enter a name, Nope to end ")
print ("Done")

4.2 Lesson Practice

What is output? Select all that apply.
c=0
while (c < 10):
c=c+5
print (c) - answer 5 and 10

4.2 Lesson Practice

What is output? Select all that apply.
c=3
while (c < 10):
c=c+2
print (c) - answer 5, 7, 9 and 11

4.2 Lesson Practice

, What is output?
c=1
sum = 0
while (c < 10):
c=c+3
sum = sum + c
print (sum) - answer 21

4.2 Lesson Practice

What should be entered to make the loop print
60
70
80
x = 50
while (x < 80):
x = x + ____
print (x) - answer 10

4.2 Code Practice: Question 1 - answer sum = 0
count = 0
while (sum <= 100):
count +=1
num = int(input("Enter a number: "))
sum += num
print("Sum: " + str(sum))
print("Numbers entered: " + str(count))

4.2 Code Practice: Question 2 - answer pet = input("What pet do you have?")
count = 0
while (pet!= "rock"):
count +=1
print ("You have a " + str(pet) + " with a total of " + str(count) + " pet(s)")
pet = input("Enter pet: ")

4.3 Lesson Practice

Consider the following code:
x = int(input ("Enter a value: "))
c=0
sum = 0
while (c < 10):
x = int(input ("Enter a value: "))
c=c+1
sum = sum + x

The benefits of buying summaries with Stuvia:

Guaranteed quality through customer reviews

Guaranteed quality through customer reviews

Stuvia customers have reviewed more than 700,000 summaries. This how you know that you are buying the best documents.

Quick and easy check-out

Quick and easy check-out

You can quickly pay through credit card for the summaries. There is no membership needed.

Focus on what matters

Focus on what matters

Your fellow students write the study notes themselves, which is why the documents are always reliable and up-to-date. This ensures you quickly get to the core!

Frequently asked questions

What do I get when I buy this document?

You get a PDF, available immediately after your purchase. The purchased document is accessible anytime, anywhere and indefinitely through your profile.

Satisfaction guarantee: how does it work?

Our satisfaction guarantee ensures that you always find a study document that suits you well. You fill out a form, and our customer service team takes care of the rest.

Who am I buying these notes from?

Stuvia is a marketplace, so you are not buying this document from us, but from seller Pogba119. Stuvia facilitates payment to the seller.

Will I be stuck with a subscription?

No, you only buy these notes for £11.31. You're not tied to anything after your purchase.

Can Stuvia be trusted?

4.6 stars on Google & Trustpilot (+1000 reviews)

50990 documents were sold in the last 30 days

Founded in 2010, the go-to place to buy revision notes and other study material for 15 years now

Start selling
£11.31
  • (0)
Add to cart
Added