Python basic scripts examples.
Examples Questions:
-
- Hello World code use print function and show how to ignore special characters in python
-
- Join two strings code Using ‘+’ operator and format() to add 2 string
-
- Format floating point in the string code Use of String Formatting and String Interpolation
-
- Raise a number to a power code
-
- Working with Boolean types
-
- If else statement
-
- Using AND and OR operators
-
- Switch case statement
-
- While Loop
-
- For Loop code
-
- Run one Python script from another
-
- Use of a command-line argument
-
- Use of regex
-
- Use of getpass
-
- Use of date format
-
- Add and remove the item from a list
-
- List comprehension
- Basic syntax : new_list = [expression for item in iterable if condition] code
-
- Slice data
-
- Add and search data in the dictionary
-
- Add and search data in the set
-
- Count items in the list
-
- Define and call a function code
-
- Use of throw and catch exception
-
- Read and Write File
-
- List files in a directory
-
- Read and write using pickle
-
- Define class and method
-
- Use of range function
-
- Use of map function add
-
- Use of filter function
- LINUX HINT: Check this website. I practice all these examples from this post and try to solve them from my ideas.