christiansoli.blogg.se

Uiuc physics 101 midterm
Uiuc physics 101 midterm







uiuc physics 101 midterm uiuc physics 101 midterm

Returns c's monogram probability (for English) """ if c is the space character (' ') or an alphabetic character, # check to ensure that c is a single character Result: 'An education is what remains after we forget everything we have learned.' > decipher('Hu lkbjhapvu pz doha ylthpuz hmaly dl mvynla lclyfaopun dl ohcl slhyulk.') Result: 'Caesar cipher? I prefer Caesar salad.' > decipher('Bzdrzq bhogdq? H oqdedq Bzdrzq rzkzc.') decipher should return, to the best of its ability, the original English string, which will be some rotation (possibly 0) of the input string s. Result: 'Bzdrzq bhogdq? H oqdedq Bzdrzq rzkzc.'Ģ.Write a function decipher(s) that takes as input an arbitrary string s that has already been enciphered by having its characters "rotated" by some amount (possibly 0). > encipher('Caesar cipher? I prefer Caesar salad.', 25) Once you think you have everything working, here are three more examples to try: Once you have rot(c, n), you can write a recursive encipher function. You can use the following test to determine if a character is between 'a' and 'z' in the alphabet: You can use the built-in functions ord and chr convert from single-character strings to integers and back: Non-alphabetic characters should be left unchanged: Lower-case letters should be "rotated" to lower-case letters: Upper-case letters should be "rotated" to upper-case letters, even if you need to wrap around. the projectilelaunched at _ degrees would have the same horizontaldisplacement as the projectile launched at 20degrees.Ī.0b.5c.10d.15e.20f.25g.30h.35i.40j.45k.50l.55m.60 n.65 o.70 p.75 q.80r.85s.90 t.none of these suitably fill thisblankġ.Write a function encipher(s, n) that takes as inputs an arbitrary string s and a non-negative integer n between 0 and 25, and that returns a new string in which the letters in s have been "rotated" by n characters forward in the alphabet, wrapping around as needed. the projectile launched at _ degreeswould have the greatest horizontal displacement. the projectile launched at _ degrees would remainin the air the longest. Several projectiles are launched from ground height withthe same launch speeds varying angles between 0 and 90 degrees withthe horizontal.









Uiuc physics 101 midterm