Header Ads

Python programming basic course

 Python programming basic course 

Many Free Stuffs At last 

  1. Variables and Data Types:

    • Variables are used to store data values. Python has various data types including integers, floats, strings, lists, tuples, dictionaries, etc.
    • Example:
      python
      # Variable assignment x = 5 y = "Hello" z = [1, 2, 3] # Printing variables print(x) # Output: 5 print(y) # Output: Hello print(z) # Output: [1, 2, 3]
  2. Control Flow:

    • Control flow statements like if-elif-else and loops (for, while) are used to control the execution of code.
    • Example:
      python
      # If-else statement age = 18 if age >= 18: print("You are an adult") else: print("You are a minor") # For loop fruits = ["apple", "banana", "cherry"] for fruit in fruits: print(fruit) # While loop i = 0 while i < 5: print(i) i += 1
  3. Functions:

    • Functions are reusable blocks of code that perform a specific task. They can take parameters and return values.
    • Example:
      python
      # Function definition def greet(name): return "Hello, " + name # Function call print(greet("Alice")) # Output: Hello, Alice
  4. Lists:

    • Lists are ordered collections of items, which can be of different data types. They are mutable, meaning their elements can be changed.
    • Example:
      python
      # List creation numbers = [1, 2, 3, 4, 5] # Accessing elements print(numbers[0]) # Output: 1 # Modifying elements numbers[0] = 10 print(numbers) # Output: [10, 2, 3, 4, 5]
  5. Dictionaries:

    • Dictionaries are unordered collections of key-value pairs. They are mutable and can store different data types.
    • Example:
      python
      # Dictionary creation person = {"name": "John", "age": 30, "city": "New York"} # Accessing values print(person["name"]) # Output: John # Modifying values person["age"] = 35 print(person) # Output: {'name': 'John', 'age': 35, 'city': 'New York'} 
  1. Sum of Numbers in a List:
    • This program calculates the sum of numbers in a given list.
python
numbers = [10, 20, 30, 40, 50] total = sum(numbers) print("Sum of numbers:", total)
  1. Factorial of a Number:
    • This program calculates the factorial of a given number using recursion.
python
def factorial(n): if n == 0: return 1 else: return n * factorial(n - 1) num = 5 print("Factorial of", num, "is:", factorial(num))
  1. Palindrome Check:
    • This program checks if a given string is a palindrome or not.
python
def is_palindrome(s): return s == s[::-1] string = "radar" if is_palindrome(string): print(string, "is a palindrome") else: print(string, "is not a palindrome")
  1. Fibonacci Series:
    • This program generates the Fibonacci series up to a specified number of terms.
python
def fibonacci(n): fib_series = [0, 1] for i in range(2, n): next_term = fib_series[-1] + fib_series[-2] fib_series.append(next_term) return fib_series terms = 10 print("Fibonacci series up to", terms, "terms:", fibonacci(terms))
  1. Prime Number Check:
    • This program checks if a given number is prime or not.
python
def is_prime(n): if n <= 1: return False elif n <= 3: return True elif n % 2 == 0 or n % 3 == 0: return False i = 5 while i * i <= n: if n % i == 0 or n % (i + 2) == 0: return False i += 6 return True num = 17 if is_prime(num): print(num, "is a prime number") else: print(num, "is not a prime number"

Free sources very imp : click this
Free STuff 2 : "How to Hunt"
most serched keywords regarding basics python
  1. Python basics
  2. Python beginner course
  3. Python tutorial for beginners
  4. Learn Python from scratch
  5. Python fundamentals
  6. Introduction to Python
  7. Python programming basics
  8. Python crash course
  9. Python for beginners
  10. Python programming for beginners
  11. Python basics tutorial
  12. Python basics for dummies
  13. Python basics pdf
  14. Python basics cheat sheet
  15. Python basics with examples
  16. Python basics syntax
  17. Python basics variables
  18. Python basics functions
  19. Python basics loops
  20. Python basics conditional statements
  21. Python basics data types
  22. Python basics strings
  23. Python basics lists
  24. Python basics tuples
  25. Python basics dictionaries
  26. Python basics sets
  27. Python basics operators
  28. Python basics input/output
  29. Python basics file handling
  30. Python basics error handling
  31. Python basics debugging
  32. Python basics IDE
  33. Python basics code examples
  34. Python basics practice exercises
  35. Python basics quizzes
  36. Python basics challenges
  37. Python basics projects
  38. Python basics online course
  39. Python basics video tutorial
  40. Python basics free course
  41. Python basics paid course
  42. Python basics certification
  43. Python basics syllabus
  44. Python basics curriculum
  45. Python basics study guide
  46. Python basics learning path
  47. Python basics study material
  48. Python basics resources
  49. Python basics books
  50. Python basics websites
  51. Python basics forum

No comments

Powered by Blogger.