Skip to main content

Posts

Showing posts from August, 2021

SoloLearn Python Core: celsius to fahrenheit converter code project answer

Code project answer of  SoloLearn mobile Application and project celsius to fahrenheit converter code from Python Core course. celsius = int(input()) def conv(c):      celsius = c f = 9/5 * celsius + 32 return f fahrenheit = conv(celsius) print(fahrenheit) In this code we just need to declare a variable, we can name it as 'f' and assign values of equation of Fahrenheit to Celsius convertor equation (9/5 * Celsius + 32), and return that variable f and print it. What is happening here is. In the first line we take one 'int' or 'whole number' as input and then we call the function 'conv' which returns converted value f. Then we simply take or copy that return variables data to our new variable called 'fahrenheit', and then we are going to print it.

SoloLearn Python Core: functions and modules quiz answer

 This is a quiz answer of module 4, Python Core course of SoloLearn mobile application. This is final quiz appear after module 4 functions and modules. 1. Fill in the blanks to define a function that takes two number as argument and returns smaller one. Ans. def min (x, y):      if x <= y:      return x else: return y 2. Rearrange the code to define a function that calculates the sum of all numbers from 0 to its argument. Ans . Def sum (x):      res = 0 for i in range (x): res += i return res 3. How would you refer to the randint function if it was imported like this?  from random import random as rnd_int. Ans . rnd_int 4. What is the highest number output by this code? def print_nums(x): for i in range(x): print(i) return print_nums(10) Ans. 0 5. What is the output of this code? def funct (x):      res = 0 for i in range(x):      res += i return res print (func(4)) Ans. 6

How to count walking steps accurately in smartphones

 In smart phone padometer or counting walking steps application is easily available on their platform specific app store i.e On android it is called playstore. Most of the time when we think about this walking exercise we choose to purchase specific wearable exercise gadgets. i.e Expensive smart watch or fitness belt. you might not  aware that we can track and trace physical activity on smartphone like android and apple also. In smartphone, same sensor named accelerometer and gyroscope utilized to accomplish this task. How to position smartphone to track and trace walking steps accurately: Smartphone position to count walking steps 1. Download application, mostly one of named "Padometer"or "StepCounter on your smartphone. 2. First manually count(counting without smartphone) max 100 steps walking distance for calibration. 3. Now turn on the application. 4. In most of the application go to settings and set the sensory sensitivity to nearest to 50% 5. Hold perfect tight you

Sololearn Python Core code project FizzBuzz answer

 FizzBuzz is a well known programming assignment, asked during interviews.The given code solves the FizzBuzz problem and uses the words "Solo" and "Learn" instead of "Fizz" and "Buzz". It takes an input n and outputs the numbers from 1 to n. For each multiple of 3, print "Solo" instead of the number. For each multiple of 5, prints "Learn" instead of the number. For numbers which are multiples of both 3 and 5, output "SoloLearn".  You need to change the code to skip the even numbers, so that the logic only applies to odd numbers in the range. Ans. for x in range(1, n , 2): if x % 3 == 0 and x % 5 == 0: print("SoloLearn") continue elif x % 3 == 0: print("Solo") continue elif x % 5 == 0: print("Learn") continue else: print(x)

Sololearn quiz answers for python Core: Control structure

 Sololearn mobile application quiz answers for Python Core programming of module control structure: 1. What is the output of this code? list = [1,1,2,3,5,8,13] print(list[list[4]]) Ans. 8 2. What does this code do? for i in  range(10):     if not i % 2 == 0:          print(i+1) Ans: Print all the even numbers between 2 and 10. 3. How many lines will this code print? While False:     print("Looping...") Ans. 0 4.Fill in the blank to print the first element of the list, if it contains even number of elements. Ans. list[1,2,3,4]          if len(list) % 2 == 0:               print(list[0]) 5. What does this code output? letters ['x','y','z'] letters.insert(1,'w') print(letters[2]) Ans. y 6. Fill in the blanks to iterate over the list using for loop and print its values. Ans. list = [1,2,3] for var in list:     print(var)