Question

PYTHON LANGUAGE Task 11 -Create a list with 5 items having 3 distinct data types -output...

PYTHON LANGUAGE

Task 11

-Create a list with 5 items having 3 distinct data types
-output the second element of the list
-output the last element of the list using
-negative index
-positive index
-len method

Task 12
-Create a list with 3 items
-add an item to the end of the list
-remove the first item of the list
-determine if an item exists in the list
-if it does, display its index
-if it does not, give user message


Task 13
-Create a list with two items
-Copy the values of the list above to create another list(hint, use slicing)
-add a value to the first list
-remove the last value of the second list
-display both lists

Task 14
-Create a list of integers using the range method
-display the list
-randomize the values of the list
-display the list again to demonstrate that the values have been reordered
-display the amount of times the number 3 occurs in the first list

Task 15
-Create a list of doubles (the data type double, minimum 3 values)
-output the minimum value
-output the maximum value

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Task 1

# a list with 5 elements and 3 data types: String, Int, Float
aList = ["Chegg", 100, 12.34, "India", 90]

# indices start from 0. So, the indices of above list are 0, 1, 2, 3 and 4

# second element has index 1
print("Second element:", aList[1])

# last element has index 4
print("Last element:", aList[4])

# negative index is to get the items from last and they start from -1

# last but one can be accessed using index -2
print("Negative index (fourth element):", aList[-2])

# last but one item using positive index
print("Positive index (fourth element):", aList[3])

# len is a method that gives the length of the list
print("Lengt:", len(aList))

# One question at a time please -- Policy of Chegg.

# Happy Learning!

Add a comment
Know the answer?
Add Answer to:
PYTHON LANGUAGE Task 11 -Create a list with 5 items having 3 distinct data types -output...
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
  • Write a Java program that will create a random list (array) randomize a  search item to be...

    Write a Java program that will create a random list (array) randomize a  search item to be found in the list sequentially search the array for that item. You must code the search and not use a search function. Display each comparison in the array; the element contents and the index. display whether the item was found or not. Now take that code and alter it to have two lists. Both lists randomize between 1 and 50. While traversing one list,...

  • C++. Please note the BOLDED ITEMS. You will create a simple linked structure. You will use...

    C++. Please note the BOLDED ITEMS. You will create a simple linked structure. You will use a simple node that has a pointer to a Node. The data for the Node will be a single data member of type char. You will build a structure where the last node you add will point to the first node created, i.e. it will be a circular linked structure. You will create a program that stores characters provided by the user, stored in...

  • 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...

  • Create a linked list with the following features. A Node class that stores the data type...

    Create a linked list with the following features. A Node class that stores the data type of your choice. A constructor that creates a dummy header node. void display() -- A method for printing the list. void add(item) -- A method for adding a value to the beginning of the list void addEnd(item) -- A method of adding a value to the end of the list. bool contains(item) -- A method for finding a specified value in the list. int...

  • Develop a Generic String List (GSL). NOTE: I have done this lab but someting is wrong...

    Develop a Generic String List (GSL). NOTE: I have done this lab but someting is wrong here is what i was told that was needed. Ill provide my code at the very end. Here is what is missing : Here is my code: public class GSL { private String arr[]; private int size; public GSL() {     arr = new String[10];     size = 0; } public int size() {     return size; } public void add(String value) {    ...

  • PYTHON PROGRAMMING LANGUAGE Task 5 Open a csv file for writing create 3 rows that store...

    PYTHON PROGRAMMING LANGUAGE Task 5 Open a csv file for writing create 3 rows that store username, first name, last name and age data (four columns) write the data to the csv file under the correct column Task 6 Open the file in task 5) and read its contents Output the content in a tabular format of columns and values

  • Write in C++: Please create a shopping list using the STL list container, then follow the...

    Write in C++: Please create a shopping list using the STL list container, then follow the following instructions. Create an empty list. Append the items, "eggs," "milk," "sugar," "chocolate," and "flour" to the list. Print the list. Remove the first element from the list. Print the list. Insert the item, "coffee" at the beginning of the list. Print the list. Find the item, "sugar" and replace it with "honey." Print the list. Insert the item, "baking powder" before "milk" in...

  • In this problem, you will create a selectable “To Do” List. To add a task to...

    In this problem, you will create a selectable “To Do” List. To add a task to this list, the user clicks the Add Task button and enters a description of the task. To delete a task from the list, the user selects the task and then clicks the Delete Task button. Open the HTML and JavaScript files provided as start-up files (index.html from within todo_list_Q.zip file). Then, review the HTML in this file. Note, within the div element, there is...

  • JAVA PROGRAMMING PLEASE This lab has three parts: Create an ArrayList class. Create a LinkedList class....

    JAVA PROGRAMMING PLEASE This lab has three parts: Create an ArrayList class. Create a LinkedList class. Print out the results after testing each of the methods in both of the classes and solving a simple problem with them. Task 1 – ArrayList Class Create an ArrayList class. This is a class that uses an internal array, but manipulates the array so that the array can be dynamically changed. This class should contain a default and overloaded constructor, where the default...

  • Instructions We're going to create a program which will allow the user to add values to a list, p...

    Instructions We're going to create a program which will allow the user to add values to a list, print the values, and print the sum of all the values. Part of this program will be a simple user interface. 1. In the Program class, add a static list of doubles: private statie List<double> _values new List<double>) this is the list of doubles well be working with in the program. 2. Add ReadInteger (string prompt) , and ReadDouble(string prompt) to the...

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