Girilen sayının int olup olmadığını kontrol etmek için bir if ifadesi oluşturmak istiyorum. Ben bir girişi böldüğümde ne yapacağımı bilmiyorum (3 ve 3 ile bir tane oluşturuldunuz). Bunu istiyorum, böylece bir harf girerseniz, bir hata mesajı üretmez. ,Bir sayının int veya str python olup olmadığını nasıl kontrol edilir
while directionloop ==0:
while DAmountLoop==0:
direction=input('How do you want to move? Your answer should look like this 4u, this moves you up 4: ')
directiondirection=str(direction[1])
directionamount=(direction[0])
if type(directionamount) != int:
print('You need to enter a number for the amount you want to move')
elif type(directionamount) == int:
directionamount=int(direction[0])
DAmountLoop=1
"Girdi" kullanırsanız, – kmario23