Showing posts with label a/l it. Show all posts
Showing posts with label a/l it. Show all posts

Wednesday, February 4, 2015

Use of colors in HTML

we can use RGB colors in web pages to make the page more colorful.
Syntax of RGB color code is rgb(rr,gg,bb)


As an example to show green color using RGB code we can write as following, rgb(0,255,0)


You can get RGB code of a color by using “Adobe Photoshop” or any image processing software. But in HTML we us corresponding hexadecimal value of a RGB color code.
Example : for red color 
  • RGB value = (255,0,0)
  • Hex value = #ff0000


But most web browsers support 17 main colors.
They are 
  1. Aqua
  2. Black
  3. Blue
  4. Fuchsia
  5. Gray
  6. Green
  7. Lime
  8. Maroon
  9. Navy
  10. Olive
  11. Orange
  12. Purple
  13. Red
  14. Sliver
  15. Teal
  16. White
  17. Yellow
we can use them without hex value.
We can use following HTML code 
<HTML>
<HEAD>
<TITLE>Colors</TITLE>
</HEAD>
<BODY>
<H1><FONT color=”red”>This is in red color</FONT></H1>
<H2><FONT color=#0000FF >This is in green</FONT></H2>
<P><FONT color=”blue”>This is some text</FONT></P>
</BODY>
</HTML>



The output will be,

How to use background colors.


<HTML>
<HEAD>
<TITLE>Colors</TITLE>
</HEAD>
<BODY BGCOLOR=”orange”>
<H1><FONT color=”red”>This is in red color</FONT></H1>
<H2><FONT color=#0000FF >This is in green</FONT></H2>
<P><FONT color=”blue”>This is some text</FONT></P>
</BODY>
</HTML>


output,


Fonts in HTML

Use of different font styles


We can change font style using “font” tag
General syntax of a font tag
<FONT size=value color=colour face=font types></FONT>
We can use many font types by using commas.
Example:
<FONT face=Courier New,Times New Roman> This is Some text</FONT>
Here if first font is not available then browser show the text using second font.


How to change font size
General Syntax : <FONT size=value ></FONT>
Can change according to 2 methods.
1.use of numbers
We can use numbers from 1 to 7
1 for smallest 7 for largest and 3 for normal size
Then 1 and 2 are smallest size,3 is normal size and 4 to 7 are large size.
2.Use of relative values
Use +1 to +6 for increasing values and -1 to -6 for decreasing values

Example,
<FONT size=2 >This is font size 2</FONT>
<FONT size=7 >This is font size 7 (larger)</FONT>
<FONT size=+3 >This is relative font size +3</FONT>


Complete code,
<HTML>
<HEAD>
<TITLE>Fonts</TITLE>
</HEAD>
<BODY >
<P><FONT face=Courier New,Times New Roman > This is Some text</FONT><br/>
<FONT face=Times New Roman,Courier New,Georgia size=5> This is Some text</FONT><br/>
<FONT size=2 face=Courier New>This is font size 2</FONT><br/>
<FONT size=7 >This is font size 7 (larger)</FONT><br/>
<FONT size=+3 >This is relative font size +3</FONT><br/>
<FONT size=-1 >This is relative font size -1</FONT></P>
</BODY>
</HTML>



Output,


Friday, December 5, 2014

How to use heading tags in HTML

Use of headings 


We can use heading tag to indicate our text as a heading.
There are six type of headings.
<H1>Your Text</H1>
<H2>Your Text</H2>
<H3>Your Text</H3>
<H4>Your Text</H4>
<H5>Your Text</H5>
<H6>Your Text</H6>
Example:
<HTML>
<HEAD><TITLE>Headings</TITLE></HEAD>
<BODY>
<H1>First level heading</H1>
<H2>Second level heading</H2>
<H3>Third level heading</H3>
<H4>Fourth level heading</H4>
<H5>Fifth level heading</H5>
<H6>Sixth level heading</H6>
</BODY>
</HTML>
Save this as headings.html in mysite folder

Output will be,

We can align headings to center, left or right. To align ,
<H1 align=”Center”>First heading</H1>

This will align the text “First heading” to center screen of your web browser.

How to use text formatting in HTML

Formatting a text


For text formatting there are some special tags.


For bold a text


We can use <B>--</B> or <STRONG>--</STRONG>

Here <B> stands for “bold”
For italic a text


We can use <I>--</I> or <EM>--</EM> or <DFN>--</DFN>
Here <I> Stands for “italic”, <EM> stands for “emphasis” and <DFN> stands for “definition”


For superscript a text
We Can use <SUP>--</SUP> for super scripting.
<SUP> stands for “superscript”


For subscript a text


We Can use <SUB>--</SUB> for sub scripting.
<SUB> stands for “subscript”


For delete a text


We Can use <DEL>--</DEL> for delete a text with a single strike.
<DEL> stands for “delete”


For block quote a text



