Trouble with if in python

后端 未结 4 1503
刺人心
刺人心 2021-01-24 01:36

Hey just starting to learn python and got some problems already I made a code with an if statement It should work but it isn\'t working can someone fix it and tell me what I did

4条回答
  •  南方客
    南方客 (楼主)
    2021-01-24 01:59

    raw_input() function waits for user to input data , it is similar to scanf() function in C. But the data which you input is stored as string, so we need to convert into our specified form like integer, float etc

    Ex: y = raw_input("Enter data");

    to convert the data into integer we need to use

    y = int(y)
    

    in the similar way we can convert into different datatypes

提交回复
热议问题