I'm new to Python, and I'm trying to learn how to code simple String algorithms from my knowledge of Java. I'm trying to recreate this code segment in Python from Java:
Java:
import java.util.Scanner;
public class test
{
public static void main(String[] args)
{
Scanner input = new Scanner(System.in);
String[] list = {"Yes", "No", "Maybe", "So"};
String userInput = input.nextLine();
for(int i = 0; i < list.length; i++)
{
if(userInput.equals(list[i]))
{
System.out.println("oh baby");
}
}
}
}
And here is my recreation in Python:
list = ["Yes", "No", "Maybe", "So"]
userInput = input()
for i in range(len(list)):
if userInput is list[i]:
print("oh baby")
but for some reason...in Python, it seems to not want to pass through the if statement.