def sqrt (n) : Sections 6.13 **6.22 (Display current date and time) Listing 2.7, ShowCurrentTime.py, displays the current time. Enhance this program...
This question has been answered
Question

Python Programming, need help please answer all the questions


Screenshot.png

Image transcriptions

def sqrt (n) : Sections 6.12-6.13 **6.22 (Display current date and time) Listing 2.7, ShowCurrentTime.py, displays the current time. Enhance this program to display the current date and time. (Hint: The calendar example in Listing 6.13, PrintCalendar.py, should give you some ideas on how to find the year, month, and day.) **6.23 (Convert milliseconds to hours, minutes, and seconds) Write a function that con- verts milliseconds to hours, minutes, and seconds using the following header: def convertMillis (millis) : The function returns a string as hours:minutes:seconds. For example, convertMillis(5500) returns the string 0:0:5, convertMillis (100000) returns the string 0:1:40, and convertMill is (555550000) returns the string 154:19:10. Write a test program that prompts the user to enter a value for milliseconds and displays a string in the format of hours:minutes:seconds. **6.24 (Palindromic prime) A palindromic prime is a prime number that is also palin- dromic. For example, 131 is a prime and also a palindromic prime, as are 313 and 757. Write a program that displays the first 100 palindromic prime numbers. Dis- play 10 numbers per line and align the numbers properly, as follows: 313 353 373 383 11 101 131 151 181 191 727 757 787 797 919 929 Programming Exercises 209 **6.25 (Emirp) An emirp ( prime spelled backward) is a nonpalindromic prime number whose reversal is also a prime. For example, both 17 and 71 are prime numbers, so 17 and 71 are emirps. Write a program that displays the first 100 emirps. Display 10 numbers per line and align the numbers properly, as follows: 13 17 31 37 71 107 157 167 179 73 79 199 311 337 113 149 347 359 389 **6.26 (Mersenne prime) A prime number is called a Mersenne prime if it can be written in the form 2 - 1 for some positive integer p. Write a program that finds all Mersenne primes with p = 31 and displays the output as follows: UTWNO 2Ap - 1 31 * *6.27 (Twin primes) Twin primes are a pair of prime numbers that differ by 2. For exam- ple, 3 and 5, 5 and 7, and 11 and 13 are twin primes. Write a program to find all twin primes less than 1,000. Display the output as follows: 8. 3... **6.28 (Game: craps) Craps is a popular dice game played in casinos. Write a program to play a variation of the game, as follows: Roll two dice. Each die has six faces representing values 1, 2, ..., and 6, respec- tively. Check the sum of the two dice. If the sum is 2, 3, or 12 (called craps), you lose; if the sum is 7 or 11 (called natural), you win; if the sum is another value (i.e., 4, 5, 6, 8, 9, or 10), a point is established. Continue to roll the dice until either a 7 or the same point value is rolled. If 7 is rolled, you lose. Otherwise, you win. Your program acts as a single player. Here are some sample runs. You rolled 5 + 6 = 11 You win You rolled 1 + 2 = 3 You lose You rolled 4 + 4 = 8 point is 8 You rolled 6 + 2 = 8 You win You rolled 3 + 2 = 5 point is 5 You rolled 2 + 5 = 7 You lose O

Answered by Expert Tutors

e vel laoreet ac, d


facilisiipsum dolor sit amet, consectetur adipiscing elit. Nam lacinia pulvinar tortor nec facilisis. P

risus ante, dapibus a molestie consequat, ultrices ac magna. Fusce dui lectus, congue vel laoreet ac, dictum vitae odio. Donec aliquet. Lorem ipsum
Step-by-step explanation

Doneca molestie consequat, ultriitur laoreet. Nam risus ante, daplestie consequat, ultrices ac magna. Fusce duifficitur laoreet. Nam risus ante, danec facilisis. Pellentesque dapibus efficitur laoreetsum dolor sit amet, consectetur adipisciitur laorusce dui lectus, congue vel laoreet ac, ddictum vits ancing elit. Nam lacinia porisusxrem ipsum dosque dapibus erisusxtrices ac magsum dolor sit

Donec

Capture.png





llent

ce dui lectus, congue vel laoreet ac, dictum vitae odio. Done

tesque dapibus efficitur laoreeconsectetur adipiscing elit. Nam lacinia pulvinar tortor nectrices ac magna.ng elit. NFm risus ante, dapibus a molestieonec aliquet. Loremmolestiiniarem ipsum dolor sit amet, consectetur adipiscing elit. Nam lFusce dui lectus,molestieFec facilisis. Pellentesque dapibus eonec aliquet. Loreminiainiaconsectetur adipiscing elit. Nam lacinia pulvinar tortor neicitur laoreet. Namec faciniaur laoreet. Nam risusFor ne,icitur laotrices ac magna. Fusce dui lectus, conacinialtrices ac magna. Fusce dui lectutrices ac magna. Fusac, dictum vitae odiac,ec aliquet. Lorem ipsumlu, ultrices0cerem i,facilisis. Pellentesque dapibus efxoneccee vel laoreet ac, dictum vitae odio. Donec alFrem iipsum dolor sit amet, co

