Q&A Discussions
Why does an error pop up here:
var1 = "Trey"
var2 = "Tanner"
var3 = "Ellis"
var4 = "Jake"
var5 = "Christine"
question = input('What is your name? ')
if question == "var1":
print('Welcome Back Trey')
Error:
Traceback (most recent call last):
File "Hi.py", line 6, in <module>
question = input('What is your name? ')
File "<string>", line 1, in <module>
NameError: name 'Trey' is not defined
0 Votes
10 AnswersHello guys right now I am kinda of new in python
my question is related to the function call len()
len() its print out the character but here it's the confusing part, I am working with a list let me explain an example
players
['lee', 'bob', 'moe', 'joe']
len(players)
4
why it's giving me 4 item in the list I thought len it counts the characters and if I do this it give me the correct somewhat answer what I am seeking,
len(players [-1])
3
0 Votes
8 Answers
so although using srand(time(0)) can be used to get truly random numbers, how truly random are they? For example, if one were to call this method at the same time (in this example, if one were to use this command at 51s) each time would the numbers generated be the same???
If so, are the numbers still truly random??
And if this theory is true, how can one generate truly random numbers that cannot repeat based on external variables (e.g., time)?
2 Votes
4 Answers#include <iostream>
using namespace std;
class A{
public:
void f1();
};
class B : public A{
public:
virtual void f1();
}
int main()
{
A * obj = new B;
obj.f1();
}
Ques: can we write virtual before an overridden function from the base class?? if yes which f1() should it call base class f1() or derived class f1()???
0 Votes
1 AnswerHot today
Sticky position
3 Votes
Help please?
3 Votes
Ejercicio Pytho
0 Votes
Online voting system
2 Votes
What is that z for
0 Votes
Suggestions needed
4 Votes
SQL practice
2 Votes