Questions: 5 831

Answers by our Experts: 5 728

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Search & Filtering

Write a function called fizz_buzz that takes a number.

If the number is divisible by 3, it should return “Fizz”.

If it is divisible by 5, it should return “Buzz”.

If it is divisible by both 3 and 5, it should return “FizzBuzz”.

Otherwise, it should return the same number.


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.


For example if the given two strings A and B are "ramisgood" "goodforall"





The output should be "good"

word count problem:

input: hello world welcome to python world

output:

hello: 1

world: 2

welcome: 1

to: 1

python: 1


Python program to filter even values from list using lambda function


Create Employee class with some attributes and method


1. Given a text file contains the name and gender of students, read the file and store the names and genders in a list.

2. Count how many male and female in the list.

3 Store the names of male and female in two different lists.


text file

name,gender

Alice,f

Bruce,m

Cloud,m

Darren,m

Eidy,f

Flower,f

Guile,m

Honda,m

Ilhamah,f

Judy,f

Kennedy,m

Laisy,f



1. Given the scores of students for Mathematics, English and Science, calculate the average score of each student and store it in a list.

2. Write the names, scores of each subject and average scores into a text file or csv file.


Code:

names = ['Zendaya', 'Yaacob', 'Xander', 'Willy',

     'Vega', 'Umar', 'Takata', 'Sheena', 'Rhina', 'Queen']


math = [67, 73, 71, 11, 51, 46, 29, 51, 66, 25]

english = [87, 48, 93, 41, 69, 43, 0, 17, 78, 74]

science = [73, 71, 17, 81, 8, 33, 39, 33, 17, 93]


Write a function which will take 2 arguments. They are:

• Sentence

• Position

Your first task is to take these arguments as user input and pass these values to the function

parameters.

Your second task is to implement the function and remove the characters at the index number

which is divisible by the position (Avoid the index number 0 as it will always be divisible by the

position, so no need to remove the index 0 character). Finally, add the removed characters at

the end of the new string.

Return the value and then finally, print the new string at the function call.

[Cannot use remove() or removed() for this task]


Input:

"I love programming."

3

Function call:

function_name("I love programming.", 3)

Output:

I lveprgrmmngo oai.

===================================================================

Input:

"Python is easy to learn. I love python."

6

Function call:

function_name("Python is easy to learn. I love python.", 6)

Output:

Pythonis eay to earn.I lov pythn. sl eo


Write a python function that will perform the basic calculation (addition, subtraction,

multiplication and division) based on 3 arguments. They are:

Operator ('+', '-', '/', '*')

First Operand (any number)

Second Operand (any number)

Your first task is to take these arguments as user input and pass the values to the function

parameters.

Your second task is to write a function and perform the calculation based on the given operator.

Then, finally return the result in the function call and print the result.

=====================================================

Input:

"+"

10

20

Function Call:

function_name("+", 10, 20)

Output:

30.0

================================

Input:

"*"

5.5

2.5

Function Call:

function_name("*", 5.5, 2.5)

Output:

13.75


LATEST TUTORIALS
New on Blog
APPROVED BY CLIENTS