We Can use <BLOCKQUOTE>--</BLOCKQUOTE> for indent a text from left margin to right.

For highlight a text


We Can use <MARK>--</MARK> for highlight a text.


For underline a text


We Can use <U>--</U> for underline a text.
<U> stands for “underline”


To use addresses



We Can use <ADDRESS>--</ADDRESS>  

Example:
<HTML>
<HEAD><TITLE>Text Formatting</TITLE></HEAD>
<BODY>
<B>This is bold tag</B><BR>
<I>This is italic tag</I><BR>
<EM>This tag is also use to italic a text</EM><BR>
<DFN>Definition tag normally in italic </DFN><BR>
I'm the 1<SUP>st</SUP>
<P>Water is known as H<SUB>2</SUB>o.</P>
<P>This is my <DEL>first</DEL> HTML document</P>
<BLOCKQUOTE>This text is away from left margin</BLOCKQUOTE>
<MARK> I want to highlight this sentence</MARK><BR>

<U>IS this underlined.</U>
<P>contact us @<ADDRESS>Main Road,Red light district.</ADDRESS></p>
</BODY>
</HTML>



Save this as “text formatting.html”.
Open it through your web browser.
























Tuesday, November 18, 2014

Indentation

Indentation in Python

By default python uses 4 spaces per indentation level


Example:>>>def A1( ):

                     ____x=10

                     ____for i in range(1,10,1)

                     ________print i



Spacing and maximum length of a line is 79.


Do not mix Tabs and spaces.

Python Identifires

 Python Identifiers


Python identifier is a name used to identify a variable,function,class,module or other objects.

There are some rules/conventions about naming identifiers.

  • An identifier can start with the letter “A-Z” or “a-z”. 
  • An identifier can start with the “_”followed by any digit or letter. 
  • An identifier can start with the any letter followed by any digit. 
  • An identifier can’t start with a digit 
  • An identifier can’t use functional characters such as @,%,!

Note: Python is case sensitive language. So “name” and “Name” are 2 different identifiers.

Some conventions about naming identifiers.
  • Class names start with uppercase letters and all other identifiers with a lowercase letter     Ex: Student stu1=new Student( )                                                                                                             Shape s1=new Shape( )
  • Starting an identifier with single leading underscore indicate by convention that the identifier is need to be private                                                                                            Ex: _accountno
  • Starting an identifier with 2 leading underscores indicate a strongly private identifire Ex:_ _password      _ _pinnumber

Monday, November 17, 2014

Key Words in Python

Key Words in Python

Key words are the reserved words that use for specific command.
You can see those key words below.


and
del
form
not
with
as
elif
global
or
while
assert
else
if
pass
yield
break
except
import
print

class
exec
in
return

continue
finally
is
raise

def
for
lambda
try


As python is case sensitive language you should type those keywords in simple letters.
If you are using default settings in python GUI these key words are orange colored or purple colored.




Sunday, November 16, 2014

Introduction & Arithmetic Functions

Introduction to Python

Here we use version 2.7.6.
Let’s take a look at python GUI.



Use of arithmetic and logical expressions.

Order of mathematical operations.

  1. Parentheses : ( ) 
  2. Power : ** 
  3. Multiplication,Division : * , / 
  4. Addition , Substraction : + , - 
  5. XOR : ^ 

Let’s work with some arithmetic problems.
(you can type an expression in python gui then press enter for the result)


1).2+5     2).5/2     3).9/3    4).9.0/3    5).9.0/3.0     6).2**3+8


---------------------------------------------------------------------------------------------------------------


we can use mode function using “%” symbol.

7).5%3 ;(Gives remainder)


N.B. Check out above highlighted ones. They gives different answers.
         # is used to indicate comments in python.
         You do not need to type those comments.




How to calculate complex arithmetic.



example 1 : 20/7*2.0**/1.5


Steps:


First name the symbols according to their simplification order.
(Refer the order mentioned above)


20/7*2.0**3/1.5
                (3)              (3)                              (2)               (3)
  1. If you have same order number in many locations number them from left to right.
    20/7*2.0**3/1.5
                    (3)              (3)                              (2)              (3)
                     (1)              (2)                                                  (3)
  2. Then simplify according to step 1 or if you have to do step to do the calculation from left to right
    20/7*2.0**3/1.5
                    (3)              (3)                          (2)                    (3) highlighted one first
                      (1)              (2)                                                   (3)
    20/7*8.0/1.5
                   (3)               (3)                        (3) highlighted one first
                    (1)               (2)                         (3)
    2*8.0/1.5
                (3)                      (3) highlighted one first
                 (2)                       (3)
    16.0/1.5
                                    (3) highlighted one first
                                     (3)
    10.666666666666666 This is the answer


First try these problems with your mind. Then check out in python gui .


  1. 45/6*5-6 
  2. 5*4*(3+4)+6%4 
  3. 7.0*5+2**4*(8/5+5*(9%4)-3