1.Question 1Which of the following statements correctly describe strings? Select all that apply.1 pointStrings must be placed in brackets ([ ]).Strings must be placed in quotation marks (" ").Strings cannot contain numeric characters.Strings are immutable.2.Question 2What does the following code return?device_id = "uu0ktt0vwugjyf2"print(device_id[2:5])1 point"u0k""u0kt""0kt""0ktt"3.Question 3What does the following code display?device_id = "Tj1C58Dakx"print(device_id.lower())1 point"tj1c58dakx""Tj1C58Dakx""tj1C58Dakx""TJ1C58DAKX"4.Question 4You want to find the index where the substring "192.168.243.140" starts within the string contained in the variable ip_addresses. Complete the Python code to find and display the starting index. (If you want to undo your changes to the code, you can click the Reset button.)12ip_addresses = "192.168.140.81, 192.168.109.50, 192.168.243.140"###YOUR CODE HERE###RunResetWhat index does the substring "192.168.243.140" start at?1 point31333432
Question
1.Question 1Which of the following statements correctly describe strings? Select all that apply.1 pointStrings must be placed in brackets ([ ]).Strings must be placed in quotation marks (" ").Strings cannot contain numeric characters.Strings are immutable.2.Question 2What does the following code return?device_id = "uu0ktt0vwugjyf2"print(device_id[2:5])1 point"u0k""u0kt""0kt""0ktt"3.Question 3What does the following code display?device_id = "Tj1C58Dakx"print(device_id.lower())1 point"tj1c58dakx""Tj1C58Dakx""tj1C58Dakx""TJ1C58DAKX"4.Question 4You want to find the index where the substring "192.168.243.140" starts within the string contained in the variable ip_addresses. Complete the Python code to find and display the starting index. (If you want to undo your changes to the code, you can click the Reset button.)12ip_addresses = "192.168.140.81, 192.168.109.50, 192.168.243.140"###YOUR CODE HERE###RunResetWhat index does the substring "192.168.243.140" start at?1 point31333432
Solution
- The correct statements that describe strings are:
- Strings must be placed in quotation marks (" ").
- Strings are immutable.
-
The code
print(device_id[2:5])will return "0kt". -
The code
print(device_id.lower())will display "tj1c58dakx". -
To find the starting index of the substring "192.168.243.140" within the string contained in the variable ip_addresses, you can use the
find()method in Python. Here is the completed code:
ip_addresses = "192.168.140.81, 192.168.109.50, 192.168.243.140"
index = ip_addresses.find("192.168.243.140")
print(index)
The starting index of the substring "192.168.243.140" is 33.
Similar Questions
2.Question 2What does the following code return?device_id = "uu0ktt0vwugjyf2"print(device_id[2:5])1 point"u0kt""0ktt""0kt""u0k"
3.Question 3What does the following code display?device_id = "Tj1C58Dakx"print(device_id.lower())1 point"tj1c58dakx""Tj1C58Dakx""TJ1C58DAKX""tj1C58Dakx"
3.Question 3Which of the following lines of code has correct syntax for printing the data type of the string "elarson"?1 pointtype(print("elarson"))print(type, "elarson")print("elarson", type)print(type("elarson"))
1.Question 1what is the result of the following: 1=21 pointFalse TrueSyntaxError:can't assign to literal2.Question 2What is the output of the following code segment:i=6i<51 pointTrueFalseSyntaxError: can't assign to literal3.Question 3What is the result of the following: 5!=51 pointFalseTrue4.Question 4What is the output of the following code segment: 'a'=='A'1 pointFalseTrue5.Question 5in the video, if age=18 what would be the result 1 pointmove onyou can enter 6.Question 6in the video what would be the result if we set the variable age as follows: age= -101 pointgo see Meat Loafmove onyou can entermove on7.Question 7what is the result of the following: True or False 1 pointTrue, an or statement is only False if all the Boolean values are FalseFalse
Which of the following declaration(s) is/are correct for a String? Tick all correct answer(s). No partial marks and no negative marks.Select one or more:String s2='null';String s1=null;String s4=(String)'\ufeed';String s3=(String)'abc';
Upgrade your grade with Knowee
Get personalized homework help. Review tough concepts in more detail, or go deeper into your topic by exploring other relevant questions.