Tag: Float

Python Functions

A function is a predefined block of code which is used then programming. It often contains a number of commands and steps.

Here are some of the functions we have met

print()

This function displays the string that is contained in it parenthesis ().

print(‘Hi there, how are you?)

input()

This function displays the string in its parenthesis but allows the user to enter a string that is then returned and assigned to a variable.

age=input(‘What is your age?’)

str()

Converts the contents of its parenthesis to a string

check=input(‘Is your age ‘+str(age))

len()

Outputs the length (number of characters) of a string or the size (number of elements) in an array

print(‘The length of your name is’,len(name))

float()

Converts a value to a floating point number

weight=float(input(‘How many KG do you weight’))

int()

Converts a value to an integer

age=int(input(‘What is your age?’))

 

Align and Float Images

These notes were prepared using this article.

  • When an image is aligned it is just moved on the page to the left, centre or right. This just effects the position of the image and not the reaction of the text surrounding it. The inline version is given below.
    • <div style=”text-align: center”><img src=”your-image.png” width=”100″ /></div>
  • When an image is floated it can either be on the right or the left of the page. The text is forced to wrap around it. The inline version is given below.
    • <img style=”float: right” src=”page1.gif” />

Using the box model it is possible to float other sections of the page, such as the <NAV> area.

You can find more information on CSS Floats, from the links on the page or here.