Question
Explain in details of the following question and Do not use IDLE 1. # what does this function mean ? #what is %s %d %f
Explain in details of the following question and Do not use IDLE
1.
# what does this function mean ?
#what is "%s %d %f" % ? what does it do ? how it affects the (5,5,5)?
print ("%s %d %f" % (5, 5, 5))
2
n = 10000 count = 0 # what does count = 0 means ? while n: # what does while n: means ? count = count + 1 # what does it mean by count =count+1 ? how does it affect the result n = n // 10 # what n// 10 means ? what // means ? print (count)
3.
n = 10 while n != 1: print (n,) if n % 2 == 0: # n is even # what does % means ? what n % 2 == 0 means? n = n // 2 # what n // 2 means ? else: # n is odd n = n * 3 + 1
4.
mylist = ["now", "four", "is", "score", "the", "and seven", "time", "years", "for"] # why we have to use [] instead of () a=0 while a < 7: print (mylist[a],) # what does the "," in here means? what does it do to the function a += 2 # what does += means, what does a+=2 do to the function ?
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started