Question: 6. Write a program that displays the number of users on a social media application based on the following rules: If there is no

 6. Write a program that displays the number of users on a social media application based on the following  

6. Write a program that displays the number of users on a social media application based on the following rules: If there is no one, return "no one online". If there is 1 person, return "user1 online". If there are 2 people, return "user1 and user2 online". If there are n>2 people, return the first two names and add "and n-2 more online". Initialize an array of size N with some username(s) (maybe none) and consider the above conditions. For example, if there are 5 users, the program displays: "user1, user2 and 3 more online" 6. Write a program that displays the number of users on a social media application based on the following rules: If there is no one, return "no one online". If there is 1 person, return "user1 online". If there are 2 people, return "user1 and user2 online". If there are n>2 people, return the first two names and add "and n-2 more online". Initialize an array of size N with some username(s) (maybe none) and consider the above conditions. For example, if there are 5 users, the program displays: "user1, user2 and 3 more online"

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Answer Certainly Below is a simple Python program that impl... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!