Posts

Showing posts from 2023

Python for beginners- Dictionary Operations

 Dictionary is one of the type of collections in python. It combines variety of data items under a common name. Syntax be like,  Name={               "Membername1":"Value",               "Membername2":"Value",                ........................................                   "Membernamen":"Value"              } An example is given below... Eg: Creating a dictionary named "sunglass"  sunglass = {                       "brand": "Suntrack"                       "model": "Wideangle"                       "Year " : "2023"                      } To print the...

How to add a value, remove a value and emptying a list???

 List has many operations to perform. The basic operations like creating a list, changing a value, displaying a list, searching an element in a list and finding length of a variable is explained in part 1. https://www.blogger.com/blog/post/edit/5251857942821229/7649420483850529537 In part 2, the remaining operations are listed below. Adding a value Removing a value Empty a list Usage of constructor  The operations are explained below.   =>Adding a value:                 This can be achieved by two ways. First one is adding a value in the end of the list. Second one  deals with adding in a specified index.     Method1:Adding a value in the end of the list:      colorlist=["Red", "Green", "Yellow" ]      colorlist.append( "Orange")      print(colorlist)     W hile executing this code, you get the following output.       [ 'Red', 'Green',...

How to create a list and its operations???

Python collections      Collection is a set of elements stored in a sequence. In python, there are 4 types of collections. They are List Tuple Set Dictionary In the above collections, list has variety of operations to do. Lists   List is a collection in python. It can store any type of data. It has variety of operations to perform like creating, displaying, access, add, delete, search and so on. 1.Creating a list  This is the way of creating a new list in python. Colorlist is the list name. Red,Green,Yellow are the values.  colorlist=[“Red”,”Green”,”Yellow”] print(colorlist)  When you execute this code, you get the following output. ['Red', 'Green' ,'Yellow'] 2.Access the list items   After creating the list, you can access the items. Here,it displays the data in first position. list is always starts from index 0. colorlist=[“Red”,”Green”,”Yellow”] print(colorlist[1]...

Python program for beginners - String operations.

Image
 String is a collection of characters. It is stored in sequence as an array. Normally a string in python is assigned a value by the following syntax. Syntax: String_Variable= " String value " Eg: a= " Best wishes" where, a is a variable that represents string. "Best wishes" is the value assigned to string. Next, a simple python program to display this string is given below. a="Best wishes" print(a) The Program and its output are like this. The operations on a string variable are listed here. Extracting a character or set of characters. Finding the total number of characters (Length) in a string Converting upper case to Lowercase and vice versa. Adding two strings Replacing characters Splitting the string into sub string White space removing The sample code is given as below. Extracting a character or set of characters.           a="Best Wishes"           print (a[5:11])                   ...

Python program to generate fibonacci series

Image
 Maths has some wonderful sequences of numbers. one among that is Fibonacci series. The logic behind Fibonacci series is very simple. It starts with two numbers 0,1 as the first and second elements. the next number is the sum of the previous two numbers. Likewise ,it goes on until it reaches the number of the elements in the series. In python, it has following steps. This Fibonacci series program starts with getting the number of elements for the series.  Next, it assigns the values to the first two numbers.  It checks the number of elements is less than zero. If yes means, the number is a negative value. So, it prints a message that enter a positive number. Else if the number of elements is equal to 1, it print the the first number alone. Else, it starts a loop. It prints the first value. It adds the previous two numbers and store it into third variable. It exchanges the value of  second variable to first variable and  the value of third variable to second vari...

Java Script program to display current date and time using HTML.

Image
 Date and time are the important factors for real time applications. JavaScript includes inbuilt class to get the date and time. date()  is the inbuilt class.  This inbuilt class has many functions listed below.  getDate() - it provides the date as number(1-31)  getMonth() - it displays the month as number getFullYear() - it gives the year in four digit number getDay() - it shows the day of the week in number(0-6) getHour() - it displays the hour information(0-23) getMinutes() - it gives the minutes details( 0-59) getSeconds() -it provides  the seconds details (0-59) getMilliseconds()  -it finds the milliseconds details and gives the information( 0-999) getTime() - it shows the time. these are the inbuilt functions available in date(). Next, create a file in notepad ,save it as "DateDisplay.html" . The program is given below. The <head> tag  is used to set the heading as "Display current date and time" wit h <h1> tag. where <he...

how to create About us and enquiry page using HTML coding???

Image
  when user wants to know about the author’s details and enquire about the recipes, the following codes are used. About us page: This page contains basic information about foodie website. The html code for about us page is given below. “Aboutus.html” <html> <head> <title> Foodie </title></head> <style> p { color: navy; text-indent: 30px; } </style> <body bgcolor="lightgreen"> <h1> Foodie </h1>      <p> Foodie is a great collection of mouth watering receipes. It has variety of receipes in different categories. South special,North Indian combo,Continental menus and Italy receipes </p> </body> </html> the about us page is like as follows Next,enquiry page code is given below.   Enquiry page             When someone wants to find some recipes or doubts in the recipes, this enqui...

how to create a simple,elegant food receipe website????

Image
  Food… Its one of the basic needs of our life. without food,we cant live. If you know cooking, then its fine. We design a food receipe website with following features. Here, a food receipe website. let us name it as “foodie”. It has Home page, about us,enquiry form and receipes page. Home page displays the title, logo and categories along with a welcome message. About us page displays the details of the website owning authority. Receipes page has many categories. They are divided into 4 types as follows… ·        South special ·        North Indian combo ·        Continental menus ·        Italy receipes At last, enquiry form is used to collect the user queries. Steps to follow: ·        Create a folder and name it as “foodie”. ·        Create a two logos. one for the top and another ...

How to create Login form using HTML?

Image
Login is mandatory for any websites nowadays. Here, a login form is designed to get the input from the user. The user has to enter the login id and password.   Html program to create a login form: Simply open an editor like notepad. create a new file and save it as "loginform.html". Type the below coding. <!DOCTYPE html>    <html>    <head>   <meta name=” Description" content="HTML programs"> < meta  name ="viewport"  content ="width=device-width, initial-scale=1.0" > <title> It’s Login page </title>   <style>    <!-- This block defines the style properties  --> Body {   <!-- This defines the font family and sets the background as cyan -->   font-family: Times New Roman, Arial, sans-serif;     background-color: cyan;   }   <!-- This block defines the properties for the button --> button {     ...

Java script – conditional statement

Java script has many conditional statements. It is used to check whether the given condition is true or false. It has following type. ·        If ·        If else ·        If else if Each one is explained as follows. 1.     If statement: This is a simple condition checking statement. It has a syntax to follow. Syntax: If (condition) { Code…. }   Example:   if( a>10)    {           document.writeln(“The number is greater than 10”);    } This example checks the given number is greater than 10. If the condition is true,it prints the number is greater than 10. Next, a simple example which checks the given number is greater than 10 or not is shown below. 2.     if   else: This type of conditional statement is used to check the condition. if the condition is tru...