100 Days of Code (Python Course by Angela) Project 4

BillFortune: Your Random Bill Payer

100 Days of Code (Python Course by Angela) Project 4



Introduction:

"BillFortune" is an innovative project designed to simplify the process of splitting bills among a group of friends. Whether it's a dinner at a restaurant or a gathering at a hotel, this interactive program assists in determining the lucky friend who will take care of the bill 😁. By leveraging the power of randomness, the burden of decision-making is lifted, creating an exciting and fair solution for bill payments.


The program prompts the user to input the number of friends attending the event and their respective names. Once the information is provided, the program selects a random friend from the list and announces them as the designated bill payer for the occasion 😁. This feature adds an element of surprise and eliminates any biases or conflicts that may arise when selecting someone to foot the bill. 😉

Source code:

import random

print("BillFortune: Your Random Bill Payer")

friends_list = []

number_of_friends = int(input("How many friends attend party at hotel\n"))

#using for loop for entering friends name to list.

for i in range(number_of_friends):

  friend_name = input("Enter name of friend:\n")

  friends_list.append(friend_name)

  

print(f"Today! Bill will be paid by {random.choice(friends_list)}")

Next Post Previous Post