Monday, November 25, 2019

write a program to search the vowel in the given string in python

# -*- coding: utf-8 -*-
"""
Created on Tue Nov 26 07:16:18 2019

@author: anil durgam
program:
    write a program to search the vowel in the given string
   
"""
vowels=['a','e','i','o','u']
word=input("enter the some word to search for vowels\n")
found=[]
for letter in word:
    if letter in vowels:
        if letter not in found:
            found.append(letter)
print(found)
print("the number of different vowels present in",word,"is:",len(found) )


output:

enter the some word to search for vowels
anildurgam
['a', 'i', 'u']
the number of different vowels present in anildurgam is: 3


slice operator in python

# -*- coding: utf-8 -*-
"""
Created on Tue Nov 26 06:53:23 2019

@author: anil
Topic:slice operator

"""
a='0123456789'
#a[begin index:end index:direction]
#begin index start from zero
#end index goes upto length of the string.in my case it is ten
#the last parameter indicates the direction if that is '+' its mean positive direction
#if that is '-' then negative direction and also step to increse
print(a[0:11:1])
#in end index forward direction then it should be '-1' need to delete
print(a[0:11:2])
print(a[0:11:3])
print(a[0:11:4])
print(a[0:11:5])
print(a[0:11:6])
print(a[0:11:7])
print(a[0:11:8])
print(a[0:11:9])

#begin index from different values
print()
print("slice operator begin value from different indexes")
print(a[1:11:2])
print(a[1:11:3])
print(a[1:11:4])

output:
0123456789
02468
0369
048
05
06
07
08
09

slice operator begin value from different indexes
13579
147
159


Happy face symbol using arcade game library in python

# -*- coding: utf-8 -*-
"""
Drawing an example happy face

If Python and Arcade are installed, this example can be run from the command line with:
python -m arcade.examples.happy_face
"""

import arcade

# Set constants for the screen size
SCREEN_WIDTH = 600
SCREEN_HEIGHT = 600
SCREEN_TITLE = "Happy Face Example"

# Open the window. Set the window title and dimensions
arcade.open_window(SCREEN_WIDTH, SCREEN_HEIGHT, SCREEN_TITLE)

# Set the background color
arcade.set_background_color(arcade.color.WHITE)

# Clear screen and start render process
arcade.start_render()

# --- Drawing Commands Will Go Here ---

# Draw the face
x = 300
y = 300
radius = 200
arcade.draw_circle_filled(x, y, radius, arcade.color.YELLOW)

# Draw the right eye
x = 370
y = 350
radius = 20
arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)

# Draw the left eye
x = 230
y = 350
radius = 20
arcade.draw_circle_filled(x, y, radius, arcade.color.BLACK)

# Draw the smile
x = 300
y = 280
width = 120
height = 100
start_angle = 190
end_angle = 350
arcade.draw_arc_outline(x, y, width, height, arcade.color.BLACK,
                        start_angle, end_angle, 10)

# Finish drawing and display the result
arcade.finish_render()

# Keep the window open until the user hits the 'close' button
arcade.run()

python class topic video