Skip Navigation
InitialsDiceBearhttps://github.com/dicebear/dicebearhttps://creativecommons.org/publicdomain/zero/1.0/„Initials” (https://github.com/dicebear/dicebear) by „DiceBear”, licensed under „CC0 1.0” (https://creativecommons.org/publicdomain/zero/1.0/)BC
  • Another program I coded in high-school to draw a triangle.

    Triangle=turtle.Turtle#Making the turtle easily callable. Side_1=float(input("How many pixels should the 1st side of the triangle be?"))#Asking the user the length of the 1st side of the triangle. Side_2=float(input("How many pixels should the 2nd side of the triangle be?"))#Asking the user the length of the 2nd side of the triangle. Side_3=float(input("How many pixels should the 3rd side of the triangle be?"))#Asking the user the length of the 3rd side of the triangle. Angle_1=float(input("How many degrees should the 1st angle be?"))#Asking the user the measure of the 1st angle of the triangle. Angle_2=float(input("How many degrees should the 1st angle be?"))#Asking the user the measure of the 2nd angle of the triangle. Angle_3=float(input("How many degrees should the 1st angle be?"))#Asking the user the measure of the 3rd angle of the triangle. if Angle_1+Angle_2+Angle_3!= 180:#If the angles of the triangle do not add up to 180 degrees. print("The angles of a traingle must add up to 180 degrees.") elif (Side_1>Side_2 and Angle_1<Angle_2) or (Side_2>Side_1 and Angle_2>Angle_1) or (Side_3>Side_2 and Angle_3>Angle_2) or (Side_3<Side_2 and Angle_3<Angle_2) or (Side_3>Side_1 and Angle_3>Angle_1):#If both the side and its opposing angle are larger than another side and its respective opposive angle. print("If an angle is greater than another angle, then the side opposing the 2nd angle should be greater than the side opposing the 1st angle.")#Printing an appropriate message. else:#If everything works fine. pass#The rest fo the code happens. class Side(Triangle):#Drawing a side. def init(self,Side,Angle):#Making the attributes easily callable. self.Side=Side#The side of the triangle. self.Angle=Angle#The angle of the triangle. def Draw(self):#Drawing a side. Triangle.forward(self.Side)#Drawing the side. Triangle.left(self.Angle)#Turning the pen. Sides=[Side_1,Side_2,Side_3]#The sides of the triangle. Angles=[Angle_1,Angle_2,Angle_3]#The angles of the triangle. for Side_number in range(0,2):#This loop will run until all 3 sides have been drawn. Side=Side(Sides[Side_number],Angles[Side_number])#Creating an object for the sides and angles. Side.Draw#Drawing the sides.

    0
  • A code I did in high school.

    import java.util.Scanner;//importing the Scanner.

    public class Letter{//Starting the program.

    public static void Letter(){//Initialising the class.

    Scanner Letter=new Scanner(System.in);//So that the user can input the letter.

    System.out.println("Enter a letter.");//Asking the user for a letter.

    final char letter=Letter.next[].charAt(0);//Storing the user input.

    switch(letter){//Checkign for the letter that the user input.

    case 'A'://If the user had input A.

    case 'a'://If the user had input a.

    case 'E'://If the user had input E.

    case 'e'://If the user had input e.

    case 'I'://If the user had input I.

    case 'i'://If the user had input i.

    case 'O'://If the user had input O.

    case 'o'://If the user had input o.

    case 'U'://If the user had input U.

    case 'u'://If the user had input u.

    System.out.print(Letter+" is a vowel.");//Printing an appropriate message.

    case 'B'://If the user had input B.

    case 'b'://If the user had input b.

    case 'C'://If the user had input C.

    case 'c'://If the user had input c.

    case 'D'://If the user had input D.

    case 'd'://If the user had input d.

    case 'F'://If the user had input F.

    case 'f'://If the user had input f.

    case 'G'://If the user had input G.

    case 'g'://If the user had input g.

    case 'H'://If the user had input H.

    case 'h'://If the user had input h.

    case 'J'://If the user had input J.

    case 'j'://If the user had input j.

    case 'K'://If the user had input K.

    case 'k'://If the user had input k.

    case 'L'://If the user had input L.

    case 'l'://If the user had input l.

    case 'M'://If the user had input M.

    case 'm'://If the user had input m. case 'N'://If the user had input N.

    case 'n'://If the user had input n.

    case 'P'://If the user had input P.

    case 'p'://If the user had input p.

    case 'Q'://If the user had input Q.

    case 'q'://If the user had input q.

    case 'R'://If the user had input R.

    case 'r'://If the user had input r.

    case 'S'://If the user had input S.

    case 's'://If the user had input s.

    case 'T'://If the user had input T.

    case 't'://If the user had input t.

    case 'U'://If the user had input U.

    case 'u'://If the user had input u.

    case 'V'://If the user had input V.

    case 'v'://If the user had input v.

    case 'W'://If the user had input W.

    case 'w'://If the user had input w.

    case 'X'://If the user had input X.

    case 'x'://If the user had input x.

    case 'Y'://If the user had input Y.

    case 'y'://If the user had input y.

    case 'Z'://If the user had input Z.

    case 'z'://If the user had input z.

    System.out.println(Letter+" is a consonant.");//Printing an appropriate message.

    default://If anything else happens.

    System.out.print("Error.");//Printing an appropriate message.

    }//Closing the curly brackets.

    }//Closing the curly brackets.

    }//Closing the curly brackets.

    1
1 Active user