[&]
3.137.186.4
workshop: #lesson-2.html
AD
mod1
py
app-1-1.py
app-1-2.py
# Chapter: 1.1 # Subject: Printing # Time: 2 minutes # Go! print("F*** the World") print(' /|') print(' / |') print(' / |') print(' /___|') print("My name is Grzegorz") print("My age is 30") print("I like Lemonade") print("I hate Garlic")
# Chapter: 1.2 # Subject: Variables # Time: 3 minutes # Go! name = "Grzegorz" # String age = "30" # String (but a Number) like = "Lemonade" # String hate = "Garlic" # String print("My name is "+name) print("My age is "+age) print("I like "+like) print("I hate "+hate)
# Chapter: 1.3 # Subject: Data types # Time: 5 minutes # Go! table = ''' Operation Meaning < strictly less than <= less than or equal > strictly greater than >= greater than or equal == equal != not equal is object identity is not negated object identity''' print(table)
# Chapter: 1.4 # Subject: Variables & Types of Values # Time: 6 minutes # Go! name = "Grzegorz" # String age = 30 # String (but a Number) isMale = True # String but a Boolean) like = "Lemonade" # String hate = "Garlic" # String print("My name is "+name) print(type(name)) print("My age is "+age) print(type(age)) print('I\'am a male '+isMale) print("\nI like "+like) print("I hate "+hate)
# Chapter: 1.5 # Subject: build in functions # Time: 2 minutes # Go! name = "Grzegorz" # String age = 30 # Number isMale = True # Boolean like = "Lemonade" # String hate = "Garlic" # String print("My name is "+name.upper()) print(" "+str(type(name))) print("My age is "+str(age)) print(" "+str(type(age))) print("I'am a male "+str(isMale)) print(" "+str(type(isMale))) print("\nI like "+like+" as much as "+str(len(like))+" between 0-10") print("I hate "+hate+" with length of ") print(len(hate))
# Chapter: 1.6 # Subject: arrays # Time: 6 minutes # Go! name = "Grzegorz" # String age = 30 # Number isMale = True # Boolean like = "Lemonade" # String hate = "Garlic" # String print("My name is "+str(name.index("z"))) print("My age is "+str(age)) print("I'am a "+str(isMale)+" male") print("\nI like "+like[0].lower()+like.replace(like[0],"")) print("I hate "+hate[0])
# Chapter: 1.7 # Subject: numbers # Time: 6 minutes # Go! from math import * name = "Grzegorz" # String now = "2020" # String age = 1987 # Number weight = 96.5 # Number (decimal) isMale = True # Boolean like = "Microsoft" # String strength = -10 # Number (negative) hate = like # String print("My name is "+name) print("My weight is "+str(weight)+" at age "+str(int(now)-age)) print("Simple weight: "+str(round(weight))) # lib IMPORT needed print("True weight: "+str(ceil(weight))) print("Fake weight: "+str(floor(weight))) print("\nI like "+(like[0].lower()+like.replace(like[0],""))+" with strengt of "+str(strength)) print("I hate "+hate+" with strengt of "+str(abs(strength)))