Computers and Technology

#Write a function called "num_changer" that accepts a string #of digits (0-9). You should make an integer from the digits #of the even indices and another number from the digits in #the odd indices. Return the sum of these two numbers. You #can assume the given string will have a length of at least #2 digits. # #For example, if the string was "123456", you would split #this into two integers, 135 and 246. Adding them would give #381. Or if the string was "13579", you would split this into #159 and 37, then add them to get 196. # #Hint: You can do this with loops, but it's easier to do #this with string slicing. Remember how we could pass a third #argument to range() that would tell range how many numbers #to skip? You can do something similar with string slices: if #you include second colon in a string slice, the number #that follows it lets you skip characters in the string. For #example: # # "Hello, world!"[1:9] -> This gives "ello, wo". # "Hello, world!"[1:9:2] -> This gives "el, w". Including :2 # in the string slice skips every other letter. # "Hello, world!" [::3] -> This gives "Hl r!". Leaving the # first two spots blank tells it to look at the entire # string, but putting :3 at the end says to only take # every third character (H, l, space, r, and !). # #Hint 2: Remember, Python is zero-indexed. That means the #first number in the string is at position 0, and so it goes #in the even list.

answer
Answers: 2

Other questions on the subject: Computers and Technology

image
Computers and Technology, 22.06.2019 18:30, emojigirl2824
Word vocabulary words: print, proofread, status line, graphics, font effects, left margin, justification, line spacing, copy/paste, data. review words: font point, bold, save, center, error. fill in the correct word for the definition and then transfer the letters to the appropriate spot by number. some numbers will be found multiple times. you will end up with a quotation about…… what else? 1 2 3 4 5 6 7 8 9 10 11 12 13 14 k 16 17 18 19 20 21 22 23 24 25 8 27 28 29 w 31 32 k 34 35 36 w h 39 40 41 42 8 44 45 46 47 48 49 50 51 52 53 54 55 .1. a software function that records keystrokes on a disk or drive so information can be 5 4 52 9 later retrieved. p n 2. to produce a paper copy of information. 10 7 12u n 3. a display that shows the location of the cursor, pages, etc. 45 46 18 27 36 20 42p4. pictures or images, located in clip art or other files. 6 24 44 28 34 49 555. any mis-stroke of a key. 47 41 48 2 10 n6. allows major changes to the font such as shadow, emboss, etc. 21 25 46 35 23 21 29 14 22 17 n7. a feature that centers lines of text horizontally. 49 53 46 9 51 p8. size of the font 31 16 22 b l 9. a feature that prints designated text darker than the rest to add emphasis. 32 3 . p10. to compare copy on a display screen or printout to the original 24 39 25 23 54 9 50 3 and correct errors. j un 11. a feature that allows text to be aligned at the left 11 12 7 21 16 49 40 46 34 2 and right margins. leftn 12. amount of blank space on the left side of the paper. 8 18 41 6 34 linen 13. number of blank lines between lines of text. 17 4 49 13 1914. any information inputted into the computer. 3 4 46 44 p /p15. feature that duplicates text from one location and places it in another.
Answers: 2
image
Computers and Technology, 23.06.2019 11:00, swelch2010
Describe three characteristics of at-risk drivers. a. b. c. describe three characteristics of safe drivers. a. b. c. describe three driver errors that could cause a collision. a. b. c. how will this information affect you as a driver now and in the future? (2-3 sentences)
Answers: 2
image
Computers and Technology, 24.06.2019 12:00, tipbri6380
An npn transistor is correctly biased and turned on if the a. base is negative. b. collector is negative. c. collector is positive with respect to the emitter and negative with respect to the base. d. collector is the most positive lead followed by the base.
Answers: 1
image
Computers and Technology, 24.06.2019 12:50, neptunesx
Write a new lc-3 trap subroutine (i. e. a subroutine that will be invoked via the trap instruction) that will receive a numeric digit entered at the keyboard (i. e. an ascii character), echo it to the screen, and return in r0 the corresponding numeric value: so if the user types the digit '7', the character '7' will appear on the screen, but the value returned in r0 will be b0000 0000 0000 0111 (#7) you may not use any trap calls in your code - you must implement the "polling" code that interrogates the keyboard status and data registers. ; getnum_tsr ; a subroutine for obtaining a numeric value ; given ascii numeric digit input to keyboard. ; the numeric digit is echoed to the console (e. g. '7' = b0000 0000 0011 0111), ; but the value returned in r0 is the actual numeric value ; corresponding to the digit (e. g. b0000 0000 0000 0111 =
Answers: 3
Do you know the correct answer?
#Write a function called "num_changer" that accepts a string #of digits (0-9). You should make an in...

Questions in other subjects:

Konu
Mathematics, 08.11.2019 23:31
Konu
Mathematics, 08.11.2019 23:31