Tag Archives: #i

#WSQ13

Here it is the babylonian method 

program: https://github.com/Julio1229898/Ken-Work/blob/master/babylo.py

‘mBack  

#mastery13 Importing and using Python modules

An example of this can be found on my WSQ06, here’s the part of the code where i imported a module:

import random imported the module random that in this case it produces a random intenger from a certain parameter 

value= random.randint(1,100) this line does is that the variable value will become a random integer (random.randint) from 1 to 100 (1,100)

print(value)

This program will show a random value from 1 to 100.

Another example is:

import math import the module math which has lots of functions that can be found here https://docs.python.org/2/library/math.html

pi=math.pi will take math.pi’s value which  is equivalent to 3.1416…

print (pi)

This program will show:

3.141592653589793

#TC1014 #WSQ05 Temperature

1 min read

Thanks to this WSQ i learned to apply an if function in python, i used this link to know the boiling point of water 🙂 http://chemistry.about.com/od/howthingswork/f/boiling-point-of-water.htm 

This link also helped me to know better about the if function and other stuff in python. http://anh.cs.luc.edu/python/hands-on/3.1/handsonHtml/io.html

Here’s my code. 

f=int(input(“Give me the temperature in Farenheit that you want to convert to Celsius: “))

c= 5*(f-32)/9

print(“The temperature in Celsius is: “, int(c)) ###i put the c in a parenthesis using an int so it gives the value without decimals

if c>=100: 

  print (“Water boils at this temperature”) ###note that you have to ident this line in order for this to work

else:

   print (“Water does not boil at this temperature”) ###note that u have to ident this line in order for this to work