the babylonian method consists in guessing the closest value to the square root of one number and use it to get closer to the real root.
reference: http:/
my code github: https:/
the babylonian method consists in guessing the closest value to the square root of one number and use it to get closer to the real root.
reference: http:/
my code github: https:/
Comments Off on WSQ13 – Babylonian method
Posted in Blogs, Syndicated, TC1014 Blogs
partial 2 revised.
github repository:
the while loop will go on until the condition to break it is met and can run undefinedly.
to use it write while and the condition>
while x < 50:
do something
reference:
Comments Off on Mastery19 – While loop
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #awesome, #Mastery19, #TC1014
nesting is when you put conditionals inside other ones to check another condition.
if something:
thing1
if something2:
this
else:
that
there is an if and else conditionals inside the initial if.
reference:
http:/
Comments Off on Mastery18 – Nesting of conditional statements
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #awesome, #mastery18, #TC1014
the elif conditional es a combination of the else and if conditionals, it needs a to fulfill a conition like the if conditional but it will be ignored if the condition above is fulfilled like an else conditional.
if we had this conditionals:
if x != 0:
print(“it’s not a 0”)
if x > 0:
print(“more than 0”)
if x < 100:
print(“less than 100”)
and we used 50 as x, the program will print everything since 50 meets each condition but if we change any of the if conditionals after the first to elif the program would ignore them since the first will be true. elif is to stick two statements as one.
Comments Off on Mastery17 – Conditional elif
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #awesome, #Mastery17, #TC1014
the else conditional goes after an if conditional, when none of the conditionals above is fulfilled then the else conditon is used. for example:
x = 5
if x < 5:
if x > 5:
else:
print (“it’s a 5”)
the rpogram wil ignore the other conditionals since 5 is not lower or higher than 5 and will use the else.
Comments Off on Mastery16 – Conditional else
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #awesome, #Mastery16, #TC1014
the conditional if es used whe you want something to happen only when a a certain condition is met. like comparing two variables and if they are equal the the program will follow the contition.
x = input()
y = input()
if x == y:
print (“it is the same”)
Comments Off on Mastery15 – Conditional If
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #awesome, #Mastery15, #TC1014
creating a module is no different from a normal program, create a python file and create a few functions in it.
file name: mymodule.py
def function1():
print (“function 1”)
# end of the module.
and in another program import it an call the function:
import mymodule.py
mymodule.function1()
reference:
http:/
Comments Off on Mastery14 – Creating a python module
Posted in Blogs, Syndicated, TC1014 Blogs
to import modules write import and the name of the module you want.
import random
and now you can use the functions of that module.
here is a list of modules in python:
Comments Off on Mastery13 – Importing and using python modules
Posted in Blogs, Syndicated, TC1014 Blogs
Tagged #awesome, #mastery13, #TC1014