Learning Python from C

Ascci numbers: ‘a’ => ord(‘a’)
Printf -> Print so %c => {:c} , end=””(not \n)
logic operators: || => or
&& => and
syntax: tab => 4 espacios

Print

Math

Loop:

for i in range(a,b): #Loop between a(include) to b(not include)#Ways to run a loop in an argvfrom sys import argv
for i in range(0, len(argv)): #if you want to print -> argv[i]
import sys
for i in sys.argv[1:]: #if you want to print -> i
from sys import argv
for i in argv[1:]: #Loop since argv(1) #if you want to print -> i

for i in range(a:b):

Import:

import sys
from calculator_1 import add, mul, sub, div
from calculator_1 import *

Main:

# stuff to run always here such as class/def
def main():
pass
# stuff only to run when not called via 'import' here
if __name__ == “__main__”:

Command Line Arguments

import sysprint(sys.argv)
argc = len(sys.argv) -1

Error Output Redirection

sys.stderr.write(‘warning, etc\n’)
script -> sys.exit().

--

--

--

Software engineer in progress

Love podcasts or audiobooks? Learn on the go with our new app.

Recommended from Medium

IT Leadership, COVID is the catalyst to changing your business.

Learning Python to Play Magic the Gathering

Frontend Dev Blog: Day 1

Querying Cloudfront web logs using AWS Athena and Serverless

Alberta Health Services & Ontario Digital Service Shared Self-Assessment Tool

Rails Project Build Part 1

Powering Your E-Commerce Application with Image Classification

From Hex to Color and Back in SwiftUI

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Katherine Soto

Katherine Soto

Software engineer in progress

More from Medium

Beginners friendly Python basics

Install Python3 From SourceCode in Ubuntu20.0.4

Understand Nested Loops with Examples

Python Iterator and Generator Internals