codi
codi
print ("-----------------")
option = 0
while opti < 5:
if opti == 3:
print ("You selected the multiply option")
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: "))
break
NUMBERS
# -*- coding: utf-8 -*-
content = ["1","3","5"]
content.insert(1, "2")
content.insert(3, "4")
Greatest_least
# -*- coding: utf-8 -*-
content = []
content.append (num)
content.append (num)
print ("Press a key to continue.")
content.append (num)
content.append (num)
content.append (num)
addition = sum(content)
least = min(content)
greatest = max(content)
print ("The sum of the numbers in the list is: ", addition)
CONTENT 1
# -*- coding: utf-8 -*-
content = []
content.append (num)
content.append (num)
content.append (num)
content.append (num)
content.append (num)
content.append (num)
content.append (num)
content.append (num)
addition = sum(content)
least = min(content)
greatest = max(content)
print ("The sum of the numbers in the list is: ", addition)
Activity # 6
Hexagon
import turtle
hexa=turtle.Turtle()
hexa.color("Blue")
hexa.pensize(5)
hexa.fillcolor("Green")
hexa.begin_fill()
hexa.forward(100)
hexa.right(60)
hexa.end_fill()
turtle.done()
Polygon
import turtle
angl = 360/sides
poly = turtle.Turtle()
poly.penup()
poly.goto(-50,-50)
poly.pendown()
poly.pensize(border)
poly.speed(1)
poly.left(angl)
turtle.done()
Sides
print("Equilateral triangle")
print("Isoceles triangle")
else:
print("Sccalene triangle")
Guess
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 ("Has",countvowel(word),"vowels")
if guess == word:
else:
print("Try again!")
vowel = vowel + 1
water
if wstates == "solid":
print("The solid state water is found in the form of ice and snow in the high
mountains.")
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:
print (answer)
if answer == "exit":
Break
Operation
print ("-----------------")
print ("1)Add")
print ("2)Subtract")
print ("3)Multiply")
print ("4)Divide")
print ("5)Exit")
print ("-----------------")
opti = 0
if opti == 1:
total = v1 + v2
total = v1 - v2
if opti == 3:
total = v1 * v2
if opti == 4:
total = v1 / v2
if opti == 5:
Break
Problema 3
if number % 5 == 0:
else:
print("The number is not divisible by 5")
Problema 4
tdc = 44
else:
Challenge3
print("Hello", name)
Challenge4
print (phrase)
Challenge6
print(sorted(content))
least = min(content)
greatest = max(content)
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
if opti == 1:
elif opti == 2:
elif opti == 3:
seconds = minu * 60
print ("Exit")
Break
Challenge10
else:
print("Try again")