Coding Exercise for Beginners in Python with solution | Exercise 20 |Python for Beginners #lec59

preview_player
Показать описание
In this Lecture we have written a Program in Python to solve a coding exercise "Hurdle Race with variable heights" using while loop. In this we have used some in-built functions as well as user-defined functions and while loop

*********************************************

Connect & Contact Me:

*******************************************

More Playlists:

#coding #pythonforbeginners #python #jennyslectures #pythonprogramming #codingquestions
Рекомендации по теме
Комментарии
Автор

My version of jump() function
def jump():
turn_left()
move()
if(wall_on_right()):
if(wall_in_front):
turn_left()
break
else:
move()
else:
turn_right()
move()
turn_right()
move()

RKBOSS-
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal() :
if not wall_on_right():
turn_right()
move()
elif wall_in_front():
turn_left()
else:
move()





i have written that code and its working . and easy and more understandable. and i love jenny mam too.

RahulSingh-cwcn
Автор

how is it:
def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if not wall_on_right():
turn_right()
if wall_in_front():
turn_left()
if front_is_clear():
move()

white-hat
Автор

Osm explanation I never ever seen this type of teaching 👍😍

pgkgaming
Автор

Your enthusiasm for programming is contagious🌼😍✌. Thank you for sharing your passion with us!

MyCodingDiary
Автор

I am Mbbs Student idk why I felt need to study python 😂😂😂

UnknownUser-jppe
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
move()
elif front_is_clear():
move()
elif wall_in_front():
turn_left()

wantedlikkygaming
Автор

this with less lines you could write :)

def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
if front_is_clear():
move()
elif wall_in_front():
turn_left()
else:
move()

omarismail-qtos
Автор

def right() :
for i in range(3) :
turn_left()
def ch_move() :
if not wall_in_front() :
move()
while not wall_in_front() and wall_on_right() :
move()
while not at_goal() :
ch_move()
turn_left()
ch_move()
right()
move()
right()
ch_move()
turn_left()

dpcmvih
Автор

def turn_right():
turn_left()
turn_left()
turn_left()


def jump():
turn_left()
while wall_on_right():
move()
turn_right()
move()
turn_right()
while front_is_clear():
move()
turn_left()


while not at_goal():
if wall_in_front():
jump()
else:
move()

saisrinivaskarlapudi
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
while not(at_goal()):
if wall_in_front():
turn_left()
if front_is_clear():
move()
turn_right()

This is another way

midnightphantom
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
def jump():
turn_left()
if right_is_clear():
turn_right()
move()
if right_is_clear():
turn_right()
move()

while not at_goal():
if front_is_clear():
move()
if right_is_clear():
turn_right()
if wall_in_front():
jump()

nagasurepalli
Автор

def turn_right():
turn_left()
turn_left()
turn_left()



while not at_goal():
if front_is_clear():
move()
if right_is_clear():
turn_right()
else:
turn_left()

sarisivadas
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
move()
turn_right()
move()
if wall_in_front():
turn_left()
else:
move()

foodwithkalai
Автор

Hello ma'am you really most teaching I'm very happy

mantukumaryadav
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
def jump():
turn_left()
while not at_goal():
if not wall_on_right():
turn_right()
move()
elif front_is_clear():
move()
elif wall_in_front():
jump()

this also can be the code for that

tsunithkumar
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
count=0
while(not at_goal()):
if(wall_in_front()):
turn_left()
move()
turn_right()
count=count+1
else:
move()
if(count>0):
turn_right()
for i in range(count):
move()
turn_left()
count=0

murakondamanasa
Автор

def right():
turn_left()
turn_left()
turn_left()

def wall_right():

while wall_on_right():
move()
else:
jump()


def jump():
right()
move()
right()
move()
while front_is_clear():
move()
else:
turn_left()


while not at_goal():
if wall_in_front():
turn_left()
move()
wall_right()
else:
move()

TheaSerola
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
while not at_goal():
if right_is_clear():
turn_right()
move()
elif wall_in_front():
turn_left()
if wall_in_front():
turn_left()
move()
else:
move()
else:
move()

falahmpm
Автор

def turn_right():
turn_left()
turn_left()
turn_left()
def check_condition():
if right_is_clear():
turn_right()
move()
turn_right()
move()
elif wall_in_front():
turn_left()
elif wall_on_right():
move()
while not at_goal():
check_condition()

karthikeyasarma