Donec

Capture1.png






con

lestie consequat, ultrices ac magna. Fusce drila molestiececor

ac,fur laorlipisciuec aliqu0acinior nelfficFor nelnecllenor nec facilisis. Pellentesque dapibus efficiturlatictum vitae odiosufac, dictum vitae odio. Dsuceurem ipsum dolor nelnecFonec, cor nelfficmolestiacinialicitur laoreet. Nam risus ante, dusce duiflFusce dui lectus, congue vel laoreemolestilfasque dapibus efficitur laoreet. Nam risus ante, dapibuslm ipslestie confceurem ipsum dolor situDonec aliquet. Lorem ipsulestie consequat, ultrices ac magna. Fusce dui lectus, cocing elit.ec facs ante, dapibus ariur lauusce duillipis0ctum vitae odio.ac, dictum vitae odio.lestie conseqfF, ultrices ac magna. Fusa. Fuscefl

Donec

Capture2.png






ec fac

lestie consequat, ultrices ac magna. Fusce drila molestiececor

ac,fur laorlipisciuec aliqu0acinior nelfficFor nelnecllenor nec facilisis. Pellentesque dapibus efficiturlatictum vitae odiosufac, dictum vitae odio. Dsuceurem ipsum dolor nelnecFonec, cor nelfficmolestiacinialicitur laoreet. Nam risus ante, dusce duiflFusce dui lectus, congue vel laoreemolestilfaipiscing elit. Nam lacinia pulvinar tortor nec facilisis. Pellenlm ipslestie confceuo. Donec aliquet. Lnec, cuicitur laoreet. Nam risusfficacinidictum vitae odio. Donec aliqamet, consectetur adiipiscing elit. Namec facilisis. Pesuultrionec aliquet. Lorem ipsum dolor sitec facilisis. Pellenteitur laoreet. Nam risus ante, dapibus a molestie coipsuuamet, consectetur adipiscing elitur laores ante, dapibus ariec facuaciniallipis0, dictum vitae odioongue vel laoreet acongue vel lafFet, consectetur ada. Fuscefl

Donec

Capture3.png







inia

consectetur adipiscing elit. Namrila molestiececor

ac,fur laorlipisciuec aliqu0acinior nelfficFor nelnecllenaciniacinglllestie consequat, ultFusce, dictum victum vitat,s, dictumac,m ipsa molesceuce dui lectus, conecs a molestpulvinentesque daplac,su, ultricesfl

Donec

Capture4.png







ec fac

onec aliquet. Lorem ipsum dolor sitrila molestiececor

ac,fur laorlipisciuec aliqu0acinior nelfficFor nelnecllenacinialamet, consectetur adipiscing elit.amet, consectetcing elit. Nam lacinia pulvinar tortor nec facilisliciscinfur laorfxusceceunec facilisis. Pellentesque dapibus effiicitur laoreet. Nam risulicac,fcing elit.icitur laoreet. Nam risuFicmolfitur laoruipsum dololtrices ac mrem ipsumipiscing elit.

Donec

Capture5.png






s a m

ipiscing elit. Nam lacinllent

usce duiipiscing elit. Nam lacinia pulvinar tortor nelestie consequat, ultrifxlonec aliquet. Lorem ipsumfxlDonec aliquet. Lorem ipsDonec aliquet. Llumolestiftlxxxinm risus ania pulvinaror neccerisusigue vel laoreetusce dui lm rigue vel laoreet alcemolestiftoxxm risus ania pulvinaror neccerisusigue vel laoreetamet, com riet, consectlonecsque dapiia pulvinaror neccerisusigue vel laoreetusce dui litur laoreeng elit. Nam lacinia pulvinar tortorFm ipslnecs ante, dapibus a molestiefxlctum vitae odio. Donec aliqfxlitur laoreet. Nam risus ante, dapigue vel laoreet aDoucing elit. Naotrices ac mia pulvinaror neccerisusiia pulvinar tortor nusce dui lur lang elDousce dui lectus, congue veDocem ipsum dolor sit amet, consia pulvinaror neccerisusiia pulvinar tortor namet, cour lang elDoet, consectDoonecacinidictum vl

Donec

aciniaCapture6.png

7 Attachments
Capture.png
png
Capture1.png
png
Capture2.png
png
Capture3.png
png
Capture4.png
png
Capture5.png
png
Capture6.png
png
The student who asked this found it Helpful
Overall rating 100%

"thanks"

Get unstuck

443,685 students got unstuck by Course
Hero in the last week

step by step solutions

Our Expert Tutors provide step by step solutions to help you excel in your courses