Skip to content
Menu
myCloud myCloud

Personal short notes about Cloud

  • XMPie
  • AWS
    • AWS Topics
    • AWS Architecture
    • AWS CLI
    • AWS Health
    • AWS Policies
    • AWS Cost
  • CHEAT SHEETS
myCloud myCloud

Personal short notes about Cloud

Python CS

By mikado on April 1, 2023April 1, 2023

PEP – Python Enhancement Proposals

https://www.python.org/dev/peps

  • create myscript.py and make it executable and include:

#!/usr/bin/env python3

List, Tuple, Set

  • List

[ ] or list()

turtles = ['michelangelo', 'raphael', 'leonardo', 'donatello']
turtles.append("mika")    # add record
turtles.pop(1)    # remove 2nd record

  • Tuple

( ) or tuple()

foods = ("pizza", "shakshuka", "raclette", "salad")
print(len(foods)) 
  • Set

{ } or set()

  • Dictionary

{ } or dict() with key pairs

turtles = {'michelangelo':'party dud', 'raphael':'cool but rude', 'leonardo':'leader', 'donatello':'geek'}

print(turtles['leonardo'])    # print specific value
del turtles['michelangelo']    # delete record
turtles["shredder"] = "mean dude"    # add record
print(turtles)

Misc.

type()    # get object type
  • get help
help()
help(print)
help(list)
help(int())
  • string
msg = "this is a string"
print(msg[3])    # will print the 4th character
print(msg[1:5])    # will print the range
print(msg.upper())    # to uppercase

if, elif

	age = input("enter your age: \n")
	if int(age) >= 50:
	    print("i am old!")
	elif int(age) >= 18:
		print("in between!")
	else:
        print("I am so young!")

while

	my_num = 1
	while my_num <= 10:
		print(my_num)
        my_num = my_num + 1

for

	foods = ["pizza", "shakshuka", "raclette", "salad"]
	for f in foods:
        print(f)

Category: Python

Categories

  • AWS (4)
  • AWS Architecture (8)
  • AWS CLI (5)
  • AWS Cost (3)
  • AWS Health (4)
  • AWS Policies (2)
  • AWS Topics (24)
  • CHEAT SHEETS (16)
  • Container (21)
  • Datadog (4)
  • Jenkins (2)
  • Linux (9)
  • Microsoft (7)
  • Python (1)
  • SCRIPTS (9)
  • Terraform (5)
  • XMPie (6)
©2025 myCloud
Click to Copy