print ("5)Exit")
print ("-----------------")
option = 0
while opti < 5:
opti = int(input("Enter an option: ")
if opti == 1
print ("You selected the option to add")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 + v2
print ("The result is:", total)
if opti == 2:
print ("You selected the option to subtract")
v1 =int(input("Enter the first value: "))
v2 =int(input("Enter the second value: "))
total = v1 - v2
print ("The result is:", total)
if opti == 3:
print ("You selected the multiply option")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 * v2
print ("The result is:", total)
if opti == 4:
print ("You selected the option to divide")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 / v2
print ("The result is:", total)
if opti == 5:
break
NUMBERS
# -*- coding: utf-8 -*-
content = ["1","3","5"]
content.insert(1, "2")
content.insert(3, "4")
print ("The numbers on the list are: ", content)
Greatest_least
# -*- coding: utf-8 -*-
content = []
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
addition = sum(content)
least = min(content)
greatest = max(content)
print ("The numbers on the list are: ", sorted (content))
print ("The sum of the numbers in the list is: ", addition)
print ("The least number on the list is: ", least)
print ("The greatest number on the list is: ", greatest)
CONTENT 1
# -*- coding: utf-8 -*-
content = []
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
num = int(input("Enter a number: "))
content.append (num)
print ("Press a key to continue.")
addition = sum(content)
least = min(content)
greatest = max(content)
print ("The numbers on the list are: ", sorted (content))
print ("The sum of the numbers in the list is: ", addition)
print ("The least number on the list is: ", least)
print ("The greatest number on the list is: ", greatest)
Activity # 6
Hexagon
import turtle
hexa=turtle.Turtle()
hexa.color("Blue")
hexa.pensize(5)
hexa.fillcolor("Green")
hexa.begin_fill()
for i in range (6):
hexa.forward(100)
hexa.right(60)
hexa.end_fill()
turtle.done()
Polygon
# -*- coding: utf-8 -*-)
import turtle
sides = int(input("Enter the number of sides: "))
border = int(input("Enter the thickness of borders (1 - 5): "))
fillcolor = int(input("Enter the fill color: "))
bordercolor = int(input("Enter the border color: "))
angl = 360/sides
poly = turtle.Turtle()
poly.penup()
poly.goto(-50,-50)
poly.pendown()
poly.pensize(border)
poly.speed(1)
for i in range (sides):
poly.forward(100)
poly.left(angl)
turtle.done()
Sides
# -*- coding: utf-8 -*-)
side1 = int(input("Enter the value from side 1: "))
side2 = int(input("Enter the value from side 2: "))
side3 = int(input("Enter the value from side 3: "))
if side1 == side2 and side2 == side3:
print("Equilateral triangle")
elif side1 == side2 or side2 == side3 or side3 == side1:
print("Isoceles triangle")
else:
print("Sccalene triangle")
Guess
# -*- coding: utf-8 -*-)
import random
def countvowel(word):
vowel = 0
for i in word:
if i in "aeiouAEIOU":
vowel = vowel + 1
return vowel
content = ("Computers","Programming","Computing","Robotics","Technology")
word = random.choice(content)
letters = len(word)
letteri = word[0]
letterf = word[letters-1]
print ("Welcome, you must guess the word.")
print ("The word has", letters, "letters.")
print ("Has",countvowel(word),"vowels")
print ("Begins with the letter:",letteri)
print ("Ends with the letter:",letterf)
guess = input("Enter the word: ")
if guess == word:
print("Well done, you guessed!")
else:
print("Try again!")
vowel = vowel + 1
water
# -*- coding: utf-8 -*-
wstates = str(input("Enter the state of water: "))
if wstates == "solid":
print("The solid state water is found in the form of ice and snow in the high
mountains.")
elif wstates == "liquid":
print("Water in a liquid state is what we drink and we find it in rivers, seas, oceans and
lakes.")
Exit
# -*- coding: utf-8 -*-
while True:
answer = input("Enter the word exit to end the while loop.")
print (answer)
if answer == "exit":
print("While loop finished.")
Break
Operation
# -*- coding: utf-8 -*-
print ("**Choose an option**")
print ("-----------------")
print ("1)Add")
print ("2)Subtract")
print ("3)Multiply")
print ("4)Divide")
print ("5)Exit")
print ("-----------------")
opti = 0
while opti < 5:
opti = int(input("Enter an option: "))
if opti == 1:
print ("You selected the option to add")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 + v2
print ("The result is:", total)
if opti == 2:
print ("You selected the option to subtract")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 - v2
print ("The result is:", total)
if opti == 3:
print ("You selected multiply option")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 * v2
print ("The result is:", total)
if opti == 4:
print ("You selected the divide option")
v1 = int(input("Enter the first value: "))
v2 = int(input("Enter the second value: "))
total = v1 / v2
print ("The result is:", total)
if opti == 5:
Break
Problema 3
# -*- coding: utf-8 -*-
number = int(input("Enter a number: "))
if number % 5 == 0:
print("The number is divisible by 5")
else:
print("The number is not divisible by 5")
Problema 4
# -*- coding: utf-8 -*-
tdc = 44
nda = int(input("Enter the number of classes attended: "))
per = (tdc - nda) / tdc * 100
print("Percentage of classes attended:", per)
if per <= 60:
print("The student is eligible to take the exams.")
else:
print("The student is not eligible to take the exams.")
Challenge3
# -*- coding: utf-8 -*-
name = input("Enter your name: ")
print("Hello", name)
birth = int(input("Enter your birth year: "))
age = 2024 - birth
print (name, "your age is:", age)
Challenge4
# -*- coding: utf-8 -*-
text = "Python Computing."
phrase = text.replace ("Computing","Programming")
print (phrase)
Challenge6
# -*- coding: utf-8 -*-
content = [1, 2, 3, 5, 8, 9, 12, 8, 9, 3]
print(sorted(content))
least = min(content)
greatest = max(content)
print ("Least number: ", least)
print ("Greatest number: ", greatest)
Challenge7
import turtle
turtle.fillcolor("Red")
turtle.begin_fill()
turtle.left(20)
for i in range(4):
turtle.forward(50)
turtle.left(90)
turtle.end_fill()
turtle.fillcolor("Green")
turtle.begin_fill()
turtle.left(30)
for i in range(4):
turtle.forward(50)
turtle.left(90)
turtle.end_fill()
Challenge9
# -*- coding: utf-8 -*-
print("**Unit converter**")
print("--Choose an option--")
print("-----------------")
print("1) Length")
print("2) Temperature")
print("3) Time")
print("4) Exit")
print("-----------------")
opti = 1
while opti < 4:
opti = int(input("Enter an option: "))
if opti == 1:
print("Convert from meter to centimeters")
meters = int(input("Enter the number of meters: "))
centi = meters * 100
print("The result is:", centi, "centimeters")
elif opti == 2:
print("Convert from Celsius to Fahrenheit degrees")
celsius = int(input("Enter the Celsius degrees: "))
fahren = (celsius * 1.8) + 32
print("The Fahrenheit degrees are:", fahren)
elif opti == 3:
print("Convert from minutes to seconds")
minu = int(input("Enter the minutes: "))
seconds = minu * 60
print("The result is:", seconds, "seconds")
elif opti == 4:
print ("Exit")
Break
Challenge10
# -*- coding: utf-8 -*-
user = input("Username: ")
password= int(input("Enter the password: "))
if user =="TBox" and password == 12345:
print("Welcome to the system")
else:
print("Try again")