MCC – Python fun

We have been learning python for last two weeks, we started with downloading python https://www.python.org/downloads/  and setup IDE pycharm https://www.jetbrains.com/pycharm/download/ . First we started with HelloWorld as always, Super easy

print("hello world!")

Then moved on to math operations

number1 = 100
number2 = 200

print(number1 + number2)

Learned order of operation

math = 20 + 30 - 5 * 4 - 3

# Multiplication, Divsion, Addition, Subtraction

# 5 * 4 = 20

# 20 + 30 - 20 - 3

# 20 + 30 = 50

# 50 - 20 - 3

# 30 - 3

# 27

print(math)

Played with String

math = 1
mathstring = "1"
mathstring1 = 'a'
mathstring2 = '''prajeeth,'''

print(math * 20)
print(mathstring * 20)
print(mathstring1 * 20)
print(mathstring2 * 20)


print( mathstring1 + mathstring2 )


mathstring3 = input("enter your name: ")
print("Hello ",mathstring3, "!")

message = "Hello %s !"

print(message % mathstring3)


score = 1000

message1 = "%s scored %s !"
print(message1 % (mathstring3,score))

Also learned about place holder

name = input("what is your name?")
age = input("what is your age?")
where = input("where do you live?")

output = "Hello %s you are %s years old and live in %s"

print( output % (name,age,where) )

Pretty fun !!!

We just started learning graphics with just opening a window

import turtle

turtle.color('red','yellow')

turtle.begin_fill()
turtle.forward(50)
turtle.circle(50)
turtle.end_fill()


turtle.done()

turtle is fun to learn, we will be doing lot more in coming weeks


Leave a comment