Skip to content

infrared-o8/py_programs_for_practice_basic_1

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 

Repository files navigation


About this project :

this is a list of programs i coded myself for understanding python. it contains python fundamentals: for loops, while loops, lists, tuples, string traversing, built-in functions usage, pattern generators.

credits to my comp. science teacher for setting up the questions!

Overview:

Built-in Functions:

  • int(): Converts a string or a number to an integer.
  • float(): Converts a string or a number to a floating-point number.
  • str(): Converts an object to a string.
  • input(): Takes user input as a string.
  • print(): Prints the specified message to the console.

Control Flow Statements:

  • if, elif, else: Conditional statements for decision-making.
  • while: Executes a block of code repeatedly as long as a specified condition is true.
  • for: Iterates over a sequence (that is either a list, tuple, dictionary, string, or range).

Mathematical Functions:

  • math.pow() (imported from math module): Returns the value of x to the power of y.
  • math.pi (imported from math module): Mathematical constant representing the ratio of a circle's circumference to its diameter.

List Manipulation Functions:

  • list.append(): Appends an element to the end of the list.
  • list.pop(): Removes and returns the last item from the list.
  • list.remove(): Removes the first occurrence of a specified element from the list.
  • list.index(): Returns the index of the first occurrence of a specified value.

String Functions:

  • str.replace(): Replaces a specified phrase with another specified phrase.
  • str.isupper(), str.islower(), str.isspace(): Checks if all characters in a string are uppercase, lowercase, or whitespace.

Dictionary Functions:

  • dict.keys(): Returns a view of dictionary keys.
  • dict.values(): Returns a view of dictionary values.
  • dict.items(): Returns a view of dictionary items.

Statistics Functions (imported from statistics module):

  • statistics.median(): Computes the median of a sequence of numbers.

Control Flow Statements:

  • break: Terminates the loop statement and transfers execution to the statement immediately following the loop.

Miscellaneous:

  • chr(): Returns a string representing a character whose Unicode code point is the integer.
  • abs(): Returns the absolute value of a number.

Data Types:

  • int: Integer data type.
  • float: Floating-point data type.
  • str: String data type.
  • list: List data type.
  • tuple: Tuple data type.
  • dict: Dictionary data type.

About

a basics file for py. great for beginners.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages