Using function:
a. sort a list using bubble sort algorithm (ascending and descending order). you have
to take choice from the user. also the list should be user defined
b. search an item using binary search algorithm
User inputs a word. Programmesays if it has vowels or not
Take in a number
from the user print if it's divisible by 3 or 5 or 3 and 5
Calculate and display the sum of all the numbers divisible by 7 between 18 and 534 using loops and conditional statements i.e. 21+28+35+...+525+532.
Q5: Create a list containing the following 3 elements:
your favorite color
the number of pets you have
a boolean value describing whether you have previous programming experience
Q6: Complete the following print and if statements by accessing the appropriate elements from my_list.
Hint: Use the list indexing notation [].
print('My favorite color is', ???) print('I have {} pet(s).'.format(???)) if ???:
print("I have previous programming experience") else:
print("I do not have previous programming experience")
Q7: Add your favorite single digit number to the end of the list using the appropriate list method.
Q8: Remove the first element of the list, using the appropriate list method.
Q9: Complete the print statement below to display the number of elements in my_list. print("The list has {} elements.".format(???))
Q11: A travel company wants to fly a plane to the Bahamas. Flying the plane costs 5000 dollars. So far, 29 people have signed up for the trip. If the company charges 200 dollars per ticket, what is the profit made by the company?
Fill in values or arithmetic expressions for the variables below.
cost_of_flying_plane = ??? number_of_passengers = ??? price_of_ticket = ???
profit = ???
print('The company makes of a profit of {} dollars'.format(profit))
Q11b Out of the 29 people who took the flight, only 12 buy tickets to return
from the Bahamas on the same plane. If the flying the plane back also costs 5000 dollars, and does the company make an overall profit or loss? The company charges the same fee of 200 dollars per ticket for the return flight. (Optional)
Use an if statement to display the result.
if a given integer in "N". write a program to print the right angled triangle pattern of "N" rows and there is a lhytopenus line using "/" of same number
-------
|
|
|
|
|
|
|
Q11: A travel company wants to fly a plane to the Bahamas. Flying the plane costs 5000 dollars. So far, 29 people have signed up for the trip. If the company charges 200 dollars per ticket, what is the profit made by the company?
Fill in values or arithmetic expressions for the variables below.
cost_of_flying_plane = ??? number_of_passengers = ??? price_of_ticket = ???
profit = ???
print('The company makes of a profit of {} dollars'.format(profit))
Q11b Out of the 29 people who took the flight, only 12 buy tickets to return
from the Bahamas on the same plane. If the flying the plane back also costs 5000 dollars, and does the company make an overall profit or loss? The company charges the same fee of 200 dollars per ticket for the return flight. (Optional)
Use an if statement to display the result.
Assign your name to the variable name.
Assign your age (real or fake) to the variable age.
Assign a boolean value to the variable has_android_phone.
Create a dictionary person with keys "Name", "Age", "HasAndroidPhone" and values using the variables defined above.
Use a for loop to display the type of each value stored against each key in person.
write a program to find the first prime number in the given inputs