Question

The isdigit() method of a string returns a. true if the string contains only digits b....

The isdigit() method of a string returns

a.

true if the string contains only digits

b.

the digits that are in the string

c.

the string if it only contains digits

d.

true if the string contains only digits and a decimal point

Which of the Python examples that follow can not be used to create a string named n2?

a.

numbers = ["8", "17", "54", "22", "35"]
n2 = "".join(numbers)

b.

numbers = "817542235"
n2 = numbers.replace("2", "")

c.

n2 = "817542235"

d.

numbers = [8, 17, 54, 22, 35]
n2 = "".join(numbers)

Given the following code, what would display?
car = "PORSCHE"
color = "red"
my_car2 = car.join(color)

print(my_car)

a.

redPORSCHE

b.

rPORSCHEePORSCHEd

c.

PredOredRredSredCredHredE

d.

PORSCHEred

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

1)  a.  true if the string contains only digits
2)  d
3)  b.  rPORSCHEePORSCHEd
Add a comment
Know the answer?
Add Answer to:
The isdigit() method of a string returns a. true if the string contains only digits b....
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
  • PYTHON Define a function named sum_products(...) which receives a string containing only digits (and the string...

    PYTHON Define a function named sum_products(...) which receives a string containing only digits (and the string contains with at least two digits) , and returns a number, which is the sum resulting from adding the multiplication all the two contiguous digits. For example, sum_products("1234") will return the number 20 because 20 = (1*2 + 2*3 + 3*4)

  • C++ Write a function named “hasDescendingDigits” that accepts a string of numbers. It returns true if...

    C++ Write a function named “hasDescendingDigits” that accepts a string of numbers. It returns true if the string contains the digits in descending order. The function can ignore (e.g. skip checking) all the characters that are not digits in the string. Empty string will return false. For example, string of “95421” or “862” or “8622” or “88” or “9” will return true and string of “95423” or “889” or “9445” or “449” or “” will return false.

  • Python Language Problems 1. isdigit() A. Returns True if this string is just a digit. B....

    Python Language Problems 1. isdigit() A. Returns True if this string is just a digit. B. Returns True if this string contains only number characters. C. Return True if this string has at least one number character. D. is not a valid function. 2. Pick the most accurate interpretation for the if construct: if letter in words: print("Got it") A. If the character letter existed in the string words, it prints "Got it". B. It traverse through the string words,...

  • Define a function ValidRoom() that passes in a string parameter and returns true if the string...

    Define a function ValidRoom() that passes in a string parameter and returns true if the string parameter obeys all rules for a building's room address, else returns false. The rules are: (1) Must be two or three characters long. (2) First two characters must be digits, (3) If third character exists, must be a letter (upper or lowercase). Examples of strings yielding true: "65", "00", "21L". Examples of strings yielding false: "356", "7", "A23", " 65", "45AB". Recall some available...

  • Write a method in java named isValidEmail that takes a string as input parameter, and returns...

    Write a method in java named isValidEmail that takes a string as input parameter, and returns true if that string represents a valid email address, or false otherwise. An email address is considered valid if it follows this format “user123@domain.ext”, where:  user123 represents a sequence of word characters (i.e., letters, digits, or underscore) whose length is between 1 and 10 (inclusive), but the first character must be a letter  domain represents a sequence of alphanumeric characters (i.e., letters...

  • Intro to Programming and Logic (chapter 5): Python 2 - Conditionals and Recursion: Write a program...

    Intro to Programming and Logic (chapter 5): Python 2 - Conditionals and Recursion: Write a program that will simulate a roulette wheel. The pockets on a roulette wheel are different colors. There are 36 pockets – numbered 0 to 35. Pocket 0 and 18 are green. For pockets 1 – 8, the even numbers are black and the odd numbers are red. For pockets 9 – 17, the even numbers are red and the odd numbers are black. For pockets...

  • 5. (8 pts) An n-bit string is a string of n digits consisting of only O's...

    5. (8 pts) An n-bit string is a string of n digits consisting of only O's and 1's. a. How many 16-bit strings contain exactly seven 1's? b. How many 16-bit strings contain at least thirteen 1's? How many 16-bit strings contain at least one 1? d. How many 16-bit strings contain at most one 1? C.

  • 1.1. Write a function named "areFirstTwoTheSame AsLast TwoChars" that accepts a string. It returns true if...

    1.1. Write a function named "areFirstTwoTheSame AsLast TwoChars" that accepts a string. It returns true if the first two characters and the last two characters of the string are the same. It returns false otherwise. In addition, if the string is empty or has only one character, it also returns false. For example, these are the strings with their expected return values false falsc "AB" true "ABA" false "ABAB" trus "ABBA" false "ABCABC false "ABCCAB" true 1.2 Write a function...

  • A phone number is an ordered string of ten digits. Each digit is one of 0,...

    A phone number is an ordered string of ten digits. Each digit is one of 0, 1, 2, 3, 4, 5, 6, 7, 8, or 9. (a) How many phone numbers are there that do not contain any zeros? (b) How many phone numbers are there that start with 216 or 440? (c) How many phone numbers are there that start or end with 3? (d) What is the smallest number of phone numbers that guarantee at least nine of...

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