Computer Science, asked by williambarnes, 11 months ago

does anyone know edhesive and python? if so, please help with these coding questions!!!

Question 1:
Write a program that uses a while loop to calculate and print the multiples of 3 from 3 to 21. Your program should print each number on a separate line.

Sample Run

3
6
9
12
15
18
21
Question 2:
Write a program that inputs numbers and keeps a running sum. When the sum is greater than 100, output the sum as well as the count of how many numbers were entered.

Sample Run

Enter a number: 1
Enter a number: 41
Enter a number: 36
Enter a number: 25

Sum: 103
Numbers Entered: 4
Question 3:
Write a loop that continually asks the user what pets the user has, until the user enters "rock", in which case the loop ends. It should acknowledge the user in the following format. For the first pet it should say "You have a dog with a total of 1 pet(s)" if they enter dog, and so on.

Sample Run:

User enters:

lemur
parrot
cat
rock
Outputs:

You have a lemur with a total of 1 pet(s)
You have a parrot with a total of 2 pet(s)
You have a cat with a total of 3 pet(s)

Answers

Answered by lastbenchstudent
0

ans 1

i = 3

while (i <= 22):

if (i % 3 == 0):

print(i)

i++

Answered by luzincourt134
2

Answer:

Answer1

u=float(input("Enter a number"))

c = 1

while (u <= 100):

 n = float(input("Enter a number"))

 u = u + n

 c = c + 1

print ("Sum: " + str (u))

if(u > 100):

 print ("Numbers Entered: " + str(c)

Similar questions