Showing posts with label Case Sensitivity. Show all posts
Showing posts with label Case Sensitivity. Show all posts

Thursday, June 7, 2018

What list operations are possible in Python 3.7?

I am using Python 3.7 on a Windows 10 machine.

You can define a list as shown.


ListMethods_0

You can reverse a list

ListMethods_1

Index of a list element. It is zero based.

ListMethods_2

You can add element to a list using append()


ListMethods_3.png

You can sort the list using sort()


ListMethods_4.png

You can find the argument limits of list index as shown here. List can have very large  number of elements indeed.



ListMethods_5.png

You can remove element from list


ListMethods_6.png

Beware of case sensitiveness.


Thursday, February 15, 2018

How to write a SWITCH statement in a UWP project?

SWITCH is a selection statement that selects a switch section among a number of switch sections based on a pattern match with the switch expression.


Switch.png

The default need not be the last case section, as it is evaluated last, no matter where it is found.
In the case constant (case sensitive).
  • constant is the value to test for, and it can be any of the following:
  • A bool literal, either true or false.
  • Any integral constant, such as an int, a long, or a byte. 
  • The name of a declared const variable.
  • An enumeration constant.
  • A char literal.
  • A string literal.
The following is a complete example in a UWP project called JSwitch:

In this example, the variable anim is set to 'bird'. It is case sensitive. Bird is not the same as bird. When the switch statement is run and it finds 'bird' in any of the case sections, it displays the corresponding case constant in the text box. Change 'anim' and run the app again, and the textbox displays the match.

The XAML page has just one TEXTBOX and a BUTTON. The button click runs the program MainPage.xaml.cs.

Here is the MainPage.xaml for the JSwitch project.


Here is the MainPage.xaml.cs code: