CS 115 – Introduction to Programming in Python Solved

$ 20.99
Category:

Description

Lab Guide 02A

Lab Objectives: Loops, Nested Loops

1) Write a program to input the age of 10 people and print out the number of people whose ages are above 50 years old and the average age of the people who are below 20 years old. You should not store the ages in a list.

Sample Run:

Age of person 1: 45
Age of person 2: 56
Age of person 3: 78
Age of person 4: 15
Age of person 5: 14
Age of person 6: 23
Age of person 7: 57
Age of person 8: 13
Age of person 9: 60 Age of person 10:17

There are 4 people whose ages are above 50
Average age of people whose ages are below 20: 14.75

Sample Run:
Enter positive integer (negative to quit): 1234
Digits are not in descending order

Sample Run:
Enter positive integer: 9531
Digits are in descending order 3) Write a script to input n (number of lines) and displays the output below.

1
1 2
1 2 3
..
1 2 … n

Sample run :
Enter number of lines: 7
1
1 2
1 2 3
1 2 3 4
1 2 3 4 5
1 2 3 4 5 6
1 2 3 4 5 6 7

Reviews

There are no reviews yet.

Be the first to review “CS 115 – Introduction to Programming in Python Solved”

Your email address will not be published. Required fields are marked *