Question
pls help
python is to be used

Assume that the variable data refers to the list [5, 3, 7]. Write the value of the following expressions for questions 48-49.
0 0
Add a comment Improve this question Transcribed image text
Answer #1

48 and 49)

python code:

# given data in list
data = [5, 3, 7]
# 48th question answer (its gievs last element of the list)
print(data[-1])
# 49th question (its checks whether list contain 0 or not)
if 0 in data:
print("Yes")
else:
print("no")

output:

7                                                                                                                                                           

no     

main.py Online Python Compiler. Code, Compile, Run and Debug python program online. 5 Write your code in this editor and pres

50)

python code:

# dictionary declaring with key and value
my_dict = {'a': 3, 'x': 7, 'r': 5}
print("Given my_dict is :")
# printing dictionary
print(my_dict)
# printing pairs of dictionary items
print("Key and value pair is :")
# for loop for dictionary items its iterate one by one
for i in my_dict:
print(i, my_dict[i])

output:

Given my_dict is :                                                                                                                                            

{'x': 7, 'r': 5, 'a': 3}                                                                                                                                      

Key and value pair is :                                                                                                                                       

x 7                                                                                                                                                           

r 5                                                                                                                                                           

a 3

main.py Online Python Compiler. Code, Compile, Run and Debug python program online. 5 Write your code in this editor and presNote:

  • # indicates comment for code

  

   

Add a comment
Know the answer?
Add Answer to:
pls help python is to be used Assume that the variable data refers to the list...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • 47. (2 points) What will the following code print? my-list-on"n) for n in range( 5) İf(n.nr%2--ol...

    47. (2 points) What will the following code print? my-list-on"n) for n in range( 5) İf(n.nr%2--ol print(my_list) Answer Assume that the variable data refers to the list [5, 3, 7). Write the value of the following expressions for questions 48-49. 48. (1 points) datal-11 Answer: 49. (1 points) 0 in data Answer: 50. (4 points) Given my_dict my_dict l'a:3, x':7, r':5, write Python code to print all the key and value pairs of Answer:

  • 1) Which of the following is NOT true about a Python variable? a) A Python variable...

    1) Which of the following is NOT true about a Python variable? a) A Python variable must have a value b) A Python variable can be deleted c) The lifetime of a Python variable is the whole duration of a program execution.   d) A Python variable can have the value None.        2) Given the code segment:        What is the result of executing the code segment? a) Syntax error b) Runtime error c) No error      d) Logic error 3) What...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...

  • There exists a Python variable (a list of lists) called score_card which stores data representing...

    PYTHON 3.7 EXERCISES part 2 Question 1 Question 2 There exists a Python variable (a list of lists) called score_card which stores data representing player results from a golf competition. Each sublist is a triple (i.e., a list of size three) which stores data for one player as follows (in this order): A string representing the player's initials An integer representing the player's gross score An integer representing the player's golfing handicap. A golf player's net score is calculated by...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...

  • Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a...

    Python Language Only!!!! Python Language Only!!!! Python Language Only!!!! Python 3 is used. A. Write a function named smaller that accepts two arguments: a list, and a number n. Assume that the list contains numbers. The function should display all numbers in the list that are smaller than the number n. Write a code that declares and initializes a list of numbers and a variable number and pass them to the function to test it. Please see the outcome below:...

  • Create a Python list (use first three letters of your name followed by the letter L...

    Create a Python list (use first three letters of your name followed by the letter L as the name of the list.) with the following data: 10, 20.0, 50.00, 7000, 7500, 7700, 7800, 8000, 9000, ‘python’. Display the entire list with an appropriate message. Display the 4th element in the list with an appropriate message. Display the first 3 values of the list only. Display all the values starting from the sixth element to the end of the list. Change...

  • USE Python 1. Assign value 555 to the variable x, write code to square the variable...

    USE Python 1. Assign value 555 to the variable x, write code to square the variable x and print out the result. 2. Given a string x, write a program to check if its first character is the same as its last character. If yes, the code should output "True" . 3. We defined two variables, x = 'Python' and y = '3.0'. Write code to concatenate the two numbers (the result should be 'Python3.0').

  • Exercise 1 - Create a List to Sum Values Write a python script that sums the...

    Exercise 1 - Create a List to Sum Values Write a python script that sums the values in a list called add_list that contains the following values: (10, 2, -4, 8). Make sure you include a for loop when iterating through the list to sum the values. Take screenshots of the code and output. Exercise 2 – Create a Dictionary Write a python script that prints a dictionary where the key numbers are 1, 2, 3, 4, and 5 and...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT